Commit 1d12ef0d authored by James Bottomley's avatar James Bottomley

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

into mulgrave.(none):/home/jejb/BK/scsi-misc-2.5
parents 90a8d4f3 4e5ba3ff
...@@ -554,7 +554,6 @@ struct Scsi_Device_Template ...@@ -554,7 +554,6 @@ struct Scsi_Device_Template
const char * tag; const char * tag;
struct module * module; /* Used for loadable modules */ struct module * module; /* Used for loadable modules */
unsigned char scsi_type; unsigned char scsi_type;
int (*detect)(Scsi_Device *); /* Returns 1 if we can attach this device */
int (*attach)(Scsi_Device *); /* Attach devices to arrays */ int (*attach)(Scsi_Device *); /* Attach devices to arrays */
void (*detach)(Scsi_Device *); void (*detach)(Scsi_Device *);
int (*init_command)(Scsi_Cmnd *); /* Used by new queueing code. int (*init_command)(Scsi_Cmnd *); /* Used by new queueing code.
......
...@@ -153,10 +153,8 @@ static int osst_copy_from_buffer(OSST_buffer *, unsigned char *); ...@@ -153,10 +153,8 @@ static int osst_copy_from_buffer(OSST_buffer *, unsigned char *);
static int osst_init(void); static int osst_init(void);
static int osst_attach(Scsi_Device *); static int osst_attach(Scsi_Device *);
static int osst_detect(Scsi_Device *);
static void osst_detach(Scsi_Device *); static void osst_detach(Scsi_Device *);
static int osst_dev_noticed;
static int osst_nr_dev; static int osst_nr_dev;
static int osst_dev_max; static int osst_dev_max;
...@@ -166,7 +164,6 @@ struct Scsi_Device_Template osst_template = ...@@ -166,7 +164,6 @@ struct Scsi_Device_Template osst_template =
name: "OnStream tape", name: "OnStream tape",
tag: "osst", tag: "osst",
scsi_type: TYPE_TAPE, scsi_type: TYPE_TAPE,
detect: osst_detect,
attach: osst_attach, attach: osst_attach,
detach: osst_detach detach: osst_detach
}; };
...@@ -5564,15 +5561,6 @@ static int osst_attach(Scsi_Device * SDp) ...@@ -5564,15 +5561,6 @@ static int osst_attach(Scsi_Device * SDp)
return 0; 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; static int osst_registered = 0;
/* Driver initialization (not __initfunc because may be called later) */ /* Driver initialization (not __initfunc because may be called later) */
...@@ -5580,9 +5568,6 @@ static int osst_init() ...@@ -5580,9 +5568,6 @@ static int osst_init()
{ {
int i; int i;
if (osst_dev_noticed == 0)
return 0;
if (!osst_registered) { if (!osst_registered) {
if (register_chrdev(MAJOR_NR,"osst",&osst_fops)) { if (register_chrdev(MAJOR_NR,"osst",&osst_fops)) {
printk(KERN_ERR "osst :W: Unable to get major %d for OnStream tapes\n",MAJOR_NR); 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) ...@@ -5653,7 +5638,6 @@ static void osst_detach(Scsi_Device * SDp)
os_scsi_tapes[i] = NULL; os_scsi_tapes[i] = NULL;
scsi_slave_detach(SDp); scsi_slave_detach(SDp);
osst_nr_dev--; osst_nr_dev--;
osst_dev_noticed--;
return; return;
} }
} }
......
...@@ -226,6 +226,8 @@ void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt) ...@@ -226,6 +226,8 @@ void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt)
if (!SHpnt->use_clustering) if (!SHpnt->use_clustering)
clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
blk_queue_prep_rq(q, scsi_prep_fn);
} }
#ifdef MODULE #ifdef MODULE
...@@ -1958,17 +1960,6 @@ static int proc_scsi_gen_write(struct file * file, const char * buf, ...@@ -1958,17 +1960,6 @@ static int proc_scsi_gen_write(struct file * file, const char * buf,
} }
#endif #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) int scsi_attach_device(struct scsi_device *sdev)
{ {
struct Scsi_Device_Template *sdt; struct Scsi_Device_Template *sdt;
...@@ -2089,22 +2080,6 @@ int scsi_register_device(struct Scsi_Device_Template *tpnt) ...@@ -2089,22 +2080,6 @@ int scsi_register_device(struct Scsi_Device_Template *tpnt)
driver_register(&tpnt->scsi_driverfs_driver); 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; for (shpnt = scsi_host_get_next(NULL); shpnt;
shpnt = scsi_host_get_next(shpnt)) { shpnt = scsi_host_get_next(shpnt)) {
for (SDpnt = shpnt->host_queue; SDpnt; for (SDpnt = shpnt->host_queue; SDpnt;
......
...@@ -455,6 +455,7 @@ extern int scsi_insert_special_cmd(Scsi_Cmnd * SCpnt, int); ...@@ -455,6 +455,7 @@ extern int scsi_insert_special_cmd(Scsi_Cmnd * SCpnt, int);
extern void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors, extern void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
int block_sectors); int block_sectors);
extern void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt); 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 void scsi_request_fn(request_queue_t * q);
extern int scsi_starvation_completion(Scsi_Device * SDpnt); extern int scsi_starvation_completion(Scsi_Device * SDpnt);
...@@ -480,7 +481,6 @@ extern void scsi_do_cmd(Scsi_Cmnd *, const void *cmnd, ...@@ -480,7 +481,6 @@ extern void scsi_do_cmd(Scsi_Cmnd *, const void *cmnd,
int timeout, int retries); int timeout, int retries);
extern int scsi_dev_init(void); extern int scsi_dev_init(void);
extern int scsi_mlqueue_insert(struct scsi_cmnd *, int); 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 int scsi_attach_device(struct scsi_device *);
extern void scsi_detach_device(struct scsi_device *); extern void scsi_detach_device(struct scsi_device *);
......
...@@ -102,6 +102,13 @@ int scsi_insert_special_req(Scsi_Request * SRpnt, int at_head) ...@@ -102,6 +102,13 @@ int scsi_insert_special_req(Scsi_Request * SRpnt, int at_head)
{ {
request_queue_t *q = &SRpnt->sr_device->request_queue; request_queue_t *q = &SRpnt->sr_device->request_queue;
/* This is used to insert SRpnt specials. Because users of
* this function are apt to reuse requests with no modification,
* we have to sanitise the request flags here
*/
SRpnt->sr_request->flags &= ~REQ_DONTPREP;
blk_insert_request(q, SRpnt->sr_request, at_head, SRpnt); blk_insert_request(q, SRpnt->sr_request, at_head, SRpnt);
return 0; return 0;
} }
...@@ -240,6 +247,12 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt) ...@@ -240,6 +247,12 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
SCpnt->request->special = (void *) SCpnt; SCpnt->request->special = (void *) SCpnt;
if(blk_rq_tagged(SCpnt->request)) if(blk_rq_tagged(SCpnt->request))
blk_queue_end_tag(q, SCpnt->request); blk_queue_end_tag(q, SCpnt->request);
/* set REQ_SPECIAL - we have a command
* clear REQ_DONTPREP - we assume the sg table has been
* nuked so we need to set it up again.
*/
SCpnt->request->flags |= REQ_SPECIAL;
SCpnt->request->flags &= ~REQ_DONTPREP;
__elv_add_request(q, SCpnt->request, 0, 0); __elv_add_request(q, SCpnt->request, 0, 0);
} }
...@@ -741,7 +754,7 @@ static int scsi_init_io(Scsi_Cmnd *SCpnt) ...@@ -741,7 +754,7 @@ static int scsi_init_io(Scsi_Cmnd *SCpnt)
SCpnt->use_sg = req->nr_phys_segments; SCpnt->use_sg = req->nr_phys_segments;
gfp_mask = GFP_NOIO; gfp_mask = GFP_NOIO;
if (in_interrupt()) { if (likely(in_atomic())) {
gfp_mask &= ~__GFP_WAIT; gfp_mask &= ~__GFP_WAIT;
gfp_mask |= __GFP_HIGH; gfp_mask |= __GFP_HIGH;
} }
...@@ -788,6 +801,116 @@ static int scsi_init_io(Scsi_Cmnd *SCpnt) ...@@ -788,6 +801,116 @@ static int scsi_init_io(Scsi_Cmnd *SCpnt)
return 0; return 0;
} }
int scsi_prep_fn(struct request_queue *q, struct request *req)
{
struct Scsi_Device_Template *STpnt;
Scsi_Cmnd *SCpnt;
Scsi_Device *SDpnt;
SDpnt = (Scsi_Device *) q->queuedata;
BUG_ON(!SDpnt);
/*
* Find the actual device driver associated with this command.
* The SPECIAL requests are things like character device or
* ioctls, which did not originate from ll_rw_blk. Note that
* the special field is also used to indicate the SCpnt for
* the remainder of a partially fulfilled request that can
* come up when there is a medium error. We have to treat
* these two cases differently. We differentiate by looking
* at request->cmd, as this tells us the real story.
*/
if (req->flags & REQ_SPECIAL) {
Scsi_Request *SRpnt;
STpnt = NULL;
SCpnt = (Scsi_Cmnd *) req->special;
SRpnt = (Scsi_Request *) req->special;
if( SRpnt->sr_magic == SCSI_REQ_MAGIC ) {
SCpnt = scsi_allocate_device(SRpnt->sr_device,
FALSE, FALSE);
if (!SCpnt)
return BLKPREP_DEFER;
scsi_init_cmd_from_req(SCpnt, SRpnt);
}
} else if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) {
/*
* Now try and find a command block that we can use.
*/
if (req->special) {
SCpnt = (Scsi_Cmnd *) req->special;
} else {
SCpnt = scsi_allocate_device(SDpnt, FALSE, FALSE);
}
/*
* if command allocation failure, wait a bit
*/
if (unlikely(!SCpnt))
return BLKPREP_DEFER;
/* pull a tag out of the request if we have one */
SCpnt->tag = req->tag;
} else {
blk_dump_rq_flags(req, "SCSI bad req");
return BLKPREP_KILL;
}
/* note the overloading of req->special. When the tag
* is active it always means SCpnt. If the tag goes
* back for re-queueing, it may be reset */
req->special = SCpnt;
SCpnt->request = req;
/*
* FIXME: drop the lock here because the functions below
* expect to be called without the queue lock held. Also,
* previously, we dequeued the request before dropping the
* lock. We hope REQ_STARTED prevents anything untoward from
* happening now.
*/
if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) {
/*
* This will do a couple of things:
* 1) Fill in the actual SCSI command.
* 2) Fill in any other upper-level specific fields
* (timeout).
*
* If this returns 0, it means that the request failed
* (reading past end of disk, reading offline device,
* etc). This won't actually talk to the device, but
* some kinds of consistency checking may cause the
* request to be rejected immediately.
*/
STpnt = scsi_get_request_dev(req);
BUG_ON(!STpnt);
/*
* This sets up the scatter-gather table (allocating if
* required).
*/
if (!scsi_init_io(SCpnt)) {
/* Mark it as special --- We already have an
* allocated command associated with it */
req->flags |= REQ_SPECIAL;
return BLKPREP_DEFER;
}
/*
* Initialize the actual SCSI command for this request.
*/
if (!STpnt->init_command(SCpnt)) {
scsi_release_buffers(SCpnt);
return BLKPREP_KILL;
}
}
/* The request is now prepped, no need to come back here */
req->flags |= REQ_DONTPREP;
return BLKPREP_OK;
}
/* /*
* Function: scsi_request_fn() * Function: scsi_request_fn()
* *
...@@ -811,10 +934,8 @@ void scsi_request_fn(request_queue_t * q) ...@@ -811,10 +934,8 @@ void scsi_request_fn(request_queue_t * q)
{ {
struct request *req; struct request *req;
Scsi_Cmnd *SCpnt; Scsi_Cmnd *SCpnt;
Scsi_Request *SRpnt;
Scsi_Device *SDpnt; Scsi_Device *SDpnt;
struct Scsi_Host *SHpnt; struct Scsi_Host *SHpnt;
struct Scsi_Device_Template *STpnt;
ASSERT_LOCK(q->queue_lock, 1); ASSERT_LOCK(q->queue_lock, 1);
...@@ -837,6 +958,14 @@ void scsi_request_fn(request_queue_t * q) ...@@ -837,6 +958,14 @@ void scsi_request_fn(request_queue_t * q)
if (SHpnt->in_recovery || blk_queue_plugged(q)) if (SHpnt->in_recovery || blk_queue_plugged(q))
return; return;
/*
* get next queueable request. We do this early to make sure
* that the request is fully prepared even if we cannot
* accept it. If there is no request, we'll detect this
* lower down.
*/
req = elv_next_request(q);
if(SHpnt->host_busy == 0 && SHpnt->host_blocked) { if(SHpnt->host_busy == 0 && SHpnt->host_blocked) {
/* unblock after host_blocked iterates to zero */ /* unblock after host_blocked iterates to zero */
if(--SHpnt->host_blocked == 0) { if(--SHpnt->host_blocked == 0) {
...@@ -888,141 +1017,40 @@ void scsi_request_fn(request_queue_t * q) ...@@ -888,141 +1017,40 @@ void scsi_request_fn(request_queue_t * q)
if (blk_queue_empty(q)) if (blk_queue_empty(q))
break; break;
/* if(!req) {
* get next queueable request. /* can happen if the prep fails
*/ * FIXME: elv_next_request() should be plugging the
req = elv_next_request(q); * queue */
blk_plug_device(q);
/*
* Find the actual device driver associated with this command.
* The SPECIAL requests are things like character device or
* ioctls, which did not originate from ll_rw_blk. Note that
* the special field is also used to indicate the SCpnt for
* the remainder of a partially fulfilled request that can
* come up when there is a medium error. We have to treat
* these two cases differently. We differentiate by looking
* at request->cmd, as this tells us the real story.
*/
if (req->flags & REQ_SPECIAL) {
STpnt = NULL;
SCpnt = (Scsi_Cmnd *) req->special;
SRpnt = (Scsi_Request *) req->special;
if( SRpnt->sr_magic == SCSI_REQ_MAGIC ) {
SCpnt = scsi_allocate_device(SRpnt->sr_device,
FALSE, FALSE);
if (!SCpnt)
break;
scsi_init_cmd_from_req(SCpnt, SRpnt);
}
} else if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) {
SRpnt = NULL;
STpnt = scsi_get_request_dev(req);
if (!STpnt) {
panic("Unable to find device associated with request");
}
/*
* Now try and find a command block that we can use.
*/
if (req->special) {
SCpnt = (Scsi_Cmnd *) req->special;
} else {
SCpnt = scsi_allocate_device(SDpnt, FALSE, FALSE);
}
/*
* If so, we are ready to do something. Bump the count
* while the queue is locked and then break out of the
* loop. Otherwise loop around and try another request.
*/
if (!SCpnt)
break;
/* pull a tag out of the request if we have one */
SCpnt->tag = req->tag;
} else {
blk_dump_rq_flags(req, "SCSI bad req");
break; break;
} }
/* SCpnt = (struct scsi_cmnd *)req->special;
* Now bump the usage count for both the host and the
* device. /* Should be impossible for a correctly prepared request
* please mail the stack trace to linux-scsi@vger.kernel.org
*/ */
SHpnt->host_busy++; BUG_ON(!SCpnt);
SDpnt->device_busy++;
/* /*
* Finally, before we release the lock, we copy the * Finally, before we release the lock, we copy the
* request to the command block, and remove the * request to the command block, and remove the
* request from the request list. Note that we always * request from the request list. Note that we always
* operate on the queue head - there is absolutely no * operate on the queue head - there is absolutely no
* reason to search the list, because all of the commands * reason to search the list, because all of the
* in this queue are for the same device. * commands in this queue are for the same device.
*/ */
if(!(blk_queue_tagged(q) && (blk_queue_start_tag(q, req) == 0))) if(!(blk_queue_tagged(q) && (blk_queue_start_tag(q, req) == 0)))
blkdev_dequeue_request(req); blkdev_dequeue_request(req);
/* note the overloading of req->special. When the tag
* is active it always means SCpnt. If the tag goes
* back for re-queueing, it may be reset */
req->special = SCpnt;
SCpnt->request = req;
/* /*
* Now it is finally safe to release the lock. We are * Now bump the usage count for both the host and the
* not going to noodle the request list until this * device.
* request has been queued and we loop back to queue
* another.
*/ */
req = NULL; SHpnt->host_busy++;
SDpnt->device_busy++;
spin_unlock_irq(q->queue_lock); spin_unlock_irq(q->queue_lock);
if (!(SCpnt->request->flags & REQ_DONTPREP)
&& (SCpnt->request->flags & (REQ_CMD | REQ_BLOCK_PC))) {
/*
* This will do a couple of things:
* 1) Fill in the actual SCSI command.
* 2) Fill in any other upper-level specific fields
* (timeout).
*
* If this returns 0, it means that the request failed
* (reading past end of disk, reading offline device,
* etc). This won't actually talk to the device, but
* some kinds of consistency checking may cause the
* request to be rejected immediately.
*/
if (STpnt == NULL)
STpnt = scsi_get_request_dev(SCpnt->request);
/*
* This sets up the scatter-gather table (allocating if
* required).
*/
if (!scsi_init_io(SCpnt)) {
scsi_mlqueue_insert(SCpnt, SCSI_MLQUEUE_DEVICE_BUSY);
spin_lock_irq(q->queue_lock);
break;
}
/*
* Initialize the actual SCSI command for this request.
*/
if (!STpnt->init_command(SCpnt)) {
scsi_release_buffers(SCpnt);
SCpnt = __scsi_end_request(SCpnt, 0,
SCpnt->request->nr_sectors, 0, 0);
if( SCpnt != NULL )
{
panic("Should not have leftover blocks\n");
}
spin_lock_irq(q->queue_lock);
SHpnt->host_busy--;
SDpnt->device_busy--;
continue;
}
}
SCpnt->request->flags |= REQ_DONTPREP;
/* /*
* Finally, initialize any error handling parameters, and set up * Finally, initialize any error handling parameters, and set up
* the timers for timeouts. * the timers for timeouts.
......
...@@ -1478,8 +1478,6 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew, ...@@ -1478,8 +1478,6 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
* function */ * function */
sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED; sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
scsi_detect_device(sdev);
if (sdevnew != NULL) if (sdevnew != NULL)
*sdevnew = sdev; *sdevnew = sdev;
......
...@@ -94,7 +94,6 @@ static void sd_init_onedisk(struct scsi_disk * sdkp, struct gendisk *disk); ...@@ -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 void sd_rw_intr(struct scsi_cmnd * SCpnt);
static int sd_attach(struct scsi_device *); static int sd_attach(struct scsi_device *);
static int sd_detect(struct scsi_device *);
static void sd_detach(struct scsi_device *); static void sd_detach(struct scsi_device *);
static int sd_init_command(struct scsi_cmnd *); static int sd_init_command(struct scsi_cmnd *);
static int sd_synchronize_cache(struct scsi_disk *, int); static int sd_synchronize_cache(struct scsi_disk *, int);
...@@ -107,7 +106,6 @@ static struct Scsi_Device_Template sd_template = { ...@@ -107,7 +106,6 @@ static struct Scsi_Device_Template sd_template = {
.name = "disk", .name = "disk",
.tag = "sd", .tag = "sd",
.scsi_type = TYPE_DISK, .scsi_type = TYPE_DISK,
.detect = sd_detect,
.attach = sd_attach, .attach = sd_attach,
.detach = sd_detach, .detach = sd_detach,
.init_command = sd_init_command, .init_command = sd_init_command,
...@@ -1165,23 +1163,6 @@ sd_init_onedisk(struct scsi_disk * sdkp, struct gendisk *disk) ...@@ -1165,23 +1163,6 @@ sd_init_onedisk(struct scsi_disk * sdkp, struct gendisk *disk)
kfree(buffer); 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 * sd_attach - called during driver initialization and whenever a
* new scsi device is attached to the system. It is called once * 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; ...@@ -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 */ #define SG_DEV_ARR_LUMP 6 /* amount to over allocate sg_dev_arr by */
static int sg_attach(Scsi_Device *); static int sg_attach(Scsi_Device *);
static int sg_detect(Scsi_Device *);
static void sg_detach(Scsi_Device *); static void sg_detach(Scsi_Device *);
static Scsi_Request *dummy_cmdp; /* only used for sizeof */ static Scsi_Request *dummy_cmdp; /* only used for sizeof */
...@@ -124,7 +123,6 @@ static struct Scsi_Device_Template sg_template = { ...@@ -124,7 +123,6 @@ static struct Scsi_Device_Template sg_template = {
.name = "generic", .name = "generic",
.tag = "sg", .tag = "sg",
.scsi_type = 0xff, .scsi_type = 0xff,
.detect = sg_detect,
.attach = sg_attach, .attach = sg_attach,
.detach = sg_detach .detach = sg_detach
}; };
...@@ -233,7 +231,6 @@ static int sg_last_dev(void); ...@@ -233,7 +231,6 @@ static int sg_last_dev(void);
#endif #endif
static Sg_device **sg_dev_arr = NULL; static Sg_device **sg_dev_arr = NULL;
static int sg_dev_noticed;
static int sg_dev_max; static int sg_dev_max;
static int sg_nr_dev; static int sg_nr_dev;
...@@ -1338,13 +1335,6 @@ static struct file_operations sg_fops = { ...@@ -1338,13 +1335,6 @@ static struct file_operations sg_fops = {
.fasync = sg_fasync, .fasync = sg_fasync,
}; };
static int
sg_detect(Scsi_Device * scsidp)
{
sg_dev_noticed++;
return 1;
}
#ifndef MODULE #ifndef MODULE
static int __init static int __init
sg_def_reserved_size_setup(char *str) sg_def_reserved_size_setup(char *str)
...@@ -1563,7 +1553,6 @@ sg_detach(Scsi_Device * scsidp) ...@@ -1563,7 +1553,6 @@ sg_detach(Scsi_Device * scsidp)
} }
scsi_slave_detach(scsidp); scsi_slave_detach(scsidp);
sg_nr_dev--; sg_nr_dev--;
sg_dev_noticed--; /* from <dan@lectra.fr> */
break; break;
} }
write_unlock_irqrestore(&sg_dev_arr_lock, iflags); write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
......
...@@ -66,7 +66,6 @@ MODULE_PARM(xa_test, "i"); /* see sr_ioctl.c */ ...@@ -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) CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_GENERIC_PACKET)
static int sr_attach(struct scsi_device *); static int sr_attach(struct scsi_device *);
static int sr_detect(struct scsi_device *);
static void sr_detach(struct scsi_device *); static void sr_detach(struct scsi_device *);
static int sr_init_command(struct scsi_cmnd *); static int sr_init_command(struct scsi_cmnd *);
...@@ -75,7 +74,6 @@ static struct Scsi_Device_Template sr_template = { ...@@ -75,7 +74,6 @@ static struct Scsi_Device_Template sr_template = {
.name = "cdrom", .name = "cdrom",
.tag = "sr", .tag = "sr",
.scsi_type = TYPE_ROM, .scsi_type = TYPE_ROM,
.detect = sr_detect,
.attach = sr_attach, .attach = sr_attach,
.detach = sr_detach, .detach = sr_detach,
.init_command = sr_init_command .init_command = sr_init_command
...@@ -489,14 +487,6 @@ static int sr_open(struct cdrom_device_info *cdi, int purpose) ...@@ -489,14 +487,6 @@ static int sr_open(struct cdrom_device_info *cdi, int purpose)
return 0; 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) static int sr_attach(struct scsi_device *sdev)
{ {
struct gendisk *disk; struct gendisk *disk;
......
...@@ -170,7 +170,6 @@ static int sgl_map_user_pages(struct scatterlist *, const unsigned int, ...@@ -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 sgl_unmap_user_pages(struct scatterlist *, const unsigned int, int);
static int st_attach(Scsi_Device *); static int st_attach(Scsi_Device *);
static int st_detect(Scsi_Device *);
static void st_detach(Scsi_Device *); static void st_detach(Scsi_Device *);
static struct Scsi_Device_Template st_template = { static struct Scsi_Device_Template st_template = {
...@@ -178,7 +177,6 @@ static struct Scsi_Device_Template st_template = { ...@@ -178,7 +177,6 @@ static struct Scsi_Device_Template st_template = {
.name = "tape", .name = "tape",
.tag = "st", .tag = "st",
.scsi_type = TYPE_TAPE, .scsi_type = TYPE_TAPE,
.detect = st_detect,
.attach = st_attach, .attach = st_attach,
.detach = st_detach .detach = st_detach
}; };
...@@ -3885,13 +3883,6 @@ static int st_attach(Scsi_Device * SDp) ...@@ -3885,13 +3883,6 @@ static int st_attach(Scsi_Device * SDp)
return 0; 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) static void st_detach(Scsi_Device * SDp)
{ {
Scsi_Tape *tpnt; 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