diff mbox series

[v5,1/2] net: phylink: add mac_managed_pm in phylink_config structure

Message ID 20221013133904.978802-2-shenwei.wang@nxp.com (mailing list archive)
State New, archived
Headers show
Series net: phylink: add phylink_set_mac_pm() helper | expand

Commit Message

Shenwei Wang Oct. 13, 2022, 1:39 p.m. UTC
The recent commit

'commit 47ac7b2f6a1f ("net: phy: Warn about incorrect
mdio_bus_phy_resume() state")'

requires the MAC driver explicitly tell the phy driver who is
managing the PM, otherwise you will see warning during resume
stage.

Add a boolean property in the phylink_config structure so that
the MAC driver can use it to tell the PHY driver if it wants to
manage the PM.

'Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect
mdio_bus_phy_resume() state")'

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 3 +++
 include/linux/phylink.h   | 2 ++
 2 files changed, 5 insertions(+)

--
2.34.1

Comments

Florian Fainelli Oct. 13, 2022, 6:47 p.m. UTC | #1
On 10/13/22 06:39, Shenwei Wang wrote:
> The recent commit
> 
> 'commit 47ac7b2f6a1f ("net: phy: Warn about incorrect
> mdio_bus_phy_resume() state")'
> 
> requires the MAC driver explicitly tell the phy driver who is
> managing the PM, otherwise you will see warning during resume
> stage.
> 
> Add a boolean property in the phylink_config structure so that
> the MAC driver can use it to tell the PHY driver if it wants to
> manage the PM.
> 
> 'Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect
> mdio_bus_phy_resume() state")'

This is not the way to provide a Fixse tag, it should simply be:

Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect 
mdio_bus_phy_resume() state"

With that fixed:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

as a courtesy, you could CC the author of the patch you are fixing BTW
Shenwei Wang Oct. 13, 2022, 7:28 p.m. UTC | #2
> -----Original Message-----
> From: Florian Fainelli <f.fainelli@gmail.com>
> Sent: Thursday, October 13, 2022 1:48 PM
> On 10/13/22 06:39, Shenwei Wang wrote:
> > The recent commit
> >
> > 'commit 47ac7b2f6a1f ("net: phy: Warn about incorrect
> > mdio_bus_phy_resume() state")'
> >
> > requires the MAC driver explicitly tell the phy driver who is managing
> > the PM, otherwise you will see warning during resume stage.
> >
> > Add a boolean property in the phylink_config structure so that the MAC
> > driver can use it to tell the PHY driver if it wants to manage the PM.
> >
> > 'Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect
> > mdio_bus_phy_resume() state")'
> 
> This is not the way to provide a Fixse tag, it should simply be:
> 
> Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect
> mdio_bus_phy_resume() state"
> 

That was my original format. But it met the following warning when ran checkpatch.pl script:

./scripts/checkpatch.pl 0001-net-phylink-add-mac_managed_pm-in-phylink_config-str.patch 
WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: e6a39ffcfe22 ("net: stmmac: Enable mac_managed_pm phylink config")'
#20: 
Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect

That's why I changed to the current tag format.

Regards,
Shenwei

> With that fixed:
> 
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> as a courtesy, you could CC the author of the patch you are fixing BTW
> --
> Florian
Shenwei Wang Oct. 14, 2022, 2:35 p.m. UTC | #3
RESEND because some recipients' mail address were somehow corrupted.

> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Thursday, October 13, 2022 6:12 PM
> To: Shenwei Wang <shenwei.wang@nxp.com> On Thu, 13 Oct 2022 19:28:45 
> +0000 Shenwei Wang wrote:
> > > Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect
> > > mdio_bus_phy_resume() state"
> > >
> >
> > That was my original format. But it met the following warning when 
> > ran
> checkpatch.pl script:
> >
> > ./scripts/checkpatch.pl
> > 0001-net-phylink-add-mac_managed_pm-in-phylink_config-str.patch
> > WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> 
> > ("<title
> line>")' - ie: 'Fixes: e6a39ffcfe22 ("net: stmmac: Enable 
> line>mac_managed_pm
> phylink config")'
> > #20:
> > Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect
> >
> > That's why I changed to the current tag format.
> 
> It needs to be all on one line:
> 
> Fixes: 47ac7b2f6a1f ("net: phy: Warn about incorrect 
> mdio_bus_phy_resume()
> state")
> 

En, that's the tricky.  Seems the rule of size limit is not applied for this use case.

> But I don't see 47ac7b2f6a1f in my trees, are you sure that's the 
> upstream commit id?

Just had a check again, and commit id on the upstream changed to 

commit 744d23c71af39c7dc77ac7c3cac87ae86a181a85 upstream

Will post a new patches to fix the tag.

Thanks,
Shenwei
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 75464df191ef..6547b6cc6cbe 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1661,6 +1661,9 @@  static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
 	if (phy_interrupt_is_valid(phy))
 		phy_request_interrupt(phy);

+	if (pl->config->mac_managed_pm)
+		phy->mac_managed_pm = true;
+
 	return 0;
 }

diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 664dd409feb9..3f01ac8017e0 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -122,6 +122,7 @@  enum phylink_op_type {
  *	(See commit 7cceb599d15d ("net: phylink: avoid mac_config calls")
  * @poll_fixed_state: if true, starts link_poll,
  *		      if MAC link is at %MLO_AN_FIXED mode.
+ * @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM.
  * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
  * @get_fixed_state: callback to execute to determine the fixed link state,
  *		     if MAC link is at %MLO_AN_FIXED mode.
@@ -134,6 +135,7 @@  struct phylink_config {
 	enum phylink_op_type type;
 	bool legacy_pre_march2020;
 	bool poll_fixed_state;
+	bool mac_managed_pm;
 	bool ovr_an_inband;
 	void (*get_fixed_state)(struct phylink_config *config,
 				struct phylink_link_state *state);