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

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


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 84296d4c 363b6545
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -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,
+3 −7
Original line number Diff line number Diff line
@@ -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,