Commit b7c36ad9 authored by James Bottomley's avatar James Bottomley

Merge mulgrave.(none):/home/jejb/BK/scsi-misc-2.5

into mulgrave.(none):/home/jejb/BK/scsi-misc-new-2.5
parents 5be2bc3c ffd91b2f
......@@ -115,6 +115,9 @@ simscsi_detect (Scsi_Host_Template *templ)
{
templ->proc_name = "simscsi";
host = scsi_register(templ, 0);
if(host == NULL)
return 0;
return 1; /* fake one SCSI host adapter */
}
......
......@@ -204,6 +204,9 @@ static int aac_detect(Scsi_Host_Template *template)
* specific information.
*/
host_ptr = scsi_register( template, sizeof(struct aac_dev) );
if(host_ptr == NULL)
continue;
/*
* These three parameters can be used to allow for wide SCSI
* and for host adapters that support multiple buses.
......
......@@ -3991,6 +3991,9 @@ GDTH_INITFUNC(int, gdth_detect(Scsi_Host_Template *shtp))
break;
if (gdth_search_isa(isa_bios)) { /* controller found */
shp = scsi_register(shtp,sizeof(gdth_ext_str));
if(shp == NULL)
continue;
ha = HADATA(shp);
if (!gdth_init_isa(isa_bios,ha)) {
scsi_unregister(shp);
......@@ -4105,6 +4108,9 @@ GDTH_INITFUNC(int, gdth_detect(Scsi_Host_Template *shtp))
break;
if (gdth_search_eisa(eisa_slot)) { /* controller found */
shp = scsi_register(shtp,sizeof(gdth_ext_str));
if(shp == NULL)
continue;
ha = HADATA(shp);
if (!gdth_init_eisa(eisa_slot,ha)) {
scsi_unregister(shp);
......@@ -4214,6 +4220,9 @@ GDTH_INITFUNC(int, gdth_detect(Scsi_Host_Template *shtp))
if (gdth_ctr_count >= MAXHA)
break;
shp = scsi_register(shtp,sizeof(gdth_ext_str));
if(shp == NULL)
continue;
ha = HADATA(shp);
if (!gdth_init_pci(&pcistr[ctr],ha)) {
scsi_unregister(shp);
......
......@@ -51,6 +51,7 @@ static spinlock_t scsi_host_list_lock = SPIN_LOCK_UNLOCKED;
static int scsi_host_next_hn; /* host_no for next new host */
static int scsi_hosts_registered; /* cnt of registered scsi hosts */
static int scsi_ignore_no_error_handling = 0;
/**
* scsi_tp_for_each_host - call function for each scsi host off a template
......@@ -345,6 +346,22 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
int gfp_mask;
DECLARE_MUTEX_LOCKED(sem);
/*
* Determine host number. Check reserved first before allocating
* new one
*/
hname = (shost_tp->proc_name) ? shost_tp->proc_name : "";
hname_len = strlen(hname);
/* Check to see if this host has any error handling facilities */
if(shost_tp->eh_strategy_handler == NULL &&
shost_tp->eh_abort_handler == NULL &&
shost_tp->eh_device_reset_handler == NULL &&
shost_tp->eh_bus_reset_handler == NULL &&
shost_tp->eh_host_reset_handler == NULL) {
printk(KERN_ERR "ERROR: SCSI host `%s' has no error handling\nERROR: This is not a safe way to run your SCSI host\nERROR: The error handling must be added to this driver\n", hname);
dump_stack();
}
gfp_mask = GFP_KERNEL;
if (shost_tp->unchecked_isa_dma && xtr_bytes)
gfp_mask |= __GFP_DMA;
......@@ -357,13 +374,6 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
memset(shost, 0, sizeof(struct Scsi_Host) + xtr_bytes);
/*
* Determine host number. Check reserved first before allocating
* new one
*/
hname = (shost_tp->proc_name) ? shost_tp->proc_name : "";
hname_len = strlen(hname);
if (hname_len)
list_for_each(lh, &scsi_host_hn_list) {
shn = list_entry(lh, Scsi_Host_Name, shn_list);
......
......@@ -53,8 +53,6 @@
* type of host adapter that is supported on the system.
*/
typedef struct scsi_disk Disk;
typedef struct SHT
{
/* Used with loadable modules so that we know when it is safe to unload */
......@@ -515,13 +513,6 @@ extern void scsi_proc_host_mkdir(Scsi_Host_Template *);
extern void scsi_proc_host_add(struct Scsi_Host *);
extern void scsi_proc_host_rm(struct Scsi_Host *);
/*
* scsi_init initializes the scsi hosts.
*/
extern int next_scsi_host;
unsigned int scsi_init(void);
extern void scsi_register_blocked_host(struct Scsi_Host *);
extern void scsi_deregister_blocked_host(struct Scsi_Host *);
......@@ -543,10 +534,6 @@ static inline void scsi_set_pci_device(struct Scsi_Host *shost,
*/
extern void scan_scsis(struct Scsi_Host *, uint, uint, uint, uint);
extern void scsi_mark_host_reset(struct Scsi_Host *);
#define BLANK_HOST {"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
struct Scsi_Device_Template
{
struct Scsi_Device_Template * next;
......@@ -554,7 +541,6 @@ struct Scsi_Device_Template
const char * tag;
struct module * module; /* Used for loadable modules */
unsigned char scsi_type;
int (*detect)(Scsi_Device *); /* Returns 1 if we can attach this device */
int (*attach)(Scsi_Device *); /* Attach devices to arrays */
void (*detach)(Scsi_Device *);
int (*init_command)(Scsi_Cmnd *); /* Used by new queueing code.
......
......@@ -153,10 +153,8 @@ static int osst_copy_from_buffer(OSST_buffer *, unsigned char *);
static int osst_init(void);
static int osst_attach(Scsi_Device *);
static int osst_detect(Scsi_Device *);
static void osst_detach(Scsi_Device *);
static int osst_dev_noticed;
static int osst_nr_dev;
static int osst_dev_max;
......@@ -166,7 +164,6 @@ struct Scsi_Device_Template osst_template =
name: "OnStream tape",
tag: "osst",
scsi_type: TYPE_TAPE,
detect: osst_detect,
attach: osst_attach,
detach: osst_detach
};
......@@ -5564,15 +5561,6 @@ static int osst_attach(Scsi_Device * SDp)
return 0;
};
static int osst_detect(Scsi_Device * SDp)
{
if (SDp->type != TYPE_TAPE) return 0;
if ( ! osst_supports(SDp) ) return 0;
osst_dev_noticed++;
return 1;
}
static int osst_registered = 0;
/* Driver initialization (not __initfunc because may be called later) */
......@@ -5580,9 +5568,6 @@ static int osst_init()
{
int i;
if (osst_dev_noticed == 0)
return 0;
if (!osst_registered) {
if (register_chrdev(MAJOR_NR,"osst",&osst_fops)) {
printk(KERN_ERR "osst :W: Unable to get major %d for OnStream tapes\n",MAJOR_NR);
......@@ -5653,7 +5638,6 @@ static void osst_detach(Scsi_Device * SDp)
os_scsi_tapes[i] = NULL;
scsi_slave_detach(SDp);
osst_nr_dev--;
osst_dev_noticed--;
return;
}
}
......
......@@ -1224,6 +1224,9 @@ static int nsp_detect(Scsi_Host_Template *sht)
request_region(data->BaseAddress, data->NumAddress, "nsp_cs");
host = scsi_register(sht, 0);
if(host == NULL)
return 0;
host->unique_id = data->BaseAddress;
host->io_port = data->BaseAddress;
host->n_io_port = data->NumAddress;
......
......@@ -226,6 +226,8 @@ void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt)
if (!SHpnt->use_clustering)
clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
blk_queue_prep_rq(q, scsi_prep_fn);
}
#ifdef MODULE
......@@ -1958,17 +1960,6 @@ static int proc_scsi_gen_write(struct file * file, const char * buf,
}
#endif
void scsi_detect_device(struct scsi_device *sdev)
{
struct Scsi_Device_Template *sdt;
down_read(&scsi_devicelist_mutex);
for (sdt = scsi_devicelist; sdt; sdt = sdt->next)
if (sdt->detect)
(*sdt->detect)(sdev);
up_read(&scsi_devicelist_mutex);
}
int scsi_attach_device(struct scsi_device *sdev)
{
struct Scsi_Device_Template *sdt;
......@@ -2089,22 +2080,6 @@ int scsi_register_device(struct Scsi_Device_Template *tpnt)
driver_register(&tpnt->scsi_driverfs_driver);
/*
* First scan the devices that we know about, and see if we notice them.
*/
for (shpnt = scsi_host_get_next(NULL); shpnt;
shpnt = scsi_host_get_next(shpnt)) {
for (SDpnt = shpnt->host_queue; SDpnt;
SDpnt = SDpnt->next) {
if (tpnt->detect)
(*tpnt->detect) (SDpnt);
}
}
/*
* Now actually connect the devices to the new driver.
*/
for (shpnt = scsi_host_get_next(NULL); shpnt;
shpnt = scsi_host_get_next(shpnt)) {
for (SDpnt = shpnt->host_queue; SDpnt;
......
......@@ -404,15 +404,7 @@ typedef struct scsi_request Scsi_Request;
* Here is where we prototype most of the mid-layer.
*/
/*
* Initializes all SCSI devices. This scans all scsi busses.
*/
extern unsigned int scsi_logging_level; /* What do we log? */
extern unsigned int scsi_dma_free_sectors; /* How much room do we have left */
extern unsigned int scsi_need_isa_buffer; /* True if some devices need indirection
* buffers */
extern volatile int in_scan_scsis;
extern struct bus_type scsi_driverfs_bus_type;
......@@ -455,6 +447,7 @@ extern int scsi_insert_special_cmd(Scsi_Cmnd * SCpnt, int);
extern void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
int block_sectors);
extern void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt);
extern int scsi_prep_fn(struct request_queue *q, struct request *req);
extern void scsi_request_fn(request_queue_t * q);
extern int scsi_starvation_completion(Scsi_Device * SDpnt);
......@@ -480,7 +473,6 @@ extern void scsi_do_cmd(Scsi_Cmnd *, const void *cmnd,
int timeout, int retries);
extern int scsi_dev_init(void);
extern int scsi_mlqueue_insert(struct scsi_cmnd *, int);
extern void scsi_detect_device(struct scsi_device *);
extern int scsi_attach_device(struct scsi_device *);
extern void scsi_detach_device(struct scsi_device *);
......@@ -500,12 +492,6 @@ extern void scsi_do_req(Scsi_Request *, const void *cmnd,
extern int scsi_insert_special_req(Scsi_Request * SRpnt, int);
extern void scsi_init_cmd_from_req(Scsi_Cmnd *, Scsi_Request *);
/*
* Prototypes for functions/data in hosts.c
*/
extern int max_scsi_hosts;
/*
* Prototypes for functions in scsi_proc.c
*/
......@@ -837,25 +823,6 @@ struct scsi_cmnd {
#define SCSI_MLQUEUE_HOST_BUSY 0x1055
#define SCSI_MLQUEUE_DEVICE_BUSY 0x1056
#define SCSI_SLEEP(QUEUE, CONDITION) { \
if (CONDITION) { \
DECLARE_WAITQUEUE(wait, current); \
add_wait_queue(QUEUE, &wait); \
for(;;) { \
set_current_state(TASK_UNINTERRUPTIBLE); \
if (CONDITION) { \
if (in_interrupt()) \
panic("scsi: trying to call schedule() in interrupt" \
", file %s, line %d.\n", __FILE__, __LINE__); \
schedule(); \
} \
else \
break; \
} \
remove_wait_queue(QUEUE, &wait);\
current->state = TASK_RUNNING; \
}; }
/*
* old style reset request from external source
* (private to sg.c and scsi_error.c, supplied by scsi_obsolete.c)
......
This diff is collapsed.
#ifndef _SCSI_DEBUG_H
#include <linux/types.h>
#include <linux/kdev_t.h>
static int scsi_debug_detect(struct SHT *);
static int scsi_debug_slave_attach(struct scsi_device *);
static void scsi_debug_slave_detach(struct scsi_device *);
static int scsi_debug_release(struct Scsi_Host *);
/* static int scsi_debug_command(struct scsi_cmnd *); */
static int scsi_debug_queuecommand(struct scsi_cmnd *,
void (*done) (struct scsi_cmnd *));
static int scsi_debug_ioctl(struct scsi_device *, int, void *);
......@@ -20,10 +16,6 @@ static int scsi_debug_host_reset(struct scsi_cmnd *);
static int scsi_debug_proc_info(char *, char **, off_t, int, int, int);
static const char * scsi_debug_info(struct Scsi_Host *);
#ifndef NULL
#define NULL 0
#endif
/*
* This driver is written for the lk 2.5 series
*/
......@@ -31,14 +23,12 @@ static const char * scsi_debug_info(struct Scsi_Host *);
#define SCSI_DEBUG_MAX_CMD_LEN 16
static Scsi_Host_Template driver_template = {
static Scsi_Host_Template sdebug_driver_template = {
.proc_info = scsi_debug_proc_info,
.name = "SCSI DEBUG",
.info = scsi_debug_info,
.detect = scsi_debug_detect,
.slave_attach = scsi_debug_slave_attach,
.slave_detach = scsi_debug_slave_detach,
.release = scsi_debug_release,
.ioctl = scsi_debug_ioctl,
.queuecommand = scsi_debug_queuecommand,
.eh_abort_handler = scsi_debug_abort,
......@@ -50,8 +40,9 @@ static Scsi_Host_Template driver_template = {
.this_id = 7,
.sg_tablesize = 64,
.cmd_per_lun = 3,
.max_sectors = 4096,
.unchecked_isa_dma = 0,
.use_clustering = ENABLE_CLUSTERING,
}; /* the name 'driver_template' is used by scsi_module.c */
};
#endif
......@@ -177,8 +177,7 @@ void scsi_times_out(Scsi_Cmnd *scmd)
**/
int scsi_block_when_processing_errors(Scsi_Device *sdev)
{
SCSI_SLEEP(&sdev->host->host_wait, sdev->host->in_recovery);
wait_event(sdev->host->host_wait, (sdev->host->in_recovery == 0));
SCSI_LOG_ERROR_RECOVERY(5, printk("%s: rtn: %d\n", __FUNCTION__,
sdev->online));
......
This diff is collapsed.
This diff is collapsed.
......@@ -1478,8 +1478,6 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
* function */
sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
scsi_detect_device(sdev);
if (sdevnew != NULL)
*sdevnew = sdev;
......
......@@ -94,7 +94,6 @@ static void sd_init_onedisk(struct scsi_disk * sdkp, struct gendisk *disk);
static void sd_rw_intr(struct scsi_cmnd * SCpnt);
static int sd_attach(struct scsi_device *);
static int sd_detect(struct scsi_device *);
static void sd_detach(struct scsi_device *);
static int sd_init_command(struct scsi_cmnd *);
static int sd_synchronize_cache(struct scsi_disk *, int);
......@@ -107,7 +106,6 @@ static struct Scsi_Device_Template sd_template = {
.name = "disk",
.tag = "sd",
.scsi_type = TYPE_DISK,
.detect = sd_detect,
.attach = sd_attach,
.detach = sd_detach,
.init_command = sd_init_command,
......@@ -758,7 +756,6 @@ static void
sd_spinup_disk(struct scsi_disk *sdkp, char *diskname,
struct scsi_request *SRpnt, unsigned char *buffer) {
unsigned char cmd[10];
struct scsi_device *sdp = sdkp->device;
unsigned long spintime_value = 0;
int the_result, retries, spintime;
......@@ -1165,23 +1162,6 @@ sd_init_onedisk(struct scsi_disk * sdkp, struct gendisk *disk)
kfree(buffer);
}
/**
* sd_detect - called at the start of driver initialization, once
* for each scsi device (not just disks) present.
*
* Returns 0 if not interested in this scsi device (e.g. scanner);
* 1 if this device is of interest (e.g. a disk).
*
* Note: this function is invoked from the scsi mid-level.
**/
static int sd_detect(struct scsi_device * sdp)
{
SCSI_LOG_HLQUEUE(3, printk("sd_detect: type=%d\n", sdp->type));
if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD)
return 0;
return 1;
}
/**
* sd_attach - called during driver initialization and whenever a
* new scsi device is attached to the system. It is called once
......
......@@ -111,7 +111,6 @@ static int sg_allow_dio = SG_ALLOW_DIO_DEF;
#define SG_DEV_ARR_LUMP 6 /* amount to over allocate sg_dev_arr by */
static int sg_attach(Scsi_Device *);
static int sg_detect(Scsi_Device *);
static void sg_detach(Scsi_Device *);
static Scsi_Request *dummy_cmdp; /* only used for sizeof */
......@@ -124,7 +123,6 @@ static struct Scsi_Device_Template sg_template = {
.name = "generic",
.tag = "sg",
.scsi_type = 0xff,
.detect = sg_detect,
.attach = sg_attach,
.detach = sg_detach
};
......@@ -233,7 +231,6 @@ static int sg_last_dev(void);
#endif
static Sg_device **sg_dev_arr = NULL;
static int sg_dev_noticed;
static int sg_dev_max;
static int sg_nr_dev;
......@@ -1338,13 +1335,6 @@ static struct file_operations sg_fops = {
.fasync = sg_fasync,
};
static int
sg_detect(Scsi_Device * scsidp)
{
sg_dev_noticed++;
return 1;
}
#ifndef MODULE
static int __init
sg_def_reserved_size_setup(char *str)
......@@ -1563,7 +1553,6 @@ sg_detach(Scsi_Device * scsidp)
}
scsi_slave_detach(scsidp);
sg_nr_dev--;
sg_dev_noticed--; /* from <dan@lectra.fr> */
break;
}
write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
......
......@@ -66,7 +66,6 @@ MODULE_PARM(xa_test, "i"); /* see sr_ioctl.c */
CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_GENERIC_PACKET)
static int sr_attach(struct scsi_device *);
static int sr_detect(struct scsi_device *);
static void sr_detach(struct scsi_device *);
static int sr_init_command(struct scsi_cmnd *);
......@@ -75,7 +74,6 @@ static struct Scsi_Device_Template sr_template = {
.name = "cdrom",
.tag = "sr",
.scsi_type = TYPE_ROM,
.detect = sr_detect,
.attach = sr_attach,
.detach = sr_detach,
.init_command = sr_init_command
......@@ -489,14 +487,6 @@ static int sr_open(struct cdrom_device_info *cdi, int purpose)
return 0;
}
static int sr_detect(struct scsi_device * SDp)
{
if (SDp->type != TYPE_ROM && SDp->type != TYPE_WORM)
return 0;
return 1;
}
static int sr_attach(struct scsi_device *sdev)
{
struct gendisk *disk;
......
......@@ -170,7 +170,6 @@ static int sgl_map_user_pages(struct scatterlist *, const unsigned int,
static int sgl_unmap_user_pages(struct scatterlist *, const unsigned int, int);
static int st_attach(Scsi_Device *);
static int st_detect(Scsi_Device *);
static void st_detach(Scsi_Device *);
static struct Scsi_Device_Template st_template = {
......@@ -178,7 +177,6 @@ static struct Scsi_Device_Template st_template = {
.name = "tape",
.tag = "st",
.scsi_type = TYPE_TAPE,
.detect = st_detect,
.attach = st_attach,
.detach = st_detach
};
......@@ -3885,13 +3883,6 @@ static int st_attach(Scsi_Device * SDp)
return 0;
};
static int st_detect(Scsi_Device * SDp)
{
if (SDp->type != TYPE_TAPE || st_incompatible(SDp))
return 0;
return 1;
}
static void st_detach(Scsi_Device * SDp)
{
Scsi_Tape *tpnt;
......
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