Skip to content

Commit 2616f57

Browse files
philmdcminyard
authored andcommitted
hw/i2c: Rename i2c_realize_and_unref() as i2c_slave_realize_and_unref()
The other i2c functions are called i2c_slave_FOO(). Rename as i2c_slave_realize_and_unref() to be consistent. Suggested-by: Markus Armbruster <[email protected]> Reviewed-by: Corey Minyard <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
1 parent db437ca commit 2616f57

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

hw/arm/aspeed.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,9 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
515515
/* Bus 3: TODO dps310@76 */
516516
dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
517517
qdev_prop_set_string(dev, "description", "pca1");
518-
i2c_realize_and_unref(dev, aspeed_i2c_get_bus(&soc->i2c, 3),
519-
&error_fatal);
518+
i2c_slave_realize_and_unref(I2C_SLAVE(dev),
519+
aspeed_i2c_get_bus(&soc->i2c, 3),
520+
&error_fatal);
520521

521522
i2c_create_slave(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x4c);
522523
i2c_create_slave(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x4c);
@@ -533,8 +534,9 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
533534
eeprom_buf);
534535
dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
535536
qdev_prop_set_string(dev, "description", "pca0");
536-
i2c_realize_and_unref(dev, aspeed_i2c_get_bus(&soc->i2c, 11),
537-
&error_fatal);
537+
i2c_slave_realize_and_unref(I2C_SLAVE(dev),
538+
aspeed_i2c_get_bus(&soc->i2c, 11),
539+
&error_fatal);
538540
/* Bus 11: TODO ucd90160@64 */
539541
}
540542

hw/i2c/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,16 @@ I2CSlave *i2c_slave_new(const char *name, uint8_t addr)
276276
return I2C_SLAVE(dev);
277277
}
278278

279-
bool i2c_realize_and_unref(DeviceState *dev, I2CBus *bus, Error **errp)
279+
bool i2c_slave_realize_and_unref(I2CSlave *dev, I2CBus *bus, Error **errp)
280280
{
281-
return qdev_realize_and_unref(dev, &bus->qbus, errp);
281+
return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
282282
}
283283

284284
DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr)
285285
{
286286
I2CSlave *dev = i2c_slave_new(name, addr);
287287

288-
i2c_realize_and_unref(DEVICE(dev), bus, &error_fatal);
288+
i2c_slave_realize_and_unref(dev, bus, &error_fatal);
289289

290290
return DEVICE(dev);
291291
}

include/hw/i2c/i2c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ uint8_t i2c_recv(I2CBus *bus);
8181

8282
I2CSlave *i2c_slave_new(const char *name, uint8_t addr);
8383
DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
84-
bool i2c_realize_and_unref(DeviceState *dev, I2CBus *bus, Error **errp);
84+
bool i2c_slave_realize_and_unref(I2CSlave *dev, I2CBus *bus, Error **errp);
8585

8686
/* lm832x.c */
8787
void lm832x_key_event(DeviceState *dev, int key, int state);

0 commit comments

Comments
 (0)