diff options
author | Jean-Francois Dagenais <jeff.dagenais@gmail.com> | 2013-03-15 14:20:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-15 15:15:02 -0400 |
commit | 1116575d918a7d5fe6d1adf46c5bbdf11dcec51b (patch) | |
tree | f1bf6af57f6259e55b25eec12a534fc53e202de1 | |
parent | aceca2854498de7384ee7b44d8eb7820fd4c7f16 (diff) |
w1: ds2408: use ARRAY_SIZE instead of hard-coded number
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/w1/slaves/w1_ds2408.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c index 25a5168ab522..e45eca1044bd 100644 --- a/drivers/w1/slaves/w1_ds2408.c +++ b/drivers/w1/slaves/w1_ds2408.c | |||
@@ -303,8 +303,7 @@ error: | |||
303 | 303 | ||
304 | 304 | ||
305 | 305 | ||
306 | #define NB_SYSFS_BIN_FILES 6 | 306 | static struct bin_attribute w1_f29_sysfs_bin_files[] = { |
307 | static struct bin_attribute w1_f29_sysfs_bin_files[NB_SYSFS_BIN_FILES] = { | ||
308 | { | 307 | { |
309 | .attr = { | 308 | .attr = { |
310 | .name = "state", | 309 | .name = "state", |
@@ -363,7 +362,7 @@ static int w1_f29_add_slave(struct w1_slave *sl) | |||
363 | int err = 0; | 362 | int err = 0; |
364 | int i; | 363 | int i; |
365 | 364 | ||
366 | for (i = 0; i < NB_SYSFS_BIN_FILES && !err; ++i) | 365 | for (i = 0; i < ARRAY_SIZE(w1_f29_sysfs_bin_files) && !err; ++i) |
367 | err = sysfs_create_bin_file( | 366 | err = sysfs_create_bin_file( |
368 | &sl->dev.kobj, | 367 | &sl->dev.kobj, |
369 | &(w1_f29_sysfs_bin_files[i])); | 368 | &(w1_f29_sysfs_bin_files[i])); |
@@ -377,7 +376,7 @@ static int w1_f29_add_slave(struct w1_slave *sl) | |||
377 | static void w1_f29_remove_slave(struct w1_slave *sl) | 376 | static void w1_f29_remove_slave(struct w1_slave *sl) |
378 | { | 377 | { |
379 | int i; | 378 | int i; |
380 | for (i = NB_SYSFS_BIN_FILES - 1; i >= 0; --i) | 379 | for (i = ARRAY_SIZE(w1_f29_sysfs_bin_files) - 1; i >= 0; --i) |
381 | sysfs_remove_bin_file(&sl->dev.kobj, | 380 | sysfs_remove_bin_file(&sl->dev.kobj, |
382 | &(w1_f29_sysfs_bin_files[i])); | 381 | &(w1_f29_sysfs_bin_files[i])); |
383 | } | 382 | } |