diff mbox

[1/4] mmc: core: Remove unnecessary check for the remove callback

Message ID 1369918391-15277-2-git-send-email-ulf.hansson@stericsson.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ulf Hansson May 30, 2013, 12:53 p.m. UTC
From: Ulf Hansson <ulf.hansson@linaro.org>

For every bus_ops type the .remove callback always exist, thus there
are no need to check the existence of it, before we decide to call it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/core.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Jaehoon Chung May 31, 2013, 7:43 a.m. UTC | #1
Hi Ulf,

According to your commit message, host->bus_ops is also always existed, isn't?

Best Regards,
Jaehoon Chung

On 05/30/2013 09:53 PM, Ulf Hansson wrote:
> From: Ulf Hansson <ulf.hansson@linaro.org>
> 
> For every bus_ops type the .remove callback always exist, thus there
> are no need to check the existence of it, before we decide to call it.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  drivers/mmc/core/core.c |   11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index e9a104b..d2ee282 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2483,9 +2483,7 @@ void mmc_stop_host(struct mmc_host *host)
>  	mmc_bus_get(host);
>  	if (host->bus_ops && !host->bus_dead) {
>  		/* Calling bus_ops->remove() with a claimed host can deadlock */
> -		if (host->bus_ops->remove)
> -			host->bus_ops->remove(host);
> -
> +		host->bus_ops->remove(host);
>  		mmc_claim_host(host);
>  		mmc_detach_bus(host);
>  		mmc_power_off(host);
> @@ -2638,8 +2636,7 @@ int mmc_suspend_host(struct mmc_host *host)
>  			 * bus_ops->remove() with a claimed host can
>  			 * deadlock.)
>  			 */
> -			if (host->bus_ops->remove)
> -				host->bus_ops->remove(host);
> +			host->bus_ops->remove(host);
>  			mmc_claim_host(host);
>  			mmc_detach_bus(host);
>  			mmc_power_off(host);
> @@ -2722,9 +2719,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>  			break;
>  
>  		/* Calling bus_ops->remove() with a claimed host can deadlock */
> -		if (host->bus_ops->remove)
> -			host->bus_ops->remove(host);
> -
> +		host->bus_ops->remove(host);
>  		mmc_claim_host(host);
>  		mmc_detach_bus(host);
>  		mmc_power_off(host);
> 

--
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
Ulf Hansson May 31, 2013, 8:11 a.m. UTC | #2
On 31 May 2013 09:43, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi Ulf,
>
> According to your commit message, host->bus_ops is also always existed, isn't?

I am saying that the .remove callback always exist. Maybe I should
clarify it further somehow?

Kind regards
Ulf Hansson

