From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Linus Walleij" <linus.walleij@linaro.org>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>
Cc: "Bartosz Golaszewski" <brgl@bgdev.pl>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
<linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v2] gpio: nomadik: Back out some managed resources
Date: Wed, 06 Mar 2024 16:13:41 +0100 [thread overview]
Message-ID: <CZMRJNWD7F6W.23A8YUXQ6P7H7@bootlin.com> (raw)
In-Reply-To: <CACRpkdZCXE6VBa3f7asSNYF7Esn5nHnxf0QJfibT7TcfSE52FQ@mail.gmail.com>
Hello,
On Wed Mar 6, 2024 at 1:51 PM CET, Linus Walleij wrote:
> On Wed, Mar 6, 2024 at 12:20 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Wed, Mar 6, 2024 at 12:09 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> > >
> > > Several commits introduce managed resources (devm_*) into the
> > > nmk_gpio_populate_chip() function.
> > >
> > > This isn't always working because when called from the Nomadik pin
> > > control driver we just want to populate some states for the device as
> > > the same states are used by the pin control driver.
> > >
> > > Some managed resources such as devm_kzalloc() etc will work, as the
> > > passed in platform device will be used for lifecycle management,
> > > but in some cases where we used the looked-up platform device
> > > for the GPIO block, this will cause problems for the combined
> > > pin control and GPIO driver, because it adds managed resources
> > > to the GPIO device before it is probed, which is something that
> > > the device core will not accept, and all of the GPIO blocks will
> > > refuse to probe:
> > >
> > > platform 8012e000.gpio: Resources present before probing
> > > platform 8012e080.gpio: Resources present before probing
> > > (...)
> > >
> > > Fix this by not tying any managed resources to the looked-up
> > > gpio_pdev/gpio_dev device, let's just live with the fact that
> > > these need imperative resource management for now.
> > >
> > > Drop in some notes and use a local *dev variable to clarify the
> > > code.
> >
> > LGTM, some minor remarks below.
> >
> > ...
> >
> > > Cc: Théo Lebrun <theo.lebrun@bootlin.com>
> >
> > Note, you can put Cc:s after --- line and it won't go to the commit
> > message while Cc to the respective people.
>
> Yeah old habit, actually b4 handles it fine by recording the
> recipients only in the cover letter.
>
> > > + dev_dbg(dev, "populate: using default ngpio (%d)\n", ngpio);
> >
> > While at it %d --> %u.
> (...)
> > > + dev_err(dev, "failed getting reset control: %ld\n",
> > > PTR_ERR(reset));
> >
> > Also possible %pe.
>
> Fixed them both when applying! Thanks!
Format specifier %pe takes a pointer, ie it should be reset and not
PTR_ERR(reset). See efaa90ed2cff ("gpio: nomadik: Back out some managed
resources") on linux-pinctrl/ib-nomadik-gpio.
Apart from that, tested efaa90ed2cff on Mobileye hardware.
GCC warning:
In file included from ./include/linux/device.h:15,
from ./include/linux/platform_device.h:13,
from drivers/gpio/gpio-nomadik.c:28:
drivers/gpio/gpio-nomadik.c: In function ‘nmk_gpio_populate_chip’:
drivers/gpio/gpio-nomadik.c:588:30: warning: format ‘%p’ expects argument of type ‘void *’, but argument 3 has type ‘long int’ [-Wformat=]
588 | dev_err(dev, "failed getting reset control: %pe\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:110:30: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
./include/linux/dev_printk.h:144:56: note: in expansion of macro ‘dev_fmt’
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/gpio/gpio-nomadik.c:588:17: note: in expansion of macro ‘dev_err’
588 | dev_err(dev, "failed getting reset control: %pe\n",
| ^~~~~~~
drivers/gpio/gpio-nomadik.c:588:62: note: format string is defined here
588 | dev_err(dev, "failed getting reset control: %pe\n",
| ~^
| |
| void *
| %ld
Regards,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-03-06 15:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 22:09 [PATCH v2] gpio: nomadik: Back out some managed resources Linus Walleij
2024-03-06 11:19 ` Andy Shevchenko
2024-03-06 12:51 ` Linus Walleij
2024-03-06 15:13 ` Théo Lebrun [this message]
2024-03-06 19:46 ` Linus Walleij
2024-03-06 16:17 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CZMRJNWD7F6W.23A8YUXQ6P7H7@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).