Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>, Xu Liang <lxu@maxlinear.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH net-next 2/4] net: phy: tja11xx: remove call to devm_hwmon_sanitize_name
Date: Fri, 14 Mar 2025 08:45:54 +0100	[thread overview]
Message-ID: <20250314084554.322e790c@fedora-2.home> (raw)
In-Reply-To: <4452cb7e-1a2f-4213-b49f-9de196be9204@gmail.com>

Hello Heiner,

On Thu, 13 Mar 2025 20:45:06 +0100
Heiner Kallweit <hkallweit1@gmail.com> wrote:

> Since c909e68f8127 ("hwmon: (core) Use device name as a fallback in
> devm_hwmon_device_register_with_info") we can simply provide NULL
> as name argument.
> 
> Note that neither priv->hwmon_name nor priv->hwmon_dev are used
> outside tja11xx_hwmon_register.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/nxp-tja11xx.c | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
> index 601094fe2..07e94a247 100644
> --- a/drivers/net/phy/nxp-tja11xx.c
> +++ b/drivers/net/phy/nxp-tja11xx.c
> @@ -87,8 +87,6 @@
>  #define TJA110X_RMII_MODE_REFCLK_IN       BIT(0)
>  
>  struct tja11xx_priv {
> -	char		*hwmon_name;
> -	struct device	*hwmon_dev;
>  	struct phy_device *phydev;
>  	struct work_struct phy_register_work;
>  	u32 flags;
> @@ -508,19 +506,12 @@ static const struct hwmon_chip_info tja11xx_hwmon_chip_info = {
>  static int tja11xx_hwmon_register(struct phy_device *phydev,
>  				  struct tja11xx_priv *priv)
>  {
> -	struct device *dev = &phydev->mdio.dev;
> -
> -	priv->hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev));
> -	if (IS_ERR(priv->hwmon_name))
> -		return PTR_ERR(priv->hwmon_name);
> -
> -	priv->hwmon_dev =
> -		devm_hwmon_device_register_with_info(dev, priv->hwmon_name,
> -						     phydev,
> -						     &tja11xx_hwmon_chip_info,
> -						     NULL);
> +	struct device *hdev, *dev = &phydev->mdio.dev;
>  
> -	return PTR_ERR_OR_ZERO(priv->hwmon_dev);
> +	hdev = devm_hwmon_device_register_with_info(dev, NULL, phydev,
> +						    &tja11xx_hwmon_chip_info,
> +						    NULL);
> +	return PTR_ERR_OR_ZERO(hdev);
>  }

The change look correct to me, however I think you can go one step
further and remove the field tja11xx_priv.hwmon_name as well as
hwmon_dev.

One could argue that we can even remove tja11xx_hwmon_register()
entirely

Thanks,

Maxime

  reply	other threads:[~2025-03-14  7:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 19:43 [PATCH net-next 0/4] net: phy: remove calls to devm_hwmon_sanitize_name Heiner Kallweit
2025-03-13 19:44 ` [PATCH net-next 1/4] net: phy: realtek: remove call " Heiner Kallweit
2025-03-13 19:45 ` [PATCH net-next 2/4] net: phy: tja11xx: " Heiner Kallweit
2025-03-14  7:45   ` Maxime Chevallier [this message]
2025-03-14 11:26     ` Heiner Kallweit
2025-03-14 11:47       ` Maxime Chevallier
2025-03-13 19:45 ` [PATCH net-next 3/4] net: phy: mxl-gpy: " Heiner Kallweit
2025-03-13 19:46 ` [PATCH net-next 4/4] net: phy: marvell-88q2xxx: " Heiner Kallweit
2025-03-14 17:23 ` [PATCH net-next 0/4] net: phy: remove calls " Maxime Chevallier
2025-03-21 17:10 ` patchwork-bot+netdevbpf

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=20250314084554.322e790c@fedora-2.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=kuba@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=lxu@maxlinear.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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