From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Marcelo Tosatti <marcelo@conectiva.com.br>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Development <linux-kernel@vger.kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH] Atari NCR5380 SCSI: bitops operate on long
Date: Sun, 23 Mar 2003 12:25:49 +0100 [thread overview]
Message-ID: <200303231125.h2NBPnVx009682@callisto.of.borg> (raw)
Atari NCR5380 SCSI: bitops operate on long, not char.
This also introduces the DECLARE_BITMAP() and CLEAR_BITMAP() macros we have in
2.5.x.
--- linux-2.4.x/drivers/scsi/atari_NCR5380.c Fri Mar 1 17:28:31 2002
+++ linux-m68k-2.4.x/drivers/scsi/atari_NCR5380.c Sat Mar 2 14:31:07 2002
@@ -309,13 +309,8 @@
#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 {
- char allocated[MAX_TAGS/8];
+ DECLARE_BITMAP(allocated, MAX_TAGS);
int nr_allocated;
int queue_size;
} TAG_ALLOC;
@@ -334,7 +329,7 @@
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 @@
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 @@
}
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 @@
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;
}
}
--- linux-2.4.x/include/linux/types.h Wed May 29 10:14:25 2002
+++ linux-m68k-2.4.x/include/linux/types.h Sun Mar 2 15:58:24 2003
@@ -3,6 +3,13 @@
#ifdef __KERNEL__
#include <linux/config.h>
+
+#define BITS_TO_LONGS(bits) \
+ (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
+#define DECLARE_BITMAP(name,bits) \
+ unsigned long name[BITS_TO_LONGS(bits)]
+#define CLEAR_BITMAP(name,bits) \
+ memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long))
#endif
#include <linux/posix_types.h>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
reply other threads:[~2003-03-23 11:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200303231125.h2NBPnVx009682@callisto.of.borg \
--to=geert@linux-m68k.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).