All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Andi Shyti <andi.shyti@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:48:39 +0900	[thread overview]
Message-ID: <56C522F7.5040109@samsung.com> (raw)
In-Reply-To: <20160218014610.GJ10719@samsunx.samsung>

On 18.02.2016 10:46, Andi Shyti wrote:
>>>> 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.
>>
>> Remove from probe? It is used in probe and removal would make the code
>> more complicated than it should be.
> 
> no, I mean remove it from s2mps11_info. Other than in the probe
> this value is used only once in s2mps11_pmic_dt_parse() (which is
> called by probe()).

Sure, it can be safely removed from s2mps11_info... but it won't affect
this issue and this patch. Still the local variable would be used in
probe leading to compiler optimization choices impacting BUILD_BUG_ON.

BR,
Krzysztof

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  0:35 [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON Krzysztof Kozlowski
2016-02-18  1:37 ` Andi Shyti
2016-02-18  1:38   ` Krzysztof Kozlowski
2016-02-18  1:46     ` Andi Shyti
2016-02-18  1:48       ` Krzysztof Kozlowski [this message]
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=56C522F7.5040109@samsung.com \
    --to=k.kozlowski@samsung.com \
    --cc=andi.shyti@samsung.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=jacob.e.keller@intel.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 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.