On Sat, 26 Jun 2021 at 20:58, Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote: > > Hi Adrian, Ulf, everyone, > > > With the code above, if the host controller knows the card has been > > removed, it can return -ENOMEDIUM from ->execute_tuning() to suppress > > the message. > > On second thought, I like the idea with -ENOMEDIUM. Because tuning can > still fail for reasons other than a removed card and we want to see an > error message then. > > So, I checked when/how to return -ENOMEDIUM for the SDHI driver but this > lead me to more questions. The few driver which return this error code > all follow a similar pattern: > > xxx_request() > { > if (host->get_cd == 1) > submit_mrq > else > cmd->error = -ENOMEDIUM > mmc_request_done() > } > > So, my first question would be if we can't apply this pattern in the > core before calling the .request callback? A lot of drivers are not > implementing this pattern although it seems useful. Is it required? It's required for some sdhci variants, because issuing a command when a card has been removed can hang (or completes after quite a long timeout, I don't recall, Adrian?). > Recommended? Nice to have? However, I could imagine an answer for moving > it into the core is "no, that should be checked atomically"? E.g. sdhci > does it, but atmel-mci and s3cmci do not. If I just look at moving the > card detection call into the core, I don't really see the reason for > atomic. Am I missing something? My main concern would be performance/latency, as we would introduce some overhead for every single request. So, no, we don't want this in the core in my opinion. Kind regards Uffe