Commit 4ce9191f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[PATCH] scsi device template cleanups

Now that .init isn't implement anymore we can get rid of it and
do some more cleanup in the scsi device template:

* remove .blk - unused since 2.5.46
* remove .dev_noticed, only midlayer user is gone together with
  .init.  remaining instance now driver-private
* remove .nr_dev and .dev_max - they're purely driver internal
  and at least in sd and sr they'll be completly gone very soon.
parent c877e091
...@@ -560,13 +560,7 @@ struct Scsi_Device_Template ...@@ -560,13 +560,7 @@ 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;
unsigned int nr_dev; /* Number currently attached */
unsigned int dev_noticed; /* Number of devices detected. */
unsigned int dev_max; /* Current size of arrays */
unsigned blk:1; /* 0 if character device */
int (*detect)(Scsi_Device *); /* Returns 1 if we can attach this device */ int (*detect)(Scsi_Device *); /* Returns 1 if we can attach this device */
int (*init)(void); /* Sizes arrays based upon number of devices
* detected */
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.
......
...@@ -156,6 +156,10 @@ static int osst_attach(Scsi_Device *); ...@@ -156,6 +156,10 @@ static int osst_attach(Scsi_Device *);
static int osst_detect(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_dev_max;
struct Scsi_Device_Template osst_template = struct Scsi_Device_Template osst_template =
{ {
module: THIS_MODULE, module: THIS_MODULE,
...@@ -4154,7 +4158,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) ...@@ -4154,7 +4158,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
char *name; char *name;
int mode = TAPE_MODE(inode->i_rdev); int mode = TAPE_MODE(inode->i_rdev);
if (dev >= osst_template.dev_max || (STp = os_scsi_tapes[dev]) == NULL || !STp->device) if (dev >= osst_dev_max || (STp = os_scsi_tapes[dev]) == NULL || !STp->device)
return (-ENXIO); return (-ENXIO);
filp->private_data = STp; filp->private_data = STp;
...@@ -4979,7 +4983,7 @@ static OSST_buffer * new_tape_buffer( int from_initialization, int need_dma ) ...@@ -4979,7 +4983,7 @@ static OSST_buffer * new_tape_buffer( int from_initialization, int need_dma )
int i, priority, b_size, order, got = 0, segs = 0; int i, priority, b_size, order, got = 0, segs = 0;
OSST_buffer *tb; OSST_buffer *tb;
if (osst_nbr_buffers >= osst_template.dev_max) if (osst_nbr_buffers >= osst_dev_max)
return NULL; /* Should never happen */ return NULL; /* Should never happen */
if (from_initialization) if (from_initialization)
...@@ -5416,15 +5420,15 @@ static int osst_attach(Scsi_Device * SDp) ...@@ -5416,15 +5420,15 @@ static int osst_attach(Scsi_Device * SDp)
if (!disk) if (!disk)
return 1; return 1;
if (osst_template.nr_dev >= osst_template.dev_max) { if (osst_nr_dev >= osst_dev_max) {
SDp->attached--; SDp->attached--;
put_disk(disk); put_disk(disk);
return 1; return 1;
} }
/* find a free minor number */ /* find a free minor number */
for (i=0; os_scsi_tapes[i] && i<osst_template.dev_max; i++); for (i=0; os_scsi_tapes[i] && i<osst_dev_max; i++);
if(i >= osst_template.dev_max) panic ("Scsi_devices corrupt (osst)"); if(i >= osst_dev_max) panic ("Scsi_devices corrupt (osst)");
/* allocate a OS_Scsi_Tape for this device */ /* allocate a OS_Scsi_Tape for this device */
tpnt = (OS_Scsi_Tape *)kmalloc(sizeof(OS_Scsi_Tape), GFP_ATOMIC); tpnt = (OS_Scsi_Tape *)kmalloc(sizeof(OS_Scsi_Tape), GFP_ATOMIC);
...@@ -5548,7 +5552,7 @@ static int osst_attach(Scsi_Device * SDp) ...@@ -5548,7 +5552,7 @@ static int osst_attach(Scsi_Device * SDp)
tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = FALSE; tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = FALSE;
init_MUTEX(&tpnt->lock); init_MUTEX(&tpnt->lock);
osst_template.nr_dev++; osst_nr_dev++;
printk(KERN_INFO printk(KERN_INFO
"osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n", "osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n",
...@@ -5562,7 +5566,7 @@ static int osst_detect(Scsi_Device * SDp) ...@@ -5562,7 +5566,7 @@ static int osst_detect(Scsi_Device * SDp)
if (SDp->type != TYPE_TAPE) return 0; if (SDp->type != TYPE_TAPE) return 0;
if ( ! osst_supports(SDp) ) return 0; if ( ! osst_supports(SDp) ) return 0;
osst_template.dev_noticed++; osst_dev_noticed++;
return 1; return 1;
} }
...@@ -5573,7 +5577,7 @@ static int osst_init() ...@@ -5573,7 +5577,7 @@ static int osst_init()
{ {
int i; int i;
if (osst_template.dev_noticed == 0) if (osst_dev_noticed == 0)
return 0; return 0;
if (!osst_registered) { if (!osst_registered) {
...@@ -5586,10 +5590,10 @@ static int osst_init() ...@@ -5586,10 +5590,10 @@ static int osst_init()
if (os_scsi_tapes) if (os_scsi_tapes)
return 0; return 0;
osst_template.dev_max = OSST_MAX_TAPES; osst_dev_max = OSST_MAX_TAPES;
if (osst_template.dev_max > 128 / ST_NBR_MODES) if (osst_dev_max > 128 / ST_NBR_MODES)
printk(KERN_INFO "osst :I: Only %d tapes accessible.\n", 128 / ST_NBR_MODES); printk(KERN_INFO "osst :I: Only %d tapes accessible.\n", 128 / ST_NBR_MODES);
os_scsi_tapes = kmalloc(osst_template.dev_max * sizeof(OS_Scsi_Tape *), os_scsi_tapes = kmalloc(osst_dev_max * sizeof(OS_Scsi_Tape *),
GFP_ATOMIC); GFP_ATOMIC);
if (!os_scsi_tapes) { if (!os_scsi_tapes) {
printk(KERN_ERR "osst :W: Unable to allocate array for OnStream SCSI tapes.\n"); printk(KERN_ERR "osst :W: Unable to allocate array for OnStream SCSI tapes.\n");
...@@ -5597,11 +5601,11 @@ static int osst_init() ...@@ -5597,11 +5601,11 @@ static int osst_init()
return 1; return 1;
} }
for (i=0; i < osst_template.dev_max; ++i) for (i=0; i < osst_dev_max; ++i)
os_scsi_tapes[i] = NULL; os_scsi_tapes[i] = NULL;
/* Allocate the buffer pointers */ /* Allocate the buffer pointers */
osst_buffers = kmalloc(osst_template.dev_max * sizeof(OSST_buffer *), osst_buffers = kmalloc(osst_dev_max * sizeof(OSST_buffer *),
GFP_ATOMIC); GFP_ATOMIC);
if (!osst_buffers) { if (!osst_buffers) {
printk(KERN_ERR "osst :W: Unable to allocate tape buffer pointers.\n"); printk(KERN_ERR "osst :W: Unable to allocate tape buffer pointers.\n");
...@@ -5629,7 +5633,7 @@ static void osst_detach(Scsi_Device * SDp) ...@@ -5629,7 +5633,7 @@ static void osst_detach(Scsi_Device * SDp)
int mode; int mode;
#endif #endif
for(i=0; i<osst_template.dev_max; i++) { for(i=0; i<osst_dev_max; i++) {
tpnt = os_scsi_tapes[i]; tpnt = os_scsi_tapes[i];
if(tpnt != NULL && tpnt->device == SDp) { if(tpnt != NULL && tpnt->device == SDp) {
tpnt->device = NULL; tpnt->device = NULL;
...@@ -5645,8 +5649,8 @@ static void osst_detach(Scsi_Device * SDp) ...@@ -5645,8 +5649,8 @@ static void osst_detach(Scsi_Device * SDp)
kfree(tpnt); kfree(tpnt);
os_scsi_tapes[i] = NULL; os_scsi_tapes[i] = NULL;
SDp->attached--; SDp->attached--;
osst_template.nr_dev--; osst_nr_dev--;
osst_template.dev_noticed--; osst_dev_noticed--;
return; return;
} }
} }
...@@ -5668,7 +5672,7 @@ static void __exit exit_osst (void) ...@@ -5668,7 +5672,7 @@ static void __exit exit_osst (void)
unregister_chrdev(MAJOR_NR, "osst"); unregister_chrdev(MAJOR_NR, "osst");
osst_registered--; osst_registered--;
if (os_scsi_tapes) { if (os_scsi_tapes) {
for (i=0; i < osst_template.dev_max; ++i) { for (i=0; i < osst_dev_max; ++i) {
STp = os_scsi_tapes[i]; STp = os_scsi_tapes[i];
if (!STp) if (!STp)
continue; continue;
...@@ -5690,7 +5694,7 @@ static void __exit exit_osst (void) ...@@ -5690,7 +5694,7 @@ static void __exit exit_osst (void)
kfree(osst_buffers); kfree(osst_buffers);
} }
} }
osst_template.dev_max = 0; osst_dev_max = 0;
printk(KERN_INFO "osst :I: Unloaded.\n"); printk(KERN_INFO "osst :I: Unloaded.\n");
} }
......
...@@ -1989,9 +1989,6 @@ int scsi_attach_device(struct scsi_device *sdev) ...@@ -1989,9 +1989,6 @@ int scsi_attach_device(struct scsi_device *sdev)
goto fail; goto fail;
down_read(&scsi_devicelist_mutex); down_read(&scsi_devicelist_mutex);
for (sdt = scsi_devicelist; sdt; sdt = sdt->next)
if (sdt->init && sdt->dev_noticed)
(*sdt->init) ();
for (sdt = scsi_devicelist; sdt; sdt = sdt->next) for (sdt = scsi_devicelist; sdt; sdt = sdt->next)
if (sdt->attach) if (sdt->attach)
(*sdt->attach) (sdev); (*sdt->attach) (sdev);
...@@ -2060,14 +2057,6 @@ int scsi_register_device(struct Scsi_Device_Template *tpnt) ...@@ -2060,14 +2057,6 @@ int scsi_register_device(struct Scsi_Device_Template *tpnt)
} }
} }
/*
* If any of the devices would match this driver, then perform the
* init function.
*/
if (tpnt->init && tpnt->dev_noticed)
if ((*tpnt->init) ())
return 1;
/* /*
* Now actually connect the devices to the new driver. * Now actually connect the devices to the new driver.
*/ */
......
...@@ -83,6 +83,7 @@ struct scsi_disk { ...@@ -83,6 +83,7 @@ struct scsi_disk {
unsigned RCD : 1; /* state of disk RCD bit */ unsigned RCD : 1; /* state of disk RCD bit */
}; };
static int sd_nr_dev; /* XXX(hch) bad hack, we want a bitmap instead */
static LIST_HEAD(sd_devlist); static LIST_HEAD(sd_devlist);
static spinlock_t sd_devlist_lock = SPIN_LOCK_UNLOCKED; static spinlock_t sd_devlist_lock = SPIN_LOCK_UNLOCKED;
...@@ -106,7 +107,6 @@ static struct Scsi_Device_Template sd_template = { ...@@ -106,7 +107,6 @@ static struct Scsi_Device_Template sd_template = {
.name = "disk", .name = "disk",
.tag = "sd", .tag = "sd",
.scsi_type = TYPE_DISK, .scsi_type = TYPE_DISK,
.blk = 1,
.detect = sd_detect, .detect = sd_detect,
.attach = sd_attach, .attach = sd_attach,
.detach = sd_detach, .detach = sd_detach,
...@@ -1179,7 +1179,6 @@ static int sd_detect(struct scsi_device * sdp) ...@@ -1179,7 +1179,6 @@ static int sd_detect(struct scsi_device * sdp)
SCSI_LOG_HLQUEUE(3, printk("sd_detect: type=%d\n", sdp->type)); SCSI_LOG_HLQUEUE(3, printk("sd_detect: type=%d\n", sdp->type));
if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD) if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD)
return 0; return 0;
sd_template.dev_noticed++;
return 1; return 1;
} }
...@@ -1228,7 +1227,7 @@ static int sd_attach(struct scsi_device * sdp) ...@@ -1228,7 +1227,7 @@ static int sd_attach(struct scsi_device * sdp)
* XXX use find_first_zero_bit on it. This will happen at the * XXX use find_first_zero_bit on it. This will happen at the
* XXX same time template->nr_* goes away. --hch * XXX same time template->nr_* goes away. --hch
*/ */
dsk_nr = sd_template.nr_dev++; dsk_nr = sd_nr_dev++;
sdkp->device = sdp; sdkp->device = sdp;
sdkp->driver = &sd_template; sdkp->driver = &sd_template;
...@@ -1314,8 +1313,7 @@ static void sd_detach(struct scsi_device * sdp) ...@@ -1314,8 +1313,7 @@ static void sd_detach(struct scsi_device * sdp)
sd_devlist_remove(sdkp); sd_devlist_remove(sdkp);
del_gendisk(sdkp->disk); del_gendisk(sdkp->disk);
sdp->attached--; sdp->attached--;
sd_template.dev_noticed--; sd_nr_dev--;
sd_template.nr_dev--;
put_disk(sdkp->disk); put_disk(sdkp->disk);
kfree(sdkp); kfree(sdkp);
} }
......
...@@ -68,7 +68,6 @@ MODULE_PARM(xa_test, "i"); /* see sr_ioctl.c */ ...@@ -68,7 +68,6 @@ MODULE_PARM(xa_test, "i"); /* see sr_ioctl.c */
static int sr_attach(struct scsi_device *); static int sr_attach(struct scsi_device *);
static int sr_detect(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 *);
static struct Scsi_Device_Template sr_template = { static struct Scsi_Device_Template sr_template = {
...@@ -76,13 +75,13 @@ static struct Scsi_Device_Template sr_template = { ...@@ -76,13 +75,13 @@ static struct Scsi_Device_Template sr_template = {
.name = "cdrom", .name = "cdrom",
.tag = "sr", .tag = "sr",
.scsi_type = TYPE_ROM, .scsi_type = TYPE_ROM,
.blk = 1,
.detect = sr_detect, .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
}; };
static int sr_nr_dev; /* XXX(hch) bad hack, we want a bitmap instead */
static LIST_HEAD(sr_devlist); static LIST_HEAD(sr_devlist);
static spinlock_t sr_devlist_lock = SPIN_LOCK_UNLOCKED; static spinlock_t sr_devlist_lock = SPIN_LOCK_UNLOCKED;
...@@ -495,7 +494,6 @@ static int sr_detect(struct scsi_device * SDp) ...@@ -495,7 +494,6 @@ static int sr_detect(struct scsi_device * SDp)
if (SDp->type != TYPE_ROM && SDp->type != TYPE_WORM) if (SDp->type != TYPE_ROM && SDp->type != TYPE_WORM)
return 0; return 0;
sr_template.dev_noticed++;
return 1; return 1;
} }
...@@ -524,7 +522,7 @@ static int sr_attach(struct scsi_device *sdev) ...@@ -524,7 +522,7 @@ static int sr_attach(struct scsi_device *sdev)
* XXX use find_first_zero_bit on it. This will happen at the * XXX use find_first_zero_bit on it. This will happen at the
* XXX same time template->nr_* goes away. --hch * XXX same time template->nr_* goes away. --hch
*/ */
minor = sr_template.nr_dev++; minor = sr_nr_dev++;
disk->major = MAJOR_NR; disk->major = MAJOR_NR;
disk->first_minor = minor; disk->first_minor = minor;
...@@ -810,7 +808,7 @@ static void sr_detach(struct scsi_device * SDp) ...@@ -810,7 +808,7 @@ static void sr_detach(struct scsi_device * SDp)
unregister_cdrom(&cd->cdi); unregister_cdrom(&cd->cdi);
SDp->attached--; SDp->attached--;
sr_template.nr_dev--; sr_nr_dev--;
kfree(cd); kfree(cd);
} }
......
...@@ -74,6 +74,9 @@ static int try_direct_io = TRY_DIRECT_IO; ...@@ -74,6 +74,9 @@ static int try_direct_io = TRY_DIRECT_IO;
static int try_rdio = TRUE; static int try_rdio = TRUE;
static int try_wdio = TRUE; static int try_wdio = TRUE;
static int st_dev_max;
static int st_nr_dev;
MODULE_AUTHOR("Kai Makisara"); MODULE_AUTHOR("Kai Makisara");
MODULE_DESCRIPTION("SCSI Tape Driver"); MODULE_DESCRIPTION("SCSI Tape Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -976,7 +979,7 @@ static int st_open(struct inode *inode, struct file *filp) ...@@ -976,7 +979,7 @@ static int st_open(struct inode *inode, struct file *filp)
char *name; char *name;
write_lock(&st_dev_arr_lock); write_lock(&st_dev_arr_lock);
if (dev >= st_template.dev_max || scsi_tapes == NULL || if (dev >= st_dev_max || scsi_tapes == NULL ||
((STp = scsi_tapes[dev]) == NULL)) { ((STp = scsi_tapes[dev]) == NULL)) {
write_unlock(&st_dev_arr_lock); write_unlock(&st_dev_arr_lock);
return (-ENXIO); return (-ENXIO);
...@@ -3680,15 +3683,15 @@ static int st_attach(Scsi_Device * SDp) ...@@ -3680,15 +3683,15 @@ static int st_attach(Scsi_Device * SDp)
} }
write_lock(&st_dev_arr_lock); write_lock(&st_dev_arr_lock);
if (st_template.nr_dev >= st_template.dev_max) { if (st_nr_dev >= st_dev_max) {
Scsi_Tape **tmp_da; Scsi_Tape **tmp_da;
ST_buffer **tmp_ba; ST_buffer **tmp_ba;
int tmp_dev_max; int tmp_dev_max;
tmp_dev_max = st_template.nr_dev + ST_DEV_ARR_LUMP; tmp_dev_max = st_nr_dev + ST_DEV_ARR_LUMP;
if (tmp_dev_max > ST_MAX_TAPES) if (tmp_dev_max > ST_MAX_TAPES)
tmp_dev_max = ST_MAX_TAPES; tmp_dev_max = ST_MAX_TAPES;
if (tmp_dev_max <= st_template.nr_dev) { if (tmp_dev_max <= st_nr_dev) {
SDp->attached--; SDp->attached--;
write_unlock(&st_dev_arr_lock); write_unlock(&st_dev_arr_lock);
printk(KERN_ERR "st: Too many tape devices (max. %d).\n", printk(KERN_ERR "st: Too many tape devices (max. %d).\n",
...@@ -3714,18 +3717,18 @@ static int st_attach(Scsi_Device * SDp) ...@@ -3714,18 +3717,18 @@ static int st_attach(Scsi_Device * SDp)
memset(tmp_da, 0, tmp_dev_max * sizeof(Scsi_Tape *)); memset(tmp_da, 0, tmp_dev_max * sizeof(Scsi_Tape *));
if (scsi_tapes != NULL) { if (scsi_tapes != NULL) {
memcpy(tmp_da, scsi_tapes, memcpy(tmp_da, scsi_tapes,
st_template.dev_max * sizeof(Scsi_Tape *)); st_dev_max * sizeof(Scsi_Tape *));
kfree(scsi_tapes); kfree(scsi_tapes);
} }
scsi_tapes = tmp_da; scsi_tapes = tmp_da;
st_template.dev_max = tmp_dev_max; st_dev_max = tmp_dev_max;
} }
for (i = 0; i < st_template.dev_max; i++) for (i = 0; i < st_dev_max; i++)
if (scsi_tapes[i] == NULL) if (scsi_tapes[i] == NULL)
break; break;
if (i >= st_template.dev_max) if (i >= st_dev_max)
panic("scsi_devices corrupt (st)"); panic("scsi_devices corrupt (st)");
tpnt = kmalloc(sizeof(Scsi_Tape), GFP_ATOMIC); tpnt = kmalloc(sizeof(Scsi_Tape), GFP_ATOMIC);
...@@ -3821,7 +3824,7 @@ static int st_attach(Scsi_Device * SDp) ...@@ -3821,7 +3824,7 @@ static int st_attach(Scsi_Device * SDp)
tpnt->blksize_changed = FALSE; tpnt->blksize_changed = FALSE;
init_MUTEX(&tpnt->lock); init_MUTEX(&tpnt->lock);
st_template.nr_dev++; st_nr_dev++;
write_unlock(&st_dev_arr_lock); write_unlock(&st_dev_arr_lock);
for (mode = 0; mode < ST_NBR_MODES; ++mode) { for (mode = 0; mode < ST_NBR_MODES; ++mode) {
...@@ -3883,7 +3886,6 @@ static int st_detect(Scsi_Device * SDp) ...@@ -3883,7 +3886,6 @@ static int st_detect(Scsi_Device * SDp)
{ {
if (SDp->type != TYPE_TAPE || st_incompatible(SDp)) if (SDp->type != TYPE_TAPE || st_incompatible(SDp))
return 0; return 0;
st_template.dev_noticed++;
return 1; return 1;
} }
...@@ -3893,7 +3895,7 @@ static void st_detach(Scsi_Device * SDp) ...@@ -3893,7 +3895,7 @@ static void st_detach(Scsi_Device * SDp)
int i, mode; int i, mode;
write_lock(&st_dev_arr_lock); write_lock(&st_dev_arr_lock);
for (i = 0; i < st_template.dev_max; i++) { for (i = 0; i < st_dev_max; i++) {
tpnt = scsi_tapes[i]; tpnt = scsi_tapes[i];
if (tpnt != NULL && tpnt->device == SDp) { if (tpnt != NULL && tpnt->device == SDp) {
tpnt->device = NULL; tpnt->device = NULL;
...@@ -3905,8 +3907,7 @@ static void st_detach(Scsi_Device * SDp) ...@@ -3905,8 +3907,7 @@ static void st_detach(Scsi_Device * SDp)
} }
scsi_tapes[i] = 0; scsi_tapes[i] = 0;
SDp->attached--; SDp->attached--;
st_template.nr_dev--; st_nr_dev--;
st_template.dev_noticed--;
write_unlock(&st_dev_arr_lock); write_unlock(&st_dev_arr_lock);
for (mode = 0; mode < ST_NBR_MODES; ++mode) { for (mode = 0; mode < ST_NBR_MODES; ++mode) {
...@@ -3962,14 +3963,13 @@ static void __exit exit_st(void) ...@@ -3962,14 +3963,13 @@ static void __exit exit_st(void)
scsi_unregister_device(&st_template); scsi_unregister_device(&st_template);
unregister_chrdev(SCSI_TAPE_MAJOR, "st"); unregister_chrdev(SCSI_TAPE_MAJOR, "st");
if (scsi_tapes != NULL) { if (scsi_tapes != NULL) {
for (i=0; i < st_template.dev_max; ++i) for (i=0; i < st_dev_max; ++i)
if (scsi_tapes[i]) { if (scsi_tapes[i]) {
put_disk(scsi_tapes[i]->disk); put_disk(scsi_tapes[i]->disk);
kfree(scsi_tapes[i]); kfree(scsi_tapes[i]);
} }
kfree(scsi_tapes); kfree(scsi_tapes);
} }
st_template.dev_max = 0;
printk(KERN_INFO "st: Unloaded.\n"); printk(KERN_INFO "st: Unloaded.\n");
} }
......
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