linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] bcma: fix building without OF_IRQ
@ 2016-03-17  9:20 Arnd Bergmann
  2016-03-17  9:20 ` [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask Arnd Bergmann
  2016-03-23 15:52 ` [1/2] bcma: fix building without OF_IRQ Kalle Valo
  0 siblings, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-03-17  9:20 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Arnd Bergmann, Kalle Valo, Hauke Mehrtens, linux-wireless,
	linux-kernel

The bcma driver core can be built with or without DT support, but
it fails to build when CONFIG_OF=y and CONFIG_OF_IRQ=n, which
can happen on platforms that do not support IRQ domains.

ERROR: "irq_create_of_mapping" [drivers/bcma/bcma.ko] undefined!
ERROR: "of_irq_parse_raw" [drivers/bcma/bcma.ko] undefined!
ERROR: "of_irq_parse_one" [drivers/bcma/bcma.ko] undefined!

This adds another compile-time check for OF_IRQ, but also
gets rid of now unneeded #ifdef checks: Using the simpler
IS_ENABLED() check for OF_IRQ also covers the case of not
having CONFIG_OF enabled. The check for CONFIG_OF_ADDRESS
was added to allow building on architectures without
OF_ADDRESS, but that has been addressed already in
b1d06b60e90c ("of: Provide static inline function for
of_translate_address if needed").

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/bcma/main.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 786be8fed39e..1f635471f318 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -136,7 +136,6 @@ static bool bcma_is_core_needed_early(u16 core_id)
 	return false;
 }
 
