From: Ioana Ciornei <ioana.ciornei@nxp.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"kishon@ti.com" <kishon@ti.com>,
"vkoul@kernel.org" <vkoul@kernel.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
Leo Li <leoyang.li@nxp.com>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"shawnguo@kernel.org" <shawnguo@kernel.org>,
Hongxing Zhu <hongxing.zhu@nxp.com>
Subject: Re: [PATCH net-next v3 7/8] dpaa2-mac: configure the SerDes phy on a protocol change
Date: Thu, 10 Mar 2022 15:57:10 +0000 [thread overview]
Message-ID: <20220310155709.xfbqjspok2duka3n@skbuf> (raw)
In-Reply-To: <YioTznpNwldCnJpm@shell.armlinux.org.uk>
On Thu, Mar 10, 2022 at 03:05:50PM +0000, Russell King (Oracle) wrote:
> On Thu, Mar 10, 2022 at 04:51:59PM +0200, Ioana Ciornei wrote:
> > This patch integrates the dpaa2-eth driver with the generic PHY
> > infrastructure in order to search, find and reconfigure the SerDes lanes
> > in case of a protocol change.
> >
> > On the .mac_config() callback, the phy_set_mode_ext() API is called so
> > that the Lynx 28G SerDes PHY driver can change the lane's configuration.
> > In the same phylink callback the MC firmware is called so that it
> > reconfigures the MAC side to run using the new protocol.
> >
> > The consumer drivers - dpaa2-eth and dpaa2-switch - are updated to call
> > the dpaa2_mac_start/stop functions newly added which will
> > power_on/power_off the associated SerDes lane.
> >
> > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
>
> Looks better, there's a minor thing that I missed, sorry:
>
> > + if (mac->features & DPAA2_MAC_FEATURE_PROTOCOL_CHANGE &&
> > + !phy_interface_mode_is_rgmii(mac->if_mode) &&
> > + is_of_node(dpmac_node)) {
> > + serdes_phy = of_phy_get(to_of_node(dpmac_node), NULL);
> > +
> > + if (IS_ERR(serdes_phy)) {
> > + if (PTR_ERR(serdes_phy) == -ENODEV)
> > + serdes_phy = NULL;
> > + else
> > + return PTR_ERR(serdes_phy);
> > + } else {
> > + phy_init(serdes_phy);
> > + }
>
> Would:
> if (PTR_ERR(serdes_phy) == -ENODEV)
> serdes_phy = NULL;
> else if (IS_ERR(serdes_phy))
> return PTR_ERR(serdes_phy);
> else
> phy_init(serdes_phy);
>
Yes, it wouldn't be an if inside another if statement.
> be neater? There is no need to check IS_ERR() before testing PTR_ERR().
> One may also prefer the pointer-comparison approach:
>
> if (serdes_phy == ERR_PTR(-ENODEV))
>
> to remove any question about PTR_ERR(p) on a !IS_ERR(p) value too, but
> it really doesn't make any difference.
>
> I suspect this is just a code formatting issue, I'd think the compiler
> would generate reasonable code either way, so as I said above, it's
> quite minor.
>
As you said, since it's quite minor I am going to wait to see if more
comments will appear, if not I am going to fix this up in another patch.
Thanks!
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2022-03-10 15:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 14:51 [PATCH net-next v3 0/8] dpaa2-mac: add support for changing the protocol at runtime Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 1/8] phy: add support for the Layerscape SerDes 28G Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl, lynx-28g" compatible Ioana Ciornei
2022-03-10 16:47 ` Krzysztof Kozlowski
2022-03-10 17:32 ` Ioana Ciornei
2022-03-10 21:19 ` Krzysztof Kozlowski
2022-03-10 17:58 ` Russell King (Oracle)
2022-03-10 19:06 ` Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 3/8] dpaa2-mac: add the MC API for retrieving the version Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 4/8] dpaa2-mac: add the MC API for reconfiguring the protocol Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 5/8] dpaa2-mac: retrieve API version and detect features Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 6/8] dpaa2-mac: move setting up supported_interfaces into a function Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 7/8] dpaa2-mac: configure the SerDes phy on a protocol change Ioana Ciornei
2022-03-10 15:05 ` Russell King (Oracle)
2022-03-10 15:57 ` Ioana Ciornei [this message]
2022-03-10 14:52 ` [PATCH net-next v3 8/8] arch: arm64: dts: lx2160a: describe the SerDes block #1 Ioana Ciornei
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=20220310155709.xfbqjspok2duka3n@skbuf \
--to=ioana.ciornei@nxp.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=hongxing.zhu@nxp.com \
--cc=kishon@ti.com \
--cc=kuba@kernel.org \
--cc=leoyang.li@nxp.com \
--cc=linux-phy@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=shawnguo@kernel.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