diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:38 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:38 -0400 |
commit | 0d346ba0730d84f04022f9f984d3f606f69cef37 (patch) | |
tree | 0e68c29e5cbea6766cded4feb9274d87698f8b72 /drivers/ide/ide-io.c | |
parent | d1d76714e2f0c520b6c2a84ab5b050d0b3244949 (diff) |
ide: sanitize ide*_pm_* enums
* Move ide*_pm_* enums from ide-io.c to <linux/ide.h>.
* idedisk_pm_* -> ide_pm_*
* ide_pm_state_* -> ide_pm_*
* No need to set ide_pm_* enums to the fixed values.
* Uppercase ide_pm_* enums.
* Fix/update comments.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 623f6c246cf5..f8d8642903da 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -132,21 +132,6 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
132 | } | 132 | } |
133 | EXPORT_SYMBOL(ide_end_request); | 133 | EXPORT_SYMBOL(ide_end_request); |
134 | 134 | ||
135 | /* | ||
136 | * Power Management state machine. This one is rather trivial for now, | ||
137 | * we should probably add more, like switching back to PIO on suspend | ||
138 | * to help some BIOSes, re-do the door locking on resume, etc... | ||
139 | */ | ||
140 | |||
141 | enum { | ||
142 | ide_pm_flush_cache = ide_pm_state_start_suspend, | ||
143 | idedisk_pm_standby, | ||
144 | |||
145 | idedisk_pm_restore_pio = ide_pm_state_start_resume, | ||
146 | idedisk_pm_idle, | ||
147 | ide_pm_restore_dma, | ||
148 | }; | ||
149 | |||
150 | static void ide_complete_power_step(ide_drive_t *drive, struct request *rq, u8 stat, u8 error) | 135 | static void ide_complete_power_step(ide_drive_t *drive, struct request *rq, u8 stat, u8 error) |
151 | { | 136 | { |
152 | struct request_pm_state *pm = rq->data; | 137 | struct request_pm_state *pm = rq->data; |
@@ -155,20 +140,20 @@ static void ide_complete_power_step(ide_drive_t *drive, struct request *rq, u8 s | |||
155 | return; | 140 | return; |
156 | 141 | ||
157 | switch (pm->pm_step) { | 142 | switch (pm->pm_step) { |
158 | case ide_pm_flush_cache: /* Suspend step 1 (flush cache) complete */ | 143 | case IDE_PM_FLUSH_CACHE: /* Suspend step 1 (flush cache) */ |
159 | if (pm->pm_state == PM_EVENT_FREEZE) | 144 | if (pm->pm_state == PM_EVENT_FREEZE) |
160 | pm->pm_step = ide_pm_state_completed; | 145 | pm->pm_step = IDE_PM_COMPLETED; |
161 | else | 146 | else |
162 | pm->pm_step = idedisk_pm_standby; | 147 | pm->pm_step = IDE_PM_STANDBY; |
163 | break; | 148 | break; |
164 | case idedisk_pm_standby: /* Suspend step 2 (standby) complete */ | 149 | case IDE_PM_STANDBY: /* Suspend step 2 (standby) */ |
165 | pm->pm_step = ide_pm_state_completed; | 150 | pm->pm_step = IDE_PM_COMPLETED; |
166 | break; | 151 | break; |
167 | case idedisk_pm_restore_pio: /* Resume step 1 complete */ | 152 | case IDE_PM_RESTORE_PIO: /* Resume step 1 (restore PIO) */ |
168 | pm->pm_step = idedisk_pm_idle; | 153 | pm->pm_step = IDE_PM_IDLE; |
169 | break; | 154 | break; |
170 | case idedisk_pm_idle: /* Resume step 2 (idle) complete */ | 155 | case IDE_PM_IDLE: /* Resume step 2 (idle)*/ |
171 | pm->pm_step = ide_pm_restore_dma; | 156 | pm->pm_step = IDE_PM_RESTORE_DMA; |
172 | break; | 157 | break; |
173 | } | 158 | } |
174 | } | 159 | } |
@@ -181,7 +166,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
181 | memset(args, 0, sizeof(*args)); | 166 | memset(args, 0, sizeof(*args)); |
182 | 167 | ||
183 | switch (pm->pm_step) { | 168 | switch (pm->pm_step) { |
184 | case ide_pm_flush_cache: /* Suspend step 1 (flush cache) */ | 169 | case IDE_PM_FLUSH_CACHE: /* Suspend step 1 (flush cache) */ |
185 | if (drive->media != ide_disk) | 170 | if (drive->media != ide_disk) |
186 | break; | 171 | break; |
187 | /* Not supported? Switch to next step now. */ | 172 | /* Not supported? Switch to next step now. */ |
@@ -195,27 +180,23 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
195 | else | 180 | else |
196 | args->tf.command = ATA_CMD_FLUSH; | 181 | args->tf.command = ATA_CMD_FLUSH; |
197 | goto out_do_tf; | 182 | goto out_do_tf; |
198 | 183 | case IDE_PM_STANDBY: /* Suspend step 2 (standby) */ | |
199 | case idedisk_pm_standby: /* Suspend step 2 (standby) */ | ||
200 | args->tf.command = ATA_CMD_STANDBYNOW1; | 184 | args->tf.command = ATA_CMD_STANDBYNOW1; |
201 | goto out_do_tf; | 185 | goto out_do_tf; |
202 | 186 | case IDE_PM_RESTORE_PIO: /* Resume step 1 (restore PIO) */ | |
203 | case idedisk_pm_restore_pio: /* Resume step 1 (restore PIO) */ | ||
204 | ide_set_max_pio(drive); | 187 | ide_set_max_pio(drive); |
205 | /* | 188 | /* |
206 | * skip idedisk_pm_idle for ATAPI devices | 189 | * skip IDE_PM_IDLE for ATAPI devices |
207 | */ | 190 | */ |
208 | if (drive->media != ide_disk) | 191 | if (drive->media != ide_disk) |
209 | pm->pm_step = ide_pm_restore_dma; | 192 | pm->pm_step = IDE_PM_RESTORE_DMA; |
210 | else | 193 | else |
211 | ide_complete_power_step(drive, rq, 0, 0); | 194 | ide_complete_power_step(drive, rq, 0, 0); |
212 | return ide_stopped; | 195 | return ide_stopped; |
213 | 196 | case IDE_PM_IDLE: /* Resume step 2 (idle) */ | |
214 | case idedisk_pm_idle: /* Resume step 2 (idle) */ | ||
215 | args->tf.command = ATA_CMD_IDLEIMMEDIATE; | 197 | args->tf.command = ATA_CMD_IDLEIMMEDIATE; |
216 | goto out_do_tf; | 198 | goto out_do_tf; |
217 | 199 | case IDE_PM_RESTORE_DMA: /* Resume step 3 (restore DMA) */ | |
218 | case ide_pm_restore_dma: /* Resume step 3 (restore DMA) */ | ||
219 | /* | 200 | /* |
220 | * Right now, all we do is call ide_set_dma(drive), | 201 | * Right now, all we do is call ide_set_dma(drive), |
221 | * we could be smarter and check for current xfer_speed | 202 | * we could be smarter and check for current xfer_speed |
@@ -229,7 +210,8 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
229 | ide_set_dma(drive); | 210 | ide_set_dma(drive); |
230 | break; | 211 | break; |
231 | } | 212 | } |
232 | pm->pm_step = ide_pm_state_completed; | 213 | |
214 | pm->pm_step = IDE_PM_COMPLETED; | ||
233 | return ide_stopped; | 215 | return ide_stopped; |
234 | 216 | ||
235 | out_do_tf: | 217 | out_do_tf: |
@@ -345,7 +327,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
345 | drive->name, rq->pm->pm_step, stat, err); | 327 | drive->name, rq->pm->pm_step, stat, err); |
346 | #endif | 328 | #endif |
347 | ide_complete_power_step(drive, rq, stat, err); | 329 | ide_complete_power_step(drive, rq, stat, err); |
348 | if (pm->pm_step == ide_pm_state_completed) | 330 | if (pm->pm_step == IDE_PM_COMPLETED) |
349 | ide_complete_pm_request(drive, rq); | 331 | ide_complete_pm_request(drive, rq); |
350 | return; | 332 | return; |
351 | } | 333 | } |
@@ -778,11 +760,11 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
778 | struct request_pm_state *pm = rq->data; | 760 | struct request_pm_state *pm = rq->data; |
779 | 761 | ||
780 | if (blk_pm_suspend_request(rq) && | 762 | if (blk_pm_suspend_request(rq) && |
781 | pm->pm_step == ide_pm_state_start_suspend) | 763 | pm->pm_step == IDE_PM_START_SUSPEND) |
782 | /* Mark drive blocked when starting the suspend sequence. */ | 764 | /* Mark drive blocked when starting the suspend sequence. */ |
783 | drive->dev_flags |= IDE_DFLAG_BLOCKED; | 765 | drive->dev_flags |= IDE_DFLAG_BLOCKED; |
784 | else if (blk_pm_resume_request(rq) && | 766 | else if (blk_pm_resume_request(rq) && |
785 | pm->pm_step == ide_pm_state_start_resume) { | 767 | pm->pm_step == IDE_PM_START_RESUME) { |
786 | /* | 768 | /* |
787 | * The first thing we do on wakeup is to wait for BSY bit to | 769 | * The first thing we do on wakeup is to wait for BSY bit to |
788 | * go away (with a looong timeout) as a drive on this hwif may | 770 | * go away (with a looong timeout) as a drive on this hwif may |
@@ -862,7 +844,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) | |||
862 | #endif | 844 | #endif |
863 | startstop = ide_start_power_step(drive, rq); | 845 | startstop = ide_start_power_step(drive, rq); |
864 | if (startstop == ide_stopped && | 846 | if (startstop == ide_stopped && |
865 | pm->pm_step == ide_pm_state_completed) | 847 | pm->pm_step == IDE_PM_COMPLETED) |
866 | ide_complete_pm_request(drive, rq); | 848 | ide_complete_pm_request(drive, rq); |
867 | return startstop; | 849 | return startstop; |
868 | } else if (!rq->rq_disk && blk_special_request(rq)) | 850 | } else if (!rq->rq_disk && blk_special_request(rq)) |