From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH] gpiolib: devres: shrink devm_gpiochip_add_data_with_key()
Date: Wed, 11 Nov 2020 17:05:31 +0200 [thread overview]
Message-ID: <CAHp75VdoptjHM8aSiiQ7BHpYE0Zf2-Ojy55H5hTv4c_68cS1vg@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VeRvO-PpNpcQHKXBRdWQqavfvQwqai2gRys+FbhBuVy4Q@mail.gmail.com>
On Wed, Nov 11, 2020 at 5:02 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Tue, Nov 10, 2020 at 11:42 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > If all we want to manage is a single pointer, there's no need to
> > manually allocate and add a new devres. We can simply use
> > devm_add_action_or_reset() and shrink the code by a good bit.
>
> Yes, it is possible to convert all one-function-based devm_*()
> wrappers to use this approach.
>
> The problem is, it will call the release() function on error which is
> new (and probably undesired) behaviour.
> I suppose you meant devm_add_action() here.
Ah, now it seems I got it. You need to release the chip in case if
devm_add_action() fail.
Dunno if devm_add_action() can somehow change the logic to be clearer here...
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-11-11 15:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 9:39 [PATCH] gpiolib: devres: shrink devm_gpiochip_add_data_with_key() Bartosz Golaszewski
2020-11-11 14:56 ` Linus Walleij
2020-11-11 15:02 ` Andy Shevchenko
2020-11-11 15:05 ` Andy Shevchenko [this message]
2020-11-12 8:58 ` Bartosz Golaszewski
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=CAHp75VdoptjHM8aSiiQ7BHpYE0Zf2-Ojy55H5hTv4c_68cS1vg@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).