diff mbox series

[RFC,v2,5/5] hwmon: move hwmon_is_bad_char() into core

Message ID 20220329160730.3265481-6-michael@walle.cc (mailing list archive)
State Superseded
Headers show
Series hwmon: introduce hwmon_sanitize() | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 158 this patch: 158
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/build_clang success Errors and warnings before: 58 this patch: 58
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 159 this patch: 159
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 53 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Michael Walle March 29, 2022, 4:07 p.m. UTC
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 <michael@walle.cc>
---
 drivers/hwmon/hwmon.c | 20 ++++++++++++++++++++
 include/linux/hwmon.h | 23 -----------------------
 2 files changed, 20 insertions(+), 23 deletions(-)
diff mbox series

Patch

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