* [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes
@ 2023-07-29 0:51 Dmitry Torokhov
2023-07-29 2:40 ` Guenter Roeck
2023-07-30 11:39 ` Greg Kroah-Hartman
0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2023-07-29 0:51 UTC (permalink / raw)
To: linux-input
Cc: linux-kernel, Greg Kroah-Hartman, Benson Leung, Guenter Roeck,
chrome-platform
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.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/cros_ec_keyb.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index e7ecfca838df..313b7a69dd69 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -686,10 +686,11 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj,
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,
.attrs = cros_ec_keyb_attrs,
};
+__ATTRIBUTE_GROUPS(cros_ec_keyb);
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;
}
- 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;
err = blocking_notifier_chain_register(&ckdev->ec->event_notifier,
&ckdev->notifier);
@@ -782,6 +777,7 @@ static struct platform_driver cros_ec_keyb_driver = {
.remove = cros_ec_keyb_remove,
.driver = {
.name = "cros-ec-keyb",
+ .dev_groups = cros_ec_keyb_groups,
.of_match_table = of_match_ptr(cros_ec_keyb_of_match),
.acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match),
.pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops),
--
2.41.0.487.g6d72f3e995-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes
2023-07-29 0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
@ 2023-07-29 2:40 ` Guenter Roeck
2023-07-30 11:39 ` Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2023-07-29 2:40 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-input, linux-kernel, Greg Kroah-Hartman, Benson Leung,
Guenter Roeck, chrome-platform
On Fri, Jul 28, 2023 at 5:51 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
> ---
> drivers/input/keyboard/cros_ec_keyb.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index e7ecfca838df..313b7a69dd69 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -686,10 +686,11 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj,
> 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,
> .attrs = cros_ec_keyb_attrs,
> };
> +__ATTRIBUTE_GROUPS(cros_ec_keyb);
>
> 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;
> }
>
> - 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;
> err = blocking_notifier_chain_register(&ckdev->ec->event_notifier,
> &ckdev->notifier);
> @@ -782,6 +777,7 @@ static struct platform_driver cros_ec_keyb_driver = {
> .remove = cros_ec_keyb_remove,
> .driver = {
> .name = "cros-ec-keyb",
> + .dev_groups = cros_ec_keyb_groups,
> .of_match_table = of_match_ptr(cros_ec_keyb_of_match),
> .acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match),
> .pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops),
> --
> 2.41.0.487.g6d72f3e995-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes
2023-07-29 0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
2023-07-29 2:40 ` Guenter Roeck
@ 2023-07-30 11:39 ` Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-07-30 11:39 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-input, linux-kernel, Benson Leung, Guenter Roeck,
chrome-platform
On Fri, Jul 28, 2023 at 05:51:10PM -0700, Dmitry Torokhov wrote:
> 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.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/keyboard/cros_ec_keyb.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
All of these look great, thanks for doing them:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-30 11:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-29 0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
2023-07-29 2:40 ` Guenter Roeck
2023-07-30 11:39 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox