diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2010-04-06 17:34:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-04-07 11:38:03 -0400 |
commit | 12765517d9dbb477a2432375938f1eb5bdbcb532 (patch) | |
tree | 5c0e4002378fe3b65e20ea4959276d22b0a22911 /drivers/video/fsl-diu-fb.c | |
parent | 975f8c5653acba461229e671202113da69b87be1 (diff) |
device_attributes: add sysfs_attr_init() for dynamic attributes
Made necessary by 6992f5334995af474c2b58d010d08bc597f0f2fe ("sysfs: Use
one lockdep class per sysfs attribute").
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@pengutronix.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Greg KH <gregkh@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Mike Isely <isely@pobox.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Sujith Thomas <sujith.thomas@intel.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/fsl-diu-fb.c')
-rw-r--r-- | drivers/video/fsl-diu-fb.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 4637bcbe03a4..994358a4f302 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -1536,6 +1536,7 @@ static int __devinit fsl_diu_probe(struct of_device *ofdev, | |||
1536 | goto error; | 1536 | goto error; |
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | sysfs_attr_init(&machine_data->dev_attr.attr); | ||
1539 | machine_data->dev_attr.attr.name = "monitor"; | 1540 | machine_data->dev_attr.attr.name = "monitor"; |
1540 | machine_data->dev_attr.attr.mode = S_IRUGO|S_IWUSR; | 1541 | machine_data->dev_attr.attr.mode = S_IRUGO|S_IWUSR; |
1541 | machine_data->dev_attr.show = show_monitor; | 1542 | machine_data->dev_attr.show = show_monitor; |