Skip to content

Commit 21c1d66

Browse files
Demon000geertu
authored andcommitted
clk: renesas: cpg-mssr: Simplify pointer math in cpg_rzt2h_mstp_read()
Private state is available in all places where cpg_rzt2h_mstp_read() is called, remove the extra pointer math used to find it from clk_hw. While at it, put these statements on a single line as they do not exceed the 80 columns limit. Signed-off-by: Cosmin Tanislav <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent ebb3acf commit 21c1d66

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

drivers/clk/renesas/renesas-cpg-mssr.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,16 @@ struct mstp_clock {
237237

238238
#define to_mstp_clock(_hw) container_of(_hw, struct mstp_clock, hw)
239239

240-
static u32 cpg_rzt2h_mstp_read(struct clk_hw *hw, u16 offset)
240+
static u32 cpg_rzt2h_mstp_read(struct cpg_mssr_priv *priv, u16 offset)
241241
{
242-
struct mstp_clock *clock = to_mstp_clock(hw);
243-
struct cpg_mssr_priv *priv = clock->priv;
244242
void __iomem *base =
245243
RZT2H_MSTPCR_BLOCK(offset) ? priv->pub.base1 : priv->pub.base0;
246244

247245
return readl(base + RZT2H_MSTPCR_OFFSET(offset));
248246
}
249247

250-
static void cpg_rzt2h_mstp_write(struct clk_hw *hw, u16 offset, u32 value)
248+
static void cpg_rzt2h_mstp_write(struct cpg_mssr_priv *priv, u16 offset, u32 value)
251249
{
252-
struct mstp_clock *clock = to_mstp_clock(hw);
253-
struct cpg_mssr_priv *priv = clock->priv;
254250
void __iomem *base =
255251
RZT2H_MSTPCR_BLOCK(offset) ? priv->pub.base1 : priv->pub.base0;
256252

@@ -286,17 +282,14 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
286282
barrier_data(priv->pub.base0 + priv->control_regs[reg]);
287283

288284
} else if (priv->reg_layout == CLK_REG_LAYOUT_RZ_T2H) {
289-
value = cpg_rzt2h_mstp_read(hw,
290-
priv->control_regs[reg]);
285+
value = cpg_rzt2h_mstp_read(priv, priv->control_regs[reg]);
291286

292287
if (enable)
293288
value &= ~bitmask;
294289
else
295290
value |= bitmask;
296291

297-
cpg_rzt2h_mstp_write(hw,
298-
priv->control_regs[reg],
299-
value);
292+
cpg_rzt2h_mstp_write(priv, priv->control_regs[reg], value);
300293
} else {
301294
value = readl(priv->pub.base0 + priv->control_regs[reg]);
302295
if (enable)
@@ -318,7 +311,7 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
318311
* the IP at least seven times. Instead of memory-mapping the IP
319312
* register, we simply add a delay after the read operation.
320313
*/
321-
cpg_rzt2h_mstp_read(hw, priv->control_regs[reg]);
314+
cpg_rzt2h_mstp_read(priv, priv->control_regs[reg]);
322315
udelay(10);
323316
return 0;
324317
}
@@ -352,8 +345,7 @@ static int cpg_mstp_clock_is_enabled(struct clk_hw *hw)
352345
if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A)
353346
value = readb(priv->pub.base0 + priv->control_regs[reg]);
354347
else if (priv->reg_layout == CLK_REG_LAYOUT_RZ_T2H)
355-
value = cpg_rzt2h_mstp_read(hw,
356-
priv->control_regs[reg]);
348+
value = cpg_rzt2h_mstp_read(priv, priv->control_regs[reg]);
357349
else
358350
value = readl(priv->pub.base0 + priv->status_regs[reg]);
359351

0 commit comments

Comments
 (0)