* [PATCH v2 1/1] staging: lustre: libcfs: nidstrings.c - use ARRAY_SIZE macro
@ 2014-07-02 10:53 Anil Belur
2014-07-08 23:48 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Anil Belur @ 2014-07-02 10:53 UTC (permalink / raw)
To: teobaluta, oleg.drokin, dmitry.eremin, bergwolf, gregkh
Cc: devel, linux-kernel, Anil Belur
From: Anil Belur <askb23@gmail.com>
- this patch replaces sizeof(a)/sizeof(a[0]) with the ARRAY_SIZE macro
to get the number of nidstrings (and netstrfns)
- v2: also for netstrfns
Signed-off-by: Anil Belur <askb23@gmail.com>
---
drivers/staging/lustre/lustre/libcfs/nidstrings.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c b/drivers/staging/lustre/lustre/libcfs/nidstrings.c
index 87705ae..4fc7b45 100644
--- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c
+++ b/drivers/staging/lustre/lustre/libcfs/nidstrings.c
@@ -74,8 +74,7 @@ libcfs_next_nidstring(void)
spin_lock_irqsave(&libcfs_nidstring_lock, flags);
str = libcfs_nidstrings[libcfs_nidstring_idx++];
- if (libcfs_nidstring_idx ==
- sizeof(libcfs_nidstrings)/sizeof(libcfs_nidstrings[0]))
+ if (libcfs_nidstring_idx == ARRAY_SIZE(libcfs_nidstrings))
libcfs_nidstring_idx = 0;
spin_unlock_irqrestore(&libcfs_nidstring_lock, flags);
@@ -198,7 +197,7 @@ static struct netstrfns libcfs_netstrfns[] = {
{/* .nf_type */ -1},
};
-const int libcfs_nnetstrfns = sizeof(libcfs_netstrfns)/sizeof(libcfs_netstrfns[0]);
+const int libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
int
libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/1] staging: lustre: libcfs: nidstrings.c - use ARRAY_SIZE macro
2014-07-02 10:53 [PATCH v2 1/1] staging: lustre: libcfs: nidstrings.c - use ARRAY_SIZE macro Anil Belur
@ 2014-07-08 23:48 ` Greg KH
2014-07-09 4:25 ` Anil Shashikumar Belur
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2014-07-08 23:48 UTC (permalink / raw)
To: Anil Belur
Cc: teobaluta, oleg.drokin, dmitry.eremin, bergwolf, devel,
linux-kernel
On Wed, Jul 02, 2014 at 04:23:55PM +0530, Anil Belur wrote:
> From: Anil Belur <askb23@gmail.com>
>
> - this patch replaces sizeof(a)/sizeof(a[0]) with the ARRAY_SIZE macro
> to get the number of nidstrings (and netstrfns)
> - v2: also for netstrfns
>
> Signed-off-by: Anil Belur <askb23@gmail.com>
Someone sent this same patch just before you did, sorry :(
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-09 4:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-02 10:53 [PATCH v2 1/1] staging: lustre: libcfs: nidstrings.c - use ARRAY_SIZE macro Anil Belur
2014-07-08 23:48 ` Greg KH
2014-07-09 4:25 ` Anil Shashikumar Belur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox