From: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
To: zbr@ioremap.net, linux-kernel@vger.kernel.org
Cc: olivier@okprods.com, Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Subject: [PATCH 2/2] w1: ds2408: use ARRAY_SIZE instead of hard-coded number
Date: Thu, 7 Mar 2013 16:07:04 -0500 [thread overview]
Message-ID: <1362690424-324-2-git-send-email-jeff.dagenais@gmail.com> (raw)
In-Reply-To: <1362690424-324-1-git-send-email-jeff.dagenais@gmail.com>
Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
---
drivers/w1/slaves/w1_ds2408.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c
index 25a5168..e45eca1 100644
--- a/drivers/w1/slaves/w1_ds2408.c
+++ b/drivers/w1/slaves/w1_ds2408.c
@@ -303,8 +303,7 @@ error:
-#define NB_SYSFS_BIN_FILES 6
-static struct bin_attribute w1_f29_sysfs_bin_files[NB_SYSFS_BIN_FILES] = {
+static struct bin_attribute w1_f29_sysfs_bin_files[] = {
{
.attr = {
.name = "state",
@@ -363,7 +362,7 @@ static int w1_f29_add_slave(struct w1_slave *sl)
int err = 0;
int i;
- for (i = 0; i < NB_SYSFS_BIN_FILES && !err; ++i)
+ for (i = 0; i < ARRAY_SIZE(w1_f29_sysfs_bin_files) && !err; ++i)
err = sysfs_create_bin_file(
&sl->dev.kobj,
&(w1_f29_sysfs_bin_files[i]));
@@ -377,7 +376,7 @@ static int w1_f29_add_slave(struct w1_slave *sl)
static void w1_f29_remove_slave(struct w1_slave *sl)
{
int i;
- for (i = NB_SYSFS_BIN_FILES - 1; i >= 0; --i)
+ for (i = ARRAY_SIZE(w1_f29_sysfs_bin_files) - 1; i >= 0; --i)
sysfs_remove_bin_file(&sl->dev.kobj,
&(w1_f29_sysfs_bin_files[i]));
}
--
1.8.1.1
next prev parent reply other threads:[~2013-03-07 21:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51238FBA.9050600@okprods.com>
2013-02-19 15:20 ` w1_ds2408 linux driver Jean-Francois Dagenais
2013-03-07 20:09 ` Jean-Francois Dagenais
2013-03-07 21:07 ` [PATCH 1/2] w1: ds2408: make value read-back check a Kconfig option Jean-Francois Dagenais
2013-03-07 21:07 ` Jean-Francois Dagenais [this message]
2013-03-12 2:09 ` Evgeniy Polyakov
2013-03-12 18:28 ` Jean-François Dagenais
2013-03-15 0:15 ` Evgeniy Polyakov
2013-03-15 18:20 ` Jean-Francois Dagenais
2013-03-15 18:20 ` [PATCH 2/2] w1: ds2408: use ARRAY_SIZE instead of hard-coded number Jean-Francois Dagenais
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=1362690424-324-2-git-send-email-jeff.dagenais@gmail.com \
--to=jeff.dagenais@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olivier@okprods.com \
--cc=zbr@ioremap.net \
/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