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

Commit 422c0d61 authored by Jeff Garzik's avatar Jeff Garzik Committed by James Bottomley
Browse files

[SCSI] use scmd_id(), scmd_channel() throughout code



Wrap a highly common idiom.  Makes the code easier to read, helps pave
the way for sdev->{id,channel} removal, and adds a token that can easily
by grepped-for in the future.

There are a couple sdev_id() and scmd_printk() updates thrown in as well.

Rejections fixed up and
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 017560fc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1427,7 +1427,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
	 * If a contingent allegiance condition exists, the device
	 * will refuse all tags, so send the request sense as untagged
	 * */
	if((hostdata->tag_negotiated & (1<<SCp->device->id))
	if((hostdata->tag_negotiated & (1<<scmd_id(SCp)))
	   && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE)) {
		count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]);
	}
@@ -1446,7 +1446,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)


	script_patch_ID(hostdata->script,
			Device_ID, 1<<SCp->device->id);
			Device_ID, 1<<scmd_id(SCp));

	script_patch_32_abs(hostdata->script, CommandAddress, 
			    slot->pCmd);
@@ -2111,7 +2111,7 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
		/* shift back to the default unqueued number of commands
		 * (the user can still raise this) */
		scsi_deactivate_tcq(SDp, SDp->host->cmd_per_lun);
		hostdata->tag_negotiated &= ~(1 << SDp->id);
		hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
	} else {
		/* Here, we cleared the negotiation flag above, so this
		 * will force the driver to renegotiate */
+6 −6
Original line number Diff line number Diff line
@@ -1247,13 +1247,13 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
	case WRITE:
	case WRITE_6:
	case WRITE_10:
		hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
		hostdata->time_write[scmd_id(cmd)] += (jiffies - hostdata->timebase);
		hostdata->pendingw--;
		break;
	case READ:
	case READ_6:
	case READ_10:
		hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
		hostdata->time_read[scmd_id(cmd)] += (jiffies - hostdata->timebase);
		hostdata->pendingr--;
		break;
	}
@@ -1385,7 +1385,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
	 * the host and target ID's on the SCSI bus.
	 */

	NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id)));
	NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << scmd_id(cmd))));

	/* 
	 * Raise ATN while SEL is true before BSY goes false from arbitration,
@@ -1430,7 +1430,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)

	udelay(1);

	dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->device->id));
	dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, scmd_id(cmd)));

	/* 
	 * The SCSI specification calls for a 250 ms timeout for the actual 
@@ -1483,7 +1483,7 @@ part2:

	if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
		if (hostdata->targets_present & (1 << cmd->device->id)) {
		if (hostdata->targets_present & (1 << scmd_id(cmd))) {
			printk(KERN_DEBUG "scsi%d : weirdness\n", instance->host_no);
			if (hostdata->restart_select)
				printk(KERN_DEBUG "\trestart select\n");
@@ -1499,7 +1499,7 @@ part2:
		NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
		return 0;
	}
	hostdata->targets_present |= (1 << cmd->device->id);
	hostdata->targets_present |= (1 << scmd_id(cmd));

	/*
	 * Since we followed the SCSI spec, and raised ATN while SEL 
+8 −8
Original line number Diff line number Diff line
@@ -936,7 +936,7 @@ static void esp_release_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp)

static void esp_restore_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
	struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
	struct esp_pointers *ep = &esp->data_pointers[scmd_id(sp)];

	sp->SCp.ptr = ep->saved_ptr;
	sp->SCp.buffer = ep->saved_buffer;
@@ -946,7 +946,7 @@ static void esp_restore_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)

static void esp_save_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
	struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
	struct esp_pointers *ep = &esp->data_pointers[scmd_id(sp)];

	ep->saved_ptr = sp->SCp.ptr;
	ep->saved_buffer = sp->SCp.buffer;
@@ -1693,13 +1693,13 @@ static inline void esp_connect(struct NCR_ESP *esp, struct ESP_regs *eregs,
	if(esp->prev_soff  != esp_dev->sync_max_offset ||
	   esp->prev_stp   != esp_dev->sync_min_period ||
	   (esp->erev > esp100a &&
	    esp->prev_cfg3 != esp->config3[sp->device->id])) {
	    esp->prev_cfg3 != esp->config3[scmd_id(sp)])) {
		esp->prev_soff = esp_dev->sync_max_offset;
		esp_write(eregs->esp_soff, esp->prev_soff);
		esp->prev_stp = esp_dev->sync_min_period;
		esp_write(eregs->esp_stp, esp->prev_stp);
		if(esp->erev > esp100a) {
			esp->prev_cfg3 = esp->config3[sp->device->id];
			esp->prev_cfg3 = esp->config3[scmd_id(sp)];
			esp_write(eregs->esp_cfg3, esp->prev_cfg3);
		} 
	}
@@ -2205,7 +2205,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs)

		if(SCptr->SCp.Status != GOOD &&
		   SCptr->SCp.Status != CONDITION_GOOD &&
		   ((1<<SCptr->device->id) & esp->targets_present) &&
		   ((1<<scmd_id(SCptr)) & esp->targets_present) &&
		   esp_dev->sync && esp_dev->sync_max_offset) {
			/* SCSI standard says that the synchronous capabilities
			 * should be renegotiated at this point.  Most likely
@@ -2597,7 +2597,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs)
	 */
	if(esp->ireg == (ESP_INTR_FDONE | ESP_INTR_BSERV)) {
		/* target speaks... */
		esp->targets_present |= (1<<SCptr->device->id);
		esp->targets_present |= (1<<scmd_id(SCptr));

		/* What if the target ignores the sdtr? */
		if(esp->snip)
@@ -3064,7 +3064,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
			ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n",
				esp_dev->sync_max_offset,
				esp_dev->sync_min_period,
				esp->config3[SCptr->device->id]));
				esp->config3[scmd_id(SCptr)]));

			esp->snip = 0;
		} else if(esp_dev->sync_max_offset) {
@@ -3621,7 +3621,7 @@ void esp_slave_destroy(Scsi_Device *SDptr)
{
	struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata;

	esp->targets_present &= ~(1 << SDptr->id);
	esp->targets_present &= ~(1 << sdev_id(SDptr));
	kfree(SDptr->hostdata);
	SDptr->hostdata = NULL;
}
+1 −1
Original line number Diff line number Diff line
@@ -710,7 +710,7 @@ static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))

	/* We are locked here already by the mid layer */
	REG0;
	outb(SCpnt->device->id, DEST_ID);	/* set destination */
	outb(scmd_id(SCpnt), DEST_ID);	/* set destination */
	outb(FLUSH_FIFO, CMD_REG);	/* reset the fifos */

	for (i = 0; i < SCpnt->cmd_len; i++) {
+1 −1
Original line number Diff line number Diff line
@@ -923,7 +923,7 @@ static int inia100_device_reset(struct scsi_cmnd * SCpnt)
{				/* I need Host Control Block Information */
	ORC_HCS *pHCB;
	pHCB = (ORC_HCS *) SCpnt->device->host->hostdata;
	return orc_device_reset(pHCB, SCpnt, SCpnt->device->id);
	return orc_device_reset(pHCB, SCpnt, scmd_id(SCpnt));

}

Loading