On Sun, 30 Aug 2020 at 15:04, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote: > > > > This isn't how mmc_hw_reset() is intended to be used. Instead, the > > idea is that it should be called by upper layer code, when some error > > path is triggered for an I/O request. > > Hmm, there are some wireless drivers using it as well. I am confused, is > this considered "upper layer"? > > drivers/net/wireless/ath/ath10k/sdio.c: ret = mmc_hw_reset(ar_sdio->func->card->host); > drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: mmc_hw_reset(sdiodev->func1->card->host); > drivers/net/wireless/marvell/mwifiex/sdio.c: ret = mmc_hw_reset(func->card->host); > drivers/net/wireless/ti/wlcore/sdio.c: mmc_hw_reset(card->host); Correct, these are "upper layers". The same applies for the mmc block device driver. In this way there is a guarantee that the struct mmc_card is still present. > > I'd like to understand, so I can add some docs. Because the intended use > is nowhere documented to the best of my knowledge. That would be great. I appreciate all kinds of improvements on the doc parts. > > > However, let me think a bit about this. > > Sure, thanks for the help! Thinking more about this. Perhaps a better option is to return a specific error code for the last request, that makes the core run mmc_hw_reset(). Or potentially, add a host cap and let the core treat some error code, specifically for hosts like tmio. Kind regards Uffe