Commit 317e6b65 authored by Swen Schillig's avatar Swen Schillig Committed by James Bottomley

[SCSI] zfcp: Cleanup of code in zfcp_aux.c

Overall cleanup of zfcp_aux.c to simplify code and follow kernel
coding style.
Signed-off-by: default avatarSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent f76af7d7
This diff is collapsed.
...@@ -20,12 +20,10 @@ ...@@ -20,12 +20,10 @@
*/ */
static int zfcp_ccw_probe(struct ccw_device *ccw_device) static int zfcp_ccw_probe(struct ccw_device *ccw_device)
{ {
struct zfcp_adapter *adapter;
int retval = 0; int retval = 0;
down(&zfcp_data.config_sema); down(&zfcp_data.config_sema);
adapter = zfcp_adapter_enqueue(ccw_device); if (zfcp_adapter_enqueue(ccw_device)) {
if (!adapter) {
dev_err(&ccw_device->dev, dev_err(&ccw_device->dev,
"Setup of data structures failed.\n"); "Setup of data structures failed.\n");
retval = -EINVAL; retval = -EINVAL;
......
...@@ -730,13 +730,6 @@ struct zfcp_data { ...@@ -730,13 +730,6 @@ struct zfcp_data {
struct kmem_cache *gid_pn_cache; struct kmem_cache *gid_pn_cache;
}; };
/* number of elements for various memory pools */
#define ZFCP_POOL_FSF_REQ_ERP_NR 1
#define ZFCP_POOL_FSF_REQ_SCSI_NR 1
#define ZFCP_POOL_FSF_REQ_ABORT_NR 1
#define ZFCP_POOL_STATUS_READ_NR FSF_STATUS_READS_RECOM
#define ZFCP_POOL_DATA_GID_PN_NR 1
/* struct used by memory pools for fsf_requests */ /* struct used by memory pools for fsf_requests */
struct zfcp_fsf_req_qtcb { struct zfcp_fsf_req_qtcb {
struct zfcp_fsf_req fsf_req; struct zfcp_fsf_req fsf_req;
...@@ -757,12 +750,6 @@ struct zfcp_fsf_req_qtcb { ...@@ -757,12 +750,6 @@ struct zfcp_fsf_req_qtcb {
((atomic_read(target) & mask) == mask) ((atomic_read(target) & mask) == mask)
#endif #endif
extern void _zfcp_hex_dump(char *, int);
#define ZFCP_HEX_DUMP(level, addr, count) \
if (ZFCP_LOG_CHECK(level)) { \
_zfcp_hex_dump(addr, count); \
}
#define zfcp_get_busid_by_adapter(adapter) (adapter->ccw_device->dev.bus_id) #define zfcp_get_busid_by_adapter(adapter) (adapter->ccw_device->dev.bus_id)
#define zfcp_get_busid_by_port(port) (zfcp_get_busid_by_adapter(port->adapter)) #define zfcp_get_busid_by_port(port) (zfcp_get_busid_by_adapter(port->adapter))
#define zfcp_get_busid_by_unit(unit) (zfcp_get_busid_by_port(unit->port)) #define zfcp_get_busid_by_unit(unit) (zfcp_get_busid_by_port(unit->port))
......
...@@ -1675,7 +1675,7 @@ static void zfcp_erp_open_ptp_port(struct zfcp_adapter *adapter) ...@@ -1675,7 +1675,7 @@ static void zfcp_erp_open_ptp_port(struct zfcp_adapter *adapter)
struct zfcp_port *port; struct zfcp_port *port;
port = zfcp_port_enqueue(adapter, adapter->peer_wwpn, 0, port = zfcp_port_enqueue(adapter, adapter->peer_wwpn, 0,
adapter->peer_d_id); adapter->peer_d_id);
if (!port) /* error or port already attached */ if (IS_ERR(port)) /* error or port already attached */
return; return;
zfcp_erp_port_reopen_internal(port, 0, 150, NULL); zfcp_erp_port_reopen_internal(port, 0, 150, NULL);
} }
......
...@@ -26,9 +26,7 @@ extern void zfcp_sysfs_unit_release(struct device *); ...@@ -26,9 +26,7 @@ extern void zfcp_sysfs_unit_release(struct device *);
/**************************** CONFIGURATION *********************************/ /**************************** CONFIGURATION *********************************/
extern struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *, fcp_lun_t); extern struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *, fcp_lun_t);
extern struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *, wwn_t); extern struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *, wwn_t);
extern struct zfcp_port *zfcp_get_port_by_did(struct zfcp_adapter *, u32); extern int zfcp_adapter_enqueue(struct ccw_device *);
struct zfcp_adapter *zfcp_get_adapter_by_busid(char *);
extern struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *);
extern int zfcp_adapter_debug_register(struct zfcp_adapter *); extern int zfcp_adapter_debug_register(struct zfcp_adapter *);
extern void zfcp_adapter_dequeue(struct zfcp_adapter *); extern void zfcp_adapter_dequeue(struct zfcp_adapter *);
extern void zfcp_adapter_debug_unregister(struct zfcp_adapter *); extern void zfcp_adapter_debug_unregister(struct zfcp_adapter *);
......
...@@ -39,6 +39,18 @@ struct zfcp_gpn_ft { ...@@ -39,6 +39,18 @@ struct zfcp_gpn_ft {
struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS]; struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS];
}; };
static struct zfcp_port *zfcp_get_port_by_did(struct zfcp_adapter *adapter,
u32 d_id)
{
struct zfcp_port *port;
list_for_each_entry(port, &adapter->port_list_head, list)
if ((port->d_id == d_id) &&
!atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status))
return port;
return NULL;
}
static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
struct fcp_rscn_element *elem) struct fcp_rscn_element *elem)
{ {
...@@ -496,10 +508,10 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) ...@@ -496,10 +508,10 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft)
port = zfcp_port_enqueue(adapter, acc->wwpn, port = zfcp_port_enqueue(adapter, acc->wwpn,
ZFCP_STATUS_PORT_DID_DID | ZFCP_STATUS_PORT_DID_DID |
ZFCP_STATUS_COMMON_NOESC, d_id); ZFCP_STATUS_COMMON_NOESC, d_id);
if (port) if (IS_ERR(port))
zfcp_erp_port_reopen(port, 0, 149, NULL); ret = PTR_ERR(port);
else else
ret = -ENOMEM; zfcp_erp_port_reopen(port, 0, 149, NULL);
if (acc->control & 0x80) /* last entry */ if (acc->control & 0x80) /* last entry */
break; break;
} }
......
...@@ -74,7 +74,7 @@ zfcp_sysfs_unit_add_store(struct device *dev, struct device_attribute *attr, con ...@@ -74,7 +74,7 @@ zfcp_sysfs_unit_add_store(struct device *dev, struct device_attribute *attr, con
goto out; goto out;
unit = zfcp_unit_enqueue(port, fcp_lun); unit = zfcp_unit_enqueue(port, fcp_lun);
if (!unit) if (IS_ERR(unit))
goto out; goto out;
retval = 0; retval = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment