/* Upper level users use ib_unregister_client() to remove their client registration. When ib_unregister_client() is called, the client will receive a remove callback for each IB device still registered.  */
void ib_unregister_client(struct ib_client *client)
/* Upper level users use ib_unregister_client() to remove their client registration. When ib_unregister_client() is called, the client will receive a remove callback for each IB device still registered.  */
void ib_unregister_client(struct ib_client *client)
{
	struct ib_client_data *context, *tmp;
	struct ib_device *device;
	unsigned long flags;
	mutex_lock(&device_mutex);
	list_for_each_entry(device, &device_list, core_list) {
		if (client->remove)
			client->remove(device);
		spin_lock_irqsave(&device->client_data_lock, flags);
		list_for_each_entry_safe(context, tmp, &device->client_data_list, list)
			if (context->client == client) {
				list_del(&context->list);
				kfree(context);
			}
		spin_unlock_irqrestore(&device->client_data_lock, flags);
	}
	list_del(&client->list);
	mutex_unlock(&device_mutex);
}