Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44cc76f2 authored by Swen Schillig's avatar Swen Schillig Committed by James Bottomley
Browse files

[SCSI] zfcp: remove unused references, declarations and flags



 - Remove unused references and declarations, including one instance
   of the FC ls_adisc struct that has been defined twice.
 - Also remove the flags COMMON_OPENING, COMMON_CLOSING,
   ADAPTER_REGISTERED and XPORT_OK that are only set and cleared, but
   not checked anywhere.
 - Remove the zfcp specific atomic_test_mask makro. Simply use
   atomic_read directly instead.
 - Remove the zfcp internal sg helper functions and switch the places
   where it is still used to call sg_virt directly.
 - With the update of the QDIO code, the QDIO data structures no
   longer use the volatile type qualifier. Now we can also remove the
   volatile qualifiers from the zfcp code.

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 ff3b24fa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun)
 */
void zfcp_unit_dequeue(struct zfcp_unit *unit)
{
	zfcp_unit_wait(unit);
	wait_event(unit->remove_wq, atomic_read(&unit->refcount) == 0);
	write_lock_irq(&zfcp_data.config_lock);
	list_del(&unit->list);
	write_unlock_irq(&zfcp_data.config_lock);
@@ -740,7 +740,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn,
 */
void zfcp_port_dequeue(struct zfcp_port *port)
{
	zfcp_port_wait(port);
	wait_event(port->remove_wq, atomic_read(&port->refcount) == 0);
	write_lock_irq(&zfcp_data.config_lock);
	list_del(&port->list);
	port->adapter->ports--;
+3 −3
Original line number Diff line number Diff line
@@ -67,14 +67,14 @@ static void zfcp_ccw_remove(struct ccw_device *ccw_device)

	list_for_each_entry_safe(port, p, &adapter->port_remove_lh, list) {
		list_for_each_entry_safe(unit, u, &port->unit_remove_lh, list) {
			if (atomic_test_mask(ZFCP_STATUS_UNIT_REGISTERED,
				&unit->status))
			if (atomic_read(&unit->status) &
			    ZFCP_STATUS_UNIT_REGISTERED)
				scsi_remove_device(unit->device);
			zfcp_unit_dequeue(unit);
		}
		zfcp_port_dequeue(port);
	}
	zfcp_adapter_wait(adapter);
	wait_event(adapter->remove_wq, atomic_read(&adapter->refcount) == 0);
	zfcp_adapter_dequeue(adapter);

	up(&zfcp_data.config_sema);
+5 −6
Original line number Diff line number Diff line
@@ -831,7 +831,7 @@ void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req)
	struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
	struct zfcp_port *port = ct->port;
	struct zfcp_adapter *adapter = port->adapter;
	struct ct_hdr *hdr = zfcp_sg_to_address(ct->req);
	struct ct_hdr *hdr = sg_virt(ct->req);
	struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
	struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req;
	unsigned long flags;
@@ -865,7 +865,7 @@ void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
	struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
	struct zfcp_port *port = ct->port;
	struct zfcp_adapter *adapter = port->adapter;
	struct ct_hdr *hdr = zfcp_sg_to_address(ct->resp);
	struct ct_hdr *hdr = sg_virt(ct->resp);
	struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
	struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp;
	unsigned long flags;
@@ -922,8 +922,8 @@ void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *fsf_req)

	zfcp_san_dbf_event_els("oels", 2, fsf_req,
			       fc_host_port_id(els->adapter->scsi_host),
			       els->d_id, *(u8 *) zfcp_sg_to_address(els->req),
			       zfcp_sg_to_address(els->req), els->req->length);
			       els->d_id, *(u8 *) sg_virt(els->req),
			       sg_virt(els->req), els->req->length);
}

/**
@@ -936,8 +936,7 @@ void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *fsf_req)

	zfcp_san_dbf_event_els("rels", 2, fsf_req, els->d_id,
			       fc_host_port_id(els->adapter->scsi_host),
			       *(u8 *)zfcp_sg_to_address(els->req),
			       zfcp_sg_to_address(els->resp),
			       *(u8 *)sg_virt(els->req), sg_virt(els->resp),
			       els->resp->length);
}

+2 −79
Original line number Diff line number Diff line
@@ -39,29 +39,6 @@

/********************* GENERAL DEFINES *********************************/

/**
 * zfcp_sg_to_address - determine kernel address from struct scatterlist
 * @list: struct scatterlist
 * Return: kernel address
 */
static inline void *
zfcp_sg_to_address(struct scatterlist *list)
{
	return sg_virt(list);
}

