From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Leon Romanovsky <leonro@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Devesh Sharma <devesh.sharma@broadcom.com>,
Jakub Kicinski <kuba@kernel.org>,
linux-rdma@vger.kernel.org,
Michael Chan <michael.chan@broadcom.com>,
Naresh Kumar PBS <nareshkumar.pbs@broadcom.com>,
netdev@vger.kernel.org,
Selvin Xavier <selvin.xavier@broadcom.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Subject: [PATCH rdma-next v1 3/5] RDMA/bnxt_re: Get rid of custom module reference counting
Date: Mon, 29 Mar 2021 11:52:10 +0300 [thread overview]
Message-ID: <20210329085212.257771-4-leon@kernel.org> (raw)
In-Reply-To: <20210329085212.257771-1-leon@kernel.org>
From: Leon Romanovsky <leonro@nvidia.com>
Instead of manually messing with parent driver module reference
counting rely on export symbol mechanism to ensure that proper
probe/remove chain is performed.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/hw/bnxt_re/main.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 140c54ee5916..8bfbf0231a9e 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -601,13 +601,6 @@ static struct bnxt_re_dev *bnxt_re_from_netdev(struct net_device *netdev)
return container_of(ibdev, struct bnxt_re_dev, ibdev);
}
-static void bnxt_re_dev_unprobe(struct net_device *netdev,
- struct bnxt_en_dev *en_dev)
-{
- dev_put(netdev);
- module_put(en_dev->pdev->driver->driver.owner);
-}
-
static struct bnxt_en_dev *bnxt_re_dev_probe(struct net_device *netdev)
{
struct bnxt_en_dev *en_dev;
@@ -628,10 +621,6 @@ static struct bnxt_en_dev *bnxt_re_dev_probe(struct net_device *netdev)
return ERR_PTR(-ENODEV);
}
- /* Bump net device reference count */
- if (!try_module_get(pdev->driver->driver.owner))
- return ERR_PTR(-ENODEV);
-
dev_hold(netdev);
return en_dev;
@@ -1558,13 +1547,12 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode)
static void bnxt_re_dev_unreg(struct bnxt_re_dev *rdev)
{
- struct bnxt_en_dev *en_dev = rdev->en_dev;
struct net_device *netdev = rdev->netdev;
bnxt_re_dev_remove(rdev);
if (netdev)
- bnxt_re_dev_unprobe(netdev, en_dev);
+ dev_put(netdev);
}
static int bnxt_re_dev_reg(struct bnxt_re_dev **rdev, struct net_device *netdev)
@@ -1586,7 +1574,7 @@ static int bnxt_re_dev_reg(struct bnxt_re_dev **rdev, struct net_device *netdev)
*rdev = bnxt_re_dev_add(netdev, en_dev);
if (!*rdev) {
rc = -ENOMEM;
- bnxt_re_dev_unprobe(netdev, en_dev);
+ dev_put(netdev);
goto exit;
}
exit:
--
2.30.2
next prev parent reply other threads:[~2021-03-29 8:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 8:52 [PATCH rdma-next v1 0/5] Get rid of custom made module dependency Leon Romanovsky
2021-03-29 8:52 ` [PATCH rdma-next v1 1/5] RDMA/bnxt_re: Depend on bnxt ethernet driver and not blindly select it Leon Romanovsky
2021-03-29 8:52 ` [PATCH rdma-next v1 2/5] RDMA/bnxt_re: Create direct symbolic link between bnxt modules Leon Romanovsky
2021-03-29 8:52 ` Leon Romanovsky [this message]
2021-03-29 8:52 ` [PATCH rdma-next v1 4/5] net/bnxt: Remove useless check of non-existent ULP id Leon Romanovsky
2021-03-29 8:52 ` [PATCH rdma-next v1 5/5] net/bnxt: Use direct API instead of useless indirection Leon Romanovsky
2021-03-29 14:01 ` Michael Chan
2021-03-29 14:16 ` Jason Gunthorpe
2021-03-29 18:12 ` Devesh Sharma
2021-03-31 6:37 ` kernel test robot
2021-03-31 7:10 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210329085212.257771-4-leon@kernel.org \
--to=leon@kernel.org \
--cc=davem@davemloft.net \
--cc=devesh.sharma@broadcom.com \
--cc=dledford@redhat.com \
--cc=jgg@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=nareshkumar.pbs@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=selvin.xavier@broadcom.com \
--cc=somnath.kotur@broadcom.com \
--cc=sriharsha.basavapatna@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.