Commit 86a995ac authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] finish introduction of ->reinit()

Finish introduction of ->reinit() - Jens had missed MOD_DEC_USE_COUNT on
several exits from ide-cd one and forgot to remove the loop from
ide-floppy ide-tape and ide-scsi ones ;-) (->reinit() is the body of
loop in ->init() - stuff that should be done one drive; in 2.5.32
ide-disk one is OK, ide-cd is OK modulo minor bugs and in the rest it's
a copy of ->init())
parent 65862d88
...@@ -3101,17 +3101,18 @@ MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); ...@@ -3101,17 +3101,18 @@ MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
int ide_cdrom_reinit (ide_drive_t *drive) int ide_cdrom_reinit (ide_drive_t *drive)
{ {
struct cdrom_info *info; struct cdrom_info *info;
int failed = 0;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
info = (struct cdrom_info *) kmalloc (sizeof (struct cdrom_info), GFP_KERNEL); info = (struct cdrom_info *) kmalloc (sizeof (struct cdrom_info), GFP_KERNEL);
if (info == NULL) { if (info == NULL) {
printk ("%s: Can't allocate a cdrom structure\n", drive->name); printk ("%s: Can't allocate a cdrom structure\n", drive->name);
MOD_DEC_USE_COUNT;
return 1; return 1;
} }
if (ide_register_subdriver (drive, &ide_cdrom_driver, IDE_SUBDRIVER_VERSION)) { if (ide_register_subdriver (drive, &ide_cdrom_driver, IDE_SUBDRIVER_VERSION)) {
printk ("%s: Failed to register the driver with ide.c\n", drive->name); printk ("%s: Failed to register the driver with ide.c\n", drive->name);
kfree (info); kfree (info);
MOD_DEC_USE_COUNT;
return 1; return 1;
} }
memset (info, 0, sizeof (struct cdrom_info)); memset (info, 0, sizeof (struct cdrom_info));
...@@ -3121,12 +3122,10 @@ int ide_cdrom_reinit (ide_drive_t *drive) ...@@ -3121,12 +3122,10 @@ int ide_cdrom_reinit (ide_drive_t *drive)
DRIVER(drive)->busy--; DRIVER(drive)->busy--;
if (ide_cdrom_cleanup (drive)) if (ide_cdrom_cleanup (drive))
printk ("%s: ide_cdrom_cleanup failed in ide_cdrom_init\n", drive->name); printk ("%s: ide_cdrom_cleanup failed in ide_cdrom_init\n", drive->name);
MOD_DEC_USE_COUNT;
return 1; return 1;
} }
DRIVER(drive)->busy--; DRIVER(drive)->busy--;
failed--;
ide_register_module(&ide_cdrom_module);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -3147,7 +3146,6 @@ static void __exit ide_cdrom_exit(void) ...@@ -3147,7 +3146,6 @@ static void __exit ide_cdrom_exit(void)
int ide_cdrom_init(void) int ide_cdrom_init(void)
{ {
ide_drive_t *drive; ide_drive_t *drive;
struct cdrom_info *info;
int failed = 0; int failed = 0;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
...@@ -3163,26 +3161,8 @@ int ide_cdrom_init(void) ...@@ -3163,26 +3161,8 @@ int ide_cdrom_init(void)
printk("ide-cd: passing drive %s to ide-scsi emulation.\n", drive->name); printk("ide-cd: passing drive %s to ide-scsi emulation.\n", drive->name);
continue; continue;
} }
info = (struct cdrom_info *) kmalloc (sizeof (struct cdrom_info), GFP_KERNEL); if (ide_cdrom_reinit(drive))
if (info == NULL) {
printk ("%s: Can't allocate a cdrom structure\n", drive->name);
continue; continue;
}
if (ide_register_subdriver (drive, &ide_cdrom_driver, IDE_SUBDRIVER_VERSION)) {
printk ("%s: Failed to register the driver with ide.c\n", drive->name);
kfree (info);
continue;
}
memset (info, 0, sizeof (struct cdrom_info));
drive->driver_data = info;
DRIVER(drive)->busy++;
if (ide_cdrom_setup (drive)) {
DRIVER(drive)->busy--;
if (ide_cdrom_cleanup (drive))
printk ("%s: ide_cdrom_cleanup failed in ide_cdrom_init\n", drive->name);
continue;
}
DRIVER(drive)->busy--;
failed--; failed--;
} }
ide_register_module(&ide_cdrom_module); ide_register_module(&ide_cdrom_module);
......
...@@ -1682,14 +1682,13 @@ static ide_module_t idedisk_module = { ...@@ -1682,14 +1682,13 @@ static ide_module_t idedisk_module = {
MODULE_DESCRIPTION("ATA DISK Driver"); MODULE_DESCRIPTION("ATA DISK Driver");
int idedisk_reinit (ide_drive_t *drive) int idedisk_reinit(ide_drive_t *drive)
{ {
int failed = 0;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
if (ide_register_subdriver (drive, &idedisk_driver, IDE_SUBDRIVER_VERSION)) { if (ide_register_subdriver (drive, &idedisk_driver, IDE_SUBDRIVER_VERSION)) {
printk (KERN_ERR "ide-disk: %s: Failed to register the driver with ide.c\n", drive->name); printk (KERN_ERR "ide-disk: %s: Failed to register the driver with ide.c\n", drive->name);
MOD_DEC_USE_COUNT;
return 1; return 1;
} }
DRIVER(drive)->busy++; DRIVER(drive)->busy++;
...@@ -1699,12 +1698,10 @@ int idedisk_reinit (ide_drive_t *drive) ...@@ -1699,12 +1698,10 @@ int idedisk_reinit (ide_drive_t *drive)
drive->name, drive->head); drive->name, drive->head);
(void) idedisk_cleanup(drive); (void) idedisk_cleanup(drive);
DRIVER(drive)->busy--; DRIVER(drive)->busy--;
MOD_DEC_USE_COUNT;
return 1; return 1;
} }
DRIVER(drive)->busy--; DRIVER(drive)->busy--;
failed--;
ide_register_module(&idedisk_module);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -1736,19 +1733,8 @@ int idedisk_init (void) ...@@ -1736,19 +1733,8 @@ int idedisk_init (void)
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices (ide_disk, idedisk_driver.name, NULL, failed++)) != NULL) { while ((drive = ide_scan_devices (ide_disk, idedisk_driver.name, NULL, failed++)) != NULL) {
if (ide_register_subdriver (drive, &idedisk_driver, IDE_SUBDRIVER_VERSION)) { if (idedisk_reinit(drive))
printk (KERN_ERR "ide-disk: %s: Failed to register the driver with ide.c\n", drive->name);
continue; continue;
}
DRIVER(drive)->busy++;
idedisk_setup(drive);
if ((!drive->head || drive->head > 16) && !drive->select.b.lba) {
printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n", drive->name, drive->head);
(void) idedisk_cleanup(drive);
DRIVER(drive)->busy--;
continue;
}
DRIVER(drive)->busy--;
failed--; failed--;
} }
ide_register_module(&idedisk_module); ide_register_module(&idedisk_module);
......
...@@ -2194,33 +2194,31 @@ static ide_module_t idefloppy_module = { ...@@ -2194,33 +2194,31 @@ static ide_module_t idefloppy_module = {
int idefloppy_reinit (ide_drive_t *drive) int idefloppy_reinit (ide_drive_t *drive)
{ {
idefloppy_floppy_t *floppy; idefloppy_floppy_t *floppy;
int failed = 0;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, NULL, failed++)) != NULL) { if (!idefloppy_identify_device (drive, drive->id)) {
if (!idefloppy_identify_device (drive, drive->id)) { printk (KERN_ERR "ide-floppy: %s: not supported by this version of ide-floppy\n", drive->name);
printk (KERN_ERR "ide-floppy: %s: not supported by this version of ide-floppy\n", drive->name); MOD_DEC_USE_COUNT;
continue; return 1;
}
if (drive->scsi) {
printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
continue;
}
if ((floppy = (idefloppy_floppy_t *) kmalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) {
printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name);
continue;
}
if (ide_register_subdriver (drive, &idefloppy_driver, IDE_SUBDRIVER_VERSION)) {
printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (floppy);
continue;
}
DRIVER(drive)->busy++;
idefloppy_setup (drive, floppy);
DRIVER(drive)->busy--;
failed--;
} }
ide_register_module(&idefloppy_module); if (drive->scsi) {
printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
MOD_DEC_USE_COUNT;
return 1;
}
if ((floppy = (idefloppy_floppy_t *) kmalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) {
printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name);
MOD_DEC_USE_COUNT;
return 1;
}
if (ide_register_subdriver (drive, &idefloppy_driver, IDE_SUBDRIVER_VERSION)) {
printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (floppy);
MOD_DEC_USE_COUNT;
return 1;
}
DRIVER(drive)->busy++;
idefloppy_setup (drive, floppy);
DRIVER(drive)->busy--;
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -2253,32 +2251,13 @@ static void __exit idefloppy_exit (void) ...@@ -2253,32 +2251,13 @@ static void __exit idefloppy_exit (void)
int idefloppy_init (void) int idefloppy_init (void)
{ {
ide_drive_t *drive; ide_drive_t *drive;
idefloppy_floppy_t *floppy;
int failed = 0; int failed = 0;
printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); printk("ide-floppy driver " IDEFLOPPY_VERSION "\n");
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, NULL, failed++)) != NULL) { while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, NULL, failed++)) != NULL) {
if (!idefloppy_identify_device (drive, drive->id)) { if (idefloppy_reinit(drive))
printk (KERN_ERR "ide-floppy: %s: not supported by this version of ide-floppy\n", drive->name);
continue;
}
if (drive->scsi) {
printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
continue;
}
if ((floppy = (idefloppy_floppy_t *) kmalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) {
printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name);
continue;
}
if (ide_register_subdriver (drive, &idefloppy_driver, IDE_SUBDRIVER_VERSION)) {
printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (floppy);
continue; continue;
}
DRIVER(drive)->busy++;
idefloppy_setup (drive, floppy);
DRIVER(drive)->busy--;
failed--; failed--;
} }
ide_register_module(&idefloppy_module); ide_register_module(&idefloppy_module);
......
...@@ -6367,89 +6367,53 @@ static struct file_operations idetape_fops = { ...@@ -6367,89 +6367,53 @@ static struct file_operations idetape_fops = {
int idetape_reinit (ide_drive_t *drive) int idetape_reinit (ide_drive_t *drive)
{ {
#if 0
idetape_tape_t *tape; idetape_tape_t *tape;
int minor, failed = 0, supported = 0; int minor;
/* DRIVER(drive)->busy++; */
MOD_INC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_INC_USE_COUNT in idetape_init\n");
#endif
if (!idetape_chrdev_present)
for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++ )
idetape_chrdevs[minor].drive = NULL;
if ((drive = ide_scan_devices(ide_tape, idetape_driver.name, NULL, failed++)) == NULL) { MOD_INC_USE_COUNT;
ide_register_module(&idetape_module); if (!idetape_identify_device (drive, drive->id)) {
printk(KERN_ERR "ide-tape: %s: not supported by this version of ide-tape\n", drive->name);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG return 1;
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return 0;
} }
if (!idetape_chrdev_present && if (drive->scsi) {
register_chrdev(IDETAPE_MAJOR, "ht", &idetape_fops)) { if (strstr(drive->id->model, "OnStream DI-")) {
printk(KERN_ERR "ide-tape: Failed to register character device interface\n"); printk("ide-tape: ide-scsi emulation is not supported for %s.\n", drive->id->model);
} else {
printk("ide-tape: passing drive %s to ide-scsi emulation.\n", drive->name);
MOD_DEC_USE_COUNT;
return 1;
}
}
tape = (idetape_tape_t *) kmalloc (sizeof (idetape_tape_t), GFP_KERNEL);
if (tape == NULL) {
printk(KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG return 1;
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return -EBUSY;
} }
do { if (ide_register_subdriver (drive, &idetape_driver, IDE_SUBDRIVER_VERSION)) {
if (!idetape_identify_device(drive, drive->id)) { printk(KERN_ERR "ide-tape: %s: Failed to register the driver with ide.c\n", drive->name);
printk(KERN_ERR "ide-tape: %s: not supported by this version of ide-tape\n", drive->name); kfree(tape);
continue; MOD_DEC_USE_COUNT;
} return 1;
if (drive->scsi) { }
if (strstr(drive->id->model, "OnStream DI-30")) { for (minor = 0; idetape_chrdevs[minor].drive != NULL; minor++)
printk("ide-tape: ide-scsi emulation is not supported for %s.\n", drive->id->model); ;
} else { idetape_setup(drive, tape, minor);
printk("ide-tape: passing drive %s to ide-scsi emulation.\n", drive->name); idetape_chrdevs[minor].drive = drive;
continue; tape->de_r =
} devfs_register (drive->de, "mt", DEVFS_FL_DEFAULT,
} HWIF(drive)->major, minor,
tape = (idetape_tape_t *) kmalloc (sizeof (idetape_tape_t), GFP_KERNEL); S_IFCHR | S_IRUGO | S_IWUGO,
if (tape == NULL) { &idetape_fops, NULL);
printk(KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name); tape->de_n =
continue; devfs_register (drive->de, "mtn", DEVFS_FL_DEFAULT,
} HWIF(drive)->major, minor + 128,
if (ide_register_subdriver (drive, &idetape_driver, IDE_SUBDRIVER_VERSION)) { S_IFCHR | S_IRUGO | S_IWUGO,
printk(KERN_ERR "ide-tape: %s: Failed to register the driver with ide.c\n", drive->name); &idetape_fops, NULL);
kfree(tape); devfs_register_tape(tape->de_r);
continue;
}
for (minor = 0; idetape_chrdevs[minor].drive != NULL; minor++);
idetape_setup(drive, tape, minor);
idetape_chrdevs[minor].drive = drive;
tape->de_r =
devfs_register (drive->de, "mt", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
tape->de_n =
devfs_register (drive->de, "mtn", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor + 128,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
devfs_register_tape(tape->de_r);
supported++;
failed--;
} while ((drive = ide_scan_devices(ide_tape, idetape_driver.name, NULL, failed++)) != NULL);
if (!idetape_chrdev_present && !supported) {
devfs_unregister_chrdev(IDETAPE_MAJOR, "ht");
} else
idetape_chrdev_present = 1;
ide_register_module(&idetape_module);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return 0; return 0;
#else
return 1;
#endif
} }
MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver");
...@@ -6474,83 +6438,31 @@ static void __exit idetape_exit (void) ...@@ -6474,83 +6438,31 @@ static void __exit idetape_exit (void)
int idetape_init (void) int idetape_init (void)
{ {
ide_drive_t *drive; ide_drive_t *drive;
idetape_tape_t *tape;
int minor, failed = 0, supported = 0; int minor, failed = 0, supported = 0;
/* DRIVER(drive)->busy++; */ /* DRIVER(drive)->busy++; */
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
#if ONSTREAM_DEBUG if (!idetape_chrdev_present) {
printk(KERN_INFO "ide-tape: MOD_INC_USE_COUNT in idetape_init\n"); if (register_chrdev(IDETAPE_MAJOR, "ht", &idetape_fops)) {
#endif printk(KERN_ERR "ide-tape: Failed to register character device interface\n");
if (!idetape_chrdev_present) MOD_DEC_USE_COUNT;
for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++ ) return -EBUSY;
}
for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++)
idetape_chrdevs[minor].drive = NULL; idetape_chrdevs[minor].drive = NULL;
if ((drive = ide_scan_devices(ide_tape, idetape_driver.name, NULL, failed++)) == NULL) {
ide_register_module(&idetape_module);
MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return 0;
} }
if (!idetape_chrdev_present &&
register_chrdev(IDETAPE_MAJOR, "ht", &idetape_fops)) { while ((drive = ide_scan_devices(ide_tape, idetape_driver.name, NULL, failed++))) {
printk(KERN_ERR "ide-tape: Failed to register character device interface\n"); if (idetape_reinit(drive))
MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return -EBUSY;
}
do {
if (!idetape_identify_device (drive, drive->id)) {
printk(KERN_ERR "ide-tape: %s: not supported by this version of ide-tape\n", drive->name);
continue;
}
if (drive->scsi) {
if (strstr(drive->id->model, "OnStream DI-")) {
printk("ide-tape: ide-scsi emulation is not supported for %s.\n", drive->id->model);
} else {
printk("ide-tape: passing drive %s to ide-scsi emulation.\n", drive->name);
continue;
}
}
tape = (idetape_tape_t *) kmalloc (sizeof (idetape_tape_t), GFP_KERNEL);
if (tape == NULL) {
printk(KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name);
continue;
}
if (ide_register_subdriver (drive, &idetape_driver, IDE_SUBDRIVER_VERSION)) {
printk(KERN_ERR "ide-tape: %s: Failed to register the driver with ide.c\n", drive->name);
kfree(tape);
continue; continue;
}
for (minor = 0; idetape_chrdevs[minor].drive != NULL; minor++);
idetape_setup(drive, tape, minor);
idetape_chrdevs[minor].drive = drive;
tape->de_r =
devfs_register (drive->de, "mt", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
tape->de_n =
devfs_register (drive->de, "mtn", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor + 128,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
devfs_register_tape(tape->de_r);
supported++; supported++;
failed--; failed--;
} while ((drive = ide_scan_devices(ide_tape, idetape_driver.name, NULL, failed++)) != NULL); }
if (!idetape_chrdev_present && !supported) { if (!idetape_chrdev_present && !supported) {
unregister_chrdev(IDETAPE_MAJOR, "ht"); unregister_chrdev(IDETAPE_MAJOR, "ht");
} else } else
idetape_chrdev_present = 1; idetape_chrdev_present = 1;
ide_register_module(&idetape_module); ide_register_module(&idetape_module);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
#if ONSTREAM_DEBUG
printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
#endif
return 0; return 0;
} }
......
...@@ -539,6 +539,8 @@ static int idescsi_cleanup (ide_drive_t *drive) ...@@ -539,6 +539,8 @@ static int idescsi_cleanup (ide_drive_t *drive)
return 0; return 0;
} }
static int idescsi_reinit(ide_drive_t *drive);
/* /*
* IDE subdriver functions, registered with ide.c * IDE subdriver functions, registered with ide.c
*/ */
...@@ -549,6 +551,7 @@ static ide_driver_t idescsi_driver = { ...@@ -549,6 +551,7 @@ static ide_driver_t idescsi_driver = {
busy: 0, busy: 0,
supports_dma: 1, supports_dma: 1,
supports_dsc_overlap: 0, supports_dsc_overlap: 0,
reinit: idescsi_reinit,
cleanup: idescsi_cleanup, cleanup: idescsi_cleanup,
standby: NULL, standby: NULL,
flushcache: NULL, flushcache: NULL,
...@@ -573,15 +576,39 @@ static ide_module_t idescsi_module = { ...@@ -573,15 +576,39 @@ static ide_module_t idescsi_module = {
NULL NULL
}; };
static int idescsi_reinit(ide_drive_t *drive)
{
idescsi_scsi_t *scsi;
int id;
MOD_INC_USE_COUNT;
if ((scsi = (idescsi_scsi_t *) kmalloc (sizeof (idescsi_scsi_t), GFP_KERNEL)) == NULL) {
printk (KERN_ERR "ide-scsi: %s: Can't allocate a scsi structure\n", drive->name);
MOD_DEC_USE_COUNT;
return 1;
}
if (ide_register_subdriver (drive, &idescsi_driver, IDE_SUBDRIVER_VERSION)) {
printk (KERN_ERR "ide-scsi: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (scsi);
MOD_DEC_USE_COUNT;
return 1;
}
for (id = 0; id < MAX_HWIFS * MAX_DRIVES && idescsi_drives[id]; id++)
;
idescsi_setup (drive, scsi, id);
MOD_DEC_USE_COUNT;
return 0;
}
/* /*
* idescsi_init will register the driver for each scsi. * idescsi_init will register the driver for each scsi.
*/ */
int idescsi_init (void) int idescsi_init (void)
{ {
ide_drive_t *drive; ide_drive_t *drive;
idescsi_scsi_t *scsi;
byte media[] = {TYPE_DISK, TYPE_TAPE, TYPE_PROCESSOR, TYPE_WORM, TYPE_ROM, TYPE_SCANNER, TYPE_MOD, 255}; byte media[] = {TYPE_DISK, TYPE_TAPE, TYPE_PROCESSOR, TYPE_WORM, TYPE_ROM, TYPE_SCANNER, TYPE_MOD, 255};
int i, failed, id; int i, failed;
if (idescsi_initialized) if (idescsi_initialized)
return 0; return 0;
...@@ -592,18 +619,8 @@ int idescsi_init (void) ...@@ -592,18 +619,8 @@ int idescsi_init (void)
for (i = 0; media[i] != 255; i++) { for (i = 0; media[i] != 255; i++) {
failed = 0; failed = 0;
while ((drive = ide_scan_devices (media[i], idescsi_driver.name, NULL, failed++)) != NULL) { while ((drive = ide_scan_devices (media[i], idescsi_driver.name, NULL, failed++)) != NULL) {
if (idescsi_reinit(drive))
if ((scsi = (idescsi_scsi_t *) kmalloc (sizeof (idescsi_scsi_t), GFP_KERNEL)) == NULL) {
printk (KERN_ERR "ide-scsi: %s: Can't allocate a scsi structure\n", drive->name);
continue; continue;
}
if (ide_register_subdriver (drive, &idescsi_driver, IDE_SUBDRIVER_VERSION)) {
printk (KERN_ERR "ide-scsi: %s: Failed to register the driver with ide.c\n", drive->name);
kfree (scsi);
continue;
}
for (id = 0; id < MAX_HWIFS * MAX_DRIVES && idescsi_drives[id]; id++);
idescsi_setup (drive, scsi, id);
failed--; failed--;
} }
} }
......
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