1 From 626542ca2277961aaa64855206574f8ca4f360e3 Mon Sep 17 00:00:00 2001
2 From: Borislav Petkov <petkovbb@gmail.com>
3 Date: Sun, 7 Jun 2009 15:37:05 +0200
4 Subject: ide-tape: change IDE_AFLAG_IGNORE_DSC non-atomically
8 There are two sites where the flag is being changed: ide_retry_pc
9 and idetape_do_request. Both codepaths are protected by hwif->busy
10 (ide_lock_port) and therefore we shouldn't need the atomic accesses.
12 Spotted-by: Jiri Slaby <jirislaby@gmail.com>
13 Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
14 Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 Signed-off-by: Jiri Slaby <jslaby@suse.cz>
17 drivers/ide/ide-tape.c | 12 +++++++-----
18 1 file changed, 7 insertions(+), 5 deletions(-)
20 --- a/drivers/ide/ide-tape.c
21 +++ b/drivers/ide/ide-tape.c
22 @@ -736,7 +736,7 @@ static void idetape_retry_pc(ide_drive_t
23 pc = idetape_next_pc_storage(drive);
24 rq = idetape_next_rq_storage(drive);
25 idetape_create_request_sense_cmd(pc);
26 - set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
27 + drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC;
28 idetape_queue_pc_head(drive, pc, rq);
31 @@ -1013,14 +1013,14 @@ static ide_startstop_t idetape_do_reques
32 stat = hwif->tp_ops->read_status(hwif);
34 if (!drive->dsc_overlap && !(rq->cmd[13] & REQ_IDETAPE_PC2))
35 - set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
36 + drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC;
38 if (drive->post_reset == 1) {
39 - set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
40 + drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC;
41 drive->post_reset = 0;
44 - if (!test_and_clear_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags) &&
45 + if (!(drive->atapi_flags & IDE_AFLAG_IGNORE_DSC) &&
46 (stat & SEEK_STAT) == 0) {
47 if (postponed_rq == NULL) {
48 tape->dsc_polling_start = jiffies;
49 @@ -1041,7 +1041,9 @@ static ide_startstop_t idetape_do_reques
50 tape->dsc_poll_freq = IDETAPE_DSC_MA_SLOW;
51 idetape_postpone_request(drive);
55 + drive->atapi_flags &= ~IDE_AFLAG_IGNORE_DSC;
57 if (rq->cmd[13] & REQ_IDETAPE_READ) {
58 pc = idetape_next_pc_storage(drive);
59 ide_tape_create_rw_cmd(tape, pc, rq, READ_6);