Message ID | 20220622123543.3463209-3-michael@walle.cc (mailing list archive) |
---|---|
State | Accepted |
Commit | 363b65459b78c0488721196186fac7f48593234e |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: use new hwmon_sanitize_name() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 8 of 8 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 18 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
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 >
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,
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(-)