Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336950

Re: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON

From Krzysztof Kozlowski <k.kozlowski@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON
Date 2016-02-18 02:50 +0100
Message-ID <r3lTc-6Da-1@gated-at.bofh.it> (permalink)
References <r3kNs-5NL-9@gated-at.bofh.it> <r3lJv-6xI-9@gated-at.bofh.it> <r3lJv-6xI-7@gated-at.bofh.it> <r3lTc-6Da-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-02-18 01:40 +0100
  Re: [PATCH v2] regulator: s2mps11: Simplify expression used in  BUILD_BUG_ON Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-02-18 02:40 +0100
    Re: [PATCH v2] regulator: s2mps11: Simplify expression used in  BUILD_BUG_ON Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-02-18 02:50 +0100
      Re: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON Arnd Bergmann <arnd@arndb.de> - 2016-02-18 10:10 +0100
    Re: [PATCH v2] regulator: s2mps11: Simplify expression used in  BUILD_BUG_ON Andi Shyti <andi.shyti@samsung.com> - 2016-02-18 02:50 +0100
  Re: [PATCH v2] regulator: s2mps11: Simplify expression used in  BUILD_BUG_ON Andi Shyti <andi.shyti@samsung.com> - 2016-02-18 02:40 +0100
  Re: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON Arnd Bergmann <arnd@arndb.de> - 2016-02-18 10:10 +0100

csiph-web