ipmi: use ARRAY_SIZE for poweroff_functions array sizing calculation
authorColin Ian King <colin.king@canonical.com>
Fri, 2 Mar 2018 14:14:51 +0000 (14:14 +0000)
committerCorey Minyard <cminyard@mvista.com>
Wed, 7 Mar 2018 01:47:51 +0000 (19:47 -0600)
Use the ARRAY_SIZE macro on a array poweroff_functions to determine
size of the array. Improvement suggested by Coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
drivers/char/ipmi/ipmi_poweroff.c

index 07fa366bc8f05ecc3cb776fc6a70fef9bb593d7f..fccb1e9fd3b7c6be4f19f9a725696fd06c2e0661 100644 (file)
@@ -519,8 +519,7 @@ static struct poweroff_function poweroff_functions[] = {
          .detect               = ipmi_chassis_detect,
          .poweroff_func        = ipmi_poweroff_chassis },
 };
-#define NUM_PO_FUNCS (sizeof(poweroff_functions) \
-                     / sizeof(struct poweroff_function))
+#define NUM_PO_FUNCS ARRAY_SIZE(poweroff_functions)
 
 
 /* Called on a powerdown request. */