Commit 7e2bc6de authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen
Browse files

scsi: nsp32: Whitespace cleanup

parent 5751a9ea
Loading
Loading
Loading
Loading
+221 −194
Original line number Diff line number Diff line
@@ -197,12 +197,14 @@ static int nsp32_eh_host_reset(struct scsi_cmnd *);
static void nsp32_build_identify(struct scsi_cmnd *);
static void nsp32_build_nop     (struct scsi_cmnd *);
static void nsp32_build_reject  (struct scsi_cmnd *);
static void nsp32_build_sdtr    (struct scsi_cmnd *, unsigned char, unsigned char);
static void nsp32_build_sdtr    (struct scsi_cmnd *, unsigned char,
				 unsigned char);

/* SCSI message handler */
static int  nsp32_busfree_occur(struct scsi_cmnd *, unsigned short);
static void nsp32_msgout_occur (struct scsi_cmnd *);
static void nsp32_msgin_occur  (struct scsi_cmnd *, unsigned long, unsigned short);
static void nsp32_msgin_occur  (struct scsi_cmnd *, unsigned long,
				unsigned short);

static int  nsp32_setup_sg_table    (struct scsi_cmnd *);
static int  nsp32_selection_autopara(struct scsi_cmnd *);
@@ -215,10 +217,13 @@ static void nsp32_restart_autoscsi (struct scsi_cmnd *, unsigned short);

/* SCSI SDTR */
static void nsp32_analyze_sdtr       (struct scsi_cmnd *);
static int  nsp32_search_period_entry(nsp32_hw_data *, nsp32_target *, unsigned char);
static int  nsp32_search_period_entry(nsp32_hw_data *, nsp32_target *,
				      unsigned char);
static void nsp32_set_async	     (nsp32_hw_data *, nsp32_target *);
static void nsp32_set_max_sync       (nsp32_hw_data *, nsp32_target *, unsigned char *, unsigned char *);
static void nsp32_set_sync_entry     (nsp32_hw_data *, nsp32_target *, int, unsigned char);
static void nsp32_set_max_sync       (nsp32_hw_data *, nsp32_target *,
				      unsigned char *, unsigned char *);
static void nsp32_set_sync_entry     (nsp32_hw_data *, nsp32_target *,
				      int, unsigned char);

/* SCSI bus status handler */
static void nsp32_wait_req    (nsp32_hw_data *, int);
@@ -494,7 +499,8 @@ static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
		msgout = 0;
	}

	// nsp_dbg(NSP32_DEBUG_AUTOSCSI, "sel time out=0x%x\n", nsp32_read2(base, SEL_TIME_OUT));
	// nsp_dbg(NSP32_DEBUG_AUTOSCSI, "sel time out=0x%x\n",
	// nsp32_read2(base, SEL_TIME_OUT));
	// nsp32_write2(base, SEL_TIME_OUT,   SEL_TIMEOUT_TIME);

	/*
@@ -556,8 +562,8 @@ static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
	 * transfer parameter to ASIC
	 */
	nsp32_write4(base, SGT_ADR, data->auto_paddr);
	nsp32_write2(base, COMMAND_CONTROL, CLEAR_CDB_FIFO_POINTER |
		                            AUTO_PARAMETER         );
	nsp32_write2(base, COMMAND_CONTROL,
		     CLEAR_CDB_FIFO_POINTER | AUTO_PARAMETER );

	/*
	 * Check arbitration
@@ -622,7 +628,8 @@ static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
	/*
	 * set SCSIOUT LATCH(initiator)/TARGET(target) (OR-ed) ID
	 */
	nsp32_write1(base, SCSI_OUT_LATCH_TARGET_ID, BIT(host_id) | BIT(target));
	nsp32_write1(base, SCSI_OUT_LATCH_TARGET_ID,
		     BIT(host_id) | BIT(target));

	/*
	 * set SCSI MSGOUT REG
@@ -687,7 +694,8 @@ static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
	nsp32_dbg(NSP32_DEBUG_AUTOSCSI,
		  "syncreg=0x%x, ackwidth=0x%x, sgtpaddr=0x%x, id=0x%x",
		  nsp32_read1(base, SYNC_REG), nsp32_read1(base, ACK_WIDTH),
		  nsp32_read4(base, SGT_ADR), nsp32_read1(base, SCSI_OUT_LATCH_TARGET_ID));
		  nsp32_read4(base, SGT_ADR),
		  nsp32_read1(base, SCSI_OUT_LATCH_TARGET_ID));
	nsp32_dbg(NSP32_DEBUG_AUTOSCSI, "msgout_len=%d, msgout=0x%x",
		  data->msgout_len, msgout);

@@ -822,7 +830,8 @@ static int nsp32_reselection(struct scsi_cmnd *SCpnt, unsigned char newlun)
	 * or current nexus is not existed, unexpected
	 * reselection is occurred. Send reject message.
	 */
	if (newid >= ARRAY_SIZE(data->lunt) || newlun >= ARRAY_SIZE(data->lunt[0])) {
	if (newid >= ARRAY_SIZE(data->lunt) ||
	    newlun >= ARRAY_SIZE(data->lunt[0])) {
		nsp32_msg(KERN_WARNING, "unknown id/lun");
		return FALSE;
	} else if(data->lunt[newid][newlun].SCpnt == NULL) {
@@ -876,7 +885,8 @@ static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt)

			if (le32_to_cpu(sgt[i].len) > 0x10000) {
				nsp32_msg(KERN_ERR,
					"can't transfer over 64KB at a time, size=0x%x", le32_to_cpu(sgt[i].len));
					"can't transfer over 64KB at a time, "
					"size=0x%x", le32_to_cpu(sgt[i].len));
				return FALSE;
			}
			nsp32_dbg(NSP32_DEBUG_SGLIST,
@@ -894,7 +904,8 @@ static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt)
	return TRUE;
}

