linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
@ 2018-07-21 20:00 Anders Roxell
  2018-07-21 21:53 ` Randy Dunlap
  0 siblings, 1 reply; 11+ messages in thread
From: Anders Roxell @ 2018-07-21 20:00 UTC (permalink / raw)
  To: miquel.raynal, boris.brezillon, rdunlap; +Cc: linux-kernel, Anders Roxell

JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
error:
drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
 function ‘of_read_number’; did you mean ‘down_read_nested’?
 [-Werror=implicit-function-declaration]
   bank = of_read_number(prop, 1);
          ^~~~~~~~~~~~~~
          down_read_nested

Make JZ4780_NEMC depend on OF.

Fixes: ab99e11062c1 ("memory: jz4780-nemc: Allow selection of this driver when COMPILE_TEST=y")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/memory/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index a642552dfdc9..63389f075f1d 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -123,7 +123,7 @@ config JZ4780_NEMC
 	bool "Ingenic JZ4780 SoC NEMC driver"
 	default y
 	depends on MACH_JZ4780 || COMPILE_TEST
-	depends on HAS_IOMEM
+	depends on HAS_IOMEM && OF
 	help
 	  This driver is for the NAND/External Memory Controller (NEMC) in
 	  the Ingenic JZ4780. This controller is used to handle external
-- 
2.18.0


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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-21 20:00 [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency Anders Roxell
@ 2018-07-21 21:53 ` Randy Dunlap
  2018-07-22  6:29   ` Boris Brezillon
  0 siblings, 1 reply; 11+ messages in thread
From: Randy Dunlap @ 2018-07-21 21:53 UTC (permalink / raw)
  To: Anders Roxell, miquel.raynal, boris.brezillon; +Cc: linux-kernel

On 07/21/2018 01:00 PM, Anders Roxell wrote:
> JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
> error:
> drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
> drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
>  function ‘of_read_number’; did you mean ‘down_read_nested’?
>  [-Werror=implicit-function-declaration]
>    bank = of_read_number(prop, 1);
>           ^~~~~~~~~~~~~~
>           down_read_nested
> 
> Make JZ4780_NEMC depend on OF.
> 
> Fixes: ab99e11062c1 ("memory: jz4780-nemc: Allow selection of this driver when COMPILE_TEST=y")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

Acked-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  drivers/memory/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
> index a642552dfdc9..63389f075f1d 100644
> --- a/drivers/memory/Kconfig
> +++ b/drivers/memory/Kconfig
> @@ -123,7 +123,7 @@ config JZ4780_NEMC
>  	bool "Ingenic JZ4780 SoC NEMC driver"
>  	default y
>  	depends on MACH_JZ4780 || COMPILE_TEST
> -	depends on HAS_IOMEM
> +	depends on HAS_IOMEM && OF
>  	help
>  	  This driver is for the NAND/External Memory Controller (NEMC) in
>  	  the Ingenic JZ4780. This controller is used to handle external
> 


-- 
~Randy

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-21 21:53 ` Randy Dunlap
@ 2018-07-22  6:29   ` Boris Brezillon
  2018-07-23  9:34     ` Arnd Bergmann
  0 siblings, 1 reply; 11+ messages in thread
From: Boris Brezillon @ 2018-07-22  6:29 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Anders Roxell, miquel.raynal, linux-kernel, Arnd Bergmann,
	Rob Herring, devicetree

+Arnd, Rob and the DT ML.

On Sat, 21 Jul 2018 14:53:47 -0700
Randy Dunlap <rdunlap@infradead.org> wrote:

> On 07/21/2018 01:00 PM, Anders Roxell wrote:
> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
> > error:
> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
> >  [-Werror=implicit-function-declaration]
> >    bank = of_read_number(prop, 1);
> >           ^~~~~~~~~~~~~~
> >           down_read_nested

Looks like of.h defines stubs so that people can compile-test without
CONFIG_OF selected. Maybe we should move of_read_number() and
of_read_ulong() out of the #ifdef CONFIG_OF section.

Alternatively, we could patch jz4780-nemc.c to not use of_read_number
and instead rely on of_read_property_u32_index() +
of_property_count_elems_of_size() + of_n_{addr,size}_cells():