>
> Best Regards,
> Jaehoon Chung
>
> On 05/30/2013 09:53 PM, Ulf Hansson wrote:
>> From: Ulf Hansson <ulf.hansson@linaro.org>
>>
>> For every bus_ops type the .remove callback always exist, thus there
>> are no need to check the existence of it, before we decide to call it.
>>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>>  drivers/mmc/core/core.c |   11 +++--------
>>  1 file changed, 3 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>> index e9a104b..d2ee282 100644
>> --- a/drivers/mmc/core/core.c
>> +++ b/drivers/mmc/core/core.c
>> @@ -2483,9 +2483,7 @@ void mmc_stop_host(struct mmc_host *host)
>>       mmc_bus_get(host);
>>       if (host->bus_ops && !host->bus_dead) {
>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>> -             if (host->bus_ops->remove)
>> -                     host->bus_ops->remove(host);
>> -
>> +             host->bus_ops->remove(host);
>>               mmc_claim_host(host);
>>               mmc_detach_bus(host);
>>               mmc_power_off(host);
>> @@ -2638,8 +2636,7 @@ int mmc_suspend_host(struct mmc_host *host)
>>                        * bus_ops->remove() with a claimed host can
>>                        * deadlock.)
>>                        */
>> -                     if (host->bus_ops->remove)
>> -                             host->bus_ops->remove(host);
>> +                     host->bus_ops->remove(host);
>>                       mmc_claim_host(host);
>>                       mmc_detach_bus(host);
>>                       mmc_power_off(host);
>> @@ -2722,9 +2719,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>                       break;
>>
>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>> -             if (host->bus_ops->remove)
>> -                     host->bus_ops->remove(host);
>> -
>> +             host->bus_ops->remove(host);
>>               mmc_claim_host(host);
>>               mmc_detach_bus(host);
>>               mmc_power_off(host);
>>
>
--
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
Jaehoon Chung May 31, 2013, 8:22 a.m. UTC | #3
On 05/31/2013 05:11 PM, Ulf Hansson wrote:
> On 31 May 2013 09:43, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> Hi Ulf,
>>
>> According to your commit message, host->bus_ops is also always existed, isn't?
> 
> I am saying that the .remove callback always exist. Maybe I should
> clarify it further somehow?
Sorry if you are confused. My meaning is that according to your commit message,
it didn't need also to check whether host->bus_ops is existed or not.
For example,
if (host->bus_ops && !host->bus_dead) {

Best Regards,
Jaehoon Chung
> 
> Kind regards
> Ulf Hansson
> 
>>
>> Best Regards,
>> Jaehoon Chung
>>
>> On 05/30/2013 09:53 PM, Ulf Hansson wrote:
>>> From: Ulf Hansson <ulf.hansson@linaro.org>
>>>
>>> For every bus_ops type the .remove callback always exist, thus there
>>> are no need to check the existence of it, before we decide to call it.
>>>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>> ---
>>>  drivers/mmc/core/core.c |   11 +++--------
>>>  1 file changed, 3 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>> index e9a104b..d2ee282 100644
>>> --- a/drivers/mmc/core/core.c
>>> +++ b/drivers/mmc/core/core.c
>>> @@ -2483,9 +2483,7 @@ void mmc_stop_host(struct mmc_host *host)
>>>       mmc_bus_get(host);
>>>       if (host->bus_ops && !host->bus_dead) {
>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>> -             if (host->bus_ops->remove)
>>> -                     host->bus_ops->remove(host);
>>> -
>>> +             host->bus_ops->remove(host);
>>>               mmc_claim_host(host);
>>>               mmc_detach_bus(host);
>>>               mmc_power_off(host);
>>> @@ -2638,8 +2636,7 @@ int mmc_suspend_host(struct mmc_host *host)
>>>                        * bus_ops->remove() with a claimed host can
>>>                        * deadlock.)
>>>                        */
>>> -                     if (host->bus_ops->remove)
>>> -                             host->bus_ops->remove(host);
>>> +                     host->bus_ops->remove(host);
>>>                       mmc_claim_host(host);
>>>                       mmc_detach_bus(host);
>>>                       mmc_power_off(host);
>>> @@ -2722,9 +2719,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>>                       break;
>>>
>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>> -             if (host->bus_ops->remove)
>>> -                     host->bus_ops->remove(host);
>>> -
>>> +             host->bus_ops->remove(host);
>>>               mmc_claim_host(host);
>>>               mmc_detach_bus(host);
>>>               mmc_power_off(host);
>>>
>>
> --
> 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
> 

--
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
Ulf Hansson May 31, 2013, 9:33 a.m. UTC | #4
On 31 May 2013 10:22, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> On 05/31/2013 05:11 PM, Ulf Hansson wrote:
>> On 31 May 2013 09:43, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>> Hi Ulf,
>>>
>>> According to your commit message, host->bus_ops is also always existed, isn't?
>>
>> I am saying that the .remove callback always exist. Maybe I should
>> clarify it further somehow?
> Sorry if you are confused. My meaning is that according to your commit message,
> it didn't need also to check whether host->bus_ops is existed or not.
> For example,
> if (host->bus_ops && !host->bus_dead) {

I really can't see this information in the commit msg, I guess we are
reading it differently :-)

Anyway, I will rephrase it so it gets clear.

>
> Best Regards,
> Jaehoon Chung
>>
>> Kind regards
>> Ulf Hansson
>>
>>>
>>> Best Regards,
>>> Jaehoon Chung
>>>
>>> On 05/30/2013 09:53 PM, Ulf Hansson wrote:
>>>> From: Ulf Hansson <ulf.hansson@linaro.org>
>>>>
>>>> For every bus_ops type the .remove callback always exist, thus there
>>>> are no need to check the existence of it, before we decide to call it.
>>>>
>>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>>> ---
>>>>  drivers/mmc/core/core.c |   11 +++--------
>>>>  1 file changed, 3 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>>> index e9a104b..d2ee282 100644
>>>> --- a/drivers/mmc/core/core.c
>>>> +++ b/drivers/mmc/core/core.c
>>>> @@ -2483,9 +2483,7 @@ void mmc_stop_host(struct mmc_host *host)
>>>>       mmc_bus_get(host);
>>>>       if (host->bus_ops && !host->bus_dead) {
>>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>>> -             if (host->bus_ops->remove)
>>>> -                     host->bus_ops->remove(host);
>>>> -
>>>> +             host->bus_ops->remove(host);
>>>>               mmc_claim_host(host);
>>>>               mmc_detach_bus(host);
>>>>               mmc_power_off(host);
>>>> @@ -2638,8 +2636,7 @@ int mmc_suspend_host(struct mmc_host *host)
>>>>                        * bus_ops->remove() with a claimed host can
>>>>                        * deadlock.)
>>>>                        */
>>>> -                     if (host->bus_ops->remove)
>>>> -                             host->bus_ops->remove(host);
>>>> +                     host->bus_ops->remove(host);
>>>>                       mmc_claim_host(host);
>>>>                       mmc_detach_bus(host);
>>>>                       mmc_power_off(host);
>>>> @@ -2722,9 +2719,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>>>                       break;
>>>>
>>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>>> -             if (host->bus_ops->remove)
>>>> -                     host->bus_ops->remove(host);
>>>> -
>>>> +             host->bus_ops->remove(host);
>>>>               mmc_claim_host(host);
>>>>               mmc_detach_bus(host);
>>>>               mmc_power_off(host);
>>>>
>>>
>> --
>> 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
>>
>
--
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
Jaehoon Chung May 31, 2013, 10:50 a.m. UTC | #5
Hi Ulf,

Sorry..:-) I understood clear. it's my mis-understanding.

