mlx4: do not set struct device * to NULL
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 4 Oct 2019 19:23:40 +0000 (15:23 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 8 Oct 2019 21:11:10 +0000 (17:11 -0400)
This driver was ported back before we had any struct device in
pci_device.  We don't use it for much, but I can use it to find the
pci_device for a given Linux driver's device.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/net/mlx4/alloc.c
kern/drivers/net/mlx4/en_main.c
kern/drivers/net/mlx4/en_netdev.c
kern/drivers/net/mlx4/icm.c
kern/drivers/net/mlx4/mlx4_en.h

index dd8053b..1ffe736 100644 (file)
@@ -757,11 +757,7 @@ int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order, gfp_t gfp
                if (!mlx4_alloc_db_from_pgdir(pgdir, db, order))
                        goto out;
 
-#if 0 // AKAROS_PORT
-       pgdir = mlx4_alloc_db_pgdir(&dev->persist->pdev->dev, gfp);
-#else
-       pgdir = mlx4_alloc_db_pgdir(0, gfp);
-#endif
+       pgdir = mlx4_alloc_db_pgdir(&dev->persist->pdev->linux_dev, gfp);
        if (!pgdir) {
                ret = -ENOMEM;
                goto out;
index 0e1cab0..c8edc9b 100644 (file)
@@ -261,11 +261,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
        spinlock_init_irqsave(&mdev->uar_lock);
 
        mdev->dev = dev;
-#if 0 // AKAROS_PORT
-       mdev->dma_device = &dev->persist->pdev->dev;
-#else
-       mdev->dma_device = 0;
-#endif
+       mdev->dma_device = &dev->persist->pdev->linux_dev;
        mdev->pdev = dev->persist->pdev;
        mdev->device_up = false;
 
index d9f0968..c59d56e 100644 (file)
@@ -2873,9 +2873,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 
        priv->dev = dev;
        priv->mdev = mdev;
-#if 0 // AKAROS_PORT
-       priv->ddev = &mdev->pdev->dev;
-#endif
+       priv->ddev = &mdev->pdev->linux_dev;
        priv->prof = prof;
        priv->port = port;
        priv->port_up = false;
index d3446d4..ad9129a 100644 (file)
@@ -170,11 +170,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
                        --cur_order;
 
                if (coherent)
-#if 0 // AKAROS_PORT
-                       ret = mlx4_alloc_icm_coherent(&dev->persist->pdev->dev,
-#else
-                       ret = mlx4_alloc_icm_coherent(0,
-#endif
+                       ret = mlx4_alloc_icm_coherent(&dev->persist->pdev->linux_dev,
                                                      &chunk->mem[chunk->npages],
                                                      cur_order, gfp_mask);
                else
index 7ab2e81..f31a9f8 100644 (file)
@@ -579,9 +579,7 @@ struct mlx4_en_priv {
        struct mlx4_en_stat_out_mbox hw_stats;
        int vids[128];
        bool wol;
-#if 0 // AKAROS_PORT
        struct device *ddev;
-#endif
        int base_tx_qpn;
        struct hlist_head mac_hash[MLX4_EN_MAC_HASH_SIZE];
        struct hwtstamp_config hwtstamp_config;