]> git.baikalelectronics.ru Git - kernel.git/commit
init dynamic bin_attribute structures
authorWolfram Sang <w.sang@pengutronix.de>
Mon, 15 Mar 2010 00:29:41 +0000 (01:29 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 15 Mar 2010 03:28:39 +0000 (20:28 -0700)
commite654929daeac6a659cd663588da2039b3378c98c
treee14edb4d6e31ef48f07145e6f3e4016c6075f4d8
parent8a7733d72f5bf51b612ae4ac76bc58ddd429754a
init dynamic bin_attribute structures

Commit fcb21f7e9f89fcea645e475fd69df4b5493ce02e ("sysfs: Use one lockdep
class per sysfs attribute.") introduced this requirement.  First, at25
was fixed manually.  Then, other occurences were found with coccinelle
and the following semantic patch.  Results were reviewed and fixed up:

    @ 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);
    )

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/mips/txx9/generic/setup.c
drivers/misc/eeprom/at25.c
drivers/rtc/rtc-ds1742.c