Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c518e84c authored by Emilio López's avatar Emilio López Committed by Maxime Ripard
Browse files

clk: sunxi: factors: fix off-by-one masks



The previous code would generate one bit too long masks, and was
needlessly complicated. This patch replaces it by simpler code that can
generate the masks correctly.

Signed-off-by: default avatarEmilio López <emilio@elopez.com.ar>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
parent 107f3198
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@ struct clk_factors {


#define to_clk_factors(_hw) container_of(_hw, struct clk_factors, hw)
#define to_clk_factors(_hw) container_of(_hw, struct clk_factors, hw)


#define SETMASK(len, pos)		(((-1U) >> (31-len))  << (pos))
#define SETMASK(len, pos)		(((1U << (len)) - 1) << (pos))
#define CLRMASK(len, pos)		(~(SETMASK(len, pos)))
#define CLRMASK(len, pos)		(~(SETMASK(len, pos)))
#define FACTOR_GET(bit, len, reg)	(((reg) & SETMASK(len, bit)) >> (bit))
#define FACTOR_GET(bit, len, reg)	(((reg) & SETMASK(len, bit)) >> (bit))