/**
 * zfcp_address_to_sg - set up struct scatterlist from kernel address
 * @address: kernel address
 * @list: struct scatterlist
 * @size: buffer size
 */
static inline void
zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)
{
	sg_set_buf(list, address, size);
}

#define REQUEST_LIST_SIZE 128

/********************* SCSI SPECIFIC DEFINES *********************************/
@@ -218,13 +195,6 @@ struct fcp_logo {
#define ZFCP_LS_RSCN			0x61
#define ZFCP_LS_RNID			0x78

struct zfcp_ls_rjt_par {
	u8 action;
 	u8 reason_code;
 	u8 reason_expl;
 	u8 vendor_unique;
} __attribute__ ((packed));

struct zfcp_ls_adisc {
	u8		code;
	u8		field[3];
@@ -234,20 +204,6 @@ struct zfcp_ls_adisc {
	u32		nport_id;
} __attribute__ ((packed));

struct zfcp_ls_adisc_acc {
	u8		code;
	u8		field[3];
	u32		hard_nport_id;
	u64		wwpn;
	u64		wwnn;
	u32		nport_id;
} __attribute__ ((packed));

struct zfcp_rc_entry {
	u8 code;
	const char *description;
};

/*
 * FC-GS-2 stuff
 */
@@ -281,9 +237,7 @@ struct zfcp_rc_entry {
#define ZFCP_STATUS_COMMON_RUNNING		0x40000000
#define ZFCP_STATUS_COMMON_ERP_FAILED		0x20000000
#define ZFCP_STATUS_COMMON_UNBLOCKED		0x10000000
#define ZFCP_STATUS_COMMON_OPENING              0x08000000
#define ZFCP_STATUS_COMMON_OPEN                 0x04000000
#define ZFCP_STATUS_COMMON_CLOSING              0x02000000
#define ZFCP_STATUS_COMMON_ERP_INUSE		0x01000000
#define ZFCP_STATUS_COMMON_ACCESS_DENIED	0x00800000
#define ZFCP_STATUS_COMMON_ACCESS_BOXED		0x00400000
@@ -291,14 +245,12 @@ struct zfcp_rc_entry {

/* adapter status */
#define ZFCP_STATUS_ADAPTER_QDIOUP		0x00000002
#define ZFCP_STATUS_ADAPTER_REGISTERED		0x00000004
#define ZFCP_STATUS_ADAPTER_XCONFIG_OK		0x00000008
#define ZFCP_STATUS_ADAPTER_HOST_CON_INIT	0x00000010
#define ZFCP_STATUS_ADAPTER_ERP_THREAD_UP	0x00000020
#define ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL	0x00000080
#define ZFCP_STATUS_ADAPTER_ERP_PENDING		0x00000100
#define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED	0x00000200
#define ZFCP_STATUS_ADAPTER_XPORT_OK		0x00000800

/* FC-PH/FC-GS well-known address identifiers for generic services */
#define ZFCP_DID_MANAGEMENT_SERVICE		0xFFFFFA
@@ -321,20 +273,16 @@ struct zfcp_rc_entry {
		 ZFCP_STATUS_PORT_NO_SCSI_ID)

/* logical unit status */
#define ZFCP_STATUS_UNIT_TEMPORARY		0x00000002
#define ZFCP_STATUS_UNIT_SHARED			0x00000004
#define ZFCP_STATUS_UNIT_READONLY		0x00000008
#define ZFCP_STATUS_UNIT_REGISTERED		0x00000010
#define ZFCP_STATUS_UNIT_SCSI_WORK_PENDING	0x00000020

/* FSF request status (this does not have a common part) */
#define ZFCP_STATUS_FSFREQ_NOT_INIT		0x00000000
#define ZFCP_STATUS_FSFREQ_POOL  		0x00000001
#define ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT	0x00000002
#define ZFCP_STATUS_FSFREQ_COMPLETED		0x00000004
#define ZFCP_STATUS_FSFREQ_ERROR		0x00000008
#define ZFCP_STATUS_FSFREQ_CLEANUP		0x00000010
#define ZFCP_STATUS_FSFREQ_ABORTING		0x00000020
#define ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED	0x00000040
#define ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED       0x00000080
#define ZFCP_STATUS_FSFREQ_ABORTED              0x00000100
@@ -475,7 +423,7 @@ struct zfcp_erp_action {
	struct zfcp_adapter *adapter; /* device which should be recovered */
	struct zfcp_port *port;
	struct zfcp_unit *unit;
	volatile u32 status;	      /* recovery status */
	u32		status;	      /* recovery status */
	u32 step;	              /* active step of this erp action */
	struct zfcp_fsf_req *fsf_req; /* fsf request currently pending
					 for this action */
@@ -626,7 +574,7 @@ struct zfcp_fsf_req {
	u8			sbal_response;	/* SBAL used in interrupt */
	wait_queue_head_t      completion_wq;  /* can be used by a routine
						  to wait for completion */
	volatile u32	       status;	       /* status of this request */
	u32			status;	       /* status of this request */
	u32		       fsf_command;    /* FSF Command copy */
	struct fsf_qtcb	       *qtcb;	       /* address of associated QTCB */
	u32		       seq_no;         /* Sequence number of request */
@@ -678,14 +626,7 @@ struct zfcp_fsf_req_qtcb {
#define ZFCP_SET                0x00000100
#define ZFCP_CLEAR              0x00000200

#ifndef atomic_test_mask
#define atomic_test_mask(mask, target) \
           ((atomic_read(target) & mask) == mask)
#endif

#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_unit(unit) (zfcp_get_busid_by_port(unit->port))

/*
 * Helper functions for request ID management.
@@ -745,12 +686,6 @@ zfcp_unit_put(struct zfcp_unit *unit)
		wake_up(&unit->remove_wq);
}

static inline void
zfcp_unit_wait(struct zfcp_unit *unit)
{
	wait_event(unit->remove_wq, atomic_read(&unit->refcount) == 0);
}

static inline void
zfcp_port_get(struct zfcp_port *port)
{
@@ -764,12 +699,6 @@ zfcp_port_put(struct zfcp_port *port)
		wake_up(&port->remove_wq);
}

static inline void
zfcp_port_wait(struct zfcp_port *port)
{
	wait_event(port->remove_wq, atomic_read(&port->refcount) == 0);
}

static inline void
zfcp_adapter_get(struct zfcp_adapter *adapter)
{
@@ -783,10 +712,4 @@ zfcp_adapter_put(struct zfcp_adapter *adapter)
		wake_up(&adapter->remove_wq);
}

static inline void
zfcp_adapter_wait(struct zfcp_adapter *adapter)
{
	wait_event(adapter->remove_wq, atomic_read(&adapter->refcount) == 0);
}

#endif /* ZFCP_DEF_H */
+3 −14
Original line number Diff line number Diff line
@@ -669,8 +669,6 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *act)
	int ret;
	struct zfcp_adapter *adapter = act->adapter;

	atomic_clear_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status);

	write_lock_irq(&adapter->erp_lock);
	zfcp_erp_action_to_running(act);
	write_unlock_irq(&adapter->erp_lock);
@@ -741,8 +739,7 @@ static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *act,
				       ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
 failed_qdio:
	atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK |
			  ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
			  ZFCP_STATUS_ADAPTER_XPORT_OK,
			  ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED,
			  &act->adapter->status);
	return retval;
}
@@ -751,15 +748,11 @@ static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *act)
{
	int retval;

	atomic_set_mask(ZFCP_STATUS_COMMON_CLOSING, &act->adapter->status);
	zfcp_erp_adapter_strategy_generic(act, 1); /* close */
	atomic_clear_mask(ZFCP_STATUS_COMMON_CLOSING, &act->adapter->status);
	if (act->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
		return ZFCP_ERP_EXIT;

	atomic_set_mask(ZFCP_STATUS_COMMON_OPENING, &act->adapter->status);
	retval = zfcp_erp_adapter_strategy_generic(act, 0); /* open */
	atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING, &act->adapter->status);

	if (retval == ZFCP_ERP_FAILED)
		ssleep(8);
@@ -783,9 +776,7 @@ static int zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *act)

static void zfcp_erp_port_strategy_clearstati(struct zfcp_port *port)
{
	atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING |
			  ZFCP_STATUS_COMMON_CLOSING |
			  ZFCP_STATUS_COMMON_ACCESS_DENIED |
	atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
			  ZFCP_STATUS_PORT_DID_DID |
			  ZFCP_STATUS_PORT_PHYS_CLOSING |
			  ZFCP_STATUS_PORT_INVALID_WWPN,
@@ -998,9 +989,7 @@ static int zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)

static void zfcp_erp_unit_strategy_clearstati(struct zfcp_unit *unit)
{
	atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING |
			  ZFCP_STATUS_COMMON_CLOSING |
			  ZFCP_STATUS_COMMON_ACCESS_DENIED |
	atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
			  ZFCP_STATUS_UNIT_SHARED |
			  ZFCP_STATUS_UNIT_READONLY,
			  &unit->status);
Loading