diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:27 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:27 -0400 |
commit | 1e874f448365b80e69b8a60b8b575b17f00811f3 (patch) | |
tree | 6a79a12ffdcaa12f5f89356527c1ab02014c751b /drivers | |
parent | 3ceca727fe3a38dd8d7a3adf938fefda83eee8af (diff) |
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: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-cd.c | 5 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 3 | ||||
-rw-r--r-- | drivers/scsi/ide-scsi.c | 2 |
5 files changed, 8 insertions, 10 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 607af5de16f8..34a1aeaa15dd 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1924,6 +1924,8 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1924 | cd->devinfo.handle = NULL; | 1924 | cd->devinfo.handle = NULL; |
1925 | return 1; | 1925 | return 1; |
1926 | } | 1926 | } |
1927 | |||
1928 | ide_proc_register_driver(drive, cd->driver); | ||
1927 | ide_cdrom_add_settings(drive); | 1929 | ide_cdrom_add_settings(drive); |
1928 | return 0; | 1930 | return 0; |
1929 | } | 1931 | } |
@@ -2134,8 +2136,6 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
2134 | 2136 | ||
2135 | ide_init_disk(g, drive); | 2137 | ide_init_disk(g, drive); |
2136 | 2138 | ||
2137 | ide_proc_register_driver(drive, &ide_cdrom_driver); | ||
2138 | |||
2139 | kref_init(&info->kref); | 2139 | kref_init(&info->kref); |
2140 | 2140 | ||
2141 | info->drive = drive; | 2141 | info->drive = drive; |
@@ -2150,7 +2150,6 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
2150 | g->driverfs_dev = &drive->gendev; | 2150 | g->driverfs_dev = &drive->gendev; |
2151 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; | 2151 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; |
2152 | if (ide_cdrom_setup(drive)) { | 2152 | if (ide_cdrom_setup(drive)) { |
2153 | ide_proc_unregister_driver(drive, &ide_cdrom_driver); | ||
2154 | ide_cd_release(&info->kref); | 2153 | ide_cd_release(&info->kref); |
2155 | goto failed; | 2154 | goto failed; |
2156 | } | 2155 | } |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 6e1a25e61df5..5fc4213437a5 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -782,11 +782,13 @@ static inline void idedisk_add_settings(ide_drive_t *drive) { ; } | |||
782 | 782 | ||
783 | static void idedisk_setup(ide_drive_t *drive) | 783 | static void idedisk_setup(ide_drive_t *drive) |
784 | { | 784 | { |
785 | struct ide_disk_obj *idkp = drive->driver_data; | ||
785 | ide_hwif_t *hwif = drive->hwif; | 786 | ide_hwif_t *hwif = drive->hwif; |
786 | u16 *id = drive->id; | 787 | u16 *id = drive->id; |
787 | char *m = (char *)&id[ATA_ID_PROD]; | 788 | char *m = (char *)&id[ATA_ID_PROD]; |
788 | unsigned long long capacity; | 789 | unsigned long long capacity; |
789 | 790 | ||
791 | ide_proc_register_driver(drive, idkp->driver); | ||
790 | idedisk_add_settings(drive); | 792 | idedisk_add_settings(drive); |
791 | 793 | ||
792 | if (drive->id_read == 0) | 794 | if (drive->id_read == 0) |
@@ -1151,8 +1153,6 @@ static int ide_disk_probe(ide_drive_t *drive) | |||
1151 | 1153 | ||
1152 | ide_init_disk(g, drive); | 1154 | ide_init_disk(g, drive); |
1153 | 1155 | ||
1154 | ide_proc_register_driver(drive, &idedisk_driver); | ||
1155 | |||
1156 | kref_init(&idkp->kref); | 1156 | kref_init(&idkp->kref); |
1157 | 1157 | ||
1158 | idkp->drive = drive; | 1158 | idkp->drive = drive; |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index b0f4d8459a9d..597459c81d5f 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -1061,6 +1061,8 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) | |||
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | (void) ide_floppy_get_capacity(drive); | 1063 | (void) ide_floppy_get_capacity(drive); |
1064 | |||
1065 | ide_proc_register_driver(drive, floppy->driver); | ||
1064 | idefloppy_add_settings(drive); | 1066 | idefloppy_add_settings(drive); |
1065 | } | 1067 | } |
1066 | 1068 | ||
@@ -1413,8 +1415,6 @@ static int ide_floppy_probe(ide_drive_t *drive) | |||
1413 | 1415 | ||
1414 | ide_init_disk(g, drive); | 1416 | ide_init_disk(g, drive); |
1415 | 1417 | ||
1416 | ide_proc_register_driver(drive, &idefloppy_driver); | ||
1417 | |||
1418 | kref_init(&floppy->kref); | 1418 | kref_init(&floppy->kref); |
1419 | 1419 | ||
1420 | floppy->drive = drive; | 1420 | floppy->drive = drive; |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 874e60fc85d1..f41983e4a4e4 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -2514,6 +2514,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
2514 | tape->best_dsc_rw_freq * 1000 / HZ, | 2514 | tape->best_dsc_rw_freq * 1000 / HZ, |
2515 | drive->using_dma ? ", DMA":""); | 2515 | drive->using_dma ? ", DMA":""); |
2516 | 2516 | ||
2517 | ide_proc_register_driver(drive, tape->driver); | ||
2517 | idetape_add_settings(drive); | 2518 | idetape_add_settings(drive); |
2518 | } | 2519 | } |
2519 | 2520 | ||
@@ -2669,8 +2670,6 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
2669 | 2670 | ||
2670 | ide_init_disk(g, drive); | 2671 | ide_init_disk(g, drive); |
2671 | 2672 | ||
2672 | ide_proc_register_driver(drive, &idetape_driver); | ||
2673 | |||
2674 | kref_init(&tape->kref); | 2673 | kref_init(&tape->kref); |
2675 | 2674 | ||
2676 | tape->drive = drive; | 2675 | tape->drive = drive; |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index d9a2cc09f5c6..02bd5c487d1f 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -460,6 +460,7 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi) | |||
460 | 460 | ||
461 | drive->pc_callback = ide_scsi_callback; | 461 | drive->pc_callback = ide_scsi_callback; |
462 | 462 | ||
463 | ide_proc_register_driver(drive, scsi->driver); | ||
463 | idescsi_add_settings(drive); | 464 | idescsi_add_settings(drive); |
464 | } | 465 | } |
465 | 466 | ||
@@ -851,7 +852,6 @@ static int ide_scsi_probe(ide_drive_t *drive) | |||
851 | idescsi->host = host; | 852 | idescsi->host = host; |
852 | idescsi->disk = g; | 853 | idescsi->disk = g; |
853 | g->private_data = &idescsi->driver; | 854 | g->private_data = &idescsi->driver; |
854 | ide_proc_register_driver(drive, &idescsi_driver); | ||
855 | err = 0; | 855 | err = 0; |
856 | idescsi_setup(drive, idescsi); | 856 | idescsi_setup(drive, idescsi); |
857 | g->fops = &idescsi_ops; | 857 | g->fops = &idescsi_ops; |