Skip to contentSkip to conversation

sh: clk: Fix assignment from incompatible pointer type for ioreadX()

PATCH In review Krzysztof Kozlowski 2 participants 4 messages Jul 23, 2020 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: clk: Fix assignment from incompatible pointer type for ioreadX()

The ioreadX() helpers accept now pointer to const memory so declaration of read function needs updating.

This fixes build errors like:

drivers/sh/clk/cpg.c: In function ‘sh_clk_mstp_enable’:
drivers/sh/clk/cpg.c:49:9: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
read = ioread8;

Cc Geert Uytterhoeven <[email protected]>
Cc Kuninori Morimoto <[email protected]>

---

Dear Andrew,

This was part of my v3 patchset commit 9ab7fb303cc1 ("iomap: Constify ioreadX() iomem argument (as in generic implementation)") but I think it was skipped when applying to your tree.

Maybe because it depends on commit 58c4d8659186 ("sh: clkfwk: remove r8/r16/r32") which landed later? Anyway it should go through your tree, I think.

---
 drivers/sh/clk/cpg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/sh/clk/cpg.c +1 -1
index a5cacfe24a42..fd72d9088bdc 100644
@@ -40,7 +40,7 @@ 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)(void __iomem *addr);
+		unsigned int (*read)(const void __iomem *addr);
 		int i;
 		void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
 			(phys_addr_t)clk->enable_reg + clk->mapped_reg;
Signature · 1 line
2.17.1
#1 lore raw

Hi Krzysztof!

Quoted 12 lines · Krzysztof Kozlowski

Maybe because it depends on commit 58c4d8659186 ("sh: clkfwk: remove r8/r16/r32") which landed later? Anyway it should go through your tree, I think.

---
 drivers/sh/clk/cpg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/sh/clk/cpg.c +0 -0
index a5cacfe24a42..fd72d9088bdc 100644

drivers/sh/clk/cpg.c static int sh_clk_mstp_enable(struct clk *clk) · line 46

Quoted 8 lines
drivers/sh/clk/cpg.c +1 -1
@@ -40,7 +40,7 @@ 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)(void __iomem *addr);
+		unsigned int (*read)(const void __iomem *addr);
 		int i;
 		void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
 			(phys_addr_t)clk->enable_reg + clk->mapped_reg;

Is that a reverted patch, by any chance? The patch does not apply for me and looking at the sources, the qualifier is already "const" [1].

Adrian

Quoted 1 line

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/sh/clk/cpg.c#n58

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#2 lore raw
Quoted 10 lines · John Paul Adrian Glaubitz

Hi Krzysztof!

Quoted 7 lines · Krzysztof Kozlowski

Maybe because it depends on commit 58c4d8659186 ("sh: clkfwk: remove r8/r16/r32") which landed later? Anyway it should go through your tree, I think.

---
 drivers/sh/clk/cpg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/sh/clk/cpg.c static int sh_clk_mstp_enable(struct clk *clk) · line 46

Quoted 13 lines
drivers/sh/clk/cpg.c +1 -1
index a5cacfe24a42..fd72d9088bdc 100644
@@ -40,7 +40,7 @@ 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)(void __iomem *addr);
+		unsigned int (*read)(const void __iomem *addr);
 		int i;
 		void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
 			(phys_addr_t)clk->enable_reg + clk->mapped_reg;

Is that a reverted patch, by any chance? The patch does not apply for me and looking at the sources, the qualifier is already "const" [1].

The patch is for Andrew Morton's tree which contain two commits:
1. sh: clkfwk: remove r8/r16/r32
2. iomap: constify ioreadX() iomem argument (as in generic implementation)

This patch here was actually part of #2 because of being based on linux-next. However it disappeared when applying to Andrew's tree because patch #1 came later.

Best regards,
Krzysztof

#3 lore raw

Hi!

Quoted 7 lines · Krzysztof Kozlowski

The patch is for Andrew Morton's tree which contain two commits:
1. sh: clkfwk: remove r8/r16/r32
2. iomap: constify ioreadX() iomem argument (as in generic implementation)

This patch here was actually part of #2 because of being based on linux-next. However it disappeared when applying to Andrew's tree because patch #1 came later.

Okay. I'll try to look at the other two patches later.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913