Commit 5dc48684 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-use-new-hwmon_sanitize_name'

Michael Walle says:

====================
net: use new hwmon_sanitize_name()

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/
====================

Link: https://lore.kernel.org/r/20220622123543.3463209-1-michael@walle.ccSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 84296d4c 363b6545
...@@ -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,
......
...@@ -1290,7 +1290,7 @@ static const struct hwmon_chip_info sfp_hwmon_chip_info = { ...@@ -1290,7 +1290,7 @@ static const struct hwmon_chip_info sfp_hwmon_chip_info = {
static void sfp_hwmon_probe(struct work_struct *work) static void sfp_hwmon_probe(struct work_struct *work)
{ {
struct sfp *sfp = container_of(work, struct sfp, hwmon_probe.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 /* hwmon interface needs to access 16bit registers in atomic way to
* guarantee coherency of the diagnostic monitoring data. If it is not * guarantee coherency of the diagnostic monitoring data. If it is not
...@@ -1318,16 +1318,12 @@ static void sfp_hwmon_probe(struct work_struct *work) ...@@ -1318,16 +1318,12 @@ static void sfp_hwmon_probe(struct work_struct *work)
return; return;
} }
sfp->hwmon_name = kstrdup(dev_name(sfp->dev), GFP_KERNEL); sfp->hwmon_name = hwmon_sanitize_name(dev_name(sfp->dev));
if (!sfp->hwmon_name) { if (IS_ERR(sfp->hwmon_name)) {
dev_err(sfp->dev, "out of memory for hwmon name\n"); dev_err(sfp->dev, "out of memory for hwmon name\n");
return; 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_dev = hwmon_device_register_with_info(sfp->dev,
sfp->hwmon_name, sfp, sfp->hwmon_name, sfp,
&sfp_hwmon_chip_info, &sfp_hwmon_chip_info,
......
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