Skip to content

Commit

Permalink
[SCSI] qla2xxx: Cruft cleanup of functions and structures.
Browse files Browse the repository at this point in the history
Strip unused (DEBUG-ONLY) enabled functions, inlines, useless
wrappers, and unused DPC flags from the code.  Another step in
the migration towards a cleaner (less-crusty) driver.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
Andrew Vasquez authored and James Bottomley committed Apr 7, 2008
1 parent cb8dacb commit 587f4ca
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 428 deletions.
122 changes: 0 additions & 122 deletions drivers/scsi/qla2xxx/qla_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,125 +1410,3 @@ qla2x00_dump_buffer(uint8_t * b, uint32_t size)
if (cnt % 16)
printk("\n");
}

/**************************************************************************
* qla2x00_print_scsi_cmd
* Dumps out info about the scsi cmd and srb.
* Input
* cmd : struct scsi_cmnd
**************************************************************************/
void
qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
{
int i;
struct scsi_qla_host *ha;
srb_t *sp;

ha = shost_priv(cmd->device->host);

sp = (srb_t *) cmd->SCp.ptr;
printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
printk(" chan=0x%02x, target=0x%02x, lun=0x%02x, cmd_len=0x%02x\n",
cmd->device->channel, cmd->device->id, cmd->device->lun,
cmd->cmd_len);
printk(" CDB: ");
for (i = 0; i < cmd->cmd_len; i++) {
printk("0x%02x ", cmd->cmnd[i]);
}
printk("\n seg_cnt=%d, allowed=%d, retries=%d\n",
scsi_sg_count(cmd), cmd->allowed, cmd->retries);
printk(" request buffer=0x%p, request buffer len=0x%x\n",
scsi_sglist(cmd), scsi_bufflen(cmd));
printk(" tag=%d, transfersize=0x%x\n",
cmd->tag, cmd->transfersize);
printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp);
printk(" data direction=%d\n", cmd->sc_data_direction);

if (!sp)
return;

printk(" sp flags=0x%x\n", sp->flags);
}

#if defined(QL_DEBUG_ROUTINES)
/*
* qla2x00_formatted_dump_buffer
* Prints string plus buffer.
*
* Input:
* string = Null terminated string (no newline at end).
* buffer = buffer address.
* wd_size = word size 8, 16, 32 or 64 bits
* count = number of words.
*/
void
qla2x00_formatted_dump_buffer(char *string, uint8_t * buffer,
uint8_t wd_size, uint32_t count)
{
uint32_t cnt;
uint16_t *buf16;
uint32_t *buf32;

if (strcmp(string, "") != 0)
printk("%s\n",string);

switch (wd_size) {
case 8:
printk(" 0 1 2 3 4 5 6 7 "
"8 9 Ah Bh Ch Dh Eh Fh\n");
printk("-----------------------------------------"
"-------------------------------------\n");

for (cnt = 1; cnt <= count; cnt++, buffer++) {
printk("%02x",*buffer);
if (cnt % 16 == 0)
printk("\n");
else
printk(" ");
}
if (cnt % 16 != 0)
printk("\n");
break;
case 16:
printk(" 0 2 4 6 8 Ah "
" Ch Eh\n");
printk("-----------------------------------------"
"-------------\n");

buf16 = (uint16_t *) buffer;
for (cnt = 1; cnt <= count; cnt++, buf16++) {
printk("%4x",*buf16);

if (cnt % 8 == 0)
printk("\n");
else if (*buf16 < 10)
printk(" ");
else
printk(" ");
}
if (cnt % 8 != 0)
printk("\n");
break;
case 32:
printk(" 0 4 8 Ch\n");
printk("------------------------------------------\n");

buf32 = (uint32_t *) buffer;
for (cnt = 1; cnt <= count; cnt++, buf32++) {
printk("%8x", *buf32);

if (cnt % 4 == 0)
printk("\n");
else if (*buf32 < 10)
printk(" ");
else
printk(" ");
}
if (cnt % 4 != 0)
printk("\n");
break;
default:
break;
}
}
#endif
13 changes: 0 additions & 13 deletions drivers/scsi/qla2xxx/qla_dbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,6 @@
/* #define QL_DEBUG_LEVEL_13 */ /* Output fdmi function trace msgs */
/* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */
/* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */
/*
* Local Macro Definitions.
*/
#if defined(QL_DEBUG_LEVEL_1) || defined(QL_DEBUG_LEVEL_2) || \
defined(QL_DEBUG_LEVEL_3) || defined(QL_DEBUG_LEVEL_4) || \
defined(QL_DEBUG_LEVEL_5) || defined(QL_DEBUG_LEVEL_6) || \
defined(QL_DEBUG_LEVEL_7) || defined(QL_DEBUG_LEVEL_8) || \
defined(QL_DEBUG_LEVEL_9) || defined(QL_DEBUG_LEVEL_10) || \
defined(QL_DEBUG_LEVEL_11) || defined(QL_DEBUG_LEVEL_12) || \
defined(QL_DEBUG_LEVEL_13) || defined(QL_DEBUG_LEVEL_14) || \
defined(QL_DEBUG_LEVEL_15)
#define QL_DEBUG_ROUTINES
#endif

