linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: use new hwmon_sanitize_name()
@ 2022-06-22 12:35 Michael Walle
  2022-06-22 12:35 ` [PATCH net-next 1/2] net: sfp: use hwmon_sanitize_name() Michael Walle
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Walle @ 2022-06-22 12:35 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Guenter Roeck, Michael Walle

These are the remaining patches of my former series [1] which were hold
back because it would have required a stable branch between the subsystems.

[1] https://lore.kernel.org/r/20220405092452.4033674-1-michael@walle.cc/

Michael Walle (2):
  net: sfp: use hwmon_sanitize_name()
  net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name()

 drivers/net/phy/nxp-tja11xx.c | 11 +++--------
 drivers/net/phy/sfp.c         | 10 +++-------
 2 files changed, 6 insertions(+), 15 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next 1/2] net: sfp: use hwmon_sanitize_name()
  2022-06-22 12:35 [PATCH net-next 0/2] net: use new hwmon_sanitize_name() Michael Walle
@ 2022-06-22 12:35 ` Michael Walle
  2022-06-22 15:00   ` Guenter Roeck
  2022-06-22 12:35 ` [PATCH net-next 2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name() Michael Walle
  2022-06-24  4:00 ` [PATCH net-next 0/2] net: use new hwmon_sanitize_name() patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Michael Walle @ 2022-06-22 12:35 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Guenter Roeck, Michael Walle, Russell King

Instead of open-coding the bad characters replacement in the hwmon name,
use the new hwmon_sanitize_name().

Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/sfp.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 9a5d5a10560f..81a529c3dbe4 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -1290,7 +1290,7 @@ static const struct hwmon_chip_info sfp_hwmon_chip_info = {
 static void sfp_hwmon_probe(struct work_struct *work)
 {
 	struct sfp *sfp = container_of(work, struct sfp, hwmon_probe.work);
-	int err, i;
+	int err;
 
 	/* hwmon interface needs to access 16bit registers in atomic way to
 	 * guarantee coherency of the diagnostic monitoring data. If it is not
@@ -1318,16 +1318,12 @@ static void sfp_hwmon_probe(struct work_struct *work)
 		return;
 	}
 
-	sfp->hwmon_name = kstrdup(dev_name(sfp->dev), GFP_KERNEL);
-	if (!sfp->hwmon_name) {
+	sfp->hwmon_name = hwmon_sanitize_name(dev_name(sfp->dev));
+	if (IS_ERR(sfp->hwmon_name)) {
 		dev_err(sfp->dev, "out of memory for hwmon name\n");
 		return;
 	}
 
-	for (i = 0; sfp->hwmon_name[i]; i++)
-		if (hwmon_is_bad_char(sfp->hwmon_name[i]))
-			sfp->hwmon_name[i] = '_';
-
 	sfp->hwmon_dev = hwmon_device_register_with_info(sfp->dev,
 							 sfp->hwmon_name, sfp,
 							 &sfp_hwmon_chip_info,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name()
  2022-06-22 12:35 [PATCH net-next 0/2] net: use new hwmon_sanitize_name() Michael Walle
  2022-06-22 12:35 ` [PATCH net-next 1/2] net: sfp: use hwmon_sanitize_name() Michael Walle
@ 2022-06-22 12:35 ` Michael Walle
  2022-06-22 15:00   ` Guenter Roeck
  2022-06-24  4:00 ` [PATCH net-next 0/2] net: use new hwmon_sanitize_name() patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Michael Walle @ 2022-06-22 12:35 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Guenter Roeck, Michael Walle

Instead of open-coding the bad characters replacement in the hwmon name,
use the new devm_hwmon_sanitize_name().

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/net/phy/nxp-tja11xx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
index 9944cc501806..2a8195c50d14 100644
--- a/drivers/net/phy/nxp-tja11xx.c
+++ b/drivers/net/phy/nxp-tja11xx.c
@@ -444,15 +444,10 @@ static int tja11xx_hwmon_register(struct phy_device *phydev,
 				  struct tja11xx_priv *priv)
 {
 	struct device *dev = &phydev->mdio.dev;
-	int i;
-
-	priv->hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL);
-	if (!priv->hwmon_name)
-		return -ENOMEM;
 
-	for (i = 0; priv->hwmon_name[i]; i++)
-		if (hwmon_is_bad_char(priv->hwmon_name[i]))
-			priv->hwmon_name[i] = '_';
+	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,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/2] net: sfp: use hwmon_sanitize_name()
  2022-06-22 12:35 ` [PATCH net-next 1/2] net: sfp: use hwmon_sanitize_name() Michael Walle
@ 2022-06-22 15:00   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2022-06-22 15:00 UTC (permalink / raw)
  To: Michael Walle
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
	Russell King

On Wed, Jun 22, 2022 at 02:35:42PM +0200, Michael Walle wrote:
> Instead of open-coding the bad characters replacement in the hwmon name,
> use the new hwmon_sanitize_name().
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/net/phy/sfp.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index 9a5d5a10560f..81a529c3dbe4 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -1290,7 +1290,7 @@ static const struct hwmon_chip_info sfp_hwmon_chip_info = {
>  static void sfp_hwmon_probe(struct work_struct *work)
>  {
>  	struct sfp *sfp = container_of(work, struct sfp, hwmon_probe.work);
> -	int err, i;
> +	int err;
>  
>  	/* hwmon interface needs to access 16bit registers in atomic way to
>  	 * guarantee coherency of the diagnostic monitoring data. If it is not
> @@ -1318,16 +1318,12 @@ static void sfp_hwmon_probe(struct work_struct *work)
>  		return;
>  	}
>  
> -	sfp->hwmon_name = kstrdup(dev_name(sfp->dev), GFP_KERNEL);
> -	if (!sfp->hwmon_name) {
> +	sfp->hwmon_name = hwmon_sanitize_name(dev_name(sfp->dev));
> +	if (IS_ERR(sfp->hwmon_name)) {
>  		dev_err(sfp->dev, "out of memory for hwmon name\n");
>  		return;
>  	}
>  
> -	for (i = 0; sfp->hwmon_name[i]; i++)
> -		if (hwmon_is_bad_char(sfp->hwmon_name[i]))
> -			sfp->hwmon_name[i] = '_';
> -
>  	sfp->hwmon_dev = hwmon_device_register_with_info(sfp->dev,
>  							 sfp->hwmon_name, sfp,
>  							 &sfp_hwmon_chip_info,
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name()
  2022-06-22 12:35 ` [PATCH net-next 2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name() Michael Walle
@ 2022-06-22 15:00   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2022-06-22 15:00 UTC (permalink / raw)
  To: Michael Walle
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

On Wed, Jun 22, 2022 at 02:35:43PM +0200, Michael Walle wrote:
> Instead of open-coding the bad characters replacement in the hwmon name,
> use the new devm_hwmon_sanitize_name().
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/net/phy/nxp-tja11xx.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
> index 9944cc501806..2a8195c50d14 100644
> --- a/drivers/net/phy/nxp-tja11xx.c
> +++ b/drivers/net/phy/nxp-tja11xx.c
> @@ -444,15 +444,10 @@ static int tja11xx_hwmon_register(struct phy_device *phydev,
>  				  struct tja11xx_priv *priv)
>  {
>  	struct device *dev = &phydev->mdio.dev;
> -	int i;
> -
> -	priv->hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL);
> -	if (!priv->hwmon_name)
> -		return -ENOMEM;
>  
> -	for (i = 0; priv->hwmon_name[i]; i++)
> -		if (hwmon_is_bad_char(priv->hwmon_name[i]))
> -			priv->hwmon_name[i] = '_';
> +	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,
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/2] net: use new hwmon_sanitize_name()
  2022-06-22 12:35 [PATCH net-next 0/2] net: use new hwmon_sanitize_name() Michael Walle
  2022-06-22 12:35 ` [PATCH net-next 1/2] net: sfp: use hwmon_sanitize_name() Michael Walle
  2022-06-22 12:35 ` [PATCH net-next 2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name() Michael Walle
@ 2022-06-24  4:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-06-24  4:00 UTC (permalink / raw)
  To: Michael Walle
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, linux

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 22 Jun 2022 14:35:41 +0200 you wrote:
> These are the remaining patches of my former series [1] which were hold
> back because it would have required a stable branch between the subsystems.
> 
> [1] https://lore.kernel.org/r/20220405092452.4033674-1-michael@walle.cc/
> 
> Michael Walle (2):
>   net: sfp: use hwmon_sanitize_name()
>   net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name()
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net: sfp: use hwmon_sanitize_name()
    https://git.kernel.org/netdev/net-next/c/3f118c449c8e
  - [net-next,2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name()
    https://git.kernel.org/netdev/net-next/c/363b65459b78

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-24  4:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 12:35 [PATCH net-next 0/2] net: use new hwmon_sanitize_name() Michael Walle
2022-06-22 12:35 ` [PATCH net-next 1/2] net: sfp: use hwmon_sanitize_name() Michael Walle
2022-06-22 15:00   ` Guenter Roeck
2022-06-22 12:35 ` [PATCH net-next 2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name() Michael Walle
2022-06-22 15:00   ` Guenter Roeck
2022-06-24  4:00 ` [PATCH net-next 0/2] net: use new hwmon_sanitize_name() patchwork-bot+netdevbpf

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).