static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt,
				  void (*done)(struct scsi_cmnd *))
{
	nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
	nsp32_target *target;
@@ -904,8 +915,9 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct s
	nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND,
		  "enter. target: 0x%x LUN: 0x%llx cmnd: 0x%x cmndlen: 0x%x "
		  "use_sg: 0x%x reqbuf: 0x%lx reqlen: 0x%x",
		  SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
		  scsi_sg_count(SCpnt), scsi_sglist(SCpnt), scsi_bufflen(SCpnt));
		  SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0],
		  SCpnt->cmd_len, scsi_sg_count(SCpnt), scsi_sglist(SCpnt),
		  scsi_bufflen(SCpnt));

	if (data->CurrentSC != NULL) {
		nsp32_msg(KERN_ERR, "Currentsc != NULL. Cancel this command request");
@@ -1081,7 +1093,8 @@ static int nsp32hw_init(nsp32_hw_data *data)
		  nsp32_index_read1(base, FIFO_EMPTY_SHLD_COUNT));

	nsp32_index_write1(base, CLOCK_DIV, data->clock);
	nsp32_index_write1(base, BM_CYCLE,  MEMRD_CMD1 | SGT_AUTO_PARA_MEMED_CMD);
	nsp32_index_write1(base, BM_CYCLE,
			   MEMRD_CMD1 | SGT_AUTO_PARA_MEMED_CMD);
	nsp32_write1(base, PARITY_CONTROL, 0);	/* parity check is disable */

	/*
@@ -1125,7 +1138,8 @@ static int nsp32hw_init(nsp32_hw_data *data)
	 * enable to select designated IRQ (except for
	 * IRQSELECT_SERR, IRQSELECT_PERR, IRQSELECT_BMCNTERR)
	 */
	nsp32_index_write2(base, IRQ_SELECT, IRQSELECT_TIMER_IRQ         |
	nsp32_index_write2(base, IRQ_SELECT,
			   IRQSELECT_TIMER_IRQ |
			   IRQSELECT_SCSIRESET_IRQ |
			   IRQSELECT_FIFO_SHLD_IRQ |
			   IRQSELECT_RESELECT_IRQ |
@@ -1167,7 +1181,8 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
		  "enter IRQ: %d, IRQstatus: 0x%x", irq, irq_stat);
	/* is this interrupt comes from Ninja asic? */
	if ((irq_stat & IRQSTATUS_ANY_IRQ) == 0) {
		nsp32_dbg(NSP32_DEBUG_INTR, "shared interrupt: irq other 0x%x", irq_stat);
		nsp32_dbg(NSP32_DEBUG_INTR,
			  "shared interrupt: irq other 0x%x", irq_stat);
		goto out2;
	}
	handled = 1;
@@ -1207,7 +1222,8 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)

	if (SCpnt == NULL) {
		nsp32_msg(KERN_WARNING, "SCpnt==NULL this can't be happened");
		nsp32_msg(KERN_WARNING, "irq_stat=0x%x trans_stat=0x%x", irq_stat, trans_stat);
		nsp32_msg(KERN_WARNING, "irq_stat=0x%x trans_stat=0x%x",
			  irq_stat, trans_stat);
		goto out;
	}

