[10/10] net: ethernet: ixp4xx: Use parent dev for DMA pool

Message ID 20191021000824.531-11-linus.walleij@linaro.org
State New
Headers show
Series
  • IXP4xx networking cleanups
Related show

Commit Message

Linus Walleij Oct. 21, 2019, 12:08 a.m.
Use the netdevice struct device .parent field when calling
dma_pool_create(): the .dma_coherent_mask and .dma_mask
pertains to the bus device on the hardware (platform)
bus in this case, not the struct device inside the network
device. This makes the pool allocation work.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.21.0

Comments

Arnd Bergmann Oct. 21, 2019, 10:27 a.m. | #1
On Mon, Oct 21, 2019 at 2:10 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>

> Use the netdevice struct device .parent field when calling

> dma_pool_create(): the .dma_coherent_mask and .dma_mask

> pertains to the bus device on the hardware (platform)

> bus in this case, not the struct device inside the network

> device. This makes the pool allocation work.

>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Has this always been broken, or can you identify when it stopped
working? It might be a candidate for stable backports.

> ---

>  drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c

> index 0996046bd046..3ee6d7232eb9 100644

> --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c

> +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c

> @@ -1090,7 +1090,7 @@ static int init_queues(struct port *port)

>         int i;

>

>         if (!ports_open) {

> -               dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev,

> +               dma_pool = dma_pool_create(DRV_NAME, port->netdev->dev.parent,

>                                            POOL_ALLOC_SIZE, 32, 0);

>                 if (!dma_pool)

>                         return -ENOMEM;

> --

> 2.21.0

>

Patch

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 0996046bd046..3ee6d7232eb9 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1090,7 +1090,7 @@  static int init_queues(struct port *port)
 	int i;
 
 	if (!ports_open) {
-		dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev,
+		dma_pool = dma_pool_create(DRV_NAME, port->netdev->dev.parent,
 					   POOL_ALLOC_SIZE, 32, 0);
 		if (!dma_pool)
 			return -ENOMEM;