From: Matthew Wilcox <matthew@wil.cx>
To: linux-scsi@vger.kernel.org
Cc: "Subject:[PATCH 4/5]"@wil.cx, "[SCSI]"@wil.cx, Use@wil.cx,
ARRAY_SIZE@wil.cx, in@wil.cx, spi_print_msg@wil.cx,
Matthew Wilcox <matthew@wil.cx>
Subject: From: Matthew Wilcox <matthew@wil.cx>
Date: Thu, 15 Dec 2005 16:07:32 -0500 [thread overview]
Message-ID: <11346808521924-git-send-email-matthew@wil.cx> (raw)
In-Reply-To: <11346808522583-git-send-email-matthew@wil.cx>
Replace the custom NO_*_MSGS definitions with uses of ARRAY_SIZE.
This fixes a bug in the definition of NO_EXTENDED_MSGS.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
---
drivers/scsi/scsi_transport_spi.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
a7469c6472f85b42be4953e6b64a5dcb2dd96d6f
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 8cc5dff..380e167 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1057,19 +1057,16 @@ static const char * const one_byte_msgs[
/* 0x0c */ "Bus device reset", "Abort Tag", "Clear Queue",
/* 0x0f */ "Initiate Recovery", "Release Recovery"
};
-#define NO_ONE_BYTE_MSGS (sizeof(one_byte_msgs) / sizeof (const char *))
static const char * const two_byte_msgs[] = {
/* 0x20 */ "Simple Queue Tag", "Head of Queue Tag", "Ordered Queue Tag",
/* 0x23 */ "Ignore Wide Residue"
};
-#define NO_TWO_BYTE_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
static const char * const extended_msgs[] = {
/* 0x00 */ "Modify Data Pointer", "Synchronous Data Transfer Request",
/* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Request"
};
-#define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *))
int spi_print_msg(const unsigned char *msg)
@@ -1077,7 +1074,7 @@ int spi_print_msg(const unsigned char *m
int len = 0, i;
if (msg[0] == EXTENDED_MESSAGE) {
len = 3 + msg[1];
- if (msg[2] < NO_EXTENDED_MSGS)
+ if (msg[2] < ARRAY_SIZE(extended_msgs))
printk ("%s ", extended_msgs[msg[2]]);
else
printk ("Extended Message, reserved code (0x%02x) ",
@@ -1107,14 +1104,14 @@ int spi_print_msg(const unsigned char *m
len = 1;
/* Normal One byte */
} else if (msg[0] < 0x1f) {
- if (msg[0] < NO_ONE_BYTE_MSGS)
+ if (msg[0] < ARRAY_SIZE(one_byte_msgs))
printk(one_byte_msgs[msg[0]]);
else
printk("reserved (%02x) ", msg[0]);
len = 1;
/* Two byte */
} else if (msg[0] <= 0x2f) {
- if ((msg[0] - 0x20) < NO_TWO_BYTE_MSGS)
+ if ((msg[0] - 0x20) < ARRAY_SIZE(two_byte_msgs))
printk("%s %02x ", two_byte_msgs[msg[0] - 0x20],
msg[1]);
else
--
0.99.9.GIT
next prev parent reply other threads:[~2005-12-15 21:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-13 16:53 [PATCH] Move scsi_print_msg to SPI code Matthew Wilcox
2005-12-13 18:32 ` Jeff Garzik
2005-12-15 20:58 ` Matthew Wilcox
2005-12-15 21:07 ` From: Matthew Wilcox <matthew@wil.cx> Matthew Wilcox
2005-12-15 21:07 ` Matthew Wilcox
2005-12-15 21:07 ` Matthew Wilcox
2005-12-15 21:07 ` Matthew Wilcox [this message]
2005-12-15 21:07 ` Matthew Wilcox
2005-12-15 21:22 ` [PATCH 5/5] [SCSI] Add PPR support to spi_print_msg Matthew Wilcox
2005-12-15 21:22 ` [PATCH 4/5] [SCSI] Use ARRAY_SIZE in spi_print_msg Matthew Wilcox
2005-12-15 21:22 ` [PATCH 2/5] [SCSI] Rename scsi_print_msg to spi_print_msg Matthew Wilcox
2005-12-15 21:22 ` [PATCH 3/5] [SCSI] Fix printing of two-byte messages Matthew Wilcox
2005-12-15 21:22 ` [PATCH 1/5] [SCSI] Move scsi_print_msg to SPI class Matthew Wilcox
2005-12-15 21:22 ` [PATCH] Move scsi_print_msg to SPI code Matthew Wilcox
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=11346808521924-git-send-email-matthew@wil.cx \
--to=matthew@wil.cx \
--cc="Subject:[PATCH 4/5]"@wil.cx \
--cc="[SCSI]"@wil.cx \
--cc=ARRAY_SIZE@wil.cx \
--cc=Use@wil.cx \
--cc=in@wil.cx \
--cc=linux-scsi@vger.kernel.org \
--cc=spi_print_msg@wil.cx \
/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