diff options
author | 2017-07-02 11:20:50 +0300 | |
---|---|---|
committer | 2017-08-18 10:46:20 -0400 | |
commit | b059e2108d7ac2d63001735f11d79ee670d9e3fe (patch) | |
tree | e58b6184b0592e79383f4f28f9f0550a9c96f037 /drivers/infiniband/core/device.c | |
parent | cxgb4: Remove some dead code (diff) | |
download | linux-b059e2108d7ac2d63001735f11d79ee670d9e3fe.tar.gz linux-b059e2108d7ac2d63001735f11d79ee670d9e3fe.tar.bz2 linux-b059e2108d7ac2d63001735f11d79ee670d9e3fe.zip |
RDMA/core: make ib_device.add method optional
ib_clients can indeed fill .add to NULL, but then they will not see
any device removal notifications. The reason is that that
ib_register_client and ib_register_device checked existence of .add
before adding the creating a corresponding client_data and adding
it to the list. Simple condition reverse fixes the issue.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/device.c')
-rw-r--r-- | drivers/infiniband/core/device.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index a5dfab6adf49..9b7e110e7d8e 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -489,7 +489,7 @@ int ib_register_device(struct ib_device *device, device->reg_state = IB_DEV_REGISTERED; list_for_each_entry(client, &client_list, list) - if (client->add && !add_client_context(device, client)) + if (!add_client_context(device, client) && client->add) client->add(device); down_write(&lists_rwsem); @@ -577,7 +577,7 @@ int ib_register_client(struct ib_client *client) mutex_lock(&device_mutex); list_for_each_entry(device, &device_list, core_list) - if (client->add && !add_client_context(device, client)) + if (!add_client_context(device, client) && client->add) client->add(device); down_write(&lists_rwsem); |