Re: [PATCH] staging: fbtft: convert sysfs attributes to use attribute_group
From: Andy Shevchenko
Date: Tue May 12 2026 - 07:02:39 EST
On Tue, May 12, 2026 at 09:28:17AM +0000, Harshit Shaw wrote:
> Replace direct device_create_file() and device_remove_file() calls
> with the correct attribute_group API using sysfs_create_group() and
> sysfs_remove_group(). This is the proper way to register sysfs
> attributes in kernel drivers.
...
> +static DEVICE_ATTR(gamma, 0644, show_gamma_curve, store_gamma_curve);
> +static DEVICE_ATTR(debug, 0644, show_debug, store_debug);
Move each of them closer to the used callbacks. Also there is DEVICE_ATTR_RW()
macro.
...
> +static struct attribute *fbtft_attrs[] = {
> + &dev_attr_debug.attr,
> + NULL,
Don't put trailing commas in terminator entries.
> +};
...
> +static struct attribute *fbtft_gamma_attrs[] = {
> + &dev_attr_gamma.attr,
> + NULL,
Ditto.
> +};
...
Also these definitions should be moved closer to the related initialisers.
--
With Best Regards,
Andy Shevchenko