From 12765517d9dbb477a2432375938f1eb5bdbcb532 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 6 Apr 2010 14:34:52 -0700 Subject: 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 Cc: Eric W. Biederman Cc: Greg KH Cc: Benjamin Herrenschmidt Cc: Grant Likely Cc: Mike Isely Cc: Mauro Carvalho Chehab Cc: Sujith Thomas Cc: Matthew Garrett Cc: Len Brown Cc: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/platform/x86/intel_menlow.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/platform') diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c index 1190bad4297..2f795ce2b93 100644 --- a/drivers/platform/x86/intel_menlow.c +++ b/drivers/platform/x86/intel_menlow.c @@ -397,6 +397,7 @@ static int intel_menlow_add_one_attribute(char *name, int mode, void *show, if (!attr) return -ENOMEM; + sysfs_attr_init(&attr->attr.attr); /* That is consistent naming :D */ attr->attr.attr.name = name; attr->attr.attr.mode = mode; attr->attr.show = show; -- cgit v1.2.3