diff mbox

[13/18] mmc: meson-gx: remove unneeded meson_mmc_clk_set in meson_mmc_clk_init

Message ID f891a0bd-62f3-8104-5658-5e8fb2d9e070@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Heiner Kallweit Feb. 14, 2017, 8:06 p.m. UTC
I don't think this clk_disable_unprepare is right here. We do this
in meson_mmc_remove what should be sufficient.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/mmc/host/meson-gx-mmc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Kevin Hilman Feb. 15, 2017, 7:27 p.m. UTC | #1
Heiner Kallweit <hkallweit1@gmail.com> writes:

> I don't think this clk_disable_unprepare is right here. We do this
> in meson_mmc_remove what should be sufficient.

I don't think so, because if _clk_init() fails, then _probe will fail,
and the driver's ->remove() will not be called.

Kevin

> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/mmc/host/meson-gx-mmc.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 74ceda75..39904fb5 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -315,11 +315,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
>  	/* Get the nearest minimum clock to 400KHz */
>  	host->mmc->f_min = clk_round_rate(host->cfg_div_clk, 400000);
>  
> -	ret = meson_mmc_clk_set(host, host->mmc->f_min);
> -	if (!ret)
> -		clk_disable_unprepare(host->cfg_div_clk);
> -
> -	return ret;
> +	return meson_mmc_clk_set(host, host->mmc->f_min);
>  }
>  
>  static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
Heiner Kallweit Feb. 15, 2017, 7:38 p.m. UTC | #2
Am 15.02.2017 um 20:27 schrieb Kevin Hilman:
> Heiner Kallweit <hkallweit1@gmail.com> writes:
> 
>> I don't think this clk_disable_unprepare is right here. We do this
>> in meson_mmc_remove what should be sufficient.
> 
> I don't think so, because if _clk_init() fails, then _probe will fail,
> and the driver's ->remove() will not be called.
> 
In general, then the condition should be "if (ret)", not "if (!ret)".
And if _clk_init() fails, then probe jumps to label free_host,
where we have exactly this clk_disable_unprepare(host->cfg_div_clk)

Heiner

> Kevin
> 
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/mmc/host/meson-gx-mmc.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
>> index 74ceda75..39904fb5 100644
>> --- a/drivers/mmc/host/meson-gx-mmc.c
>> +++ b/drivers/mmc/host/meson-gx-mmc.c
>> @@ -315,11 +315,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
>>  	/* Get the nearest minimum clock to 400KHz */
>>  	host->mmc->f_min = clk_round_rate(host->cfg_div_clk, 400000);
>>  
>> -	ret = meson_mmc_clk_set(host, host->mmc->f_min);
>> -	if (!ret)
>> -		clk_disable_unprepare(host->cfg_div_clk);
>> -
>> -	return ret;
>> +	return meson_mmc_clk_set(host, host->mmc->f_min);
>>  }
>>  
>>  static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>
Kevin Hilman Feb. 15, 2017, 11:56 p.m. UTC | #3
Heiner Kallweit <hkallweit1@gmail.com> writes:

> Am 15.02.2017 um 20:27 schrieb Kevin Hilman:
>> Heiner Kallweit <hkallweit1@gmail.com> writes:
>> 
>>> I don't think this clk_disable_unprepare is right here. We do this
>>> in meson_mmc_remove what should be sufficient.
>> 
>> I don't think so, because if _clk_init() fails, then _probe will fail,
>> and the driver's ->remove() will not be called.
>> 
> In general, then the condition should be "if (ret)", not "if (!ret)".
> And if _clk_init() fails, then probe jumps to label free_host,
> where we have exactly this clk_disable_unprepare(host->cfg_div_clk)

Then you need to update the changelog, which refers to remove, not the
cleanup in probe.

Kevin

>> Kevin
>> 
>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>> ---
>>>  drivers/mmc/host/meson-gx-mmc.c | 6 +-----
>>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
>>> index 74ceda75..39904fb5 100644
>>> --- a/drivers/mmc/host/meson-gx-mmc.c
>>> +++ b/drivers/mmc/host/meson-gx-mmc.c
>>> @@ -315,11 +315,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
>>>  	/* Get the nearest minimum clock to 400KHz */
>>>  	host->mmc->f_min = clk_round_rate(host->cfg_div_clk, 400000);
>>>  
>>> -	ret = meson_mmc_clk_set(host, host->mmc->f_min);
>>> -	if (!ret)
>>> -		clk_disable_unprepare(host->cfg_div_clk);
>>> -
>>> -	return ret;
>>> +	return meson_mmc_clk_set(host, host->mmc->f_min);
>>>  }
>>>  
>>>  static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>
Heiner Kallweit Feb. 16, 2017, 7:05 a.m. UTC | #4
Am 16.02.2017 um 00:56 schrieb Kevin Hilman:
> Heiner Kallweit <hkallweit1@gmail.com> writes:
> 
>> Am 15.02.2017 um 20:27 schrieb Kevin Hilman:
>>> Heiner Kallweit <hkallweit1@gmail.com> writes:
>>>
>>>> I don't think this clk_disable_unprepare is right here. We do this
>>>> in meson_mmc_remove what should be sufficient.
>>>
>>> I don't think so, because if _clk_init() fails, then _probe will fail,
>>> and the driver's ->remove() will not be called.
>>>
>> In general, then the condition should be "if (ret)", not "if (!ret)".
>> And if _clk_init() fails, then probe jumps to label free_host,
>> where we have exactly this clk_disable_unprepare(host->cfg_div_clk)
> 
> Then you need to update the changelog, which refers to remove, not the
> cleanup in probe.
> 
Sure ..

> Kevin
> 
>>> Kevin
>>>
>>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>>> ---
>>>>  drivers/mmc/host/meson-gx-mmc.c | 6 +-----
>>>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
>>>> index 74ceda75..39904fb5 100644
>>>> --- a/drivers/mmc/host/meson-gx-mmc.c
>>>> +++ b/drivers/mmc/host/meson-gx-mmc.c
>>>> @@ -315,11 +315,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
>>>>  	/* Get the nearest minimum clock to 400KHz */
>>>>  	host->mmc->f_min = clk_round_rate(host->cfg_div_clk, 400000);
>>>>  
>>>> -	ret = meson_mmc_clk_set(host, host->mmc->f_min);
>>>> -	if (!ret)
>>>> -		clk_disable_unprepare(host->cfg_div_clk);
>>>> -
>>>> -	return ret;
>>>> +	return meson_mmc_clk_set(host, host->mmc->f_min);
>>>>  }
>>>>  
>>>>  static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>>
>
diff mbox

Patch

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 74ceda75..39904fb5 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -315,11 +315,7 @@  static int meson_mmc_clk_init(struct meson_host *host)
 	/* Get the nearest minimum clock to 400KHz */
 	host->mmc->f_min = clk_round_rate(host->cfg_div_clk, 400000);
 
-	ret = meson_mmc_clk_set(host, host->mmc->f_min);
-	if (!ret)
-		clk_disable_unprepare(host->cfg_div_clk);
-
-	return ret;
+	return meson_mmc_clk_set(host, host->mmc->f_min);
 }
 
 static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)