[PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape,scsi}

2008-02-13 Thread Borislav Petkov
This is done in one single patch in order not to cause git breakage.

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
---
 drivers/ide/ide-floppy.c |   14 --
 drivers/ide/ide-tape.c   |   16 
 drivers/scsi/ide-scsi.c  |   36 +++-
 include/linux/ide.h  |   15 +++
 4 files changed, 30 insertions(+), 51 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index bf1ef60..5f133df 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -78,20 +78,6 @@
  */
 #define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES)
 
-/* Packet command flag bits. */
-enum {
-   /* 1 when we prefer to use DMA if possible */
-   PC_FLAG_DMA_RECOMMENDED = (1  0),
-   /* 1 while DMA in progress */
-   PC_FLAG_DMA_IN_PROGRESS = (1  1),
-   /* 1 when encountered problem during DMA */
-   PC_FLAG_DMA_ERROR   = (1  2),
-   /* Data direction */
-   PC_FLAG_WRITING = (1  3),
-   /* Suppress error reporting */
-   PC_FLAG_SUPPRESS_ERROR  = (1  4),
-};
-
 /* format capacities descriptor codes */
 #define CAPACITY_INVALID   0x00
 #define CAPACITY_UNFORMATTED   0x01
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 3a10208..3f9fbd8 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -181,22 +181,6 @@ struct idetape_bh {
char *b_data;
 };
 
-/* Packet command flag bits. */
-enum {
-   /* Set when an error is considered normal - We won't retry */
-   PC_FLAG_ABORT   = (1  0),
-   /* 1 When polling for DSC on a media access command */
-   PC_FLAG_WAIT_FOR_DSC= (1  1),
-   /* 1 when we prefer to use DMA if possible */
-   PC_FLAG_DMA_RECOMMENDED = (1  2),
-   /* 1 while DMA in progress */
-   PC_FLAG_DMA_IN_PROGRESS = (1  3),
-   /* 1 when encountered problem during DMA */
-   PC_FLAG_DMA_ERROR   = (1  4),
-   /* Data direction */
-   PC_FLAG_WRITING = (1  5),
-};
-
 /* Tape door status */
 #define DOOR_UNLOCKED  0
 #define DOOR_LOCKED1
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 5ec421c..d46c81c 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -61,14 +61,6 @@
 #define IDESCSI_DEBUG_LOG  0
 
 /*
- * Packet command status bits.
- */
-#define PC_DMA_IN_PROGRESS 0   /* 1 while DMA in progress */
-#define PC_WRITING 1   /* Data direction */
-#define PC_TIMEDOUT3   /* command timed out */
-#define PC_DMA_OK  4   /* Use DMA */
-
-/*
  * SCSI command transformation layer
  */
 #define IDESCSI_SG_TRANSFORM   1   /* /dev/sg transformation */
@@ -319,8 +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_TIMEDOUT, 
pc-flags)?DID_TIME_OUT:DID_OK)  16);
-   } else if (test_bit(PC_TIMEDOUT, pc-flags)) {
+   ((test_bit(PC_FLAG_TIMEDOUT, pc-flags) ?
+ DID_TIME_OUT :
+ DID_OK)  16);
+   } else if (test_bit(PC_FLAG_TIMEDOUT, pc-flags)) {
if (log)
printk (KERN_WARNING ide-scsi: %s: timed out for 
%lu\n,
drive-name, 
pc-scsi_cmd-serial_number);
@@ -362,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_TIMEDOUT, pc-flags);
+   set_bit(PC_FLAG_TIMEDOUT, pc-flags);
 
return 0;   /* we do not want the 
ide subsystem to retry */
 }
