linux/drivers/macintosh
Wolfram Sang 12765517d9 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 <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>
2010-04-07 08:38:03 -07:00
..
adb-iop.c [POWERPC] Remove old includes from arch/ppc 2007-08-22 22:39:35 -05:00
adb.c mac68k: start CUDA early 2010-02-27 18:31:13 +01:00
adbhid.c Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into next 2008-07-21 00:55:14 -04:00
ans-lcd.c macintosh: Remove BKL from ans-lcd 2009-10-14 17:36:50 +02:00
ans-lcd.h [POWERPC] Copy over headers from arch/ppc to arch/powerpc that we need 2007-08-22 22:43:29 -05:00
apm_emu.c [POWERPC] apm_emu: Use generic apm-emulation 2007-05-02 16:42:19 +10:00
Kconfig Input: Mac button emulation - allow compiling as a module 2010-01-30 01:48:03 -08:00
mac_hid.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
macio_asic.c powerpc/macio: Add dma_parms support to macio 2009-12-08 16:02:52 +11:00
macio_sysfs.c [POWERPC] Create modalias file in sysfs for of_platform bus 2008-05-14 22:31:28 +10:00
macio-adb.c [POWERPC] Remove find_compatible_devices 2007-04-24 22:08:57 +10:00
Makefile [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
mediabay.c powerpc/macio: Rework hotplug media bay support 2009-12-09 17:09:14 +11:00
nvram.c macintosh: Remove BKL from nvram driver 2009-11-24 14:31:27 +11:00
rack-meter.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
smu.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
therm_adt746x.c powerpc: Remove trailing space in messages 2010-02-09 13:56:23 +11:00
therm_pm72.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
therm_pm72.h powerpc: Fix G5 thermal shutdown 2010-03-09 11:55:27 +11:00
therm_windtunnel.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
via-cuda.c mac68k: start CUDA early 2010-02-27 18:31:13 +01:00
via-macii.c m68k: machw.h cleanup 2008-12-28 20:00:03 +01:00
via-maciisi.c m68k: count can reach 51, not 50 2009-08-26 23:14:49 +02:00
via-pmu68k.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
via-pmu-backlight.c backlight: Allow properties to be passed at registration 2010-03-16 19:47:54 +00:00
via-pmu-event.c Input: via-pmu - add input device support 2006-06-26 01:49:55 -04:00
via-pmu-event.h Input: via-pmu - add input device support 2006-06-26 01:49:55 -04:00
via-pmu-led.c leds: Fix LED names 2009-09-07 14:37:27 +01:00
via-pmu.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_core.c device_attributes: add sysfs_attr_init() for dynamic attributes 2010-04-07 08:38:03 -07:00
windfarm_cpufreq_clamp.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_lm75_sensor.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_max6690_sensor.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_pid.c [PATCH] windfarm license fix 2006-03-06 18:40:45 -08:00
windfarm_pid.h
windfarm_pm81.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_pm91.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_pm112.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_pm121.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm_smu_controls.c sysfs: windfarm: init sysfs attributes 2010-03-07 17:04:51 -08:00
windfarm_smu_sat.c macintosh: Don't assume i2c device probing always succeeds 2009-10-04 22:53:46 +02:00
windfarm_smu_sensors.c of: add 'of_' prefix to machine_is_compatible() 2010-02-09 08:33:00 -07:00
windfarm.h