aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c55bdbd22314..504bc9480e93 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -906,7 +906,8 @@ static int ide_init_queue(ide_drive_t *drive)
906 * do not. 906 * do not.
907 */ 907 */
908 908
909 q = blk_init_queue_node(do_ide_request, &ide_lock, hwif_to_node(hwif)); 909 q = blk_init_queue_node(do_ide_request, &hwif->hwgroup->lock,
910 hwif_to_node(hwif));
910 if (!q) 911 if (!q)
911 return 1; 912 return 1;
912 913
@@ -947,7 +948,7 @@ static void ide_add_drive_to_hwgroup(ide_drive_t *drive)
947{ 948{
948 ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; 949 ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;
949 950
950 spin_lock_irq(&ide_lock); 951 spin_lock_irq(&hwgroup->lock);
951 if (!hwgroup->drive) { 952 if (!hwgroup->drive) {
952 /* first drive for hwgroup. */ 953 /* first drive for hwgroup. */
953 drive->next = drive; 954 drive->next = drive;
@@ -957,7 +958,7 @@ static void ide_add_drive_to_hwgroup(ide_drive_t *drive)
957 drive->next = hwgroup->drive->next; 958 drive->next = hwgroup->drive->next;
958 hwgroup->drive->next = drive; 959 hwgroup->drive->next = drive;
959 } 960 }
960 spin_unlock_irq(&ide_lock); 961 spin_unlock_irq(&hwgroup->lock);
961} 962}
962 963
963/* 964/*
@@ -1002,7 +1003,7 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
1002 1003
1003 ide_ports[hwif->index] = NULL; 1004 ide_ports[hwif->index] = NULL;
1004 1005
1005 spin_lock_irq(&ide_lock); 1006 spin_lock_irq(&hwgroup->lock);
1006 /* 1007 /*
1007 * Remove us from the hwgroup, and free 1008 * Remove us from the hwgroup, and free
1008 * the hwgroup if we were the only member 1009 * the hwgroup if we were the only member
@@ -1030,7 +1031,7 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
1030 } 1031 }
1031 BUG_ON(hwgroup->hwif == hwif); 1032 BUG_ON(hwgroup->hwif == hwif);
1032 } 1033 }
1033 spin_unlock_irq(&ide_lock); 1034 spin_unlock_irq(&hwgroup->lock);
1034} 1035}
1035 1036
1036/* 1037/*
@@ -1092,17 +1093,19 @@ static int init_irq (ide_hwif_t *hwif)
1092 * linked list, the first entry is the hwif that owns 1093 * linked list, the first entry is the hwif that owns
1093 * hwgroup->handler - do not change that. 1094 * hwgroup->handler - do not change that.
1094 */ 1095 */
1095 spin_lock_irq(&ide_lock); 1096 spin_lock_irq(&hwgroup->lock);
1096 hwif->next = hwgroup->hwif->next; 1097 hwif->next = hwgroup->hwif->next;
1097 hwgroup->hwif->next = hwif; 1098 hwgroup->hwif->next = hwif;
1098 BUG_ON(hwif->next == hwif); 1099 BUG_ON(hwif->next == hwif);
1099 spin_unlock_irq(&ide_lock); 1100 spin_unlock_irq(&hwgroup->lock);
1100 } else { 1101 } else {
1101 hwgroup = kmalloc_node(sizeof(*hwgroup), GFP_KERNEL|__GFP_ZERO, 1102 hwgroup = kmalloc_node(sizeof(*hwgroup), GFP_KERNEL|__GFP_ZERO,
1102 hwif_to_node(hwif)); 1103 hwif_to_node(hwif));
1103 if (hwgroup == NULL) 1104 if (hwgroup == NULL)
1104 goto out_up; 1105 goto out_up;
1105 1106
1107 spin_lock_init(&hwgroup->lock);
1108
1106 hwif->hwgroup = hwgroup; 1109 hwif->hwgroup = hwgroup;
1107 hwgroup->hwif = hwif->next = hwif; 1110 hwgroup->hwif = hwif->next = hwif;
1108 1111
@@ -1263,20 +1266,21 @@ static void ide_remove_drive_from_hwgroup(ide_drive_t *drive)
1263static void drive_release_dev (struct device *dev) 1266static void drive_release_dev (struct device *dev)
1264{ 1267{
1265 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); 1268 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
1269 ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;
1266 1270
1267 ide_proc_unregister_device(drive); 1271 ide_proc_unregister_device(drive);
1268 1272
1269 spin_lock_irq(&ide_lock); 1273 spin_lock_irq(&hwgroup->lock);
1270 ide_remove_drive_from_hwgroup(drive); 1274 ide_remove_drive_from_hwgroup(drive);
1271 kfree(drive->id); 1275 kfree(drive->id);
1272 drive->id = NULL; 1276 drive->id = NULL;
1273 drive->dev_flags &= ~IDE_DFLAG_PRESENT; 1277 drive->dev_flags &= ~IDE_DFLAG_PRESENT;
1274 /* Messed up locking ... */ 1278 /* Messed up locking ... */
1275 spin_unlock_irq(&ide_lock); 1279 spin_unlock_irq(&hwgroup->lock);
1276 blk_cleanup_queue(drive->queue); 1280 blk_cleanup_queue(drive->queue);
1277 spin_lock_irq(&ide_lock); 1281 spin_lock_irq(&hwgroup->lock);
1278 drive->queue = NULL; 1282 drive->queue = NULL;
1279 spin_unlock_irq(&ide_lock); 1283 spin_unlock_irq(&hwgroup->lock);
1280 1284
1281 complete(&drive->gendev_rel_comp); 1285 complete(&drive->gendev_rel_comp);
1282} 1286}