diff mbox

[2/2] bcma: use of_dma_configure() to set initial dma mask

Message ID 1458206432-3039552-2-git-send-email-arnd@arndb.de (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Arnd Bergmann March 17, 2016, 9:20 a.m. UTC
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(-)

Comments

Arnd Bergmann March 17, 2016, 9:22 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot March 17, 2016, 9:43 a.m. UTC | #2
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
diff mbox

Patch

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;