lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20170816102635.25573-1-robin@protonic.nl>
Date:   Wed, 16 Aug 2017 12:26:35 +0200
From:   Robin van der Gracht <robin@...tonic.nl>
To:     linux-kernel@...r.kernel.org
Cc:     Miguel Ojeda Sandonis <miguel.ojeda.sandonis@...il.com>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Robin van der Gracht <robin@...tonic.nl>
Subject: [PATCH] auxdisplay: ht16k33: Use unique prefixed i2c client device name

Static naming causes problems when multiple devices are registered.

Reported-by: Michael Kaplan <M.KAPLAN@...a.com>
Signed-off-by: Robin van der Gracht <robin@...tonic.nl>
---

Michael Kaplan <M.KAPLAN@...a.com> reported the issue with his multiple
ht16k33 controller setup.

[  472.124385] sysfs: cannot create duplicate filename '/class/backlight/ht16k33-bl'

So we've got to get rid of the static device names for backlight and keypad.

I figured incoperating the i2c device name would make it generic enough.

The default device name if on i2c adapter 0 with addres 0x70 is '0-0070' which
might be fine for an input or framebuffer device, but IMO it looks odd for a
backlight device (/sys/class/backlight/0-0070/).

So I choose to prefix the default i2c device name (assigned in i2c-core.c) with
the driver name which will result in 'ht16k33-0-0070'.

 drivers/auxdisplay/ht16k33.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 99ce9731fc9c..674a6c0cec2a 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -339,7 +339,7 @@ static int ht16k33_keypad_probe(struct i2c_client *client,
 
 	input_set_drvdata(keypad->dev, keypad);
 
-	keypad->dev->name = DRIVER_NAME"-keypad";
+	keypad->dev->name = dev_name(&client->dev);
 	keypad->dev->id.bustype = BUS_I2C;
 	keypad->dev->open = ht16k33_keypad_start;
 	keypad->dev->close = ht16k33_keypad_stop;
@@ -421,6 +421,7 @@ static int ht16k33_probe(struct i2c_client *client,
 
 	priv->client = client;
 	i2c_set_clientdata(client, priv);
+	dev_set_name(&client->dev, DRIVER_NAME"-%s", dev_name(&client->dev));
 	fbdev = &priv->fbdev;
 
 	err = ht16k33_initialize(priv);
@@ -476,7 +477,8 @@ 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_name(&client->dev),
 					    &client->dev, priv,
 					    &ht16k33_bl_ops, &bl_props);
 	if (IS_ERR(bl)) {
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