diff options
| author | Long Li <[email protected]> | 2025-03-12 23:15:31 +0000 |
|---|---|---|
| committer | Leon Romanovsky <[email protected]> | 2025-03-13 12:03:02 +0000 |
| commit | a8445cfec101c42e9d64cdb2dac13973b22c205c (patch) | |
| tree | 5cbab7287c61d4ff4c7600f433fb3a2615bac669 /drivers/infiniband/hw/mana/device.c | |
| parent | RDMA/rxe: Improve readability of ODP pagefault interface (diff) | |
| download | kernel-a8445cfec101c42e9d64cdb2dac13973b22c205c.tar.gz kernel-a8445cfec101c42e9d64cdb2dac13973b22c205c.zip | |
net: mana: Change the function signature of mana_get_primary_netdev_rcu
Change mana_get_primary_netdev_rcu() to mana_get_primary_netdev(), and
return the ndev with refcount held. The caller is responsible for dropping
the refcount.
Also drop the check for IFF_SLAVE as it is not necessary if the upper
device is present.
Signed-off-by: Long Li <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Leon Romanovsky <[email protected]>
Diffstat (limited to 'drivers/infiniband/hw/mana/device.c')
| -rw-r--r-- | drivers/infiniband/hw/mana/device.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c index d1a02c54a236..9357a9845c2c 100644 --- a/drivers/infiniband/hw/mana/device.c +++ b/drivers/infiniband/hw/mana/device.c @@ -98,10 +98,8 @@ static int mana_ib_probe(struct auxiliary_device *adev, dev->ib_dev.num_comp_vectors = mdev->gdma_context->max_num_queues; dev->ib_dev.dev.parent = mdev->gdma_context->dev; - rcu_read_lock(); /* required to get primary netdev */ - ndev = mana_get_primary_netdev_rcu(mc, 0); + ndev = mana_get_primary_netdev(mc, 0, &dev->dev_tracker); if (!ndev) { - rcu_read_unlock(); ret = -ENODEV; ibdev_err(&dev->ib_dev, "Failed to get netdev for IB port 1"); goto free_ib_device; @@ -109,7 +107,8 @@ static int mana_ib_probe(struct auxiliary_device *adev, ether_addr_copy(mac_addr, ndev->dev_addr); addrconf_addr_eui48((u8 *)&dev->ib_dev.node_guid, ndev->dev_addr); ret = ib_device_set_netdev(&dev->ib_dev, ndev, 1); - rcu_read_unlock(); + /* mana_get_primary_netdev() returns ndev with refcount held */ + netdev_put(ndev, &dev->dev_tracker); if (ret) { ibdev_err(&dev->ib_dev, "Failed to set ib netdev, ret %d", ret); goto free_ib_device; |
