diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2014-10-13 18:52:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 20:18:17 -0400 |
commit | 473b86451276d6d342ecd26d5e503163c30ea974 (patch) | |
tree | 449d1522bfd7ee9719c3415e8a4594e238dc9d1d /drivers/rtc | |
parent | 87d672cbd512c8dca01423381c94ac3658db0a18 (diff) |
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>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-pcf8583.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index c2639845186b..5911a6dca291 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c | |||
@@ -176,7 +176,11 @@ static int pcf8583_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
176 | { | 176 | { |
177 | struct i2c_client *client = to_i2c_client(dev); | 177 | struct i2c_client *client = to_i2c_client(dev); |
178 | unsigned char ctrl, year[2]; | 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 | int real_year, year_offset, err; | 184 | int real_year, year_offset, err; |
181 | 185 | ||
182 | /* | 186 | /* |
@@ -222,8 +226,16 @@ static int pcf8583_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
222 | { | 226 | { |
223 | struct i2c_client *client = to_i2c_client(dev); | 227 | struct i2c_client *client = to_i2c_client(dev); |
224 | unsigned char year[2], chk; | 228 | unsigned char year[2], chk; |
225 | struct rtc_mem cmos_year = { CMOS_YEAR, sizeof(year), year }; | 229 | struct rtc_mem cmos_year = { |
226 | struct rtc_mem cmos_check = { CMOS_CHECKSUM, 1, &chk }; | 230 | .loc = CMOS_YEAR, |
231 | .nr = sizeof(year), | ||
232 | .data = year | ||
233 | }; | ||
234 | struct rtc_mem cmos_check = { | ||
235 | .loc = CMOS_CHECKSUM, | ||
236 | .nr = 1, | ||
237 | .data = &chk | ||
238 | }; | ||
227 | unsigned int proper_year = tm->tm_year + 1900; | 239 | unsigned int proper_year = tm->tm_year + 1900; |
228 | int ret; | 240 | int ret; |
229 | 241 | ||