diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_sysfs.c')
| -rw-r--r-- | drivers/s390/scsi/zfcp_sysfs.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c index f539e006683c..a43035d4bd70 100644 --- a/drivers/s390/scsi/zfcp_sysfs.c +++ b/drivers/s390/scsi/zfcp_sysfs.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * sysfs attributes. | 4 | * sysfs attributes. |
| 5 | * | 5 | * |
| 6 | * Copyright IBM Corporation 2008, 2009 | 6 | * Copyright IBM Corporation 2008, 2010 |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #define KMSG_COMPONENT "zfcp" | 9 | #define KMSG_COMPONENT "zfcp" |
| @@ -19,8 +19,7 @@ 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 = container_of(dev, struct _feat_def, \ | 22 | struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \ |
| 23 | sysfs_device); \ | ||
| 24 | \ | 23 | \ |
| 25 | return sprintf(buf, _format, _value); \ | 24 | return sprintf(buf, _format, _value); \ |
| 26 | } \ | 25 | } \ |
| @@ -87,8 +86,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev, \ | |||
| 87 | struct device_attribute *attr, \ | 86 | struct device_attribute *attr, \ |
| 88 | char *buf) \ | 87 | char *buf) \ |
| 89 | { \ | 88 | { \ |
| 90 | struct _feat_def *_feat = container_of(dev, struct _feat_def, \ | 89 | struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \ |
| 91 | sysfs_device); \ | ||
| 92 | \ | 90 | \ |
| 93 | if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \ | 91 | if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \ |
| 94 | return sprintf(buf, "1\n"); \ | 92 | return sprintf(buf, "1\n"); \ |
| @@ -99,12 +97,11 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \ | |||
| 99 | struct device_attribute *attr,\ | 97 | struct device_attribute *attr,\ |
| 100 | const char *buf, size_t count)\ | 98 | const char *buf, size_t count)\ |
| 101 | { \ | 99 | { \ |
| 102 | struct _feat_def *_feat = container_of(dev, struct _feat_def, \ | 100 | struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \ |
| 103 | sysfs_device); \ | ||
| 104 | unsigned long val; \ | 101 | unsigned long val; \ |
| 105 | int retval = 0; \ | 102 | int retval = 0; \ |
| 106 | \ | 103 | \ |
| 107 | if (!(_feat && get_device(&_feat->sysfs_device))) \ | 104 | if (!(_feat && get_device(&_feat->dev))) \ |
| 108 | return -EBUSY; \ | 105 | return -EBUSY; \ |
| 109 | \ | 106 | \ |
| 110 | if (strict_strtoul(buf, 0, &val) || val != 0) { \ | 107 | if (strict_strtoul(buf, 0, &val) || val != 0) { \ |
| @@ -118,7 +115,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \ | |||
| 118 | _reopen_id, NULL); \ | 115 | _reopen_id, NULL); \ |
| 119 | zfcp_erp_wait(_adapter); \ | 116 | zfcp_erp_wait(_adapter); \ |
| 120 | out: \ | 117 | out: \ |
| 121 | put_device(&_feat->sysfs_device); \ | 118 | put_device(&_feat->dev); \ |
| 122 | return retval ? retval : (ssize_t) count; \ | 119 | return retval ? retval : (ssize_t) count; \ |
| 123 | } \ | 120 | } \ |
| 124 | static ZFCP_DEV_ATTR(_feat, failed, S_IWUSR | S_IRUGO, \ | 121 | static ZFCP_DEV_ATTR(_feat, failed, S_IWUSR | S_IRUGO, \ |
| @@ -224,10 +221,10 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev, | |||
| 224 | list_del(&port->list); | 221 | list_del(&port->list); |
| 225 | write_unlock_irq(&adapter->port_list_lock); | 222 | write_unlock_irq(&adapter->port_list_lock); |
| 226 | 223 | ||
| 227 | put_device(&port->sysfs_device); | 224 | put_device(&port->dev); |
| 228 | 225 | ||
| 229 | zfcp_erp_port_shutdown(port, 0, "syprs_1", NULL); | 226 | zfcp_erp_port_shutdown(port, 0, "syprs_1", NULL); |
| 230 | zfcp_device_unregister(&port->sysfs_device, &zfcp_sysfs_port_attrs); | 227 | zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs); |
| 231 | out: | 228 | out: |
| 232 | zfcp_ccw_adapter_put(adapter); | 229 | zfcp_ccw_adapter_put(adapter); |
| 233 | return retval ? retval : (ssize_t) count; | 230 | return retval ? retval : (ssize_t) count; |
| @@ -258,13 +255,12 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev, | |||
| 258 | struct device_attribute *attr, | 255 | struct device_attribute *attr, |
| 259 | const char *buf, size_t count) | 256 | const char *buf, size_t count) |
| 260 | { | 257 | { |
| 261 | struct zfcp_port *port = container_of(dev, struct zfcp_port, | 258 | struct zfcp_port *port = container_of(dev, struct zfcp_port, dev); |
| 262 | sysfs_device); | ||
| 263 | struct zfcp_unit *unit; | 259 | struct zfcp_unit *unit; |
| 264 | u64 fcp_lun; | 260 | u64 fcp_lun; |
| 265 | int retval = -EINVAL; | 261 | int retval = -EINVAL; |
| 266 | 262 | ||
| 267 | if (!(port && get_device(&port->sysfs_device))) | 263 | if (!(port && get_device(&port->dev))) |
| 268 | return -EBUSY; | 264 | return -EBUSY; |
| 269 | 265 | ||
| 270 | if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) | 266 | if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) |
| @@ -280,7 +276,7 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev, | |||
| 280 | zfcp_erp_wait(unit->port->adapter); | 276 | zfcp_erp_wait(unit->port->adapter); |
| 281 | flush_work(&unit->scsi_work); | 277 | flush_work(&unit->scsi_work); |
| 282 | out: | 278 | out: |
| 283 | put_device(&port->sysfs_device); | 279 | put_device(&port->dev); |
| 284 | return retval ? retval : (ssize_t) count; | 280 | return retval ? retval : (ssize_t) count; |
| 285 | } | 281 | } |
| 286 | static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store); | 282 | static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store); |
| @@ -289,13 +285,12 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev, | |||
| 289 | struct device_attribute *attr, | 285 | struct device_attribute *attr, |
| 290 | const char *buf, size_t count) | 286 | const char *buf, size_t count) |
| 291 | { | 287 | { |
| 292 | struct zfcp_port *port = container_of(dev, struct zfcp_port, | 288 | struct zfcp_port *port = container_of(dev, struct zfcp_port, dev); |
| 293 | sysfs_device); | ||
| 294 | struct zfcp_unit *unit; | 289 | struct zfcp_unit *unit; |
| 295 | u64 fcp_lun; | 290 | u64 fcp_lun; |
| 296 | int retval = -EINVAL; | 291 | int retval = -EINVAL; |
| 297 | 292 | ||
| 298 | if (!(port && get_device(&port->sysfs_device))) | 293 | if (!(port && get_device(&port->dev))) |
| 299 | return -EBUSY; | 294 | return -EBUSY; |
| 300 | 295 | ||
| 301 | if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) | 296 | if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) |
| @@ -314,12 +309,12 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev, | |||
| 314 | list_del(&unit->list); | 309 | list_del(&unit->list); |
| 315 | write_unlock_irq(&port->unit_list_lock); | 310 | write_unlock_irq(&port->unit_list_lock); |
| 316 | 311 | ||
| 317 | put_device(&unit->sysfs_device); | 312 | put_device(&unit->dev); |
| 318 | 313 | ||
| 319 | zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL); | 314 | zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL); |
| 320 | zfcp_device_unregister(&unit->sysfs_device, &zfcp_sysfs_unit_attrs); | 315 | zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs); |
| 321 | out: | 316 | out: |
| 322 | put_device(&port->sysfs_device); | 317 | put_device(&port->dev); |
| 323 | return retval ? retval : (ssize_t) count; | 318 | return retval ? retval : (ssize_t) count; |
| 324 | } | 319 | } |
| 325 | static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store); | 320 | static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store); |
