提交 1e874f44 编写于 作者: B Bartlomiej Zolnierkiewicz

ide: call ide_proc_register_driver() later

Call ide_proc_register_driver() in ide*_setup() (just before
ide*_add_settings() call) instead of in ->probe method.

Despite being basically a preparation for /proc/ide/hd*/settings
rework this is a nice cleanup in itself.
Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
上级 3ceca727
...@@ -1924,6 +1924,8 @@ static int ide_cdrom_setup(ide_drive_t *drive) ...@@ -1924,6 +1924,8 @@ static int ide_cdrom_setup(ide_drive_t *drive)
cd->devinfo.handle = NULL; cd->devinfo.handle = NULL;
return 1; return 1;
} }
ide_proc_register_driver(drive, cd->driver);
ide_cdrom_add_settings(drive); ide_cdrom_add_settings(drive);
return 0; return 0;
} }
...@@ -2134,8 +2136,6 @@ static int ide_cd_probe(ide_drive_t *drive) ...@@ -2134,8 +2136,6 @@ static int ide_cd_probe(ide_drive_t *drive)
ide_init_disk(g, drive); ide_init_disk(g, drive);
ide_proc_register_driver(drive, &ide_cdrom_driver);
kref_init(&info->kref); kref_init(&info->kref);
info->drive = drive; info->drive = drive;
...@@ -2150,7 +2150,6 @@ static int ide_cd_probe(ide_drive_t *drive) ...@@ -2150,7 +2150,6 @@ static int ide_cd_probe(ide_drive_t *drive)
g->driverfs_dev = &drive->gendev; g->driverfs_dev = &drive->gendev;
g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
if (ide_cdrom_setup(drive)) { if (ide_cdrom_setup(drive)) {
ide_proc_unregister_driver(drive, &ide_cdrom_driver);
ide_cd_release(&info->kref); ide_cd_release(&info->kref);
goto failed; goto failed;
} }
......
...@@ -782,11 +782,13 @@ static inline void idedisk_add_settings(ide_drive_t *drive) { ; } ...@@ -782,11 +782,13 @@ static inline void idedisk_add_settings(ide_drive_t *drive) { ; }
static void idedisk_setup(ide_drive_t *drive) static void idedisk_setup(ide_drive_t *drive)
{ {
struct ide_disk_obj *idkp = drive->driver_data;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
u16 *id = drive->id; u16 *id = drive->id;
char *m = (char *)&id[ATA_ID_PROD]; char *m = (char *)&id[ATA_ID_PROD];
unsigned long long capacity; unsigned long long capacity;
ide_proc_register_driver(drive, idkp->driver);
idedisk_add_settings(drive); idedisk_add_settings(drive);
if (drive->id_read == 0) if (drive->id_read == 0)
...@@ -1151,8 +1153,6 @@ static int ide_disk_probe(ide_drive_t *drive) ...@@ -1151,8 +1153,6 @@ static int ide_disk_probe(ide_drive_t *drive)
ide_init_disk(g, drive); ide_init_disk(g, drive);
ide_proc_register_driver(drive, &idedisk_driver);
kref_init(&idkp->kref); kref_init(&idkp->kref);
idkp->drive = drive; idkp->drive = drive;
......
...@@ -1061,6 +1061,8 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) ...@@ -1061,6 +1061,8 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
} }
(void) ide_floppy_get_capacity(drive); (void) ide_floppy_get_capacity(drive);
ide_proc_register_driver(drive, floppy->driver);
idefloppy_add_settings(drive); idefloppy_add_settings(drive);
} }
...@@ -1413,8 +1415,6 @@ static int ide_floppy_probe(ide_drive_t *drive) ...@@ -1413,8 +1415,6 @@ static int ide_floppy_probe(ide_drive_t *drive)
ide_init_disk(g, drive); ide_init_disk(g, drive);
ide_proc_register_driver(drive, &idefloppy_driver);
kref_init(&floppy->kref); kref_init(&floppy->kref);
floppy->drive = drive; floppy->drive = drive;
......
...@@ -2514,6 +2514,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) ...@@ -2514,6 +2514,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
tape->best_dsc_rw_freq * 1000 / HZ, tape->best_dsc_rw_freq * 1000 / HZ,
drive->using_dma ? ", DMA":""); drive->using_dma ? ", DMA":"");
ide_proc_register_driver(drive, tape->driver);
idetape_add_settings(drive); idetape_add_settings(drive);
} }
...@@ -2669,8 +2670,6 @@ static int ide_tape_probe(ide_drive_t *drive) ...@@ -2669,8 +2670,6 @@ static int ide_tape_probe(ide_drive_t *drive)
ide_init_disk(g, drive); ide_init_disk(g, drive);
ide_proc_register_driver(drive, &idetape_driver);
kref_init(&tape->kref); kref_init(&tape->kref);
tape->drive = drive; tape->drive = drive;
......
...@@ -460,6 +460,7 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi) ...@@ -460,6 +460,7 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
drive->pc_callback = ide_scsi_callback; drive->pc_callback = ide_scsi_callback;
ide_proc_register_driver(drive, scsi->driver);
idescsi_add_settings(drive); idescsi_add_settings(drive);
} }
...@@ -851,7 +852,6 @@ static int ide_scsi_probe(ide_drive_t *drive) ...@@ -851,7 +852,6 @@ static int ide_scsi_probe(ide_drive_t *drive)
idescsi->host = host; idescsi->host = host;
idescsi->disk = g; idescsi->disk = g;
g->private_data = &idescsi->driver; g->private_data = &idescsi->driver;
ide_proc_register_driver(drive, &idescsi_driver);
err = 0; err = 0;
idescsi_setup(drive, idescsi); idescsi_setup(drive, idescsi);
g->fops = &idescsi_ops; g->fops = &idescsi_ops;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册