[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] hw/i2c: Rename i2c_realize_and_unref() as i2c_slave_real
From: |
Corey Minyard |
Subject: |
Re: [PATCH 3/5] hw/i2c: Rename i2c_realize_and_unref() as i2c_slave_realize_and_unref() |
Date: |
Mon, 29 Jun 2020 16:29:35 -0500 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Mon, Jun 29, 2020 at 07:38:19PM +0200, Philippe Mathieu-Daudé wrote:
> The other i2c functions are called i2c_slave_FOO(). Rename as
> i2c_slave_realize_and_unref() to be consistent.
Reviewed-by: Corey Minyard <cminyard@mvista.com>
>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> include/hw/i2c/i2c.h | 2 +-
> hw/arm/aspeed.c | 10 ++++++----
> hw/i2c/core.c | 6 +++---
> 3 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
> index 18efc668f1..cb7211f027 100644
> --- a/include/hw/i2c/i2c.h
> +++ b/include/hw/i2c/i2c.h
> @@ -81,7 +81,7 @@ uint8_t i2c_recv(I2CBus *bus);
>
> I2CSlave *i2c_slave_new(const char *name, uint8_t addr);
> DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
> -bool i2c_realize_and_unref(DeviceState *dev, I2CBus *bus, Error **errp);
> +bool i2c_slave_realize_and_unref(I2CSlave *dev, I2CBus *bus, Error **errp);
>
> /* lm832x.c */
> void lm832x_key_event(DeviceState *dev, int key, int state);
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 54ca36e0b6..ed14e79f57 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -515,8 +515,9 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState
> *bmc)
> /* Bus 3: TODO dps310@76 */
> dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
> qdev_prop_set_string(dev, "description", "pca1");
> - i2c_realize_and_unref(dev, aspeed_i2c_get_bus(&soc->i2c, 3),
> - &error_fatal);
> + i2c_slave_realize_and_unref(I2C_SLAVE(dev),
> + aspeed_i2c_get_bus(&soc->i2c, 3),
> + &error_fatal);
>
> i2c_create_slave(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x4c);
> i2c_create_slave(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x4c);
> @@ -533,8 +534,9 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState
> *bmc)
> eeprom_buf);
> dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
> qdev_prop_set_string(dev, "description", "pca0");
> - i2c_realize_and_unref(dev, aspeed_i2c_get_bus(&soc->i2c, 11),
> - &error_fatal);
> + i2c_slave_realize_and_unref(I2C_SLAVE(dev),
> + aspeed_i2c_get_bus(&soc->i2c, 11),
> + &error_fatal);
> /* Bus 11: TODO ucd90160@64 */
> }
>
> diff --git a/hw/i2c/core.c b/hw/i2c/core.c
> index 6eacb4a463..135ea56036 100644
> --- a/hw/i2c/core.c
> +++ b/hw/i2c/core.c
> @@ -276,16 +276,16 @@ I2CSlave *i2c_slave_new(const char *name, uint8_t addr)
> return I2C_SLAVE(dev);
> }
>
> -bool i2c_realize_and_unref(DeviceState *dev, I2CBus *bus, Error **errp)
> +bool i2c_slave_realize_and_unref(I2CSlave *dev, I2CBus *bus, Error **errp)
> {
> - return qdev_realize_and_unref(dev, &bus->qbus, errp);
> + return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
> }
>
> DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr)
> {
> DeviceState *dev = DEVICE(i2c_slave_new(name, addr));
>
> - i2c_realize_and_unref(I2C_SLAVE(dev), bus, &error_fatal);
> + i2c_slave_realize_and_unref(I2C_SLAVE(dev), bus, &error_fatal);
>
> return dev;
> }
> --
> 2.21.3
>
>
- [PATCH 0/5] hw/i2c: Rename method names for consistency and add documentation, Philippe Mathieu-Daudé, 2020/06/29
- [PATCH 1/5] hw/i2c/aspeed_i2c: Simplify aspeed_i2c_get_bus(), Philippe Mathieu-Daudé, 2020/06/29
- [PATCH 2/5] hw/i2c: Rename i2c_try_create_slave() as i2c_slave_new(), Philippe Mathieu-Daudé, 2020/06/29
- [PATCH 3/5] hw/i2c: Rename i2c_realize_and_unref() as i2c_slave_realize_and_unref(), Philippe Mathieu-Daudé, 2020/06/29
- Re: [PATCH 3/5] hw/i2c: Rename i2c_realize_and_unref() as i2c_slave_realize_and_unref(),
Corey Minyard <=
- [PATCH 4/5] hw/i2c: Rename i2c_create_slave() as i2c_slave_create_simple(), Philippe Mathieu-Daudé, 2020/06/29
- [PATCH 5/5] hw/i2c: Document the I2C qdev helpers, Philippe Mathieu-Daudé, 2020/06/29
- Re: [PATCH 0/5] hw/i2c: Rename method names for consistency and add documentation, Corey Minyard, 2020/06/29