提交 615f59e0 编写于 作者: C Christof Schmitt 提交者: James Bottomley

[SCSI] zfcp: Rename sysfs_device attribute to dev in zfcp_unit and zfcp_port

Kernel code uses dev as short name for the struct device. Rename the
sysfs_device in zfcp_unit and zfcp_port to match this convention.
Reviewed-by: NSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: NChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 5bdecd22
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Module interface and handling of zfcp data structures. * Module interface and handling of zfcp data structures.
* *
* Copyright IBM Corporation 2002, 2009 * Copyright IBM Corporation 2002, 2010
*/ */
/* /*
...@@ -81,7 +81,7 @@ static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun) ...@@ -81,7 +81,7 @@ static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
flush_work(&unit->scsi_work); flush_work(&unit->scsi_work);
out_unit: out_unit:
put_device(&port->sysfs_device); put_device(&port->dev);
out_port: out_port:
zfcp_ccw_adapter_put(adapter); zfcp_ccw_adapter_put(adapter);
out_ccw_device: out_ccw_device:
...@@ -226,7 +226,7 @@ struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *port, u64 fcp_lun) ...@@ -226,7 +226,7 @@ struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *port, u64 fcp_lun)
read_lock_irqsave(&port->unit_list_lock, flags); read_lock_irqsave(&port->unit_list_lock, flags);
list_for_each_entry(unit, &port->unit_list, list) list_for_each_entry(unit, &port->unit_list, list)
if (unit->fcp_lun == fcp_lun) { if (unit->fcp_lun == fcp_lun) {
if (!get_device(&unit->sysfs_device)) if (!get_device(&unit->dev))
unit = NULL; unit = NULL;
read_unlock_irqrestore(&port->unit_list_lock, flags); read_unlock_irqrestore(&port->unit_list_lock, flags);
return unit; return unit;
...@@ -251,7 +251,7 @@ struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *adapter, ...@@ -251,7 +251,7 @@ struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *adapter,
read_lock_irqsave(&adapter->port_list_lock, flags); read_lock_irqsave(&adapter->port_list_lock, flags);
list_for_each_entry(port, &adapter->port_list, list) list_for_each_entry(port, &adapter->port_list, list)
if (port->wwpn == wwpn) { if (port->wwpn == wwpn) {
if (!get_device(&port->sysfs_device)) if (!get_device(&port->dev))
port = NULL; port = NULL;
read_unlock_irqrestore(&adapter->port_list_lock, flags); read_unlock_irqrestore(&adapter->port_list_lock, flags);
return port; return port;
...@@ -269,10 +269,9 @@ struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *adapter, ...@@ -269,10 +269,9 @@ struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *adapter,
*/ */
static void zfcp_unit_release(struct device *dev) static void zfcp_unit_release(struct device *dev)
{ {
struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
sysfs_device);
put_device(&unit->port->sysfs_device); put_device(&unit->port->dev);
kfree(unit); kfree(unit);
} }
...@@ -289,11 +288,11 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun) ...@@ -289,11 +288,11 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
struct zfcp_unit *unit; struct zfcp_unit *unit;
int retval = -ENOMEM; int retval = -ENOMEM;
get_device(&port->sysfs_device); get_device(&port->dev);
unit = zfcp_get_unit_by_lun(port, fcp_lun); unit = zfcp_get_unit_by_lun(port, fcp_lun);
if (unit) { if (unit) {
put_device(&unit->sysfs_device); put_device(&unit->dev);
retval = -EEXIST; retval = -EEXIST;
goto err_out; goto err_out;
} }
...@@ -304,10 +303,10 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun) ...@@ -304,10 +303,10 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
unit->port = port; unit->port = port;
unit->fcp_lun = fcp_lun; unit->fcp_lun = fcp_lun;
unit->sysfs_device.parent = &port->sysfs_device; unit->dev.parent = &port->dev;
unit->sysfs_device.release = zfcp_unit_release; unit->dev.release = zfcp_unit_release;
if (dev_set_name(&unit->sysfs_device, "0x%016llx", if (dev_set_name(&unit->dev, "0x%016llx",
(unsigned long long) fcp_lun)) { (unsigned long long) fcp_lun)) {
kfree(unit); kfree(unit);
goto err_out; goto err_out;
...@@ -324,13 +323,12 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun) ...@@ -324,13 +323,12 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
unit->latencies.cmd.channel.min = 0xFFFFFFFF; unit->latencies.cmd.channel.min = 0xFFFFFFFF;
unit->latencies.cmd.fabric.min = 0xFFFFFFFF; unit->latencies.cmd.fabric.min = 0xFFFFFFFF;
if (device_register(&unit->sysfs_device)) { if (device_register(&unit->dev)) {
put_device(&unit->sysfs_device); put_device(&unit->dev);
goto err_out; goto err_out;
} }
if (sysfs_create_group(&unit->sysfs_device.kobj, if (sysfs_create_group(&unit->dev.kobj, &zfcp_sysfs_unit_attrs))
&zfcp_sysfs_unit_attrs))
goto err_out_put; goto err_out_put;
write_lock_irq(&port->unit_list_lock); write_lock_irq(&port->unit_list_lock);
...@@ -342,9 +340,9 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun) ...@@ -342,9 +340,9 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
return unit; return unit;
err_out_put: err_out_put:
device_unregister(&unit->sysfs_device); device_unregister(&unit->dev);
err_out: err_out:
put_device(&port->sysfs_device); put_device(&port->dev);
return ERR_PTR(retval); return ERR_PTR(retval);
} }
...@@ -610,8 +608,7 @@ void zfcp_device_unregister(struct device *dev, ...@@ -610,8 +608,7 @@ void zfcp_device_unregister(struct device *dev,
static void zfcp_port_release(struct device *dev) static void zfcp_port_release(struct device *dev)
{ {
struct zfcp_port *port = container_of(dev, struct zfcp_port, struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
sysfs_device);
zfcp_ccw_adapter_put(port->adapter); zfcp_ccw_adapter_put(port->adapter);
kfree(port); kfree(port);
...@@ -639,7 +636,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, ...@@ -639,7 +636,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
port = zfcp_get_port_by_wwpn(adapter, wwpn); port = zfcp_get_port_by_wwpn(adapter, wwpn);
if (port) { if (port) {
put_device(&port->sysfs_device); put_device(&port->dev);
retval = -EEXIST; retval = -EEXIST;
goto err_out; goto err_out;
} }
...@@ -659,22 +656,21 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, ...@@ -659,22 +656,21 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
port->d_id = d_id; port->d_id = d_id;
port->wwpn = wwpn; port->wwpn = wwpn;
port->rport_task = RPORT_NONE; port->rport_task = RPORT_NONE;
port->sysfs_device.parent = &adapter->ccw_device->dev; port->dev.parent = &adapter->ccw_device->dev;
port->sysfs_device.release = zfcp_port_release; port->dev.release = zfcp_port_release;
if (dev_set_name(&port->sysfs_device, "0x%016llx", if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) {
(unsigned long long)wwpn)) {
kfree(port); kfree(port);
goto err_out; goto err_out;
} }
retval = -EINVAL; retval = -EINVAL;
if (device_register(&port->sysfs_device)) { if (device_register(&port->dev)) {
put_device(&port->sysfs_device); put_device(&port->dev);
goto err_out; goto err_out;
} }
if (sysfs_create_group(&port->sysfs_device.kobj, if (sysfs_create_group(&port->dev.kobj,
&zfcp_sysfs_port_attrs)) &zfcp_sysfs_port_attrs))
goto err_out_put; goto err_out_put;
...@@ -687,7 +683,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, ...@@ -687,7 +683,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
return port; return port;
err_out_put: err_out_put:
device_unregister(&port->sysfs_device); device_unregister(&port->dev);
err_out: err_out:
zfcp_ccw_adapter_put(adapter); zfcp_ccw_adapter_put(adapter);
return ERR_PTR(retval); return ERR_PTR(retval);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Registration and callback for the s390 common I/O layer. * Registration and callback for the s390 common I/O layer.
* *
* Copyright IBM Corporation 2002, 2009 * Copyright IBM Corporation 2002, 2010
*/ */
#define KMSG_COMPONENT "zfcp" #define KMSG_COMPONENT "zfcp"
...@@ -123,12 +123,10 @@ static void zfcp_ccw_remove(struct ccw_device *cdev) ...@@ -123,12 +123,10 @@ static void zfcp_ccw_remove(struct ccw_device *cdev)
zfcp_ccw_adapter_put(adapter); /* put from zfcp_ccw_adapter_by_cdev */ zfcp_ccw_adapter_put(adapter); /* put from zfcp_ccw_adapter_by_cdev */
list_for_each_entry_safe(unit, u, &unit_remove_lh, list) list_for_each_entry_safe(unit, u, &unit_remove_lh, list)
zfcp_device_unregister(&unit->sysfs_device, zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
&zfcp_sysfs_unit_attrs);
list_for_each_entry_safe(port, p, &port_remove_lh, list) list_for_each_entry_safe(port, p, &port_remove_lh, list)
zfcp_device_unregister(&port->sysfs_device, zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
&zfcp_sysfs_port_attrs);
zfcp_adapter_unregister(adapter); zfcp_adapter_unregister(adapter);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Global definitions for the zfcp device driver. * Global definitions for the zfcp device driver.
* *
* Copyright IBM Corporation 2002, 2009 * Copyright IBM Corporation 2002, 2010
*/ */
#ifndef ZFCP_DEF_H #ifndef ZFCP_DEF_H
...@@ -237,7 +237,7 @@ struct zfcp_adapter { ...@@ -237,7 +237,7 @@ struct zfcp_adapter {
}; };
struct zfcp_port { struct zfcp_port {
struct device sysfs_device; /* sysfs device */ struct device dev;
struct fc_rport *rport; /* rport of fc transport class */ struct fc_rport *rport; /* rport of fc transport class */
struct list_head list; /* list of remote ports */ struct list_head list; /* list of remote ports */
struct zfcp_adapter *adapter; /* adapter used to access port */ struct zfcp_adapter *adapter; /* adapter used to access port */
...@@ -259,7 +259,7 @@ struct zfcp_port { ...@@ -259,7 +259,7 @@ struct zfcp_port {
}; };
struct zfcp_unit { struct zfcp_unit {
struct device sysfs_device; /* sysfs device */ struct device dev;
struct list_head list; /* list of logical units */ struct list_head list; /* list of logical units */
struct zfcp_port *port; /* remote port of unit */ struct zfcp_port *port; /* remote port of unit */
atomic_t status; /* status of this logical unit */ atomic_t status; /* status of this logical unit */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Error Recovery Procedures (ERP). * Error Recovery Procedures (ERP).
* *
* Copyright IBM Corporation 2002, 2009 * Copyright IBM Corporation 2002, 2010
*/ */
#define KMSG_COMPONENT "zfcp" #define KMSG_COMPONENT "zfcp"
...@@ -175,7 +175,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, ...@@ -175,7 +175,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need,
switch (need) { switch (need) {
case ZFCP_ERP_ACTION_REOPEN_UNIT: case ZFCP_ERP_ACTION_REOPEN_UNIT:
if (!get_device(&unit->sysfs_device)) if (!get_device(&unit->dev))
return NULL; return NULL;
atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status); atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status);
erp_action = &unit->erp_action; erp_action = &unit->erp_action;
...@@ -185,7 +185,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, ...@@ -185,7 +185,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need,
case ZFCP_ERP_ACTION_REOPEN_PORT: case ZFCP_ERP_ACTION_REOPEN_PORT:
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
if (!get_device(&port->sysfs_device)) if (!get_device(&port->dev))
return NULL; return NULL;
zfcp_erp_action_dismiss_port(port); zfcp_erp_action_dismiss_port(port);
atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status);
...@@ -1181,19 +1181,19 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result) ...@@ -1181,19 +1181,19 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
switch (act->action) { switch (act->action) {
case ZFCP_ERP_ACTION_REOPEN_UNIT: case ZFCP_ERP_ACTION_REOPEN_UNIT:
if ((result == ZFCP_ERP_SUCCEEDED) && !unit->device) { if ((result == ZFCP_ERP_SUCCEEDED) && !unit->device) {
get_device(&unit->sysfs_device); get_device(&unit->dev);
if (scsi_queue_work(unit->port->adapter->scsi_host, if (scsi_queue_work(unit->port->adapter->scsi_host,
&unit->scsi_work) <= 0) &unit->scsi_work) <= 0)
put_device(&unit->sysfs_device); put_device(&unit->dev);
} }
put_device(&unit->sysfs_device); put_device(&unit->dev);
break; break;
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
case ZFCP_ERP_ACTION_REOPEN_PORT: case ZFCP_ERP_ACTION_REOPEN_PORT:
if (result == ZFCP_ERP_SUCCEEDED) if (result == ZFCP_ERP_SUCCEEDED)
zfcp_scsi_schedule_rport_register(port); zfcp_scsi_schedule_rport_register(port);
put_device(&port->sysfs_device); put_device(&port->dev);
break; break;
case ZFCP_ERP_ACTION_REOPEN_ADAPTER: case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Fibre Channel related functions for the zfcp device driver. * Fibre Channel related functions for the zfcp device driver.
* *
* Copyright IBM Corporation 2008, 2009 * Copyright IBM Corporation 2008, 2010
*/ */
#define KMSG_COMPONENT "zfcp" #define KMSG_COMPONENT "zfcp"
...@@ -316,7 +316,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work) ...@@ -316,7 +316,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work)
zfcp_erp_port_reopen(port, 0, "fcgpn_3", NULL); zfcp_erp_port_reopen(port, 0, "fcgpn_3", NULL);
out: out:
put_device(&port->sysfs_device); put_device(&port->dev);
} }
/** /**
...@@ -325,9 +325,9 @@ void zfcp_fc_port_did_lookup(struct work_struct *work) ...@@ -325,9 +325,9 @@ void zfcp_fc_port_did_lookup(struct work_struct *work)
*/ */
void zfcp_fc_trigger_did_lookup(struct zfcp_port *port) void zfcp_fc_trigger_did_lookup(struct zfcp_port *port)
{ {
get_device(&port->sysfs_device); get_device(&port->dev);
if (!queue_work(port->adapter->work_queue, &port->gid_pn_work)) if (!queue_work(port->adapter->work_queue, &port->gid_pn_work))
put_device(&port->sysfs_device); put_device(&port->dev);
} }
/** /**
...@@ -389,7 +389,7 @@ static void zfcp_fc_adisc_handler(void *data) ...@@ -389,7 +389,7 @@ static void zfcp_fc_adisc_handler(void *data)
zfcp_scsi_schedule_rport_register(port); zfcp_scsi_schedule_rport_register(port);
out: out:
atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status); atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status);
put_device(&port->sysfs_device); put_device(&port->dev);
kmem_cache_free(zfcp_data.adisc_cache, adisc); kmem_cache_free(zfcp_data.adisc_cache, adisc);
} }
...@@ -436,7 +436,7 @@ void zfcp_fc_link_test_work(struct work_struct *work) ...@@ -436,7 +436,7 @@ void zfcp_fc_link_test_work(struct work_struct *work)
container_of(work, struct zfcp_port, test_link_work); container_of(work, struct zfcp_port, test_link_work);
int retval; int retval;
get_device(&port->sysfs_device); get_device(&port->dev);
port->rport_task = RPORT_DEL; port->rport_task = RPORT_DEL;
zfcp_scsi_rport_work(&port->rport_work); zfcp_scsi_rport_work(&port->rport_work);
...@@ -455,7 +455,7 @@ void zfcp_fc_link_test_work(struct work_struct *work) ...@@ -455,7 +455,7 @@ void zfcp_fc_link_test_work(struct work_struct *work)
zfcp_erp_port_forced_reopen(port, 0, "fcltwk1", NULL); zfcp_erp_port_forced_reopen(port, 0, "fcltwk1", NULL);
out: out:
put_device(&port->sysfs_device); put_device(&port->dev);
} }
/** /**
...@@ -468,9 +468,9 @@ void zfcp_fc_link_test_work(struct work_struct *work) ...@@ -468,9 +468,9 @@ void zfcp_fc_link_test_work(struct work_struct *work)
*/ */
void zfcp_fc_test_link(struct zfcp_port *port) void zfcp_fc_test_link(struct zfcp_port *port)
{ {
get_device(&port->sysfs_device); get_device(&port->dev);
if (!queue_work(port->adapter->work_queue, &port->test_link_work)) if (!queue_work(port->adapter->work_queue, &port->test_link_work))
put_device(&port->sysfs_device); put_device(&port->dev);
} }
static void zfcp_free_sg_env(struct zfcp_fc_gpn_ft *gpn_ft, int buf_num) static void zfcp_free_sg_env(struct zfcp_fc_gpn_ft *gpn_ft, int buf_num)
...@@ -617,8 +617,7 @@ static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft, ...@@ -617,8 +617,7 @@ static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft,
list_for_each_entry_safe(port, tmp, &remove_lh, list) { list_for_each_entry_safe(port, tmp, &remove_lh, list) {
zfcp_erp_port_shutdown(port, 0, "fcegpf2", NULL); zfcp_erp_port_shutdown(port, 0, "fcegpf2", NULL);
zfcp_device_unregister(&port->sysfs_device, zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
&zfcp_sysfs_port_attrs);
} }
return ret; return ret;
...@@ -732,7 +731,7 @@ static int zfcp_fc_exec_els_job(struct fc_bsg_job *job, ...@@ -732,7 +731,7 @@ static int zfcp_fc_exec_els_job(struct fc_bsg_job *job,
return -EINVAL; return -EINVAL;
d_id = port->d_id; d_id = port->d_id;
put_device(&port->sysfs_device); put_device(&port->dev);
} else } else
d_id = ntoh24(job->request->rqst_data.h_els.port_id); d_id = ntoh24(job->request->rqst_data.h_els.port_id);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Implementation of FSF commands. * Implementation of FSF commands.
* *
* Copyright IBM Corporation 2002, 2009 * Copyright IBM Corporation 2002, 2010
*/ */
#define KMSG_COMPONENT "zfcp" #define KMSG_COMPONENT "zfcp"
...@@ -1471,7 +1471,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) ...@@ -1471,7 +1471,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
} }
out: out:
put_device(&port->sysfs_device); put_device(&port->dev);
} }
/** /**
...@@ -1509,14 +1509,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) ...@@ -1509,14 +1509,14 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
req->data = port; req->data = port;
req->erp_action = erp_action; req->erp_action = erp_action;
erp_action->fsf_req_id = req->req_id; erp_action->fsf_req_id = req->req_id;
get_device(&port->sysfs_device); get_device(&port->dev);
zfcp_fsf_start_erp_timer(req); zfcp_fsf_start_erp_timer(req);
retval = zfcp_fsf_req_send(req); retval = zfcp_fsf_req_send(req);
if (retval) { if (retval) {
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
erp_action->fsf_req_id = 0; erp_action->fsf_req_id = 0;
put_device(&port->sysfs_device); put_device(&port->dev);
} }
out: out:
spin_unlock_bh(&qdio->req_q_lock); spin_unlock_bh(&qdio->req_q_lock);
...@@ -2261,7 +2261,7 @@ static void zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *req) ...@@ -2261,7 +2261,7 @@ static void zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *req)
else { else {
zfcp_fsf_send_fcp_command_task_handler(req); zfcp_fsf_send_fcp_command_task_handler(req);
req->unit = NULL; req->unit = NULL;
put_device(&unit->sysfs_device); put_device(&unit->dev);
} }
} }
...@@ -2299,7 +2299,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, ...@@ -2299,7 +2299,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
} }
req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
get_device(&unit->sysfs_device); get_device(&unit->dev);
req->unit = unit; req->unit = unit;
req->data = scsi_cmnd; req->data = scsi_cmnd;
req->handler = zfcp_fsf_send_fcp_command_handler; req->handler = zfcp_fsf_send_fcp_command_handler;
...@@ -2356,7 +2356,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, ...@@ -2356,7 +2356,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
goto out; goto out;
failed_scsi_cmnd: failed_scsi_cmnd:
put_device(&unit->sysfs_device); put_device(&unit->dev);
zfcp_fsf_req_free(req); zfcp_fsf_req_free(req);
scsi_cmnd->host_scribble = NULL; scsi_cmnd->host_scribble = NULL;
out: out:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Interface to Linux SCSI midlayer. * Interface to Linux SCSI midlayer.
* *
* Copyright IBM Corporation 2002, 2009 * Copyright IBM Corporation 2002, 2010
*/ */
#define KMSG_COMPONENT "zfcp" #define KMSG_COMPONENT "zfcp"
...@@ -44,7 +44,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt) ...@@ -44,7 +44,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
{ {
struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
unit->device = NULL; unit->device = NULL;
put_device(&unit->sysfs_device); put_device(&unit->dev);
} }
static int zfcp_scsi_slave_configure(struct scsi_device *sdp) static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
...@@ -511,7 +511,7 @@ static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport) ...@@ -511,7 +511,7 @@ static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport)
if (port) { if (port) {
zfcp_erp_port_reopen(port, 0, "sctrpi1", NULL); zfcp_erp_port_reopen(port, 0, "sctrpi1", NULL);
put_device(&port->sysfs_device); put_device(&port->dev);
} }
} }
...@@ -553,23 +553,23 @@ static void zfcp_scsi_rport_block(struct zfcp_port *port) ...@@ -553,23 +553,23 @@ static void zfcp_scsi_rport_block(struct zfcp_port *port)
void zfcp_scsi_schedule_rport_register(struct zfcp_port *port) void zfcp_scsi_schedule_rport_register(struct zfcp_port *port)
{ {
get_device(&port->sysfs_device); get_device(&port->dev);
port->rport_task = RPORT_ADD; port->rport_task = RPORT_ADD;
if (!queue_work(port->adapter->work_queue, &port->rport_work)) if (!queue_work(port->adapter->work_queue, &port->rport_work))
put_device(&port->sysfs_device); put_device(&port->dev);
} }
void zfcp_scsi_schedule_rport_block(struct zfcp_port *port) void zfcp_scsi_schedule_rport_block(struct zfcp_port *port)
{ {
get_device(&port->sysfs_device); get_device(&port->dev);
port->rport_task = RPORT_DEL; port->rport_task = RPORT_DEL;
if (port->rport && queue_work(port->adapter->work_queue, if (port->rport && queue_work(port->adapter->work_queue,
&port->rport_work)) &port->rport_work))
return; return;
put_device(&port->sysfs_device); put_device(&port->dev);
} }
void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *adapter) void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *adapter)
...@@ -598,7 +598,7 @@ void zfcp_scsi_rport_work(struct work_struct *work) ...@@ -598,7 +598,7 @@ void zfcp_scsi_rport_work(struct work_struct *work)
} }
} }
put_device(&port->sysfs_device); put_device(&port->dev);
} }
...@@ -616,7 +616,7 @@ void zfcp_scsi_scan(struct work_struct *work) ...@@ -616,7 +616,7 @@ void zfcp_scsi_scan(struct work_struct *work)
scsilun_to_int((struct scsi_lun *) scsilun_to_int((struct scsi_lun *)
&unit->fcp_lun), 0); &unit->fcp_lun), 0);
put_device(&unit->sysfs_device); put_device(&unit->dev);
} }
struct fc_function_template zfcp_transport_functions = { struct fc_function_template zfcp_transport_functions = {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* sysfs attributes. * sysfs attributes.
* *
* Copyright IBM Corporation 2008, 2009 * Copyright IBM Corporation 2008, 2010
*/ */
#define KMSG_COMPONENT "zfcp" #define KMSG_COMPONENT "zfcp"
...@@ -19,8 +19,7 @@ static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev, \ ...@@ -19,8 +19,7 @@ static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev, \
struct device_attribute *at,\ struct device_attribute *at,\
char *buf) \ char *buf) \
{ \ { \
struct _feat_def *_feat = container_of(dev, struct _feat_def, \ struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \
sysfs_device); \
\ \
return sprintf(buf, _format, _value); \ return sprintf(buf, _format, _value); \
} \ } \
...@@ -87,8 +86,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev, \ ...@@ -87,8 +86,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_show(struct device *dev, \
struct device_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
struct _feat_def *_feat = container_of(dev, struct _feat_def, \ struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \
sysfs_device); \
\ \
if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \ if (atomic_read(&_feat->status) & ZFCP_STATUS_COMMON_ERP_FAILED) \
return sprintf(buf, "1\n"); \ return sprintf(buf, "1\n"); \
...@@ -99,12 +97,11 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \ ...@@ -99,12 +97,11 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \
struct device_attribute *attr,\ struct device_attribute *attr,\
const char *buf, size_t count)\ const char *buf, size_t count)\
{ \ { \
struct _feat_def *_feat = container_of(dev, struct _feat_def, \ struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \
sysfs_device); \
unsigned long val; \ unsigned long val; \
int retval = 0; \ int retval = 0; \
\ \
if (!(_feat && get_device(&_feat->sysfs_device))) \ if (!(_feat && get_device(&_feat->dev))) \
return -EBUSY; \ return -EBUSY; \
\ \
if (strict_strtoul(buf, 0, &val) || val != 0) { \ if (strict_strtoul(buf, 0, &val) || val != 0) { \
...@@ -118,7 +115,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \ ...@@ -118,7 +115,7 @@ static ssize_t zfcp_sysfs_##_feat##_failed_store(struct device *dev, \
_reopen_id, NULL); \ _reopen_id, NULL); \
zfcp_erp_wait(_adapter); \ zfcp_erp_wait(_adapter); \
out: \ out: \
put_device(&_feat->sysfs_device); \ put_device(&_feat->dev); \
return retval ? retval : (ssize_t) count; \ return retval ? retval : (ssize_t) count; \
} \ } \
static ZFCP_DEV_ATTR(_feat, failed, S_IWUSR | S_IRUGO, \ 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,10 +221,10 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
list_del(&port->list); list_del(&port->list);
write_unlock_irq(&adapter->port_list_lock); write_unlock_irq(&adapter->port_list_lock);
put_device(&port->sysfs_device); put_device(&port->dev);
zfcp_erp_port_shutdown(port, 0, "syprs_1", NULL); zfcp_erp_port_shutdown(port, 0, "syprs_1", NULL);
zfcp_device_unregister(&port->sysfs_device, &zfcp_sysfs_port_attrs); zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
out: out:
zfcp_ccw_adapter_put(adapter); zfcp_ccw_adapter_put(adapter);
return retval ? retval : (ssize_t) count; return retval ? retval : (ssize_t) count;
...@@ -258,13 +255,12 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev, ...@@ -258,13 +255,12 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct zfcp_port *port = container_of(dev, struct zfcp_port, struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
sysfs_device);
struct zfcp_unit *unit; struct zfcp_unit *unit;
u64 fcp_lun; u64 fcp_lun;
int retval = -EINVAL; int retval = -EINVAL;
if (!(port && get_device(&port->sysfs_device))) if (!(port && get_device(&port->dev)))
return -EBUSY; return -EBUSY;
if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) 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,7 +276,7 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
zfcp_erp_wait(unit->port->adapter); zfcp_erp_wait(unit->port->adapter);
flush_work(&unit->scsi_work); flush_work(&unit->scsi_work);
out: out:
put_device(&port->sysfs_device); put_device(&port->dev);
return retval ? retval : (ssize_t) count; return retval ? retval : (ssize_t) count;
} }
static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store); 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,13 +285,12 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct zfcp_port *port = container_of(dev, struct zfcp_port, struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
sysfs_device);
struct zfcp_unit *unit; struct zfcp_unit *unit;
u64 fcp_lun; u64 fcp_lun;
int retval = -EINVAL; int retval = -EINVAL;
if (!(port && get_device(&port->sysfs_device))) if (!(port && get_device(&port->dev)))
return -EBUSY; return -EBUSY;
if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) 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,12 +309,12 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
list_del(&unit->list); list_del(&unit->list);
write_unlock_irq(&port->unit_list_lock); write_unlock_irq(&port->unit_list_lock);
put_device(&unit->sysfs_device); put_device(&unit->dev);
zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL); zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL);
zfcp_device_unregister(&unit->sysfs_device, &zfcp_sysfs_unit_attrs); zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
out: out:
put_device(&port->sysfs_device); put_device(&port->dev);
return retval ? retval : (ssize_t) count; return retval ? retval : (ssize_t) count;
} }
static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store); static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册