Re: [PATCH V3] mmc: allow upper layers to determine immediately if a card has been removed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Add a function mmc_detect_card_removed() which upper layers
> can use to determine immediately if a card has been removed.
> This function should be called after an I/O request fails so
> that all queued I/O requests can be errored out immediately
> instead of waiting for the card device to be removed.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> ---
>  drivers/mmc/core/core.c  |   51
> +++++++++++++++++++++++++++++++++++++++++++--
>  drivers/mmc/core/core.h  |    3 ++
>  drivers/mmc/core/mmc.c   |   12 ++++++++++-
>  drivers/mmc/core/sd.c    |   12 ++++++++++-
>  drivers/mmc/core/sdio.c  |   11 +++++++++-
>  include/linux/mmc/card.h |    3 ++
>  include/linux/mmc/core.h |    2 +
>  include/linux/mmc/host.h |    1 +
>  8 files changed, 89 insertions(+), 6 deletions(-)
>
...

> +int _mmc_detect_card_removed(struct mmc_host *host)
> +{
> +	int ret;
> +
> +	if (!(host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)

This should be just "if ((host->caps & MMC_CAP_NONREMOVABLE) || ...)"

Otherwise, Acked-by: Sujit Reddy Thumma <sthumma@xxxxxxxxxxxxxx>

> +		return 0;
> +
> +	if (!host->card || mmc_card_removed(host->card))
> +		return 1;
> +
> +	ret = host->bus_ops->alive(host);
> +	if (ret) {
> +		mmc_card_set_removed(host->card);
> +		pr_info("%s: card removed\n", mmc_hostname(host));
> +	}
> +
> +	return ret;
> +}
> +


-- 
Thanks
Sujit

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux