Commit f354a51a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[PATCH] avoiding obsolete scsi APIs in dc395

replace obsolete typedefs and scsi_to_pci_dma_dir, use proper includes
and re-order includes correctly.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 576d6618
...@@ -51,16 +51,20 @@ ...@@ -51,16 +51,20 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <asm/io.h>
#include "scsi.h"
#include <scsi/scsi_host.h>
#include "dc395x.h"
#include <scsi/scsicam.h> /* needed for scsicam_bios_param */
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/list.h> #include <linux/list.h>
#include <asm/io.h>
#include <scsi/scsi.h>
#include <scsi/scsicam.h> /* needed for scsicam_bios_param */
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include "dc395x.h"
#define DC395X_NAME "dc395x" #define DC395X_NAME "dc395x"
#define DC395X_BANNER "Tekram DC395(U/UW/F), DC315(U) - ASIC TRM-S1040" #define DC395X_BANNER "Tekram DC395(U/UW/F), DC315(U) - ASIC TRM-S1040"
...@@ -222,7 +226,7 @@ struct NvRamType { ...@@ -222,7 +226,7 @@ struct NvRamType {
struct ScsiReqBlk { struct ScsiReqBlk {
struct list_head list; /* next/prev ptrs for srb lists */ struct list_head list; /* next/prev ptrs for srb lists */
struct DeviceCtlBlk *dcb; struct DeviceCtlBlk *dcb;
Scsi_Cmnd *cmd; struct scsi_cmnd *cmd;
struct SGentry *segment_x; /* Linear array of hw sg entries (up to 64 entries) */ struct SGentry *segment_x; /* Linear array of hw sg entries (up to 64 entries) */
u32 sg_bus_addr; /* Bus address of sg list (ie, of segment_x) */ u32 sg_bus_addr; /* Bus address of sg list (ie, of segment_x) */
...@@ -372,10 +376,10 @@ static void disconnect(struct AdapterCtlBlk *acb); ...@@ -372,10 +376,10 @@ static void disconnect(struct AdapterCtlBlk *acb);
static void reselect(struct AdapterCtlBlk *acb); static void reselect(struct AdapterCtlBlk *acb);
static u8 start_scsi(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, static u8 start_scsi(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
struct ScsiReqBlk *srb); struct ScsiReqBlk *srb);
static void build_srb(Scsi_Cmnd *cmd, struct DeviceCtlBlk *dcb, static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
struct ScsiReqBlk *srb); struct ScsiReqBlk *srb);
static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_code, static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_code,
Scsi_Cmnd *cmd, u8 force); struct scsi_cmnd *cmd, u8 force);
static void scsi_reset_detect(struct AdapterCtlBlk *acb); static void scsi_reset_detect(struct AdapterCtlBlk *acb);
static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb); static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb);
static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb, static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb,
...@@ -738,7 +742,7 @@ static void free_tag(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) ...@@ -738,7 +742,7 @@ static void free_tag(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb)
/* Find cmd in SRB list */ /* Find cmd in SRB list */
inline static struct ScsiReqBlk *find_cmd(Scsi_Cmnd *cmd, inline static struct ScsiReqBlk *find_cmd(struct scsi_cmnd *cmd,
struct list_head *head) struct list_head *head)
{ {
struct ScsiReqBlk *i; struct ScsiReqBlk *i;
...@@ -973,10 +977,10 @@ static void send_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) ...@@ -973,10 +977,10 @@ static void send_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
/* Prepare SRB for being sent to Device DCB w/ command *cmd */ /* Prepare SRB for being sent to Device DCB w/ command *cmd */
static void build_srb(Scsi_Cmnd *cmd, struct DeviceCtlBlk *dcb, static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
struct ScsiReqBlk *srb) struct ScsiReqBlk *srb)
{ {
int dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); enum dma_data_direction dir = cmd->sc_data_direction;
dprintkdbg(DBG_0, "build_srb: (pid#%li) <%02i-%i>\n", dprintkdbg(DBG_0, "build_srb: (pid#%li) <%02i-%i>\n",
cmd->pid, dcb->target_id, dcb->target_lun); cmd->pid, dcb->target_id, dcb->target_lun);
...@@ -1089,7 +1093,7 @@ static void build_srb(Scsi_Cmnd *cmd, struct DeviceCtlBlk *dcb, ...@@ -1089,7 +1093,7 @@ static void build_srb(Scsi_Cmnd *cmd, struct DeviceCtlBlk *dcb,
* and is expected to be held on return. * and is expected to be held on return.
* *
**/ **/
static int dc395x_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) static int dc395x_queue_command(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
{ {
struct DeviceCtlBlk *dcb; struct DeviceCtlBlk *dcb;
struct ScsiReqBlk *srb; struct ScsiReqBlk *srb;
...@@ -1304,7 +1308,7 @@ static void reset_dev_param(struct AdapterCtlBlk *acb) ...@@ -1304,7 +1308,7 @@ static void reset_dev_param(struct AdapterCtlBlk *acb)
* @cmd - some command for this host (for fetching hooks) * @cmd - some command for this host (for fetching hooks)
* Returns: SUCCESS (0x2002) on success, else FAILED (0x2003). * Returns: SUCCESS (0x2002) on success, else FAILED (0x2003).
*/ */
static int dc395x_eh_bus_reset(Scsi_Cmnd *cmd) static int dc395x_eh_bus_reset(struct scsi_cmnd *cmd)
{ {
struct AdapterCtlBlk *acb = struct AdapterCtlBlk *acb =
(struct AdapterCtlBlk *)cmd->device->host->hostdata; (struct AdapterCtlBlk *)cmd->device->host->hostdata;
...@@ -1356,7 +1360,7 @@ static int dc395x_eh_bus_reset(Scsi_Cmnd *cmd) ...@@ -1356,7 +1360,7 @@ static int dc395x_eh_bus_reset(Scsi_Cmnd *cmd)
* @cmd - command to be aborted * @cmd - command to be aborted
* Returns: SUCCESS (0x2002) on success, else FAILED (0x2003). * Returns: SUCCESS (0x2002) on success, else FAILED (0x2003).
*/ */
static int dc395x_eh_abort(Scsi_Cmnd *cmd) static int dc395x_eh_abort(struct scsi_cmnd *cmd)
{ {
/* /*
* Look into our command queues: If it has not been sent already, * Look into our command queues: If it has not been sent already,
...@@ -1939,7 +1943,7 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left) ...@@ -1939,7 +1943,7 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
{ {
u8 idx; u8 idx;
struct scatterlist *sg; struct scatterlist *sg;
Scsi_Cmnd *cmd = srb->cmd; struct scsi_cmnd *cmd = srb->cmd;
int segment = cmd->use_sg; int segment = cmd->use_sg;
u32 xferred = srb->total_xfer_length - left; /* bytes transfered */ u32 xferred = srb->total_xfer_length - left; /* bytes transfered */
struct SGentry *psge = srb->segment_x + srb->sg_index; struct SGentry *psge = srb->segment_x + srb->sg_index;
...@@ -3249,8 +3253,8 @@ static void add_dev(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, ...@@ -3249,8 +3253,8 @@ static void add_dev(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
/* unmap mapped pci regions from SRB */ /* unmap mapped pci regions from SRB */
static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
{ {
Scsi_Cmnd *cmd = srb->cmd; struct scsi_cmnd *cmd = srb->cmd;
int dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); enum dma_data_direction dir = cmd->sc_data_direction;
if (cmd->use_sg && dir != PCI_DMA_NONE) { if (cmd->use_sg && dir != PCI_DMA_NONE) {
/* unmap DC395x SG list */ /* unmap DC395x SG list */
dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n", dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n",
...@@ -3301,11 +3305,10 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, ...@@ -3301,11 +3305,10 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
struct ScsiReqBlk *srb) struct ScsiReqBlk *srb)
{ {
u8 tempcnt, status; u8 tempcnt, status;
Scsi_Cmnd *cmd = srb->cmd; struct scsi_cmnd *cmd = srb->cmd;
struct ScsiInqData *ptr; struct ScsiInqData *ptr;
int dir; enum dma_data_direction dir = cmd->sc_data_direction;
dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
if (cmd->use_sg) { if (cmd->use_sg) {
struct scatterlist* sg = (struct scatterlist *)cmd->request_buffer; struct scatterlist* sg = (struct scatterlist *)cmd->request_buffer;
ptr = (struct ScsiInqData *)(page_address(sg->page) + sg->offset); ptr = (struct ScsiInqData *)(page_address(sg->page) + sg->offset);
...@@ -3510,7 +3513,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, ...@@ -3510,7 +3513,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
/* abort all cmds in our queues */ /* abort all cmds in our queues */
static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,
Scsi_Cmnd *cmd, u8 force) struct scsi_cmnd *cmd, u8 force)
{ {
struct DeviceCtlBlk *dcb; struct DeviceCtlBlk *dcb;
dprintkl(KERN_INFO, "doing_srb_done: pids "); dprintkl(KERN_INFO, "doing_srb_done: pids ");
...@@ -3518,14 +3521,14 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, ...@@ -3518,14 +3521,14 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,
list_for_each_entry(dcb, &acb->dcb_list, list) { list_for_each_entry(dcb, &acb->dcb_list, list) {
struct ScsiReqBlk *srb; struct ScsiReqBlk *srb;
struct ScsiReqBlk *tmp; struct ScsiReqBlk *tmp;
Scsi_Cmnd *p; struct scsi_cmnd *p;
list_for_each_entry_safe(srb, tmp, &dcb->srb_going_list, list) { list_for_each_entry_safe(srb, tmp, &dcb->srb_going_list, list) {
enum dma_data_direction dir;
int result; int result;
int dir;
p = srb->cmd; p = srb->cmd;
dir = scsi_to_pci_dma_dir(p->sc_data_direction); dir = p->sc_data_direction;
result = MK_RES(0, did_flag, 0, 0); result = MK_RES(0, did_flag, 0, 0);
printk("G:%li(%02i-%i) ", p->pid, printk("G:%li(%02i-%i) ", p->pid,
p->device->id, p->device->lun); p->device->id, p->device->lun);
...@@ -3665,7 +3668,7 @@ static void scsi_reset_detect(struct AdapterCtlBlk *acb) ...@@ -3665,7 +3668,7 @@ static void scsi_reset_detect(struct AdapterCtlBlk *acb)
static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
struct ScsiReqBlk *srb) struct ScsiReqBlk *srb)
{ {
Scsi_Cmnd *cmd = srb->cmd; struct scsi_cmnd *cmd = srb->cmd;
dprintkdbg(DBG_1, "request_sense: (pid#%li) <%02i-%i>\n", dprintkdbg(DBG_1, "request_sense: (pid#%li) <%02i-%i>\n",
cmd->pid, cmd->device->id, cmd->device->lun); cmd->pid, cmd->device->id, cmd->device->lun);
...@@ -4738,7 +4741,7 @@ static int dc395x_proc_info(struct Scsi_Host *host, char *buffer, ...@@ -4738,7 +4741,7 @@ static int dc395x_proc_info(struct Scsi_Host *host, char *buffer,
} }
static Scsi_Host_Template dc395x_driver_template = { static struct scsi_host_template dc395x_driver_template = {
.module = THIS_MODULE, .module = THIS_MODULE,
.proc_name = DC395X_NAME, .proc_name = DC395X_NAME,
.proc_info = dc395x_proc_info, .proc_info = dc395x_proc_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment