mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume
Based on a patch-set originally written by Maxim Levitsky.
If you don't use CONFIG_MMC_UNSAFE_RESUME, as soon as you attempt to
suspend, the card will be removed, therefore this patch doesn't change the
behavior of this option.
However the removal will be done by pm notifier, which runs while
userspace is still not frozen and thus can freely use del_gendisk, without
the risk of deadlock which would happen otherwise.
Card detect workqueue is now disabled while userspace is frozen, Therefore
if you do use CONFIG_MMC_UNSAFE_RESUME, and remove the card during
suspend, the removal will be detected as soon as userspace is unfrozen,
again at the moment it is safe to call del_gendisk.
Tested with and without CONFIG_MMC_UNSAFE_RESUME with suspend and hibernate.
The patch looks good to me as well. My suggestion is to get the bug description
in the standard SRU request format. Note, we don't require the patch to first
be upstream, we just prefer that in most cases. We will still process any patch
on a case by case basis for inclusion into one of the stable releases.