[PATCH 1/2] mfd stmpe: add index to devicename

Sascha Hauer s.hauer at pengutronix.de
Thu Nov 29 14:02:47 EST 2012


Otherwise it's not possible to register multiple stmpe devices.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mfd/stmpe-i2c.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index d7c29cc..7d16842 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -118,7 +118,8 @@ static int stmpe_probe(struct device_d *dev)
 	}
 
 	stmpe_dev = xzalloc(sizeof(struct stmpe));
-	stmpe_dev->cdev.name = DRIVERNAME;
+	stmpe_dev->cdev.name = asprintf(DRIVERNAME "%d",
+			cdev_find_free_index(DRIVERNAME));
 	stmpe_dev->client = to_i2c_client(dev);
 	stmpe_dev->cdev.size = 191;		/* 191 known registers */
 	stmpe_dev->cdev.dev = dev;
-- 
1.7.10.4




More information about the barebox mailing list