From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Jules Maselbas <jmaselbas@kalray.eu>, linux-usb@vger.kernel.org
Cc: Minas Harutyunyan <hminas@synopsys.com>,
Kishon Vijay Abraham I <kishon@ti.com>,
Amelie DELAUNAY <amelie.delaunay@foss.st.com>,
Yann Sionneau <ysionneau@kalray.eu>,
Michael Grzeschik <mgr@pengutronix.de>,
Randy Dunlap <rdunlap@infradead.org>,
Arnd Bergmann <arnd@arndb.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>
Subject: Re: [PATCH v2 3/3] phy: core: Warn when phy_power_on is called before phy_init
Date: Wed, 23 Mar 2022 12:13:42 +0100 [thread overview]
Message-ID: <1dba9024-6c48-03da-5d1e-70c05a87c4a8@pengutronix.de> (raw)
In-Reply-To: <20220323110708.8254-4-jmaselbas@kalray.eu>
Hello Jules,
On 23.03.22 12:07, Jules Maselbas wrote:
> A warning when the order of phy operation is mixed up by drivers,
> this is an atempt to make the phy usage more uniform across (usb)
> drivers.
Thanks for picking up this suggestion.
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Cc: Amelie DELAUNAY <amelie.delaunay@foss.st.com>
> Cc: Minas Harutyunyan <hminas@synopsys.com>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> change in v2:
> - no changes
>
> drivers/phy/phy-core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index cbdad65d2caa..0cb4da62577e 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -252,6 +252,9 @@ int phy_init(struct phy *phy)
> return ret;
> ret = 0; /* Override possible ret == -ENOTSUPP */
>
> + if (phy->power_count > phy->init_count)
This needs to be moved into the critical section below.
> + dev_warn(&phy->dev, "phy_power_on was called before phy_init\n");
I am wondering how often would this be triggered for e.g. a PHY that's being
runtime suspended. But the warning being obnoxious is the point of the patch,
so perhaps it's ok to not make it into a dev_warn_once.
> +
> mutex_lock(&phy->mutex);
> if (phy->init_count == 0 && phy->ops->init) {
> ret = phy->ops->init(phy);
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2022-03-23 11:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 11:07 [PATCH v2 0/3] Cleanup the call ordering of phy_init and phy_power_on Jules Maselbas
2022-03-23 11:07 ` [PATCH v2 1/3] phy: core: Add documentation of phy operation order Jules Maselbas
2022-03-23 11:07 ` [PATCH v2 2/3] phy: core: Update documentation syntax Jules Maselbas
2022-03-23 11:07 ` [PATCH v2 3/3] phy: core: Warn when phy_power_on is called before phy_init Jules Maselbas
2022-03-23 11:13 ` Ahmad Fatoum [this message]
2022-03-23 11:21 ` Jules Maselbas
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=1dba9024-6c48-03da-5d1e-70c05a87c4a8@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=amelie.delaunay@foss.st.com \
--cc=arnd@arndb.de \
--cc=hminas@synopsys.com \
--cc=jmaselbas@kalray.eu \
--cc=kernel@pengutronix.de \
--cc=kishon@ti.com \
--cc=linux-usb@vger.kernel.org \
--cc=mgr@pengutronix.de \
--cc=rdunlap@infradead.org \
--cc=ysionneau@kalray.eu \
/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).