mvebu: fix __iomem on mvebu_pm_store_armadaxp_bootinfo()
Subsystems (3)
PATCH 1/1 mvebu: fix __iomem on mvebu_pm_store_armadaxp_bootinfo()
The mvebu_pm_store_armadaxp_bootinfo() uses writel to store data, so the pointer into it should be __iomem annotated. Fixes the following sparse warnings:
arch/arm/mach-mvebu/pm.c:124:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:124:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:124:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:125:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:125:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:125:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:133:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:133:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:133:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:134:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:134:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:134:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:140:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:140:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:140:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:141:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:141:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:141:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:148:50: warning: incorrect type in argument 1 (different address spaces)arch/arm/mach-mvebu/pm.c:148:50: expected unsigned int [noderef] [usertype] <asn:2> *store_addrarch/arm/mach-mvebu/pm.c:148:50: got unsigned int [usertype] *[assigned] store_addrarch/arm/mach-mvebu/pm.c:150:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:150:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:150:9: got unsigned int [usertype] *[assigned] store_addr
Note, this doesn't take into account writel() is probably heavy handed here and just writing the data and then flushing all the caches etc would be good enough.
---
Cc: Jason Cooper <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Gregory Clement <[email protected]>
Cc: Sebastian Hesselbarth <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
--- arch/arm/mach-mvebu/pm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-mvebu/pm.c +3 -3
@@ -106,7 +106,7 @@ static phys_addr_t mvebu_internal_reg_base(void)return of_translate_address (np, in_addr); } -static void mvebu_pm_store_armadaxp_bootinfo (u32 *store_addr) +static void mvebu_pm_store_armadaxp_bootinfo (u32 __iomem *store_addr) {phys_addr_t resume_pc;
@@ -152,9 +152,9 @@ static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)static int mvebu_pm_store_bootinfo (void ) { -u32 *store_addr; +u32 __iomem *store_addr; - store_addr =phys_to_virt (BOOT_INFO_ADDR ); + store_addr = (__force __iomem u32 *)phys_to_virt (BOOT_INFO_ADDR );if (of_machine_is_compatible ("marvell,armadaxp" ))mvebu_pm_store_armadaxp_bootinfo (store_addr);
Signature · 7 lines
2.23.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 3 lines · Ben Dooks
The
mvebu_pm_store_armadaxp_bootinfo()uses writel to store data, so the pointer into it should be__iomemannotated. Fixes the following sparse warnings:
Shouldn't this use something like early_ioremap instead of blind casts?
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Russell King - ARM Linux admin
maintainerQuoted 29 lines · Ben Dooks
The
mvebu_pm_store_armadaxp_bootinfo()uses writel to store data, so the pointer into it should be__iomemannotated. Fixes the following sparse warnings:
arch/arm/mach-mvebu/pm.c:124:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:124:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:124:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:125:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:125:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:125:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:133:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:133:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:133:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:134:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:134:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:134:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:140:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:140:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:140:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:141:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:141:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:141:9: got unsigned int [usertype] *arch/arm/mach-mvebu/pm.c:148:50: warning: incorrect type in argument 1 (different address spaces)arch/arm/mach-mvebu/pm.c:148:50: expected unsigned int [noderef] [usertype] <asn:2>*store_addrarch/arm/mach-mvebu/pm.c:148:50: got unsigned int [usertype] *[assigned]store_addrarch/arm/mach-mvebu/pm.c:150:9: warning: incorrect type in argument 2 (different address spaces)arch/arm/mach-mvebu/pm.c:150:9: expected void volatile [noderef] <asn:2> *addrarch/arm/mach-mvebu/pm.c:150:9: got unsigned int [usertype] *[assigned]store_addr
Quoted 3 lines
Note, this doesn't take into account
writel()is probably heavy handed here and just writing the data and then flushing all the caches etc would be good enough.
This is definitely wrong.
Quoted 26 lines
Signed-off-by Ben Dooks <[email protected]>---
Cc: Jason Cooper <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Gregory Clement <[email protected]>
Cc: Sebastian Hesselbarth <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]--- arch/arm/mach-mvebu/pm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/arm/mach-mvebu/pm.c +1
-1@@ -106,7 +106,7 @@ static phys_addr_t mvebu_internal_reg_base(void)return of_translate_address (np, in_addr); } -static void mvebu_pm_store_armadaxp_bootinfo (u32 *store_addr) +static void mvebu_pm_store_armadaxp_bootinfo (u32 __iomem *store_addr) {phys_addr_t resume_pc;
arch/arm/mach-mvebu/pm.c static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr) · line 157
Quoted 8 lines
arch/arm/mach-mvebu/pm.c +2
-2@@ -152,9 +152,9 @@ static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)static int mvebu_pm_store_bootinfo (void ) { -u32 *store_addr; +u32 __iomem *store_addr; - store_addr =phys_to_virt (BOOT_INFO_ADDR ); + store_addr = (__force __iomem u32 *)phys_to_virt (BOOT_INFO_ADDR );
phys_to_virt() does not return an iomem pointer, so the memory pointed to here is _not_ iomem. Thus, iomem accessors should not be used - and that's where the problem actually lies.
Quoted 7 lines
arch/arm/mach-mvebu/pm.c +0
-0if (of_machine_is_compatible ("marvell,armadaxp" ))mvebu_pm_store_armadaxp_bootinfo (store_addr);Signature · 1 line
2.23.0
Signature · 8 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel