Skip to content

Commit

Permalink
mmc: core: improve API to make clear mmc_hw_reset is for cards
Browse files Browse the repository at this point in the history
To make it unambiguous that mmc_hw_reset() is for cards and not for
controllers, we make the function argument mmc_card instead of mmc_host.
Also, all users are converted.

Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220408080045.6497-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Wolfram Sang authored and Ulf Hansson committed Apr 8, 2022
1 parent 03e59b1 commit b71597e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion drivers/mmc/core/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host,
return -EEXIST;

md->reset_done |= type;
err = mmc_hw_reset(host);
err = mmc_hw_reset(host->card);
/* Ensure we switch back to the correct partition */
if (err) {
struct mmc_blk_data *main_md =
Expand Down
5 changes: 3 additions & 2 deletions drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1995,16 +1995,17 @@ static void mmc_hw_reset_for_init(struct mmc_host *host)

/**
* mmc_hw_reset - reset the card in hardware
* @host: MMC host to which the card is attached
* @card: card to be reset
*
* Hard reset the card. This function is only for upper layers, like the
* block layer or card drivers. You cannot use it in host drivers (struct
* mmc_card might be gone then).
*
* Return: 0 on success, -errno on failure
*/
int mmc_hw_reset(struct mmc_host *host)
int mmc_hw_reset(struct mmc_card *card)
{
struct mmc_host *host = card->host;
int ret;

ret = host->bus_ops->hw_reset(host);
Expand Down
3 changes: 1 addition & 2 deletions drivers/mmc/core/mmc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2325,10 +2325,9 @@ static int mmc_test_profile_sglen_r_nonblock_perf(struct mmc_test_card *test)
static int mmc_test_reset(struct mmc_test_card *test)
{
struct mmc_card *card = test->card;
struct mmc_host *host = card->host;
int err;

err = mmc_hw_reset(host);
err = mmc_hw_reset(card);
if (!err) {
/*
* Reset will re-enable the card's command queue, but tests
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath10k/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ static void ath10k_sdio_hif_power_down(struct ath10k *ar)
return;
}

ret = mmc_hw_reset(ar_sdio->func->card->host);
ret = mmc_hw_reset(ar_sdio->func->card);
if (ret)
ath10k_warn(ar, "unable to reset sdio: %d\n", ret);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -4165,7 +4165,7 @@ static int brcmf_sdio_bus_reset(struct device *dev)

/* reset the adapter */
sdio_claim_host(sdiodev->func1);
mmc_hw_reset(sdiodev->func1->card->host);
mmc_hw_reset(sdiodev->func1->card);
sdio_release_host(sdiodev->func1);

brcmf_bus_change_state(sdiodev->bus_if, BRCMF_BUS_DOWN);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/marvell/mwifiex/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2639,7 +2639,7 @@ static void mwifiex_sdio_card_reset_work(struct mwifiex_adapter *adapter)

/* Run a HW reset of the SDIO interface. */
sdio_claim_host(func);
ret = mmc_hw_reset(func->card->host);
ret = mmc_hw_reset(func->card);
sdio_release_host(func);

switch (ret) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ti/wlcore/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
* To guarantee that the SDIO card is power cycled, as required to make
* the FW programming to succeed, let's do a brute force HW reset.
*/
mmc_hw_reset(card->host);
mmc_hw_reset(card);

sdio_enable_func(func);
sdio_release_host(func);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/mmc/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq);
int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd,
int retries);

int mmc_hw_reset(struct mmc_host *host);
int mmc_hw_reset(struct mmc_card *card);
int mmc_sw_reset(struct mmc_host *host);
void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card);

Expand Down

0 comments on commit b71597e

Please sign in to comment.