mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@samsung.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Sangbeom Kim <sbkim73@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	jacob.e.keller@intel.com, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON
Date: Thu, 18 Feb 2016 10:37:06 +0900	[thread overview]
Message-ID: <20160218013705.GI10719@samsunx.samsung> (raw)
In-Reply-To: <1455755707-16844-1-git-send-email-k.kozlowski@samsung.com>

Hi Krzysztof,

> Following BUILD_BUG_ON using a variable fails for some of the compilers
> and optimization levels (reported for gcc 4.9):
> 	var = ARRAY_SIZE(s2mps15_regulators);
> 	BUILD_BUG_ON(S2MPS_REGULATOR_MAX < var);
> Fix this by using ARRAY_SIZE directly.
> 
> Additionally add missing BUILD_BUG_ON check for S2MPS15 device (the
> check ensures that internal arrays are big enough to hold data for all
> of regulators on all devices).
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 

[...]

>  	case S2MPS11X:
>  		s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);

Why don't we remove rdev_num at all? It's not used that much
other than in the probe function.

>  		regulators = s2mps11_regulators;
> -		BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num);
> +		BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps11_regulators));
>  		break;

Andi

  reply	other threads:[~2016-02-18  1:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  0:35 Krzysztof Kozlowski
2016-02-18  1:37 ` Andi Shyti [this message]
2016-02-18  1:38   ` Krzysztof Kozlowski
2016-02-18  1:46     ` Andi Shyti
2016-02-18  1:48       ` Krzysztof Kozlowski
2016-02-18  9:05         ` Arnd Bergmann
2016-02-18  9:06 ` Arnd Bergmann

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=20160218013705.GI10719@samsunx.samsung \
    --to=andi.shyti@samsung.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=k.kozlowski@samsung.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sbkim73@samsung.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 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®