Best Regards,
Jaehoon Chung

On 05/31/2013 06:33 PM, Ulf Hansson wrote:
> On 31 May 2013 10:22, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> On 05/31/2013 05:11 PM, Ulf Hansson wrote:
>>> On 31 May 2013 09:43, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>>> Hi Ulf,
>>>>
>>>> According to your commit message, host->bus_ops is also always existed, isn't?
>>>
>>> I am saying that the .remove callback always exist. Maybe I should
>>> clarify it further somehow?
>> Sorry if you are confused. My meaning is that according to your commit message,
>> it didn't need also to check whether host->bus_ops is existed or not.
>> For example,
>> if (host->bus_ops && !host->bus_dead) {
> 
> I really can't see this information in the commit msg, I guess we are
> reading it differently :-)
> 
> Anyway, I will rephrase it so it gets clear.
> 
>>
>> Best Regards,
>> Jaehoon Chung
>>>
>>> Kind regards
>>> Ulf Hansson
>>>
>>>>
>>>> Best Regards,
>>>> Jaehoon Chung
>>>>
>>>> On 05/30/2013 09:53 PM, Ulf Hansson wrote:
>>>>> From: Ulf Hansson <ulf.hansson@linaro.org>
>>>>>
>>>>> For every bus_ops type the .remove callback always exist, thus there
>>>>> are no need to check the existence of it, before we decide to call it.
>>>>>
>>>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>>>> ---
>>>>>  drivers/mmc/core/core.c |   11 +++--------
>>>>>  1 file changed, 3 insertions(+), 8 deletions(-)
>>>>>
>>>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>>>> index e9a104b..d2ee282 100644
>>>>> --- a/drivers/mmc/core/core.c
>>>>> +++ b/drivers/mmc/core/core.c
>>>>> @@ -2483,9 +2483,7 @@ void mmc_stop_host(struct mmc_host *host)
>>>>>       mmc_bus_get(host);
>>>>>       if (host->bus_ops && !host->bus_dead) {
>>>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>>>> -             if (host->bus_ops->remove)
>>>>> -                     host->bus_ops->remove(host);
>>>>> -
>>>>> +             host->bus_ops->remove(host);
>>>>>               mmc_claim_host(host);
>>>>>               mmc_detach_bus(host);
>>>>>               mmc_power_off(host);
>>>>> @@ -2638,8 +2636,7 @@ int mmc_suspend_host(struct mmc_host *host)
>>>>>                        * bus_ops->remove() with a claimed host can
>>>>>                        * deadlock.)
>>>>>                        */
>>>>> -                     if (host->bus_ops->remove)
>>>>> -                             host->bus_ops->remove(host);
>>>>> +                     host->bus_ops->remove(host);
>>>>>                       mmc_claim_host(host);
>>>>>                       mmc_detach_bus(host);
>>>>>                       mmc_power_off(host);
>>>>> @@ -2722,9 +2719,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>>>>                       break;
>>>>>
>>>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>>>> -             if (host->bus_ops->remove)
>>>>> -                     host->bus_ops->remove(host);
>>>>> -
>>>>> +             host->bus_ops->remove(host);
>>>>>               mmc_claim_host(host);
>>>>>               mmc_detach_bus(host);
>>>>>               mmc_power_off(host);
>>>>>
>>>>
>>> --
>>> 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
>>>
>>
> --
> 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
> 

--
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
Ulf Hansson May 31, 2013, 3:05 p.m. UTC | #6
On 31 May 2013 12:50, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi Ulf,
>
> Sorry..:-) I understood clear. it's my mis-understanding.

Hi Jaehoon,

OK, cool! :-)

Would be very nice if you had some time to check the other patches in
this series as well.

Thanks!

Ulf Hansson

