On Sat, Jan 4, 2020 at 1:06 AM Jason Gunthorpe <jgg@xxxxxxxx> wrote: > > On Mon, Nov 25, 2019 at 12:39:32AM -0800, Selvin Xavier wrote: > > - bnxt_re_ib_reg() handles two main functionalities - initializing > > the device and registering with the IB stack. Split it into 2 > > functions i.e. bnxt_re_dev_init() and bnxt_re_ib_init() to account > > for the same thereby improve modularity. Do the same for > > bnxt_re_ib_unreg()i.e. split into two functions - bnxt_re_dev_uninit() > > and bnxt_re_ib_uninit(). > > - Simplify the code by combining the different steps to add and > > remove the device into two functions. > > > > Signed-off-by: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx> > > drivers/infiniband/hw/bnxt_re/main.c | 133 ++++++++++++++++++++--------------- > > 1 file changed, 78 insertions(+), 55 deletions(-) > > > > diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c > > index fbe3192..0cf38a4 100644 > > +++ b/drivers/infiniband/hw/bnxt_re/main.c > > @@ -78,7 +78,8 @@ static struct list_head bnxt_re_dev_list = LIST_HEAD_INIT(bnxt_re_dev_list); > > /* Mutex to protect the list of bnxt_re devices added */ > > static DEFINE_MUTEX(bnxt_re_dev_lock); > > static struct workqueue_struct *bnxt_re_wq; > > -static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev); > > +static void bnxt_re_remove_device(struct bnxt_re_dev *rdev); > > +static void bnxt_re_ib_uninit(struct bnxt_re_dev *rdev); > > > > static void bnxt_re_destroy_chip_ctx(struct bnxt_re_dev *rdev) > > { > > @@ -222,7 +223,9 @@ static void bnxt_re_shutdown(void *p) > > if (!rdev) > > return; > > > > - bnxt_re_ib_unreg(rdev); > > + bnxt_re_ib_uninit(rdev); > > + /* rtnl_lock held by L2 before coming here */ > > + bnxt_re_remove_device(rdev); > > Is this a warning that RTNL is held, or a note that is is required? If > it is the latter then plen use ASSERT_RTNL instead of a comment > It was intended as a note. I will replace this with the ASSERT_RTNL. Thanks > Jason