[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YDUI3rYnNxhxiZem@unreal>
Date: Tue, 23 Feb 2021 15:53:34 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Kishon Vijay Abraham I <kishon@...com>
Cc: Steen Hegelund <steen.hegelund@...rochip.com>,
Vinod Koul <vkoul@...nel.org>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Lars Povlsen <lars.povlsen@...rochip.com>,
Bjarni Jonasson <bjarni.jonasson@...rochip.com>,
Microchip UNG Driver List <UNGLinuxDriver@...rochip.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH v15 2/4] phy: Add media type and speed serdes
configuration interfaces
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@...rochip.com>
> >>> Signed-off-by: Steen Hegelund <steen.hegelund@...rochip.com>
> >>> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> >>> Reviewed-by: Alexandre Belloni <alexandre.belloni@...tlin.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
> >
Powered by blists - more mailing lists