summaryrefslogtreecommitdiff
path: root/drivers/s390/scsi
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2013-04-26 18:13:49 +0400
committerJames Bottomley <JBottomley@Parallels.com>2013-06-01 03:32:37 +0400
commit86bdf218a717b77cb775b82ce48c7847cb72a86d (patch)
tree44b48f8c9d984e3243d6b8e6bfa6ebed0c5e6222 /drivers/s390/scsi
parent83d4e1c33d9329e6d53cf4ac0a02c98ac83eba05 (diff)
downloadlinux-86bdf218a717b77cb775b82ce48c7847cb72a86d.tar.xz
[SCSI] zfcp: cleanup unit sysfs attribute usage
Let the driver core handle device attribute creation and removal. This will simplify the code and eliminates races between attribute availability and userspace notification via uevents. Reviewed-by: Steffen Maier <maier@linux.vnet.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/s390/scsi')
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c2
-rw-r--r--drivers/s390/scsi/zfcp_ext.h2
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c7
-rw-r--r--drivers/s390/scsi/zfcp_unit.c9
4 files changed, 9 insertions, 11 deletions
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 202f39572880..8e71d35a64cc 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -129,7 +129,7 @@ static void zfcp_ccw_remove(struct ccw_device *cdev)
zfcp_ccw_adapter_put(adapter); /* put from zfcp_ccw_adapter_by_cdev */
list_for_each_entry_safe(unit, u, &unit_remove_lh, list)
- zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
+ device_unregister(&unit->dev);
list_for_each_entry_safe(port, p, &port_remove_lh, list)
device_unregister(&port->dev);
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 695b133364a8..b993d1170063 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -158,7 +158,7 @@ extern void zfcp_scsi_set_prot(struct zfcp_adapter *);
extern void zfcp_scsi_dif_sense_error(struct scsi_cmnd *, int);
/* zfcp_sysfs.c */
-extern struct attribute_group zfcp_sysfs_unit_attrs;
+extern const struct attribute_group *zfcp_unit_attr_groups[];
extern struct attribute_group zfcp_sysfs_adapter_attrs;
extern const struct attribute_group *zfcp_port_attr_groups[];
extern struct mutex zfcp_sysfs_port_units_mutex;
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index d9261264a2b6..05423ace6bf3 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -357,10 +357,13 @@ static struct attribute *zfcp_unit_attrs[] = {
&dev_attr_unit_access_readonly.attr,
NULL
};
-
-struct attribute_group zfcp_sysfs_unit_attrs = {
+static struct attribute_group zfcp_unit_attr_group = {
.attrs = zfcp_unit_attrs,
};
+const struct attribute_group *zfcp_unit_attr_groups[] = {
+ &zfcp_unit_attr_group,
+ NULL,
+};
#define ZFCP_DEFINE_LATENCY_ATTR(_name) \
static ssize_t \
diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c
index 1cd2b99ab256..39f5446f7216 100644
--- a/drivers/s390/scsi/zfcp_unit.c
+++ b/drivers/s390/scsi/zfcp_unit.c
@@ -145,6 +145,7 @@ int zfcp_unit_add(struct zfcp_port *port, u64 fcp_lun)
unit->fcp_lun = fcp_lun;
unit->dev.parent = &port->dev;
unit->dev.release = zfcp_unit_release;
+ unit->dev.groups = zfcp_unit_attr_groups;
INIT_WORK(&unit->scsi_work, zfcp_unit_scsi_scan_work);
if (dev_set_name(&unit->dev, "0x%016llx",
@@ -160,12 +161,6 @@ int zfcp_unit_add(struct zfcp_port *port, u64 fcp_lun)
goto out;
}
- if (sysfs_create_group(&unit->dev.kobj, &zfcp_sysfs_unit_attrs)) {
- device_unregister(&unit->dev);
- retval = -EINVAL;
- goto out;
- }
-
atomic_inc(&port->units); /* under zfcp_sysfs_port_units_mutex ! */
write_lock_irq(&port->unit_list_lock);
@@ -254,7 +249,7 @@ int zfcp_unit_remove(struct zfcp_port *port, u64 fcp_lun)
put_device(&unit->dev);
- zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
+ device_unregister(&unit->dev);
return 0;
}