Merge branches 'core-fixes-for-linus' and 'irq-fixes-for-linus' of git://git.kernel...
[pandora-kernel.git] / drivers / mmc / core / sd_ops.c
index 76af349..021fed1 100644 (file)
 #include "core.h"
 #include "sd_ops.h"
 
-static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
+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));
@@ -49,6 +49,7 @@ static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(mmc_app_cmd);
 
 /**
  *     mmc_wait_for_app_cmd - start an application command and wait for
@@ -66,7 +67,7 @@ static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
 int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
        struct mmc_command *cmd, int retries)
 {
-       struct mmc_request mrq;
+       struct mmc_request mrq = {0};
 
        int i, err;
 
@@ -119,13 +120,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;
 
@@ -149,13 +148,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 */
@@ -194,7 +191,7 @@ 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;
@@ -226,13 +223,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;
@@ -249,9 +244,9 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)
 int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
 {
        int err;
-       struct mmc_request mrq;
-       struct mmc_command cmd;
-       struct mmc_data data;
+       struct mmc_request mrq = {0};
+       struct mmc_command cmd = {0};
+       struct mmc_data data = {0};
        struct scatterlist sg;
        void *data_buf;
 
@@ -272,10 +267,6 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
        if (data_buf == NULL)
                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;
        mrq.data = &data;
 
@@ -312,9 +303,9 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
 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_data data;
+       struct mmc_request mrq = {0};
+       struct mmc_command cmd = {0};
+       struct mmc_data data = {0};
        struct scatterlist sg;
 
        BUG_ON(!card);
@@ -325,10 +316,6 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
        mode = !!mode;
        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;
        mrq.data = &data;
 
@@ -361,9 +348,9 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
 int mmc_app_sd_status(struct mmc_card *card, void *ssr)
 {
        int err;
-       struct mmc_request mrq;
-       struct mmc_command cmd;
-       struct mmc_data data;
+       struct mmc_request mrq = {0};
+       struct mmc_command cmd = {0};
+       struct mmc_data data = {0};
        struct scatterlist sg;
 
        BUG_ON(!card);
@@ -376,10 +363,6 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr)
        if (err)
                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;
        mrq.data = &data;