| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/mmc/core/sd_ops.h |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2006-2007 Pierre Ossman |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or (at |
|---|
| 9 | | - * your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 52 | 48 | } |
|---|
| 53 | 49 | EXPORT_SYMBOL_GPL(mmc_app_cmd); |
|---|
| 54 | 50 | |
|---|
| 55 | | -/** |
|---|
| 56 | | - * mmc_wait_for_app_cmd - start an application command and wait for |
|---|
| 57 | | - completion |
|---|
| 58 | | - * @host: MMC host to start command |
|---|
| 59 | | - * @card: Card to send MMC_APP_CMD to |
|---|
| 60 | | - * @cmd: MMC command to start |
|---|
| 61 | | - * @retries: maximum number of retries |
|---|
| 62 | | - * |
|---|
| 63 | | - * Sends a MMC_APP_CMD, checks the card response, sends the command |
|---|
| 64 | | - * in the parameter and waits for it to complete. Return any error |
|---|
| 65 | | - * that occurred while the command was executing. Do not attempt to |
|---|
| 66 | | - * parse the response. |
|---|
| 67 | | - */ |
|---|
| 68 | | -int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, |
|---|
| 69 | | - struct mmc_command *cmd, int retries) |
|---|
| 51 | +static int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, |
|---|
| 52 | + struct mmc_command *cmd) |
|---|
| 70 | 53 | { |
|---|
| 71 | 54 | struct mmc_request mrq = {}; |
|---|
| 72 | | - |
|---|
| 73 | | - int i, err; |
|---|
| 74 | | - |
|---|
| 75 | | - if (retries < 0) |
|---|
| 76 | | - retries = MMC_CMD_RETRIES; |
|---|
| 77 | | - |
|---|
| 78 | | - err = -EIO; |
|---|
| 55 | + int i, err = -EIO; |
|---|
| 79 | 56 | |
|---|
| 80 | 57 | /* |
|---|
| 81 | 58 | * We have to resend MMC_APP_CMD for each attempt so |
|---|
| 82 | 59 | * we cannot use the retries field in mmc_command. |
|---|
| 83 | 60 | */ |
|---|
| 84 | | - for (i = 0;i <= retries;i++) { |
|---|
| 61 | + for (i = 0; i <= MMC_CMD_RETRIES; i++) { |
|---|
| 85 | 62 | err = mmc_app_cmd(host, card); |
|---|
| 86 | 63 | if (err) { |
|---|
| 87 | 64 | /* no point in retrying; no APP commands allowed */ |
|---|
| .. | .. |
|---|
| 116 | 93 | return err; |
|---|
| 117 | 94 | } |
|---|
| 118 | 95 | |
|---|
| 119 | | -EXPORT_SYMBOL(mmc_wait_for_app_cmd); |
|---|
| 120 | | - |
|---|
| 121 | 96 | int mmc_app_set_bus_width(struct mmc_card *card, int width) |
|---|
| 122 | 97 | { |
|---|
| 123 | 98 | struct mmc_command cmd = {}; |
|---|
| .. | .. |
|---|
| 136 | 111 | return -EINVAL; |
|---|
| 137 | 112 | } |
|---|
| 138 | 113 | |
|---|
| 139 | | - return mmc_wait_for_app_cmd(card->host, card, &cmd, MMC_CMD_RETRIES); |
|---|
| 114 | + return mmc_wait_for_app_cmd(card->host, card, &cmd); |
|---|
| 140 | 115 | } |
|---|
| 141 | 116 | |
|---|
| 142 | 117 | int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) |
|---|
| .. | .. |
|---|
| 152 | 127 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; |
|---|
| 153 | 128 | |
|---|
| 154 | 129 | for (i = 100; i; i--) { |
|---|
| 155 | | - err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES); |
|---|
| 130 | + err = mmc_wait_for_app_cmd(host, NULL, &cmd); |
|---|
| 156 | 131 | if (err) |
|---|
| 157 | 132 | break; |
|---|
| 158 | 133 | |
|---|