From nobody Fri Dec 19 02:54:14 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 773B3C001DF for ; Thu, 3 Aug 2023 11:40:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232875AbjHCLkA (ORCPT ); Thu, 3 Aug 2023 07:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232835AbjHCLjy (ORCPT ); Thu, 3 Aug 2023 07:39:54 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC8F1BF0 for ; Thu, 3 Aug 2023 04:39:53 -0700 (PDT) Received: from dggpemm500019.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RGn130RlBzrS9j; Thu, 3 Aug 2023 19:38:47 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500019.china.huawei.com (7.185.36.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 3 Aug 2023 19:39:51 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 3 Aug 2023 19:39:50 +0800 From: Yang Yingliang To: CC: , , , Subject: [PATCH -next] regulator: max77857: fix build error in max77857-regulator.c Date: Thu, 3 Aug 2023 19:36:54 +0800 Message-ID: <20230803113654.818640-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When using low verion gcc(7.5) to build the max77857-regulator driver, got the following error: drivers/regulator/max77857-regulator.c:312:16: error: initializer element i= s not constant .ramp_delay =3D max77857_ramp_table[0][0], To fix this by introducing a macro RAMAP_DELAY_INIT_VAL to define the value of max77857_ramp_table[0[0]. Fixes: af71cccadece ("regulator: max77857: Add ADI MAX77857/59/MAX77831 Reg= ulator Support") Signed-off-by: Yang Yingliang --- I notice this build error has been in -next a while, and it hasn't been fix= ed yet, so I tried to fix this. If it was already fixed in other way, ignore this p= atch. --- drivers/regulator/max77857-regulator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/max77857-regulator.c b/drivers/regulator/max= 77857-regulator.c index f2141b5be780..44a510547318 100644 --- a/drivers/regulator/max77857-regulator.c +++ b/drivers/regulator/max77857-regulator.c @@ -293,8 +293,10 @@ static const unsigned int max77857_switch_freq[] =3D { 1200000, 1500000, 1800000, 2100000 }; =20 +#define RAMAP_DELAY_INIT_VAL 1333 + static const unsigned int max77857_ramp_table[2][4] =3D { - { 1333, 667, 333, 227 }, /* when switch freq is 1.8MHz or 2.1MHz */ + { RAMAP_DELAY_INIT_VAL, 667, 333, 227 }, /* when switch freq is 1.8MHz or= 2.1MHz */ { 1166, 667, 333, 167 }, /* when switch freq is 1.2MHz or 1.5MHz */ }; =20 @@ -309,7 +311,7 @@ static struct regulator_desc max77857_regulator_desc = =3D { .n_ramp_values =3D ARRAY_SIZE(max77857_ramp_table[0]), .ramp_reg =3D MAX77857_REG_CONT3, .ramp_mask =3D GENMASK(1, 0), - .ramp_delay =3D max77857_ramp_table[0][0], + .ramp_delay =3D RAMAP_DELAY_INIT_VAL, .owner =3D THIS_MODULE, }; =20 --=20 2.25.1