/** * zfcp_sysfs_unit_failed_store - failed state of unit * @dev: pointer to belonging device * @buf: pointer to input buffer * @count: number of bytes in buffer * * Store function of the "failed" attribute of a unit. * If a "0" gets written to "failed", error recovery will be * started for the belonging unit. */ static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct zfcp_unit *unit; unsigned int val; char *endp; int retval = 0; down(&zfcp_data.config_sema); unit = dev_get_drvdata(dev); if (atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status)) { retval = -EBUSY; goto out; } val = simple_strtoul(buf, &endp, 0); if (((endp + 1) < (buf + count)) || (val != 0)) { retval = -EINVAL; goto out; } zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); zfcp_erp_wait(unit->port->adapter); out: up(&zfcp_data.config_sema); return retval ? retval : (ssize_t) count; }
/** * zfcp_sysfs_unit_failed_store - failed state of unit * @dev: pointer to belonging device * @buf: pointer to input buffer * @count: number of bytes in buffer * * Store function of the "failed" attribute of a unit. * If a "0" gets written to "failed", error recovery will be * started for the belonging unit. */ static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev, const char *buf, size_t count) { struct zfcp_unit *unit; unsigned int val; char *endp; int retval = 0; down(&zfcp_data.config_sema); unit = dev_get_drvdata(dev); if (atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status)) { retval = -EBUSY; goto out; } val = simple_strtoul(buf, &endp, 0); if (((endp + 1) < (buf + count)) || (val != 0)) { retval = -EINVAL; goto out; } /* restart error recovery only if adapter is online */ if (unit->port->adapter->ccw_device->online != 1) { retval = -ENXIO; goto out; } zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); out: up(&zfcp_data.config_sema); return retval ? retval : count; }
static void zfcp_erp_unit_block(struct zfcp_unit *unit, int clear_mask) { zfcp_erp_modify_unit_status(unit, "erublk1", NULL, ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask, ZFCP_CLEAR); }