mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
device_attributes: add sysfs_attr_init() for dynamic attributes
Made necessary by 6992f53349 ("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 <[email protected]>
Cc: Eric W. Biederman <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Mike Isely <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Sujith Thomas <[email protected]>
Cc: Matthew Garrett <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Krzysztof Helt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
975f8c5653
commit
12765517d9
4 changed files with 11 additions and 0 deletions
|
|
@ -1536,6 +1536,7 @@ static int __devinit fsl_diu_probe(struct of_device *ofdev,
|
|||
goto error;
|
||||
}
|
||||
|
||||
sysfs_attr_init(&machine_data->dev_attr.attr);
|
||||
machine_data->dev_attr.attr.name = "monitor";
|
||||
machine_data->dev_attr.attr.mode = S_IRUGO|S_IWUSR;
|
||||
machine_data->dev_attr.show = show_monitor;
|
||||
|
|
|
|||
Loading…
Reference in a new issue