summaryrefslogtreecommitdiff
path: root/drivers/s390/scsi/zfcp_sysfs.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-11-24 18:54:02 +0300
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 21:02:04 +0300
commit25458eb791acf0e5e65183c5adb3918d8d71d756 (patch)
treee634ee6be885b096c8a8840f6b6a1184d1fb341d /drivers/s390/scsi/zfcp_sysfs.c
parentb42aeceb35c59484056b0eea81203a0911ebb50d (diff)
downloadlinux-25458eb791acf0e5e65183c5adb3918d8d71d756.tar.xz
[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>
Diffstat (limited to 'drivers/s390/scsi/zfcp_sysfs.c')
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c15
1 files changed, 10 insertions, 5 deletions
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, \
struct device_attribute *at,\
char *buf) \
{ \
- struct _feat_def *_feat = dev_get_drvdata(dev); \
+ struct _feat_def *_feat = container_of(dev, struct _feat_def, \
+ sysfs_device); \
\
return sprintf(buf, _format, _value); \
} \
@@ -86,7 +87,8 @@ static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
- struct _feat_def *_feat = dev_get_drvdata(dev); \
+ struct _feat_def *_feat = container_of(dev, struct _feat_def, \
+ sysfs_device); \
\
if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \
return sprintf(buf, "1\n"); \
@@ -97,7 +99,8 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \
struct device_attribute *attr,\
const char *buf, size_t count)\
{ \
- struct _feat_def *_feat = dev_get_drvdata(dev); \
+ struct _feat_def *_feat = container_of(dev, struct _feat_def, \
+ sysfs_device); \
unsigned long val; \
int retval = 0; \
\
@@ -274,7 +277,8 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct zfcp_port *port = dev_get_drvdata(dev);
+ struct zfcp_port *port = container_of(dev, struct zfcp_port,
+ sysfs_device);
struct zfcp_unit *unit;
u64 fcp_lun;
int retval = -EINVAL;
@@ -305,7 +309,8 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct zfcp_port *port = dev_get_drvdata(dev);
+ struct zfcp_port *port = container_of(dev, struct zfcp_port,
+ sysfs_device);
struct zfcp_unit *unit;
u64 fcp_lun;
int retval = 0;