linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: mediatek: Fix off-by-one checking for rate_spi
@ 2015-04-21 10:53 Axel Lin
  2015-04-21 10:59 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2015-04-21 10:53 UTC (permalink / raw)
  To: linux-arm-kernel

If rate_spi is 26000000, current code set ck_mhz to 18 rather than 26.
Fix the off-by-one checking for rate_spi.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index db5be1e..e910e19 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -568,9 +568,9 @@ static int pwrap_init_reg_clock(struct pmic_wrapper *wrp)
 
 	rate_spi = clk_get_rate(wrp->clk_spi);
 
-	if (rate_spi > 26000000)
+	if (rate_spi >= 26000000)
 		ck_mhz = 26;
-	else if (rate_spi > 18000000)
+	else if (rate_spi >= 18000000)
 		ck_mhz = 18;
 	else
 		ck_mhz = 0;
-- 
2.1.0

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

* [PATCH] soc: mediatek: Fix off-by-one checking for rate_spi
  2015-04-21 10:53 [PATCH] soc: mediatek: Fix off-by-one checking for rate_spi Axel Lin
@ 2015-04-21 10:59 ` Sascha Hauer
  2015-04-21 11:46   ` Matthias Brugger
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2015-04-21 10:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 21, 2015 at 06:53:32PM +0800, Axel Lin wrote:
> If rate_spi is 26000000, current code set ck_mhz to 18 rather than 26.
> Fix the off-by-one checking for rate_spi.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
>  drivers/soc/mediatek/mtk-pmic-wrap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index db5be1e..e910e19 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -568,9 +568,9 @@ static int pwrap_init_reg_clock(struct pmic_wrapper *wrp)
>  
>  	rate_spi = clk_get_rate(wrp->clk_spi);
>  
> -	if (rate_spi > 26000000)
> +	if (rate_spi >= 26000000)
>  		ck_mhz = 26;
> -	else if (rate_spi > 18000000)
> +	else if (rate_spi >= 18000000)
>  		ck_mhz = 18;
>  	else
>  		ck_mhz = 0;
> -- 
> 2.1.0
> 
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [PATCH] soc: mediatek: Fix off-by-one checking for rate_spi
  2015-04-21 10:59 ` Sascha Hauer
@ 2015-04-21 11:46   ` Matthias Brugger
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Brugger @ 2015-04-21 11:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sascha,

2015-04-21 12:59 GMT+02:00 Sascha Hauer <s.hauer@pengutronix.de>:
> On Tue, Apr 21, 2015 at 06:53:32PM +0800, Axel Lin wrote:
>> If rate_spi is 26000000, current code set ck_mhz to 18 rather than 26.
>> Fix the off-by-one checking for rate_spi.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
>

Can you please explain why you think this is a bug? Please see my
concerns here [1].

Best regards,
Matthias

[1] http://lists.infradead.org/pipermail/linux-mediatek/2015-April/000419.html

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

end of thread, other threads:[~2015-04-21 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-21 10:53 [PATCH] soc: mediatek: Fix off-by-one checking for rate_spi Axel Lin
2015-04-21 10:59 ` Sascha Hauer
2015-04-21 11:46   ` Matthias Brugger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).