Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2221091pxb; Wed, 30 Mar 2022 19:47:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6W0O8RcsVgVQscka6+D/Mh3CaNL9kScip3nuKpg+zAiwCD4PghNZ07ME6UoC1A6LTUWb1 X-Received: by 2002:a63:5f4e:0:b0:382:3b02:a4a with SMTP id t75-20020a635f4e000000b003823b020a4amr8950939pgb.451.1648694824719; Wed, 30 Mar 2022 19:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648694824; cv=none; d=google.com; s=arc-20160816; b=HYOhNSXu/2HQroD5eMj2RpUXAf1yLCPfVRdpqAkOSlDIyTmRg0ULjMhHkq8LpxikV3 iYqxMTUwYqJxvpMh2lkahqaK4uwiqwS+2Iblwy59YLcIPb42uVq4Io494qF0M3rE1shY M90gM+N+BqqRwJXuLA0oQf3/42x0c1xph5I8rzOrCZZWFFGBqHdWIi/y11PFzXDs37yi 6E43rgljya3o+vodoM2RRE7lLC15p3wwOshm+iWJRjk/2dSbQA5DURbZhDdXI8oDJAB1 kZrns154LMNbHZannX17sW1Rj0rhlbn7ZKxCTl8zLFP6IWqnYs5sPdk+PNzQDACNXr5t cNrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LITMhSgRSwvz0qOYhyziptpPp80wDKzdbc0ItV4sHrA=; b=D6fOl4h4KMkhH2nAsYwBpLMCnZQX1V7JRa6+Z7jSzWPe40ijCwjBGn6A/G1t+P0ov4 6jpV1ldDcOKttgcEBPhOxjKfGZoG00yPK2j3ieY+q7djK1jy7bpr3SXgO2/CRhLzX/4x 7qI/gVP/DRrJfxmbMFJHiKQxxE1B4idz89zjJxjOHC5f1nxMKY+l6vUYzr2VpvlfEWDu NjARG/NZHMvOZhAds2FxCVuUibRpNiBwjMNhqe4iSRaE4MAsD6+WouEByJUS6nvbFN3B r+nzcOolDSkIXehRE/3wRN9mSZZw3z77rE1XwAi6DocYYciP22kxTntT7w/U84pychI1 zsew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Kab4Gj2K; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w7-20020a170902a70700b00153b2d16420si21483989plq.40.2022.03.30.19.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 19:47:04 -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=@intel.com header.s=Intel header.b=Kab4Gj2K; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B7192B7168; Wed, 30 Mar 2022 19:36:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242980AbiC3HCY (ORCPT + 99 others); Wed, 30 Mar 2022 03:02:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241845AbiC3HB5 (ORCPT ); Wed, 30 Mar 2022 03:01:57 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 879A6DF484; Wed, 30 Mar 2022 00:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648623612; x=1680159612; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=a/yS06E/f5TlhFE99MfmA8gjZt8NoZmWScc2/+Gac5Y=; b=Kab4Gj2KqZ/uTuU+hBH93dJhAMs2RwDVp19DAwGfPHOgldPZoDcDP7/r ZXzW9UC84qQuHAJFU5Wkzvgn6oxO4chjZb83ZEhLEusb5nStVN2KtmnG+ DetFxe2EBcvyKxOL5iQZtGHGuMwEaZuGdAmDlELJ8cjAH5N/iPxLR3FgC NfVNaI46e5pKfPGBpU8Gk29YeJZEsZRFId505tw9oMEpsUgu3GfAJ51Ch Q+2yqNW7E/AveLwBlkdzJtpeP3SSZsJIbc+v2+8CLZJNp/VCGfm6FPYkj 5BckXYOoDj5xnhxZ9H7ktKwmjRikcszTCeZD+ZQm2DdaIuT8spfvKIL4+ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10301"; a="258293974" X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="258293974" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 00:00:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,222,1643702400"; d="scan'208";a="565346120" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.135]) by orsmga008.jf.intel.com with ESMTP; 30 Mar 2022 00:00:05 -0700 Date: Wed, 30 Mar 2022 14:52:51 +0800 From: Xu Yilun To: Michael Walle Cc: Tom Rix , Jean Delvare , Guenter Roeck , Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v2 2/5] hwmon: intel-m10-bmc-hwmon: use devm_hwmon_sanitize_name() Message-ID: <20220330065251.GB212503@yilunxu-OptiPlex-7050> References: <20220329160730.3265481-1-michael@walle.cc> <20220329160730.3265481-3-michael@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220329160730.3265481-3-michael@walle.cc> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 On Tue, Mar 29, 2022 at 06:07:27PM +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 Acked-by: Xu Yilun > --- > drivers/hwmon/intel-m10-bmc-hwmon.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/hwmon/intel-m10-bmc-hwmon.c b/drivers/hwmon/intel-m10-bmc-hwmon.c > index 7a08e4c44a4b..29370108fa1c 100644 > --- a/drivers/hwmon/intel-m10-bmc-hwmon.c > +++ b/drivers/hwmon/intel-m10-bmc-hwmon.c > @@ -515,7 +515,6 @@ static int m10bmc_hwmon_probe(struct platform_device *pdev) > struct intel_m10bmc *m10bmc = dev_get_drvdata(pdev->dev.parent); > struct device *hwmon_dev, *dev = &pdev->dev; > struct m10bmc_hwmon *hw; > - int i; > > hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); > if (!hw) > @@ -528,14 +527,10 @@ static int m10bmc_hwmon_probe(struct platform_device *pdev) > hw->chip.info = hw->bdata->hinfo; > hw->chip.ops = &m10bmc_hwmon_ops; > > - hw->hw_name = devm_kstrdup(dev, id->name, GFP_KERNEL); > + hw->hw_name = devm_hwmon_sanitize_name(dev, id->name); > if (!hw->hw_name) > return -ENOMEM; > > - for (i = 0; hw->hw_name[i]; i++) > - if (hwmon_is_bad_char(hw->hw_name[i])) > - hw->hw_name[i] = '_'; > - > hwmon_dev = devm_hwmon_device_register_with_info(dev, hw->hw_name, > hw, &hw->chip, NULL); > return PTR_ERR_OR_ZERO(hwmon_dev); > -- > 2.30.2