/*
* Macros use for debugging the driver.
Expand Down
2 changes: 0 additions & 2 deletions drivers/scsi/qla2xxx/qla_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -2449,8 +2449,6 @@ typedef struct scsi_qla_host {
#define MBX_TIMEDOUT BIT_5
#define MBX_ACCESS_TIMEDOUT BIT_6

mbx_cmd_t mc;

/* Basic firmware related information. */
uint16_t fw_major_version;
uint16_t fw_minor_version;
Expand Down
4 changes: 0 additions & 4 deletions drivers/scsi/qla2xxx/qla_gbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ extern int qla2x00_loop_resync(scsi_qla_host_t *);
extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *);
extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *);

extern void qla2x00_restart_queues(scsi_qla_host_t *, uint8_t);

extern void qla2x00_rescan_fcports(scsi_qla_host_t *);
extern void qla2x00_update_fcports(scsi_qla_host_t *);

extern int qla2x00_abort_isp(scsi_qla_host_t *);
Expand Down Expand Up @@ -312,7 +309,6 @@ extern void qla24xx_fw_dump(scsi_qla_host_t *, int);
extern void qla25xx_fw_dump(scsi_qla_host_t *, int);
extern void qla2x00_dump_regs(scsi_qla_host_t *);
extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *);

/*
* Global Function Prototypes in qla_gs.c source file.
Expand Down
6 changes: 0 additions & 6 deletions drivers/scsi/qla2xxx/qla_gs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
*/
#include "qla_def.h"

static inline struct ct_sns_req *
qla2x00_prep_ct_req(struct ct_sns_req *, uint16_t, uint16_t);

static inline struct sns_cmd_pkt *
qla2x00_prep_sns_cmd(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t);

static int qla2x00_sns_ga_nxt(scsi_qla_host_t *, fc_port_t *);
static int qla2x00_sns_gid_pt(scsi_qla_host_t *, sw_info_t *);
static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *);
Expand Down
41 changes: 0 additions & 41 deletions drivers/scsi/qla2xxx/qla_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
#include <asm/prom.h>
#endif

/* XXX(hch): this is ugly, but we don't want to pull in exioctl.h */
#ifndef EXT_IS_LUN_BIT_SET
#define EXT_IS_LUN_BIT_SET(P,L) \
(((P)->mask[L/8] & (0x80 >> (L%8)))?1:0)
#define EXT_SET_LUN_BIT(P,L) \
((P)->mask[L/8] |= (0x80 >> (L%8)))
#endif

/*
* QLogic ISP2x00 Hardware Support Function Prototypes.
*/
Expand Down Expand Up @@ -2175,20 +2167,6 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
return (rval);
}

static void
qla2x00_probe_for_all_luns(scsi_qla_host_t *ha)
{
fc_port_t *fcport;

qla2x00_mark_all_devices_lost(ha, 0);
list_for_each_entry(fcport, &ha->fcports, list) {
if (fcport->port_type != FCT_TARGET)
continue;

qla2x00_update_fcport(ha, fcport);
}
}

static void
qla2x00_iidma_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
{
Expand Down Expand Up @@ -3199,25 +3177,6 @@ qla2x00_loop_resync(scsi_qla_host_t *ha)
return (rval);
}

void
qla2x00_rescan_fcports(scsi_qla_host_t *ha)
{
int rescan_done;
fc_port_t *fcport;

rescan_done = 0;
list_for_each_entry(fcport, &ha->fcports, list) {
if ((fcport->flags & FCF_RESCAN_NEEDED) == 0)
continue;

qla2x00_update_fcport(ha, fcport);
fcport->flags &= ~FCF_RESCAN_NEEDED;

rescan_done = 1;
}
qla2x00_probe_for_all_luns(ha);
}

