RDMA: Fully setup the device name in ib_register_device
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@mellanox.com> Acked-by: Adit Ranadive <aditr@vmware.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Acked-by: Devesh Sharma <devesh.sharma@broadcom.com> Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
这个提交包含在:
@@ -170,8 +170,6 @@ static int qedr_register_device(struct qedr_dev *dev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
strlcpy(dev->ibdev.name, "qedr%d", IB_DEVICE_NAME_MAX);
|
||||
|
||||
dev->ibdev.node_guid = dev->attr.node_guid;
|
||||
memcpy(dev->ibdev.node_desc, QEDR_NODE_DESC, sizeof(QEDR_NODE_DESC));
|
||||
dev->ibdev.owner = THIS_MODULE;
|
||||
@@ -264,7 +262,7 @@ static int qedr_register_device(struct qedr_dev *dev)
|
||||
dev->ibdev.get_dev_fw_str = qedr_get_dev_fw_str;
|
||||
|
||||
dev->ibdev.driver_id = RDMA_DRIVER_QEDR;
|
||||
return ib_register_device(&dev->ibdev, NULL);
|
||||
return ib_register_device(&dev->ibdev, "qedr%d", NULL);
|
||||
}
|
||||
|
||||
/* This function allocates fast-path status block memory */
|
||||
|
在新工单中引用
屏蔽一个用户