Commit 99faa48a authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: cros_ec_keyb - use device core to create driver-specific device attributes

Instead of creating driver-specific device attributes with
devm_device_add_group() have device core do this by setting up dev_groups
pointer in the driver structure.
Reviewed-by: default avatarGuenter Roeck <groeck@chromium.org>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230729005133.1095051-1-dmitry.torokhov@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 34069d12
...@@ -686,10 +686,11 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj, ...@@ -686,10 +686,11 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj,
return attr->mode; return attr->mode;
} }
static const struct attribute_group cros_ec_keyb_attr_group = { static const struct attribute_group cros_ec_keyb_group = {
.is_visible = cros_ec_keyb_attr_is_visible, .is_visible = cros_ec_keyb_attr_is_visible,
.attrs = cros_ec_keyb_attrs, .attrs = cros_ec_keyb_attrs,
}; };
__ATTRIBUTE_GROUPS(cros_ec_keyb);
static int cros_ec_keyb_probe(struct platform_device *pdev) static int cros_ec_keyb_probe(struct platform_device *pdev)
{ {
...@@ -730,12 +731,6 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) ...@@ -730,12 +731,6 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
return err; return err;
} }
err = devm_device_add_group(dev, &cros_ec_keyb_attr_group);
if (err) {
dev_err(dev, "failed to create attributes: %d\n", err);
return err;
}
ckdev->notifier.notifier_call = cros_ec_keyb_work; ckdev->notifier.notifier_call = cros_ec_keyb_work;
err = blocking_notifier_chain_register(&ckdev->ec->event_notifier, err = blocking_notifier_chain_register(&ckdev->ec->event_notifier,
&ckdev->notifier); &ckdev->notifier);
...@@ -782,6 +777,7 @@ static struct platform_driver cros_ec_keyb_driver = { ...@@ -782,6 +777,7 @@ static struct platform_driver cros_ec_keyb_driver = {
.remove = cros_ec_keyb_remove, .remove = cros_ec_keyb_remove,
.driver = { .driver = {
.name = "cros-ec-keyb", .name = "cros-ec-keyb",
.dev_groups = cros_ec_keyb_groups,
.of_match_table = of_match_ptr(cros_ec_keyb_of_match), .of_match_table = of_match_ptr(cros_ec_keyb_of_match),
.acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match), .acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match),
.pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops), .pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment