Message ID | 20230226205357.1013504-1-dario.binacchi@amarulasolutions.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2106345wrd; Sun, 26 Feb 2023 13:30:34 -0800 (PST) X-Google-Smtp-Source: AK7set/G+7D/EF1W2xKendnUa/kAmTajgiyuE77WvHLzHj4roW8gmF45E+J2YEfN0/BdJxFrLbtD X-Received: by 2002:a05:6402:274c:b0:4af:81f1:5b02 with SMTP id z12-20020a056402274c00b004af81f15b02mr10261819edd.2.1677447034791; Sun, 26 Feb 2023 13:30:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677447034; cv=none; d=google.com; s=arc-20160816; b=NOvdwB6PQUaoGTCMai9jfXlrVw3VxSOi4/gS190YeQ70e9kQ9kbpW3xVHUsht9Y8RT 7I4sOXHVZWzuFiU9yiHzmE2OdChL2a3umlDoBsklXpnp3IX5uHpAp5Yccpi0cmY7aGFk 7vpzh6ThnJIyTt4qx0ilgCphXrAkIG3ywnL4BJjmysbq1FDsrRYD57t0Ch7l59PNQ08R zSpI+qLGXzbJc5sw6OgYR0qgkT7umnrvrYX8Ynwo0lKbGg2Fk0VzqdUySf6fNBzQ7iW/ sWRl7OrUEJyy+qJOVpdUxx/xacy2Gd4e5dGpvvU6gci7XE0oVwsHiFQktuR6rfNNpVS0 YacA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0xCc6hdBBOY36yrfSA2b2U559vub69VWaEmSIo4wJJw=; b=mFroe3Wo0wJLonPZtUjc2pUIxWNRef3f1OGHBoC8OV5k0ucrDNwIw1vc6Kj7+NxJQj 2WYyNn6nxDrxGGuY1h06+0C26iDgFHxnfwGh4BL92WA3RHhsOE4oj22J8yDbqUIIFEco 6z+6Ua93/VVOFp+lV43kaKfE7znnbaKyL9BbZenfGUzNMaUThVPlDG7Ira1GxfP3QGiz gNDaf7sQpAP9B+5GP2W3WPQP/Q4a89MYnQXJPB3cQR9pK9cWZGhk+f0WcBWe5mHSrJAF fk1frX+RreSPwx1+kBGxDBltjdpauiOLo7pt1gnoc5rVG6VUSv8pfUqtwCaQ4VVtDLKx 3dKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SMeeXl1u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020aa7c1c8000000b004ad7ac04a59si6585163edp.389.2023.02.26.13.30.03; Sun, 26 Feb 2023 13:30:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SMeeXl1u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbjBZUyF (ORCPT <rfc822;tertiaryakionsight@gmail.com> + 99 others); Sun, 26 Feb 2023 15:54:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjBZUyD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 26 Feb 2023 15:54:03 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4B4E10AB1 for <linux-kernel@vger.kernel.org>; Sun, 26 Feb 2023 12:54:02 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id i34so18025031eda.7 for <linux-kernel@vger.kernel.org>; Sun, 26 Feb 2023 12:54:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0xCc6hdBBOY36yrfSA2b2U559vub69VWaEmSIo4wJJw=; b=SMeeXl1uXWvpcsnn6+YTJTplSH7r1sn5v0jQLPV0uuM6eZ8NSBeUCPJct+UDIbDfhE hUz9whtZe9H0GWdqkRZmx2lLO80M2ZWam06soXPbvfqNEAKu3NZ7Lf8a/HzlWeqUXFoc PTUqnprv3G8kpA+6PG+qBflVBseS6XsKp6Yg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0xCc6hdBBOY36yrfSA2b2U559vub69VWaEmSIo4wJJw=; b=zqQ8cUmdOURY8L/n1xjjH5Tn7227BjzJOkomqKn9dp+2OXeXuUay0H9nB/XOu6AnRc vTz/JwDthrhP9LTLtsKFT1JPRqSK1TV1vzNJFK2atQ5YY1lsuncbMfp/OPo1OP+HlpgT jb0e1c9wejzD7Yj4OIZxxQntuULA9/5+hINmWYMyPrlS/C0tYWmtlsGZCOgAOx+x33lc lZU+oLR97EB1T8ae5Tw0GI+2/7AJ+Y+kBV0/YXuPOu/Lb1N+U4eexYVPiGJzWfQeLdC5 9yMalUb6qtfeuCMGT8Siz8846arPWZkTyXpndobLh2TJaRWpSFLSiePPztco1dUpw/tl CVOQ== X-Gm-Message-State: AO0yUKVlUYNyCpBSd6jWwnttRSRZAoi+lJF+TSwabvVV+sHaMnhW6hIR rC03/EagAQIbD8bdTPeUH35Nn4a7RSOInTKy+zA= X-Received: by 2002:a17:906:9991:b0:8b1:7eb1:590e with SMTP id af17-20020a170906999100b008b17eb1590emr32173637ejc.20.1677444841214; Sun, 26 Feb 2023 12:54:01 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-56-22-12.retail.telecomitalia.it. [82.56.22.12]) by smtp.gmail.com with ESMTPSA id lz15-20020a170906fb0f00b008dffda52d71sm2320013ejb.124.2023.02.26.12.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 12:54:00 -0800 (PST) From: Dario Binacchi <dario.binacchi@amarulasolutions.com> To: linux-kernel@vger.kernel.org Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>, Bartosz Golaszewski <brgl@bgdev.pl>, Fabio Estevam <festevam@gmail.com>, Linus Walleij <linus.walleij@linaro.org>, NXP Linux Team <linux-imx@nxp.com>, Pengutronix Kernel Team <kernel@pengutronix.de>, Sascha Hauer <s.hauer@pengutronix.de>, Shawn Guo <shawnguo@kernel.org>, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Subject: [PATCH] gpio: mxs: use dynamic allocation of base Date: Sun, 26 Feb 2023 21:53:57 +0100 Message-Id: <20230226205357.1013504-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758930701910975198?= X-GMAIL-MSGID: =?utf-8?q?1758930701910975198?= |
Series |
gpio: mxs: use dynamic allocation of base
|
|
Commit Message
Dario Binacchi
Feb. 26, 2023, 8:53 p.m. UTC
Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static
gpiobase allocation"), one or more warnings are printed during boot on
systems where static allocation of GPIO base is used:
[ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
So let's follow the suggestion and use dynamic allocation.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
drivers/gpio/gpio-mxs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Dario, Am 26.02.23 um 21:53 schrieb Dario Binacchi: > Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static > gpiobase allocation"), one or more warnings are printed during boot on > systems where static allocation of GPIO base is used: > > [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation. > [ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation. > [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation. > [ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation. > [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation. > > So let's follow the suggestion and use dynamic allocation. i understand the motivation of avoiding these warnings. AFAIK the MXS platform is older than the dynamic allocation of GPIO base. In the perfect world all applications has been migrated to libgpiod / chardev GPIO. But i'm really concerned this hasn't happend yet, at least for this platform. So i believe this change break applications, since it affects userspace. Best regards > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > --- > > drivers/gpio/gpio-mxs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c > index 7f59e5d936c2..b48a7c1fb7c1 100644 > --- a/drivers/gpio/gpio-mxs.c > +++ b/drivers/gpio/gpio-mxs.c > @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev) > > port->gc.to_irq = mxs_gpio_to_irq; > port->gc.get_direction = mxs_gpio_get_direction; > - port->gc.base = port->id * 32; > + port->gc.base = -1; > > err = gpiochip_add_data(&port->gc, port); > if (err)
Hi Stefan, On Mon, Feb 27, 2023 at 6:52 PM Stefan Wahren <stefan.wahren@i2se.com> wrote: > > Hi Dario, > > Am 26.02.23 um 21:53 schrieb Dario Binacchi: > > Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static > > gpiobase allocation"), one or more warnings are printed during boot on > > systems where static allocation of GPIO base is used: > > > > [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation. > > [ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation. > > [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation. > > [ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation. > > [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation. > > > > So let's follow the suggestion and use dynamic allocation. > > i understand the motivation of avoiding these warnings. > > AFAIK the MXS platform is older than the dynamic allocation of GPIO > base. In the perfect world all applications has been migrated to > libgpiod / chardev GPIO. But i'm really concerned this hasn't happend > yet, at least for this platform. So i believe this change break > applications, since it affects userspace. Thanks for your explanations. Do you think it makes sense to use a Kconfig option to enable/disable the dynamic allocation of GPIO base? As done, if I'm not mistaken, in commit 80d34260f36c6 ("pinctrl: renesas: gpio: Use dynamic GPIO base if no function GPIOs")? With legacy support enabled by default, but the ability to try out the latest dynamic allocation functionality. Thanks and regards, Dario > > Best regards > > > > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > > --- > > > > drivers/gpio/gpio-mxs.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c > > index 7f59e5d936c2..b48a7c1fb7c1 100644 > > --- a/drivers/gpio/gpio-mxs.c > > +++ b/drivers/gpio/gpio-mxs.c > > @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev) > > > > port->gc.to_irq = mxs_gpio_to_irq; > > port->gc.get_direction = mxs_gpio_get_direction; > > - port->gc.base = port->id * 32; > > + port->gc.base = -1; > > > > err = gpiochip_add_data(&port->gc, port); > > if (err)
Hi Dario, On 23-02-28, Dario Binacchi wrote: > Hi Stefan, > > On Mon, Feb 27, 2023 at 6:52 PM Stefan Wahren <stefan.wahren@i2se.com> wrote: > > > > Hi Dario, > > > > Am 26.02.23 um 21:53 schrieb Dario Binacchi: > > > Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static > > > gpiobase allocation"), one or more warnings are printed during boot on > > > systems where static allocation of GPIO base is used: > > > > > > [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation. > > > [ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation. > > > [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation. > > > [ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation. > > > [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation. > > > > > > So let's follow the suggestion and use dynamic allocation. > > > > i understand the motivation of avoiding these warnings. > > > > AFAIK the MXS platform is older than the dynamic allocation of GPIO > > base. In the perfect world all applications has been migrated to > > libgpiod / chardev GPIO. But i'm really concerned this hasn't happend > > yet, at least for this platform. So i believe this change break > > applications, since it affects userspace. > > Thanks for your explanations. There was also a lengthly discussion here: https://lore.kernel.org/all/20230120104647.nwki4silrtd7bt3w@pengutronix.de/ > Do you think it makes sense to use a Kconfig option to enable/disable > the dynamic allocation of GPIO base? What we could do is to check the GPIO_SYSFS kconfig symbol. If this is enabled we should keep the current behaviour to not break the uAPI else we can go with the dynamic numbering. What we should avoid is a new Kconfig symbol. Regards, Marco > As done, if I'm not mistaken, in commit 80d34260f36c6 ("pinctrl: > renesas: gpio: Use dynamic GPIO base if no function GPIOs")? > With legacy support enabled by default, but the ability to try out the > latest dynamic allocation functionality. > > Thanks and regards, > Dario > > > > > Best regards > > > > > > > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > > > --- > > > > > > drivers/gpio/gpio-mxs.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c > > > index 7f59e5d936c2..b48a7c1fb7c1 100644 > > > --- a/drivers/gpio/gpio-mxs.c > > > +++ b/drivers/gpio/gpio-mxs.c > > > @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev) > > > > > > port->gc.to_irq = mxs_gpio_to_irq; > > > port->gc.get_direction = mxs_gpio_get_direction; > > > - port->gc.base = port->id * 32; > > > + port->gc.base = -1; > > > > > > err = gpiochip_add_data(&port->gc, port); > > > if (err) > > > > -- > > Dario Binacchi > > Senior Embedded Linux Developer > > dario.binacchi@amarulasolutions.com > > __________________________________ > > > Amarula Solutions SRL > > Via Le Canevare 30, 31100 Treviso, Veneto, IT > > T. +39 042 243 5310 > info@amarulasolutions.com > > www.amarulasolutions.com > >
Hi everyone, Am Dienstag, 28. Februar 2023, 09:46:27 CET schrieb Marco Felsch: > Hi Dario, > > On 23-02-28, Dario Binacchi wrote: > > Hi Stefan, > > > > On Mon, Feb 27, 2023 at 6:52 PM Stefan Wahren <stefan.wahren@i2se.com> wrote: > > > Hi Dario, > > > > > > Am 26.02.23 um 21:53 schrieb Dario Binacchi: > > > > Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using > > > > static > > > > gpiobase allocation"), one or more warnings are printed during boot on > > > > systems where static allocation of GPIO base is used: > > > > > > > > [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is > > > > deprecated, use dynamic allocation. [ 0.142753] gpio gpiochip1: > > > > Static allocation of GPIO base is deprecated, use dynamic allocation. > > > > [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is > > > > deprecated, use dynamic allocation. [ 0.154341] gpio gpiochip3: > > > > Static allocation of GPIO base is deprecated, use dynamic allocation. > > > > [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is > > > > deprecated, use dynamic allocation. > > > > > > > > So let's follow the suggestion and use dynamic allocation. > > > > > > i understand the motivation of avoiding these warnings. > > > > > > AFAIK the MXS platform is older than the dynamic allocation of GPIO > > > base. In the perfect world all applications has been migrated to > > > libgpiod / chardev GPIO. But i'm really concerned this hasn't happend > > > yet, at least for this platform. So i believe this change break > > > applications, since it affects userspace. > > > > Thanks for your explanations. > > There was also a lengthly discussion here: > > https://lore.kernel.org/all/20230120104647.nwki4silrtd7bt3w@pengutronix.de/ > > > Do you think it makes sense to use a Kconfig option to enable/disable > > the dynamic allocation of GPIO base? > > What we could do is to check the GPIO_SYSFS kconfig symbol. If this is > enabled we should keep the current behaviour to not break the uAPI else > we can go with the dynamic numbering. What we should avoid is a new > Kconfig symbol. Even that is only half of the truth. Apparently this is crucial for GPIO_SYSFS, but even without sysfs it affects the order of the character devices, which might break userspace. The main open issue is, whether GPIO aliases shall be supported or not, see see [1] and [2]. Once this is clear, the switch to dynamic base can be done. Best regards, Alexander [1] https://lore.kernel.org/linux-gpio/20230215092421.143199-1-alexander.stein@ew.tq-group.com/T/#u [2] https://lore.kernel.org/linux-gpio/5941337.lOV4Wx5bFT@steina-w/T/ #m2a74777fc4031b7f6f30ac1dcf65b20e7d3f8f12 > Regards, > Marco > > > As done, if I'm not mistaken, in commit 80d34260f36c6 ("pinctrl: > > renesas: gpio: Use dynamic GPIO base if no function GPIOs")? > > With legacy support enabled by default, but the ability to try out the > > latest dynamic allocation functionality. > > > > Thanks and regards, > > Dario > > > > > Best regards > > > > > > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > > > > --- > > > > > > > > drivers/gpio/gpio-mxs.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c > > > > index 7f59e5d936c2..b48a7c1fb7c1 100644 > > > > --- a/drivers/gpio/gpio-mxs.c > > > > +++ b/drivers/gpio/gpio-mxs.c > > > > @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device > > > > *pdev) > > > > > > > > port->gc.to_irq = mxs_gpio_to_irq; > > > > port->gc.get_direction = mxs_gpio_get_direction; > > > > > > > > - port->gc.base = port->id * 32; > > > > + port->gc.base = -1; > > > > > > > > err = gpiochip_add_data(&port->gc, port); > > > > if (err)
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c index 7f59e5d936c2..b48a7c1fb7c1 100644 --- a/drivers/gpio/gpio-mxs.c +++ b/drivers/gpio/gpio-mxs.c @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev) port->gc.to_irq = mxs_gpio_to_irq; port->gc.get_direction = mxs_gpio_get_direction; - port->gc.base = port->id * 32; + port->gc.base = -1; err = gpiochip_add_data(&port->gc, port); if (err)