>
> Best Regards,
> Jaehoon Chung
>
> On 05/31/2013 06:33 PM, Ulf Hansson wrote:
>> On 31 May 2013 10:22, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>> On 05/31/2013 05:11 PM, Ulf Hansson wrote:
>>>> On 31 May 2013 09:43, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>>>> Hi Ulf,
>>>>>
>>>>> According to your commit message, host->bus_ops is also always existed, isn't?
>>>>
>>>> I am saying that the .remove callback always exist. Maybe I should
>>>> clarify it further somehow?
>>> Sorry if you are confused. My meaning is that according to your commit message,
>>> it didn't need also to check whether host->bus_ops is existed or not.
>>> For example,
>>> if (host->bus_ops && !host->bus_dead) {
>>
>> I really can't see this information in the commit msg, I guess we are
>> reading it differently :-)
>>
>> Anyway, I will rephrase it so it gets clear.
>>
>>>
>>> Best Regards,
>>> Jaehoon Chung
>>>>
>>>> Kind regards
>>>> Ulf Hansson
>>>>
>>>>>
>>>>> Best Regards,
>>>>> Jaehoon Chung
>>>>>
>>>>> On 05/30/2013 09:53 PM, Ulf Hansson wrote:
>>>>>> From: Ulf Hansson <ulf.hansson@linaro.org>
>>>>>>
>>>>>> For every bus_ops type the .remove callback always exist, thus there
>>>>>> are no need to check the existence of it, before we decide to call it.
>>>>>>
>>>>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>>>>> ---
>>>>>>  drivers/mmc/core/core.c |   11 +++--------
>>>>>>  1 file changed, 3 insertions(+), 8 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>>>>> index e9a104b..d2ee282 100644
>>>>>> --- a/drivers/mmc/core/core.c
>>>>>> +++ b/drivers/mmc/core/core.c
>>>>>> @@ -2483,9 +2483,7 @@ void mmc_stop_host(struct mmc_host *host)
>>>>>>       mmc_bus_get(host);
>>>>>>       if (host->bus_ops && !host->bus_dead) {
>>>>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>>>>> -             if (host->bus_ops->remove)
>>>>>> -                     host->bus_ops->remove(host);
>>>>>> -
>>>>>> +             host->bus_ops->remove(host);
>>>>>>               mmc_claim_host(host);
>>>>>>               mmc_detach_bus(host);
>>>>>>               mmc_power_off(host);
>>>>>> @@ -2638,8 +2636,7 @@ int mmc_suspend_host(struct mmc_host *host)
>>>>>>                        * bus_ops->remove() with a claimed host can
>>>>>>                        * deadlock.)
>>>>>>                        */
>>>>>> -                     if (host->bus_ops->remove)
>>>>>> -                             host->bus_ops->remove(host);
>>>>>> +                     host->bus_ops->remove(host);
>>>>>>                       mmc_claim_host(host);
>>>>>>                       mmc_detach_bus(host);
>>>>>>                       mmc_power_off(host);
>>>>>> @@ -2722,9 +2719,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
>>>>>>                       break;
>>>>>>
>>>>>>               /* Calling bus_ops->remove() with a claimed host can deadlock */
>>>>>> -             if (host->bus_ops->remove)
>>>>>> -                     host->bus_ops->remove(host);
>>>>>> -
>>>>>> +             host->bus_ops->remove(host);
>>>>>>               mmc_claim_host(host);
>>>>>>               mmc_detach_bus(host);
>>>>>>               mmc_power_off(host);
>>>>>>
>>>>>
>>>> --
>>>> 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
>>>>
>>>
>> --
>> 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
>>
>
--
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
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e9a104b..d2ee282 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2483,9 +2483,7 @@  void mmc_stop_host(struct mmc_host *host)
 	mmc_bus_get(host);
 	if (host->bus_ops && !host->bus_dead) {
 		/* Calling bus_ops->remove() with a claimed host can deadlock */
-		if (host->bus_ops->remove)
-			host->bus_ops->remove(host);
-
+		host->bus_ops->remove(host);
 		mmc_claim_host(host);
 		mmc_detach_bus(host);
 		mmc_power_off(host);
@@ -2638,8 +2636,7 @@  int mmc_suspend_host(struct mmc_host *host)
 			 * bus_ops->remove() with a claimed host can
 			 * deadlock.)
 			 */
-			if (host->bus_ops->remove)
-				host->bus_ops->remove(host);
+			host->bus_ops->remove(host);
 			mmc_claim_host(host);
 			mmc_detach_bus(host);
 			mmc_power_off(host);
@@ -2722,9 +2719,7 @@  int mmc_pm_notify(struct notifier_block *notify_block,
 			break;
 
 		/* Calling bus_ops->remove() with a claimed host can deadlock */
-		if (host->bus_ops->remove)
-			host->bus_ops->remove(host);
-
+		host->bus_ops->remove(host);
 		mmc_claim_host(host);
 		mmc_detach_bus(host);
 		mmc_power_off(host);