Skip to content

Commit 896de00

Browse files
committed
RDMA/core: Use dev_name instead of ibdev->name
These return the same thing but dev_name is a more conventional use of the kernel API. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
1 parent 5a738b5 commit 896de00

File tree

10 files changed

+16
-17
lines changed

10 files changed

+16
-17
lines changed

drivers/infiniband/core/cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4367,7 +4367,7 @@ static void cm_add_one(struct ib_device *ib_device)
43674367
cm_dev->going_down = 0;
43684368
cm_dev->device = device_create(&cm_class, &ib_device->dev,
43694369
MKDEV(0, 0), NULL,
4370-
"%s", ib_device->name);
4370+
"%s", dev_name(&ib_device->dev));
43714371
if (IS_ERR(cm_dev->device)) {
43724372
kfree(cm_dev);
43734373
return;

drivers/infiniband/core/cma_configfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static struct cma_dev_port_group *to_dev_port_group(struct config_item *item)
6565

6666
static bool filter_by_name(struct ib_device *ib_dev, void *cookie)
6767
{
68-
return !strcmp(ib_dev->name, cookie);
68+
return !strcmp(dev_name(&ib_dev->dev), cookie);
6969
}
7070

7171
static int cma_configfs_params_get(struct config_item *item,

drivers/infiniband/core/device.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static struct ib_device *__ib_device_get_by_name(const char *name)
165165
struct ib_device *device;
166166

167167
list_for_each_entry(device, &device_list, core_list)
168-
if (!strncmp(name, device->name, IB_DEVICE_NAME_MAX))
168+
if (!strcmp(name, dev_name(&device->dev)))
169169
return device;
170170

171171
return NULL;
@@ -184,7 +184,7 @@ static int alloc_name(struct ib_device *ibdev, const char *name)
184184
list_for_each_entry(device, &device_list, core_list) {
185185
char buf[IB_DEVICE_NAME_MAX];
186186

187-
if (sscanf(device->name, name, &i) != 1)
187+
if (sscanf(dev_name(&device->dev), name, &i) != 1)
188188
continue;
189189
if (i < 0 || i >= PAGE_SIZE * 8)
190190
continue;
@@ -219,9 +219,7 @@ static void ib_device_release(struct device *device)
219219
static int ib_device_uevent(struct device *device,
220220
struct kobj_uevent_env *env)
221221
{
222-
struct ib_device *dev = container_of(device, struct ib_device, dev);
223-
224-
if (add_uevent_var(env, "NAME=%s", dev->name))
222+
if (add_uevent_var(env, "NAME=%s", dev_name(device)))
225223
return -ENOMEM;
226224

227225
/*

drivers/infiniband/core/fmr_pool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
257257
atomic_set(&pool->flush_ser, 0);
258258
init_waitqueue_head(&pool->force_wait);
259259

260-
pool->worker = kthread_create_worker(0, "ib_fmr(%s)", device->name);
260+
pool->worker =
261+
kthread_create_worker(0, "ib_fmr(%s)", dev_name(&device->dev));
261262
if (IS_ERR(pool->worker)) {
262263
pr_warn(PFX "couldn't start cleanup kthread worker\n");
263264
ret = PTR_ERR(pool->worker);

drivers/infiniband/core/iwcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ static int iw_cm_map(struct iw_cm_id *cm_id, bool active)
509509
cm_id->m_local_addr = cm_id->local_addr;
510510
cm_id->m_remote_addr = cm_id->remote_addr;
511511

512-
memcpy(pm_reg_msg.dev_name, cm_id->device->name,
512+
memcpy(pm_reg_msg.dev_name, dev_name(&cm_id->device->dev),
513513
sizeof(pm_reg_msg.dev_name));
514514
memcpy(pm_reg_msg.if_name, cm_id->device->iwcm->ifname,
515515
sizeof(pm_reg_msg.if_name));

drivers/infiniband/core/nldev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ static int fill_nldev_handle(struct sk_buff *msg, struct ib_device *device)
179179
{
180180
if (nla_put_u32(msg, RDMA_NLDEV_ATTR_DEV_INDEX, device->index))
181181
return -EMSGSIZE;
182-
if (nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_NAME, device->name))
182+
if (nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_NAME,
183+
dev_name(&device->dev)))
183184
return -EMSGSIZE;
184185

185186
return 0;

drivers/infiniband/core/sa_query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ static void ib_nl_set_path_rec_attrs(struct sk_buff *skb,
761761

762762
/* Construct the family header first */
763763
header = skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
764-
memcpy(header->device_name, query->port->agent->device->name,
764+
memcpy(header->device_name, dev_name(&query->port->agent->device->dev),
765765
LS_DEVICE_NAME_MAX);
766766
header->port_num = query->port->port_num;
767767

drivers/infiniband/core/security.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,8 @@ static int ib_mad_agent_security_change(struct notifier_block *nb,
685685
if (event != LSM_POLICY_CHANGE)
686686
return NOTIFY_DONE;
687687

688-
ag->smp_allowed = !security_ib_endport_manage_subnet(ag->security,
689-
ag->device->name,
690-
ag->port_num);
688+
ag->smp_allowed = !security_ib_endport_manage_subnet(
689+
ag->security, dev_name(&ag->device->dev), ag->port_num);
691690

692691
return NOTIFY_OK;
693692
}
@@ -708,7 +707,7 @@ int ib_mad_agent_security_setup(struct ib_mad_agent *agent,
708707
return 0;
709708

710709
ret = security_ib_endport_manage_subnet(agent->security,
711-
agent->device->name,
710+
dev_name(&agent->device->dev),
712711
agent->port_num);
713712
if (ret)
714713
return ret;

drivers/infiniband/core/user_mad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr,
11321132
if (!port)
11331133
return -ENODEV;
11341134

1135-
return sprintf(buf, "%s\n", port->ib_dev->name);
1135+
return sprintf(buf, "%s\n", dev_name(&port->ib_dev->dev));
11361136
}
11371137
static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
11381138

drivers/infiniband/core/uverbs_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ static ssize_t ibdev_show(struct device *device, struct device_attribute *attr,
11791179
srcu_key = srcu_read_lock(&dev->disassociate_srcu);
11801180
ib_dev = srcu_dereference(dev->ib_dev, &dev->disassociate_srcu);
11811181
if (ib_dev)
1182-
ret = sprintf(buf, "%s\n", ib_dev->name);
1182+
ret = sprintf(buf, "%s\n", dev_name(&ib_dev->dev));
11831183
srcu_read_unlock(&dev->disassociate_srcu, srcu_key);
11841184

11851185
return ret;

0 commit comments

Comments
 (0)