aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card/block.c
diff options
context:
space:
mode:
authorChris Ball <cjb@laptop.org>2011-04-13 23:40:30 -0400
committerChris Ball <cjb@laptop.org>2011-05-24 21:01:52 -0400
commit1278dba167f01bb3c6626d16450d31129d041087 (patch)
tree6fb3af716e5437cb558ae37fd8a58db23b9b173e /drivers/mmc/card/block.c
parent62929e4be3fe4cc632b3b03645e083c6548de531 (diff)
mmc: initialize struct mmc_command at declaration time
Converts from: struct mmc_command cmd; memset(&cmd, 0, sizeof(struct mmc_command)); to: struct mmc_command cmd = {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/block.c')
-rw-r--r--drivers/mmc/card/block.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 9e30cf6db53c..93a7efcbfde9 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -260,14 +260,12 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
260 __be32 *blocks; 260 __be32 *blocks;
261 261
262 struct mmc_request mrq; 262 struct mmc_request mrq;
263 struct mmc_command cmd; 263 struct mmc_command cmd = {0};
264 struct mmc_data data; 264 struct mmc_data data;
265 unsigned int timeout_us; 265 unsigned int timeout_us;
266 266
267 struct scatterlist sg; 267 struct scatterlist sg;
268 268
269 memset(&cmd, 0, sizeof(struct mmc_command));
270
271 cmd.opcode = MMC_APP_CMD; 269 cmd.opcode = MMC_APP_CMD;
272 cmd.arg = card->rca << 16; 270 cmd.arg = card->rca << 16;
273 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; 271 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
@@ -328,10 +326,9 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
328 326
329static u32 get_card_status(struct mmc_card *card, struct request *req) 327static u32 get_card_status(struct mmc_card *card, struct request *req)
330{ 328{
331 struct mmc_command cmd; 329 struct mmc_command cmd = {0};
332 int err; 330 int err;
333 331
334 memset(&cmd, 0, sizeof(struct mmc_command));
335 cmd.opcode = MMC_SEND_STATUS; 332 cmd.opcode = MMC_SEND_STATUS;
336 if (!mmc_host_is_spi(card->host)) 333 if (!mmc_host_is_spi(card->host))
337 cmd.arg = card->rca << 16; 334 cmd.arg = card->rca << 16;
@@ -460,7 +457,7 @@ static inline int mmc_apply_rel_rw(struct mmc_blk_request *brq,
460 struct request *req) 457 struct request *req)
461{ 458{
462 int err; 459 int err;
463 struct mmc_command set_count; 460 struct mmc_command set_count = {0};
464 461
465 if (!(card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN)) { 462 if (!(card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN)) {
466 /* Legacy mode imposes restrictions on transfers. */ 463 /* Legacy mode imposes restrictions on transfers. */
@@ -473,7 +470,6 @@ static inline int mmc_apply_rel_rw(struct mmc_blk_request *brq,
473 brq->data.blocks = 1; 470 brq->data.blocks = 1;
474 } 471 }
475 472
476 memset(&set_count, 0, sizeof(struct mmc_command));
477 set_count.opcode = MMC_SET_BLOCK_COUNT; 473 set_count.opcode = MMC_SET_BLOCK_COUNT;
478 set_count.arg = brq->data.blocks | (1 << 31); 474 set_count.arg = brq->data.blocks | (1 << 31);
479 set_count.flags = MMC_RSP_R1 | MMC_CMD_AC; 475 set_count.flags = MMC_RSP_R1 | MMC_CMD_AC;
@@ -501,10 +497,9 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
501 REL_WRITES_SUPPORTED(card); 497 REL_WRITES_SUPPORTED(card);
502 498
503 do { 499 do {
504 struct mmc_command cmd; 500 struct mmc_command cmd = {0};
505 u32 readcmd, writecmd, status = 0; 501 u32 readcmd, writecmd, status = 0;
506 502
507 memset(&cmd, 0, sizeof(struct mmc_command));
508 memset(&brq, 0, sizeof(struct mmc_blk_request)); 503 memset(&brq, 0, sizeof(struct mmc_blk_request));
509 brq.mrq.cmd = &brq.cmd; 504 brq.mrq.cmd = &brq.cmd;
510 brq.mrq.data = &brq.data; 505 brq.mrq.data = &brq.data;