From: Dan Carpenter <dan.carpenter@linaro.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH] pinctrl: renesas: rzn1: Use for_each_child_of_node_scoped()
Date: Fri, 31 May 2024 12:18:19 +0300 [thread overview]
Message-ID: <731a2a4e-936c-4aa6-8c2c-e0605c7380fa@moroto.mountain> (raw)
In-Reply-To: <CAHp75VdZXs-XCOZaG48dsLEVNsUKiL0rhtf56dnqJKycDMByuQ@mail.gmail.com>
On Fri, May 31, 2024 at 11:19:26AM +0300, Andy Shevchenko wrote:
> On Fri, May 31, 2024 at 11:01 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> > On Thu, May 30, 2024 at 04:36:59PM +0300, Andy Shevchenko wrote:
> > > On Thu, May 30, 2024 at 2:52 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > On Thu, May 30, 2024 at 11:26 AM Andy Shevchenko
> > > > <andy.shevchenko@gmail.com> wrote:
> > > > > Thu, May 30, 2024 at 11:19:29AM +0200, Geert Uytterhoeven kirjoitti:
> > > > > > Use the scoped variant of for_each_child_of_node() to simplify the code.
> > > > >
> > > > > I do not see the point of this patch. This makes code actually more
> > > > > complicated, and I'm not sure the code generation is the same and not worse.
> > > >
> > > > On arm32, a conversion to for_each_child_of_node_scoped() seems to
> > > > cost ca. 48 bytes of additional code.
> > > >
> > > > BTW, the same is true for cases where the conversion does simplify
> > > > cleanup.
> > > >
> > > > I checked "pinctrl: renesas: Use scope based of_node_put() cleanups",
> > > > and all but the conversions in *_dt_node_to_map() cost 48 bytes each.
> > >
> > > Yeah. so for the cases where there are no returns from inside the loop
> > > I prefer not to use _scoped.
> >
> > Eventually _scoped() loops will become the norm. Leaving some unscoped
> > loops will be a fun surprise for the first person to introduce a return
> > -EINVAL.
>
> It makes no sense when we have no return / goto semantics from inside
> of the loop. I don't know why we should do worse binary code for no
> benefit.
The compiler ought to be able to determine when the cleanup function is
not required and save those 48 bytes. That's why we have NULL checking
in __free_device_node() instead of using the NULL check in of_node_put().
The compiler is already removing all the calls from the return
statements where p is NULL. It seems like a small thing to one step
further and delete the cleanup when it's not called on any path?
regards,
dan carpenter
next prev parent reply other threads:[~2024-05-31 9:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 9:19 [PATCH] pinctrl: renesas: rzn1: Use for_each_child_of_node_scoped() Geert Uytterhoeven
2024-05-30 9:26 ` Andy Shevchenko
2024-05-30 11:52 ` Geert Uytterhoeven
2024-05-30 13:36 ` Andy Shevchenko
2024-05-31 8:01 ` Dan Carpenter
2024-05-31 8:19 ` Andy Shevchenko
2024-05-31 9:18 ` Dan Carpenter [this message]
2024-06-07 12:08 ` Geert Uytterhoeven
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=731a2a4e-936c-4aa6-8c2c-e0605c7380fa@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=andy.shevchenko@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-renesas-soc@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