aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-11-24 10:54:02 -0500
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:02:04 -0500
commit25458eb791acf0e5e65183c5adb3918d8d71d756 (patch)
treee634ee6be885b096c8a8840f6b6a1184d1fb341d
parentb42aeceb35c59484056b0eea81203a0911ebb50d (diff)
[SCSI] zfcp: Access ports and units with container_of in sysfs code
When accessing port and unit attributes, use container_of instead of dev_get_drvdata. This eliminates some code checker warnings about aliased access of data structures. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/s390/scsi/zfcp_aux.c2
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c15
2 files changed, 10 insertions, 7 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index ed31bd0ff3fb..baef2ec7482f 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -319,7 +319,6 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
319 kfree(unit); 319 kfree(unit);
320 goto err_out; 320 goto err_out;
321 } 321 }
322 dev_set_drvdata(&unit->sysfs_device, unit);
323 retval = -EINVAL; 322 retval = -EINVAL;
324 323
325 /* mark unit unusable as long as sysfs registration is not complete */ 324 /* mark unit unusable as long as sysfs registration is not complete */
@@ -688,7 +687,6 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
688 kfree(port); 687 kfree(port);
689 goto err_out; 688 goto err_out;
690 } 689 }
691 dev_set_drvdata(&port->sysfs_device, port);
692 retval = -EINVAL; 690 retval = -EINVAL;
693 691
694 if (device_register(&port->sysfs_device)) { 692 if (device_register(&port->sysfs_device)) {
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 181bea0f10fb..901cc9a6ed20 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -19,7 +19,8 @@ static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev, \
19 struct device_attribute *at,\ 19 struct device_attribute *at,\
20 char *buf) \ 20 char *buf) \
21{ \ 21{ \
22 struct _feat_def *_feat = dev_get_drvdata(dev); \ 22 struct _feat_def *_feat = container_of(dev, struct _feat_def, \
23 sysfs_device); \
23 \ 24 \
24 return sprintf(buf, _format, _value); \ 25 return sprintf(buf, _format, _value); \
25} \ 26} \
@@ -86,7 +87,8 @@ static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev, \
86 struct device_attribute *attr, \ 87 struct device_attribute *attr, \
87 char *buf) \ 88 char *buf) \
88{ \ 89{ \
89 struct _feat_def *_feat = dev_get_drvdata(dev); \ 90 struct _feat_def *_feat = container_of(dev, struct _feat_def, \
91 sysfs_device); \
90 \ 92 \
91 if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \ 93 if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \
92 return sprintf(buf, "1\n"); \ 94 return sprintf(buf, "1\n"); \
@@ -97,7 +99,8 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \
97 struct device_attribute *attr,\ 99 struct device_attribute *attr,\
98 const char *buf, size_t count)\ 100 const char *buf, size_t count)\
99{ \ 101{ \
100 struct _feat_def *_feat = dev_get_drvdata(dev); \ 102 struct _feat_def *_feat = container_of(dev, struct _feat_def, \
103 sysfs_device); \
101 unsigned long val; \ 104 unsigned long val; \
102 int retval = 0; \ 105 int retval = 0; \
103 \ 106 \
@@ -274,7 +277,8 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
274 struct device_attribute *attr, 277 struct device_attribute *attr,
275 const char *buf, size_t count) 278 const char *buf, size_t count)
276{ 279{
277 struct zfcp_port *port = dev_get_drvdata(dev); 280 struct zfcp_port *port = container_of(dev, struct zfcp_port,
281 sysfs_device);
278 struct zfcp_unit *unit; 282 struct zfcp_unit *unit;
279 u64 fcp_lun; 283 u64 fcp_lun;
280 int retval = -EINVAL; 284 int retval = -EINVAL;
@@ -305,7 +309,8 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
305 struct device_attribute *attr, 309 struct device_attribute *attr,
306 const char *buf, size_t count) 310 const char *buf, size_t count)
307{ 311{
308 struct zfcp_port *port = dev_get_drvdata(dev); 312 struct zfcp_port *port = container_of(dev, struct zfcp_port,
313 sysfs_device);
309 struct zfcp_unit *unit; 314 struct zfcp_unit *unit;
310 u64 fcp_lun; 315 u64 fcp_lun;
311 int retval = 0; 316 int retval = 0;