summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2002-12-30 19:01:43 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-12-30 19:01:43 -0800
commitee0d7c25e5c9385337db9ffe4eba0a1bfde3b19f (patch)
treead0e344f9bd1eb2dc68257a1a841be899c62f406
parentd04aa04949b4acdf0503749423b64a7d58585d2b (diff)
[PATCH] Atari NCR5380 SCSI: bitops operate on long
Atari NCR5380 SCSI driver tag bitmap updates: - Use DECLARE_BITMAP() to declare the tag bitmap - Remove `MAX_TAGS must be a multiple of 32', which is no longer true - Declare and use CLEAR_BITMAP() to set all bits in a bitmap to zero - Fix bitops call problems that got unnoticed before
-rw-r--r--drivers/scsi/atari_NCR5380.c17
-rw-r--r--include/linux/types.h2
2 files changed, 8 insertions, 11 deletions
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 70da49bc0372..f7a944485be2 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -309,13 +309,8 @@ static Scsi_Host_Template *the_template = NULL;
#undef TAG_NONE
#define TAG_NONE 0xff
-/* For the m68k, the number of bits in 'allocated' must be a multiple of 32! */
-#if (MAX_TAGS % 32) != 0
-#error "MAX_TAGS must be a multiple of 32!"
-#endif
-
typedef struct {
- long allocated[MAX_TAGS/32];
+ DECLARE_BITMAP(allocated, MAX_TAGS);
int nr_allocated;
int queue_size;
} TAG_ALLOC;
@@ -334,7 +329,7 @@ static void __init init_tags( void )
for( target = 0; target < 8; ++target ) {
for( lun = 0; lun < 8; ++lun ) {
ta = &TagAlloc[target][lun];
- memset( &ta->allocated, 0, MAX_TAGS/8 );
+ CLEAR_BITMAP( ta->allocated, MAX_TAGS );
ta->nr_allocated = 0;
/* At the beginning, assume the maximum queue size we could
* support (MAX_TAGS). This value will be decreased if the target
@@ -394,8 +389,8 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun];
- cmd->tag = find_first_zero_bit( &ta->allocated, MAX_TAGS );
- set_bit( cmd->tag, &ta->allocated );
+ cmd->tag = find_first_zero_bit( ta->allocated, MAX_TAGS );
+ set_bit( cmd->tag, ta->allocated );
ta->nr_allocated++;
TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d "
"(now %d tags in use)\n",
@@ -424,7 +419,7 @@ static void cmd_free_tag( Scsi_Cmnd *cmd )
}
else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun];
- clear_bit( cmd->tag, &ta->allocated );
+ clear_bit( cmd->tag, ta->allocated );
ta->nr_allocated--;
TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n",
H_NO(cmd), cmd->tag, cmd->target, cmd->lun );
@@ -443,7 +438,7 @@ static void free_all_tags( void )
for( target = 0; target < 8; ++target ) {
for( lun = 0; lun < 8; ++lun ) {
ta = &TagAlloc[target][lun];
- memset( &ta->allocated, 0, MAX_TAGS/8 );
+ CLEAR_BITMAP( ta->allocated, MAX_TAGS );
ta->nr_allocated = 0;
}
}
diff --git a/include/linux/types.h b/include/linux/types.h
index 87985824b16e..94ceb057eb64 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -6,6 +6,8 @@
#define DECLARE_BITMAP(name,bits) \
unsigned long name[((bits)+BITS_PER_LONG-1)/BITS_PER_LONG]
+#define CLEAR_BITMAP(name,bits) \
+ memset(name, 0, ((bits)+BITS_PER_LONG-1)/8)
#endif
#include <linux/posix_types.h>