From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751505AbcB2Mve (ORCPT ); Mon, 29 Feb 2016 07:51:34 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:19722 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750861AbcB2Mvb convert rfc822-to-8bit (ORCPT ); Mon, 29 Feb 2016 07:51:31 -0500 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 29 Feb 2016 04:51:14 -0800 Message-ID: <56D43BE1.1080501@nvidia.com> Date: Mon, 29 Feb 2016 18:08:57 +0530 From: Laxman Dewangan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Rhyland Klein , Lee Jones CC: Subject: Re: [PATCH] mfd: Fix MACRO for commonly declared MFD cell attributes References: <1455821558-28493-1-git-send-email-rklein@nvidia.com> <20160219085019.GA3410@x1> <56C742C4.4080308@nvidia.com> <56D07ED6.7030607@nvidia.com> In-Reply-To: <56D07ED6.7030607@nvidia.com> X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: BGMAIL103.nvidia.com (10.25.59.12) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 26 February 2016 10:05 PM, Rhyland Klein wrote: > On 2/19/2016 11:28 AM, Rhyland Klein wrote: >> On 2/19/2016 3:50 AM, Lee Jones wrote: >>> On Thu, 18 Feb 2016, Rhyland Klein wrote: >>> >>>> #define MFD_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) >>>> >>>> -#define MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, _match) \ >>>> +#define MFD_CELL_ALL(_name, _nres, _res, _pdata, _id, _compat, _match) \ >>>> { \ >>>> .name = (_name), \ >>>> .resources = (_res), \ >>>> - .num_resources = MFD_ARRAY_SIZE((_res)), \ >>>> + .num_resources = (_nres), \ >>>> .platform_data = (_pdata), \ >>>> .pdata_size = MFD_ARRAY_SIZE((_pdata)), \ The pdata_size initialization is also not correct. This is not the array count but the size of the platform data which is passed. Should be sizeof((_pdata)) >> >> #define MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, _match) \ >> { \ >> >> That was my first thought too. However, I see this when I try to compile >> that: >> >> In file included from drivers/mfd/max77620.c:18:0: >> include/linux/mfd/core.h:19:34: warning: the address of ‘gpio_resources’ >> will always evaluate as ‘true’ [-Waddress] >> #define MFD_ARRAY_SIZE(arr) (arr ? (sizeof(arr) / sizeof((arr)[0])) : 0) >> >> 7 different times. This patch was the only way I seemed to be able to >> WAR around compile time warnings. >> >> -rhyland >> > Did you not see warnings like this when you compiled the kernel? Did you > find a different approach than what I proposed above to deal with it? > I'd like to get this in soon so that when the max77620 drivers are all > in and using it, it should be functional. > I think the following change also crash in runtime: /*** commit e60a946f05db2cac857025da6ffb72df48d3be54 Author: Lee Jones mfd: ab8500: Provide a small example using new MFD cell MACROs ***/ Should we have something MFD_CELL_RES, MFD_CELL_RES_PDATA, MFD_CELL_PDATA, for more common user and not to pass the NULL here.