* [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards
@ 2022-03-21 11:50 Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset " Wolfram Sang
` (11 more replies)
0 siblings, 12 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, ath10k,
bcm-kernel-feedback-list, brcm80211-dev-list.pdl, linux-amlogic,
linux-arm-kernel, linux-mediatek, linux-rpi-kernel, linux-sunxi,
linux-wireless, netdev, SHA-cyfmac-dev-list
As discussed in 2020 [1], Ulf and I agreed that it would be easier to
understand the {h|s}w_reset mechanisms if it was clear that they are for
cards. This RFC series implements that by adding 'card' to the function
names and changing the parameter to mmc_card where apropriate. Note that
I only changed the MMC core. The SDHCI driver still uses hw_reset in its
ops, I leave it to the SDHCI maintainers if they want to change that.
Also, I didn't convert CAP_HW_RESET to CAP_CARD_HW_RESET yet although it
should be done IMHO. However, we need an agreement on that first.
Finally, I also did not check if all the host drivers are really doing a
card reset or a controller reset. I tried but it was often not obvious
what is actually happening in these functions without proper manuals.
I tested it with my Renesas boards, so far no regressions. Buildbots are
currently checking the series. For this RFC, I sent this as one series
so people can get an overview and comment on that. For a proper release,
I think patches 1-5 should be one series, and 7-10 probably. Patch 6
could then be applied once patches 2-4 hit the net tree. That's my
proposal.
This series is based on mmc/next as of yesterday. A branch is here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/mmc/reset-api
Looking forward to comments. Happy hacking,
Wolfram
[1] https://lore.kernel.org/all/20200916090121.2350-1-wsa+renesas@sang-engineering.com/
Wolfram Sang (10):
mmc: core: improve API to make clear mmc_hw_reset is for cards
ath10k: sdio: update to new MMC API for resetting cards
brcmfmac: sdio: update to new MMC API for resetting cards
mwifiex: sdio: update to new MMC API for resetting cards
wlcore: sdio: update to new MMC API for resetting cards
mmc: core: remove fallback for mmc_hw_reset()
mmc: core: improve API to make clear that mmc_sw_reset is for cards
mmc: core: improve API to make clear hw_reset from bus_ops is for
cards
mmc: core: improve API to make clear sw_reset from bus_ops is for
cards
mmc: improve API to make clear hw_reset callback is for cards
drivers/mmc/core/block.c | 2 +-
drivers/mmc/core/core.c | 31 ++++++++++---------
drivers/mmc/core/core.h | 4 +--
drivers/mmc/core/mmc.c | 10 +++---
drivers/mmc/core/mmc_test.c | 3 +-
drivers/mmc/core/sd.c | 8 ++---
drivers/mmc/core/sdio.c | 12 ++++---
drivers/mmc/host/bcm2835.c | 2 +-
drivers/mmc/host/dw_mmc.c | 2 +-
drivers/mmc/host/meson-mx-sdhc-mmc.c | 2 +-
drivers/mmc/host/mtk-sd.c | 2 +-
drivers/mmc/host/sdhci.c | 2 +-
drivers/mmc/host/sunxi-mmc.c | 2 +-
drivers/mmc/host/uniphier-sd.c | 2 +-
drivers/net/wireless/ath/ath10k/sdio.c | 2 +-
.../broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
drivers/net/wireless/marvell/mwifiex/sdio.c | 2 +-
drivers/net/wireless/ti/wlcore/sdio.c | 2 +-
include/linux/mmc/core.h | 4 +--
include/linux/mmc/host.h | 2 +-
20 files changed, 51 insertions(+), 47 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset is for cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-04-04 12:05 ` Ulf Hansson
2022-03-21 11:50 ` [RFC PATCH 02/10] ath10k: sdio: update to new MMC API for resetting cards Wolfram Sang
` (10 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Ulf Hansson
To make it unambiguous that mmc_hw_reset() is for cards and not for
controllers, we a) add 'card' to the function name and b) make the
function argument mmc_card instead of mmc_host. A fallback is provided
until all users are converted.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/block.c | 2 +-
drivers/mmc/core/core.c | 18 +++++++++++++-----
drivers/mmc/core/mmc_test.c | 3 +--
include/linux/mmc/core.h | 1 +
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 4e67c1403cc9..74674a4650b0 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -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_card_hw_reset(host->card);
/* Ensure we switch back to the correct partition */
if (err) {
struct mmc_blk_data *main_md =
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 368f10405e13..71e75196bc53 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1984,7 +1984,8 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
}
EXPORT_SYMBOL(mmc_set_blocklen);
-static void mmc_hw_reset_for_init(struct mmc_host *host)
+/* we can't use mmc_card as a parameter, it is not populated yet */
+static void mmc_card_hw_reset_for_init(struct mmc_host *host)
{
mmc_pwrseq_reset(host);
@@ -1994,8 +1995,8 @@ 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
+ * mmc_card_hw_reset - reset the card in hardware
+ * @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
@@ -2003,8 +2004,9 @@ static void mmc_hw_reset_for_init(struct mmc_host *host)
*
* Return: 0 on success, -errno on failure
*/
-int mmc_hw_reset(struct mmc_host *host)
+int mmc_card_hw_reset(struct mmc_card *card)
{
+ struct mmc_host *host = card->host;
int ret;
ret = host->bus_ops->hw_reset(host);
@@ -2014,6 +2016,12 @@ int mmc_hw_reset(struct mmc_host *host)
return ret;
}
+EXPORT_SYMBOL(mmc_card_hw_reset);
+
+int mmc_hw_reset(struct mmc_host *host)
+{
+ return mmc_card_hw_reset(host->card);
+}
EXPORT_SYMBOL(mmc_hw_reset);
int mmc_sw_reset(struct mmc_host *host)
@@ -2045,7 +2053,7 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
* Some eMMCs (with VCCQ always on) may not be reset after power up, so
* do a hardware reset if possible.
*/
- mmc_hw_reset_for_init(host);
+ mmc_card_hw_reset_for_init(host);
/*
* sdio_reset sends CMD52 to reset card. Since we do not know
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index e6a2fd2c6d5c..bfcae8f79cbd 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -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_card_hw_reset(card);
if (!err) {
/*
* Reset will re-enable the card's command queue, but tests
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 71101d1ec825..25a7cf69d919 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -176,6 +176,7 @@ 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_card_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);
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 02/10] ath10k: sdio: update to new MMC API for resetting cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset " Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 03/10] brcmfmac: " Wolfram Sang
` (9 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Kalle Valo,
David S. Miller, Jakub Kicinski, ath10k, linux-wireless, netdev
No functional change, only the name and the argument type change to
avoid confusion between resetting a card and a host controller.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
RFC, please do not apply yet.
drivers/net/wireless/ath/ath10k/sdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
index 63e1c2d783c5..b6c9eb0ab9c8 100644
--- a/drivers/net/wireless/ath/ath10k/sdio.c
+++ b/drivers/net/wireless/ath/ath10k/sdio.c
@@ -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_card_hw_reset(ar_sdio->func->card);
if (ret)
ath10k_warn(ar, "unable to reset sdio: %d\n", ret);
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 03/10] brcmfmac: sdio: update to new MMC API for resetting cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset " Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 02/10] ath10k: sdio: update to new MMC API for resetting cards Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-21 11:57 ` Arend van Spriel
2022-03-21 11:50 ` [RFC PATCH 04/10] mwifiex: " Wolfram Sang
` (8 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Arend van Spriel,
Franky Lin, Hante Meuleman, Chi-hsien Lin, Wright Feng,
Chung-hsien Hsu, Kalle Valo, David S. Miller, Jakub Kicinski,
linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
netdev
No functional change, only the name and the argument type change to
avoid confusion between resetting a card and a host controller.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
RFC, please do not apply yet.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 8effeb7a7269..df5b36217a0d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -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_card_hw_reset(sdiodev->func1->card);
sdio_release_host(sdiodev->func1);
brcmf_bus_change_state(sdiodev->bus_if, BRCMF_BUS_DOWN);
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 04/10] mwifiex: sdio: update to new MMC API for resetting cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (2 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 03/10] brcmfmac: " Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 05/10] wlcore: " Wolfram Sang
` (7 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Amitkumar Karwar,
Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo,
David S. Miller, Jakub Kicinski, linux-wireless, netdev
No functional change, only the name and the argument type change to
avoid confusion between resetting a card and a host controller.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
RFC, please do not apply yet.
drivers/net/wireless/marvell/mwifiex/sdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index bde9e4bbfffe..8c3730c7d93e 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -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_card_hw_reset(func->card);
sdio_release_host(func);
switch (ret) {
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 05/10] wlcore: sdio: update to new MMC API for resetting cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (3 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 04/10] mwifiex: " Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 06/10] mmc: core: remove fallback for mmc_hw_reset() Wolfram Sang
` (6 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Kalle Valo,
David S. Miller, Jakub Kicinski, linux-wireless, netdev
No functional change, only the name and the argument type change to
avoid confusion between resetting a card and a host controller.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
RFC, please do not apply yet.
drivers/net/wireless/ti/wlcore/sdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 72fc41ac83c0..62246a98bbc9 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -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_card_hw_reset(card);
sdio_enable_func(func);
sdio_release_host(func);
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 06/10] mmc: core: remove fallback for mmc_hw_reset()
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (4 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 05/10] wlcore: " Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 07/10] mmc: core: improve API to make clear that mmc_sw_reset is for cards Wolfram Sang
` (5 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Ulf Hansson
All users have been converted, the fallback can go now.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/core.c | 6 ------
include/linux/mmc/core.h | 1 -
2 files changed, 7 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 71e75196bc53..7a2985dde0e6 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2018,12 +2018,6 @@ int mmc_card_hw_reset(struct mmc_card *card)
}
EXPORT_SYMBOL(mmc_card_hw_reset);
-int mmc_hw_reset(struct mmc_host *host)
-{
- return mmc_card_hw_reset(host->card);
-}
-EXPORT_SYMBOL(mmc_hw_reset);
-
int mmc_sw_reset(struct mmc_host *host)
{
int ret;
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 25a7cf69d919..7759502c8c67 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -175,7 +175,6 @@ 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_card_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);
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 07/10] mmc: core: improve API to make clear that mmc_sw_reset is for cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (5 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 06/10] mmc: core: remove fallback for mmc_hw_reset() Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops " Wolfram Sang
` (4 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Ulf Hansson
To make it unambiguous that mmc_sw_reset() is for cards and not for
controllers, we a) add 'card' to the function name and b) make the
function argument mmc_card instead of mmc_host. There is no fallback
because there are currently no users.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/core.c | 5 +++--
include/linux/mmc/core.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 7a2985dde0e6..3498b341acaf 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2018,8 +2018,9 @@ int mmc_card_hw_reset(struct mmc_card *card)
}
EXPORT_SYMBOL(mmc_card_hw_reset);
-int mmc_sw_reset(struct mmc_host *host)
+int mmc_card_sw_reset(struct mmc_card *card)
{
+ struct mmc_host *host = card->host;
int ret;
if (!host->bus_ops->sw_reset)
@@ -2032,7 +2033,7 @@ int mmc_sw_reset(struct mmc_host *host)
return ret;
}
-EXPORT_SYMBOL(mmc_sw_reset);
+EXPORT_SYMBOL(mmc_card_sw_reset);
static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
{
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 7759502c8c67..c2616b61c191 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -176,7 +176,7 @@ int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd,
int retries);
int mmc_card_hw_reset(struct mmc_card *card);
-int mmc_sw_reset(struct mmc_host *host);
+int mmc_card_sw_reset(struct mmc_card *card);
void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card);
#endif /* LINUX_MMC_CORE_H */
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops is for cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (6 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 07/10] mmc: core: improve API to make clear that mmc_sw_reset is for cards Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-04-04 12:13 ` Ulf Hansson
2022-03-21 11:50 ` [RFC PATCH 09/10] mmc: core: improve API to make clear sw_reset " Wolfram Sang
` (3 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Ulf Hansson
To make it unambiguous that bus_ops->hw_reset() is for cards and not for
controllers, we a) add 'card' to the function name and b) make the
function argument mmc_card instead of mmc_host. All users are converted,
too.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/core.c | 4 ++--
drivers/mmc/core/core.h | 2 +-
drivers/mmc/core/mmc.c | 6 +++---
drivers/mmc/core/sd.c | 8 ++++----
drivers/mmc/core/sdio.c | 6 +++---
5 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3498b341acaf..1d874b064202 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -969,7 +969,7 @@ void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
}
/*
- * Set initial state after a power cycle or a hw_reset.
+ * Set initial state after a power cycle or a card_hw_reset.
*/
void mmc_set_initial_state(struct mmc_host *host)
{
@@ -2009,7 +2009,7 @@ int mmc_card_hw_reset(struct mmc_card *card)
struct mmc_host *host = card->host;
int ret;
- ret = host->bus_ops->hw_reset(host);
+ ret = host->bus_ops->card_hw_reset(card);
if (ret < 0)
pr_warn("%s: tried to HW reset card, got error %d\n",
mmc_hostname(host), ret);
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index f5f3f623ea49..c54270a6d457 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -27,7 +27,7 @@ struct mmc_bus_ops {
int (*runtime_resume)(struct mmc_host *);
int (*alive)(struct mmc_host *);
int (*shutdown)(struct mmc_host *);
- int (*hw_reset)(struct mmc_host *);
+ int (*card_hw_reset)(struct mmc_card *);
int (*sw_reset)(struct mmc_host *);
bool (*cache_enabled)(struct mmc_host *);
int (*flush_cache)(struct mmc_host *);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index e7ea45386c22..1857f398298b 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2215,9 +2215,9 @@ static int mmc_can_reset(struct mmc_card *card)
return 1;
}
-static int _mmc_hw_reset(struct mmc_host *host)
+static int _mmc_card_hw_reset(struct mmc_card *card)
{
- struct mmc_card *card = host->card;
+ struct mmc_host *host = card->host;
/*
* In the case of recovery, we can't expect flushing the cache to work
@@ -2249,7 +2249,7 @@ static const struct mmc_bus_ops mmc_ops = {
.runtime_resume = mmc_runtime_resume,
.alive = mmc_alive,
.shutdown = mmc_shutdown,
- .hw_reset = _mmc_hw_reset,
+ .card_hw_reset = _mmc_card_hw_reset,
.cache_enabled = _mmc_cache_enabled,
.flush_cache = _mmc_flush_cache,
};
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 68df6b2f49cc..c4a08ee8cdcc 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1784,10 +1784,10 @@ static int mmc_sd_runtime_resume(struct mmc_host *host)
return 0;
}
-static int mmc_sd_hw_reset(struct mmc_host *host)
+static int mmc_sd_card_hw_reset(struct mmc_card *card)
{
- mmc_power_cycle(host, host->card->ocr);
- return mmc_sd_init_card(host, host->card->ocr, host->card);
+ mmc_power_cycle(card->host, card->ocr);
+ return mmc_sd_init_card(card->host, card->ocr, card);
}
static const struct mmc_bus_ops mmc_sd_ops = {
@@ -1799,7 +1799,7 @@ static const struct mmc_bus_ops mmc_sd_ops = {
.resume = mmc_sd_resume,
.alive = mmc_sd_alive,
.shutdown = mmc_sd_suspend,
- .hw_reset = mmc_sd_hw_reset,
+ .card_hw_reset = mmc_sd_card_hw_reset,
.cache_enabled = sd_cache_enabled,
.flush_cache = sd_flush_cache,
};
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 25799accf8a0..30242faf703e 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1128,9 +1128,9 @@ static int mmc_sdio_runtime_resume(struct mmc_host *host)
* Returns 0 if the HW reset was executed synchronously, returns 1 if the HW
* reset was asynchronously scheduled, else a negative error code.
*/
-static int mmc_sdio_hw_reset(struct mmc_host *host)
+static int mmc_sdio_card_hw_reset(struct mmc_card *card)
{
- struct mmc_card *card = host->card;
+ struct mmc_host *host = card->host;
/*
* In case the card is shared among multiple func drivers, reset the
@@ -1175,7 +1175,7 @@ static const struct mmc_bus_ops mmc_sdio_ops = {
.runtime_suspend = mmc_sdio_runtime_suspend,
.runtime_resume = mmc_sdio_runtime_resume,
.alive = mmc_sdio_alive,
- .hw_reset = mmc_sdio_hw_reset,
+ .card_hw_reset = mmc_sdio_card_hw_reset,
.sw_reset = mmc_sdio_sw_reset,
};
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 09/10] mmc: core: improve API to make clear sw_reset from bus_ops is for cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (7 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops " Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 10/10] mmc: improve API to make clear hw_reset callback " Wolfram Sang
` (2 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Ulf Hansson
To make it unambiguous that bus_ops->sw_reset() is for cards and not for
controllers, we a) add 'card' to the function name and b) make the
function argument mmc_card instead of mmc_host. All users are converted,
too.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/core.c | 4 ++--
drivers/mmc/core/core.h | 2 +-
drivers/mmc/core/sdio.c | 6 ++++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 1d874b064202..7e48570007f9 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2023,10 +2023,10 @@ int mmc_card_sw_reset(struct mmc_card *card)
struct mmc_host *host = card->host;
int ret;
- if (!host->bus_ops->sw_reset)
+ if (!host->bus_ops->card_sw_reset)
return -EOPNOTSUPP;
- ret = host->bus_ops->sw_reset(host);
+ ret = host->bus_ops->card_sw_reset(card);
if (ret)
pr_warn("%s: tried to SW reset card, got error %d\n",
mmc_hostname(host), ret);
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index c54270a6d457..27e8435ae779 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -28,7 +28,7 @@ struct mmc_bus_ops {
int (*alive)(struct mmc_host *);
int (*shutdown)(struct mmc_host *);
int (*card_hw_reset)(struct mmc_card *);
- int (*sw_reset)(struct mmc_host *);
+ int (*card_sw_reset)(struct mmc_card *);
bool (*cache_enabled)(struct mmc_host *);
int (*flush_cache)(struct mmc_host *);
};
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 30242faf703e..e6460285b46b 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1154,8 +1154,10 @@ static int mmc_sdio_card_hw_reset(struct mmc_card *card)
return mmc_sdio_reinit_card(host);
}
-static int mmc_sdio_sw_reset(struct mmc_host *host)
+static int mmc_sdio_card_sw_reset(struct mmc_card *card)
{
+ struct mmc_host *host = card->host;
+
mmc_set_clock(host, host->f_init);
sdio_reset(host);
mmc_go_idle(host);
@@ -1176,7 +1178,7 @@ static const struct mmc_bus_ops mmc_sdio_ops = {
.runtime_resume = mmc_sdio_runtime_resume,
.alive = mmc_sdio_alive,
.card_hw_reset = mmc_sdio_card_hw_reset,
- .sw_reset = mmc_sdio_sw_reset,
+ .card_sw_reset = mmc_sdio_card_sw_reset,
};
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH 10/10] mmc: improve API to make clear hw_reset callback is for cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (8 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 09/10] mmc: core: improve API to make clear sw_reset " Wolfram Sang
@ 2022-03-21 11:50 ` Wolfram Sang
2022-03-22 6:43 ` [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset " Wolfram Sang
2022-04-01 16:25 ` Wolfram Sang
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-21 11:50 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, Wolfram Sang, Ulf Hansson,
Nicolas Saenz Julienne, Florian Fainelli, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Jaehoon Chung, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Chaotian Jing,
Matthias Brugger, Adrian Hunter, Maxime Ripard, Chen-Yu Tsai,
Jernej Skrabec, Kunihiko Hayashi, Masami Hiramatsu,
linux-rpi-kernel, linux-arm-kernel, linux-amlogic,
linux-mediatek, linux-sunxi
To make it unambiguous that the hw_reset callback is for cards and not
for controllers, we add 'card' to the callback name and convert all
users in one go. We keep the argument as mmc_host, though, because the
callback is used very early when mmc_card is not yet populated.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/core.c | 4 ++--
drivers/mmc/core/mmc.c | 4 ++--
drivers/mmc/host/bcm2835.c | 2 +-
drivers/mmc/host/dw_mmc.c | 2 +-
drivers/mmc/host/meson-mx-sdhc-mmc.c | 2 +-
drivers/mmc/host/mtk-sd.c | 2 +-
drivers/mmc/host/sdhci.c | 2 +-
drivers/mmc/host/sunxi-mmc.c | 2 +-
drivers/mmc/host/uniphier-sd.c | 2 +-
include/linux/mmc/host.h | 2 +-
10 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 7e48570007f9..9b8455c6e0c3 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1989,9 +1989,9 @@ static void mmc_card_hw_reset_for_init(struct mmc_host *host)
{
mmc_pwrseq_reset(host);
- if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
+ if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->card_hw_reset)
return;
- host->ops->hw_reset(host);
+ host->ops->card_hw_reset(host);
}
/**
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 1857f398298b..9ea837e2c1ab 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2225,11 +2225,11 @@ static int _mmc_card_hw_reset(struct mmc_card *card)
*/
_mmc_flush_cache(host);
- if ((host->caps & MMC_CAP_HW_RESET) && host->ops->hw_reset &&
+ if ((host->caps & MMC_CAP_HW_RESET) && host->ops->card_hw_reset &&
mmc_can_reset(card)) {
/* If the card accept RST_n signal, send it. */
mmc_set_clock(host, host->f_init);
- host->ops->hw_reset(host);
+ host->ops->card_hw_reset(host);
/* Set initial state and call mmc_set_ios */
mmc_set_initial_state(host);
} else {
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 463b707d9e99..641ab4f42125 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1259,7 +1259,7 @@ static void bcm2835_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
static const struct mmc_host_ops bcm2835_ops = {
.request = bcm2835_request,
.set_ios = bcm2835_set_ios,
- .hw_reset = bcm2835_reset,
+ .card_hw_reset = bcm2835_reset,
};
static int bcm2835_add_host(struct bcm2835_host *host)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 06dc56cbada8..581614196a84 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1812,7 +1812,7 @@ static const struct mmc_host_ops dw_mci_ops = {
.set_ios = dw_mci_set_ios,
.get_ro = dw_mci_get_ro,
.get_cd = dw_mci_get_cd,
- .hw_reset = dw_mci_hw_reset,
+ .card_hw_reset = dw_mci_hw_reset,
.enable_sdio_irq = dw_mci_enable_sdio_irq,
.ack_sdio_irq = dw_mci_ack_sdio_irq,
.execute_tuning = dw_mci_execute_tuning,
diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
index 28aa78aa08f3..e92e63cb5641 100644
--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
@@ -511,7 +511,7 @@ static int meson_mx_sdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
}
static const struct mmc_host_ops meson_mx_sdhc_ops = {
- .hw_reset = meson_mx_sdhc_hw_reset,
+ .card_hw_reset = meson_mx_sdhc_hw_reset,
.request = meson_mx_sdhc_request,
.set_ios = meson_mx_sdhc_set_ios,
.card_busy = meson_mx_sdhc_card_busy,
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index e61b0b98065a..195dc897188b 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2458,7 +2458,7 @@ static const struct mmc_host_ops mt_msdc_ops = {
.execute_tuning = msdc_execute_tuning,
.prepare_hs400_tuning = msdc_prepare_hs400_tuning,
.execute_hs400_tuning = msdc_execute_hs400_tuning,
- .hw_reset = msdc_hw_reset,
+ .card_hw_reset = msdc_hw_reset,
};
static const struct cqhci_host_ops msdc_cmdq_ops = {
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 07c6da1f2f0f..22152029e14c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2999,7 +2999,7 @@ static const struct mmc_host_ops sdhci_ops = {
.set_ios = sdhci_set_ios,
.get_cd = sdhci_get_cd,
.get_ro = sdhci_get_ro,
- .hw_reset = sdhci_hw_reset,
+ .card_hw_reset = sdhci_hw_reset,
.enable_sdio_irq = sdhci_enable_sdio_irq,
.ack_sdio_irq = sdhci_ack_sdio_irq,
.start_signal_voltage_switch = sdhci_start_signal_voltage_switch,
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index c62afd212692..0e8fbf4957d8 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1115,7 +1115,7 @@ static const struct mmc_host_ops sunxi_mmc_ops = {
.get_cd = mmc_gpio_get_cd,
.enable_sdio_irq = sunxi_mmc_enable_sdio_irq,
.start_signal_voltage_switch = sunxi_mmc_volt_switch,
- .hw_reset = sunxi_mmc_hw_reset,
+ .card_hw_reset = sunxi_mmc_hw_reset,
.card_busy = sunxi_mmc_card_busy,
};
diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c
index ccbf9885a52b..3a8defdcca77 100644
--- a/drivers/mmc/host/uniphier-sd.c
+++ b/drivers/mmc/host/uniphier-sd.c
@@ -597,7 +597,7 @@ static int uniphier_sd_probe(struct platform_device *pdev)
ret = PTR_ERR(priv->rst_hw);
goto free_host;
}
- host->ops.hw_reset = uniphier_sd_hw_reset;
+ host->ops.card_hw_reset = uniphier_sd_hw_reset;
}
if (host->mmc->caps & MMC_CAP_UHS) {
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7afb57cab00b..c193c50ccd78 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -181,7 +181,7 @@ struct mmc_host_ops {
unsigned int max_dtr, int host_drv,
int card_drv, int *drv_type);
/* Reset the eMMC card via RST_n */
- void (*hw_reset)(struct mmc_host *host);
+ void (*card_hw_reset)(struct mmc_host *host);
void (*card_event)(struct mmc_host *host);
/*
--
2.30.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 03/10] brcmfmac: sdio: update to new MMC API for resetting cards
2022-03-21 11:50 ` [RFC PATCH 03/10] brcmfmac: " Wolfram Sang
@ 2022-03-21 11:57 ` Arend van Spriel
0 siblings, 0 replies; 22+ messages in thread
From: Arend van Spriel @ 2022-03-21 11:57 UTC (permalink / raw)
To: Wolfram Sang, linux-mmc
Cc: linux-renesas-soc, linux-kernel, Arend van Spriel, Franky Lin,
Hante Meuleman, Chi-hsien Lin, Wright Feng, Chung-hsien Hsu,
Kalle Valo, David S. Miller, Jakub Kicinski, linux-wireless,
brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, netdev
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
On 3/21/2022 12:50 PM, Wolfram Sang wrote:
> No functional change, only the name and the argument type change to
> avoid confusion between resetting a card and a host controller.
No comments for the driver side change presented here.
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> RFC, please do not apply yet.
>
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (9 preceding siblings ...)
2022-03-21 11:50 ` [RFC PATCH 10/10] mmc: improve API to make clear hw_reset callback " Wolfram Sang
@ 2022-03-22 6:43 ` Wolfram Sang
2022-04-01 16:25 ` Wolfram Sang
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-03-22 6:43 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, ath10k,
bcm-kernel-feedback-list, brcm80211-dev-list.pdl, linux-amlogic,
linux-arm-kernel, linux-mediatek, linux-rpi-kernel, linux-sunxi,
linux-wireless, netdev, SHA-cyfmac-dev-list
[-- Attachment #1: Type: text/plain, Size: 143 bytes --]
> I tested it with my Renesas boards, so far no regressions. Buildbots are
> currently checking the series.
Update: buildbots are happy \o/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
` (10 preceding siblings ...)
2022-03-22 6:43 ` [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset " Wolfram Sang
@ 2022-04-01 16:25 ` Wolfram Sang
11 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-04-01 16:25 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, linux-kernel, ath10k,
bcm-kernel-feedback-list, brcm80211-dev-list.pdl, linux-amlogic,
linux-arm-kernel, linux-mediatek, linux-rpi-kernel, linux-sunxi,
linux-wireless, netdev, SHA-cyfmac-dev-list
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
> I tested it with my Renesas boards, so far no regressions. Buildbots are
Wishful thinking, the patches crash now when booting. Still checking
what is the difference to when I send the patches out.
Still, looking forward to comments on the general approach.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset is for cards
2022-03-21 11:50 ` [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset " Wolfram Sang
@ 2022-04-04 12:05 ` Ulf Hansson
2022-04-06 7:58 ` Wolfram Sang
0 siblings, 1 reply; 22+ messages in thread
From: Ulf Hansson @ 2022-04-04 12:05 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, linux-kernel
On Mon, 21 Mar 2022 at 12:51, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> To make it unambiguous that mmc_hw_reset() is for cards and not for
> controllers, we a) add 'card' to the function name and b) make the
> function argument mmc_card instead of mmc_host. A fallback is provided
> until all users are converted.
In my opinion, I think b) is sufficient and would be a nice improvement.
In this regard, I suggest we make one big cross-subsystem patch (the
smallest change as possible) then I can pick it up and send it for the
v5.18-rc2.
Br
Uffe
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> drivers/mmc/core/block.c | 2 +-
> drivers/mmc/core/core.c | 18 +++++++++++++-----
> drivers/mmc/core/mmc_test.c | 3 +--
> include/linux/mmc/core.h | 1 +
> 4 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 4e67c1403cc9..74674a4650b0 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -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_card_hw_reset(host->card);
> /* Ensure we switch back to the correct partition */
> if (err) {
> struct mmc_blk_data *main_md =
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 368f10405e13..71e75196bc53 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1984,7 +1984,8 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
> }
> EXPORT_SYMBOL(mmc_set_blocklen);
>
> -static void mmc_hw_reset_for_init(struct mmc_host *host)
> +/* we can't use mmc_card as a parameter, it is not populated yet */
Please drop this. The function is internal/static and at least to me,
rather self-explanatory.
[...]
Kind regards
Uffe
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops is for cards
2022-03-21 11:50 ` [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops " Wolfram Sang
@ 2022-04-04 12:13 ` Ulf Hansson
2022-04-06 8:02 ` Wolfram Sang
0 siblings, 1 reply; 22+ messages in thread
From: Ulf Hansson @ 2022-04-04 12:13 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, linux-kernel
On Mon, 21 Mar 2022 at 12:51, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> To make it unambiguous that bus_ops->hw_reset() is for cards and not for
> controllers, we a) add 'card' to the function name and b) make the
> function argument mmc_card instead of mmc_host. All users are converted,
> too.
Again b) is sufficient in my opinion. All bus_ops are for cards, while
host_ops are for hosts.
Also, there may be some corner cases where b) can't be done, like the
->remove() bus_ops for example. In that case, we either have to make
more re-structuring of the code of simply live with that there may be
some special cases.
[...]
Kind regards
Uffe
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset is for cards
2022-04-04 12:05 ` Ulf Hansson
@ 2022-04-06 7:58 ` Wolfram Sang
2022-04-06 13:53 ` Ulf Hansson
0 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2022-04-06 7:58 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, linux-renesas-soc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]
Hi Ulf,
> > To make it unambiguous that mmc_hw_reset() is for cards and not for
> > controllers, we a) add 'card' to the function name and b) make the
> > function argument mmc_card instead of mmc_host. A fallback is provided
> > until all users are converted.
>
> In my opinion, I think b) is sufficient and would be a nice improvement.
If you say so... but I do wonder why we can't be super clear with the
function name alone without the function argument as an additional
source of information? Kernel hacking is complicated enough.
> In this regard, I suggest we make one big cross-subsystem patch (the
> smallest change as possible) then I can pick it up and send it for the
> v5.18-rc2.
Ok, I can prepare this.
> > -static void mmc_hw_reset_for_init(struct mmc_host *host)
> > +/* we can't use mmc_card as a parameter, it is not populated yet */
>
> Please drop this. The function is internal/static and at least to me,
> rather self-explanatory.
All other ?w_reset() functions have a card as a parameter. For people
trying to get into the MMC core, this comment might be helpful to
understand the anomaly? I know that you as the maintainer do know this
by heart, this comment is meant for people learning the stuff.
All the best,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops is for cards
2022-04-04 12:13 ` Ulf Hansson
@ 2022-04-06 8:02 ` Wolfram Sang
2022-04-06 13:58 ` Ulf Hansson
0 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2022-04-06 8:02 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, linux-renesas-soc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
> > To make it unambiguous that bus_ops->hw_reset() is for cards and not for
> > controllers, we a) add 'card' to the function name and b) make the
> > function argument mmc_card instead of mmc_host. All users are converted,
> > too.
>
> Again b) is sufficient in my opinion. All bus_ops are for cards, while
> host_ops are for hosts.
Okay, this argument I buy right away.
> Also, there may be some corner cases where b) can't be done, like the
> ->remove() bus_ops for example. In that case, we either have to make
> more re-structuring of the code of simply live with that there may be
> some special cases.
With the above argument, I could even imaging to simply drop this patch?
That keeps 'host' consistently as the default argument? All given that
'bus_ops' are for cards anyway.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset is for cards
2022-04-06 7:58 ` Wolfram Sang
@ 2022-04-06 13:53 ` Ulf Hansson
2022-04-07 20:24 ` Wolfram Sang
0 siblings, 1 reply; 22+ messages in thread
From: Ulf Hansson @ 2022-04-06 13:53 UTC (permalink / raw)
To: Wolfram Sang, Ulf Hansson, linux-mmc, linux-renesas-soc, linux-kernel
On Wed, 6 Apr 2022 at 09:58, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi Ulf,
>
> > > To make it unambiguous that mmc_hw_reset() is for cards and not for
> > > controllers, we a) add 'card' to the function name and b) make the
> > > function argument mmc_card instead of mmc_host. A fallback is provided
> > > until all users are converted.
> >
> > In my opinion, I think b) is sufficient and would be a nice improvement.
>
> If you say so... but I do wonder why we can't be super clear with the
> function name alone without the function argument as an additional
> source of information? Kernel hacking is complicated enough.
>
> > In this regard, I suggest we make one big cross-subsystem patch (the
> > smallest change as possible) then I can pick it up and send it for the
> > v5.18-rc2.
>
> Ok, I can prepare this.
Great!
>
> > > -static void mmc_hw_reset_for_init(struct mmc_host *host)
> > > +/* we can't use mmc_card as a parameter, it is not populated yet */
> >
> > Please drop this. The function is internal/static and at least to me,
> > rather self-explanatory.
>
> All other ?w_reset() functions have a card as a parameter. For people
> trying to get into the MMC core, this comment might be helpful to
> understand the anomaly? I know that you as the maintainer do know this
> by heart, this comment is meant for people learning the stuff.
I understand your point, however I don't think it makes much sense to
try to clarify the names on mmc_hw|sw_reset() alone. There are simply
lots of other functions that then would need to be changed too.
Otherwise we would just end up with having even more in-consistency in
function namings. To me, that's even worse.
>
> All the best,
>
> Wolfram
Kind regards
Uffe
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops is for cards
2022-04-06 8:02 ` Wolfram Sang
@ 2022-04-06 13:58 ` Ulf Hansson
2022-04-07 20:26 ` Wolfram Sang
0 siblings, 1 reply; 22+ messages in thread
From: Ulf Hansson @ 2022-04-06 13:58 UTC (permalink / raw)
To: Wolfram Sang, Ulf Hansson, linux-mmc, linux-renesas-soc, linux-kernel
On Wed, 6 Apr 2022 at 10:02, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
>
> > > To make it unambiguous that bus_ops->hw_reset() is for cards and not for
> > > controllers, we a) add 'card' to the function name and b) make the
> > > function argument mmc_card instead of mmc_host. All users are converted,
> > > too.
> >
> > Again b) is sufficient in my opinion. All bus_ops are for cards, while
> > host_ops are for hosts.
>
> Okay, this argument I buy right away.
>
> > Also, there may be some corner cases where b) can't be done, like the
> > ->remove() bus_ops for example. In that case, we either have to make
> > more re-structuring of the code of simply live with that there may be
> > some special cases.
>
> With the above argument, I could even imaging to simply drop this patch?
> That keeps 'host' consistently as the default argument? All given that
> 'bus_ops' are for cards anyway.
I have no strong opinion around this.
Perhaps one simply needs to make a patch to convert them (most of
them) to take a "card" as an in-parameter to really see if that
improves the understanding of code.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset is for cards
2022-04-06 13:53 ` Ulf Hansson
@ 2022-04-07 20:24 ` Wolfram Sang
0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-04-07 20:24 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, linux-renesas-soc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 368 bytes --]
> I understand your point, however I don't think it makes much sense to
> try to clarify the names on mmc_hw|sw_reset() alone. There are simply
> lots of other functions that then would need to be changed too.
> Otherwise we would just end up with having even more in-consistency in
> function namings. To me, that's even worse.
OK, I will follow your suggestions.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops is for cards
2022-04-06 13:58 ` Ulf Hansson
@ 2022-04-07 20:26 ` Wolfram Sang
0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2022-04-07 20:26 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, linux-renesas-soc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 294 bytes --]
> Perhaps one simply needs to make a patch to convert them (most of
> them) to take a "card" as an in-parameter to really see if that
> improves the understanding of code.
Might be worth it, but looks like a seperate patch to me, focused on
bus_ops, not on {h|s}w_reset. I might try it next.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2022-04-07 20:39 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 11:50 [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset is for cards Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 01/10] mmc: core: improve API to make clear mmc_hw_reset " Wolfram Sang
2022-04-04 12:05 ` Ulf Hansson
2022-04-06 7:58 ` Wolfram Sang
2022-04-06 13:53 ` Ulf Hansson
2022-04-07 20:24 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 02/10] ath10k: sdio: update to new MMC API for resetting cards Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 03/10] brcmfmac: " Wolfram Sang
2022-03-21 11:57 ` Arend van Spriel
2022-03-21 11:50 ` [RFC PATCH 04/10] mwifiex: " Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 05/10] wlcore: " Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 06/10] mmc: core: remove fallback for mmc_hw_reset() Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 07/10] mmc: core: improve API to make clear that mmc_sw_reset is for cards Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 08/10] mmc: core: improve API to make clear hw_reset from bus_ops " Wolfram Sang
2022-04-04 12:13 ` Ulf Hansson
2022-04-06 8:02 ` Wolfram Sang
2022-04-06 13:58 ` Ulf Hansson
2022-04-07 20:26 ` Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 09/10] mmc: core: improve API to make clear sw_reset " Wolfram Sang
2022-03-21 11:50 ` [RFC PATCH 10/10] mmc: improve API to make clear hw_reset callback " Wolfram Sang
2022-03-22 6:43 ` [RFC PATCH 00/10] mmc: improve API to make clear {h|s}w_reset " Wolfram Sang
2022-04-01 16:25 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).