-#if defined(CONFIG_OF) && defined(CONFIG_OF_ADDRESS)
 static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
 						     struct bcma_device *core)
 {
@@ -184,7 +183,7 @@ static unsigned int bcma_of_get_irq(struct platform_device *parent,
 	struct of_phandle_args out_irq;
 	int ret;
 
-	if (!parent || !parent->dev.of_node)
+	if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node)
 		return 0;
 
 	ret = bcma_of_irq_parse(parent, core, &out_irq, num);
@@ -202,23 +201,15 @@ static void bcma_of_fill_device(struct platform_device *parent,
 {
 	struct device_node *node;
 
+	if (!IS_ENABLED(CONFIG_OF_IRQ))
+		return;
+
 	node = bcma_of_find_child_device(parent, core);
 	if (node)
 		core->dev.of_node = node;
 
 	core->irq = bcma_of_get_irq(parent, core, 0);
 }
-#else
-static void bcma_of_fill_device(struct platform_device *parent,
-				struct bcma_device *core)
-{
-}
-static inline unsigned int bcma_of_get_irq(struct platform_device *parent,
-					   struct bcma_device *core, int num)
-{
-	return 0;
-}
-#endif /* CONFIG_OF */
 
 unsigned int bcma_core_irq(struct bcma_device *core, int num)
 {
-- 
2.7.0


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

* [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask
  2016-03-17  9:20 [PATCH 1/2] bcma: fix building without OF_IRQ Arnd Bergmann
@ 2016-03-17  9:20 ` Arnd Bergmann
  2016-03-17  9:22   ` Arnd Bergmann
  2016-03-17  9:43   ` kbuild test robot
  2016-03-23 15:52 ` [1/2] bcma: fix building without OF_IRQ Kalle Valo
  1 sibling, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-03-17  9:20 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Arnd Bergmann, Kalle Valo, Hauke Mehrtens, linux-wireless,
	linux-kernel

While fixing another bug, I noticed that bcma manually sets up
a dma_mask pointer for its child devices. We have a generic
helper for that now, which should be able to cope better with
any variations that might be needed to deal with cache coherency,
unusual DMA address offsets, iommus, or limited DMA masks, none
of which are currently handled here.

This changes the core to use the of_dma_configure(), like
we do for platform devices that are probed directly from
DT.

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

This patch needs to be tested to ensure we don't introduce
regressions, and should probably go into 4.7 as a cleanup.
---
 drivers/bcma/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 1f635471f318..57d223a7a720 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -209,6 +209,8 @@ static void bcma_of_fill_device(struct platform_device *parent,
 		core->dev.of_node = node;
 
 	core->irq = bcma_of_get_irq(parent, core, 0);
+
+	of_dma_configure(core->dev, node);
 }
 
 unsigned int bcma_core_irq(struct bcma_device *core, int num)
@@ -248,12 +250,12 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
 		core->irq = bus->host_pci->irq;
 		break;
 	case BCMA_HOSTTYPE_SOC:
-		core->dev.dma_mask = &core->dev.coherent_dma_mask;
-		if (bus->host_pdev) {
+		if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) {
 			core->dma_dev = &bus->host_pdev->dev;
 			core->dev.parent = &bus->host_pdev->dev;
 			bcma_of_fill_device(bus->host_pdev, core);
 		} else {
+			core->dev.dma_mask = &core->dev.coherent_dma_mask;
 			core->dma_dev = &core->dev;
 		}
 		break;
-- 
2.7.0


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

* Re: [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask
  2016-03-17  9:20 ` [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask Arnd Bergmann
@ 2016-03-17  9:22   ` Arnd Bergmann
  2016-03-17  9:43   ` kbuild test robot
  1 sibling, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-03-17  9:22 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Kalle Valo, Hauke Mehrtens, linux-wireless, linux-kernel

On Thursday 17 March 2016 10:20:21 Arnd Bergmann wrote:
> While fixing another bug, I noticed that bcma manually sets up
> a dma_mask pointer for its child devices. We have a generic
> helper for that now, which should be able to cope better with
> any variations that might be needed to deal with cache coherency,
> unusual DMA address offsets, iommus, or limited DMA masks, none
> of which are currently handled here.
> 
> This changes the core to use the of_dma_configure(), like
> we do for platform devices that are probed directly from
> DT.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> 
> This patch needs to be tested to ensure we don't introduce
> regressions, and should probably go into 4.7 as a cleanup.
> 

I had meant to send at least a build-tested version of this,
sorry for the premature submission that breaks the build.

v2 coming.

	Arnd

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

* Re: [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask
  2016-03-17  9:20 ` [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask Arnd Bergmann
  2016-03-17  9:22   ` Arnd Bergmann
@ 2016-03-17  9:43   ` kbuild test robot
  1 sibling, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2016-03-17  9:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: kbuild-all, Rafał Miłecki, Arnd Bergmann, Kalle Valo,
	Hauke Mehrtens, linux-wireless, linux-kernel

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

Hi Arnd,

[auto build test ERROR on v4.5-rc7]
[also build test ERROR on next-20160317]
[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/Arnd-Bergmann/bcma-fix-building-without-OF_IRQ/20160317-172805
config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers/bcma/main.c: In function 'bcma_of_fill_device':
>> drivers/bcma/main.c:213:2: error: incompatible type for argument 1 of 'of_dma_configure'
     of_dma_configure(core->dev, node);
     ^
   In file included from include/linux/of_platform.h:17:0,
                    from drivers/bcma/main.c:17:
   include/linux/of_device.h:58:6: note: expected 'struct device *' but argument is of type 'struct device'
    void of_dma_configure(struct device *dev, struct device_node *np);
         ^

vim +/of_dma_configure +213 drivers/bcma/main.c

   207		node = bcma_of_find_child_device(parent, core);
   208		if (node)
   209			core->dev.of_node = node;
   210	
   211		core->irq = bcma_of_get_irq(parent, core, 0);
   212	
 > 213		of_dma_configure(core->dev, node);
   214	}
   215	
   216	unsigned int bcma_core_irq(struct bcma_device *core, int num)

---
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: 44058 bytes --]

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

* Re: [1/2] bcma: fix building without OF_IRQ
  2016-03-17  9:20 [PATCH 1/2] bcma: fix building without OF_IRQ Arnd Bergmann
  2016-03-17  9:20 ` [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask Arnd Bergmann
@ 2016-03-23 15:52 ` Kalle Valo
  1 sibling, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2016-03-23 15:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Rafał Miłecki, Arnd Bergmann, Hauke Mehrtens,
	linux-wireless, linux-kernel


> The bcma driver core can be built with or without DT support, but
> it fails to build when CONFIG_OF=y and CONFIG_OF_IRQ=n, which
> can happen on platforms that do not support IRQ domains.
> 
> ERROR: "irq_create_of_mapping" [drivers/bcma/bcma.ko] undefined!
> ERROR: "of_irq_parse_raw" [drivers/bcma/bcma.ko] undefined!
> ERROR: "of_irq_parse_one" [drivers/bcma/bcma.ko] undefined!
> 
> This adds another compile-time check for OF_IRQ, but also
> gets rid of now unneeded #ifdef checks: Using the simpler
> IS_ENABLED() check for OF_IRQ also covers the case of not
> having CONFIG_OF enabled. The check for CONFIG_OF_ADDRESS
> was added to allow building on architectures without
> OF_ADDRESS, but that has been addressed already in
> b1d06b60e90c ("of: Provide static inline function for
> of_translate_address if needed").
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks, applied to wireless-drivers.git.

Kalle Valo

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

* Re: [1/2] bcma: fix building without OF_IRQ
       [not found] <20160323155243.D1AB4615C6@smtp.codeaurora.org>
@ 2016-03-24 13:19 ` Arnd Bergmann
  2016-03-24 13:53   ` Kalle Valo
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2016-03-24 13:19 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Rafał Miłecki, Hauke Mehrtens, linux-wireless,
	linux-kernel

On Wednesday 23 March 2016 15:52:43 Kalle Valo wrote:
> > The bcma driver core can be built with or without DT support, but
> > it fails to build when CONFIG_OF=y and CONFIG_OF_IRQ=n, which
> > can happen on platforms that do not support IRQ domains.
> > 
> > ERROR: "irq_create_of_mapping" [drivers/bcma/bcma.ko] undefined!
> > ERROR: "of_irq_parse_raw" [drivers/bcma/bcma.ko] undefined!
> > ERROR: "of_irq_parse_one" [drivers/bcma/bcma.ko] undefined!
> > 
> > This adds another compile-time check for OF_IRQ, but also
> > gets rid of now unneeded #ifdef checks: Using the simpler
> > IS_ENABLED() check for OF_IRQ also covers the case of not
> > having CONFIG_OF enabled. The check for CONFIG_OF_ADDRESS
> > was added to allow building on architectures without
> > OF_ADDRESS, but that has been addressed already in
> > b1d06b60e90c ("of: Provide static inline function for
> > of_translate_address if needed").
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Thanks, applied to wireless-drivers.git.
> 

Thanks! I see you have applied patch 1/2 but not patch 2/2.

As mentioned in the comment for patch 2, it should be tested
better, but I want to make sure that someone still has it
on their radar.

	Arnd

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

* Re: [1/2] bcma: fix building without OF_IRQ
  2016-03-24 13:19 ` Arnd Bergmann
@ 2016-03-24 13:53   ` Kalle Valo
  2016-03-24 14:05     ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2016-03-24 13:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Rafał Miłecki, Hauke Mehrtens, linux-wireless,
	linux-kernel

Arnd Bergmann <arnd@arndb.de> writes:

> On Wednesday 23 March 2016 15:52:43 Kalle Valo wrote:
>> > The bcma driver core can be built with or without DT support, but
>> > it fails to build when CONFIG_OF=y and CONFIG_OF_IRQ=n, which
>> > can happen on platforms that do not support IRQ domains.
>> > 
>> > ERROR: "irq_create_of_mapping" [drivers/bcma/bcma.ko] undefined!
>> > ERROR: "of_irq_parse_raw" [drivers/bcma/bcma.ko] undefined!
>> > ERROR: "of_irq_parse_one" [drivers/bcma/bcma.ko] undefined!
>> > 
>> > This adds another compile-time check for OF_IRQ, but also
>> > gets rid of now unneeded #ifdef checks: Using the simpler
>> > IS_ENABLED() check for OF_IRQ also covers the case of not
>> > having CONFIG_OF enabled. The check for CONFIG_OF_ADDRESS
>> > was added to allow building on architectures without
>> > OF_ADDRESS, but that has been addressed already in
>> > b1d06b60e90c ("of: Provide static inline function for
>> > of_translate_address if needed").
>> > 
>> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> 
>> Thanks, applied to wireless-drivers.git.
>> 
>
> Thanks! I see you have applied patch 1/2 but not patch 2/2.
>
> As mentioned in the comment for patch 2, it should be tested
> better, but I want to make sure that someone still has it
> on their radar.

Just to avoid any confusions I assume you are talking about this patch:

[v2] bcma: use of_dma_configure() to set initial dma mask
https://patchwork.kernel.org/patch/8608751/

It's on my patchwork queue and I'm planning to apply it to
wireless-drivers-next once it opens again. But I'm not able to test the
patch myself, I hope someone else could do it.

-- 
Kalle Valo

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

* Re: [1/2] bcma: fix building without OF_IRQ
  2016-03-24 13:53   ` Kalle Valo
@ 2016-03-24 14:05     ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-03-24 14:05 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Rafał Miłecki, Hauke Mehrtens, linux-wireless,
	linux-kernel

On Thursday 24 March 2016 15:53:14 Kalle Valo wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
> 
> > On Wednesday 23 March 2016 15:52:43 Kalle Valo wrote:
> >> > The bcma driver core can be built with or without DT support, but
> >> > it fails to build when CONFIG_OF=y and CONFIG_OF_IRQ=n, which
> >> > can happen on platforms that do not support IRQ domains.
> >> > 
> >> > ERROR: "irq_create_of_mapping" [drivers/bcma/bcma.ko] undefined!
> >> > ERROR: "of_irq_parse_raw" [drivers/bcma/bcma.ko] undefined!
> >> > ERROR: "of_irq_parse_one" [drivers/bcma/bcma.ko] undefined!
> >> > 
> >> > This adds another compile-time check for OF_IRQ, but also
> >> > gets rid of now unneeded #ifdef checks: Using the simpler
> >> > IS_ENABLED() check for OF_IRQ also covers the case of not
> >> > having CONFIG_OF enabled. The check for CONFIG_OF_ADDRESS
> >> > was added to allow building on architectures without
> >> > OF_ADDRESS, but that has been addressed already in
> >> > b1d06b60e90c ("of: Provide static inline function for
> >> > of_translate_address if needed").
> >> > 
> >> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> 
> >> Thanks, applied to wireless-drivers.git.
> >> 
> >
> > Thanks! I see you have applied patch 1/2 but not patch 2/2.
> >
> > As mentioned in the comment for patch 2, it should be tested
> > better, but I want to make sure that someone still has it
> > on their radar.
> 
> Just to avoid any confusions I assume you are talking about this patch:
> 
> [v2] bcma: use of_dma_configure() to set initial dma mask
> https://patchwork.kernel.org/patch/8608751/

Correct.

> It's on my patchwork queue and I'm planning to apply it to
> wireless-drivers-next once it opens again.

Ok, sounds good.

	Arnd

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

end of thread, other threads:[~2016-03-24 14:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17  9:20 [PATCH 1/2] bcma: fix building without OF_IRQ Arnd Bergmann
2016-03-17  9:20 ` [PATCH 2/2] bcma: use of_dma_configure() to set initial dma mask Arnd Bergmann
2016-03-17  9:22   ` Arnd Bergmann
2016-03-17  9:43   ` kbuild test robot
2016-03-23 15:52 ` [1/2] bcma: fix building without OF_IRQ Kalle Valo
     [not found] <20160323155243.D1AB4615C6@smtp.codeaurora.org>
2016-03-24 13:19 ` Arnd Bergmann
2016-03-24 13:53   ` Kalle Valo
2016-03-24 14:05     ` Arnd Bergmann

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).