init dynamic bin_attribute structures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I was pointed to the fact that commit 6992f5334995af474c2b58d010d08bc597f0f2fe
requires adjustments to dynamically created sysfs-attributes when Albrecht Dreß
tried to compile the eeprom-driver at24 with lockdep enabled. After fixing this
for at24 and at25, I came up with this coccinelle-script to find further
candidates:

@ init @
identifier struct_name, bin;
@@

	struct struct_name {
		...
		struct bin_attribute bin;
		...
	};

@ main extends init @
expression E;
statement S;
identifier name, err;
@@

(
	struct struct_name *name;
|
-	struct struct_name *name = NULL;
+	struct struct_name *name;
)
	...
(
	sysfs_bin_attr_init(&name->bin);
|
+	sysfs_bin_attr_init(&name->bin);
	if (sysfs_create_bin_file(E, &name->bin))
		S
|
+	sysfs_bin_attr_init(&name->bin);
	err = sysfs_create_bin_file(E, &name->bin);
)

(Note: I did a similar script for non-binary attributes, too. That one didn't
find a match)

The resulting series is the edited outcome of that. "Edited" because the
patches were manually reviewed afterwards to find the best place to add the
fix. The patches are not more than compile-tested on x86 where possible due to
no hardware. Please also note that my semantic patch is probably not perfect
and may have missed code still needing the fix.

Comments welcome, of course.

Regards,

   Wolfram Sang

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux