Commit 14658038 authored by Jody McIntyre's avatar Jody McIntyre

Christoph Hellwig: avoid obsolete scsi APIs in sbp2

Signed-off-by: default avatarJody McIntyre <scjody@modernduck.com>
parent 36c954a0
...@@ -64,7 +64,10 @@ ...@@ -64,7 +64,10 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
#include "../scsi/scsi.h" #include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include "csr1212.h" #include "csr1212.h"
...@@ -224,10 +227,10 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id ...@@ -224,10 +227,10 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
u32 status); u32 status);
static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
u32 scsi_status, Scsi_Cmnd *SCpnt, u32 scsi_status, struct scsi_cmnd *SCpnt,
void (*done)(Scsi_Cmnd *)); void (*done)(struct scsi_cmnd *));
static Scsi_Host_Template scsi_driver_template; static struct scsi_host_template scsi_driver_template;
const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xA, 0xB, 0xC }; const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xA, 0xB, 0xC };
...@@ -520,8 +523,8 @@ static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_ ...@@ -520,8 +523,8 @@ static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_
*/ */
static struct sbp2_command_info *sbp2util_allocate_command_orb( static struct sbp2_command_info *sbp2util_allocate_command_orb(
struct scsi_id_instance_data *scsi_id, struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *Current_SCpnt, struct scsi_cmnd *Current_SCpnt,
void (*Current_done)(Scsi_Cmnd *)) void (*Current_done)(struct scsi_cmnd *))
{ {
struct list_head *lh; struct list_head *lh;
struct sbp2_command_info *command = NULL; struct sbp2_command_info *command = NULL;
...@@ -1700,14 +1703,14 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, ...@@ -1700,14 +1703,14 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
unsigned int scsi_use_sg, unsigned int scsi_use_sg,
unsigned int scsi_request_bufflen, unsigned int scsi_request_bufflen,
void *scsi_request_buffer, void *scsi_request_buffer,
unsigned char scsi_dir) enum dma_data_direction dma_dir)
{ {
struct sbp2scsi_host_info *hi = scsi_id->hi; struct sbp2scsi_host_info *hi = scsi_id->hi;
struct scatterlist *sgpnt = (struct scatterlist *) scsi_request_buffer; struct scatterlist *sgpnt = (struct scatterlist *) scsi_request_buffer;
struct sbp2_command_orb *command_orb = &command->command_orb; struct sbp2_command_orb *command_orb = &command->command_orb;
struct sbp2_unrestricted_page_table *scatter_gather_element = struct sbp2_unrestricted_page_table *scatter_gather_element =
&command->scatter_gather_element[0]; &command->scatter_gather_element[0];
int dma_dir = scsi_to_pci_dma_dir (scsi_dir);
u32 sg_count, sg_len, orb_direction; u32 sg_count, sg_len, orb_direction;
dma_addr_t sg_addr; dma_addr_t sg_addr;
int i; int i;
...@@ -1730,22 +1733,22 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, ...@@ -1730,22 +1733,22 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
* Get the direction of the transfer. If the direction is unknown, then use our * Get the direction of the transfer. If the direction is unknown, then use our
* goofy table as a back-up. * goofy table as a back-up.
*/ */
switch (scsi_dir) { switch (dma_dir) {
case SCSI_DATA_NONE: case DMA_NONE:
orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER;
break; break;
case SCSI_DATA_WRITE: case DMA_TO_DEVICE:
orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA; orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA;
break; break;
case SCSI_DATA_READ: case DMA_FROM_DEVICE:
orb_direction = ORB_DIRECTION_READ_FROM_MEDIA; orb_direction = ORB_DIRECTION_READ_FROM_MEDIA;
break; break;
case SCSI_DATA_UNKNOWN: case DMA_BIDIRECTIONAL:
default: default:
SBP2_ERR("SCSI data transfer direction not specified. " SBP2_ERR("SCSI data transfer direction not specified. "
"Update the SBP2 direction table in sbp2.h if " "Update the SBP2 direction table in sbp2.h if "
"necessary for your application"); "necessary for your application");
print_command (scsi_cmd); __scsi_print_command(scsi_cmd);
orb_direction = sbp2scsi_direction_table[*scsi_cmd]; orb_direction = sbp2scsi_direction_table[*scsi_cmd];
break; break;
} }
...@@ -2031,7 +2034,8 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id, ...@@ -2031,7 +2034,8 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
* This function is called in order to begin a regular SBP-2 command. * This function is called in order to begin a regular SBP-2 command.
*/ */
static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) struct scsi_cmnd *SCpnt,
void (*done)(struct scsi_cmnd *))
{ {
unchar *cmd = (unchar *) SCpnt->cmnd; unchar *cmd = (unchar *) SCpnt->cmnd;
unsigned int request_bufflen = SCpnt->request_bufflen; unsigned int request_bufflen = SCpnt->request_bufflen;
...@@ -2040,7 +2044,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, ...@@ -2040,7 +2044,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
SBP2_DEBUG("sbp2_send_command"); SBP2_DEBUG("sbp2_send_command");
#if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) #if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP)
printk("[scsi command]\n "); printk("[scsi command]\n ");
print_command (cmd); scsi_print_command(SCpnt);
#endif #endif
SBP2_DEBUG("SCSI transfer size = %x", request_bufflen); SBP2_DEBUG("SCSI transfer size = %x", request_bufflen);
SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg); SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg);
...@@ -2233,7 +2237,7 @@ static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense ...@@ -2233,7 +2237,7 @@ static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense
* response data translations for the SCSI stack * response data translations for the SCSI stack
*/ */
static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *SCpnt) struct scsi_cmnd *SCpnt)
{ {
u8 *scsi_buf = SCpnt->request_buffer; u8 *scsi_buf = SCpnt->request_buffer;
u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun);
...@@ -2312,7 +2316,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest ...@@ -2312,7 +2316,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
struct sbp2scsi_host_info *hi; struct sbp2scsi_host_info *hi;
struct scsi_id_instance_data *scsi_id = NULL, *scsi_id_tmp; struct scsi_id_instance_data *scsi_id = NULL, *scsi_id_tmp;
u32 id; u32 id;
Scsi_Cmnd *SCpnt = NULL; struct scsi_cmnd *SCpnt = NULL;
u32 scsi_status = SBP2_SCSI_STATUS_GOOD; u32 scsi_status = SBP2_SCSI_STATUS_GOOD;
struct sbp2_command_info *command; struct sbp2_command_info *command;
...@@ -2454,7 +2458,8 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest ...@@ -2454,7 +2458,8 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
* This routine is the main request entry routine for doing I/O. It is * This routine is the main request entry routine for doing I/O. It is
* called from the scsi stack directly. * called from the scsi stack directly.
*/ */
static int sbp2scsi_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
void (*done)(struct scsi_cmnd *))
{ {
struct scsi_id_instance_data *scsi_id = struct scsi_id_instance_data *scsi_id =
(struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
...@@ -2550,9 +2555,8 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id ...@@ -2550,9 +2555,8 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
PCI_DMA_BIDIRECTIONAL); PCI_DMA_BIDIRECTIONAL);
sbp2util_mark_command_completed(scsi_id, command); sbp2util_mark_command_completed(scsi_id, command);
if (command->Current_SCpnt) { if (command->Current_SCpnt) {
void (*done)(Scsi_Cmnd *) = command->Current_done;
command->Current_SCpnt->result = status << 16; command->Current_SCpnt->result = status << 16;
done (command->Current_SCpnt); command->Current_done(command->Current_SCpnt);
} }
} }
...@@ -2565,8 +2569,8 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id ...@@ -2565,8 +2569,8 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
* This can be called in interrupt context. * This can be called in interrupt context.
*/ */
static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
u32 scsi_status, Scsi_Cmnd *SCpnt, u32 scsi_status, struct scsi_cmnd *SCpnt,
void (*done)(Scsi_Cmnd *)) void (*done)(struct scsi_cmnd *))
{ {
unsigned long flags; unsigned long flags;
...@@ -2611,8 +2615,8 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, ...@@ -2611,8 +2615,8 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
* Debug stuff * Debug stuff
*/ */
#if CONFIG_IEEE1394_SBP2_DEBUG >= 1 #if CONFIG_IEEE1394_SBP2_DEBUG >= 1
print_command (SCpnt->cmnd); scsi_print_command(SCpnt);
print_sense("bh", SCpnt); scsi_print_sense("bh", SCpnt);
#endif #endif
break; break;
...@@ -2620,7 +2624,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, ...@@ -2620,7 +2624,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: case SBP2_SCSI_STATUS_SELECTION_TIMEOUT:
SBP2_ERR("SBP2_SCSI_STATUS_SELECTION_TIMEOUT"); SBP2_ERR("SBP2_SCSI_STATUS_SELECTION_TIMEOUT");
SCpnt->result = DID_NO_CONNECT << 16; SCpnt->result = DID_NO_CONNECT << 16;
print_command (SCpnt->cmnd); scsi_print_command(SCpnt);
break; break;
case SBP2_SCSI_STATUS_CONDITION_MET: case SBP2_SCSI_STATUS_CONDITION_MET:
...@@ -2628,7 +2632,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, ...@@ -2628,7 +2632,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
case SBP2_SCSI_STATUS_COMMAND_TERMINATED: case SBP2_SCSI_STATUS_COMMAND_TERMINATED:
SBP2_ERR("Bad SCSI status = %x", scsi_status); SBP2_ERR("Bad SCSI status = %x", scsi_status);
SCpnt->result = DID_ERROR << 16; SCpnt->result = DID_ERROR << 16;
print_command (SCpnt->cmnd); scsi_print_command(SCpnt);
break; break;
default: default:
...@@ -2688,7 +2692,7 @@ static int sbp2scsi_slave_configure (struct scsi_device *sdev) ...@@ -2688,7 +2692,7 @@ static int sbp2scsi_slave_configure (struct scsi_device *sdev)
* Called by scsi stack when something has really gone wrong. Usually * Called by scsi stack when something has really gone wrong. Usually
* called when a command has timed-out for some reason. * called when a command has timed-out for some reason.
*/ */
static int sbp2scsi_abort (Scsi_Cmnd *SCpnt) static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
{ {
struct scsi_id_instance_data *scsi_id = struct scsi_id_instance_data *scsi_id =
(struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
...@@ -2696,7 +2700,7 @@ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt) ...@@ -2696,7 +2700,7 @@ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt)
struct sbp2_command_info *command; struct sbp2_command_info *command;
SBP2_ERR("aborting sbp2 command"); SBP2_ERR("aborting sbp2 command");
print_command (SCpnt->cmnd); scsi_print_command(SCpnt);
if (scsi_id) { if (scsi_id) {
...@@ -2717,9 +2721,8 @@ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt) ...@@ -2717,9 +2721,8 @@ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt)
PCI_DMA_BIDIRECTIONAL); PCI_DMA_BIDIRECTIONAL);
sbp2util_mark_command_completed(scsi_id, command); sbp2util_mark_command_completed(scsi_id, command);
if (command->Current_SCpnt) { if (command->Current_SCpnt) {
void (*done)(Scsi_Cmnd *) = command->Current_done;
command->Current_SCpnt->result = DID_ABORT << 16; command->Current_SCpnt->result = DID_ABORT << 16;
done (command->Current_SCpnt); command->Current_done(command->Current_SCpnt);
} }
} }
...@@ -2736,7 +2739,7 @@ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt) ...@@ -2736,7 +2739,7 @@ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt)
/* /*
* Called by scsi stack when something has really gone wrong. * Called by scsi stack when something has really gone wrong.
*/ */
static int sbp2scsi_reset (Scsi_Cmnd *SCpnt) static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
{ {
struct scsi_id_instance_data *scsi_id = struct scsi_id_instance_data *scsi_id =
(struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
...@@ -2789,7 +2792,7 @@ MODULE_SUPPORTED_DEVICE(SBP2_DEVICE_NAME); ...@@ -2789,7 +2792,7 @@ MODULE_SUPPORTED_DEVICE(SBP2_DEVICE_NAME);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* SCSI host template */ /* SCSI host template */
static Scsi_Host_Template scsi_driver_template = { static struct scsi_host_template scsi_driver_template = {
.module = THIS_MODULE, .module = THIS_MODULE,
.name = "SBP-2 IEEE-1394", .name = "SBP-2 IEEE-1394",
.proc_name = SBP2_DEVICE_NAME, .proc_name = SBP2_DEVICE_NAME,
......
...@@ -324,8 +324,8 @@ struct sbp2_command_info { ...@@ -324,8 +324,8 @@ struct sbp2_command_info {
struct list_head list; struct list_head list;
struct sbp2_command_orb command_orb ____cacheline_aligned; struct sbp2_command_orb command_orb ____cacheline_aligned;
dma_addr_t command_orb_dma ____cacheline_aligned; dma_addr_t command_orb_dma ____cacheline_aligned;
Scsi_Cmnd *Current_SCpnt; struct scsi_cmnd *Current_SCpnt;
void (*Current_done)(Scsi_Cmnd *); void (*Current_done)(struct scsi_cmnd *);
/* Also need s/g structure for each sbp2 command */ /* Also need s/g structure for each sbp2 command */
struct sbp2_unrestricted_page_table scatter_gather_element[SG_ALL] ____cacheline_aligned; struct sbp2_unrestricted_page_table scatter_gather_element[SG_ALL] ____cacheline_aligned;
...@@ -434,8 +434,8 @@ static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_ ...@@ -434,8 +434,8 @@ static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_
static struct sbp2_command_info *sbp2util_find_command_for_orb(struct scsi_id_instance_data *scsi_id, dma_addr_t orb); static struct sbp2_command_info *sbp2util_find_command_for_orb(struct scsi_id_instance_data *scsi_id, dma_addr_t orb);
static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt); static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt);
static struct sbp2_command_info *sbp2util_allocate_command_orb(struct scsi_id_instance_data *scsi_id, static struct sbp2_command_info *sbp2util_allocate_command_orb(struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *Current_SCpnt, struct scsi_cmnd *Current_SCpnt,
void (*Current_done)(Scsi_Cmnd *)); void (*Current_done)(struct scsi_cmnd *));
static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id, static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command); struct sbp2_command_info *command);
...@@ -466,14 +466,16 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, ...@@ -466,14 +466,16 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
unsigned int scsi_use_sg, unsigned int scsi_use_sg,
unsigned int scsi_request_bufflen, unsigned int scsi_request_bufflen,
void *scsi_request_buffer, void *scsi_request_buffer,
unsigned char scsi_dir); enum dma_data_direction dma_dir);
static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id, static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command); struct sbp2_command_info *command);
static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)); struct scsi_cmnd *SCpnt,
void (*done)(struct scsi_cmnd *));
static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data); static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data);
static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd); static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd);
static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, Scsi_Cmnd *SCpnt); static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
struct scsi_cmnd *SCpnt);
static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
struct unit_directory *ud); struct unit_directory *ud);
static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id); static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id);
......
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