diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-04-26 16:25:20 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:20 -0400 |
commit | c4b22f816b8ee316cff06df3880f8341e1251211 (patch) | |
tree | f4a3df58450b2c7bf7707efe14694f23af115a66 /drivers/ide/ide-tape.c | |
parent | 3dd89a9b2af37d8e3efd785e20b12b785e50e48f (diff) |
ide-tape: remove idetape_pipeline_active()
This function was simply a wrapper for a test_bit() macro so remove it and
use the macro instead.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index f43fd070f1b6..cac14b22506f 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -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; |