Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: use c99 initializers in structures

Use c99 initializers for structures.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@decl@
identifier i1,fld;
type T;
field list[n] fs;
@@

struct i1 {
fs
T fld;
...};

@bad@
identifier decl.i1,i2;
expression e;
initializer list[decl.n] is;
@@

struct i1 i2 = { is,
+ .fld = e
- e
,...};
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Julia Lawall and committed by
Linus Torvalds
473b8645 87d672cb

+15 -3
+15 -3
drivers/rtc/rtc-pcf8583.c
··· 176 176 { 177 177 struct i2c_client *client = to_i2c_client(dev); 178 178 unsigned char ctrl, year[2]; 179 - struct rtc_mem mem = { CMOS_YEAR, sizeof(year), year }; 179 + struct rtc_mem mem = { 180 + .loc = CMOS_YEAR, 181 + .nr = sizeof(year), 182 + .data = year 183 + }; 180 184 int real_year, year_offset, err; 181 185 182 186 /* ··· 226 222 { 227 223 struct i2c_client *client = to_i2c_client(dev); 228 224 unsigned char year[2], chk; 229 - struct rtc_mem cmos_year = { CMOS_YEAR, sizeof(year), year }; 230 - struct rtc_mem cmos_check = { CMOS_CHECKSUM, 1, &chk }; 225 + struct rtc_mem cmos_year = { 226 + .loc = CMOS_YEAR, 227 + .nr = sizeof(year), 228 + .data = year 229 + }; 230 + struct rtc_mem cmos_check = { 231 + .loc = CMOS_CHECKSUM, 232 + .nr = 1, 233 + .data = &chk 234 + }; 231 235 unsigned int proper_year = tm->tm_year + 1900; 232 236 int ret; 233 237