diff mbox series

[04/10] mfd: altera-sysmgr: Fix physical address storing hacks

Message ID 20200624150704.2729736-5-lee.jones@linaro.org
State Accepted
Commit d9ca7801b6e5ffdfd7a4ed3f287b277895e63e90
Headers show
Series [01/10] mfd: twl4030-irq: Fix incorrect type in assignment warning | expand

Commit Message

Lee Jones June 24, 2020, 3:06 p.m. UTC
Sparse reports:

 drivers/mfd/altera-sysmgr.c:150:30: warning: incorrect type in assignment (different address spaces)
 drivers/mfd/altera-sysmgr.c:150:30:    expected unsigned int [usertype] *base
 drivers/mfd/altera-sysmgr.c:150:30:    got void [noderef] <asn:2> *
 drivers/mfd/altera-sysmgr.c:156:26: warning: incorrect type in argument 3 (different address spaces)
 drivers/mfd/altera-sysmgr.c:156:26:    expected void [noderef] <asn:2> *regs
 drivers/mfd/altera-sysmgr.c:156:26:    got unsigned int [usertype] *base

It appears as though the driver data property 'resource_size_t *base'
was being used to store 2 different types of addresses (physical and
IO-mapped) under a single declared type.

Fortunately, no value is recalled from the driver data entry, so it
can be easily omitted.  Instead we can use the value obtained directly
from the platform resource to pass through  Regmap into the call-backs
to be used for the SMCC call and use a local dedicated __iomem
variable for IO-remapping.

Cc: <stable@vger.kernel.org>
Cc: Thor Thayer <thor.thayer@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 drivers/mfd/altera-sysmgr.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

-- 
2.25.1

Comments

Sasha Levin July 1, 2020, 7:33 p.m. UTC | #1
Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.7.6, v5.4.49, v4.19.130, v4.14.186, v4.9.228, v4.4.228.

v5.7.6: Build OK!
v5.4.49: Build OK!
v4.19.130: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

v4.14.186: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

