netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Steen Hegelund <steen.hegelund@microchip.com>,
	Vinod Koul <vkoul@kernel.org>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Lars Povlsen <lars.povlsen@microchip.com>,
	Bjarni Jonasson <bjarni.jonasson@microchip.com>,
	Microchip UNG Driver List <UNGLinuxDriver@microchip.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH v15 2/4] phy: Add media type and speed serdes configuration interfaces
Date: Tue, 23 Feb 2021 15:53:34 +0200	[thread overview]
Message-ID: <YDUI3rYnNxhxiZem@unreal> (raw)
In-Reply-To: <c1b78a32-de24-c036-5a7a-7ef297cc5e3a@ti.com>

On Tue, Feb 23, 2021 at 05:52:14PM +0530, Kishon Vijay Abraham I wrote:
> Hi Leon,
>
> On 22/02/21 1:30 pm, Steen Hegelund wrote:
> > Hi Leon,
> >
> > On Sun, 2021-02-21 at 07:59 +0200, Leon Romanovsky wrote:
> >> EXTERNAL EMAIL: Do not click links or open attachments unless you
> >> know the content is safe
> >>
> >> On Thu, Feb 18, 2021 at 05:14:49PM +0100, Steen Hegelund wrote:
> >>> Provide new phy configuration interfaces for media type and speed
> >>> that
> >>> allows e.g. PHYs used for ethernet to be configured with this
> >>> information.
> >>>
> >>> Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
> >>> Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
> >>> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> >>> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> >>> ---
> >>>
> >
> > ...
> >
> >>>  int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
> >>>                union phy_configure_opts *opts);
> >>> @@ -344,6 +356,20 @@ static inline int phy_set_mode_ext(struct phy
> >>> *phy, enum phy_mode mode,
> >>>  #define phy_set_mode(phy, mode) \
> >>>       phy_set_mode_ext(phy, mode, 0)
> >>>
> >>> +static inline int phy_set_media(struct phy *phy, enum phy_media
> >>> media)
> >>> +{
> >>> +     if (!phy)
> >>> +             return 0;
> >>
> >> I'm curious, why do you check for the NULL in all newly introduced
> >> functions?
> >> How is it possible that calls to phy_*() supply NULL as the main
> >> struct?
> >>
> >> Thanks
> >
> > I do not know the history of that, but all the functions in the
> > interface that takes a phy as input and returns a status follow that
> > pattern.  Maybe Kishon and Vinod knows the origin?
>
> It is to make handling optional PHYs simpler. See here for the origin :-)
> http://lore.kernel.org/r/1391264157-2112-1-git-send-email-andrew@lunn.ch

Thanks for the pointer, it is good to know.
I personally would do it differently, but whatever.

>
> Thanks
> Kishon
> >
> >>
> >>> +     return -ENODEV;
> >>> +}
> >>> +
> >>> +static inline int phy_set_speed(struct phy *phy, int speed)
> >>> +{
> >>> +     if (!phy)
> >>> +             return 0;
> >>> +     return -ENODEV;
> >>> +}
> >>> +
> >>>  static inline enum phy_mode phy_get_mode(struct phy *phy)
> >>>  {
> >>>       return PHY_MODE_INVALID;
> >>> --
> >>> 2.30.0
> >>>
> >
> > Best Regards
> > Steen
> >

  reply	other threads:[~2021-02-23 13:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 16:14 [PATCH v15 0/4] Adding the Sparx5 Serdes driver Steen Hegelund
2021-02-18 16:14 ` [PATCH v15 1/4] dt-bindings: phy: Add sparx5-serdes bindings Steen Hegelund
2021-02-18 16:14 ` [PATCH v15 2/4] phy: Add media type and speed serdes configuration interfaces Steen Hegelund
2021-02-21  5:59   ` Leon Romanovsky
2021-02-22  8:00     ` Steen Hegelund
2021-02-23 12:22       ` Kishon Vijay Abraham I
2021-02-23 13:53         ` Leon Romanovsky [this message]
2021-03-16 13:14   ` Kishon Vijay Abraham I
2021-02-18 16:14 ` [PATCH v15 3/4] phy: Add Sparx5 ethernet serdes PHY driver Steen Hegelund
2021-02-18 16:14 ` [PATCH v15 4/4] arm64: dts: sparx5: Add Sparx5 serdes driver node Steen Hegelund
2021-02-18 21:23 ` [PATCH v15 0/4] Adding the Sparx5 Serdes driver David Miller
2021-03-15 15:04 ` Steen Hegelund
2021-03-15 17:26   ` Jakub Kicinski
2021-03-16  8:04     ` Steen Hegelund
2021-03-16  4:53   ` Vinod Koul
2021-03-16  8:05     ` Steen Hegelund
2021-03-17  6:43 ` Vinod Koul

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=YDUI3rYnNxhxiZem@unreal \
    --to=leon@kernel.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=bjarni.jonasson@microchip.com \
    --cc=kishon@ti.com \
    --cc=lars.povlsen@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steen.hegelund@microchip.com \
    --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;
as well as URLs for NNTP newsgroup(s).