aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Ball <cjb@laptop.org>2011-04-13 23:49:45 -0400
committerChris Ball <cjb@laptop.org>2011-05-24 21:02:01 -0400
commit24f5b53ba076e983bc64fa48534ca795d7813d51 (patch)
tree6ae546b6443ec6f28694a9688fdd79da633c57b7
parenta61ad2b49bfce94dfddce828cd9222e4b9e7825b (diff)
mmc: initialize struct mmc_request at declaration time
Converts from: struct mmc_request mrq; memset(&mrq, 0, sizeof(struct mmc_request)); to: struct mmc_request mrq = {0}; because it's shorter, as performant, and easier to work out whether initialization has happened. Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/card/block.c4
-rw-r--r--drivers/mmc/card/mmc_test.c12
-rw-r--r--drivers/mmc/core/core.c4
-rw-r--r--drivers/mmc/core/mmc_ops.c8
-rw-r--r--drivers/mmc/core/sd_ops.c14
-rw-r--r--drivers/mmc/core/sdio_ops.c4
6 files changed, 12 insertions, 34 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index fb387c803205..adf0ed3f2c08 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -259,7 +259,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
259 u32 result; 259 u32 result;
260 __be32 *blocks; 260 __be32 *blocks;
261 261
262 struct mmc_request mrq; 262 struct mmc_request mrq = {0};
263 struct mmc_command cmd = {0}; 263 struct mmc_command cmd = {0};
264 struct mmc_data data = {0}; 264 struct mmc_data data = {0};
265 unsigned int timeout_us; 265 unsigned int timeout_us;
@@ -300,8 +300,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
300 data.sg = &sg; 300 data.sg = &sg;
301 data.sg_len = 1; 301 data.sg_len = 1;
302 302
303 memset(&mrq, 0, sizeof(struct mmc_request));
304
305 mrq.cmd = &cmd; 303 mrq.cmd = &cmd;
306 mrq.data = &data; 304 mrq.data = &data;
307 305
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index f44762b6e592..35252c1e7a20 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -246,15 +246,13 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test,
246{ 246{
247 int ret; 247 int ret;
248 248
249 struct mmc_request mrq; 249 struct mmc_request mrq = {0};
250 struct mmc_command cmd = {0}; 250 struct mmc_command cmd = {0};
251 struct mmc_command stop = {0}; 251 struct mmc_command stop = {0};
252 struct mmc_data data = {0}; 252 struct mmc_data data = {0};
253 253
254 struct scatterlist sg; 254 struct scatterlist sg;
255 255
256 memset(&mrq, 0, sizeof(struct mmc_request));
257
258 mrq.cmd = &cmd; 256 mrq.cmd = &cmd;
259 mrq.data = &data; 257 mrq.data = &data;
260 mrq.stop = &stop; 258 mrq.stop = &stop;
@@ -728,13 +726,11 @@ static int mmc_test_simple_transfer(struct mmc_test_card *test,
728 struct scatterlist *sg, unsigned sg_len, unsigned dev_addr, 726 struct scatterlist *sg, unsigned sg_len, unsigned dev_addr,
729 unsigned blocks, unsigned blksz, int write) 727 unsigned blocks, unsigned blksz, int write)
730{ 728{
731 struct mmc_request mrq; 729 struct mmc_request mrq = {0};
732 struct mmc_command cmd = {0}; 730 struct mmc_command cmd = {0};
733 struct mmc_command stop = {0}; 731 struct mmc_command stop = {0};
734 struct mmc_data data = {0}; 732 struct mmc_data data = {0};
735 733
736 memset(&mrq, 0, sizeof(struct mmc_request));
737
738 mrq.cmd = &cmd; 734 mrq.cmd = &cmd;
739 mrq.data = &data; 735 mrq.data = &data;
740 mrq.stop = &stop; 736 mrq.stop = &stop;
@@ -755,15 +751,13 @@ static int mmc_test_simple_transfer(struct mmc_test_card *test,
755static int mmc_test_broken_transfer(struct mmc_test_card *test, 751static int mmc_test_broken_transfer(struct mmc_test_card *test,
756 unsigned blocks, unsigned blksz, int write) 752 unsigned blocks, unsigned blksz, int write)
757{ 753{
758 struct mmc_request mrq; 754 struct mmc_request mrq = {0};
759 struct mmc_command cmd = {0}; 755 struct mmc_command cmd = {0};
760 struct mmc_command stop = {0}; 756 struct mmc_command stop = {0};
761 struct mmc_data data = {0}; 757 struct mmc_data data = {0};
762 758
763 struct scatterlist sg; 759 struct scatterlist sg;
764 760
765 memset(&mrq, 0, sizeof(struct mmc_request));
766
767 mrq.cmd = &cmd; 761 mrq.cmd = &cmd;
768 mrq.data = &data; 762 mrq.data = &data;
769 mrq.stop = &stop; 763 mrq.stop = &stop;
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f273ffd6557a..1dbc18576219 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -236,12 +236,10 @@ EXPORT_SYMBOL(mmc_wait_for_req);
236 */ 236 */
237int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries) 237int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries)
238{ 238{
239 struct mmc_request mrq; 239 struct mmc_request mrq = {0};
240 240
241 WARN_ON(!host->claimed); 241 WARN_ON(!host->claimed);
242 242
243 memset(&mrq, 0, sizeof(struct mmc_request));
244
245 memset(cmd->resp, 0, sizeof(cmd->resp)); 243 memset(cmd->resp, 0, sizeof(cmd->resp));
246 cmd->retries = retries; 244 cmd->retries = retries;
247 245
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 1ed3866e990f..845ce7c533b9 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -233,7 +233,7 @@ static int
233mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, 233mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
234 u32 opcode, void *buf, unsigned len) 234 u32 opcode, void *buf, unsigned len)
235{ 235{
236 struct mmc_request mrq; 236 struct mmc_request mrq = {0};
237 struct mmc_command cmd = {0}; 237 struct mmc_command cmd = {0};
238 struct mmc_data data = {0}; 238 struct mmc_data data = {0};
239 struct scatterlist sg; 239 struct scatterlist sg;
@@ -246,8 +246,6 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
246 if (data_buf == NULL) 246 if (data_buf == NULL)
247 return -ENOMEM; 247 return -ENOMEM;
248 248
249 memset(&mrq, 0, sizeof(struct mmc_request));
250
251 mrq.cmd = &cmd; 249 mrq.cmd = &cmd;
252 mrq.data = &data; 250 mrq.data = &data;
253 251
@@ -456,7 +454,7 @@ static int
456mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode, 454mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode,
457 u8 len) 455 u8 len)
458{ 456{
459 struct mmc_request mrq; 457 struct mmc_request mrq = {0};
460 struct mmc_command cmd = {0}; 458 struct mmc_command cmd = {0};
461 struct mmc_data data = {0}; 459 struct mmc_data data = {0};
462 struct scatterlist sg; 460 struct scatterlist sg;
@@ -487,8 +485,6 @@ mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode,
487 if (opcode == MMC_BUS_TEST_W) 485 if (opcode == MMC_BUS_TEST_W)
488 memcpy(data_buf, test_buf, len); 486 memcpy(data_buf, test_buf, len);
489 487
490 memset(&mrq, 0, sizeof(struct mmc_request));
491
492 mrq.cmd = &cmd; 488 mrq.cmd = &cmd;
493 mrq.data = &data; 489 mrq.data = &data;
494 cmd.opcode = opcode; 490 cmd.opcode = opcode;
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index 8023f580b901..a206aea5360d 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -66,7 +66,7 @@ static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
66int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, 66int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
67 struct mmc_command *cmd, int retries) 67 struct mmc_command *cmd, int retries)
68{ 68{
69 struct mmc_request mrq; 69 struct mmc_request mrq = {0};
70 70
71 int i, err; 71 int i, err;
72 72
@@ -243,7 +243,7 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)
243int mmc_app_send_scr(struct mmc_card *card, u32 *scr) 243int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
244{ 244{
245 int err; 245 int err;
246 struct mmc_request mrq; 246 struct mmc_request mrq = {0};
247 struct mmc_command cmd = {0}; 247 struct mmc_command cmd = {0};
248 struct mmc_data data = {0}; 248 struct mmc_data data = {0};
249 struct scatterlist sg; 249 struct scatterlist sg;
@@ -266,8 +266,6 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
266 if (data_buf == NULL) 266 if (data_buf == NULL)
267 return -ENOMEM; 267 return -ENOMEM;
268 268
269 memset(&mrq, 0, sizeof(struct mmc_request));
270
271 mrq.cmd = &cmd; 269 mrq.cmd = &cmd;
272 mrq.data = &data; 270 mrq.data = &data;
273 271
@@ -304,7 +302,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
304int mmc_sd_switch(struct mmc_card *card, int mode, int group, 302int mmc_sd_switch(struct mmc_card *card, int mode, int group,
305 u8 value, u8 *resp) 303 u8 value, u8 *resp)
306{ 304{
307 struct mmc_request mrq; 305 struct mmc_request mrq = {0};
308 struct mmc_command cmd = {0}; 306 struct mmc_command cmd = {0};
309 struct mmc_data data = {0}; 307 struct mmc_data data = {0};
310 struct scatterlist sg; 308 struct scatterlist sg;
@@ -317,8 +315,6 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
317 mode = !!mode; 315 mode = !!mode;
318 value &= 0xF; 316 value &= 0xF;
319 317
320 memset(&mrq, 0, sizeof(struct mmc_request));
321
322 mrq.cmd = &cmd; 318 mrq.cmd = &cmd;
323 mrq.data = &data; 319 mrq.data = &data;
324 320
@@ -351,7 +347,7 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
351int mmc_app_sd_status(struct mmc_card *card, void *ssr) 347int mmc_app_sd_status(struct mmc_card *card, void *ssr)
352{ 348{
353 int err; 349 int err;
354 struct mmc_request mrq; 350 struct mmc_request mrq = {0};
355 struct mmc_command cmd = {0}; 351 struct mmc_command cmd = {0};
356 struct mmc_data data = {0}; 352 struct mmc_data data = {0};
357 struct scatterlist sg; 353 struct scatterlist sg;
@@ -366,8 +362,6 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr)
366 if (err) 362 if (err)
367 return err; 363 return err;
368 364
369 memset(&mrq, 0, sizeof(struct mmc_request));
370
371 mrq.cmd = &cmd; 365 mrq.cmd = &cmd;
372 mrq.data = &data; 366 mrq.data = &data;
373 367
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
index 147dfc1879b3..f087d876c573 100644
--- a/drivers/mmc/core/sdio_ops.c
+++ b/drivers/mmc/core/sdio_ops.c
@@ -121,7 +121,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
121int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, 121int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
122 unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz) 122 unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz)
123{ 123{
124 struct mmc_request mrq; 124 struct mmc_request mrq = {0};
125 struct mmc_command cmd = {0}; 125 struct mmc_command cmd = {0};
126 struct mmc_data data = {0}; 126 struct mmc_data data = {0};
127 struct scatterlist sg; 127 struct scatterlist sg;
@@ -136,8 +136,6 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
136 if (addr & ~0x1FFFF) 136 if (addr & ~0x1FFFF)
137 return -EINVAL; 137 return -EINVAL;
138 138
139 memset(&mrq, 0, sizeof(struct mmc_request));
140
141 mrq.cmd = &cmd; 139 mrq.cmd = &cmd;
142 mrq.data = &data; 140 mrq.data = &data;
143 141