ChangeSet 1.2181.4.31, 2005/03/17 18:15:30-08:00, [EMAIL PROTECTED]

        [PATCH] USB Storage: change how unusual_devs.h flags are defined
        
        This patch started life as as473 from Alan Stern, and has been rediffed
        against the current tip.
        
        This patch changes the way the flags bits are defined, so that the
        proc_info routine can automatically list all the flags that are set.  
As a
        side effect it will also include the NEED_OVERRIDE flag; that shouldn't
        really matter.  (As another side effect, the definitions grew too long 
to
        fit on a single 80-character line so I had to wrap the comments.)
        
        This patch also takes the opportunity to remove a couple of obsolete 
flags
        and to renumber the bit values.  The patch also removes an unusual_devs
        entry whose only purpose was to set one of those obsolete flags; 
apparently
        it got left behind when all the other uses of those flags were removed.
        
        Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
        Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]>
        Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>



 scsiglue.c |   10 ++++------
 usb.h      |   39 +++++++++++++++++++++++++++------------
 2 files changed, 31 insertions(+), 18 deletions(-)


diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
--- a/drivers/usb/storage/scsiglue.c    2005-03-30 15:10:42 -08:00
+++ b/drivers/usb/storage/scsiglue.c    2005-03-30 15:10:42 -08:00
@@ -336,8 +336,6 @@
 #undef SPRINTF
 #define SPRINTF(args...) \
        do { if (pos < buffer+length) pos += sprintf(pos, ## args); } while (0)
-#define DO_FLAG(a) \
-       do { if (us->flags & US_FL_##a) pos += sprintf(pos, " " #a); } while(0)
 
 static int proc_info (struct Scsi_Host *hostptr, char *buffer, char **start, 
off_t offset,
                int length, int inout)
@@ -384,10 +382,10 @@
        if (pos < buffer + length) {
                pos += sprintf(pos, "       Quirks:");
 
-               DO_FLAG(SINGLE_LUN);
-               DO_FLAG(SCM_MULT_TARG);
-               DO_FLAG(FIX_INQUIRY);
-               DO_FLAG(FIX_CAPACITY);
+#define US_FLAG(name, value) \
+       if (us->flags & value) pos += sprintf(pos, " " #name);
+US_DO_ALL_FLAGS
+#undef US_FLAG
 
                *(pos++) = '\n';
        }
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h 2005-03-30 15:10:42 -08:00
+++ b/drivers/usb/storage/usb.h 2005-03-30 15:10:42 -08:00
@@ -66,18 +66,33 @@
        unsigned int flags;
 };
 
-/* Flag definitions: these entries are static */
-#define US_FL_SINGLE_LUN      0x00000001 /* allow access to only LUN 0     */
-#define US_FL_MODE_XLATE      0          /* [no longer used]                */
-#define US_FL_NEED_OVERRIDE   0x00000004 /* unusual_devs entry is necessary */
-#define US_FL_IGNORE_SER      0                 /* [no longer used]            
    */
-#define US_FL_SCM_MULT_TARG   0x00000020 /* supports multiple targets      */
-#define US_FL_FIX_INQUIRY     0x00000040 /* INQUIRY response needs faking   */
-#define US_FL_FIX_CAPACITY    0x00000080 /* READ CAPACITY response too big  */
-#define US_FL_IGNORE_RESIDUE  0x00000100 /* reported residue is wrong      */
-#define US_FL_BULK32          0x00000200 /* Uses 32-byte CBW length         */
-#define US_FL_NOT_LOCKABLE    0x00000400 /* PREVENT/ALLOW not supported     */
-#define US_FL_GO_SLOW         0x00000800 /* Need delay after Command phase  */
+/*
+ * Static flag definitions.  We use this roundabout technique so that the
+ * proc_info() routine can automatically display a message for each flag.
+ */
+#define US_DO_ALL_FLAGS                                                \
+       US_FLAG(SINGLE_LUN,     0x00000001)                     \
+               /* allow access to only LUN 0 */                \
+       US_FLAG(NEED_OVERRIDE,  0x00000002)                     \
+               /* unusual_devs entry is necessary */           \
+       US_FLAG(SCM_MULT_TARG,  0x00000004)                     \
+               /* supports multiple targets */                 \
+       US_FLAG(FIX_INQUIRY,    0x00000008)                     \
+               /* INQUIRY response needs faking */             \
+       US_FLAG(FIX_CAPACITY,   0x00000010)                     \
+               /* READ CAPACITY response too big */            \
+       US_FLAG(IGNORE_RESIDUE, 0x00000020)                     \
+               /* reported residue is wrong */                 \
+       US_FLAG(BULK32,         0x00000040)                     \
+               /* Uses 32-byte CBW length */                   \
+       US_FLAG(NOT_LOCKABLE,   0x00000080)                     \
+               /* PREVENT/ALLOW not supported */               \
+       US_FLAG(GO_SLOW,        0x00000100)                     \
+               /* Need delay after Command phase */            \
+
+#define US_FLAG(name, value)   US_FL_##name = value ,
+enum { US_DO_ALL_FLAGS };
+#undef US_FLAG
 
 /* Dynamic flag definitions: used in set_bit() etc. */
 #define US_FLIDX_URB_ACTIVE    18  /* 0x00040000  current_urb is in use  */
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to