From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Zijun Hu <zijun_hu@icloud.com>
Cc: Danilo Krummrich <dakr@kernel.org>,
Dave Ertman <david.m.ertman@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Leon Romanovsky <leon@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org,
Zijun Hu <zijun.hu@oss.qualcomm.com>
Subject: Re: [PATCH v2] driver core: auxiliary bus: Optimize logic of auxiliary_match_id()
Date: Sat, 6 Sep 2025 19:55:55 +0200 [thread overview]
Message-ID: <2025090630-desecrate-ensnare-ce9b@gregkh> (raw)
In-Reply-To: <2159c5bf-1ce3-4fd7-81e3-f458efca8548@icloud.com>
On Thu, Sep 04, 2025 at 07:00:37AM +0800, Zijun Hu wrote:
> On 2025/9/3 19:46, Danilo Krummrich wrote:
> >> static const struct auxiliary_device_id *auxiliary_match_id(const struct auxiliary_device_id *id,
> >> const struct auxiliary_device *auxdev)
> >> {
> >> - for (; id->name[0]; id++) {
> >> - const char *p = strrchr(dev_name(&auxdev->dev), '.');
> >> - int match_size;
> >> + const char *auxdev_name = dev_name(&auxdev->dev);
> > I feel like this is a bit too ambitious. Using dev_name() directly for the calls
> > below seems more obvious to me.
> >
>
> dev_name(&auxdev->dev) which is a inline function appears 3 times in the
> for loop. may be worthy of a new variable
>
>
> > Yes, dev_name() contains a branch, but I'm pretty sure the compiler optimizes
> > them away for subsequent calls anyways.
>
> >From debugging perspective:
> more difficult to debug if more the compiler optimizes.
You aren't debugging stuff like this :)
Anyway, I've taken this, as it is a nice tiny cleanup, thanks.
greg k-h
prev parent reply other threads:[~2025-09-06 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 11:37 Zijun Hu
2025-09-03 11:46 ` Danilo Krummrich
2025-09-03 23:00 ` Zijun Hu
2025-09-06 17:55 ` Greg Kroah-Hartman [this message]
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=2025090630-desecrate-ensnare-ce9b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dakr@kernel.org \
--cc=david.m.ertman@intel.com \
--cc=ira.weiny@intel.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=zijun.hu@oss.qualcomm.com \
--cc=zijun_hu@icloud.com \
/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
all inboxes | Powered by JetHome®