public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: syscon: set regmap max_register in of_syscon_register
@ 2016-01-29  9:35 Philipp Zabel
  2016-01-29 10:08 ` Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Philipp Zabel @ 2016-01-29  9:35 UTC (permalink / raw)
  To: Lee Jones; +Cc: Arnd Bergmann, linux-kernel, kernel, Philipp Zabel

Determine the regmap max_register configuration from the io resource size
and the reg-io-width device tree property.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/mfd/syscon.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index b730071..2f2225e 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -50,6 +50,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
 	u32 reg_io_width;
 	int ret;
 	struct regmap_config syscon_config = syscon_regmap_config;
+	struct resource res;
 
 	if (!of_device_is_compatible(np, "syscon"))
 		return ERR_PTR(-EINVAL);
@@ -58,7 +59,12 @@ static struct syscon *of_syscon_register(struct device_node *np)
 	if (!syscon)
 		return ERR_PTR(-ENOMEM);
 
-	base = of_iomap(np, 0);
+	if (of_address_to_resource(np, 0, &res)) {
+		ret = -ENOMEM;
+		goto err_map;
+	}
+
+	base = ioremap(res.start, resource_size(&res));
 	if (!base) {
 		ret = -ENOMEM;
 		goto err_map;
@@ -81,6 +87,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
 
 	syscon_config.reg_stride = reg_io_width;
 	syscon_config.val_bits = reg_io_width * 8;
+	syscon_config.max_register = resource_size(&res) - reg_io_width;
 
 	regmap = regmap_init_mmio(NULL, base, &syscon_config);
 	if (IS_ERR(regmap)) {
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: syscon: set regmap max_register in of_syscon_register
  2016-01-29  9:35 [PATCH] mfd: syscon: set regmap max_register in of_syscon_register Philipp Zabel
@ 2016-01-29 10:08 ` Arnd Bergmann
  2016-01-29 11:15 ` Lee Jones
  2016-01-29 16:14 ` kbuild test robot
  2 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-29 10:08 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Lee Jones, linux-kernel, kernel

On Friday 29 January 2016 10:35:51 Philipp Zabel wrote:
> Determine the regmap max_register configuration from the io resource size
> and the reg-io-width device tree property.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> 

Good catch!

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: syscon: set regmap max_register in of_syscon_register
  2016-01-29  9:35 [PATCH] mfd: syscon: set regmap max_register in of_syscon_register Philipp Zabel
  2016-01-29 10:08 ` Arnd Bergmann
@ 2016-01-29 11:15 ` Lee Jones
  2016-01-29 16:14 ` kbuild test robot
  2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2016-01-29 11:15 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Arnd Bergmann, linux-kernel, kernel

On Fri, 29 Jan 2016, Philipp Zabel wrote:

> Determine the regmap max_register configuration from the io resource size
> and the reg-io-width device tree property.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/mfd/syscon.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index b730071..2f2225e 100644
> --- a/drivers/mfd/syscon.c
> +++ b/drivers/mfd/syscon.c
> @@ -50,6 +50,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
>  	u32 reg_io_width;
>  	int ret;
>  	struct regmap_config syscon_config = syscon_regmap_config;
> +	struct resource res;
>  
>  	if (!of_device_is_compatible(np, "syscon"))
>  		return ERR_PTR(-EINVAL);
> @@ -58,7 +59,12 @@ static struct syscon *of_syscon_register(struct device_node *np)
>  	if (!syscon)
>  		return ERR_PTR(-ENOMEM);
>  
> -	base = of_iomap(np, 0);
> +	if (of_address_to_resource(np, 0, &res)) {
> +		ret = -ENOMEM;
> +		goto err_map;
> +	}
> +
> +	base = ioremap(res.start, resource_size(&res));
>  	if (!base) {
>  		ret = -ENOMEM;
>  		goto err_map;
> @@ -81,6 +87,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
>  
>  	syscon_config.reg_stride = reg_io_width;
>  	syscon_config.val_bits = reg_io_width * 8;
> +	syscon_config.max_register = resource_size(&res) - reg_io_width;
>  
>  	regmap = regmap_init_mmio(NULL, base, &syscon_config);
>  	if (IS_ERR(regmap)) {

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: syscon: set regmap max_register in of_syscon_register
  2016-01-29  9:35 [PATCH] mfd: syscon: set regmap max_register in of_syscon_register Philipp Zabel
  2016-01-29 10:08 ` Arnd Bergmann
  2016-01-29 11:15 ` Lee Jones
@ 2016-01-29 16:14 ` kbuild test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2016-01-29 16:14 UTC (permalink / raw)
  To: Philipp Zabel
  Cc: kbuild-all, Lee Jones, Arnd Bergmann, linux-kernel, kernel,
	Philipp Zabel

[-- Attachment #1: Type: text/plain, Size: 3168 bytes --]

Hi Philipp,

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.5-rc1 next-20160129]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Philipp-Zabel/mfd-syscon-set-regmap-max_register-in-of_syscon_register/20160129-173854
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: um-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=um 

All error/warnings (new ones prefixed by >>):

   /kbuild/src/defs/drivers/platform/goldfish/pdev_bus.c: In function 'goldfish_pdev_bus_probe':
>> /kbuild/src/defs/drivers/platform/goldfish/pdev_bus.c:191:18: error: implicit declaration of function 'ioremap' [-Werror=implicit-function-declaration]
     pdev_bus_base = ioremap(pdev_bus_addr, pdev_bus_len);
                     ^
>> /kbuild/src/defs/drivers/platform/goldfish/pdev_bus.c:191:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     pdev_bus_base = ioremap(pdev_bus_addr, pdev_bus_len);
                   ^
>> /kbuild/src/defs/drivers/platform/goldfish/pdev_bus.c:217:2: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
     iounmap(pdev_bus_base);
     ^
   cc1: some warnings being treated as errors
--
   drivers/mfd/syscon.c: In function 'of_syscon_register':
>> drivers/mfd/syscon.c:67:9: error: implicit declaration of function 'ioremap' [-Werror=implicit-function-declaration]
     base = ioremap(res.start, resource_size(&res));
            ^
>> drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     base = ioremap(res.start, resource_size(&res));
          ^
   drivers/mfd/syscon.c:109:2: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
     iounmap(base);
     ^
   cc1: some warnings being treated as errors
--
   /kbuild/src/defs/drivers/mfd/syscon.c: In function 'of_syscon_register':
>> /kbuild/src/defs/drivers/mfd/syscon.c:67:9: error: implicit declaration of function 'ioremap' [-Werror=implicit-function-declaration]
     base = ioremap(res.start, resource_size(&res));
            ^
>> /kbuild/src/defs/drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     base = ioremap(res.start, resource_size(&res));
          ^
   /kbuild/src/defs/drivers/mfd/syscon.c:109:2: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
     iounmap(base);
     ^
   cc1: some warnings being treated as errors

vim +/ioremap +67 drivers/mfd/syscon.c

    61	
    62		if (of_address_to_resource(np, 0, &res)) {
    63			ret = -ENOMEM;
    64			goto err_map;
    65		}
    66	
  > 67		base = ioremap(res.start, resource_size(&res));
    68		if (!base) {
    69			ret = -ENOMEM;
    70			goto err_map;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 17787 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-29 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29  9:35 [PATCH] mfd: syscon: set regmap max_register in of_syscon_register Philipp Zabel
2016-01-29 10:08 ` Arnd Bergmann
2016-01-29 11:15 ` Lee Jones
2016-01-29 16:14 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox