diff options
| author | Chris Ball <cjb@laptop.org> | 2011-04-13 23:40:30 -0400 | 
|---|---|---|
| committer | Chris Ball <cjb@laptop.org> | 2011-05-24 21:01:52 -0400 | 
| commit | 1278dba167f01bb3c6626d16450d31129d041087 (patch) | |
| tree | 6fb3af716e5437cb558ae37fd8a58db23b9b173e /drivers/mmc/core/sd_ops.c | |
| parent | 62929e4be3fe4cc632b3b03645e083c6548de531 (diff) | |
| download | olio-linux-3.10-1278dba167f01bb3c6626d16450d31129d041087.tar.xz olio-linux-3.10-1278dba167f01bb3c6626d16450d31129d041087.zip  | |
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/core/sd_ops.c')
| -rw-r--r-- | drivers/mmc/core/sd_ops.c | 29 | 
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index da508497a6e..dfe9a9c3f95 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c @@ -24,13 +24,11 @@  static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)  {  	int err; -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	BUG_ON(!host);  	BUG_ON(card && (card->host != host)); -	memset(&cmd, 0, sizeof(struct mmc_command)); -  	cmd.opcode = MMC_APP_CMD;  	if (card) { @@ -121,13 +119,11 @@ EXPORT_SYMBOL(mmc_wait_for_app_cmd);  int mmc_app_set_bus_width(struct mmc_card *card, int width)  {  	int err; -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	BUG_ON(!card);  	BUG_ON(!card->host); -	memset(&cmd, 0, sizeof(struct mmc_command)); -  	cmd.opcode = SD_APP_SET_BUS_WIDTH;  	cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; @@ -151,13 +147,11 @@ int mmc_app_set_bus_width(struct mmc_card *card, int width)  int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)  { -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	int i, err = 0;  	BUG_ON(!host); -	memset(&cmd, 0, sizeof(struct mmc_command)); -  	cmd.opcode = SD_APP_OP_COND;  	if (mmc_host_is_spi(host))  		cmd.arg = ocr & (1 << 30); /* SPI only defines one bit */ @@ -196,13 +190,11 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)  int mmc_send_if_cond(struct mmc_host *host, u32 ocr)  { -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	int err;  	static const u8 test_pattern = 0xAA;  	u8 result_pattern; -	memset(&cmd, 0, sizeof(struct mmc_command)); -  	/*  	 * To support SD 2.0 cards, we must always invoke SD_SEND_IF_COND  	 * before SD_APP_OP_COND. This command will harmlessly fail for @@ -230,13 +222,11 @@ int mmc_send_if_cond(struct mmc_host *host, u32 ocr)  int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)  {  	int err; -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	BUG_ON(!host);  	BUG_ON(!rca); -	memset(&cmd, 0, sizeof(struct mmc_command)); -  	cmd.opcode = SD_SEND_RELATIVE_ADDR;  	cmd.arg = 0;  	cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR; @@ -254,7 +244,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)  {  	int err;  	struct mmc_request mrq; -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	struct mmc_data data;  	struct scatterlist sg;  	void *data_buf; @@ -277,7 +267,6 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)  		return -ENOMEM;  	memset(&mrq, 0, sizeof(struct mmc_request)); -	memset(&cmd, 0, sizeof(struct mmc_command));  	memset(&data, 0, sizeof(struct mmc_data));  	mrq.cmd = &cmd; @@ -317,7 +306,7 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,  	u8 value, u8 *resp)  {  	struct mmc_request mrq; -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	struct mmc_data data;  	struct scatterlist sg; @@ -330,7 +319,6 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,  	value &= 0xF;  	memset(&mrq, 0, sizeof(struct mmc_request)); -	memset(&cmd, 0, sizeof(struct mmc_command));  	memset(&data, 0, sizeof(struct mmc_data));  	mrq.cmd = &cmd; @@ -366,7 +354,7 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr)  {  	int err;  	struct mmc_request mrq; -	struct mmc_command cmd; +	struct mmc_command cmd = {0};  	struct mmc_data data;  	struct scatterlist sg; @@ -381,7 +369,6 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr)  		return err;  	memset(&mrq, 0, sizeof(struct mmc_request)); -	memset(&cmd, 0, sizeof(struct mmc_command));  	memset(&data, 0, sizeof(struct mmc_data));  	mrq.cmd = &cmd;  |