--->8---
diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c
index bcf06adefc96..9ad7abc6983a 100644
--- a/drivers/memory/jz4780-nemc.c
+++ b/drivers/memory/jz4780-nemc.c
@@ -63,14 +63,21 @@ struct jz4780_nemc {
  */
 unsigned int jz4780_nemc_num_banks(struct device *dev)
 {
-       const __be32 *prop;
-       unsigned int bank, count = 0;
        unsigned long referenced = 0;
-       int i = 0;
-
-       while ((prop = of_get_address(dev->of_node, i++, NULL, NULL))) {
-               bank = of_read_number(prop, 1);
-               if (!(referenced & BIT(bank))) {
+       int nelems, elemsize, i = 0;
+       unsigned int count = 0;
+
+       /* #address-cells = 2 and #size-cells = 1, hence  */
+       elemsize = of_n_addr_cells(dev->of_node) +
+                  of_n_size_cells(dev->of_node);
+       nelems = of_property_count_elems_of_size(dev->of_node, "reg", elemsize);
+       for (i = 0; i < nelems; i++) {
+               u32 bank;
+
+               if (!of_property_read_u32_index(dev->of_node, "reg",
+                                               i * elemsize, &bank) &&
+                   bank >= 1 && bank < JZ4780_NEMC_NUM_BANKS &&
+                   !(referenced & BIT(bank))) {
                        referenced |= BIT(bank);
                        count++;
                }
@@ -269,10 +276,9 @@ static int jz4780_nemc_probe(struct platform_device *pdev)
        struct jz4780_nemc *nemc;
        struct resource *res;
        struct device_node *child;
-       const __be32 *prop;
-       unsigned int bank;
        unsigned long referenced;
        int i, ret;
+       u32 bank;
 
        nemc = devm_kzalloc(dev, sizeof(*nemc), GFP_KERNEL);
        if (!nemc)
@@ -316,10 +322,27 @@ static int jz4780_nemc_probe(struct platform_device *pdev)
         * registered for it.
         */
        for_each_child_of_node(nemc->dev->of_node, child) {
+               int nelems, elemsize;
+
                referenced = 0;
                i = 0;
-               while ((prop = of_get_address(child, i++, NULL, NULL))) {
-                       bank = of_read_number(prop, 1);
+               elemsize = of_n_addr_cells(dev->of_node) +
+                          of_n_size_cells(dev->of_node);
+               nelems = of_property_count_elems_of_size(dev->of_node, "reg",
+                                                        elemsize);
+               for (i = 0; i < nelems; i++) {
+                       u32 bank;
+
+                       ret = of_property_read_u32_index(dev->of_node, "reg",
+                                                        i * elemsize, &bank);
+                       if (ret) {
+                               dev_err(nemc->dev,
+                                       "failed to read bank %d of %pOF (err = %d)\n",
+                                       i, child, ret);
+                               referenced = 0;
+                               break;
+                       }
+
                        if (bank < 1 || bank >= JZ4780_NEMC_NUM_BANKS) {
                                dev_err(nemc->dev,
                                        "%pOF requests invalid bank %u\n",

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-22  6:29   ` Boris Brezillon
@ 2018-07-23  9:34     ` Arnd Bergmann
  2018-07-23  9:41       ` Boris Brezillon
  0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-23  9:34 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Randy Dunlap, Anders Roxell, Miquel Raynal,
	Linux Kernel Mailing List, Rob Herring, DTML

On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> +Arnd, Rob and the DT ML.
>
> On Sat, 21 Jul 2018 14:53:47 -0700
> Randy Dunlap <rdunlap@infradead.org> wrote:
>
>> On 07/21/2018 01:00 PM, Anders Roxell wrote:
>> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
>> > error:
>> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
>> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
>> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
>> >  [-Werror=implicit-function-declaration]
>> >    bank = of_read_number(prop, 1);
>> >           ^~~~~~~~~~~~~~
>> >           down_read_nested
>
> Looks like of.h defines stubs so that people can compile-test without
> CONFIG_OF selected. Maybe we should move of_read_number() and
> of_read_ulong() out of the #ifdef CONFIG_OF section.

That seems fine, though the added dependency seems appropriate
here as well. of_read_number() is rarely used, and for the most part in
powerpc specific code that is guaranteed to have CONFIG_OF enabled,
so it's not that likely to cause many more problems.

> Alternatively, we could patch jz4780-nemc.c to not use of_read_number
> and instead rely on of_read_property_u32_index() +
> of_property_count_elems_of_size() + of_n_{addr,size}_cells():

That seems noticeably longer for no good reason, I'd go with either
the header file change you suggested or Anders' patch.

       Arnd

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-23  9:34     ` Arnd Bergmann
@ 2018-07-23  9:41       ` Boris Brezillon
  2018-07-23 15:40         ` Arnd Bergmann
  2018-07-26 23:25         ` Miquel Raynal
  0 siblings, 2 replies; 11+ messages in thread
From: Boris Brezillon @ 2018-07-23  9:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Randy Dunlap, Anders Roxell, Miquel Raynal,
	Linux Kernel Mailing List, Rob Herring, DTML

On Mon, 23 Jul 2018 11:34:43 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
> <boris.brezillon@bootlin.com> wrote:
> > +Arnd, Rob and the DT ML.
> >
> > On Sat, 21 Jul 2018 14:53:47 -0700
> > Randy Dunlap <rdunlap@infradead.org> wrote:
> >  
> >> On 07/21/2018 01:00 PM, Anders Roxell wrote:  
> >> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
> >> > error:
> >> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
> >> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
> >> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
> >> >  [-Werror=implicit-function-declaration]
> >> >    bank = of_read_number(prop, 1);
> >> >           ^~~~~~~~~~~~~~
> >> >           down_read_nested  
> >
> > Looks like of.h defines stubs so that people can compile-test without
> > CONFIG_OF selected. Maybe we should move of_read_number() and
> > of_read_ulong() out of the #ifdef CONFIG_OF section.  
> 
> That seems fine, though the added dependency seems appropriate
> here as well. of_read_number() is rarely used, and for the most part in
> powerpc specific code that is guaranteed to have CONFIG_OF enabled,
> so it's not that likely to cause many more problems.

Ok, then I'll let Miquel apply Anders' patch to the NAND tree.

Thanks for your feedback.

Boris

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-23  9:41       ` Boris Brezillon
@ 2018-07-23 15:40         ` Arnd Bergmann
  2018-07-23 16:04           ` Arnd Bergmann
  2018-07-23 16:12           ` Boris Brezillon
  2018-07-26 23:25         ` Miquel Raynal
  1 sibling, 2 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-23 15:40 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Randy Dunlap, Anders Roxell, Miquel Raynal,
	Linux Kernel Mailing List, Rob Herring, DTML

On Mon, Jul 23, 2018 at 11:41 AM, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> On Mon, 23 Jul 2018 11:34:43 +0200
> Arnd Bergmann <arnd@arndb.de> wrote:
>
>> On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
>> <boris.brezillon@bootlin.com> wrote:
>> > +Arnd, Rob and the DT ML.
>> >
>> > On Sat, 21 Jul 2018 14:53:47 -0700
>> > Randy Dunlap <rdunlap@infradead.org> wrote:
>> >
>> >> On 07/21/2018 01:00 PM, Anders Roxell wrote:
>> >> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
>> >> > error:
>> >> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
>> >> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
>> >> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
>> >> >  [-Werror=implicit-function-declaration]
>> >> >    bank = of_read_number(prop, 1);
>> >> >           ^~~~~~~~~~~~~~
>> >> >           down_read_nested
>> >
>> > Looks like of.h defines stubs so that people can compile-test without
>> > CONFIG_OF selected. Maybe we should move of_read_number() and
>> > of_read_ulong() out of the #ifdef CONFIG_OF section.
>>
>> That seems fine, though the added dependency seems appropriate
>> here as well. of_read_number() is rarely used, and for the most part in
>> powerpc specific code that is guaranteed to have CONFIG_OF enabled,
>> so it's not that likely to cause many more problems.
>
> Ok, then I'll let Miquel apply Anders' patch to the NAND tree.
>
> Thanks for your feedback.

My randconfig build bot just ran into a second problem with this driver
with CONFIG_GPIOLIB disabled:

drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_dev_ready':
drivers/mtd/nand/raw/jz4740_nand.c:133:9: error: implicit declaration
of function 'gpiod_get_value_cansleep'; did you mean
'gpio_get_value_cansleep'? [-Werror=implicit-function-declaration]
  return gpiod_get_value_cansleep(nand->busy_gpio);
         ^~~~~~~~~~~~~~~~~~~~~~~~
         gpio_get_value_cansleep
drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_probe':
drivers/mtd/nand/raw/jz4740_nand.c:388:20: error: implicit declaration
of function 'devm_gpiod_get_optional'; did you mean
'devm_gpio_request_one'? [-Werror=implicit-function-declaration]
  nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    devm_gpio_request_one
drivers/mtd/nand/raw/jz4740_nand.c:388:64: error: 'GPIOD_IN'
undeclared (first use in this function); did you mean 'GPIOF_IN'?
  nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
                                                                ^~~~~~~~
                                                                GPIOF_IN


We could add another dependency here or (my preference) include
linux/gpio/consumer.h to fix that. Do you want a separate patch for
it, or should Anders send a combined patch?

      Arnd

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-23 15:40         ` Arnd Bergmann
@ 2018-07-23 16:04           ` Arnd Bergmann
  2018-07-23 16:14             ` Boris Brezillon
  2018-07-23 16:12           ` Boris Brezillon
  1 sibling, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-23 16:04 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Randy Dunlap, Anders Roxell, Miquel Raynal,
	Linux Kernel Mailing List, Rob Herring, DTML

On Mon, Jul 23, 2018 at 5:40 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, Jul 23, 2018 at 11:41 AM, Boris Brezillon
> <boris.brezillon@bootlin.com> wrote:
>> On Mon, 23 Jul 2018 11:34:43 +0200
>> Arnd Bergmann <arnd@arndb.de> wrote:
>>
>>> On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
>>> <boris.brezillon@bootlin.com> wrote:
>>> > +Arnd, Rob and the DT ML.
>>> >
>>> > On Sat, 21 Jul 2018 14:53:47 -0700
>>> > Randy Dunlap <rdunlap@infradead.org> wrote:
>>> >
>>> >> On 07/21/2018 01:00 PM, Anders Roxell wrote:
>>> >> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
>>> >> > error:
>>> >> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
>>> >> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
>>> >> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
>>> >> >  [-Werror=implicit-function-declaration]
>>> >> >    bank = of_read_number(prop, 1);
>>> >> >           ^~~~~~~~~~~~~~
>>> >> >           down_read_nested
>>> >
>>> > Looks like of.h defines stubs so that people can compile-test without
>>> > CONFIG_OF selected. Maybe we should move of_read_number() and
>>> > of_read_ulong() out of the #ifdef CONFIG_OF section.
>>>
>>> That seems fine, though the added dependency seems appropriate
>>> here as well. of_read_number() is rarely used, and for the most part in
>>> powerpc specific code that is guaranteed to have CONFIG_OF enabled,
>>> so it's not that likely to cause many more problems.
>>
>> Ok, then I'll let Miquel apply Anders' patch to the NAND tree.
>>
>> Thanks for your feedback.
>
> My randconfig build bot just ran into a second problem with this driver
> with CONFIG_GPIOLIB disabled:
>
> drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_dev_ready':
> drivers/mtd/nand/raw/jz4740_nand.c:133:9: error: implicit declaration
> of function 'gpiod_get_value_cansleep'; did you mean
> 'gpio_get_value_cansleep'? [-Werror=implicit-function-declaration]
>   return gpiod_get_value_cansleep(nand->busy_gpio);
>          ^~~~~~~~~~~~~~~~~~~~~~~~
>          gpio_get_value_cansleep
> drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_probe':
> drivers/mtd/nand/raw/jz4740_nand.c:388:20: error: implicit declaration
> of function 'devm_gpiod_get_optional'; did you mean
> 'devm_gpio_request_one'? [-Werror=implicit-function-declaration]
>   nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
>                     ^~~~~~~~~~~~~~~~~~~~~~~
>                     devm_gpio_request_one
> drivers/mtd/nand/raw/jz4740_nand.c:388:64: error: 'GPIOD_IN'
> undeclared (first use in this function); did you mean 'GPIOF_IN'?
>   nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
>                                                                 ^~~~~~~~
>                                                                 GPIOF_IN
>
>
> We could add another dependency here or (my preference) include
> linux/gpio/consumer.h to fix that. Do you want a separate patch for
> it, or should Anders send a combined patch?

One more failure, not analyzed yet:

/git/arm-soc/drivers/mtd/nand/raw/jz4740_nand.c: In function
'jz_nand_select_chip':
/git/arm-soc/drivers/mtd/nand/raw/jz4740_nand.c:87:9: error: implicit
declaration of function 'readl'; did you mean 'krealloc'?
[-Werror=implicit-function-declaration]
  ctrl = readl(nand->base + JZ_REG_NAND_CTRL);
         ^~~~~

        Arnd

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-23 15:40         ` Arnd Bergmann
  2018-07-23 16:04           ` Arnd Bergmann
@ 2018-07-23 16:12           ` Boris Brezillon
  1 sibling, 0 replies; 11+ messages in thread
From: Boris Brezillon @ 2018-07-23 16:12 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Randy Dunlap, Anders Roxell, Miquel Raynal,
	Linux Kernel Mailing List, Rob Herring, DTML

On Mon, 23 Jul 2018 17:40:29 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Mon, Jul 23, 2018 at 11:41 AM, Boris Brezillon
> <boris.brezillon@bootlin.com> wrote:
> > On Mon, 23 Jul 2018 11:34:43 +0200
> > Arnd Bergmann <arnd@arndb.de> wrote:
> >  
> >> On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
> >> <boris.brezillon@bootlin.com> wrote:  
> >> > +Arnd, Rob and the DT ML.
> >> >
> >> > On Sat, 21 Jul 2018 14:53:47 -0700
> >> > Randy Dunlap <rdunlap@infradead.org> wrote:
> >> >  
> >> >> On 07/21/2018 01:00 PM, Anders Roxell wrote:  
> >> >> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
> >> >> > error:
> >> >> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
> >> >> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
> >> >> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
> >> >> >  [-Werror=implicit-function-declaration]
> >> >> >    bank = of_read_number(prop, 1);
> >> >> >           ^~~~~~~~~~~~~~
> >> >> >           down_read_nested  
> >> >
> >> > Looks like of.h defines stubs so that people can compile-test without
> >> > CONFIG_OF selected. Maybe we should move of_read_number() and
> >> > of_read_ulong() out of the #ifdef CONFIG_OF section.  
> >>
> >> That seems fine, though the added dependency seems appropriate
> >> here as well. of_read_number() is rarely used, and for the most part in
> >> powerpc specific code that is guaranteed to have CONFIG_OF enabled,
> >> so it's not that likely to cause many more problems.  
> >
> > Ok, then I'll let Miquel apply Anders' patch to the NAND tree.
> >
> > Thanks for your feedback.  
> 
> My randconfig build bot just ran into a second problem with this driver
> with CONFIG_GPIOLIB disabled:
> 
> drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_dev_ready':
> drivers/mtd/nand/raw/jz4740_nand.c:133:9: error: implicit declaration
> of function 'gpiod_get_value_cansleep'; did you mean
> 'gpio_get_value_cansleep'? [-Werror=implicit-function-declaration]
>   return gpiod_get_value_cansleep(nand->busy_gpio);
>          ^~~~~~~~~~~~~~~~~~~~~~~~
>          gpio_get_value_cansleep
> drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_probe':
> drivers/mtd/nand/raw/jz4740_nand.c:388:20: error: implicit declaration
> of function 'devm_gpiod_get_optional'; did you mean
> 'devm_gpio_request_one'? [-Werror=implicit-function-declaration]
>   nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
>                     ^~~~~~~~~~~~~~~~~~~~~~~
>                     devm_gpio_request_one
> drivers/mtd/nand/raw/jz4740_nand.c:388:64: error: 'GPIOD_IN'
> undeclared (first use in this function); did you mean 'GPIOF_IN'?
>   nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
>                                                                 ^~~~~~~~
>                                                                 GPIOF_IN
> 
> 
> We could add another dependency here or (my preference) include
> linux/gpio/consumer.h to fix that. Do you want a separate patch for
> it, or should Anders send a combined patch?

I already fixed that one last week [1], it's been applied yet.

Thanks,

Boris

[1]http://patchwork.ozlabs.org/patch/946614/

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-23 16:04           ` Arnd Bergmann
@ 2018-07-23 16:14             ` Boris Brezillon
  2018-07-23 18:39               ` Arnd Bergmann
  0 siblings, 1 reply; 11+ messages in thread
From: Boris Brezillon @ 2018-07-23 16:14 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Randy Dunlap, Anders Roxell, Miquel Raynal,
	Linux Kernel Mailing List, Rob Herring, DTML

On Mon, 23 Jul 2018 18:04:52 +0200
Arnd Bergmann <arnd@arndb.de> wrote:

> On Mon, Jul 23, 2018 at 5:40 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Mon, Jul 23, 2018 at 11:41 AM, Boris Brezillon
> > <boris.brezillon@bootlin.com> wrote:  
> >> On Mon, 23 Jul 2018 11:34:43 +0200
> >> Arnd Bergmann <arnd@arndb.de> wrote:
> >>  
> >>> On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
> >>> <boris.brezillon@bootlin.com> wrote:  
> >>> > +Arnd, Rob and the DT ML.
> >>> >
> >>> > On Sat, 21 Jul 2018 14:53:47 -0700
> >>> > Randy Dunlap <rdunlap@infradead.org> wrote:
> >>> >  
> >>> >> On 07/21/2018 01:00 PM, Anders Roxell wrote:  
> >>> >> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
> >>> >> > error:
> >>> >> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
> >>> >> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
> >>> >> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
> >>> >> >  [-Werror=implicit-function-declaration]
> >>> >> >    bank = of_read_number(prop, 1);
> >>> >> >           ^~~~~~~~~~~~~~
> >>> >> >           down_read_nested  
> >>> >
> >>> > Looks like of.h defines stubs so that people can compile-test without
> >>> > CONFIG_OF selected. Maybe we should move of_read_number() and
> >>> > of_read_ulong() out of the #ifdef CONFIG_OF section.  
> >>>
> >>> That seems fine, though the added dependency seems appropriate
> >>> here as well. of_read_number() is rarely used, and for the most part in
> >>> powerpc specific code that is guaranteed to have CONFIG_OF enabled,
> >>> so it's not that likely to cause many more problems.  
> >>
> >> Ok, then I'll let Miquel apply Anders' patch to the NAND tree.
> >>
> >> Thanks for your feedback.  
> >
> > My randconfig build bot just ran into a second problem with this driver
> > with CONFIG_GPIOLIB disabled:
> >
> > drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_dev_ready':
> > drivers/mtd/nand/raw/jz4740_nand.c:133:9: error: implicit declaration
> > of function 'gpiod_get_value_cansleep'; did you mean
> > 'gpio_get_value_cansleep'? [-Werror=implicit-function-declaration]
> >   return gpiod_get_value_cansleep(nand->busy_gpio);
> >          ^~~~~~~~~~~~~~~~~~~~~~~~
> >          gpio_get_value_cansleep
> > drivers/mtd/nand/raw/jz4740_nand.c: In function 'jz_nand_probe':
> > drivers/mtd/nand/raw/jz4740_nand.c:388:20: error: implicit declaration
> > of function 'devm_gpiod_get_optional'; did you mean
> > 'devm_gpio_request_one'? [-Werror=implicit-function-declaration]
> >   nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
> >                     ^~~~~~~~~~~~~~~~~~~~~~~
> >                     devm_gpio_request_one
> > drivers/mtd/nand/raw/jz4740_nand.c:388:64: error: 'GPIOD_IN'
> > undeclared (first use in this function); did you mean 'GPIOF_IN'?
> >   nand->busy_gpio = devm_gpiod_get_optional(&pdev->dev, "busy", GPIOD_IN);
> >                                                                 ^~~~~~~~
> >                                                                 GPIOF_IN
> >
> >
> > We could add another dependency here or (my preference) include
> > linux/gpio/consumer.h to fix that. Do you want a separate patch for
> > it, or should Anders send a combined patch?  
> 
> One more failure, not analyzed yet:
> 
> /git/arm-soc/drivers/mtd/nand/raw/jz4740_nand.c: In function
> 'jz_nand_select_chip':
> /git/arm-soc/drivers/mtd/nand/raw/jz4740_nand.c:87:9: error: implicit
> declaration of function 'readl'; did you mean 'krealloc'?
> [-Werror=implicit-function-declaration]
>   ctrl = readl(nand->base + JZ_REG_NAND_CTRL);
>          ^~~~~

Yep, somehow io.h was indirectly included by gpio.h. I fixed that in my
patch when replacing gpio.h by gpio/consumer.h by including linux/io.h.

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-23 16:14             ` Boris Brezillon
@ 2018-07-23 18:39               ` Arnd Bergmann
  0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-23 18:39 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Randy Dunlap, Anders Roxell, Miquel Raynal,
	Linux Kernel Mailing List, Rob Herring, DTML

On Mon, Jul 23, 2018 at 6:14 PM, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> On Mon, 23 Jul 2018 18:04:52 +0200
> Arnd Bergmann <arnd@arndb.de> wrote:
>
>> On Mon, Jul 23, 2018 at 5:40 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > On Mon, Jul 23, 2018 at 11:41 AM, Boris Brezillon
>> > <boris.brezillon@bootlin.com> wrote:
>> >> On Mon, 23 Jul 2018 11:34:43 +0200
>> >> Arnd Bergmann <arnd@arndb.de> wrote:
>> >>
>> >>> On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
>> >>> <boris.brezillon@bootlin.com> wrote:
>> >>> > +Arnd, Rob and the DT ML.

> Yep, somehow io.h was indirectly included by gpio.h. I fixed that in my
> patch when replacing gpio.h by gpio/consumer.h by including linux/io.h.

Ok, looks good. With the patch from you plus the one from Anders,
I don't see any more randconfig failures in this driver.

    Arnd

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

* Re: [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency
  2018-07-23  9:41       ` Boris Brezillon
  2018-07-23 15:40         ` Arnd Bergmann
@ 2018-07-26 23:25         ` Miquel Raynal
  1 sibling, 0 replies; 11+ messages in thread
From: Miquel Raynal @ 2018-07-26 23:25 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Arnd Bergmann, Randy Dunlap, Anders Roxell,
	Linux Kernel Mailing List, Rob Herring, DTML

Hi Boris,

Boris Brezillon <boris.brezillon@bootlin.com> wrote on Mon, 23 Jul 2018
11:41:07 +0200:

> On Mon, 23 Jul 2018 11:34:43 +0200
> Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > On Sun, Jul 22, 2018 at 8:29 AM, Boris Brezillon
> > <boris.brezillon@bootlin.com> wrote:  
> > > +Arnd, Rob and the DT ML.
> > >
> > > On Sat, 21 Jul 2018 14:53:47 -0700
> > > Randy Dunlap <rdunlap@infradead.org> wrote:
> > >    
> > >> On 07/21/2018 01:00 PM, Anders Roxell wrote:    
> > >> > JZ4780_NEMC doesn't depend on OF, and if OF isn't enabled we get this
> > >> > error:
> > >> > drivers/memory/jz4780-nemc.c: In function ‘jz4780_nemc_num_banks’:
> > >> > drivers/memory/jz4780-nemc.c:72:10: error: implicit declaration of
> > >> >  function ‘of_read_number’; did you mean ‘down_read_nested’?
> > >> >  [-Werror=implicit-function-declaration]
> > >> >    bank = of_read_number(prop, 1);
> > >> >           ^~~~~~~~~~~~~~
> > >> >           down_read_nested    
> > >
> > > Looks like of.h defines stubs so that people can compile-test without
> > > CONFIG_OF selected. Maybe we should move of_read_number() and
> > > of_read_ulong() out of the #ifdef CONFIG_OF section.    
> > 
> > That seems fine, though the added dependency seems appropriate
> > here as well. of_read_number() is rarely used, and for the most part in
> > powerpc specific code that is guaranteed to have CONFIG_OF enabled,
> > so it's not that likely to cause many more problems.  
> 
> Ok, then I'll let Miquel apply Anders' patch to the NAND tree.

Applied to nand/next, thanks.

Miquèl

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

end of thread, other threads:[~2018-07-26 23:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-21 20:00 [PATCH] drivers/memory/Kconfig: Add CONFIG_OF dependency Anders Roxell
2018-07-21 21:53 ` Randy Dunlap
2018-07-22  6:29   ` Boris Brezillon
2018-07-23  9:34     ` Arnd Bergmann
2018-07-23  9:41       ` Boris Brezillon
2018-07-23 15:40         ` Arnd Bergmann
2018-07-23 16:04           ` Arnd Bergmann
2018-07-23 16:14             ` Boris Brezillon
2018-07-23 18:39               ` Arnd Bergmann
2018-07-23 16:12           ` Boris Brezillon
2018-07-26 23:25         ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).