* [PATCH] mmc: sh_mmcif: Simplify division/shift logic
@ 2022-02-21 16:27 Geert Uytterhoeven
2022-02-28 17:05 ` Ulf Hansson
2022-03-01 14:50 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2022-02-21 16:27 UTC (permalink / raw)
To: Ulf Hansson, Wolfram Sang
Cc: linux-mmc, linux-renesas-soc, Geert Uytterhoeven
"a / (1 << b)" == "a >> b".
No change in generated code.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/mmc/host/sh_mmcif.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 104dcd702870c423..5f9ebf045b1cb22b 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -521,8 +521,7 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
}
dev_dbg(dev, "clk %u/%u (%u, 0x%x)\n",
- (best_freq / (1 << (clkdiv + 1))), clk,
- best_freq, clkdiv);
+ (best_freq >> (clkdiv + 1)), clk, best_freq, clkdiv);
clk_set_rate(host->clk, best_freq);
clkdiv = clkdiv << 16;
@@ -1012,8 +1011,8 @@ static void sh_mmcif_clk_setup(struct sh_mmcif_host *host)
*/
host->clkdiv_map = 0x3ff;
- host->mmc->f_max = f_max / (1 << ffs(host->clkdiv_map));
- host->mmc->f_min = f_min / (1 << fls(host->clkdiv_map));
+ host->mmc->f_max = f_max >> ffs(host->clkdiv_map);
+ host->mmc->f_min = f_min >> fls(host->clkdiv_map);
} else {
unsigned int clk = clk_get_rate(host->clk);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sh_mmcif: Simplify division/shift logic
2022-02-21 16:27 [PATCH] mmc: sh_mmcif: Simplify division/shift logic Geert Uytterhoeven
@ 2022-02-28 17:05 ` Ulf Hansson
2022-03-01 14:50 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2022-02-28 17:05 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Wolfram Sang, linux-mmc, linux-renesas-soc
On Mon, 21 Feb 2022 at 17:27, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> "a / (1 << b)" == "a >> b".
>
> No change in generated code.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sh_mmcif.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 104dcd702870c423..5f9ebf045b1cb22b 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -521,8 +521,7 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
> }
>
> dev_dbg(dev, "clk %u/%u (%u, 0x%x)\n",
> - (best_freq / (1 << (clkdiv + 1))), clk,
> - best_freq, clkdiv);
> + (best_freq >> (clkdiv + 1)), clk, best_freq, clkdiv);
>
> clk_set_rate(host->clk, best_freq);
> clkdiv = clkdiv << 16;
> @@ -1012,8 +1011,8 @@ static void sh_mmcif_clk_setup(struct sh_mmcif_host *host)
> */
> host->clkdiv_map = 0x3ff;
>
> - host->mmc->f_max = f_max / (1 << ffs(host->clkdiv_map));
> - host->mmc->f_min = f_min / (1 << fls(host->clkdiv_map));
> + host->mmc->f_max = f_max >> ffs(host->clkdiv_map);
> + host->mmc->f_min = f_min >> fls(host->clkdiv_map);
> } else {
> unsigned int clk = clk_get_rate(host->clk);
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sh_mmcif: Simplify division/shift logic
2022-02-21 16:27 [PATCH] mmc: sh_mmcif: Simplify division/shift logic Geert Uytterhoeven
2022-02-28 17:05 ` Ulf Hansson
@ 2022-03-01 14:50 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2022-03-01 14:50 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Ulf Hansson, linux-mmc, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
On Mon, Feb 21, 2022 at 05:27:20PM +0100, Geert Uytterhoeven wrote:
> "a / (1 << b)" == "a >> b".
>
> No change in generated code.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Better late than never :/
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-01 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 16:27 [PATCH] mmc: sh_mmcif: Simplify division/shift logic Geert Uytterhoeven
2022-02-28 17:05 ` Ulf Hansson
2022-03-01 14:50 ` Wolfram Sang
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.