All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: use the defined function to check whether card is removable
@ 2016-01-28 23:52 Jaehoon Chung
  2016-01-29  0:38 ` Shawn Lin
  2016-02-02 13:11 ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Jaehoon Chung @ 2016-01-28 23:52 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, adrian.hunter, shawn.lin, Jaehoon Chung

In linux/mmc/host.h, mmc_card_is_removable() is already defined.
There is no reason that it doesn't use.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/core/core.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f95d41f..9da9b60 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2532,7 +2532,7 @@ int mmc_detect_card_removed(struct mmc_host *host)
 	if (!card)
 		return 1;
 
-	if (host->caps & MMC_CAP_NONREMOVABLE)
+	if (!mmc_card_is_removable(host))
 		return 0;
 
 	ret = mmc_card_removed(card);
@@ -2570,7 +2570,7 @@ void mmc_rescan(struct work_struct *work)
 		return;
 
 	/* If there is a non-removable card registered, only scan once */
-	if ((host->caps & MMC_CAP_NONREMOVABLE) && host->rescan_entered)
+	if (!mmc_card_is_removable(host) && host->rescan_entered)
 		return;
 	host->rescan_entered = 1;
 
@@ -2587,8 +2587,7 @@ void mmc_rescan(struct work_struct *work)
 	 * if there is a _removable_ card registered, check whether it is
 	 * still present
 	 */
-	if (host->bus_ops && !host->bus_dead
-	    && !(host->caps & MMC_CAP_NONREMOVABLE))
+	if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host))
 		host->bus_ops->detect(host);
 
 	host->detect_change = 0;
@@ -2613,7 +2612,7 @@ void mmc_rescan(struct work_struct *work)
 	mmc_bus_put(host);
 
 	mmc_claim_host(host);
-	if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->get_cd &&
+	if (mmc_card_is_removable(host) && host->ops->get_cd &&
 			host->ops->get_cd(host) == 0) {
 		mmc_power_off(host);
 		mmc_release_host(host);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: core: use the defined function to check whether card is removable
  2016-01-28 23:52 [PATCH] mmc: core: use the defined function to check whether card is removable Jaehoon Chung
@ 2016-01-29  0:38 ` Shawn Lin
  2016-02-02 13:11 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Shawn Lin @ 2016-01-29  0:38 UTC (permalink / raw)
  To: Jaehoon Chung, linux-mmc; +Cc: shawn.lin, ulf.hansson, adrian.hunter

Hi Jaehoon,

On 2016/1/29 7:52, Jaehoon Chung wrote:
> In linux/mmc/host.h, mmc_card_is_removable() is already defined.
> There is no reason that it doesn't use.
>

It's good to use it. But, I find some host drivers also use
"caps & MMC_CAP_NONREMOVABLE". How about respin a patchset to
slove them ?  :)

> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>   drivers/mmc/core/core.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index f95d41f..9da9b60 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2532,7 +2532,7 @@ int mmc_detect_card_removed(struct mmc_host *host)
>   	if (!card)
>   		return 1;
>
> -	if (host->caps & MMC_CAP_NONREMOVABLE)
> +	if (!mmc_card_is_removable(host))
>   		return 0;
>
>   	ret = mmc_card_removed(card);
> @@ -2570,7 +2570,7 @@ void mmc_rescan(struct work_struct *work)
>   		return;
>
>   	/* If there is a non-removable card registered, only scan once */
> -	if ((host->caps & MMC_CAP_NONREMOVABLE) && host->rescan_entered)
> +	if (!mmc_card_is_removable(host) && host->rescan_entered)
>   		return;
>   	host->rescan_entered = 1;
>
> @@ -2587,8 +2587,7 @@ void mmc_rescan(struct work_struct *work)
>   	 * if there is a _removable_ card registered, check whether it is
>   	 * still present
>   	 */
> -	if (host->bus_ops && !host->bus_dead
> -	    && !(host->caps & MMC_CAP_NONREMOVABLE))
> +	if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host))
>   		host->bus_ops->detect(host);
>
>   	host->detect_change = 0;
> @@ -2613,7 +2612,7 @@ void mmc_rescan(struct work_struct *work)
>   	mmc_bus_put(host);
>
>   	mmc_claim_host(host);
> -	if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->get_cd &&
> +	if (mmc_card_is_removable(host) && host->ops->get_cd &&
>   			host->ops->get_cd(host) == 0) {
>   		mmc_power_off(host);
>   		mmc_release_host(host);
>


-- 
Best Regards
Shawn Lin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: core: use the defined function to check whether card is removable
  2016-01-28 23:52 [PATCH] mmc: core: use the defined function to check whether card is removable Jaehoon Chung
  2016-01-29  0:38 ` Shawn Lin
@ 2016-02-02 13:11 ` Ulf Hansson
  2016-02-04  5:56   ` Jaehoon Chung
  1 sibling, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2016-02-02 13:11 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, Adrian Hunter, Shawn Lin

On 29 January 2016 at 00:52, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> In linux/mmc/host.h, mmc_card_is_removable() is already defined.
> There is no reason that it doesn't use.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

Thanks, applied for next!

Regarding the host drivers, as pointed out by Shawn. Let's fix them in
one separate patch.

Kind regards
Uffe

> ---
>  drivers/mmc/core/core.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index f95d41f..9da9b60 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2532,7 +2532,7 @@ int mmc_detect_card_removed(struct mmc_host *host)
>         if (!card)
>                 return 1;
>
> -       if (host->caps & MMC_CAP_NONREMOVABLE)
> +       if (!mmc_card_is_removable(host))
>                 return 0;
>
>         ret = mmc_card_removed(card);
> @@ -2570,7 +2570,7 @@ void mmc_rescan(struct work_struct *work)
>                 return;
>
>         /* If there is a non-removable card registered, only scan once */
> -       if ((host->caps & MMC_CAP_NONREMOVABLE) && host->rescan_entered)
> +       if (!mmc_card_is_removable(host) && host->rescan_entered)
>                 return;
>         host->rescan_entered = 1;
>
> @@ -2587,8 +2587,7 @@ void mmc_rescan(struct work_struct *work)
>          * if there is a _removable_ card registered, check whether it is
>          * still present
>          */
> -       if (host->bus_ops && !host->bus_dead
> -           && !(host->caps & MMC_CAP_NONREMOVABLE))
> +       if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host))
>                 host->bus_ops->detect(host);
>
>         host->detect_change = 0;
> @@ -2613,7 +2612,7 @@ void mmc_rescan(struct work_struct *work)
>         mmc_bus_put(host);
>
>         mmc_claim_host(host);
> -       if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->get_cd &&
> +       if (mmc_card_is_removable(host) && host->ops->get_cd &&
>                         host->ops->get_cd(host) == 0) {
>                 mmc_power_off(host);
>                 mmc_release_host(host);
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: core: use the defined function to check whether card is removable
  2016-02-02 13:11 ` Ulf Hansson
@ 2016-02-04  5:56   ` Jaehoon Chung
  0 siblings, 0 replies; 4+ messages in thread
From: Jaehoon Chung @ 2016-02-04  5:56 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Adrian Hunter, Shawn Lin

On 02/02/2016 10:11 PM, Ulf Hansson wrote:
> On 29 January 2016 at 00:52, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> In linux/mmc/host.h, mmc_card_is_removable() is already defined.
>> There is no reason that it doesn't use.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> 
> Thanks, applied for next!
> 
> Regarding the host drivers, as pointed out by Shawn. Let's fix them in
> one separate patch.

I will do it. Thanks!

Best Regards,
Jaehoon Chung

> 
> Kind regards
> Uffe
> 
>> ---
>>  drivers/mmc/core/core.c | 9 ++++-----
>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>> index f95d41f..9da9b60 100644
>> --- a/drivers/mmc/core/core.c
>> +++ b/drivers/mmc/core/core.c
>> @@ -2532,7 +2532,7 @@ int mmc_detect_card_removed(struct mmc_host *host)
>>         if (!card)
>>                 return 1;
>>
>> -       if (host->caps & MMC_CAP_NONREMOVABLE)
>> +       if (!mmc_card_is_removable(host))
>>                 return 0;
>>
>>         ret = mmc_card_removed(card);
>> @@ -2570,7 +2570,7 @@ void mmc_rescan(struct work_struct *work)
>>                 return;
>>
>>         /* If there is a non-removable card registered, only scan once */
>> -       if ((host->caps & MMC_CAP_NONREMOVABLE) && host->rescan_entered)
>> +       if (!mmc_card_is_removable(host) && host->rescan_entered)
>>                 return;
>>         host->rescan_entered = 1;
>>
>> @@ -2587,8 +2587,7 @@ void mmc_rescan(struct work_struct *work)
>>          * if there is a _removable_ card registered, check whether it is
>>          * still present
>>          */
>> -       if (host->bus_ops && !host->bus_dead
>> -           && !(host->caps & MMC_CAP_NONREMOVABLE))
>> +       if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host))
>>                 host->bus_ops->detect(host);
>>
>>         host->detect_change = 0;
>> @@ -2613,7 +2612,7 @@ void mmc_rescan(struct work_struct *work)
>>         mmc_bus_put(host);
>>
>>         mmc_claim_host(host);
>> -       if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->get_cd &&
>> +       if (mmc_card_is_removable(host) && host->ops->get_cd &&
>>                         host->ops->get_cd(host) == 0) {
>>                 mmc_power_off(host);
>>                 mmc_release_host(host);
>> --
>> 1.9.1
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-04  5:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-28 23:52 [PATCH] mmc: core: use the defined function to check whether card is removable Jaehoon Chung
2016-01-29  0:38 ` Shawn Lin
2016-02-02 13:11 ` Ulf Hansson
2016-02-04  5:56   ` Jaehoon Chung

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.