All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] rockchip: clk: rk3399: change extract_bits to bitfield_extract
@ 2017-11-22 18:45 Philipp Tomsich
  2017-11-25 23:39 ` [U-Boot] " Philipp Tomsich
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Tomsich @ 2017-11-22 18:45 UTC (permalink / raw
  To: u-boot

The RK3399 clk driver still has a left-over use of extract_bits, which
can be replaced by using bitfield_extract from include/bitfield.h.
This rewrites the invocation to use the shared function.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

 drivers/clk/rockchip/clk_rk3399.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index 6f85a38..b54cdb8 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -569,11 +569,6 @@ static const struct spi_clkreg spi_clkregs[] = {
 		.sel_shift = CLK_SPI5_PLL_SEL_SHIFT, },
 };
 
-static inline u32 extract_bits(u32 val, unsigned width, unsigned shift)
-{
-	return (val >> shift) & ((1 << width) - 1);
-}
-
 static ulong rk3399_spi_get_clk(struct rk3399_cru *cru, ulong clk_id)
 {
 	const struct spi_clkreg *spiclk = NULL;
@@ -590,7 +585,8 @@ static ulong rk3399_spi_get_clk(struct rk3399_cru *cru, ulong clk_id)
 	}
 
 	val = readl(&cru->clksel_con[spiclk->reg]);
-	div = extract_bits(val, CLK_SPI_PLL_DIV_CON_WIDTH, spiclk->div_shift);
+	div = bitfield_extract(val, spiclk->div_shift,
+			       CLK_SPI_PLL_DIV_CON_WIDTH);
 
 	return DIV_TO_RATE(GPLL_HZ, div);
 }
-- 
2.1.4

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

* [U-Boot] rockchip: clk: rk3399: change extract_bits to bitfield_extract
  2017-11-22 18:45 [U-Boot] [PATCH] rockchip: clk: rk3399: change extract_bits to bitfield_extract Philipp Tomsich
@ 2017-11-25 23:39 ` Philipp Tomsich
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Tomsich @ 2017-11-25 23:39 UTC (permalink / raw
  To: u-boot

> The RK3399 clk driver still has a left-over use of extract_bits, which
> can be replaced by using bitfield_extract from include/bitfield.h.
> This rewrites the invocation to use the shared function.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
>  drivers/clk/rockchip/clk_rk3399.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 

Applied to u-boot-rockchip, thanks!

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

end of thread, other threads:[~2017-11-25 23:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22 18:45 [U-Boot] [PATCH] rockchip: clk: rk3399: change extract_bits to bitfield_extract Philipp Tomsich
2017-11-25 23:39 ` [U-Boot] " Philipp Tomsich

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.