[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f1c73ec57aefa2803df0c32c78dcdc41fed4126.camel@mediatek.com>
Date: Mon, 7 Oct 2024 04:30:08 +0000
From: SkyLake Huang (黃啟澤)
<SkyLake.Huang@...iatek.com>
To: "andrew@...n.ch" <andrew@...n.ch>
CC: "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>, "linux@...linux.org.uk"
<linux@...linux.org.uk>, "kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>, "edumazet@...gle.com"
<edumazet@...gle.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"dqfext@...il.com" <dqfext@...il.com>,
Steven Liu (劉人豪) <steven.liu@...iatek.com>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>, "davem@...emloft.net"
<davem@...emloft.net>, "hkallweit1@...il.com" <hkallweit1@...il.com>,
"daniel@...rotopia.org" <daniel@...rotopia.org>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
Subject: Re: [PATCH net-next 3/9] net: phy: mediatek: Move LED helper
functions into mtk phy lib
On Sun, 2024-10-06 at 23:28 +0200, Andrew Lunn wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> > static int mt798x_phy_led_blink_set(struct phy_device *phydev, u8
> index,
> > unsigned long *delay_on,
> > unsigned long *delay_off)
> > {
> > +struct mtk_socphy_priv *priv = phydev->priv;
> > bool blinking = false;
> > int err = 0;
> >
> > -if (index > 1)
> > -return -EINVAL;
> > -
> > -if (delay_on && delay_off && (*delay_on > 0) && (*delay_off > 0))
> {
> > -blinking = true;
> > -*delay_on = 50;
> > -*delay_off = 50;
> > -}
> > +err = mtk_phy_led_num_dly_cfg(index, delay_on, delay_off,
> &blinking);
> > +if (err < 0)
> > +return err;
> >
> > -err = mt798x_phy_hw_led_blink_set(phydev, index, blinking);
> > +err = mtk_phy_hw_led_blink_set(phydev, index, &priv->led_state,
> > + blinking);
> > if (err)
> > return err;
> >
> > -return mt798x_phy_hw_led_on_set(phydev, index, false);
> > +return mtk_phy_hw_led_on_set(phydev, index, &priv->led_state,
> > + MTK_GPHY_LED_ON_MASK, false);
> > }
> >
> > static int mt798x_phy_led_brightness_set(struct phy_device
> *phydev,
> > u8 index, enum led_brightness value)
> > {
> > +struct mtk_socphy_priv *priv = phydev->priv;
> > int err;
> >
> > -err = mt798x_phy_hw_led_blink_set(phydev, index, false);
> > +err = mtk_phy_hw_led_blink_set(phydev, index, &priv->led_state,
> false);
> > if (err)
> > return err;
>
> If this is just moving code into a shared helper library, why is priv
> now needed, when it was not before?
>
> Maybe this needs splitting into two patches, to help explain this
> change.
>
> Andrew
Although this is just "moving code", we need this priv to do some
modification for mt798x_phy_hw_led_blink_set() so that we can move it
to mtk-phy-lib properly.
I was trying to split this patch into two but I'm afraid that will make
this patchset more complex. Is it okay that I add more explanation in
commit message? like:
This patch creates mtk-phy-lib.c & mtk-phy.h and integrates mtk-ge-
soc.c's LED helper functions so that we can use those helper functions
in other MTK's ethernet phy driver.
We need private data passed to
- mtk_phy_hw_led_on_set()
- mtk_phy_hw_led_blink_set()
- mtk_phy_led_hw_ctrl_get()
- mtk_phy_led_hw_ctrl_set()
to make sure these helper functions can be used in both mtk-ge-soc.c &
mtk-ge.c.
BRs,
Sky
Powered by blists - more mailing lists