Commit 344684e6 authored by Jason Gunthorpe's avatar Jason Gunthorpe

RDMA/device: Use __ib_device_get_by_name() in ib_device_rename()

No reason to open code this loop.
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Reviewed-by: default avatarSteve Wise <swise@opengridcomputing.com>
parent de77503a
...@@ -183,19 +183,16 @@ static struct ib_device *__ib_device_get_by_name(const char *name) ...@@ -183,19 +183,16 @@ static struct ib_device *__ib_device_get_by_name(const char *name)
int ib_device_rename(struct ib_device *ibdev, const char *name) int ib_device_rename(struct ib_device *ibdev, const char *name)
{ {
struct ib_device *device;
int ret = 0; int ret = 0;
if (!strcmp(name, dev_name(&ibdev->dev))) if (!strcmp(name, dev_name(&ibdev->dev)))
return ret; return ret;
mutex_lock(&device_mutex); mutex_lock(&device_mutex);
list_for_each_entry(device, &device_list, core_list) { if (__ib_device_get_by_name(name)) {
if (!strcmp(name, dev_name(&device->dev))) {
ret = -EEXIST; ret = -EEXIST;
goto out; goto out;
} }
}
ret = device_rename(&ibdev->dev, name); ret = device_rename(&ibdev->dev, name);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment