From: Thiago Farina <tfransosi@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: James.Bottomley@suse.de, robert.w.love@intel.com,
vasu.dev@intel.com, jeykholt@cisco.com,
linux-scsi@vger.kernel.org
Subject: [PATCH] scsi/libfc: Clean up hard coded array size calculation.
Date: Sat, 19 Dec 2009 18:26:16 -0500 [thread overview]
Message-ID: <1261265176-5241-1-git-send-email-tfransosi@gmail.com> (raw)
Use ARRAY_SIZE macro from kernel.h api instead.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
drivers/scsi/libfc/fc_exch.c | 9 ++++-----
drivers/scsi/libfc/fc_lport.c | 3 ++-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index c1c1574..b65652a 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -23,9 +23,10 @@
* Fibre Channel exchange and sequence handling.
*/
-#include <linux/timer.h>
-#include <linux/gfp.h>
#include <linux/err.h>
+#include <linux/gfp.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
#include <scsi/fc/fc_fc2.h>
@@ -194,8 +195,6 @@ static struct fc_seq *fc_seq_start_next_locked(struct fc_seq *sp);
*/
static char *fc_exch_rctl_names[] = FC_RCTL_NAMES_INIT;
-#define FC_TABLE_SIZE(x) (sizeof(x) / sizeof(x[0]))
-
static inline const char *fc_exch_name_lookup(unsigned int op, char **table,
unsigned int max_index)
{
@@ -211,7 +210,7 @@ static inline const char *fc_exch_name_lookup(unsigned int op, char **table,
static const char *fc_exch_rctl_name(unsigned int op)
{
return fc_exch_name_lookup(op, fc_exch_rctl_names,
- FC_TABLE_SIZE(fc_exch_rctl_names));
+ ARRAY_SIZE(fc_exch_rctl_names));
}
/*
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index bd2f771..98b4eaf 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -87,6 +87,7 @@
* (i.e. _enter_* function).
*/
+#include <linux/kernel.h>
#include <linux/timer.h>
#include <asm/unaligned.h>
@@ -1137,7 +1138,7 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport)
fc_lport_state_enter(lport, LPORT_ST_RFT_ID);
lps = &lport->fcts;
- i = sizeof(lps->ff_type_map) / sizeof(lps->ff_type_map[0]);
+ i = ARRAY_SIZE(lps->ff_type_map);
while (--i >= 0)
if (ntohl(lps->ff_type_map[i]) != 0)
break;
--
1.6.6.rc0.61.g41d5b
reply other threads:[~2009-12-19 23:26 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=1261265176-5241-1-git-send-email-tfransosi@gmail.com \
--to=tfransosi@gmail.com \
--cc=James.Bottomley@suse.de \
--cc=jeykholt@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=robert.w.love@intel.com \
--cc=vasu.dev@intel.com \
/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).