[PATCH 2/2] device_attributes: add sysfs_attr_init() for dynamic attributes
Mauro Carvalho Chehab
mchehab at infradead.org
Fri Apr 9 08:55:44 EST 2010
Wolfram Sang wrote:
> Made necessary by 6992f5334995af474c2b58d010d08bc597f0f2fe. Prevents further
> "key xxx not in .data" bug-reports. Although some attributes could probably be
> converted to static ones, this is left for people having hardware to test.
>
> Found by this semantic patch:
>
> @ init @
> type T;
> identifier A;
> @@
>
> T {
> ...
> struct device_attribute A;
> ...
> };
>
> @ main extends init @
> expression E;
> statement S;
> identifier err;
> T *name;
> @@
>
> ... when != sysfs_attr_init(&name->A.attr);
> (
> + sysfs_attr_init(&name->A.attr);
> if (device_create_file(E, &name->A))
> S
> |
> + sysfs_attr_init(&name->A.attr);
> err = device_create_file(E, &name->A);
> )
>
> While reviewing, I put the initialization to apropriate places.
>
> Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
> Cc: Eric W. Biederman <ebiederm at xmission.com>
> Cc: Greg KH <gregkh at suse.de>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> ---
> drivers/macintosh/windfarm_core.c | 1 +
> drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 8 ++++++++
I suspect that several (if not all) occurrences at pvrusb2 could be replaced by
static attributes, but let Mike Isely have the final word on that, as the driver
maintainer. From my side, I'm ok with either options.
Cheers,
Mauro
More information about the Linuxppc-dev
mailing list