All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: sayli karnik <karniksayli1995@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [PATCH v2] staging: vc04_services: vchiq_arm: Use ARRAY_SIZE macro
Date: Mon, 17 Oct 2016 09:34:40 +0200	[thread overview]
Message-ID: <20161017073440.GA27518@kroah.com> (raw)
In-Reply-To: <20161016133051.GA28472@sayli-HP-15-Notebook-PC>

On Sun, Oct 16, 2016 at 07:00:51PM +0530, sayli karnik wrote:
> This patch uses ARRAY_SIZE macro instead of division of two sizeofs to
> find array size.
> Done using coccinelle.
> @@
> type T;
> T[] E;
> @@
> (
> - (sizeof(E)/sizeof(*E))
> + ARRAY_SIZE(E)
> |
> - (sizeof(E)/sizeof(E[...]))
> + ARRAY_SIZE(E)
> |
> - (sizeof(E)/sizeof(T))
> + ARRAY_SIZE(E)
> )
> 
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
> ---
> Changes in v2:
> Adjusted the changed part in one line
> 
>  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 5ec7c96..7fee140 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -190,8 +190,7 @@ static const char *const ioctl_names[] = {
>  	"CLOSE_DELIVERED"
>  };
>  
> -vchiq_static_assert((sizeof(ioctl_names)/sizeof(ioctl_names[0])) ==
> -	(VCHIQ_IOC_MAX + 1));
> +vchiq_static_assert(ARRAY_SIZE(ioctl_names) == (VCHIQ_IOC_MAX + 1));

How were you able to test build this change?  The code is currently
broken in the build unless you add a number of external patches at the
moment :(

thanks,

greg k-h


  reply	other threads:[~2016-10-17  7:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-16 13:30 [PATCH v2] staging: vc04_services: vchiq_arm: Use ARRAY_SIZE macro sayli karnik
2016-10-17  7:34 ` Greg Kroah-Hartman [this message]
2016-10-17 15:12   ` sayli karnik
2016-10-17 16:19     ` Greg Kroah-Hartman

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=20161017073440.GA27518@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=karniksayli1995@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.