Commit be7db055 authored by 's avatar Committed by James Bottomley
Browse files

[PATCH] remove old scsi data direction macros



these have been wrappers for the generic dma direction bits since 2.5.x.
This patch converts the few remaining drivers and removes the macros.

Arjan noticed there's some hunk in here that shouldn't.  Updated patch
below:

Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 80e2ca3d
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -443,15 +443,9 @@ Only streaming mappings specify a direction, consistent mappings
implicitly have a direction attribute setting of
PCI_DMA_BIDIRECTIONAL.

The SCSI subsystem provides mechanisms for you to easily obtain
the direction to use, in the SCSI command:

	scsi_to_pci_dma_dir(SCSI_DIRECTION)

Where SCSI_DIRECTION is obtained from the 'sc_data_direction'
member of the SCSI command your driver is working on.  The
mentioned interface above returns a value suitable for passing
into the streaming DMA mapping interfaces below.
The SCSI subsystem tells you the direction to use in the
'sc_data_direction' member of the SCSI command your driver is
working on.

For Networking drivers, it's a rather simple affair.  For transmit
packets, map/unmap them with the PCI_DMA_TODEVICE direction
+0 −44
Original line number Diff line number Diff line
@@ -389,8 +389,6 @@ Summary:
   scsi_remove_host - detach and remove all SCSI devices owned by host
   scsi_report_bus_reset - report scsi _bus_ reset observed
   scsi_set_device - place device reference in host structure
   scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
   scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
   scsi_track_queue_full - track successive QUEUE_FULL events 
   scsi_unblock_requests - allow further commands to be queued to given host
   scsi_unregister - [calls scsi_host_put()]
@@ -756,48 +754,6 @@ void scsi_report_bus_reset(struct Scsi_Host * shost, int channel)
void scsi_set_device(struct Scsi_Host * shost, struct device * dev)


/**
 * scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
 * @scsi_data_direction: SCSI subsystem direction flag
 *
 *      Returns DMA_TO_DEVICE given SCSI_DATA_WRITE,
 *              DMA_FROM_DEVICE given SCSI_DATA_READ
 *              DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
 *              else returns DMA_NONE
 *
 *      Might block: no
 *
 *      Notes: The SCSI subsystem now uses the same values for these
 *      constants as the PCI subsystem so this function is a nop.
 *      The recommendation is not to use this conversion function anymore
 *      (in the 2.6 kernel series) as it is not needed.
 *
 *      Defined in: drivers/scsi/scsi.h .
 **/
int scsi_to_pci_dma_dir(unsigned char scsi_data_direction)


/**
 * scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
 * @scsi_data_direction: SCSI subsystem direction flag
 *
 *      Returns DMA_TO_DEVICE given SCSI_DATA_WRITE,
 *              FROM_DEVICE given SCSI_DATA_READ
 *              DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
 *              else returns DMA_NONE
 *
 *      Notes: The SCSI subsystem now uses the same values for these
 *      constants as the SBUS subsystem so this function is a nop.
 *      The recommendation is not to use this conversion function anymore
 *      (in the 2.6 kernel series) as it is not needed.
 *
 *      Might block: no
 *
 *      Defined in: drivers/scsi/scsi.h .
 **/
int scsi_to_sbus_dma_dir(unsigned char scsi_data_direction)


/**
 * scsi_track_queue_full - track successive QUEUE_FULL events on given
 *                      device to determine if and when there is a need
+9 −9
Original line number Diff line number Diff line
@@ -687,7 +687,7 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
	int direction;

	cmd = scb->io_ctx;
	direction = scsi_to_pci_dma_dir(cmd->sc_data_direction);
	direction = cmd->sc_data_direction;
	ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
	if (cmd->use_sg != 0) {
		struct scatterlist *sg;
@@ -3338,7 +3338,7 @@ ahd_linux_dv_inq(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
	}

	ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_READ;
	cmd->sc_data_direction = DMA_FROM_DEVICE;
	cmd->cmd_len = 6;
	cmd->cmnd[0] = INQUIRY;
	cmd->cmnd[4] = request_length;
@@ -3363,7 +3363,7 @@ ahd_linux_dv_tur(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
#endif
	/* Do a TUR to clear out any non-fatal transitional state */
	ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_NONE;
	cmd->sc_data_direction = DMA_NONE;
	cmd->cmd_len = 6;
	cmd->cmnd[0] = TEST_UNIT_READY;
}
@@ -3385,7 +3385,7 @@ ahd_linux_dv_rebd(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
		free(targ->dv_buffer, M_DEVBUF);
	targ->dv_buffer = malloc(AHD_REBD_LEN, M_DEVBUF, M_WAITOK);
	ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_READ;
	cmd->sc_data_direction = DMA_FROM_DEVICE;
	cmd->cmd_len = 10;
	cmd->cmnd[0] = READ_BUFFER;
	cmd->cmnd[1] = 0x0b;
@@ -3407,7 +3407,7 @@ ahd_linux_dv_web(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
	}
#endif
	ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_WRITE;
	cmd->sc_data_direction = DMA_TO_DEVICE;
	cmd->cmd_len = 10;
	cmd->cmnd[0] = WRITE_BUFFER;
	cmd->cmnd[1] = 0x0a;
@@ -3429,7 +3429,7 @@ ahd_linux_dv_reb(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
	}
#endif
	ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_READ;
	cmd->sc_data_direction = DMA_FROM_DEVICE;
	cmd->cmd_len = 10;
	cmd->cmnd[0] = READ_BUFFER;
	cmd->cmnd[1] = 0x0a;
@@ -3455,7 +3455,7 @@ ahd_linux_dv_su(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
	}
#endif
	ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_NONE;
	cmd->sc_data_direction = DMA_NONE;
	cmd->cmd_len = 6;
	cmd->cmnd[0] = START_STOP_UNIT;
	cmd->cmnd[4] = le | SSS_START;
@@ -4018,7 +4018,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
			int	 dir;

			cur_seg = (struct scatterlist *)cmd->request_buffer;
			dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
			dir = cmd->sc_data_direction;
			nseg = pci_map_sg(ahd->dev_softc, cur_seg,
					  cmd->use_sg, dir);
			scb->platform_data->xfer_len = 0;
@@ -4038,7 +4038,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
			int dir;

			sg = scb->sg_list;
			dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
			dir = cmd->sc_data_direction;
			addr = pci_map_single(ahd->dev_softc,
					      cmd->request_buffer,
					      cmd->request_bufflen, dir);
+10 −10
Original line number Diff line number Diff line
@@ -693,12 +693,12 @@ ahc_linux_unmap_scb(struct ahc_softc *ahc, struct scb *scb)

		sg = (struct scatterlist *)cmd->request_buffer;
		pci_unmap_sg(ahc->dev_softc, sg, cmd->use_sg,
			     scsi_to_pci_dma_dir(cmd->sc_data_direction));
			     cmd->sc_data_direction);
	} else if (cmd->request_bufflen != 0) {
		pci_unmap_single(ahc->dev_softc,
				 scb->platform_data->buf_busaddr,
				 cmd->request_bufflen,
				 scsi_to_pci_dma_dir(cmd->sc_data_direction));
				 cmd->sc_data_direction);
	}
}

