“4a491b1ab11ca0556d2fda1ff1301e862a2d44c4”上不存在“...scsi/git@gitcode.net:openeuler/raspberrypi-kernel.git”
提交 390c97dc 编写于 作者: J Jacek Anaszewski

leds: pca955x: Prevent crippled LED device name

In case platform data provided empty LED name string the resulting
LED class device name would be crippled. Use corresponding LED chip
bit in place of "function" segment of LED class device name then to
make the LEDs at least distinguishable.
Signed-off-by: NJacek Anaszewski <jacek.anaszewski@gmail.com>
Reported-by: NColin King <colin.king@canonical.com>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Suggested-by: NNate Case <ncase@xes-inc.com>
上级 430e48ec
......@@ -473,10 +473,14 @@ static int pca955x_probe(struct i2c_client *client,
* Platform data can specify LED names and
* default triggers
*/
if (pdata->leds[i].name)
snprintf(pca955x_led->name,
sizeof(pca955x_led->name), "pca955x:%s",
pdata->leds[i].name);
if (pdata->leds[i].name[0] == '\0')
snprintf(pdata->leds[i].name,
sizeof(pdata->leds[i].name), "%d", i);
snprintf(pca955x_led->name,
sizeof(pca955x_led->name), "pca955x:%s",
pdata->leds[i].name);
if (pdata->leds[i].default_trigger)
pca955x_led->led_cdev.default_trigger =
pdata->leds[i].default_trigger;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册