mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ipmi: use ARRAY_SIZE for poweroff_functions array sizing calculation
@ 2018-03-02 14:14 Colin King
  2018-03-02 14:39 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-03-02 14:14 UTC (permalink / raw)
  To: Corey Minyard, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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>
---
 drivers/char/ipmi/ipmi_poweroff.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c
index 07fa366bc8f0..fccb1e9fd3b7 100644
--- a/drivers/char/ipmi/ipmi_poweroff.c
+++ b/drivers/char/ipmi/ipmi_poweroff.c
@@ -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. */
-- 
2.15.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipmi: use ARRAY_SIZE for poweroff_functions array sizing calculation
  2018-03-02 14:14 [PATCH] ipmi: use ARRAY_SIZE for poweroff_functions array sizing calculation Colin King
@ 2018-03-02 14:39 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2018-03-02 14:39 UTC (permalink / raw)
  To: Colin King, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer
  Cc: kernel-janitors, linux-kernel

On 03/02/2018 08:14 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Use the ARRAY_SIZE macro on a array poweroff_functions to determine
> size of the array. Improvement suggested by Coccinelle.

Queued for next release.  Thanks!

-corey

> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/char/ipmi/ipmi_poweroff.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c
> index 07fa366bc8f0..fccb1e9fd3b7 100644
> --- a/drivers/char/ipmi/ipmi_poweroff.c
> +++ b/drivers/char/ipmi/ipmi_poweroff.c
> @@ -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. */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-02 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-02 14:14 [PATCH] ipmi: use ARRAY_SIZE for poweroff_functions array sizing calculation Colin King
2018-03-02 14:39 ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®