]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
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)
Commit 6992f5334995af474c2b58d010d08bc597f0f2fe ("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

index 7174d830dd05824dfb4e1c925e39837bce8a1e16..95184a0a1ae6ced2829ae82edfbaabf60efc147b 100644 (file)
@@ -956,6 +956,7 @@ void __init txx9_sramc_init(struct resource *r)
        if (!dev->base)
                goto exit;
        dev->dev.cls = &txx9_sramc_sysdev_class;
+       sysfs_bin_attr_init(&dev->bindata_attr);
        dev->bindata_attr.attr.name = "bindata";
        dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR;
        dev->bindata_attr.read = txx9_sram_read;
index d902d81dde397a2793f0709b0da9135922050f75..d194212a41f628a10d23e0cf77af13a0a9669e48 100644 (file)
@@ -347,6 +347,7 @@ static int at25_probe(struct spi_device *spi)
         * that's sensitive for read and/or write, like ethernet addresses,
         * security codes, board-specific manufacturing calibrations, etc.
         */
+       sysfs_bin_attr_init(&at25->bin);
        at25->bin.attr.name = "eeprom";
        at25->bin.attr.mode = S_IRUSR;
        at25->bin.read = at25_bin_read;
index a1273360a44e872c295b1a54eb57f892153ffa2e..cad9ceb89bafea483c0cdbf0de70742bde2bb220 100644 (file)
@@ -184,6 +184,7 @@ static int __devinit ds1742_rtc_probe(struct platform_device *pdev)
        pdata->size_nvram = pdata->size - RTC_SIZE;
        pdata->ioaddr_rtc = ioaddr + pdata->size_nvram;
 
+       sysfs_bin_attr_init(&pdata->nvram_attr);
        pdata->nvram_attr.attr.name = "nvram";
        pdata->nvram_attr.attr.mode = S_IRUGO | S_IWUSR;
        pdata->nvram_attr.read = ds1742_nvram_read;