[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANjDDBh_hTRKeZ+ujh4XZ5JjY1JDw0qKqgUjmvoH3koDyfSesA@mail.gmail.com>
Date: Wed, 21 Apr 2021 23:22:27 +0530
From: Devesh Sharma <devesh.sharma@...adcom.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>,
Leon Romanovsky <leonro@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
linux-rdma <linux-rdma@...r.kernel.org>,
Michael Chan <michael.chan@...adcom.com>,
Naresh Kumar PBS <nareshkumar.pbs@...adcom.com>,
Netdev <netdev@...r.kernel.org>,
Selvin Xavier <selvin.xavier@...adcom.com>,
Somnath Kotur <somnath.kotur@...adcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@...adcom.com>
Subject: Re: [PATCH rdma-next v2 3/5] RDMA/bnxt_re: Get rid of custom module
reference counting
On Thu, Apr 1, 2021 at 12:27 PM Leon Romanovsky <leon@...nel.org> wrote:
>
> From: Leon Romanovsky <leonro@...dia.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@...dia.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:
Acked-By: Devesh Sharma <devesh.sharma@...adcom.com>
> --
> 2.30.2
>
--
-Regards
Devesh
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4212 bytes)
Powered by blists - more mailing lists