2016-10-06 12:30:08

by Robin van der Gracht

[permalink] [raw]
Subject: [PATCH] auxdisplay: ht16k33: Use unique i2c client device name

Static naming causes problems when multiple devices are registered.

Signed-off-by: Robin van der Gracht <[email protected]>
---
drivers/auxdisplay/ht16k33.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index eeb323f..9c09bbc 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -345,6 +345,7 @@ static int ht16k33_probe(struct i2c_client *client,
struct ht16k33_keypad *keypad;
struct ht16k33_fbdev *fbdev;
struct device_node *node = client->dev.of_node;
+ const char *dev_id = dev_name(&client->dev);

if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "i2c_check_functionality error\n");
@@ -365,7 +366,7 @@ static int ht16k33_probe(struct i2c_client *client,
fbdev = &priv->fbdev;
keypad = &priv->keypad;

- priv->workqueue = create_singlethread_workqueue(DRIVER_NAME "-wq");
+ priv->workqueue = create_singlethread_workqueue(dev_id);
if (priv->workqueue == NULL)
return -ENOMEM;

@@ -422,7 +423,7 @@ static int ht16k33_probe(struct i2c_client *client,
goto err_fbdev_unregister;
}

- keypad->dev->name = DRIVER_NAME"-keypad";
+ keypad->dev->name = dev_id;
keypad->dev->id.bustype = BUS_I2C;
keypad->dev->open = ht16k33_keypad_start;
keypad->dev->close = ht16k33_keypad_stop;
@@ -476,7 +477,7 @@ static int ht16k33_probe(struct i2c_client *client,
bl_props.type = BACKLIGHT_RAW;
bl_props.max_brightness = MAX_BRIGHTNESS;

- bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl",
+ bl = devm_backlight_device_register(&client->dev, dev_id,
&client->dev, priv,
&ht16k33_bl_ops, &bl_props);
if (IS_ERR(bl)) {
--
2.7.4