[PATCH linux dev-4.10 2/4] i2c: fsi: Dynamically allocate port numbers
Eddie James
eajames at linux.vnet.ibm.com
Sat Jul 8 06:03:27 AEST 2017
On 07/06/2017 09:35 AM, Joel Stanley wrote:
> 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.
Acked-by: Eddie James <eajames at linux.vnet.ibm.com>
>
> Signed-off-by: Joel Stanley <joel at jms.id.au>
> ---
> 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 da045777624e..349bea0e2a63 100644
> --- a/drivers/i2c/busses/i2c-fsi.c
> +++ b/drivers/i2c/busses/i2c-fsi.c
> @@ -584,14 +584,11 @@ static int fsi_i2c_probe(struct device *dev)
> port->adapter.algo = &fsi_i2c_algorithm;
> 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;
>
More information about the openbmc
mailing list