diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:41 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:41 -0500 |
commit | 0947e0dcd62c15c67dba71561624d87b2d0cf131 (patch) | |
tree | 394c85287361d56e73771589b89d11d180a9a92b /drivers/ide | |
parent | 8a0e7e14a28b1084e90f8828d35530019c645969 (diff) |
ide: factor out adding drive to hwgroup from init_irq()
Factor out adding drive to hwgroup from init_irq() to
ide_add_drive_to_hwgroup().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-probe.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index e7067c20e338..4d940d1a80ed 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -911,6 +911,23 @@ static int ide_init_queue(ide_drive_t *drive) | |||
911 | return 0; | 911 | return 0; |
912 | } | 912 | } |
913 | 913 | ||
914 | static void ide_add_drive_to_hwgroup(ide_drive_t *drive) | ||
915 | { | ||
916 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | ||
917 | |||
918 | spin_lock_irq(&ide_lock); | ||
919 | if (!hwgroup->drive) { | ||
920 | /* first drive for hwgroup. */ | ||
921 | drive->next = drive; | ||
922 | hwgroup->drive = drive; | ||
923 | hwgroup->hwif = HWIF(hwgroup->drive); | ||
924 | } else { | ||
925 | drive->next = hwgroup->drive->next; | ||
926 | hwgroup->drive->next = drive; | ||
927 | } | ||
928 | spin_unlock_irq(&ide_lock); | ||
929 | } | ||
930 | |||
914 | /* | 931 | /* |
915 | * This routine sets up the irq for an ide interface, and creates a new | 932 | * This routine sets up the irq for an ide interface, and creates a new |
916 | * hwgroup for the irq/hwif if none was previously assigned. | 933 | * hwgroup for the irq/hwif if none was previously assigned. |
@@ -1033,17 +1050,7 @@ static int init_irq (ide_hwif_t *hwif) | |||
1033 | printk(KERN_ERR "ide: failed to init %s\n",drive->name); | 1050 | printk(KERN_ERR "ide: failed to init %s\n",drive->name); |
1034 | continue; | 1051 | continue; |
1035 | } | 1052 | } |
1036 | spin_lock_irq(&ide_lock); | 1053 | ide_add_drive_to_hwgroup(drive); |
1037 | if (!hwgroup->drive) { | ||
1038 | /* first drive for hwgroup. */ | ||
1039 | drive->next = drive; | ||
1040 | hwgroup->drive = drive; | ||
1041 | hwgroup->hwif = HWIF(hwgroup->drive); | ||
1042 | } else { | ||
1043 | drive->next = hwgroup->drive->next; | ||
1044 | hwgroup->drive->next = drive; | ||
1045 | } | ||
1046 | spin_unlock_irq(&ide_lock); | ||
1047 | } | 1054 | } |
1048 | 1055 | ||
1049 | #if !defined(__mc68000__) && !defined(CONFIG_APUS) | 1056 | #if !defined(__mc68000__) && !defined(CONFIG_APUS) |