@@ -384,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_TIMEDOUT, pc-flags)){
+   if (test_bit(PC_FLAG_TIMEDOUT, pc-flags)) {
 #if IDESCSI_DEBUG_LOG
printk(KERN_WARNING idescsi_pc_intr: got timed out packet  %lu 
at %lu\n,
pc-scsi_cmd-serial_number, jiffies);
@@ -393,7 +387,7 @@ 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_DMA_IN_PROGRESS, pc-flags)) {
+   if (test_and_clear_bit(PC_FLAG_DMA_IN_PROGRESS, pc-flags)) {
 #if IDESCSI_DEBUG_LOG
printk (ide-scsi: %s: DMA complete\n, drive-name);
 #endif /* IDESCSI_DEBUG_LOG */
@@ -432,7 +426,7 @@ static ide_startstop_t idescsi_pc_intr 

Re: [PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape,scsi}

2008-02-13 Thread Bartlomiej Zolnierkiewicz
On Feb 13, 2008 5:18 PM, Borislav Petkov [EMAIL PROTECTED] wrote:
 This is done in one single patch in order not to cause git breakage.

 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

Looks good but could you please reorder patches and move PC_* - PC_FLAG *
rename in ide-scsi to the patch removing atomic bitops from ide-scsi?

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape}

2008-02-13 Thread Borislav Petkov
Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
---
 drivers/ide/ide-floppy.c |   14 --
 drivers/ide/ide-tape.c   |   16 
 include/linux/ide.h  |   15 +++
 3 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index bf1ef60..5f133df 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -78,20 +78,6 @@
  */
 #define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES)
 
-/* Packet command flag bits. */
-enum {
-   /* 1 when we prefer to use DMA if possible */
-   PC_FLAG_DMA_RECOMMENDED = (1  0),
-   /* 1 while DMA in progress */
-   PC_FLAG_DMA_IN_PROGRESS = (1  1),
-   /* 1 when encountered problem during DMA */
-   PC_FLAG_DMA_ERROR   = (1  2),
-   /* Data direction */
-   PC_FLAG_WRITING = (1  3),
-   /* Suppress error reporting */
-   PC_FLAG_SUPPRESS_ERROR  = (1  4),
-};
-
 /* format capacities descriptor codes */
 #define CAPACITY_INVALID   0x00
 #define CAPACITY_UNFORMATTED   0x01
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 3a10208..3f9fbd8 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -181,22 +181,6 @@ struct idetape_bh {
char *b_data;
 };
 
-/* Packet command flag bits. */
-enum {
-   /* Set when an error is considered normal - We won't retry */
-   PC_FLAG_ABORT   = (1  0),
-   /* 1 When polling for DSC on a media access command */
-   PC_FLAG_WAIT_FOR_DSC= (1  1),
-   /* 1 when we prefer to use DMA if possible */
-   PC_FLAG_DMA_RECOMMENDED = (1  2),
-   /* 1 while DMA in progress */
-   PC_FLAG_DMA_IN_PROGRESS = (1  3),
-   /* 1 when encountered problem during DMA */
-   PC_FLAG_DMA_ERROR   = (1  4),
-   /* Data direction */
-   PC_FLAG_WRITING = (1  5),
-};
-
 /* Tape door status */
 #define DOOR_UNLOCKED  0
 #define DOOR_LOCKED1
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 509d806..0e5f09b 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -629,6 +629,21 @@ typedef struct ide_settings_s {
 
 int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, 
void *, ide_procset_t *set);
 
+/* ATAPI packet command flags */
+enum {
+   /* set when an error is considered normal - no retry (ide-tape) */
+   PC_FLAG_ABORT   = (1  0),
+   PC_FLAG_SUPPRESS_ERROR  = (1  1),
+   PC_FLAG_WAIT_FOR_DSC= (1  2),
+   PC_FLAG_DMA_OK  = (1  3),
+   PC_FLAG_DMA_RECOMMENDED = (1  4),
+   PC_FLAG_DMA_IN_PROGRESS = (1  5),
+   PC_FLAG_DMA_ERROR   = (1  6),
+   PC_FLAG_WRITING = (1  7),
+   /* command timed out */
+   PC_FLAG_TIMEDOUT= (1  8),
+};
+
 struct ide_atapi_pc {
/* actual packet bytes */
u8 c[12];
-- 
1.5.3.7

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape}

2008-02-13 Thread Bartlomiej Zolnierkiewicz
On Wednesday 13 February 2008, Borislav Petkov wrote:
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html