From: Borislav Petkov <petkovbb@googlemail.com>
To: bzolnier@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH 2/2] ide-scsi: do non-atomic pc->flags testing
Date: Wed, 13 Feb 2008 17:18:51 +0100 [thread overview]
Message-ID: <1202919531-17798-2-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1202919531-17798-1-git-send-email-petkovbb@gmail.com>
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/scsi/ide-scsi.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index d46c81c..93c3fc2 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -311,10 +311,10 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
pc = opc;
rq = pc->rq;
pc->scsi_cmd->result = (CHECK_CONDITION << 1) |
- ((test_bit(PC_FLAG_TIMEDOUT, &pc->flags) ?
+ (((pc->flags & PC_FLAG_TIMEDOUT) ?
DID_TIME_OUT :
DID_OK) << 16);
- } else if (test_bit(PC_FLAG_TIMEDOUT, &pc->flags)) {
+ } else if (pc->flags & PC_FLAG_TIMEDOUT) {
if (log)
printk (KERN_WARNING "ide-scsi: %s: timed out for %lu\n",
drive->name, pc->scsi_cmd->serial_number);
@@ -356,7 +356,7 @@ static int idescsi_expiry(ide_drive_t *drive)
#if IDESCSI_DEBUG_LOG
printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies);
#endif
- set_bit(PC_FLAG_TIMEDOUT, &pc->flags);
+ pc->flags |= PC_FLAG_TIMEDOUT;
return 0; /* we do not want the ide subsystem to retry */
}
@@ -378,7 +378,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
#endif /* IDESCSI_DEBUG_LOG */
- if (test_bit(PC_FLAG_TIMEDOUT, &pc->flags)) {
+ if (pc->flags & PC_FLAG_TIMEDOUT) {
#if IDESCSI_DEBUG_LOG
printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n",
pc->scsi_cmd->serial_number, jiffies);
@@ -387,7 +387,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
idescsi_end_request (drive, 1, 0);
return ide_stopped;
}
- if (test_and_clear_bit(PC_FLAG_DMA_IN_PROGRESS, &pc->flags)) {
+ if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
+ pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
#if IDESCSI_DEBUG_LOG
printk ("ide-scsi: %s: DMA complete\n", drive->name);
#endif /* IDESCSI_DEBUG_LOG */
@@ -426,7 +427,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
"- discarding data\n");
temp = pc->buf_size - pc->xferred;
if (temp) {
- clear_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags &= ~PC_FLAG_WRITING;
if (pc->sg)
idescsi_input_buffers(drive, pc,
temp);
@@ -448,14 +449,14 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
}
}
if (ireason & IO) {
- clear_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags &= ~PC_FLAG_WRITING;
if (pc->sg)
idescsi_input_buffers(drive, pc, bcount);
else
hwif->atapi_input_bytes(drive, pc->cur_pos,
bcount);
} else {
- set_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags |= PC_FLAG_WRITING;
if (pc->sg)
idescsi_output_buffers(drive, pc, bcount);
else
@@ -495,8 +496,8 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
/* Send the actual packet */
drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12);
- if (test_bit(PC_FLAG_DMA_OK, &pc->flags)) {
- set_bit(PC_FLAG_DMA_IN_PROGRESS, &pc->flags);
+ if (pc->flags & PC_FLAG_DMA_OK) {
+ pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
hwif->dma_start(drive);
}
return ide_started;
@@ -506,10 +507,10 @@ static inline int idescsi_set_direction(struct ide_atapi_pc *pc)
{
switch (pc->c[0]) {
case READ_6: case READ_10: case READ_12:
- clear_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags &= ~PC_FLAG_WRITING;
return 0;
case WRITE_6: case WRITE_10: case WRITE_12:
- set_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags |= PC_FLAG_WRITING;
return 0;
default:
return 1;
@@ -566,7 +567,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,
ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma);
if (dma)
- set_bit(PC_FLAG_DMA_OK, &pc->flags);
+ pc->flags |= PC_FLAG_DMA_OK;
if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc,
--
1.5.3.7
WARNING: multiple messages have this Message-ID (diff)
From: Borislav Petkov <petkovbb@googlemail.com>
To: <bzolnier@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH 2/2] ide-scsi: do non-atomic pc->flags testing
Date: Wed, 13 Feb 2008 17:18:51 +0100 [thread overview]
Message-ID: <1202919531-17798-2-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1202919531-17798-1-git-send-email-petkovbb@gmail.com>
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/scsi/ide-scsi.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index d46c81c..93c3fc2 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -311,10 +311,10 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
pc = opc;
rq = pc->rq;
pc->scsi_cmd->result = (CHECK_CONDITION << 1) |
- ((test_bit(PC_FLAG_TIMEDOUT, &pc->flags) ?
+ (((pc->flags & PC_FLAG_TIMEDOUT) ?
DID_TIME_OUT :
DID_OK) << 16);
- } else if (test_bit(PC_FLAG_TIMEDOUT, &pc->flags)) {
+ } else if (pc->flags & PC_FLAG_TIMEDOUT) {
if (log)
printk (KERN_WARNING "ide-scsi: %s: timed out for %lu\n",
drive->name, pc->scsi_cmd->serial_number);
@@ -356,7 +356,7 @@ static int idescsi_expiry(ide_drive_t *drive)
#if IDESCSI_DEBUG_LOG
printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies);
#endif
- set_bit(PC_FLAG_TIMEDOUT, &pc->flags);
+ pc->flags |= PC_FLAG_TIMEDOUT;
return 0; /* we do not want the ide subsystem to retry */
}
@@ -378,7 +378,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
#endif /* IDESCSI_DEBUG_LOG */
- if (test_bit(PC_FLAG_TIMEDOUT, &pc->flags)) {
+ if (pc->flags & PC_FLAG_TIMEDOUT) {
#if IDESCSI_DEBUG_LOG
printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n",
pc->scsi_cmd->serial_number, jiffies);
@@ -387,7 +387,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
idescsi_end_request (drive, 1, 0);
return ide_stopped;
}
- if (test_and_clear_bit(PC_FLAG_DMA_IN_PROGRESS, &pc->flags)) {
+ if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
+ pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
#if IDESCSI_DEBUG_LOG
printk ("ide-scsi: %s: DMA complete\n", drive->name);
#endif /* IDESCSI_DEBUG_LOG */
@@ -426,7 +427,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
"- discarding data\n");
temp = pc->buf_size - pc->xferred;
if (temp) {
- clear_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags &= ~PC_FLAG_WRITING;
if (pc->sg)
idescsi_input_buffers(drive, pc,
temp);
@@ -448,14 +449,14 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
}
}
if (ireason & IO) {
- clear_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags &= ~PC_FLAG_WRITING;
if (pc->sg)
idescsi_input_buffers(drive, pc, bcount);
else
hwif->atapi_input_bytes(drive, pc->cur_pos,
bcount);
} else {
- set_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags |= PC_FLAG_WRITING;
if (pc->sg)
idescsi_output_buffers(drive, pc, bcount);
else
@@ -495,8 +496,8 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
/* Send the actual packet */
drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12);
- if (test_bit(PC_FLAG_DMA_OK, &pc->flags)) {
- set_bit(PC_FLAG_DMA_IN_PROGRESS, &pc->flags);
+ if (pc->flags & PC_FLAG_DMA_OK) {
+ pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
hwif->dma_start(drive);
}
return ide_started;
@@ -506,10 +507,10 @@ static inline int idescsi_set_direction(struct ide_atapi_pc *pc)
{
switch (pc->c[0]) {
case READ_6: case READ_10: case READ_12:
- clear_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags &= ~PC_FLAG_WRITING;
return 0;
case WRITE_6: case WRITE_10: case WRITE_12:
- set_bit(PC_FLAG_WRITING, &pc->flags);
+ pc->flags |= PC_FLAG_WRITING;
return 0;
default:
return 1;
@@ -566,7 +567,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,
ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma);
if (dma)
- set_bit(PC_FLAG_DMA_OK, &pc->flags);
+ pc->flags |= PC_FLAG_DMA_OK;
if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc,
--
1.5.3.7
next prev parent reply other threads:[~2008-02-13 16:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-13 16:18 [PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape,scsi} Borislav Petkov
2008-02-13 16:18 ` Borislav Petkov
2008-02-13 16:18 ` Borislav Petkov [this message]
2008-02-13 16:18 ` [PATCH 2/2] ide-scsi: do non-atomic pc->flags testing Borislav Petkov
2008-02-13 16:35 ` [PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape,scsi} Bartlomiej Zolnierkiewicz
-- strict thread matches above, loose matches on Subject: below --
2008-02-13 17:25 [PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape} Borislav Petkov
2008-02-13 17:25 ` [PATCH 2/2] ide-scsi: do non-atomic pc->flags testing Borislav Petkov
2008-02-13 17:25 ` Borislav Petkov
2008-02-13 21:44 ` Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1202919531-17798-2-git-send-email-petkovbb@gmail.com \
--to=petkovbb@googlemail.com \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.