init dynamic bin_attribute structures

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>

authored by Wolfram Sang and committed by Linus Torvalds f937331b 181427a7

+3
+1
arch/mips/txx9/generic/setup.c
··· 956 if (!dev->base) 957 goto exit; 958 dev->dev.cls = &txx9_sramc_sysdev_class; 959 dev->bindata_attr.attr.name = "bindata"; 960 dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR; 961 dev->bindata_attr.read = txx9_sram_read;
··· 956 if (!dev->base) 957 goto exit; 958 dev->dev.cls = &txx9_sramc_sysdev_class; 959 + sysfs_bin_attr_init(&dev->bindata_attr); 960 dev->bindata_attr.attr.name = "bindata"; 961 dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR; 962 dev->bindata_attr.read = txx9_sram_read;
+1
drivers/misc/eeprom/at25.c
··· 347 * that's sensitive for read and/or write, like ethernet addresses, 348 * security codes, board-specific manufacturing calibrations, etc. 349 */ 350 at25->bin.attr.name = "eeprom"; 351 at25->bin.attr.mode = S_IRUSR; 352 at25->bin.read = at25_bin_read;
··· 347 * that's sensitive for read and/or write, like ethernet addresses, 348 * security codes, board-specific manufacturing calibrations, etc. 349 */ 350 + sysfs_bin_attr_init(&at25->bin); 351 at25->bin.attr.name = "eeprom"; 352 at25->bin.attr.mode = S_IRUSR; 353 at25->bin.read = at25_bin_read;
+1
drivers/rtc/rtc-ds1742.c
··· 184 pdata->size_nvram = pdata->size - RTC_SIZE; 185 pdata->ioaddr_rtc = ioaddr + pdata->size_nvram; 186 187 pdata->nvram_attr.attr.name = "nvram"; 188 pdata->nvram_attr.attr.mode = S_IRUGO | S_IWUSR; 189 pdata->nvram_attr.read = ds1742_nvram_read;
··· 184 pdata->size_nvram = pdata->size - RTC_SIZE; 185 pdata->ioaddr_rtc = ioaddr + pdata->size_nvram; 186 187 + sysfs_bin_attr_init(&pdata->nvram_attr); 188 pdata->nvram_attr.attr.name = "nvram"; 189 pdata->nvram_attr.attr.mode = S_IRUGO | S_IWUSR; 190 pdata->nvram_attr.read = ds1742_nvram_read;