public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* init dynamic bin_attribute structures
@ 2010-03-12  7:03 Wolfram Sang
  2010-03-12  7:03 ` [PATCH 1/3] arch/mips/txx9/generic: " Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Wolfram Sang @ 2010-03-12  7:03 UTC (permalink / raw)
  To: kernel-janitors

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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-03-15 17:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12  7:03 init dynamic bin_attribute structures Wolfram Sang
2010-03-12  7:03 ` [PATCH 1/3] arch/mips/txx9/generic: " Wolfram Sang
2010-03-12 18:34   ` [PATCH 1/3] arch/mips/txx9/generic: init dynamic bin_attribute Dmitry Torokhov
2010-03-13  2:28     ` Wolfram Sang
2010-03-13  8:33       ` Dmitry Torokhov
2010-03-15 17:49       ` Ralf Baechle
2010-03-12  7:03 ` [PATCH 2/3] drivers/base: init dynamic bin_attribute structures Wolfram Sang
2010-03-13  2:11   ` Wolfram Sang
2010-03-12  7:03 ` [PATCH 3/3] drivers/rtc: " Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox