Skip to content

Commit

Permalink
sh: clkfwk: remove r8/r16/r32
Browse files Browse the repository at this point in the history
SH will get below warning

${LINUX}/drivers/sh/clk/cpg.c: In function 'r8':
${LINUX}/drivers/sh/clk/cpg.c:41:17: warning: passing argument 1 of 'ioread8'
 discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  return ioread8(addr);
                 ^~~~
In file included from ${LINUX}/arch/sh/include/asm/io.h:21,
                 from ${LINUX}/include/linux/io.h:13,
                 from ${LINUX}/drivers/sh/clk/cpg.c:14:
${LINUX}/include/asm-generic/iomap.h:29:29: note: expected 'void *' but
argument is of type 'const void *'
 extern unsigned int ioread8(void __iomem *);
                             ^~~~~~~~~~~~~~

We don't need "const" for r8/r16/r32.  And we don't need r8/r16/r32
themselvs.  This patch cleanup these.

X-MARC-Message: https://marc.info/?l=linux-renesas-soc&m=157852973916903
Signed-off-by: Kuninori Morimoto <[email protected]>
Cc: Alan Modra <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Chen Zhou <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: John Paul Adrian Glaubitz <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: Romain Naour <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
  • Loading branch information
morimoto authored and sfrothwell committed Jun 5, 2020
1 parent 7552e21 commit 45c3384
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions drivers/sh/clk/cpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,21 @@ static void sh_clk_write(int value, struct clk *clk)
iowrite32(value, clk->mapped_reg);
}

static unsigned int r8(const void __iomem *addr)
{
return ioread8(addr);
}

static unsigned int r16(const void __iomem *addr)
{
return ioread16(addr);
}

static unsigned int r32(const void __iomem *addr)
{
return ioread32(addr);
}

static int sh_clk_mstp_enable(struct clk *clk)
{
sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk);
if (clk->status_reg) {
unsigned int (*read)(const void __iomem *addr);
unsigned int (*read)(void __iomem *addr);
int i;
void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
(phys_addr_t)clk->enable_reg + clk->mapped_reg;

if (clk->flags & CLK_ENABLE_REG_8BIT)
read = r8;
read = ioread8;
else if (clk->flags & CLK_ENABLE_REG_16BIT)
read = r16;
read = ioread16;
else
read = r32;
read = ioread32;

for (i = 1000;
(read(mapped_status) & (1 << clk->enable_bit)) && i;
Expand Down

0 comments on commit 45c3384

Please sign in to comment.