* [PATCH 05/11] olpc: x01: convert platform driver to use dev_groups
2019-07-04 8:46 [PATCH 00/11] Platform drivers, provide a way to add sysfs groups easily Greg Kroah-Hartman
@ 2019-07-04 8:46 ` Greg Kroah-Hartman
2019-07-04 13:28 ` Andy Shevchenko
2019-07-04 8:46 ` [PATCH 06/11] platform: x86: hp-wmi: " Greg Kroah-Hartman
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-04 8:46 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, Darren Hart, Andy Shevchenko, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, H. Peter Anvin, x86,
platform-driver-x86
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.
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 05/11] olpc: x01: convert platform driver to use dev_groups
2019-07-04 8:46 ` [PATCH 05/11] olpc: x01: convert platform driver to use dev_groups Greg Kroah-Hartman
@ 2019-07-04 13:28 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2019-07-04 13:28 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Linux Kernel Mailing List, Darren Hart, Andy Shevchenko,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Platform Driver
On Thu, Jul 4, 2019 at 11:47 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.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@gmail.com>
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andy Shevchenko <andy@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: platform-driver-x86@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 06/11] platform: x86: hp-wmi: convert platform driver to use dev_groups
2019-07-04 8:46 [PATCH 00/11] Platform drivers, provide a way to add sysfs groups easily Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 05/11] olpc: x01: convert platform driver to use dev_groups Greg Kroah-Hartman
@ 2019-07-04 8:46 ` Greg Kroah-Hartman
2019-07-04 13:29 ` Andy Shevchenko
2019-07-04 8:46 ` [PATCH 07/11] video: fbdev: wm8505fb: " Greg Kroah-Hartman
2019-07-04 14:26 ` Greg Kroah-Hartman
3 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-04 8:46 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, Darren Hart, Andy Shevchenko, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, H. Peter Anvin, x86,
platform-driver-x86
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 bunch of sysfs files.
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/platform/x86/hp-wmi.c | 47 +++++++++--------------------------
1 file changed, 12 insertions(+), 35 deletions(-)
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 2521e45280b8..b4ed5902737a 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -502,6 +502,17 @@ static DEVICE_ATTR_RO(dock);
static DEVICE_ATTR_RO(tablet);
static DEVICE_ATTR_RW(postcode);
+static struct attribute *hp_wmi_attrs[] = {
+ &dev_attr_display.attr,
+ &dev_attr_hddtemp.attr,
+ &dev_attr_als.attr,
+ &dev_attr_dock.attr,
+ &dev_attr_tablet.attr,
+ &dev_attr_postcode.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(hp_wmi);
+
static void hp_wmi_notify(u32 value, void *context)
{
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -678,16 +689,6 @@ static void hp_wmi_input_destroy(void)
input_unregister_device(hp_wmi_input_dev);
}
-static void cleanup_sysfs(struct platform_device *device)
-{
- device_remove_file(&device->dev, &dev_attr_display);
- device_remove_file(&device->dev, &dev_attr_hddtemp);
- device_remove_file(&device->dev, &dev_attr_als);
- device_remove_file(&device->dev, &dev_attr_dock);
- device_remove_file(&device->dev, &dev_attr_tablet);
- device_remove_file(&device->dev, &dev_attr_postcode);
-}
-
static int __init hp_wmi_rfkill_setup(struct platform_device *device)
{
int err, wireless;
@@ -858,8 +859,6 @@ static int __init hp_wmi_rfkill2_setup(struct platform_device *device)
static int __init hp_wmi_bios_setup(struct platform_device *device)
{
- int err;
-
/* clear detected rfkill devices */
wifi_rfkill = NULL;
bluetooth_rfkill = NULL;
@@ -869,35 +868,12 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
if (hp_wmi_rfkill_setup(device))
hp_wmi_rfkill2_setup(device);
- err = device_create_file(&device->dev, &dev_attr_display);
- if (err)
- goto add_sysfs_error;
- err = device_create_file(&device->dev, &dev_attr_hddtemp);
- if (err)
- goto add_sysfs_error;
- err = device_create_file(&device->dev, &dev_attr_als);
- if (err)
- goto add_sysfs_error;
- err = device_create_file(&device->dev, &dev_attr_dock);
- if (err)
- goto add_sysfs_error;
- err = device_create_file(&device->dev, &dev_attr_tablet);
- if (err)
- goto add_sysfs_error;
- err = device_create_file(&device->dev, &dev_attr_postcode);
- if (err)
- goto add_sysfs_error;
return 0;
-
-add_sysfs_error:
- cleanup_sysfs(device);
- return err;
}
static int __exit hp_wmi_bios_remove(struct platform_device *device)
{
int i;
- cleanup_sysfs(device);
for (i = 0; i < rfkill2_count; i++) {
rfkill_unregister(rfkill2[i].rfkill);
@@ -968,6 +944,7 @@ static struct platform_driver hp_wmi_driver = {
.pm = &hp_wmi_pm_ops,
},
.remove = __exit_p(hp_wmi_bios_remove),
+ .dev_groups = hp_wmi_groups,
};
static int __init hp_wmi_init(void)
--
2.22.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 06/11] platform: x86: hp-wmi: convert platform driver to use dev_groups
2019-07-04 8:46 ` [PATCH 06/11] platform: x86: hp-wmi: " Greg Kroah-Hartman
@ 2019-07-04 13:29 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2019-07-04 13:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Linux Kernel Mailing List, Darren Hart, Andy Shevchenko,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Platform Driver
On Thu, Jul 4, 2019 at 11:47 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.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 bunch of sysfs files.
>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andy Shevchenko <andy@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: platform-driver-x86@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/platform/x86/hp-wmi.c | 47 +++++++++--------------------------
> 1 file changed, 12 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 2521e45280b8..b4ed5902737a 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -502,6 +502,17 @@ static DEVICE_ATTR_RO(dock);
> static DEVICE_ATTR_RO(tablet);
> static DEVICE_ATTR_RW(postcode);
>
> +static struct attribute *hp_wmi_attrs[] = {
> + &dev_attr_display.attr,
> + &dev_attr_hddtemp.attr,
> + &dev_attr_als.attr,
> + &dev_attr_dock.attr,
> + &dev_attr_tablet.attr,
> + &dev_attr_postcode.attr,
> + NULL,
> +};
> +ATTRIBUTE_GROUPS(hp_wmi);
> +
> static void hp_wmi_notify(u32 value, void *context)
> {
> struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
> @@ -678,16 +689,6 @@ static void hp_wmi_input_destroy(void)
> input_unregister_device(hp_wmi_input_dev);
> }
>
> -static void cleanup_sysfs(struct platform_device *device)
> -{
> - device_remove_file(&device->dev, &dev_attr_display);
> - device_remove_file(&device->dev, &dev_attr_hddtemp);
> - device_remove_file(&device->dev, &dev_attr_als);
> - device_remove_file(&device->dev, &dev_attr_dock);
> - device_remove_file(&device->dev, &dev_attr_tablet);
> - device_remove_file(&device->dev, &dev_attr_postcode);
> -}
> -
> static int __init hp_wmi_rfkill_setup(struct platform_device *device)
> {
> int err, wireless;
> @@ -858,8 +859,6 @@ static int __init hp_wmi_rfkill2_setup(struct platform_device *device)
>
> static int __init hp_wmi_bios_setup(struct platform_device *device)
> {
> - int err;
> -
> /* clear detected rfkill devices */
> wifi_rfkill = NULL;
> bluetooth_rfkill = NULL;
> @@ -869,35 +868,12 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
> if (hp_wmi_rfkill_setup(device))
> hp_wmi_rfkill2_setup(device);
>
> - err = device_create_file(&device->dev, &dev_attr_display);
> - if (err)
> - goto add_sysfs_error;
> - err = device_create_file(&device->dev, &dev_attr_hddtemp);
> - if (err)
> - goto add_sysfs_error;
> - err = device_create_file(&device->dev, &dev_attr_als);
> - if (err)
> - goto add_sysfs_error;
> - err = device_create_file(&device->dev, &dev_attr_dock);
> - if (err)
> - goto add_sysfs_error;
> - err = device_create_file(&device->dev, &dev_attr_tablet);
> - if (err)
> - goto add_sysfs_error;
> - err = device_create_file(&device->dev, &dev_attr_postcode);
> - if (err)
> - goto add_sysfs_error;
> return 0;
> -
> -add_sysfs_error:
> - cleanup_sysfs(device);
> - return err;
> }
>
> static int __exit hp_wmi_bios_remove(struct platform_device *device)
> {
> int i;
> - cleanup_sysfs(device);
>
> for (i = 0; i < rfkill2_count; i++) {
> rfkill_unregister(rfkill2[i].rfkill);
> @@ -968,6 +944,7 @@ static struct platform_driver hp_wmi_driver = {
> .pm = &hp_wmi_pm_ops,
> },
> .remove = __exit_p(hp_wmi_bios_remove),
> + .dev_groups = hp_wmi_groups,
> };
>
> static int __init hp_wmi_init(void)
> --
> 2.22.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 07/11] video: fbdev: wm8505fb: convert platform driver to use dev_groups
2019-07-04 8:46 [PATCH 00/11] Platform drivers, provide a way to add sysfs groups easily Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 05/11] olpc: x01: convert platform driver to use dev_groups Greg Kroah-Hartman
2019-07-04 8:46 ` [PATCH 06/11] platform: x86: hp-wmi: " Greg Kroah-Hartman
@ 2019-07-04 8:46 ` Greg Kroah-Hartman
2019-07-04 13:29 ` Andy Shevchenko
2019-07-04 14:26 ` Greg Kroah-Hartman
3 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-04 8:46 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, Darren Hart, Andy Shevchenko,
platform-driver-x86
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 sysfs file.
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/wm8505fb.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c
index 8f0d5379861d..3b826da97035 100644
--- a/drivers/video/fbdev/wm8505fb.c
+++ b/drivers/video/fbdev/wm8505fb.c
@@ -184,6 +184,12 @@ static ssize_t contrast_store(struct device *dev,
static DEVICE_ATTR_RW(contrast);
+static struct attribute *wm8505fb_attrs[] = {
+ &dev_attr_contrast.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(wm8505fb);
+
static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
{
chan &= 0xffff;
@@ -369,10 +375,6 @@ static int wm8505fb_probe(struct platform_device *pdev)
return ret;
}
- ret = device_create_file(&pdev->dev, &dev_attr_contrast);
- if (ret < 0)
- fb_warn(&fbi->fb, "failed to register attributes (%d)\n", ret);
-
fb_info(&fbi->fb, "%s frame buffer at 0x%lx-0x%lx\n",
fbi->fb.fix.id, fbi->fb.fix.smem_start,
fbi->fb.fix.smem_start + fbi->fb.fix.smem_len - 1);
@@ -384,8 +386,6 @@ static int wm8505fb_remove(struct platform_device *pdev)
{
struct wm8505fb_info *fbi = platform_get_drvdata(pdev);
- device_remove_file(&pdev->dev, &dev_attr_contrast);
-
unregister_framebuffer(&fbi->fb);
writel(0, fbi->regbase);
@@ -402,6 +402,7 @@ static const struct of_device_id wmt_dt_ids[] = {
};
static struct platform_driver wm8505fb_driver = {
+ .dev_groups = wm8505fb_groups,
.probe = wm8505fb_probe,
.remove = wm8505fb_remove,
.driver = {
--
2.22.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 07/11] video: fbdev: wm8505fb: convert platform driver to use dev_groups
2019-07-04 8:46 ` [PATCH 07/11] video: fbdev: wm8505fb: " Greg Kroah-Hartman
@ 2019-07-04 13:29 ` Andy Shevchenko
2019-07-04 14:25 ` Greg Kroah-Hartman
0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2019-07-04 13:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Linux Kernel Mailing List, Darren Hart, Andy Shevchenko,
Platform Driver
On Thu, Jul 4, 2019 at 11:47 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.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 sysfs file.
>
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andy Shevchenko <andy@infradead.org>
> Cc: platform-driver-x86@vger.kernel.org
Is it correct Cc list? Looks like a typo to me.
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/video/fbdev/wm8505fb.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c
> index 8f0d5379861d..3b826da97035 100644
> --- a/drivers/video/fbdev/wm8505fb.c
> +++ b/drivers/video/fbdev/wm8505fb.c
> @@ -184,6 +184,12 @@ static ssize_t contrast_store(struct device *dev,
>
> static DEVICE_ATTR_RW(contrast);
>
> +static struct attribute *wm8505fb_attrs[] = {
> + &dev_attr_contrast.attr,
> + NULL,
> +};
> +ATTRIBUTE_GROUPS(wm8505fb);
> +
> static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
> {
> chan &= 0xffff;
> @@ -369,10 +375,6 @@ static int wm8505fb_probe(struct platform_device *pdev)
> return ret;
> }
>
> - ret = device_create_file(&pdev->dev, &dev_attr_contrast);
> - if (ret < 0)
> - fb_warn(&fbi->fb, "failed to register attributes (%d)\n", ret);
> -
> fb_info(&fbi->fb, "%s frame buffer at 0x%lx-0x%lx\n",
> fbi->fb.fix.id, fbi->fb.fix.smem_start,
> fbi->fb.fix.smem_start + fbi->fb.fix.smem_len - 1);
> @@ -384,8 +386,6 @@ static int wm8505fb_remove(struct platform_device *pdev)
> {
> struct wm8505fb_info *fbi = platform_get_drvdata(pdev);
>
> - device_remove_file(&pdev->dev, &dev_attr_contrast);
> -
> unregister_framebuffer(&fbi->fb);
>
> writel(0, fbi->regbase);
> @@ -402,6 +402,7 @@ static const struct of_device_id wmt_dt_ids[] = {
> };
>
> static struct platform_driver wm8505fb_driver = {
> + .dev_groups = wm8505fb_groups,
> .probe = wm8505fb_probe,
> .remove = wm8505fb_remove,
> .driver = {
> --
> 2.22.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 07/11] video: fbdev: wm8505fb: convert platform driver to use dev_groups
2019-07-04 13:29 ` Andy Shevchenko
@ 2019-07-04 14:25 ` Greg Kroah-Hartman
0 siblings, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-04 14:25 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linux Kernel Mailing List, Darren Hart, Andy Shevchenko,
Platform Driver
On Thu, Jul 04, 2019 at 04:29:40PM +0300, Andy Shevchenko wrote:
> On Thu, Jul 4, 2019 at 11:47 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.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 sysfs file.
> >
> > Cc: Darren Hart <dvhart@infradead.org>
> > Cc: Andy Shevchenko <andy@infradead.org>
> > Cc: platform-driver-x86@vger.kernel.org
>
> Is it correct Cc list? Looks like a typo to me.
Ugh, wrong mapping of patch to maintainers, my scripts failed me :(
I'll resend this with the proper one, thanks.
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 07/11] video: fbdev: wm8505fb: convert platform driver to use dev_groups
2019-07-04 8:46 [PATCH 00/11] Platform drivers, provide a way to add sysfs groups easily Greg Kroah-Hartman
` (2 preceding siblings ...)
2019-07-04 8:46 ` [PATCH 07/11] video: fbdev: wm8505fb: " Greg Kroah-Hartman
@ 2019-07-04 14:26 ` Greg Kroah-Hartman
2019-07-05 15:00 ` Bartlomiej Zolnierkiewicz
3 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-04 14:26 UTC (permalink / raw)
To: linux-kernel, Tony Prisk, Bartlomiej Zolnierkiewicz
Cc: linux-arm-kernel, dri-devel, linux-fbdev, Greg Kroah-Hartman,
Darren Hart, Andy Shevchenko, platform-driver-x86
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 sysfs file.
Cc: Tony Prisk <linux@prisktech.co.nz>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/wm8505fb.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c
index 8f0d5379861d..3b826da97035 100644
--- a/drivers/video/fbdev/wm8505fb.c
+++ b/drivers/video/fbdev/wm8505fb.c
@@ -184,6 +184,12 @@ static ssize_t contrast_store(struct device *dev,
static DEVICE_ATTR_RW(contrast);
+static struct attribute *wm8505fb_attrs[] = {
+ &dev_attr_contrast.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(wm8505fb);
+
static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
{
chan &= 0xffff;
@@ -369,10 +375,6 @@ static int wm8505fb_probe(struct platform_device *pdev)
return ret;
}
- ret = device_create_file(&pdev->dev, &dev_attr_contrast);
- if (ret < 0)
- fb_warn(&fbi->fb, "failed to register attributes (%d)\n", ret);
-
fb_info(&fbi->fb, "%s frame buffer at 0x%lx-0x%lx\n",
fbi->fb.fix.id, fbi->fb.fix.smem_start,
fbi->fb.fix.smem_start + fbi->fb.fix.smem_len - 1);
@@ -384,8 +386,6 @@ static int wm8505fb_remove(struct platform_device *pdev)
{
struct wm8505fb_info *fbi = platform_get_drvdata(pdev);
- device_remove_file(&pdev->dev, &dev_attr_contrast);
-
unregister_framebuffer(&fbi->fb);
writel(0, fbi->regbase);
@@ -402,6 +402,7 @@ static const struct of_device_id wmt_dt_ids[] = {
};
static struct platform_driver wm8505fb_driver = {
+ .dev_groups = wm8505fb_groups,
.probe = wm8505fb_probe,
.remove = wm8505fb_remove,
.driver = {
--
2.22.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 07/11] video: fbdev: wm8505fb: convert platform driver to use dev_groups
2019-07-04 14:26 ` Greg Kroah-Hartman
@ 2019-07-05 15:00 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 10+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-07-05 15:00 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-kernel, Tony Prisk, linux-arm-kernel, dri-devel,
linux-fbdev, Darren Hart, Andy Shevchenko, platform-driver-x86
On 7/4/19 4:26 PM, Greg Kroah-Hartman 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 sysfs file.
>
> Cc: Tony Prisk <linux@prisktech.co.nz>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-fbdev@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 10+ messages in thread