From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Inochi Amaoto <inochiama@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Rhys Tumelty <rhys@tumelty.co.uk>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-phy@lists.infradead.org, Yixun Lan <dlan@gentoo.org>,
Longbin Li <looong.bin@gmail.com>
Subject: Re: [PATCH v4 4/5] phy: core: Add managed phy bulk data helper functions
Date: Wed, 30 Sep 2026 11:29:01 +0300 [thread overview]
Message-ID: <arzITUCmgUp3uiRn@ashevche-desk.local> (raw)
In-Reply-To: <20260929085235.469515-5-inochiama@gmail.com>
On Tue, Sep 29, 2026 at 04:52:34PM +0800, Inochi Amaoto wrote:
> Add device managed variants of the phy bulk helper functions. So
> the driver can benefit from automatically managed phy handles.
...
> +int devm_of_phy_bulk_get_all(struct device *dev, struct device_node *np,
> + struct phy_bulk_data **phys)
> +{
> + struct phy_bulk_devres *devres;
> + int ret;
> + *phys = NULL;
Why?! In case of error we modify the output, this is usually not the best
approach as in most of the cases the expectation is that whatever user
provide (including a garbage) should be left untouched in case of an error.
> + if (!np)
> + return 0;
Same here. On top why do we even care about np like this? Interestingly that
some other APIs consider this as np == dev_of_node(dev) case, and automatically
propagate that.
> + devres = devres_alloc(devm_phy_bulk_release_all, sizeof(*devres),
> + GFP_KERNEL);
> + if (!devres)
> + return -ENOMEM;
> +
> + ret = of_phy_bulk_get_all(np, &devres->phys);
> + if (ret > 0) {
> + for (int i = 0; i < ret; i++)
> + phy_add_device_link(dev, devres->phys[i].phy);
> + *phys = devres->phys;
> + devres->num_phys = ret;
> + devres_add(dev, devres);
> + } else {
> + devres_free(devres);
> + }
> +
> + return ret;
> +}
...
> +static inline int devm_of_phy_bulk_get_all(struct device *dev,
> + struct device_node *np,
> + struct phy_bulk_data **phys)
> +{
> + if (phys)
> + *phys = NULL;
Same as per above.
> + return 0;
Why not an error? I do not see the _optional word in the function name.
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-09-30 8:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 8:52 [PATCH v4 0/5] phy: core: Add phy bulk helpers support Inochi Amaoto
2026-09-29 8:52 ` [PATCH v4 1/5] phy: core: Add common helper to add phy phandle device link Inochi Amaoto
2026-09-29 8:52 ` [PATCH v4 2/5] phy: core: Add common helper for get phy phandle by index Inochi Amaoto
2026-09-29 8:52 ` [PATCH v4 3/5] phy: core: Add phy bulk data helper functions Inochi Amaoto
2026-09-30 8:22 ` Andy Shevchenko
2026-09-30 8:59 ` Inochi Amaoto
2026-09-29 8:52 ` [PATCH v4 4/5] phy: core: Add managed " Inochi Amaoto
2026-09-30 8:29 ` Andy Shevchenko [this message]
2026-09-30 9:21 ` Inochi Amaoto
2026-09-30 9:23 ` Inochi Amaoto
2026-09-30 9:44 ` Andy Shevchenko
2026-09-29 8:52 ` [PATCH v4 5/5] doc: phy: Document some bulk " Inochi Amaoto
2026-09-30 8:30 ` 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=arzITUCmgUp3uiRn@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=dlan@gentoo.org \
--cc=inochiama@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=looong.bin@gmail.com \
--cc=mani@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rdunlap@infradead.org \
--cc=rhys@tumelty.co.uk \
--cc=skhan@linuxfoundation.org \
--cc=vkoul@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
all inboxes | Powered by JetHome®