Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux-2.6-block.git] / drivers / infiniband / ulp / srp / ib_srp.c
index b7c5a35f7daab3f77ac3e76074e29cf5f23b3995..d5cbad2c61e490a4096669e5a27373089378b9f0 100644 (file)
@@ -148,6 +148,7 @@ MODULE_PARM_DESC(ch_count,
 
 static void srp_add_one(struct ib_device *device);
 static void srp_remove_one(struct ib_device *device, void *client_data);
+static void srp_rename_dev(struct ib_device *device, void *client_data);
 static void srp_recv_done(struct ib_cq *cq, struct ib_wc *wc);
 static void srp_handle_qp_err(struct ib_cq *cq, struct ib_wc *wc,
                const char *opname);
@@ -162,7 +163,8 @@ static struct workqueue_struct *srp_remove_wq;
 static struct ib_client srp_client = {
        .name   = "srp",
        .add    = srp_add_one,
-       .remove = srp_remove_one
+       .remove = srp_remove_one,
+       .rename = srp_rename_dev
 };
 
 static struct ib_sa_client srp_sa_client;
@@ -4095,6 +4097,20 @@ free_host:
        return NULL;
 }
 
+static void srp_rename_dev(struct ib_device *device, void *client_data)
+{
+       struct srp_device *srp_dev = client_data;
+       struct srp_host *host, *tmp_host;
+
+       list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
+               char name[IB_DEVICE_NAME_MAX + 8];
+
+               snprintf(name, sizeof(name), "srp-%s-%d",
+                        dev_name(&device->dev), host->port);
+               device_rename(&host->dev, name);
+       }
+}
+
 static void srp_add_one(struct ib_device *device)
 {
        struct srp_device *srp_dev;