aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@nuerscht.ch>2006-06-09 01:23:48 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-06-10 11:45:30 -0400
commit6391a11375de5e2bb1eb8481e54619761dc65d9f (patch)
tree956aae1d278a3f731b2e6148ff40a69aa7957ea8 /drivers/scsi/scsi_sysfs.c
parent9dc399de0840a478adb71278becf598d3ab3aacc (diff)
[SCSI] drivers/scsi: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove duplicates of the macro. Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index a6fde52946d6..5ec7a4fb0145 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -39,7 +39,7 @@ const char *scsi_device_state_name(enum scsi_device_state state)
39 int i; 39 int i;
40 char *name = NULL; 40 char *name = NULL;
41 41
42 for (i = 0; i < sizeof(sdev_states)/sizeof(sdev_states[0]); i++) { 42 for (i = 0; i < ARRAY_SIZE(sdev_states); i++) {
43 if (sdev_states[i].value == state) { 43 if (sdev_states[i].value == state) {
44 name = sdev_states[i].name; 44 name = sdev_states[i].name;
45 break; 45 break;
@@ -65,7 +65,7 @@ const char *scsi_host_state_name(enum scsi_host_state state)
65 int i; 65 int i;
66 char *name = NULL; 66 char *name = NULL;
67 67
68 for (i = 0; i < sizeof(shost_states)/sizeof(shost_states[0]); i++) { 68 for (i = 0; i < ARRAY_SIZE(shost_states); i++) {
69 if (shost_states[i].value == state) { 69 if (shost_states[i].value == state) {
70 name = shost_states[i].name; 70 name = shost_states[i].name;
71 break; 71 break;
@@ -160,7 +160,7 @@ store_shost_state(struct class_device *class_dev, const char *buf, size_t count)
160 struct Scsi_Host *shost = class_to_shost(class_dev); 160 struct Scsi_Host *shost = class_to_shost(class_dev);
161 enum scsi_host_state state = 0; 161 enum scsi_host_state state = 0;
162 162
163 for (i = 0; i < sizeof(shost_states)/sizeof(shost_states[0]); i++) { 163 for (i = 0; i < ARRAY_SIZE(shost_states); i++) {
164 const int len = strlen(shost_states[i].name); 164 const int len = strlen(shost_states[i].name);
165 if (strncmp(shost_states[i].name, buf, len) == 0 && 165 if (strncmp(shost_states[i].name, buf, len) == 0 &&
166 buf[len] == '\n') { 166 buf[len] == '\n') {
@@ -466,7 +466,7 @@ store_state_field(struct device *dev, struct device_attribute *attr, const char
466 struct scsi_device *sdev = to_scsi_device(dev); 466 struct scsi_device *sdev = to_scsi_device(dev);
467 enum scsi_device_state state = 0; 467 enum scsi_device_state state = 0;
468 468
469 for (i = 0; i < sizeof(sdev_states)/sizeof(sdev_states[0]); i++) { 469 for (i = 0; i < ARRAY_SIZE(sdev_states); i++) {
470 const int len = strlen(sdev_states[i].name); 470 const int len = strlen(sdev_states[i].name);
471 if (strncmp(sdev_states[i].name, buf, len) == 0 && 471 if (strncmp(sdev_states[i].name, buf, len) == 0 &&
472 buf[len] == '\n') { 472 buf[len] == '\n') {