diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
| -rw-r--r-- | drivers/ide/ide-tape.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index f43fd070f1b6..d3d8b8d5157c 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -993,7 +993,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 993 | stat = ide_read_status(drive); | 993 | stat = ide_read_status(drive); |
| 994 | 994 | ||
| 995 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { | 995 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { |
| 996 | if (hwif->ide_dma_end(drive) || (stat & ERR_STAT)) { | 996 | if (hwif->dma_ops->dma_end(drive) || (stat & ERR_STAT)) { |
| 997 | /* | 997 | /* |
| 998 | * A DMA error is sometimes expected. For example, | 998 | * A DMA error is sometimes expected. For example, |
| 999 | * if the tape is crossing a filemark during a | 999 | * if the tape is crossing a filemark during a |
| @@ -1213,7 +1213,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) | |||
| 1213 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1213 | #ifdef CONFIG_BLK_DEV_IDEDMA |
| 1214 | /* Begin DMA, if necessary */ | 1214 | /* Begin DMA, if necessary */ |
| 1215 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) | 1215 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) |
| 1216 | hwif->dma_start(drive); | 1216 | hwif->dma_ops->dma_start(drive); |
| 1217 | #endif | 1217 | #endif |
| 1218 | /* Send the actual packet */ | 1218 | /* Send the actual packet */ |
| 1219 | HWIF(drive)->atapi_output_bytes(drive, pc->c, 12); | 1219 | HWIF(drive)->atapi_output_bytes(drive, pc->c, 12); |
| @@ -1279,7 +1279,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, | |||
| 1279 | ide_dma_off(drive); | 1279 | ide_dma_off(drive); |
| 1280 | } | 1280 | } |
| 1281 | if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma) | 1281 | if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma) |
| 1282 | dma_ok = !hwif->dma_setup(drive); | 1282 | dma_ok = !hwif->dma_ops->dma_setup(drive); |
| 1283 | 1283 | ||
| 1284 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | | 1284 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | |
| 1285 | IDE_TFLAG_OUT_DEVICE, bcount, dma_ok); | 1285 | IDE_TFLAG_OUT_DEVICE, bcount, dma_ok); |
| @@ -1605,14 +1605,6 @@ out: | |||
| 1605 | } | 1605 | } |
| 1606 | 1606 | ||
| 1607 | /* Pipeline related functions */ | 1607 | /* Pipeline related functions */ |
| 1608 | static inline int idetape_pipeline_active(idetape_tape_t *tape) | ||
| 1609 | { | ||
| 1610 | int rc1, rc2; | ||
| 1611 | |||
| 1612 | rc1 = test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags); | ||
| 1613 | rc2 = (tape->active_data_rq != NULL); | ||
| 1614 | return rc1; | ||
| 1615 | } | ||
| 1616 | 1608 | ||
| 1617 | /* | 1609 | /* |
| 1618 | * The function below uses __get_free_page to allocate a pipeline stage, along | 1610 | * The function below uses __get_free_page to allocate a pipeline stage, along |
| @@ -2058,7 +2050,7 @@ static int __idetape_discard_read_pipeline(ide_drive_t *drive) | |||
| 2058 | 2050 | ||
| 2059 | spin_lock_irqsave(&tape->lock, flags); | 2051 | spin_lock_irqsave(&tape->lock, flags); |
| 2060 | tape->next_stage = NULL; | 2052 | tape->next_stage = NULL; |
| 2061 | if (idetape_pipeline_active(tape)) | 2053 | if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) |
| 2062 | idetape_wait_for_request(drive, tape->active_data_rq); | 2054 | idetape_wait_for_request(drive, tape->active_data_rq); |
| 2063 | spin_unlock_irqrestore(&tape->lock, flags); | 2055 | spin_unlock_irqrestore(&tape->lock, flags); |
| 2064 | 2056 | ||
| @@ -2131,7 +2123,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, | |||
| 2131 | 2123 | ||
| 2132 | debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); | 2124 | debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); |
| 2133 | 2125 | ||
| 2134 | if (idetape_pipeline_active(tape)) { | 2126 | if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) { |
| 2135 | printk(KERN_ERR "ide-tape: bug: the pipeline is active in %s\n", | 2127 | printk(KERN_ERR "ide-tape: bug: the pipeline is active in %s\n", |
| 2136 | __func__); | 2128 | __func__); |
| 2137 | return (0); | 2129 | return (0); |
| @@ -2162,8 +2154,7 @@ static void idetape_plug_pipeline(ide_drive_t *drive) | |||
| 2162 | 2154 | ||
| 2163 | if (tape->next_stage == NULL) | 2155 | if (tape->next_stage == NULL) |
| 2164 | return; | 2156 | return; |
| 2165 | if (!idetape_pipeline_active(tape)) { | 2157 | if (!test_and_set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) { |
| 2166 | set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags); | ||
| 2167 | idetape_activate_next_stage(drive); | 2158 | idetape_activate_next_stage(drive); |
| 2168 | (void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end); | 2159 | (void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end); |
| 2169 | } | 2160 | } |
| @@ -2242,13 +2233,14 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks) | |||
| 2242 | /* Attempt to allocate a new stage. Beware possible race conditions. */ | 2233 | /* Attempt to allocate a new stage. Beware possible race conditions. */ |
| 2243 | while ((new_stage = idetape_kmalloc_stage(tape)) == NULL) { | 2234 | while ((new_stage = idetape_kmalloc_stage(tape)) == NULL) { |
| 2244 | spin_lock_irqsave(&tape->lock, flags); | 2235 | spin_lock_irqsave(&tape->lock, flags); |
| 2245 | if (idetape_pipeline_active(tape)) { | 2236 | if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) { |
| 2246 | idetape_wait_for_request(drive, tape->active_data_rq); | 2237 | idetape_wait_for_request(drive, tape->active_data_rq); |
| 2247 | spin_unlock_irqrestore(&tape->lock, flags); | 2238 | spin_unlock_irqrestore(&tape->lock, flags); |
| 2248 | } else { | 2239 | } else { |
| 2249 | spin_unlock_irqrestore(&tape->lock, flags); | 2240 | spin_unlock_irqrestore(&tape->lock, flags); |
| 2250 | idetape_plug_pipeline(drive); | 2241 | idetape_plug_pipeline(drive); |
| 2251 | if (idetape_pipeline_active(tape)) | 2242 | if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, |
| 2243 | &tape->flags)) | ||
| 2252 | continue; | 2244 | continue; |
| 2253 | /* | 2245 | /* |
| 2254 | * The machine is short on memory. Fallback to non- | 2246 | * The machine is short on memory. Fallback to non- |
| @@ -2277,7 +2269,7 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks) | |||
| 2277 | * starting to service requests, so that we will be able to keep up with | 2269 | * starting to service requests, so that we will be able to keep up with |
| 2278 | * the higher speeds of the tape. | 2270 | * the higher speeds of the tape. |
| 2279 | */ | 2271 | */ |
| 2280 | if (!idetape_pipeline_active(tape)) { | 2272 | if (!test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) { |
| 2281 | if (tape->nr_stages >= tape->max_stages * 9 / 10 || | 2273 | if (tape->nr_stages >= tape->max_stages * 9 / 10 || |
| 2282 | tape->nr_stages >= tape->max_stages - | 2274 | tape->nr_stages >= tape->max_stages - |
| 2283 | tape->uncontrolled_pipeline_head_speed * 3 * 1024 / | 2275 | tape->uncontrolled_pipeline_head_speed * 3 * 1024 / |
| @@ -2304,10 +2296,11 @@ static void idetape_wait_for_pipeline(ide_drive_t *drive) | |||
| 2304 | idetape_tape_t *tape = drive->driver_data; | 2296 | idetape_tape_t *tape = drive->driver_data; |
| 2305 | unsigned long flags; | 2297 | unsigned long flags; |
| 2306 | 2298 | ||
| 2307 | while (tape->next_stage || idetape_pipeline_active(tape)) { | 2299 | while (tape->next_stage || test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, |
| 2300 | &tape->flags)) { | ||
| 2308 | idetape_plug_pipeline(drive); | 2301 | idetape_plug_pipeline(drive); |
| 2309 | spin_lock_irqsave(&tape->lock, flags); | 2302 | spin_lock_irqsave(&tape->lock, flags); |
| 2310 | if (idetape_pipeline_active(tape)) | 2303 | if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) |
| 2311 | idetape_wait_for_request(drive, tape->active_data_rq); | 2304 | idetape_wait_for_request(drive, tape->active_data_rq); |
| 2312 | spin_unlock_irqrestore(&tape->lock, flags); | 2305 | spin_unlock_irqrestore(&tape->lock, flags); |
| 2313 | } | 2306 | } |
| @@ -2464,7 +2457,7 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages) | |||
| 2464 | new_stage = idetape_kmalloc_stage(tape); | 2457 | new_stage = idetape_kmalloc_stage(tape); |
| 2465 | } | 2458 | } |
| 2466 | } | 2459 | } |
| 2467 | if (!idetape_pipeline_active(tape)) { | 2460 | if (!test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) { |
| 2468 | if (tape->nr_pending_stages >= 3 * max_stages / 4) { | 2461 | if (tape->nr_pending_stages >= 3 * max_stages / 4) { |
| 2469 | tape->measure_insert_time = 1; | 2462 | tape->measure_insert_time = 1; |
| 2470 | tape->insert_time = jiffies; | 2463 | tape->insert_time = jiffies; |
