diff options
author | Chris Ball <cjb@laptop.org> | 2011-04-13 23:46:05 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-05-24 21:01:56 -0400 |
commit | a61ad2b49bfce94dfddce828cd9222e4b9e7825b (patch) | |
tree | 36f93e61adc7c7d7523c78c78c3df1e75fae5e33 /drivers/mmc/card | |
parent | 1278dba167f01bb3c6626d16450d31129d041087 (diff) |
mmc: initialize struct mmc_data at declaration time
Converts from:
struct mmc_data data;
memset(&data, 0, sizeof(struct mmc_data));
to:
struct mmc_data data = {0};
because it's shorter, as performant, and easier to work out whether
initialization has happened.
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/block.c | 4 | ||||
-rw-r--r-- | drivers/mmc/card/mmc_test.c | 9 |
2 files changed, 4 insertions, 9 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 93a7efcbfde9..fb387c803205 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -261,7 +261,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
261 | 261 | ||
262 | struct mmc_request mrq; | 262 | struct mmc_request mrq; |
263 | struct mmc_command cmd = {0}; | 263 | struct mmc_command cmd = {0}; |
264 | struct mmc_data data; | 264 | struct mmc_data data = {0}; |
265 | unsigned int timeout_us; | 265 | unsigned int timeout_us; |
266 | 266 | ||
267 | struct scatterlist sg; | 267 | struct scatterlist sg; |
@@ -282,8 +282,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
282 | cmd.arg = 0; | 282 | cmd.arg = 0; |
283 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; | 283 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; |
284 | 284 | ||
285 | memset(&data, 0, sizeof(struct mmc_data)); | ||
286 | |||
287 | data.timeout_ns = card->csd.tacc_ns * 100; | 285 | data.timeout_ns = card->csd.tacc_ns * 100; |
288 | data.timeout_clks = card->csd.tacc_clks * 100; | 286 | data.timeout_clks = card->csd.tacc_clks * 100; |
289 | 287 | ||
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 95c298faeb48..f44762b6e592 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -249,12 +249,11 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test, | |||
249 | struct mmc_request mrq; | 249 | struct mmc_request mrq; |
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; | 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)); | 256 | memset(&mrq, 0, sizeof(struct mmc_request)); |
257 | memset(&data, 0, sizeof(struct mmc_data)); | ||
258 | 257 | ||
259 | mrq.cmd = &cmd; | 258 | mrq.cmd = &cmd; |
260 | mrq.data = &data; | 259 | mrq.data = &data; |
@@ -732,10 +731,9 @@ static int mmc_test_simple_transfer(struct mmc_test_card *test, | |||
732 | struct mmc_request mrq; | 731 | struct mmc_request mrq; |
733 | struct mmc_command cmd = {0}; | 732 | struct mmc_command cmd = {0}; |
734 | struct mmc_command stop = {0}; | 733 | struct mmc_command stop = {0}; |
735 | struct mmc_data data; | 734 | struct mmc_data data = {0}; |
736 | 735 | ||
737 | memset(&mrq, 0, sizeof(struct mmc_request)); | 736 | memset(&mrq, 0, sizeof(struct mmc_request)); |
738 | memset(&data, 0, sizeof(struct mmc_data)); | ||
739 | 737 | ||
740 | mrq.cmd = &cmd; | 738 | mrq.cmd = &cmd; |
741 | mrq.data = &data; | 739 | mrq.data = &data; |
@@ -760,12 +758,11 @@ static int mmc_test_broken_transfer(struct mmc_test_card *test, | |||
760 | struct mmc_request mrq; | 758 | struct mmc_request mrq; |
761 | struct mmc_command cmd = {0}; | 759 | struct mmc_command cmd = {0}; |
762 | struct mmc_command stop = {0}; | 760 | struct mmc_command stop = {0}; |
763 | struct mmc_data data; | 761 | struct mmc_data data = {0}; |
764 | 762 | ||
765 | struct scatterlist sg; | 763 | struct scatterlist sg; |
766 | 764 | ||
767 | memset(&mrq, 0, sizeof(struct mmc_request)); | 765 | memset(&mrq, 0, sizeof(struct mmc_request)); |
768 | memset(&data, 0, sizeof(struct mmc_data)); | ||
769 | 766 | ||
770 | mrq.cmd = &cmd; | 767 | mrq.cmd = &cmd; |
771 | mrq.data = &data; | 768 | mrq.data = &data; |