@@ -3007,7 +3007,7 @@ ahc_linux_dv_inq(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
	}

	ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_READ;
	cmd->sc_data_direction = DMA_FROM_DEVICE;
	cmd->cmd_len = 6;
	cmd->cmnd[0] = INQUIRY;
	cmd->cmnd[4] = request_length;
@@ -3032,7 +3032,7 @@ ahc_linux_dv_tur(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
#endif
	/* Do a TUR to clear out any non-fatal transitional state */
	ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_NONE;
	cmd->sc_data_direction = DMA_NONE;
	cmd->cmd_len = 6;
	cmd->cmnd[0] = TEST_UNIT_READY;
}
@@ -3054,7 +3054,7 @@ ahc_linux_dv_rebd(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
		free(targ->dv_buffer, M_DEVBUF);
	targ->dv_buffer = malloc(AHC_REBD_LEN, M_DEVBUF, M_WAITOK);
	ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_READ;
	cmd->sc_data_direction = DMA_FROM_DEVICE;
	cmd->cmd_len = 10;
	cmd->cmnd[0] = READ_BUFFER;
	cmd->cmnd[1] = 0x0b;
@@ -3076,7 +3076,7 @@ ahc_linux_dv_web(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
	}
#endif
	ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_WRITE;
	cmd->sc_data_direction = DMA_TO_DEVICE;
	cmd->cmd_len = 10;
	cmd->cmnd[0] = WRITE_BUFFER;
	cmd->cmnd[1] = 0x0a;
@@ -3098,7 +3098,7 @@ ahc_linux_dv_reb(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
	}
#endif
	ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_READ;
	cmd->sc_data_direction = DMA_FROM_DEVICE;
	cmd->cmd_len = 10;
	cmd->cmnd[0] = READ_BUFFER;
	cmd->cmnd[1] = 0x0a;
@@ -3124,7 +3124,7 @@ ahc_linux_dv_su(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
	}
#endif
	ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
	cmd->sc_data_direction = SCSI_DATA_NONE;
	cmd->sc_data_direction = DMA_NONE;
	cmd->cmd_len = 6;
	cmd->cmnd[0] = START_STOP_UNIT;
	cmd->cmnd[4] = le | SSS_START;
@@ -3659,7 +3659,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)

			cur_seg = (struct scatterlist *)cmd->request_buffer;
			nseg = pci_map_sg(ahc->dev_softc, cur_seg, cmd->use_sg,
			    scsi_to_pci_dma_dir(cmd->sc_data_direction));
			    cmd->sc_data_direction);
			end_seg = cur_seg + nseg;
			/* Copy the segments into the SG list. */
			sg = scb->sg_list;
@@ -3703,7 +3703,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)
			addr = pci_map_single(ahc->dev_softc,
			       cmd->request_buffer,
			       cmd->request_bufflen,
			       scsi_to_pci_dma_dir(cmd->sc_data_direction));
			       cmd->sc_data_direction);
			scb->platform_data->buf_busaddr = addr;
			scb->sg_count = ahc_linux_map_seg(ahc, scb,
							  sg, addr,
+3 −3
Original line number Diff line number Diff line
@@ -103,9 +103,9 @@ typedef enum {
} ac_code;

typedef enum {
	CAM_DIR_IN		= SCSI_DATA_READ,
	CAM_DIR_OUT		= SCSI_DATA_WRITE,
	CAM_DIR_NONE		= SCSI_DATA_NONE
	CAM_DIR_IN		= DMA_FROM_DEVICE,
	CAM_DIR_OUT		= DMA_TO_DEVICE,
	CAM_DIR_NONE		= DMA_NONE,
} ccb_flags;

#endif /* _AIC7XXX_CAM_H */
Loading