diff options
| author | Alexander Viro <viro@math.psu.edu> | 2002-08-10 02:21:45 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-08-10 02:21:45 -0700 |
| commit | fc4dfb65c5e15d466300c195ab967701bfa1dd49 (patch) | |
| tree | cc3aa067908c208ce6915ba3d604280a06c1c92e | |
| parent | 7e06e792cd7ded1e7fdc57c2bdd78099ef79678b (diff) | |
[PATCH] ide subdrivers attach() cleanup
->attach() for ide subdrivers explicitly calls register_disk()
instead of ata_revalidate() now; revalidate_drives() is gone -
it's not needed anymore (we _know_ that we'll read partition
table as soon as driver claims the drive; no need to mess with
bogus rereading).
| -rw-r--r-- | drivers/ide/ide-cd.c | 9 | ||||
| -rw-r--r-- | drivers/ide/ide-disk.c | 7 | ||||
| -rw-r--r-- | drivers/ide/ide-floppy.c | 8 | ||||
| -rw-r--r-- | drivers/ide/ide-tape.c | 7 | ||||
| -rw-r--r-- | drivers/ide/main.c | 34 |
5 files changed, 19 insertions, 46 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 4ef0d796b404..a8023d010d57 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -2946,6 +2946,7 @@ static void ide_cdrom_attach(struct ata_device *drive) struct cdrom_info *info; char *req; struct ata_channel *channel; + struct gendisk *disk; int unit; if (drive->type != ATA_ROM) @@ -2983,8 +2984,12 @@ static void ide_cdrom_attach(struct ata_device *drive) channel = drive->channel; unit = drive - channel->drives; - - ata_revalidate(mk_kdev(channel->major, unit << PARTN_BITS)); + disk = channel->gd[unit]; + disk->minor_shift = 0; + ide_cdrom_revalidate(drive); + register_disk(disk, mk_kdev(disk->major, disk->first_minor), + 1<<disk->minor_shift, disk->fops, + ide_cdrom_capacity(drive)); } MODULE_PARM(ignore, "s"); diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 1d05083bbfc5..9d94ddf73422 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -1462,6 +1462,7 @@ static void idedisk_attach(struct ata_device *drive) { char *req; struct ata_channel *channel; + struct gendisk *disk; int unit; if (drive->type != ATA_DISK) @@ -1485,8 +1486,10 @@ static void idedisk_attach(struct ata_device *drive) channel = drive->channel; unit = drive - channel->drives; - - ata_revalidate(mk_kdev(channel->major, unit << PARTN_BITS)); + disk = channel->gd[unit]; + disk->minor_shift = PARTN_BITS; + register_disk(disk, mk_kdev(disk->major, disk->first_minor), + 1<<disk->minor_shift, disk->fops, drive->capacity); } static void __exit idedisk_exit(void) diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 5220ed1c3b26..a00f1de8e3f4 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -1755,6 +1755,7 @@ static void idefloppy_attach(struct ata_device *drive) idefloppy_floppy_t *floppy; char *req; struct ata_channel *channel; + struct gendisk *disk; int unit; if (drive->type != ATA_FLOPPY) @@ -1790,8 +1791,11 @@ static void idefloppy_attach(struct ata_device *drive) channel = drive->channel; unit = drive - channel->drives; - - ata_revalidate(mk_kdev(channel->major, unit << PARTN_BITS)); + disk = channel->gd[unit]; + disk->minor_shift = PARTN_BITS; + register_disk(disk, mk_kdev(disk->major, disk->first_minor), + 1<<disk->minor_shift, disk->fops, + idefloppy_capacity(drive)); } MODULE_DESCRIPTION("ATAPI FLOPPY Driver"); diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 5d6e451dd92c..b8392e7a0cdd 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -5641,13 +5641,6 @@ static void idetape_attach(struct ata_device *drive) unregister_chrdev (IDETAPE_MAJOR, "ht"); } else idetape_chrdev_present = 1; - - /* Feel free to use partitions even on tapes... */ - - channel = drive->channel; - unit = drive - channel->drives; - - ata_revalidate(mk_kdev(channel->major, unit << PARTN_BITS)); } MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); diff --git a/drivers/ide/main.c b/drivers/ide/main.c index cab68f44fa26..e952e84c63ed 100644 --- a/drivers/ide/main.c +++ b/drivers/ide/main.c @@ -296,31 +296,6 @@ int ata_revalidate(kdev_t i_rdev) return res; } -/* - * FIXME: this is most propably just totally unnecessary. - * - * Look again for all drives in the system on all interfaces. - */ -static void revalidate_drives(void) -{ - int i; - - for (i = 0; i < MAX_HWIFS; ++i) { - int unit; - struct ata_channel *ch = &ide_hwifs[i]; - - for (unit = 0; unit < MAX_DRIVES; ++unit) { - struct ata_device *drive = &ch->drives[unit]; - - if (drive->revalidate) { - drive->revalidate = 0; - if (!initializing) - ata_revalidate(mk_kdev(ch->major, unit<<PARTN_BITS)); - } - } - } -} - void ide_driver_module(void) { int i; @@ -328,13 +303,10 @@ void ide_driver_module(void) /* Don't reinit the probe if there is already one channel detected. */ for (i = 0; i < MAX_HWIFS; ++i) { if (ide_hwifs[i].present) - goto revalidate; + return; } ideprobe_init(); - -revalidate: - revalidate_drives(); } /* @@ -614,7 +586,6 @@ found: if (!initializing) { ideprobe_init(); - revalidate_drives(); /* FIXME: Do we really have to call it second time here?! */ ide_driver_module(); } @@ -1094,8 +1065,6 @@ int ata_register_device(struct ata_device *drive, struct ata_operations *driver) drive->dsc_overlap = 0; } - drive->revalidate = 1; - return 0; } @@ -1179,7 +1148,6 @@ devfs_handle_t ide_devfs_handle; EXPORT_SYMBOL(ata_register_device); EXPORT_SYMBOL(ata_unregister_device); -EXPORT_SYMBOL(ata_revalidate); EXPORT_SYMBOL(ide_register_hw); EXPORT_SYMBOL(ide_unregister); EXPORT_SYMBOL(get_info_ptr); |
