Loading drivers/mmc/card/block.c +2 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if ((err != MMC_ERR_NONE) || !(cmd.resp[0] & R1_APP_CMD)) if (err || !(cmd.resp[0] & R1_APP_CMD)) return (u32)-1; memset(&cmd, 0, sizeof(struct mmc_command)); Loading Loading @@ -192,7 +192,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) mmc_wait_for_req(card->host, &mrq); if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) if (cmd.error || data.error) return (u32)-1; blocks = ntohl(blocks); Loading drivers/mmc/core/core.c +2 −2 Original line number Diff line number Diff line Loading @@ -598,7 +598,7 @@ void mmc_rescan(struct work_struct *work) mmc_send_if_cond(host, host->ocr_avail); err = mmc_send_app_op_cond(host, 0, &ocr); if (err == MMC_ERR_NONE) { if (!err) { if (mmc_attach_sd(host, ocr)) mmc_power_off(host); } else { Loading @@ -607,7 +607,7 @@ void mmc_rescan(struct work_struct *work) * searching for MMC cards. */ err = mmc_send_op_cond(host, 0, &ocr); if (err == MMC_ERR_NONE) { if (!err) { if (mmc_attach_mmc(host, ocr)) mmc_power_off(host); } else { Loading drivers/mmc/core/mmc.c +18 −18 Original line number Diff line number Diff line Loading @@ -164,10 +164,10 @@ static int mmc_read_ext_csd(struct mmc_card *card) BUG_ON(!card); err = MMC_ERR_FAILED; err = -EIO; if (card->csd.mmca_vsn < CSD_SPEC_VER_4) return MMC_ERR_NONE; return 0; /* * As the ext_csd is so large and mostly unused, we don't store the Loading @@ -178,11 +178,11 @@ static int mmc_read_ext_csd(struct mmc_card *card) printk(KERN_ERR "%s: could not allocate a buffer to " "receive the ext_csd. mmc v4 cards will be " "treated as v3.\n", mmc_hostname(card->host)); return MMC_ERR_FAILED; return -ENOMEM; } err = mmc_send_ext_csd(card, ext_csd); if (err != MMC_ERR_NONE) { if (err) { /* * High capacity cards should have this "magic" size * stored in their CSD. Loading @@ -197,7 +197,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) "EXT_CSD, performance might " "suffer.\n", mmc_hostname(card->host)); err = MMC_ERR_NONE; err = 0; } goto out; } Loading Loading @@ -258,14 +258,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* The extra bit indicates that we support high capacity */ err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); if (err != MMC_ERR_NONE) if (err) goto err; /* * Fetch CID from card. */ err = mmc_all_send_cid(host, cid); if (err != MMC_ERR_NONE) if (err) goto err; if (oldcard) { Loading @@ -290,7 +290,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Set card RCA. */ err = mmc_set_relative_addr(card); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); Loading @@ -300,7 +300,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Fetch CSD from card. */ err = mmc_send_csd(card, card->raw_csd); if (err != MMC_ERR_NONE) if (err) goto free_card; err = mmc_decode_csd(card); Loading @@ -315,7 +315,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Select card, as all following commands rely on that. */ err = mmc_select_card(card); if (err != MMC_ERR_NONE) if (err) goto free_card; if (!oldcard) { Loading @@ -323,7 +323,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Fetch and process extened CSD. */ err = mmc_read_ext_csd(card); if (err != MMC_ERR_NONE) if (err) goto free_card; } Loading @@ -334,7 +334,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, (host->caps & MMC_CAP_MMC_HIGHSPEED)) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_card_set_highspeed(card); Loading Loading @@ -363,7 +363,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, (host->caps & MMC_CAP_4_BIT_DATA)) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); Loading @@ -372,14 +372,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, if (!oldcard) host->card = card; return MMC_ERR_NONE; return 0; free_card: if (!oldcard) mmc_remove_card(card); err: return MMC_ERR_FAILED; return -EIO; } /* Loading Loading @@ -413,7 +413,7 @@ static void mmc_detect(struct mmc_host *host) mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_remove(host); mmc_claim_host(host); Loading Loading @@ -502,7 +502,7 @@ static void mmc_resume(struct mmc_host *host) err = mmc_init_card(host, host->ocr, host->card); mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_remove(host); mmc_claim_host(host); Loading Loading @@ -565,7 +565,7 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr) * Detect and init the card. */ err = mmc_init_card(host, host->ocr, NULL); if (err != MMC_ERR_NONE) if (err) goto err; mmc_release_host(host); Loading drivers/mmc/core/mmc_ops.c +17 −17 Original line number Diff line number Diff line Loading @@ -40,10 +40,10 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) } err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; return MMC_ERR_NONE; return 0; } int mmc_select_card(struct mmc_card *card) Loading Loading @@ -99,13 +99,13 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) for (i = 100; i; i--) { err = mmc_wait_for_cmd(host, &cmd, 0); if (err != MMC_ERR_NONE) if (err) break; if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0) break; err = MMC_ERR_TIMEOUT; err = -ETIMEDOUT; mmc_delay(10); } Loading @@ -131,12 +131,12 @@ int mmc_all_send_cid(struct mmc_host *host, u32 *cid) cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR; err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; memcpy(cid, cmd.resp, sizeof(u32) * 4); return MMC_ERR_NONE; return 0; } int mmc_set_relative_addr(struct mmc_card *card) Loading @@ -154,10 +154,10 @@ int mmc_set_relative_addr(struct mmc_card *card) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; return MMC_ERR_NONE; return 0; } int mmc_send_csd(struct mmc_card *card, u32 *csd) Loading @@ -176,12 +176,12 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd) cmd.flags = MMC_RSP_R2 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; memcpy(csd, cmd.resp, sizeof(u32) * 4); return MMC_ERR_NONE; return 0; } int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) Loading Loading @@ -218,12 +218,12 @@ int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) mmc_wait_for_req(card->host, &mrq); if (cmd.error != MMC_ERR_NONE) if (cmd.error) return cmd.error; if (data.error != MMC_ERR_NONE) if (data.error) return data.error; return MMC_ERR_NONE; return 0; } int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value) Loading @@ -244,10 +244,10 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value) cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; return MMC_ERR_NONE; return 0; } int mmc_send_status(struct mmc_card *card, u32 *status) Loading @@ -265,12 +265,12 @@ int mmc_send_status(struct mmc_card *card, u32 *status) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; if (status) *status = cmd.resp[0]; return MMC_ERR_NONE; return 0; } drivers/mmc/core/sd.c +28 −28 Original line number Diff line number Diff line Loading @@ -193,30 +193,30 @@ static int mmc_read_switch(struct mmc_card *card) u8 *status; if (card->scr.sda_vsn < SCR_SPEC_VER_1) return MMC_ERR_NONE; return 0; if (!(card->csd.cmdclass & CCC_SWITCH)) { printk(KERN_WARNING "%s: card lacks mandatory switch " "function, performance might suffer.\n", mmc_hostname(card->host)); return MMC_ERR_NONE; return 0; } err = MMC_ERR_FAILED; err = -EIO; status = kmalloc(64, GFP_KERNEL); if (!status) { printk(KERN_ERR "%s: could not allocate a buffer for " "switch capabilities.\n", mmc_hostname(card->host)); return err; return -ENOMEM; } err = mmc_sd_switch(card, 0, 0, 1, status); if (err != MMC_ERR_NONE) { if (err) { printk(KERN_WARNING "%s: problem reading switch " "capabilities, performance might suffer.\n", mmc_hostname(card->host)); err = MMC_ERR_NONE; err = 0; goto out; } Loading @@ -238,28 +238,28 @@ static int mmc_switch_hs(struct mmc_card *card) u8 *status; if (card->scr.sda_vsn < SCR_SPEC_VER_1) return MMC_ERR_NONE; return 0; if (!(card->csd.cmdclass & CCC_SWITCH)) return MMC_ERR_NONE; return 0; if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) return MMC_ERR_NONE; return 0; if (card->sw_caps.hs_max_dtr == 0) return MMC_ERR_NONE; return 0; err = MMC_ERR_FAILED; err = -EIO; status = kmalloc(64, GFP_KERNEL); if (!status) { printk(KERN_ERR "%s: could not allocate a buffer for " "switch capabilities.\n", mmc_hostname(card->host)); return err; return -ENOMEM; } err = mmc_sd_switch(card, 1, 0, 1, status); if (err != MMC_ERR_NONE) if (err) goto out; if ((status[16] & 0xF) != 1) { Loading Loading @@ -309,18 +309,18 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * block-addressed SDHC cards. */ err = mmc_send_if_cond(host, ocr); if (err == MMC_ERR_NONE) if (!err) ocr |= 1 << 30; err = mmc_send_app_op_cond(host, ocr, NULL); if (err != MMC_ERR_NONE) if (err) goto err; /* * Fetch CID from card. */ err = mmc_all_send_cid(host, cid); if (err != MMC_ERR_NONE) if (err) goto err; if (oldcard) { Loading @@ -344,7 +344,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Set card RCA. */ err = mmc_send_relative_addr(host, &card->rca); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); Loading @@ -354,7 +354,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Fetch CSD from card. */ err = mmc_send_csd(card, card->raw_csd); if (err != MMC_ERR_NONE) if (err) goto free_card; err = mmc_decode_csd(card); Loading @@ -368,7 +368,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Select card, as all following commands rely on that. */ err = mmc_select_card(card); if (err != MMC_ERR_NONE) if (err) goto free_card; if (!oldcard) { Loading @@ -376,7 +376,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Fetch SCR from card. */ err = mmc_app_send_scr(card, card->raw_scr); if (err != MMC_ERR_NONE) if (err) goto free_card; err = mmc_decode_scr(card); Loading @@ -387,7 +387,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Fetch switch information from card. */ err = mmc_read_switch(card); if (err != MMC_ERR_NONE) if (err) goto free_card; } Loading @@ -395,7 +395,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Attempt to change to high-speed (if supported) */ err = mmc_switch_hs(card); if (err != MMC_ERR_NONE) if (err) goto free_card; /* Loading @@ -418,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, if ((host->caps & MMC_CAP_4_BIT_DATA) && (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) { err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_width(host, MMC_BUS_WIDTH_4); Loading @@ -442,14 +442,14 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, if (!oldcard) host->card = card; return MMC_ERR_NONE; return 0; free_card: if (!oldcard) mmc_remove_card(card); err: return MMC_ERR_FAILED; return -EIO; } /* Loading Loading @@ -483,7 +483,7 @@ static void mmc_sd_detect(struct mmc_host *host) mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_sd_remove(host); mmc_claim_host(host); Loading Loading @@ -574,7 +574,7 @@ static void mmc_sd_resume(struct mmc_host *host) err = mmc_sd_init_card(host, host->ocr, host->card); mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_sd_remove(host); mmc_claim_host(host); Loading Loading @@ -644,7 +644,7 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr) * Detect and init the card. */ err = mmc_sd_init_card(host, host->ocr, NULL); if (err != MMC_ERR_NONE) if (err) goto err; mmc_release_host(host); Loading Loading
drivers/mmc/card/block.c +2 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if ((err != MMC_ERR_NONE) || !(cmd.resp[0] & R1_APP_CMD)) if (err || !(cmd.resp[0] & R1_APP_CMD)) return (u32)-1; memset(&cmd, 0, sizeof(struct mmc_command)); Loading Loading @@ -192,7 +192,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) mmc_wait_for_req(card->host, &mrq); if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) if (cmd.error || data.error) return (u32)-1; blocks = ntohl(blocks); Loading
drivers/mmc/core/core.c +2 −2 Original line number Diff line number Diff line Loading @@ -598,7 +598,7 @@ void mmc_rescan(struct work_struct *work) mmc_send_if_cond(host, host->ocr_avail); err = mmc_send_app_op_cond(host, 0, &ocr); if (err == MMC_ERR_NONE) { if (!err) { if (mmc_attach_sd(host, ocr)) mmc_power_off(host); } else { Loading @@ -607,7 +607,7 @@ void mmc_rescan(struct work_struct *work) * searching for MMC cards. */ err = mmc_send_op_cond(host, 0, &ocr); if (err == MMC_ERR_NONE) { if (!err) { if (mmc_attach_mmc(host, ocr)) mmc_power_off(host); } else { Loading
drivers/mmc/core/mmc.c +18 −18 Original line number Diff line number Diff line Loading @@ -164,10 +164,10 @@ static int mmc_read_ext_csd(struct mmc_card *card) BUG_ON(!card); err = MMC_ERR_FAILED; err = -EIO; if (card->csd.mmca_vsn < CSD_SPEC_VER_4) return MMC_ERR_NONE; return 0; /* * As the ext_csd is so large and mostly unused, we don't store the Loading @@ -178,11 +178,11 @@ static int mmc_read_ext_csd(struct mmc_card *card) printk(KERN_ERR "%s: could not allocate a buffer to " "receive the ext_csd. mmc v4 cards will be " "treated as v3.\n", mmc_hostname(card->host)); return MMC_ERR_FAILED; return -ENOMEM; } err = mmc_send_ext_csd(card, ext_csd); if (err != MMC_ERR_NONE) { if (err) { /* * High capacity cards should have this "magic" size * stored in their CSD. Loading @@ -197,7 +197,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) "EXT_CSD, performance might " "suffer.\n", mmc_hostname(card->host)); err = MMC_ERR_NONE; err = 0; } goto out; } Loading Loading @@ -258,14 +258,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* The extra bit indicates that we support high capacity */ err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); if (err != MMC_ERR_NONE) if (err) goto err; /* * Fetch CID from card. */ err = mmc_all_send_cid(host, cid); if (err != MMC_ERR_NONE) if (err) goto err; if (oldcard) { Loading @@ -290,7 +290,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Set card RCA. */ err = mmc_set_relative_addr(card); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); Loading @@ -300,7 +300,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Fetch CSD from card. */ err = mmc_send_csd(card, card->raw_csd); if (err != MMC_ERR_NONE) if (err) goto free_card; err = mmc_decode_csd(card); Loading @@ -315,7 +315,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Select card, as all following commands rely on that. */ err = mmc_select_card(card); if (err != MMC_ERR_NONE) if (err) goto free_card; if (!oldcard) { Loading @@ -323,7 +323,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Fetch and process extened CSD. */ err = mmc_read_ext_csd(card); if (err != MMC_ERR_NONE) if (err) goto free_card; } Loading @@ -334,7 +334,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, (host->caps & MMC_CAP_MMC_HIGHSPEED)) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_card_set_highspeed(card); Loading Loading @@ -363,7 +363,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, (host->caps & MMC_CAP_4_BIT_DATA)) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); Loading @@ -372,14 +372,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, if (!oldcard) host->card = card; return MMC_ERR_NONE; return 0; free_card: if (!oldcard) mmc_remove_card(card); err: return MMC_ERR_FAILED; return -EIO; } /* Loading Loading @@ -413,7 +413,7 @@ static void mmc_detect(struct mmc_host *host) mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_remove(host); mmc_claim_host(host); Loading Loading @@ -502,7 +502,7 @@ static void mmc_resume(struct mmc_host *host) err = mmc_init_card(host, host->ocr, host->card); mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_remove(host); mmc_claim_host(host); Loading Loading @@ -565,7 +565,7 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr) * Detect and init the card. */ err = mmc_init_card(host, host->ocr, NULL); if (err != MMC_ERR_NONE) if (err) goto err; mmc_release_host(host); Loading
drivers/mmc/core/mmc_ops.c +17 −17 Original line number Diff line number Diff line Loading @@ -40,10 +40,10 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) } err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; return MMC_ERR_NONE; return 0; } int mmc_select_card(struct mmc_card *card) Loading Loading @@ -99,13 +99,13 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) for (i = 100; i; i--) { err = mmc_wait_for_cmd(host, &cmd, 0); if (err != MMC_ERR_NONE) if (err) break; if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0) break; err = MMC_ERR_TIMEOUT; err = -ETIMEDOUT; mmc_delay(10); } Loading @@ -131,12 +131,12 @@ int mmc_all_send_cid(struct mmc_host *host, u32 *cid) cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR; err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; memcpy(cid, cmd.resp, sizeof(u32) * 4); return MMC_ERR_NONE; return 0; } int mmc_set_relative_addr(struct mmc_card *card) Loading @@ -154,10 +154,10 @@ int mmc_set_relative_addr(struct mmc_card *card) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; return MMC_ERR_NONE; return 0; } int mmc_send_csd(struct mmc_card *card, u32 *csd) Loading @@ -176,12 +176,12 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd) cmd.flags = MMC_RSP_R2 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; memcpy(csd, cmd.resp, sizeof(u32) * 4); return MMC_ERR_NONE; return 0; } int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) Loading Loading @@ -218,12 +218,12 @@ int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) mmc_wait_for_req(card->host, &mrq); if (cmd.error != MMC_ERR_NONE) if (cmd.error) return cmd.error; if (data.error != MMC_ERR_NONE) if (data.error) return data.error; return MMC_ERR_NONE; return 0; } int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value) Loading @@ -244,10 +244,10 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value) cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; return MMC_ERR_NONE; return 0; } int mmc_send_status(struct mmc_card *card, u32 *status) Loading @@ -265,12 +265,12 @@ int mmc_send_status(struct mmc_card *card, u32 *status) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err != MMC_ERR_NONE) if (err) return err; if (status) *status = cmd.resp[0]; return MMC_ERR_NONE; return 0; }
drivers/mmc/core/sd.c +28 −28 Original line number Diff line number Diff line Loading @@ -193,30 +193,30 @@ static int mmc_read_switch(struct mmc_card *card) u8 *status; if (card->scr.sda_vsn < SCR_SPEC_VER_1) return MMC_ERR_NONE; return 0; if (!(card->csd.cmdclass & CCC_SWITCH)) { printk(KERN_WARNING "%s: card lacks mandatory switch " "function, performance might suffer.\n", mmc_hostname(card->host)); return MMC_ERR_NONE; return 0; } err = MMC_ERR_FAILED; err = -EIO; status = kmalloc(64, GFP_KERNEL); if (!status) { printk(KERN_ERR "%s: could not allocate a buffer for " "switch capabilities.\n", mmc_hostname(card->host)); return err; return -ENOMEM; } err = mmc_sd_switch(card, 0, 0, 1, status); if (err != MMC_ERR_NONE) { if (err) { printk(KERN_WARNING "%s: problem reading switch " "capabilities, performance might suffer.\n", mmc_hostname(card->host)); err = MMC_ERR_NONE; err = 0; goto out; } Loading @@ -238,28 +238,28 @@ static int mmc_switch_hs(struct mmc_card *card) u8 *status; if (card->scr.sda_vsn < SCR_SPEC_VER_1) return MMC_ERR_NONE; return 0; if (!(card->csd.cmdclass & CCC_SWITCH)) return MMC_ERR_NONE; return 0; if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) return MMC_ERR_NONE; return 0; if (card->sw_caps.hs_max_dtr == 0) return MMC_ERR_NONE; return 0; err = MMC_ERR_FAILED; err = -EIO; status = kmalloc(64, GFP_KERNEL); if (!status) { printk(KERN_ERR "%s: could not allocate a buffer for " "switch capabilities.\n", mmc_hostname(card->host)); return err; return -ENOMEM; } err = mmc_sd_switch(card, 1, 0, 1, status); if (err != MMC_ERR_NONE) if (err) goto out; if ((status[16] & 0xF) != 1) { Loading Loading @@ -309,18 +309,18 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * block-addressed SDHC cards. */ err = mmc_send_if_cond(host, ocr); if (err == MMC_ERR_NONE) if (!err) ocr |= 1 << 30; err = mmc_send_app_op_cond(host, ocr, NULL); if (err != MMC_ERR_NONE) if (err) goto err; /* * Fetch CID from card. */ err = mmc_all_send_cid(host, cid); if (err != MMC_ERR_NONE) if (err) goto err; if (oldcard) { Loading @@ -344,7 +344,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Set card RCA. */ err = mmc_send_relative_addr(host, &card->rca); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); Loading @@ -354,7 +354,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Fetch CSD from card. */ err = mmc_send_csd(card, card->raw_csd); if (err != MMC_ERR_NONE) if (err) goto free_card; err = mmc_decode_csd(card); Loading @@ -368,7 +368,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Select card, as all following commands rely on that. */ err = mmc_select_card(card); if (err != MMC_ERR_NONE) if (err) goto free_card; if (!oldcard) { Loading @@ -376,7 +376,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Fetch SCR from card. */ err = mmc_app_send_scr(card, card->raw_scr); if (err != MMC_ERR_NONE) if (err) goto free_card; err = mmc_decode_scr(card); Loading @@ -387,7 +387,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Fetch switch information from card. */ err = mmc_read_switch(card); if (err != MMC_ERR_NONE) if (err) goto free_card; } Loading @@ -395,7 +395,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, * Attempt to change to high-speed (if supported) */ err = mmc_switch_hs(card); if (err != MMC_ERR_NONE) if (err) goto free_card; /* Loading @@ -418,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, if ((host->caps & MMC_CAP_4_BIT_DATA) && (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) { err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); if (err != MMC_ERR_NONE) if (err) goto free_card; mmc_set_bus_width(host, MMC_BUS_WIDTH_4); Loading @@ -442,14 +442,14 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, if (!oldcard) host->card = card; return MMC_ERR_NONE; return 0; free_card: if (!oldcard) mmc_remove_card(card); err: return MMC_ERR_FAILED; return -EIO; } /* Loading Loading @@ -483,7 +483,7 @@ static void mmc_sd_detect(struct mmc_host *host) mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_sd_remove(host); mmc_claim_host(host); Loading Loading @@ -574,7 +574,7 @@ static void mmc_sd_resume(struct mmc_host *host) err = mmc_sd_init_card(host, host->ocr, host->card); mmc_release_host(host); if (err != MMC_ERR_NONE) { if (err) { mmc_sd_remove(host); mmc_claim_host(host); Loading Loading @@ -644,7 +644,7 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr) * Detect and init the card. */ err = mmc_sd_init_card(host, host->ocr, NULL); if (err != MMC_ERR_NONE) if (err) goto err; mmc_release_host(host); Loading