diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-07-24 08:28:59 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-07-29 04:04:00 +0300 |
commit | 0410595e23f8eb801301ee3e44597d3a780b6285 (patch) | |
tree | 61027eda1d52200df499242694822d42c17fa471 /drivers/input | |
parent | 3e4bb047b23375a34dbf5885709ac3729d9cfb22 (diff) | |
download | linux-0410595e23f8eb801301ee3e44597d3a780b6285.tar.xz |
Input: lm8323 - rely on device core to create kp_disable attribute
Device core now has facilities to create driver-specific device attributes
as part of driver probing, use them.
Link: https://lore.kernel.org/r/20230724052901.350240-1-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/lm8323.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c index 3964f6e0f6af..d5195415533a 100644 --- a/drivers/input/keyboard/lm8323.c +++ b/drivers/input/keyboard/lm8323.c @@ -615,6 +615,12 @@ static ssize_t lm8323_set_disable(struct device *dev, } static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable); +static struct attribute *lm8323_attrs[] = { + &dev_attr_disable_kp.attr, + NULL, +}; +ATTRIBUTE_GROUPS(lm8323); + static int lm8323_probe(struct i2c_client *client) { struct lm8323_platform_data *pdata = dev_get_platdata(&client->dev); @@ -696,9 +702,6 @@ static int lm8323_probe(struct i2c_client *client) } lm->kp_enabled = true; - err = device_create_file(&client->dev, &dev_attr_disable_kp); - if (err < 0) - goto fail2; idev->name = pdata->name ? : "LM8323 keypad"; snprintf(lm->phys, sizeof(lm->phys), @@ -719,14 +722,14 @@ static int lm8323_probe(struct i2c_client *client) err = input_register_device(idev); if (err) { dev_dbg(&client->dev, "error registering input device\n"); - goto fail3; + goto fail2; } err = request_threaded_irq(client->irq, NULL, lm8323_irq, IRQF_TRIGGER_LOW|IRQF_ONESHOT, "lm8323", lm); if (err) { dev_err(&client->dev, "could not get IRQ %d\n", client->irq); - goto fail4; + goto fail3; } i2c_set_clientdata(client, lm); @@ -736,11 +739,9 @@ static int lm8323_probe(struct i2c_client *client) return 0; -fail4: +fail3: input_unregister_device(idev); idev = NULL; -fail3: - device_remove_file(&client->dev, &dev_attr_disable_kp); fail2: while (--pwm >= 0) if (lm->pwm[pwm].enabled) @@ -761,8 +762,6 @@ static void lm8323_remove(struct i2c_client *client) input_unregister_device(lm->idev); - device_remove_file(&lm->client->dev, &dev_attr_disable_kp); - for (i = 0; i < 3; i++) if (lm->pwm[i].enabled) led_classdev_unregister(&lm->pwm[i].cdev); @@ -823,8 +822,9 @@ static const struct i2c_device_id lm8323_id[] = { static struct i2c_driver lm8323_i2c_driver = { .driver = { - .name = "lm8323", - .pm = pm_sleep_ptr(&lm8323_pm_ops), + .name = "lm8323", + .pm = pm_sleep_ptr(&lm8323_pm_ops), + .dev_groups = lm8323_groups, }, .probe = lm8323_probe, .remove = lm8323_remove, |