aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:58 -0400
commit6059143ae34f30bb49ec8733468315284f78e2da (patch)
treec891300d24bb78664464e44a3924293c6c85a5c1 /drivers/ide
parent8cdf310025bff8c5ef78564f525a8f347952237b (diff)
ide: move ide_remove_port_from_hwgroup() to ide-probe.c
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-probe.c35
-rw-r--r--drivers/ide/ide.c35
2 files changed, 35 insertions, 35 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index fdf00cde9fce..21cdd9ca14d1 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -992,6 +992,41 @@ static void ide_port_setup_devices(ide_hwif_t *hwif)
992 mutex_unlock(&ide_cfg_mtx); 992 mutex_unlock(&ide_cfg_mtx);
993} 993}
994 994
995void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
996{
997 ide_hwgroup_t *hwgroup = hwif->hwgroup;
998
999 spin_lock_irq(&ide_lock);
1000 /*
1001 * Remove us from the hwgroup, and free
1002 * the hwgroup if we were the only member
1003 */
1004 if (hwif->next == hwif) {
1005 BUG_ON(hwgroup->hwif != hwif);
1006 kfree(hwgroup);
1007 } else {
1008 /* There is another interface in hwgroup.
1009 * Unlink us, and set hwgroup->drive and ->hwif to
1010 * something sane.
1011 */
1012 ide_hwif_t *g = hwgroup->hwif;
1013
1014 while (g->next != hwif)
1015 g = g->next;
1016 g->next = hwif->next;
1017 if (hwgroup->hwif == hwif) {
1018 /* Chose a random hwif for hwgroup->hwif.
1019 * It's guaranteed that there are no drives
1020 * left in the hwgroup.
1021 */
1022 BUG_ON(hwgroup->drive != NULL);
1023 hwgroup->hwif = g;
1024 }
1025 BUG_ON(hwgroup->hwif == hwif);
1026 }
1027 spin_unlock_irq(&ide_lock);
1028}
1029
995/* 1030/*
996 * This routine sets up the irq for an ide interface, and creates a new 1031 * This routine sets up the irq for an ide interface, and creates a new
997 * hwgroup for the irq/hwif if none was previously assigned. 1032 * hwgroup for the irq/hwif if none was previously assigned.
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 7e9575d1aee3..60c5db1c59e5 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -133,41 +133,6 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif)
133 } 133 }
134} 134}
135 135
136void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
137{
138 ide_hwgroup_t *hwgroup = hwif->hwgroup;
139
140 spin_lock_irq(&ide_lock);
141 /*
142 * Remove us from the hwgroup, and free
143 * the hwgroup if we were the only member
144 */
145 if (hwif->next == hwif) {
146 BUG_ON(hwgroup->hwif != hwif);
147 kfree(hwgroup);
148 } else {
149 /* There is another interface in hwgroup.
150 * Unlink us, and set hwgroup->drive and ->hwif to
151 * something sane.
152 */
153 ide_hwif_t *g = hwgroup->hwif;
154
155 while (g->next != hwif)
156 g = g->next;
157 g->next = hwif->next;
158 if (hwgroup->hwif == hwif) {
159 /* Chose a random hwif for hwgroup->hwif.
160 * It's guaranteed that there are no drives
161 * left in the hwgroup.
162 */
163 BUG_ON(hwgroup->drive != NULL);
164 hwgroup->hwif = g;
165 }
166 BUG_ON(hwgroup->hwif == hwif);
167 }
168 spin_unlock_irq(&ide_lock);
169}
170
171/* Called with ide_lock held. */ 136/* Called with ide_lock held. */
172static void __ide_port_unregister_devices(ide_hwif_t *hwif) 137static void __ide_port_unregister_devices(ide_hwif_t *hwif)
173{ 138{