Message ID | 20170706143503.21888-2-joel@jms.id.au |
---|---|
State | Accepted, archived |
Headers | show |
On 07/06/2017 09:35 AM, Joel Stanley wrote: > It's not clear what the intention is. Regardless, it is not necessary so > remove it. Looks good and tests fine, patch doesn't apply as-is to dev-4.10 though. Acked-by: Eddie James <eajames@linux.vnet.ibm.com> > > Signed-off-by: Joel Stanley <joel@jms.id.au> > --- > drivers/i2c/busses/i2c-fsi.c | 17 +++-------------- > 1 file changed, 3 insertions(+), 14 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c > index 01816466ec86..da045777624e 100644 > --- a/drivers/i2c/busses/i2c-fsi.c > +++ b/drivers/i2c/busses/i2c-fsi.c > @@ -135,7 +135,6 @@ struct fsi_i2c_master { > int idx; > u8 fifo_size; > struct list_head ports; > - struct ida ida; > wait_queue_head_t wait; > struct semaphore lock; > }; > @@ -554,7 +553,7 @@ static int fsi_i2c_probe(struct device *dev) > struct fsi_i2c_master *i2c; > struct fsi_i2c_port *port; > struct device_node *np; > - int rc, idx; > + int rc; > u32 port_no; > > i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); > @@ -565,7 +564,6 @@ static int fsi_i2c_probe(struct device *dev) > sema_init(&i2c->lock, 1); > i2c->fsi = to_fsi_dev(dev); > i2c->idx = ida_simple_get(&fsi_i2c_ida, 1, INT_MAX, GFP_KERNEL); > - ida_init(&i2c->ida); > INIT_LIST_HEAD(&i2c->ports); > > /* add adapter for each i2c port of the master */ > @@ -574,12 +572,6 @@ static int fsi_i2c_probe(struct device *dev) > if (rc || port_no > 0xFFFF) > continue; > > - /* make sure we don't overlap index with a buggy dts */ > - idx = ida_simple_get(&i2c->ida, port_no, > - port_no + 1, GFP_KERNEL); > - if (idx < 0) > - continue; > - > port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); > if (!port) > return -ENOMEM; > @@ -596,9 +588,8 @@ static int fsi_i2c_probe(struct device *dev) > port->adapter.nr = (i2c->idx * I2C_MASTER_NR_OFFSET) + > port_no; > > - snprintf(port->adapter.name, > - sizeof(port->adapter.name), > - "fsi%d_i2c%u", i2c->idx, port_no); > + snprintf(port->adapter.name, sizeof(port->adapter.name), > + "fsi_i2c%u", port_no); > > rc = i2c_add_numbered_adapter(&port->adapter); > if (rc < 0) > @@ -625,8 +616,6 @@ static int fsi_i2c_remove(struct device *dev) > i2c_del_adapter(&port->adapter); > } > > - ida_destroy(&i2c->ida); > - > ida_simple_remove(&fsi_i2c_ida, i2c->idx); > > return 0;
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 01816466ec86..da045777624e 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -135,7 +135,6 @@ struct fsi_i2c_master { int idx; u8 fifo_size; struct list_head ports; - struct ida ida; wait_queue_head_t wait; struct semaphore lock; }; @@ -554,7 +553,7 @@ static int fsi_i2c_probe(struct device *dev) struct fsi_i2c_master *i2c; struct fsi_i2c_port *port; struct device_node *np; - int rc, idx; + int rc; u32 port_no; i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); @@ -565,7 +564,6 @@ static int fsi_i2c_probe(struct device *dev) sema_init(&i2c->lock, 1); i2c->fsi = to_fsi_dev(dev); i2c->idx = ida_simple_get(&fsi_i2c_ida, 1, INT_MAX, GFP_KERNEL); - ida_init(&i2c->ida); INIT_LIST_HEAD(&i2c->ports); /* add adapter for each i2c port of the master */ @@ -574,12 +572,6 @@ static int fsi_i2c_probe(struct device *dev) if (rc || port_no > 0xFFFF) continue; - /* make sure we don't overlap index with a buggy dts */ - idx = ida_simple_get(&i2c->ida, port_no, - port_no + 1, GFP_KERNEL); - if (idx < 0) - continue; - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); if (!port) return -ENOMEM; @@ -596,9 +588,8 @@ static int fsi_i2c_probe(struct device *dev) port->adapter.nr = (i2c->idx * I2C_MASTER_NR_OFFSET) + port_no; - snprintf(port->adapter.name, - sizeof(port->adapter.name), - "fsi%d_i2c%u", i2c->idx, port_no); + snprintf(port->adapter.name, sizeof(port->adapter.name), + "fsi_i2c%u", port_no); rc = i2c_add_numbered_adapter(&port->adapter); if (rc < 0) @@ -625,8 +616,6 @@ static int fsi_i2c_remove(struct device *dev) i2c_del_adapter(&port->adapter); } - ida_destroy(&i2c->ida); - ida_simple_remove(&fsi_i2c_ida, i2c->idx); return 0;
It's not clear what the intention is. Regardless, it is not necessary so remove it. Signed-off-by: Joel Stanley <joel@jms.id.au> --- drivers/i2c/busses/i2c-fsi.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)