aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2021-02-12 14:15:32 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2021-03-30 11:41:58 +0200
commitfefdd3c91e0a7b3cbb3f25925d93a57c45cb0f31 (patch)
tree114e3e85efb226b6e6f7ff4210a7f9ce34ed4ba3 /drivers/mmc/core/core.c
parentmmc: core: Do a power cycle when the CMD11 fails (diff)
downloadlinux-dev-fefdd3c91e0a7b3cbb3f25925d93a57c45cb0f31.tar.xz
linux-dev-fefdd3c91e0a7b3cbb3f25925d93a57c45cb0f31.zip
mmc: core: Drop superfluous validations in mmc_hw|sw_reset()
The mmc_hw|sw_reset() APIs are designed to be called solely from upper layers, which means drivers that operates on top of the struct mmc_card, like the mmc block device driver and an SDIO functional driver. Additionally, as long as the struct mmc_host has a valid pointer to a struct mmc_card, the corresponding host->bus_ops pointer stays valid and assigned. For these reasons, let's drop the superfluous reference counting and the redundant validations in mmc_hw|sw_reset(). Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20210212131532.236775-1-ulf.hansson@linaro.org
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index a6674df2a7bb..99f0df9e0491 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2080,18 +2080,7 @@ int mmc_hw_reset(struct mmc_host *host)
{
int ret;
- if (!host->card)
- return -EINVAL;
-
- mmc_bus_get(host);
- if (!host->bus_ops || host->bus_dead || !host->bus_ops->hw_reset) {
- mmc_bus_put(host);
- return -EOPNOTSUPP;
- }
-
ret = host->bus_ops->hw_reset(host);
- mmc_bus_put(host);
-
if (ret < 0)
pr_warn("%s: tried to HW reset card, got error %d\n",
mmc_hostname(host), ret);
@@ -2104,18 +2093,10 @@ int mmc_sw_reset(struct mmc_host *host)
{
int ret;
- if (!host->card)
- return -EINVAL;
-
- mmc_bus_get(host);
- if (!host->bus_ops || host->bus_dead || !host->bus_ops->sw_reset) {
- mmc_bus_put(host);
+ if (!host->bus_ops->sw_reset)
return -EOPNOTSUPP;
- }
ret = host->bus_ops->sw_reset(host);
- mmc_bus_put(host);
-
if (ret)
pr_warn("%s: tried to SW reset card, got error %d\n",
mmc_hostname(host), ret);