Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2224772pxb; Wed, 30 Mar 2022 19:54:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXz8HciLIMzf/Qh4dbuOx8MW5f+GItbQ5AGT0QOZqQsWA+xmrOY8MRuZ3hQBnIqaoMo05q X-Received: by 2002:a65:4681:0:b0:382:b4f5:84c2 with SMTP id h1-20020a654681000000b00382b4f584c2mr8868116pgr.218.1648695264436; Wed, 30 Mar 2022 19:54:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648695264; cv=none; d=google.com; s=arc-20160816; b=zH3iGCdvSpogH9Aix69/wzRY/e3pmlNWejWMuGN1n7sccRliCi3hIYKgEHDedu8I+h xfYtGsa87kSiYUSIAdkmGQXWg9N8BWdpS71s9V5f0wJAhAqJp+Nf/f/alsa2qKJCoVT2 DxvjQK4ciQaZW9PJRWuyynIO20ypuPMdtg+isTta/1kOJyc3FbNkglC5HkIidYFRiENf nLd2TGMnx4meoyGVe2HrXZW3NF0vRofjeki98kBR7RN8eYsUKzuSR52VoCzw3eKIZaOS z6jA+pmpYSUwDI6ngrXp8CgcEJz2NQqxn2t+7B4qzZ1ADO/zop1+6zD7upfXWuyoq1eF xyrQ== 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=ICyBKbcIANIRXFbM3XwImZyH8BggKJrVFsuGIGCnPIc=; b=yHojuXr1DDNV05i2e5AQvgfPzrLvY7zuBUzM/30UQwFwtdAbM8bZdxYVlLLDdiBDNJ R0GY4dx4/FTHWeJVt6+THUI0dtFh+BsEH1JR16j/jMswNi2irAlAljFGD56webpxdG9q DQe6vYAchizuXfSAURGnrn7435v9eO2RSX178XwhcEBuVEm5IGl/4zM0R4QwBnPxSOsl P2n7TfXyV2wNJBmtjilc0sZ+T9+PTGei6oFuetKQNGXDptB/yBZUnZ5eNpthCZ2sFF3+ LqyLYSx9cXe1TKXd64jwQCY3sHzGvdpN/UOUngYZes/Q2y07cFU4+EDdW17m4hnWgAUy Js7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=ndwGVfNH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g19-20020aa78193000000b004fa7c4d3815si21681267pfi.73.2022.03.30.19.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 19:54:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=ndwGVfNH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 1E5B4D082E; Wed, 30 Mar 2022 19:39:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239492AbiC2QKO (ORCPT + 99 others); Tue, 29 Mar 2022 12:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbiC2QJe (ORCPT ); Tue, 29 Mar 2022 12:09:34 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B18F1E2F65; Tue, 29 Mar 2022 09:07:51 -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 CCA752224F; 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=1648570067; 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=ICyBKbcIANIRXFbM3XwImZyH8BggKJrVFsuGIGCnPIc=; b=ndwGVfNH2rpEswAMlPNbXXbh/lBTRKacuLkziFr1tB0krx0Qj0RmAAFSztGBTn5oG4mnfc rnuNqBGNCVjI0QIYPpga+VJw129Ccp6ZtVBazrxSplfXu/MizJRnretLRYOLt2ng95IQyk F7Cj3FuQCCEFWj8jXdm3l44NR4jOMyM= 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 RFC v2 5/5] hwmon: move hwmon_is_bad_char() into core Date: Tue, 29 Mar 2022 18:07:30 +0200 Message-Id: <20220329160730.3265481-6-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=-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 With the last user of this function converted to hwmon_sanitize_name(), move the function into the core itself and make it private. Signed-off-by: Michael Walle --- drivers/hwmon/hwmon.c | 20 ++++++++++++++++++++ include/linux/hwmon.h | 23 ----------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 619ef9f9a16e..f19b69b066ef 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -1057,6 +1057,26 @@ void devm_hwmon_device_unregister(struct device *dev) } EXPORT_SYMBOL_GPL(devm_hwmon_device_unregister); +/** + * hwmon_is_bad_char - Is the char invalid in a hwmon name + * @ch: the char to be considered + * + * Returns true if the char is invalid, false otherwise. + */ +static bool hwmon_is_bad_char(const char ch) +{ + switch (ch) { + case '-': + case '*': + case ' ': + case '\t': + case '\n': + return true; + default: + return false; + } +} + static char *__hwmon_sanitize_name(struct device *dev, const char *old_name) { char *name, *p; diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 4efaf06fd2b8..6a60e3a4acc0 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h @@ -464,27 +464,4 @@ int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type, char *hwmon_sanitize_name(const char *name); char *devm_hwmon_sanitize_name(struct device *dev, const char *name); -/** - * hwmon_is_bad_char - Is the char invalid in a hwmon name - * @ch: the char to be considered - * - * hwmon_is_bad_char() can be used to determine if the given character - * may not be used in a hwmon name. - * - * Returns true if the char is invalid, false otherwise. - */ -static inline bool hwmon_is_bad_char(const char ch) -{ - switch (ch) { - case '-': - case '*': - case ' ': - case '\t': - case '\n': - return true; - default: - return false; - } -} - #endif -- 2.30.2