mmc: core: Disable card detect during shutdown
authorUlf Hansson <ulf.hansson@linaro.org>
Fri, 3 Dec 2021 14:15:54 +0000 (15:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Dec 2021 11:26:04 +0000 (12:26 +0100)
commit0d66b395210c5084c2b7324945062c1d1f95487a
tree3d6a713e4e5eb41b4a6ad768c5a5b769fe06a592
parentc8e366a01c20019a631d1aa151a918d67757ab8d
mmc: core: Disable card detect during shutdown

commit 66c915d09b942fb3b2b0cb2f56562180901fba17 upstream.

It's seems prone to problems by allowing card detect and its corresponding
mmc_rescan() work to run, during platform shutdown. For example, we may end
up turning off the power while initializing a card, which potentially could
damage it.

To avoid this scenario, let's add ->shutdown_pre() callback for the mmc host
class device and then turn of the card detect from there.

Reported-by: Al Cooper <alcooperx@gmail.com>
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20211203141555.105351-1-ulf.hansson@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/core/core.c
drivers/mmc/core/core.h
drivers/mmc/core/host.c