diff options
Diffstat (limited to 'drivers/ide/ide-park.c')
-rw-r--r-- | drivers/ide/ide-park.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index 03b00e57e93f..63d01c55f865 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
@@ -7,17 +7,16 @@ DECLARE_WAIT_QUEUE_HEAD(ide_park_wq); | |||
7 | 7 | ||
8 | static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | 8 | static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) |
9 | { | 9 | { |
10 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | ||
10 | struct request_queue *q = drive->queue; | 11 | struct request_queue *q = drive->queue; |
11 | struct request *rq; | 12 | struct request *rq; |
12 | int rc; | 13 | int rc; |
13 | 14 | ||
14 | timeout += jiffies; | 15 | timeout += jiffies; |
15 | spin_lock_irq(&ide_lock); | 16 | spin_lock_irq(&hwgroup->lock); |
16 | if (drive->dev_flags & IDE_DFLAG_PARKED) { | 17 | if (drive->dev_flags & IDE_DFLAG_PARKED) { |
17 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | 18 | int reset_timer = time_before(timeout, drive->sleep); |
18 | int reset_timer; | ||
19 | 19 | ||
20 | reset_timer = time_before(timeout, drive->sleep); | ||
21 | drive->sleep = timeout; | 20 | drive->sleep = timeout; |
22 | wake_up_all(&ide_park_wq); | 21 | wake_up_all(&ide_park_wq); |
23 | if (reset_timer && hwgroup->sleeping && | 22 | if (reset_timer && hwgroup->sleeping && |
@@ -26,10 +25,10 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
26 | hwgroup->busy = 0; | 25 | hwgroup->busy = 0; |
27 | blk_start_queueing(q); | 26 | blk_start_queueing(q); |
28 | } | 27 | } |
29 | spin_unlock_irq(&ide_lock); | 28 | spin_unlock_irq(&hwgroup->lock); |
30 | return; | 29 | return; |
31 | } | 30 | } |
32 | spin_unlock_irq(&ide_lock); | 31 | spin_unlock_irq(&hwgroup->lock); |
33 | 32 | ||
34 | rq = blk_get_request(q, READ, __GFP_WAIT); | 33 | rq = blk_get_request(q, READ, __GFP_WAIT); |
35 | rq->cmd[0] = REQ_PARK_HEADS; | 34 | rq->cmd[0] = REQ_PARK_HEADS; |
@@ -62,20 +61,21 @@ ssize_t ide_park_show(struct device *dev, struct device_attribute *attr, | |||
62 | char *buf) | 61 | char *buf) |
63 | { | 62 | { |
64 | ide_drive_t *drive = to_ide_device(dev); | 63 | ide_drive_t *drive = to_ide_device(dev); |
64 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | ||
65 | unsigned long now; | 65 | unsigned long now; |
66 | unsigned int msecs; | 66 | unsigned int msecs; |
67 | 67 | ||
68 | if (drive->dev_flags & IDE_DFLAG_NO_UNLOAD) | 68 | if (drive->dev_flags & IDE_DFLAG_NO_UNLOAD) |
69 | return -EOPNOTSUPP; | 69 | return -EOPNOTSUPP; |
70 | 70 | ||
71 | spin_lock_irq(&ide_lock); | 71 | spin_lock_irq(&hwgroup->lock); |
72 | now = jiffies; | 72 | now = jiffies; |
73 | if (drive->dev_flags & IDE_DFLAG_PARKED && | 73 | if (drive->dev_flags & IDE_DFLAG_PARKED && |
74 | time_after(drive->sleep, now)) | 74 | time_after(drive->sleep, now)) |
75 | msecs = jiffies_to_msecs(drive->sleep - now); | 75 | msecs = jiffies_to_msecs(drive->sleep - now); |
76 | else | 76 | else |
77 | msecs = 0; | 77 | msecs = 0; |
78 | spin_unlock_irq(&ide_lock); | 78 | spin_unlock_irq(&hwgroup->lock); |
79 | 79 | ||
80 | return snprintf(buf, 20, "%u\n", msecs); | 80 | return snprintf(buf, 20, "%u\n", msecs); |
81 | } | 81 | } |