[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <afd441fc-7712-4905-83e2-e35e613df64a@lunn.ch>
Date: Sun, 6 Oct 2024 23:28:02 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sky Huang <SkyLake.Huang@...iatek.com>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Daniel Golle <daniel@...rotopia.org>,
Qingfang Deng <dqfext@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Steven Liu <Steven.Liu@...iatek.com>
Subject: Re: [PATCH net-next 3/9] net: phy: mediatek: Move LED helper
functions into mtk phy lib
> 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
Powered by blists - more mailing lists