From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424587AbcBRBst (ORCPT ); Wed, 17 Feb 2016 20:48:49 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:30159 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422931AbcBRBsq (ORCPT ); Wed, 17 Feb 2016 20:48:46 -0500 X-AuditID: cbfec7f4-f79026d00000418a-1f-56c522fca574 Subject: Re: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON To: Andi Shyti References: <1455755707-16844-1-git-send-email-k.kozlowski@samsung.com> <20160218013705.GI10719@samsunx.samsung> <56C520A7.40201@samsung.com> <20160218014610.GJ10719@samsunx.samsung> Cc: Sangbeom Kim , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, jacob.e.keller@intel.com, Arnd Bergmann From: Krzysztof Kozlowski Message-id: <56C522F7.5040109@samsung.com> Date: Thu, 18 Feb 2016 10:48:39 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 In-reply-to: <20160218014610.GJ10719@samsunx.samsung> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsVy+t/xa7p/lI6GGbx7wGqx/cgzVou/k46x W0x9+ITN4sSxhSwWr18YWny70sFkcXnXHDaLGef3MVlcXPGFyYHT4/evSYweO2fdZfdYvOcl k8emVZ1sHn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJVxa1M3U8E1ropLU5ayNDDe5uhi5OSQ EDCR6PiykwXCFpO4cG89WxcjF4eQwFJGiZ6JSxhBEkICTxkl7u+VB7GFBcIk5i6czgZiiwio SyzZu5UZomEXo8SqNztYQRxmgTeMEv/+fWUHqWITMJbYvHwJWAevgJbEppfXwKayCKhK/F5y BqxGVCBC4nBnFztEjaDEj8n3wE7iFDCVWHduOlA9B9BQPYn7F7VAwswC8hKb17xlnsAoMAtJ xyyEqllIqhYwMq9iFE0tTS4oTkrPNdQrTswtLs1L10vOz93ECImALzsYFx+zOsQowMGoxMPL 8fpImBBrYllxZe4hRgkOZiURXl++o2FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeefueh8iJJCe WJKanZpakFoEk2Xi4JRqYNySrzH/Y+0rp+OKMzVyb4a97/S4PSlmwm4l7crDJSVsq5MlOp8U 6bjOvKZ9M3/vj32d/18ohyj2JFxSOPGjKflcvO6tV5cWl03gONNq+Nx9v+T1sPJznZcnfV+0 uvxjjOz9/rmPD30+9q9of+uCLGujj7VKZwXtJBl7f3WmFn99ylxe7O7WyqjEUpyRaKjFXFSc CADfEfOafAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>>> Signed-off-by: Krzysztof Kozlowski >>>> >>> >>> [...] >>> >>>> 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