static struct i2c_dev_desc *
i3c_master_alloc_i2c_dev(struct i3c_master_controller *master,
- const struct i2c_dev_boardinfo *boardinfo)
+ u16 addr, u8 lvr)
{
struct i2c_dev_desc *dev;
return ERR_PTR(-ENOMEM);
dev->common.master = master;
- dev->boardinfo = boardinfo;
- dev->addr = boardinfo->base.addr;
- dev->lvr = boardinfo->lvr;
+ dev->addr = addr;
+ dev->lvr = lvr;
return dev;
}
struct i2c_dev_desc *dev;
i3c_bus_for_each_i2cdev(&master->bus, dev) {
- if (dev->boardinfo->base.addr == addr)
+ if (dev->addr == addr)
return dev;
}
i2cboardinfo->base.addr,
I3C_ADDR_SLOT_I2C_DEV);
- i2cdev = i3c_master_alloc_i2c_dev(master, i2cboardinfo);
+ i2cdev = i3c_master_alloc_i2c_dev(master,
+ i2cboardinfo->base.addr,
+ i2cboardinfo->lvr);
if (IS_ERR(i2cdev)) {
ret = PTR_ERR(i2cdev);
goto err_detach_devs;
{
struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
struct i2c_dev_desc *i2cdev;
+ struct i2c_dev_boardinfo *i2cboardinfo;
int ret;
adap->dev.parent = master->dev.parent;
* We silently ignore failures here. The bus should keep working
* correctly even if one or more i2c devices are not registered.
*/
- i3c_bus_for_each_i2cdev(&master->bus, i2cdev)
- i2cdev->dev = i2c_new_client_device(adap, &i2cdev->boardinfo->base);
+ list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node)
+ i2cdev->dev = i2c_new_client_device(adap, &i2cboardinfo->base);
return 0;
}