[PATCH linux dev-4.10 v2 2/3] i2c: fsi: Dynamically allocate port numbers
Eddie James
eajames at linux.vnet.ibm.com
Sat Jul 8 07:44:46 AEST 2017
From: "Edward A. James" <eajames at us.ibm.com>
The static allocation can collide if there are already devices
registered at the adapter number. Dynamic allocation is safer.
Users who wish to ensure a port appears at a specific number can use the
device tree alias feature.
Signed-off-by: Joel Stanley <joel at jms.id.au>
Signed-off-by: Edward A. James <eajames at us.ibm.com>
---
drivers/i2c/busses/i2c-fsi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index e655ad0..7e03f3a 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -586,15 +586,12 @@ static int fsi_i2c_probe(struct device *dev)
port->adapter.bus_recovery_info =
&fsi_i2c_bus_recovery_info;
port->adapter.algo_data = port;
- /* number ports uniquely */
- port->adapter.nr = (i2c->idx * I2C_MASTER_NR_OFFSET) +
- port_no;
snprintf(port->adapter.name,
sizeof(port->adapter.name), "fsi_i2c-%u",
port_no);
- rc = i2c_add_numbered_adapter(&port->adapter);
+ rc = i2c_add_adapter(&port->adapter);
if (rc < 0)
return rc;
--
1.8.3.1
More information about the openbmc
mailing list