All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Matt Fleming <matt@console-pimps.org>
Cc: linux-mmc@vger.kernel.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ben Dooks <ben-linux@fluff.org>,
	Ben Hutchings <ben@decadent.org.uk>,
	Yunpeng Gao <yunpeng.gao@intel.com>
Subject: Re: [PATCH v2] mmc: Add helper function to check if a card is removable
Date: Thu, 02 Sep 2010 17:48:42 +0900	[thread overview]
Message-ID: <4C7F64EA.2080505@samsung.com> (raw)
In-Reply-To: <47ab65a2e5b756b73fb78efa3a238f0c1c87fa24.1283158644.git.matt@console-pimps.org>

Matt Fleming wrote:
> There are two checks that need to be made when determining whether a
> card is removable. A host controller may set MMC_CAP_NONREMOVABLE if the
> controller does not support removing cards (e.g. eMMC), in which case
> the card is physically non-removable. Also the 'mmc_assume_removable'
> module parameter can be configured at module load time, in which case
> the card may be logically non-removable.
>
> A helper function keeps the logic in one place so that code always
> checks both conditions.
>
> Signed-off-by: Matt Fleming <matt@console-pimps.org>
> ---
>
> Guys, it'd be good if someone could give me a Tested-by: for this patch
> just to make sure that it works as intended. Jaehoon, Kyungmin, does
> this patch work for you?
>
>  drivers/mmc/core/core.h  |    1 -
>  drivers/mmc/core/mmc.c   |    2 +-
>  drivers/mmc/core/sd.c    |    2 +-
>  include/linux/mmc/host.h |    8 ++++++++
>  4 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
> index 9d9eef5..a2ca770 100644
> --- a/drivers/mmc/core/core.h
> +++ b/drivers/mmc/core/core.h
> @@ -58,7 +58,6 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr);
>  
>  /* Module parameters */
>  extern int use_spi_crc;
> -extern int mmc_assume_removable;
>  
>  /* Debugfs information for hosts and cards */
>  void mmc_add_host_debugfs(struct mmc_host *host);
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index dcfc921..66c4a59 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -718,7 +718,7 @@ static void mmc_attach_bus_ops(struct mmc_host *host)
>  {
>  	const struct mmc_bus_ops *bus_ops;
>  
> -	if (host->caps & MMC_CAP_NONREMOVABLE || !mmc_assume_removable)
> +	if (!mmc_card_is_removable(host))
>  		bus_ops = &mmc_ops_unsafe;
>  	else
>  		bus_ops = &mmc_ops;
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 0f52410..bc745e1 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -750,7 +750,7 @@ static void mmc_sd_attach_bus_ops(struct mmc_host *host)
>  {
>  	const struct mmc_bus_ops *bus_ops;
>  
> -	if (host->caps & MMC_CAP_NONREMOVABLE || !mmc_assume_removable)
> +	if (!mmc_card_is_removable(host))
>  		bus_ops = &mmc_sd_ops_unsafe;
>  	else
>  		bus_ops = &mmc_sd_ops;
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 09dbb90..c920cfc 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -272,5 +272,13 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
>  	host->disable_delay = disable_delay;
>  }
>  
> +/* Module parameter */
> +extern int mmc_assume_removable;
> +
> +static inline int mmc_card_is_removable(struct mmc_host *host)
> +{
> +	return (!(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable);
> +}
> +
>  #endif
>  
>   
It's working well.

Tested-by Jaehoon Chung <jh80.chung@samsung.com>


      reply	other threads:[~2010-09-02  8:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-27  6:34 [PATCH] sdhci: disable MMC_CAP_NEEDS_POLL in nonremovable case Jaehoon Chung
2010-08-27  7:09 ` Matt Fleming
2010-08-27  7:14   ` Kyungmin Park
2010-08-27 11:55     ` Gao, Yunpeng
2010-08-28 13:37       ` Matt Fleming
2010-08-28 13:53         ` [PATCH 1/2] mmc: Add helper function to check if a card is removable Matt Fleming
2010-08-28 13:53           ` [PATCH 2/2] sdhci: disable MMC_CAP_NEEDS_POLL in nonremovable case Matt Fleming
2010-08-30  1:06             ` Kyungmin Park
2010-09-02  8:51             ` Jaehoon Chung
2010-09-02  9:14               ` Matt Fleming
2010-09-08  1:27                 ` Jaehoon Chung
2010-09-15 15:11                   ` Matt Fleming
2010-09-15 15:14                     ` Matt Fleming
2010-09-15 20:38                     ` Chris Ball
2010-09-16  2:20                       ` Chris Ball
2010-09-16  9:02                         ` Matt Fleming
2010-09-26  7:31                           ` zhangfei gao
2010-09-27  8:43                             ` Matt Fleming
2010-08-28 14:13           ` [PATCH 1/2] mmc: Add helper function to check if a card is removable Ben Hutchings
2010-08-28 14:28             ` Matt Fleming
2010-08-30  9:59           ` [PATCH v2] " Matt Fleming
2010-09-02  8:48             ` Jaehoon Chung [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C7F64EA.2080505@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=ben-linux@fluff.org \
    --cc=ben@decadent.org.uk \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=matt@console-pimps.org \
    --cc=yunpeng.gao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.