The bitbang i2c implementation is also useful for other device models
such as DDC in display controllers. Move the header to include/hw/i2c/
to allow it to be used from other device models and adjust users of
this include. This also reverts commit 2b4c1125ac which is no longer
needed.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/i2c/bitbang_i2c.c | 2 +-
hw/i2c/ppc4xx_i2c.c | 1 -
hw/i2c/versatile_i2c.c | 2 +-
{hw => include/hw}/i2c/bitbang_i2c.h | 2 ++
include/hw/i2c/i2c.h | 2 --
include/hw/i2c/ppc4xx_i2c.h | 2 +-
6 files changed, 5 insertions(+), 6 deletions(-)
rename {hw => include/hw}/i2c/bitbang_i2c.h (80%)
diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index 8be88ee265..b3534a3bd4 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -11,7 +11,7 @@
*/
#include "qemu/osdep.h"
#include "hw/hw.h"
-#include "bitbang_i2c.h"
+#include "hw/i2c/bitbang_i2c.h"
#include "hw/sysbus.h"
//#define DEBUG_BITBANG_I2C
diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c
index d6dfafab31..a907d0194e 100644
--- a/hw/i2c/ppc4xx_i2c.c
+++ b/hw/i2c/ppc4xx_i2c.c
@@ -30,7 +30,6 @@
#include "cpu.h"
#include "hw/hw.h"
#include "hw/i2c/ppc4xx_i2c.h"
-#include "bitbang_i2c.h"
#define PPC4xx_I2C_MEM_SIZE 18
diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
index da9f298ee5..39cbcf1948 100644
--- a/hw/i2c/versatile_i2c.c
+++ b/hw/i2c/versatile_i2c.c
@@ -23,7 +23,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "bitbang_i2c.h"
+#include "hw/i2c/bitbang_i2c.h"
#include "qemu/log.h"
#define TYPE_VERSATILE_I2C "versatile_i2c"
diff --git a/hw/i2c/bitbang_i2c.h b/include/hw/i2c/bitbang_i2c.h
similarity index 80%
rename from hw/i2c/bitbang_i2c.h
rename to include/hw/i2c/bitbang_i2c.h
index 9443021710..3a7126d5de 100644
--- a/hw/i2c/bitbang_i2c.h
+++ b/include/hw/i2c/bitbang_i2c.h
@@ -3,6 +3,8 @@
#include "hw/i2c/i2c.h"
+typedef struct bitbang_i2c_interface bitbang_i2c_interface;
+
#define BITBANG_I2C_SDA 0
#define BITBANG_I2C_SCL 1
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index 8e236f7bb4..75c5bd638b 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -81,8 +81,6 @@ uint8_t i2c_recv(I2CBus *bus);
DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
-typedef struct bitbang_i2c_interface bitbang_i2c_interface;
-
/* lm832x.c */
void lm832x_key_event(DeviceState *dev, int key, int state);
diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h
index b3450bacf7..368a5598fe 100644
--- a/include/hw/i2c/ppc4xx_i2c.h
+++ b/include/hw/i2c/ppc4xx_i2c.h
@@ -29,7 +29,7 @@
#include "qemu-common.h"
#include "hw/sysbus.h"
-#include "hw/i2c/i2c.h"
+#include "hw/i2c/bitbang_i2c.h"
#define TYPE_PPC4xx_I2C "ppc4xx-i2c"
#define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
--
2.13.7
On Sat, Mar 16, 2019 at 01:05:57PM +0100, BALATON Zoltan wrote:
> The bitbang i2c implementation is also useful for other device models
> such as DDC in display controllers. Move the header to include/hw/i2c/
> to allow it to be used from other device models and adjust users of
> this include. This also reverts commit 2b4c1125ac which is no longer
> needed.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
This looks good to me:
Reviewed-by: Corey Minyard <cminyard@mvista.com>
> ---
> hw/i2c/bitbang_i2c.c | 2 +-
> hw/i2c/ppc4xx_i2c.c | 1 -
> hw/i2c/versatile_i2c.c | 2 +-
> {hw => include/hw}/i2c/bitbang_i2c.h | 2 ++
> include/hw/i2c/i2c.h | 2 --
> include/hw/i2c/ppc4xx_i2c.h | 2 +-
> 6 files changed, 5 insertions(+), 6 deletions(-)
> rename {hw => include/hw}/i2c/bitbang_i2c.h (80%)
>
> diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
> index 8be88ee265..b3534a3bd4 100644
> --- a/hw/i2c/bitbang_i2c.c
> +++ b/hw/i2c/bitbang_i2c.c
> @@ -11,7 +11,7 @@
> */
> #include "qemu/osdep.h"
> #include "hw/hw.h"
> -#include "bitbang_i2c.h"
> +#include "hw/i2c/bitbang_i2c.h"
> #include "hw/sysbus.h"
>
> //#define DEBUG_BITBANG_I2C
> diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c
> index d6dfafab31..a907d0194e 100644
> --- a/hw/i2c/ppc4xx_i2c.c
> +++ b/hw/i2c/ppc4xx_i2c.c
> @@ -30,7 +30,6 @@
> #include "cpu.h"
> #include "hw/hw.h"
> #include "hw/i2c/ppc4xx_i2c.h"
> -#include "bitbang_i2c.h"
>
> #define PPC4xx_I2C_MEM_SIZE 18
>
> diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
> index da9f298ee5..39cbcf1948 100644
> --- a/hw/i2c/versatile_i2c.c
> +++ b/hw/i2c/versatile_i2c.c
> @@ -23,7 +23,7 @@
>
> #include "qemu/osdep.h"
> #include "hw/sysbus.h"
> -#include "bitbang_i2c.h"
> +#include "hw/i2c/bitbang_i2c.h"
> #include "qemu/log.h"
>
> #define TYPE_VERSATILE_I2C "versatile_i2c"
> diff --git a/hw/i2c/bitbang_i2c.h b/include/hw/i2c/bitbang_i2c.h
> similarity index 80%
> rename from hw/i2c/bitbang_i2c.h
> rename to include/hw/i2c/bitbang_i2c.h
> index 9443021710..3a7126d5de 100644
> --- a/hw/i2c/bitbang_i2c.h
> +++ b/include/hw/i2c/bitbang_i2c.h
> @@ -3,6 +3,8 @@
>
> #include "hw/i2c/i2c.h"
>
> +typedef struct bitbang_i2c_interface bitbang_i2c_interface;
> +
> #define BITBANG_I2C_SDA 0
> #define BITBANG_I2C_SCL 1
>
> diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
> index 8e236f7bb4..75c5bd638b 100644
> --- a/include/hw/i2c/i2c.h
> +++ b/include/hw/i2c/i2c.h
> @@ -81,8 +81,6 @@ uint8_t i2c_recv(I2CBus *bus);
>
> DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
>
> -typedef struct bitbang_i2c_interface bitbang_i2c_interface;
> -
> /* lm832x.c */
> void lm832x_key_event(DeviceState *dev, int key, int state);
>
> diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h
> index b3450bacf7..368a5598fe 100644
> --- a/include/hw/i2c/ppc4xx_i2c.h
> +++ b/include/hw/i2c/ppc4xx_i2c.h
> @@ -29,7 +29,7 @@
>
> #include "qemu-common.h"
> #include "hw/sysbus.h"
> -#include "hw/i2c/i2c.h"
> +#include "hw/i2c/bitbang_i2c.h"
>
> #define TYPE_PPC4xx_I2C "ppc4xx-i2c"
> #define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
> --
> 2.13.7
>
© 2016 - 2026 Red Hat, Inc.