void
qla2x00_update_fcports(scsi_qla_host_t *ha)
{
Expand Down
85 changes: 0 additions & 85 deletions drivers/scsi/qla2xxx/qla_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* See LICENSE.qla2xxx for copyright and licensing details.
*/

static __inline__ uint16_t qla2x00_debounce_register(volatile uint16_t __iomem *);
/*
* qla2x00_debounce_register
* Debounce register.
Expand All @@ -32,94 +31,12 @@ qla2x00_debounce_register(volatile uint16_t __iomem *addr)
return (first);
}

static __inline__ int qla2x00_normalize_dma_addr(
dma_addr_t *e_addr, uint32_t *e_len,
dma_addr_t *ne_addr, uint32_t *ne_len);

/**
* qla2x00_normalize_dma_addr() - Normalize an DMA address.
* @e_addr: Raw DMA address
* @e_len: Raw DMA length
* @ne_addr: Normalized second DMA address
* @ne_len: Normalized second DMA length
*
* If the address does not span a 4GB page boundary, the contents of @ne_addr
* and @ne_len are undefined. @e_len is updated to reflect a normalization.
*
* Example:
*
* ffffabc0ffffeeee (e_addr) start of DMA address
* 0000000020000000 (e_len) length of DMA transfer
* ffffabc11fffeeed end of DMA transfer
*
* Is the 4GB boundary crossed?
*
* ffffabc0ffffeeee (e_addr)
* ffffabc11fffeeed (e_addr + e_len - 1)
* 00000001e0000003 ((e_addr ^ (e_addr + e_len - 1))
* 0000000100000000 ((e_addr ^ (e_addr + e_len - 1)) & ~(0xffffffff)
*
* Compute start of second DMA segment:
*
* ffffabc0ffffeeee (e_addr)
* ffffabc1ffffeeee (0x100000000 + e_addr)
* ffffabc100000000 (0x100000000 + e_addr) & ~(0xffffffff)
* ffffabc100000000 (ne_addr)
*
* Compute length of second DMA segment:
*
* 00000000ffffeeee (e_addr & 0xffffffff)
* 0000000000001112 (0x100000000 - (e_addr & 0xffffffff))
* 000000001fffeeee (e_len - (0x100000000 - (e_addr & 0xffffffff))
* 000000001fffeeee (ne_len)
*
* Adjust length of first DMA segment
*
* 0000000020000000 (e_len)
* 0000000000001112 (e_len - ne_len)
* 0000000000001112 (e_len)
*
* Returns non-zero if the specified address was normalized, else zero.
*/
static __inline__ int
qla2x00_normalize_dma_addr(
dma_addr_t *e_addr, uint32_t *e_len,
dma_addr_t *ne_addr, uint32_t *ne_len)
{
int normalized;

normalized = 0;
if ((*e_addr ^ (*e_addr + *e_len - 1)) & ~(0xFFFFFFFFULL)) {
/* Compute normalized crossed address and len */
*ne_addr = (0x100000000ULL + *e_addr) & ~(0xFFFFFFFFULL);
*ne_len = *e_len - (0x100000000ULL - (*e_addr & 0xFFFFFFFFULL));
*e_len -= *ne_len;

normalized++;
}
return (normalized);
}

static __inline__ void qla2x00_poll(scsi_qla_host_t *);
static inline void
qla2x00_poll(scsi_qla_host_t *ha)
{
ha->isp_ops->intr_handler(0, ha);
}

static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *);
/*
* This routine will wait for fabric devices for
* the reset delay.
*/
static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *ha)
{
uint16_t fw_state;

qla2x00_get_firmware_state(ha, &fw_state);
}

static __inline__ scsi_qla_host_t * to_qla_parent(scsi_qla_host_t *);
static __inline__ scsi_qla_host_t *
to_qla_parent(scsi_qla_host_t *ha)
{
Expand Down Expand Up @@ -152,7 +69,6 @@ qla2x00_issue_marker(scsi_qla_host_t *ha, int ha_locked)
return (QLA_SUCCESS);
}

static inline uint8_t *host_to_fcp_swap(uint8_t *, uint32_t);
static inline uint8_t *
host_to_fcp_swap(uint8_t *fcp, uint32_t bsize)
{
Expand All @@ -166,7 +82,6 @@ host_to_fcp_swap(uint8_t *fcp, uint32_t bsize)
return fcp;
}

static inline int qla2x00_is_reserved_id(scsi_qla_host_t *, uint16_t);
static inline int
qla2x00_is_reserved_id(scsi_qla_host_t *ha, uint16_t loop_id)
{
Expand Down
3 changes: 0 additions & 3 deletions drivers/scsi/qla2xxx/qla_iocb.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

#include <scsi/scsi_tcq.h>

static inline uint16_t qla2x00_get_cmd_direction(struct scsi_cmnd *cmd);
static inline cont_entry_t *qla2x00_prep_cont_type0_iocb(scsi_qla_host_t *);
static inline cont_a64_entry_t *qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *);
static request_t *qla2x00_req_pkt(scsi_qla_host_t *ha);
static void qla2x00_isp_cmd(scsi_qla_host_t *ha);

Expand Down
Loading

0 comments on commit 587f4ca

Please sign in to comment.