v4.9.228: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    937d3a0af521e ("mfd: Add support for Allwinner SoCs ADC")
    d0f949e220fdf ("mfd: Add STM32 Timers driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

v4.4.228: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    8ce064bfe7c8c ("MAINTAINERS: Add Altera Arria10 System Resource Chip")
    937d3a0af521e ("mfd: Add support for Allwinner SoCs ADC")
    9787f5e28b507 ("mfd: altr_a10sr: Add Altera Arria10 DevKit System Resource Chip")
    b25c6b7d2801f ("mfd: act8945a: Add Active-semi ACT8945A PMIC MFD driver")
    d0f949e220fdf ("mfd: Add STM32 Timers driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha
Lee Jones July 2, 2020, 6:28 a.m. UTC | #2
On Wed, 01 Jul 2020, Sasha Levin wrote:

> Hi

> 

> [This is an automated email]

> 

> This commit has been processed because it contains a -stable tag.

> The stable tag indicates that it's relevant for the following trees: all

> 

> The bot has tested the following trees: v5.7.6, v5.4.49, v4.19.130, v4.14.186, v4.9.228, v4.4.228.

> 

> v5.7.6: Build OK!

> v5.4.49: Build OK!

> v4.19.130: Failed to apply! Possible dependencies:

>     51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")

>     f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

> 

> v4.14.186: Failed to apply! Possible dependencies:

>     51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")

>     f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

> 

> v4.9.228: Failed to apply! Possible dependencies:

>     51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")

>     937d3a0af521e ("mfd: Add support for Allwinner SoCs ADC")

>     d0f949e220fdf ("mfd: Add STM32 Timers driver")

>     f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

> 

> v4.4.228: Failed to apply! Possible dependencies:

>     51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")

>     8ce064bfe7c8c ("MAINTAINERS: Add Altera Arria10 System Resource Chip")

>     937d3a0af521e ("mfd: Add support for Allwinner SoCs ADC")

>     9787f5e28b507 ("mfd: altr_a10sr: Add Altera Arria10 DevKit System Resource Chip")

>     b25c6b7d2801f ("mfd: act8945a: Add Active-semi ACT8945A PMIC MFD driver")

>     d0f949e220fdf ("mfd: Add STM32 Timers driver")

>     f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

> 

> 

> NOTE: The patch will not be queued to stable trees until it is upstream.

> 

> How should we proceed with this patch?


Please drop it.

Greg indicated that these should not be bound for Stable.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
Sasha Levin July 10, 2020, 2:03 p.m. UTC | #3
Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.7.6, v5.4.49, v4.19.130, v4.14.186, v4.9.228, v4.4.228.

v5.7.6: Build OK!
v5.4.49: Build OK!
v4.19.130: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

v4.14.186: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

v4.9.228: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    937d3a0af521e ("mfd: Add support for Allwinner SoCs ADC")
    d0f949e220fdf ("mfd: Add STM32 Timers driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")

v4.4.228: Failed to apply! Possible dependencies:
    51908d2e9b7c7 ("mfd: stpmic1: Add STPMIC1 driver")
    8ce064bfe7c8c ("MAINTAINERS: Add Altera Arria10 System Resource Chip")
    937d3a0af521e ("mfd: Add support for Allwinner SoCs ADC")
    9787f5e28b507 ("mfd: altr_a10sr: Add Altera Arria10 DevKit System Resource Chip")
    b25c6b7d2801f ("mfd: act8945a: Add Active-semi ACT8945A PMIC MFD driver")
    d0f949e220fdf ("mfd: Add STM32 Timers driver")
    f36e789a1f8d0 ("mfd: altera-sysmgr: Add SOCFPGA System Manager")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha
diff mbox series

Patch

diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c
index d2a13a547a3ca..83f0765f819b0 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -22,11 +22,9 @@ 
 /**
  * struct altr_sysmgr - Altera SOCFPGA System Manager
  * @regmap: the regmap used for System Manager accesses.
- * @base  : the base address for the System Manager
  */
 struct altr_sysmgr {
 	struct regmap   *regmap;
-	resource_size_t *base;
 };
 
 static struct platform_driver altr_sysmgr_driver;
@@ -127,6 +125,7 @@  static int sysmgr_probe(struct platform_device *pdev)
 	struct regmap_config sysmgr_config = altr_sysmgr_regmap_cfg;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
+	void __iomem *base;
 
 	sysmgr = devm_kzalloc(dev, sizeof(*sysmgr), GFP_KERNEL);
 	if (!sysmgr)
@@ -139,22 +138,19 @@  static int sysmgr_probe(struct platform_device *pdev)
 	sysmgr_config.max_register = resource_size(res) -
 				     sysmgr_config.reg_stride;
 	if (of_device_is_compatible(np, "altr,sys-mgr-s10")) {
-		/* Need physical address for SMCC call */
-		sysmgr->base = (resource_size_t *)res->start;
 		sysmgr_config.reg_read = s10_protected_reg_read;
 		sysmgr_config.reg_write = s10_protected_reg_write;
 
-		regmap = devm_regmap_init(dev, NULL, sysmgr->base,
+		/* Need physical address for SMCC call */
+		regmap = devm_regmap_init(dev, NULL, (void *)res->start,
 					  &sysmgr_config);
 	} else {
-		sysmgr->base = devm_ioremap(dev, res->start,
-					    resource_size(res));
-		if (!sysmgr->base)
+		base = devm_ioremap(dev, res->start, resource_size(res));
+		if (!base)
 			return -ENOMEM;
 
 		sysmgr_config.max_register = res->end - res->start - 3;
-		regmap = devm_regmap_init_mmio(dev, sysmgr->base,
-					       &sysmgr_config);
+		regmap = devm_regmap_init_mmio(dev, base, &sysmgr_config);
 	}
 
 	if (IS_ERR(regmap)) {