From mboxrd@z Thu Jan 1 00:00:00 1970 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 D854CC433FE for ; Tue, 29 Mar 2022 12:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235856AbiC2MJV (ORCPT ); Tue, 29 Mar 2022 08:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbiC2MJU (ORCPT ); Tue, 29 Mar 2022 08:09:20 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FF411F608; Tue, 29 Mar 2022 05:07:37 -0700 (PDT) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22TAHJCk029058; Tue, 29 Mar 2022 14:07:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=osMzLdkQ6grvoOD0PPp5+8N1DayXK6oHusZTOhnzDIM=; b=WzpjXfluC2otRdrEe4i5lw1dl188CauxupIF+mewKyPX71/QFMK5DvdWjx8UmmtivDGW qar4zP/mCmw1UC+kCef1dNuxpgZFQ58pZIJy6FKOm6OATZTwxaXmzY4akFdHxul1zQJW OYAHjDvPIZ1etazETuJzN60T9DFLBvyNoNQ+fBbOIJfM+ymxxCkngHi25tzBePPen9wl EV+D6BXiuYOqGAIFOgKNuSRM63u4elTJ5Jy8D6LthyQtQpd7Fq0CNcCcOgBxCk7gynWN FKHdojIp8gcYQF6OHx9ZLHzO6mwmgrPmvceHoRU7dgezm/Fr1FU3YUL9aSmtPkPcb5bg lA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3f1rud9q5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Mar 2022 14:07:05 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 01DE910002A; Tue, 29 Mar 2022 14:07:04 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id EAE95221764; Tue, 29 Mar 2022 14:07:03 +0200 (CEST) Received: from [10.211.9.54] (10.75.127.51) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Tue, 29 Mar 2022 14:07:01 +0200 Message-ID: Date: Tue, 29 Mar 2022 14:07:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v1 2/5] pinctrl: stm32: Replace custom code by gpiochip_count() call Content-Language: en-US To: Andy Shevchenko , Gregory CLEMENT , Geert Uytterhoeven , Linus Walleij , , , , , , CC: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Andrew Lunn , Sebastian Hesselbarth , Maxime Coquelin , Alexandre Torgue , Bartosz Golaszewski References: <20220325200338.54270-1-andriy.shevchenko@linux.intel.com> <20220325200338.54270-2-andriy.shevchenko@linux.intel.com> From: Fabien DESSENNE In-Reply-To: <20220325200338.54270-2-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-29_04,2022-03-29_01,2022-02-23_01 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Hi Andy Thank you for your the clarification. On 25/03/2022 21:03, Andy Shevchenko wrote: > Since we have generic function to count GPIO controller nodes > under given device, there is no need to open code it. Replace > custom code by gpiochip_count() call. > > Signed-off-by: Andy Shevchenko > --- > drivers/pinctrl/stm32/pinctrl-stm32.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c > index 9ed764731570..d4bbeec82c1f 100644 > --- a/drivers/pinctrl/stm32/pinctrl-stm32.c > +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c > @@ -1423,7 +1423,8 @@ int stm32_pctl_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct stm32_pinctrl *pctl; > struct pinctrl_pin_desc *pins; > - int i, ret, hwlock_id, banks = 0; > + int i, ret, hwlock_id; > + unsigned int banks; > > if (!np) > return -EINVAL; > @@ -1513,10 +1514,7 @@ int stm32_pctl_probe(struct platform_device *pdev) > return PTR_ERR(pctl->pctl_dev); > } > > - for_each_available_child_of_node(np, child) > - if (of_property_read_bool(child, "gpio-controller")) > - banks++; > - > + banks = gpiochip_count(dev); > if (!banks) { > dev_err(dev, "at least one GPIO bank is required\n"); > return -EINVAL; Reviewed-by: Fabien Dessenne