Re: [PATCH 1/6] RDMA: Fully setup the device name in ib_register_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 24, 2018 at 09:01:32PM +0000, Ruhl, Michael J wrote:
> >From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> >
> >The current code has two copies of the device name, ibdev->dev and
> >dev_name(&ibdev->dev), and they are setup at different times, which is
> >very confusing.
> >
> >Set them both up at the same time and make dev_name() the lead name,
> >which
> >is the proper use of the driver core APIs. To make it very clear that the
> >name is not valid until registration pass it in to the
> >ib_register_device() call rather than messing with ibdev->name directly.
> >
> >Also the reorganization now checks that dev_name is unique even if it does
> >not contain a %.
> >
> >Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> > drivers/infiniband/hw/hfi1/init.c             |  1 -
> > drivers/infiniband/hw/hfi1/verbs.c            |  4 ++-
> > drivers/infiniband/hw/qib/qib_init.c          |  1 -
> > drivers/infiniband/hw/qib/qib_verbs.c         |  4 ++-
> >diff --git a/drivers/infiniband/hw/hfi1/init.c
> >b/drivers/infiniband/hw/hfi1/init.c
> >index 1e770a1337793e..e87ff7a544eb1a 100644
> >+++ b/drivers/infiniband/hw/hfi1/init.c
> >@@ -1313,7 +1313,6 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct
> >pci_dev *pdev,
> > 			"Could not allocate unit ID: error %d\n", -ret);
> > 		goto bail;
> > 	}
> >-	rvt_set_ibdev_name(&dd->verbs_dev.rdi, "%s_%d", class_name(),
> >dd->unit);
> 
> If you remove this call, the HFI (and probably the QIB) dd_dev_xxx() macros will
> not work correctly until we call ib_register().  Since we do a lot of work before
> that, this will lose our ability to print out the device name.

What prints exactly?

>From what I can see the hfi driver uses macros like this:

#define dd_dev_warn(dd, fmt, ...) \
        dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \

Which uses the physical device dev for printing, not the IB device.

Generally speaking, drivers are supposed to use the physical device
for printing until registration completes, then they should use the ib
device.

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux