aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubhrajyoti D <shubhrajyoti@ti.com>2012-10-04 20:14:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-05 14:05:05 -0400
commitc3fe92b7c03061ef8acb472aead3d86586e8149f (patch)
tree504cebcd2da140b91448d21b2d3a4df02da06be0
parent2bfc37dffa844e5b28a240feec5e2fa8ec2ea8ba (diff)
drivers/rtc/rtc-x1205.c: convert struct i2c_msg initialization to C99 format
Convert the struct i2c_msg initialization to C99 format. This makes maintaining and editing the code simpler. Also helps once other fields like transferred are added in future. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/rtc/rtc-x1205.c92
1 files changed, 78 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index 403b3d41d101..f36e59c6bc01 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -97,8 +97,17 @@ static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm,
97 int i; 97 int i;
98 98
99 struct i2c_msg msgs[] = { 99 struct i2c_msg msgs[] = {
100 { client->addr, 0, 2, dt_addr }, /* setup read ptr */ 100 {/* setup read ptr */
101 { client->addr, I2C_M_RD, 8, buf }, /* read date */ 101 .addr = client->addr,
102 .len = 2,
103 .buf = dt_addr
104 },
105 {/* read date */
106 .addr = client->addr,
107 .flags = I2C_M_RD,
108 .len = 8,
109 .buf = buf
110 },
102 }; 111 };
103 112
104 /* read date registers */ 113 /* read date registers */
@@ -142,8 +151,17 @@ static int x1205_get_status(struct i2c_client *client, unsigned char *sr)
142 static unsigned char sr_addr[2] = { 0, X1205_REG_SR }; 151 static unsigned char sr_addr[2] = { 0, X1205_REG_SR };
143 152
144 struct i2c_msg msgs[] = { 153 struct i2c_msg msgs[] = {
145 { client->addr, 0, 2, sr_addr }, /* setup read ptr */ 154 { /* setup read ptr */
146 { client->addr, I2C_M_RD, 1, sr }, /* read status */ 155 .addr = client->addr,
156 .len = 2,
157 .buf = sr_addr
158 },
159 { /* read status */
160 .addr = client->addr,
161 .flags = I2C_M_RD,
162 .len = 1,
163 .buf = sr
164 },
147 }; 165 };
148 166
149 /* read status register */ 167 /* read status register */
@@ -279,8 +297,17 @@ static int x1205_get_dtrim(struct i2c_client *client, int *trim)
279 static unsigned char dtr_addr[2] = { 0, X1205_REG_DTR }; 297 static unsigned char dtr_addr[2] = { 0, X1205_REG_DTR };
280 298
281 struct i2c_msg msgs[] = { 299 struct i2c_msg msgs[] = {
282 { client->addr, 0, 2, dtr_addr }, /* setup read ptr */ 300 { /* setup read ptr */
283 { client->addr, I2C_M_RD, 1, &dtr }, /* read dtr */ 301 .addr = client->addr,
302 .len = 2,
303 .buf = dtr_addr
304 },
305 { /* read dtr */
306 .addr = client->addr,
307 .flags = I2C_M_RD,
308 .len = 1,
309 .buf = &dtr
310 },
284 }; 311 };
285 312
286 /* read dtr register */ 313 /* read dtr register */
@@ -311,8 +338,17 @@ static int x1205_get_atrim(struct i2c_client *client, int *trim)
311 static unsigned char atr_addr[2] = { 0, X1205_REG_ATR }; 338 static unsigned char atr_addr[2] = { 0, X1205_REG_ATR };
312 339
313 struct i2c_msg msgs[] = { 340 struct i2c_msg msgs[] = {
314 { client->addr, 0, 2, atr_addr }, /* setup read ptr */ 341 {/* setup read ptr */
315 { client->addr, I2C_M_RD, 1, &atr }, /* read atr */ 342 .addr = client->addr,
343 .len = 2,
344 .buf = atr_addr
345 },
346 {/* read atr */
347 .addr = client->addr,
348 .flags = I2C_M_RD,
349 .len = 1,
350 .buf = &atr
351 },
316 }; 352 };
317 353
318 /* read atr register */ 354 /* read atr register */
@@ -381,8 +417,17 @@ static int x1205_validate_client(struct i2c_client *client)
381 unsigned char addr[2] = { 0, probe_zero_pattern[i] }; 417 unsigned char addr[2] = { 0, probe_zero_pattern[i] };
382 418
383 struct i2c_msg msgs[2] = { 419 struct i2c_msg msgs[2] = {
384 { client->addr, 0, 2, addr }, 420 {
385 { client->addr, I2C_M_RD, 1, &buf }, 421 .addr = client->addr,
422 .len = 2,
423 .buf = addr
424 },
425 {
426 .addr = client->addr,
427 .flags = I2C_M_RD,
428 .len = 1,
429 .buf = &buf
430 },
386 }; 431 };
387 432
388 if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) { 433 if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) {
@@ -409,8 +454,17 @@ static int x1205_validate_client(struct i2c_client *client)
409 unsigned char addr[2] = { 0, probe_limits_pattern[i].reg }; 454 unsigned char addr[2] = { 0, probe_limits_pattern[i].reg };
410 455
411 struct i2c_msg msgs[2] = { 456 struct i2c_msg msgs[2] = {
412 { client->addr, 0, 2, addr }, 457 {
413 { client->addr, I2C_M_RD, 1, &reg }, 458 .addr = client->addr,
459 .len = 2,
460 .buf = addr
461 },
462 {
463 .addr = client->addr,
464 .flags = I2C_M_RD,
465 .len = 1,
466 .buf = &reg
467 },
414 }; 468 };
415 469
416 if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) { 470 if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) {
@@ -444,8 +498,18 @@ static int x1205_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
444 static unsigned char int_addr[2] = { 0, X1205_REG_INT }; 498 static unsigned char int_addr[2] = { 0, X1205_REG_INT };
445 struct i2c_client *client = to_i2c_client(dev); 499 struct i2c_client *client = to_i2c_client(dev);
446 struct i2c_msg msgs[] = { 500 struct i2c_msg msgs[] = {
447 { client->addr, 0, 2, int_addr }, /* setup read ptr */ 501 { /* setup read ptr */
448 { client->addr, I2C_M_RD, 1, &intreg }, /* read INT register */ 502 .addr = client->addr,
503 .len = 2,
504 .buf = int_addr
505 },
506 {/* read INT register */
507
508 .addr = client->addr,
509 .flags = I2C_M_RD,
510 .len = 1,
511 .buf = &intreg
512 },
449 }; 513 };
450 514
451 /* read interrupt register and status register */ 515 /* read interrupt register and status register */