[PATCH linux dev-4.10 v2 1/3] i2c: fsi: Remove ida counter

Eddie James eajames at linux.vnet.ibm.com
Sat Jul 8 07:44:45 AEST 2017


From: "Edward A. James" <eajames at us.ibm.com>

It's not clear what the intention is. Regardless, it is not necessary so
remove it.

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 | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index b4eb102..e655ad0 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);
 
 	if (dev->of_node) {
@@ -575,12 +573,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;
@@ -599,8 +591,8 @@ static int fsi_i2c_probe(struct device *dev)
 				port_no;
 
 			snprintf(port->adapter.name,
-				 sizeof(port->adapter.name),
-				 "fsi_i2c-%u", port_no);
+				 sizeof(port->adapter.name), "fsi_i2c-%u",
+				 port_no);
 
 			rc = i2c_add_numbered_adapter(&port->adapter);
 			if (rc < 0)
@@ -628,8 +620,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;
-- 
1.8.3.1



More information about the openbmc mailing list