[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdLZGM3EY3LeorYLgD-8rXUL_jQ9qdTSAfaRnyvwJp+QA@mail.gmail.com>
Date: Thu, 4 Jul 2019 16:28:39 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Platform Driver <platform-driver-x86@...r.kernel.org>
Subject: Re: [PATCH 05/11] olpc: x01: convert platform driver to use dev_groups
On Thu, Jul 4, 2019 at 11:47 AM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> Platform drivers now have the option to have the platform core create
> and remove any needed sysfs attribute files. So take advantage of that
> and do not register "by hand" a lid sysfs file.
>
Acked-by: Andy Shevchenko <andy.shevchenko@...il.com>
> Cc: Darren Hart <dvhart@...radead.org>
> Cc: Andy Shevchenko <andy@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: x86@...nel.org
> Cc: platform-driver-x86@...r.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
> arch/x86/platform/olpc/olpc-xo1-sci.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
> index 25ce1b3b0732..ce1948918dd2 100644
> --- a/arch/x86/platform/olpc/olpc-xo1-sci.c
> +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
> @@ -157,6 +157,12 @@ static ssize_t lid_wake_mode_set(struct device *dev,
> static DEVICE_ATTR(lid_wake_mode, S_IWUSR | S_IRUGO, lid_wake_mode_show,
> lid_wake_mode_set);
>
> +static struct attribute *lid_attrs[] = {
> + &dev_attr_lid_wake_mode.attr,
> + NULL,
> +};
> +ATTRIBUTE_GROUPS(lid);
> +
> /*
> * Process all items in the EC's SCI queue.
> *
> @@ -510,17 +516,8 @@ static int setup_lid_switch(struct platform_device *pdev)
> goto err_register;
> }
>
> - r = device_create_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
> - if (r) {
> - dev_err(&pdev->dev, "failed to create wake mode attr: %d\n", r);
> - goto err_create_attr;
> - }
> -
> return 0;
>
> -err_create_attr:
> - input_unregister_device(lid_switch_idev);
> - lid_switch_idev = NULL;
> err_register:
> input_free_device(lid_switch_idev);
> return r;
> @@ -528,7 +525,6 @@ static int setup_lid_switch(struct platform_device *pdev)
>
> static void free_lid_switch(void)
> {
> - device_remove_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
> input_unregister_device(lid_switch_idev);
> }
>
> @@ -629,6 +625,7 @@ static struct platform_driver xo1_sci_driver = {
> .remove = xo1_sci_remove,
> .suspend = xo1_sci_suspend,
> .resume = xo1_sci_resume,
> + .dev_groups = lid_groups,
> };
>
> static int __init xo1_sci_init(void)
> --
> 2.22.0
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists