Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5565118pxb; Mon, 28 Mar 2022 14:17:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxelEeQr0+hj3AbrheuMrCDvKlsTTqryXLEqeW5G5p23ThhjAYE1nvveabyovon5dv1Uwx8 X-Received: by 2002:a05:6808:d4:b0:2da:503b:40a with SMTP id t20-20020a05680800d400b002da503b040amr602123oic.121.1648502271928; Mon, 28 Mar 2022 14:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648502271; cv=none; d=google.com; s=arc-20160816; b=VSkNuVE8bkiFRE6e9OMC4tYDNaY+ukv5a20h3dRp5rTPdR2le1pDQ0p1fqmzcu/SRw r48hc5m/lg9hrQkWIKAx1fNqshKd+JdRtienA05pRN1RdPQ4bQzXTkzsXZdYmDR8eMXE YKsR1BmsOz7sswF7yb9bU4dP3JIahttoBj8ziRk8qkVkGLjPj7E5SdpRUpdsNyfnpdhc 2E0M6p2jQ7lGoCFDjLWYAPqFCB9tVZhR9NqDT2LIGWbzMfKbl+AsBy9Ag0FKMYv3ZEN9 3hGUKaj06iTJwVckp8N/1a3WTlAc/ZRKIpKnK2Tg6j1rgNooGIYZC9O7TCrPBLmf7KQ5 hUfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eRjPElhQopDSElrlp5mEAUIG8VZuLHV4XKTK/xd/xVQ=; b=KWpEK0tgt45NHWBrXbkZmLpa48PSNBJ84D79S7jaT7WlrFuEN3GDRYZ79YBAD1+dGr +cnQM56h9t+voREbFBV286536zG0O3C/35AMSxe6ZqhPoRab0U1TjJi1raTQft7vAzOv 29V3AMxf2L/QWt5TTjXjWU+6nEUImp1oTYpGZySx3WXUg0j+Xk8/qWvNboZIBwryxhti LX7aihgGJjC1V0NDX790LI3mdz6piusGQb8sn92l22xXeCt2L08tCTXIy03qMTYJpyV0 4/XBMAfL4J6Us7M30Rat7qrTQFovxPLcRgIHkf1b+5b1hrxxnlqfwaGHfyLrhES1AlOq 3yiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=X+OR4j71; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bd11-20020a056870d78b00b000daa5765e68si10770949oab.275.2022.03.28.14.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 14:17:51 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=X+OR4j71; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B8E587CB3E; Mon, 28 Mar 2022 14:07:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241894AbiC1L4v (ORCPT + 99 others); Mon, 28 Mar 2022 07:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241769AbiC1L4X (ORCPT ); Mon, 28 Mar 2022 07:56:23 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 415D13F8B6; Mon, 28 Mar 2022 04:52:36 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 4803C22249; Mon, 28 Mar 2022 13:52:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648468354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eRjPElhQopDSElrlp5mEAUIG8VZuLHV4XKTK/xd/xVQ=; b=X+OR4j71vkeL1JwsqlcdHJyU8sMbD7I3BfjnfVCxUNEm84tsYYumOfTHBoKKXwNuBGpcKd dTxWOp0WnSS2jucTmvh5BuRyfCqlLxqWf2QwCHXkXRrLyltjSlqCLt3ExedT5O5ZeZQIyt 1NhlD/QhttdhN/CsEn1clq5xvdWqPRQ= From: Michael Walle To: Xu Yilun , Tom Rix , Jean Delvare , Guenter Roeck , Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Michael Walle Subject: [PATCH v1 2/2] net: phy: use hwmon_sanitize_name() Date: Mon, 28 Mar 2022 13:52:26 +0200 Message-Id: <20220328115226.3042322-3-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220328115226.3042322-1-michael@walle.cc> References: <20220328115226.3042322-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of open-coding it, use the new hwmon_sanitize_name() in th nxp-tja11xx and sfp driver. Signed-off-by: Michael Walle --- drivers/net/phy/nxp-tja11xx.c | 5 +---- drivers/net/phy/sfp.c | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 9944cc501806..3973aa1b90dc 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -444,15 +444,12 @@ 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] = '_'; + hwmon_sanitize_name(priv->hwmon_name); priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, priv->hwmon_name, diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 4dfb79807823..35a4641303eb 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1289,7 +1289,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 @@ -1323,9 +1323,7 @@ static void sfp_hwmon_probe(struct work_struct *work) return; } - for (i = 0; sfp->hwmon_name[i]; i++) - if (hwmon_is_bad_char(sfp->hwmon_name[i])) - sfp->hwmon_name[i] = '_'; + hwmon_sanitize_name(sfp->hwmon_name); sfp->hwmon_dev = hwmon_device_register_with_info(sfp->dev, sfp->hwmon_name, sfp, -- 2.30.2