@@ -1367,7 +1383,8 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
			break;
		default:
			nsp32_dbg(NSP32_DEBUG_INTR, "fifo/other phase");
			nsp32_dbg(NSP32_DEBUG_INTR, "irq_stat=0x%x trans_stat=0x%x", irq_stat, trans_stat);
			nsp32_dbg(NSP32_DEBUG_INTR, "irq_stat=0x%x trans_stat=0x%x",
				  irq_stat, trans_stat);
			show_busphase(busphase);
			break;
		}
@@ -1444,21 +1461,28 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
	base = host->io_port;

	seq_puts(m, "NinjaSCSI-32 status\n\n");
	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n",
		   nsp32_release_version);
	seq_printf(m, "SCSI host No.:         %d\n", hostno);
	seq_printf(m, "IRQ:                   %d\n", host->irq);
	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n",	host->base, host->base + data->MmioLength - 1);
	seq_printf(m, "sg_tablesize:          %d\n",		host->sg_tablesize);
	seq_printf(m, "Chip revision:         0x%x\n",		(nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
	seq_printf(m, "IO:                    0x%lx-0x%lx\n",
		   host->io_port, host->io_port + host->n_io_port - 1);
	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n",
		   host->base, host->base + data->MmioLength - 1);
	seq_printf(m, "sg_tablesize:          %d\n",
		   host->sg_tablesize);
	seq_printf(m, "Chip revision:         0x%x\n",
		   (nsp32_read2(base, INDEX_REG) >> 8) & 0xff);

	mode_reg = nsp32_index_read1(base, CHIP_MODE);
	model    = data->pci_devid->driver_data;

#ifdef CONFIG_PM
	seq_printf(m, "Power Management:      %s\n",          (mode_reg & OPTF) ? "yes" : "no");
	seq_printf(m, "Power Management:      %s\n",
		   (mode_reg & OPTF) ? "yes" : "no");
#endif
	seq_printf(m, "OEM:                   %ld, %s\n",     (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
	seq_printf(m, "OEM:                   %ld, %s\n",
		   (mode_reg & (OEM0|OEM1)), nsp32_model[model]);

	spin_lock_irqsave(&(data->Lock), flags);
	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
@@ -1738,7 +1762,9 @@ static void nsp32_adjust_busfree(struct scsi_cmnd *SCpnt, unsigned int s_sacklen
	if (sentlen == s_sacklen) {
		/* XXX: confirm it's ok or not */
		/* In this case, it's ok because we are at
		   the head element of the sg. restlen is correctly calculated. */
		 * the head element of the sg. restlen is correctly
		 * calculated.
		 */
	}

	/* calculate the rest length for transferring */
@@ -3281,7 +3307,8 @@ static int nsp32_resume(struct pci_dev *pdev)
	nsp32_hw_data    *data = (nsp32_hw_data *)host->hostdata;
	unsigned short    reg;

	nsp32_msg(KERN_INFO, "pci-resume: pdev=0x%p, slot=%s, host=0x%p", pdev, pci_name(pdev), host);
	nsp32_msg(KERN_INFO, "pci-resume: pdev=0x%p, slot=%s, host=0x%p",
		  pdev, pci_name(pdev), host);

	pci_set_power_state(pdev, PCI_D0);
	pci_enable_wake    (pdev, PCI_D0, 0);