Commit 363b6545 authored by Michael Walle's avatar Michael Walle Committed by Jakub Kicinski

net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name()

Instead of open-coding the bad characters replacement in the hwmon name,
use the new devm_hwmon_sanitize_name().
Signed-off-by: default avatarMichael Walle <michael@walle.cc>
Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3f118c44
...@@ -444,15 +444,10 @@ static int tja11xx_hwmon_register(struct phy_device *phydev, ...@@ -444,15 +444,10 @@ static int tja11xx_hwmon_register(struct phy_device *phydev,
struct tja11xx_priv *priv) struct tja11xx_priv *priv)
{ {
struct device *dev = &phydev->mdio.dev; 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++) priv->hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev));
if (hwmon_is_bad_char(priv->hwmon_name[i])) if (IS_ERR(priv->hwmon_name))
priv->hwmon_name[i] = '_'; return PTR_ERR(priv->hwmon_name);
priv->hwmon_dev = priv->hwmon_dev =
devm_hwmon_device_register_with_info(dev, priv->hwmon_name, devm_hwmon_device_register_with_info(dev, priv->hwmon_name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment