Commit fc4dfb65 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[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).
parent 7e06e792
......@@ -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");
......
......@@ -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)
......
......@@ -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");
......
......@@ -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");
......
......@@ -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 @@ int ide_register_hw(hw_regs_t *hw)
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);
......
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