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 v2 3/5] RDMA/bnxt_re: Get rid of custom module reference counting
Date: Thu, 1 Apr 2021 09:57:13 +0300 [thread overview]
Message-ID: <20210401065715.565226-4-leon@kernel.org> (raw)
In-Reply-To: <20210401065715.565226-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-04-01 6:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 6:57 [PATCH rdma-next v2 0/5] Get rid of custom made module dependency Leon Romanovsky
2021-04-01 6:57 ` [PATCH rdma-next v2 1/5] RDMA/bnxt_re: Depend on bnxt ethernet driver and not blindly select it Leon Romanovsky
2021-04-21 17:50 ` Devesh Sharma
2021-04-01 6:57 ` [PATCH rdma-next v2 2/5] RDMA/bnxt_re: Create direct symbolic link between bnxt modules Leon Romanovsky
2021-04-21 17:51 ` Devesh Sharma
2021-04-01 6:57 ` Leon Romanovsky [this message]
2021-04-21 17:52 ` [PATCH rdma-next v2 3/5] RDMA/bnxt_re: Get rid of custom module reference counting Devesh Sharma
2021-04-01 6:57 ` [PATCH rdma-next v2 4/5] net/bnxt: Remove useless check of non-existent ULP id Leon Romanovsky
2021-04-01 6:57 ` [PATCH rdma-next v2 5/5] net/bnxt: Use direct API instead of useless indirection Leon Romanovsky
2021-04-03 10:22 ` [PATCH rdma-next v2 0/5] Get rid of custom made module dependency Devesh Sharma
2021-04-03 11:42 ` Leon Romanovsky
2021-04-08 11:36 ` Devesh Sharma
2021-04-08 11:44 ` Leon Romanovsky
2021-04-08 11:53 ` Jason Gunthorpe
2021-04-08 12:03 ` Leon Romanovsky
2021-04-08 15:21 ` Devesh Sharma
2021-04-08 15:12 ` Devesh Sharma
2021-04-12 7:40 ` Leon Romanovsky
2021-04-14 13:45 ` Devesh Sharma
2021-04-17 8:14 ` Leon Romanovsky
2021-04-17 18:39 ` Devesh Sharma
2021-04-18 4:18 ` Leon Romanovsky
2021-04-19 17:38 ` Jason Gunthorpe
2021-04-19 19:04 ` Devesh Sharma
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=20210401065715.565226-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).