Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp969994pxb; Tue, 29 Mar 2022 13:55:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzst8y5AwdoYERPYgsS/UGhobBvx5cBok0gM4/y2ixWdboudTsode91qNwknPbAUJY82tTA X-Received: by 2002:a05:6a00:a0c:b0:4f6:661e:8dda with SMTP id p12-20020a056a000a0c00b004f6661e8ddamr29594439pfh.66.1648587337084; Tue, 29 Mar 2022 13:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648587337; cv=none; d=google.com; s=arc-20160816; b=RNGvy9CewYGrdWkPnjjcigv/JHekfmn9puD803SuKqnBOf38bVsrvmK7T+ESb9OFhx qRXy8xzioogIDOPt4fqyhbGOnCYqXCQy3RFdrRaQ9/pWwPGVL/hGGq723O+ktPNPlVPl zC43WE0mCf9EJox3fZP34hCYNqnb/23vzkLZIL2pLO7kuTX/ivUC9jm7BL5XHU7aSOAf A1+zUE1KGqFxgsQxvvAJDEq8Kin/McMqu0e6WSh/vreVDcaiF/HXQfsd8BSeNs1ZaywV iJ+TxnoIOTWVn6pREnxKUOvM5bRYL5cxTkQzzxjNfS8cgM6yEYPFjiDhDAjVkHruGywp puqA== 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=imZMY4F+ZI6v2U65NYSEw0/ID6RW/Q6WN7XlgY4LESA=; b=K0Z/vExn6bWQt8oN5qP//MASFc24VvrUcHuZxLpUHQcaQyKhMVoRb1UVxM9CsSFkap B4vNJz90//JacNkAoB4TqnvwM3xSVfka4NDC+rNfoJDoX4OfMbvb/I19ZpDq7ofMFO/T L41Zf2Qc24TzU7TGV3rl7Nmfgak1dHu+OuswA+D34bSX3S7RFW3wHjIJNwBJqgcB8BaM t9Hi5MCCyGe9sRdVr7yMPdc+FUFaCEGQ8O3LSiqyQeS4mF7X3biHl03rPUC7SLnH02DP E8rmcH7d8h9twXawG/eYyskC6ReuBDMOXxV+i6wyi8GQ9MdPG1JgprMjiLItsgusnmyT M+SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=AEdNRE7c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056a00190400b004fa3a8dffcfsi19718754pfi.134.2022.03.29.13.55.11; Tue, 29 Mar 2022 13:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=AEdNRE7c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239395AbiC2QKC (ORCPT + 99 others); Tue, 29 Mar 2022 12:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239355AbiC2QJc (ORCPT ); Tue, 29 Mar 2022 12:09:32 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F74525ECB7; Tue, 29 Mar 2022 09:07:48 -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 833A52224E; Tue, 29 Mar 2022 18:07:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648570066; 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=imZMY4F+ZI6v2U65NYSEw0/ID6RW/Q6WN7XlgY4LESA=; b=AEdNRE7cumjAdzG4X2aihooUkySO+Vo7zKqYHnpZs/JYnhMlfneyvURmtq9ZwN4wmpq9rT v8qpYQ5Qz2U1FaIlHUlHKHniaJVTfg2+MIlFKuP8bkuu/jbCyLUc+yZ2fH14WF00EF7uI8 dW371Kl/8QwlTA++kw3lwX+jzi2S7Qo= 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 v2 4/5] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name() Date: Tue, 29 Mar 2022 18:07:29 +0200 Message-Id: <20220329160730.3265481-5-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220329160730.3265481-1-michael@walle.cc> References: <20220329160730.3265481-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 the bad characters replacement in the hwmon name, use the new devm_hwmon_sanitize_name(). Signed-off-by: Michael Walle --- drivers/net/phy/nxp-tja11xx.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 9944cc501806..8088c2a4a000 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -444,16 +444,11 @@ 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); + priv->hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev)); 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_dev = devm_hwmon_device_register_with_info(dev, priv->hwmon_name, phydev, -- 2.30.2