blob: 2b949fa501e1dfa4fc4dc495a66d88a4d3ceccf2 [file] [log] [blame]
Mark M. Hoffman12364412005-07-15 21:38:08 -04001/*
2 hwmon.h - part of lm_sensors, Linux kernel modules for hardware monitoring
3
4 This file declares helper functions for the sysfs class "hwmon",
5 for use by sensors drivers.
6
7 Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
12*/
13
14#ifndef _HWMON_H_
15#define _HWMON_H_
16
Guenter Roeckd5601682015-08-26 19:38:11 -070017#include <linux/bitops.h>
18
Paul Gortmaker313162d2012-01-30 11:46:54 -050019struct device;
Guenter Roeckbab22432013-07-06 13:57:23 -070020struct attribute_group;
Mark M. Hoffman12364412005-07-15 21:38:08 -040021
Guenter Roeckd5601682015-08-26 19:38:11 -070022enum hwmon_sensor_types {
23 hwmon_chip,
24 hwmon_temp,
25 hwmon_in,
26 hwmon_curr,
27 hwmon_power,
28 hwmon_energy,
Guenter Roeck6bfcca42016-06-20 11:38:37 -070029 hwmon_humidity,
Guenter Roeck8faee732016-06-25 19:52:13 -070030 hwmon_fan,
Guenter Roeckf9f7bb32016-06-26 12:20:46 -070031 hwmon_pwm,
Sudeep Hollad5753802017-09-27 16:20:50 +010032 hwmon_max,
Guenter Roeckd5601682015-08-26 19:38:11 -070033};
34
35enum hwmon_chip_attributes {
36 hwmon_chip_temp_reset_history,
Guenter Roeck00d616c2016-06-20 11:01:57 -070037 hwmon_chip_in_reset_history,
Guenter Roeck9b269472016-06-20 11:10:33 -070038 hwmon_chip_curr_reset_history,
Guenter Roeckb308f5c2016-06-20 11:27:36 -070039 hwmon_chip_power_reset_history,
Guenter Roeckd5601682015-08-26 19:38:11 -070040 hwmon_chip_register_tz,
41 hwmon_chip_update_interval,
42 hwmon_chip_alarms,
Guenter Roeck9f009952019-04-15 13:23:48 -070043 hwmon_chip_samples,
44 hwmon_chip_curr_samples,
45 hwmon_chip_in_samples,
46 hwmon_chip_power_samples,
47 hwmon_chip_temp_samples,
Guenter Roeckd5601682015-08-26 19:38:11 -070048};
49
50#define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
51#define HWMON_C_IN_RESET_HISTORY BIT(hwmon_chip_in_reset_history)
Guenter Roeck9b269472016-06-20 11:10:33 -070052#define HWMON_C_CURR_RESET_HISTORY BIT(hwmon_chip_curr_reset_history)
Guenter Roeckb308f5c2016-06-20 11:27:36 -070053#define HWMON_C_POWER_RESET_HISTORY BIT(hwmon_chip_power_reset_history)
Guenter Roeckd5601682015-08-26 19:38:11 -070054#define HWMON_C_REGISTER_TZ BIT(hwmon_chip_register_tz)
55#define HWMON_C_UPDATE_INTERVAL BIT(hwmon_chip_update_interval)
56#define HWMON_C_ALARMS BIT(hwmon_chip_alarms)
Guenter Roeck9f009952019-04-15 13:23:48 -070057#define HWMON_C_SAMPLES BIT(hwmon_chip_samples)
58#define HWMON_C_CURR_SAMPLES BIT(hwmon_chip_curr_samples)
59#define HWMON_C_IN_SAMPLES BIT(hwmon_chip_in_samples)
60#define HWMON_C_POWER_SAMPLES BIT(hwmon_chip_power_samples)
61#define HWMON_C_TEMP_SAMPLES BIT(hwmon_chip_temp_samples)
Guenter Roeckd5601682015-08-26 19:38:11 -070062
63enum hwmon_temp_attributes {
64 hwmon_temp_input = 0,
65 hwmon_temp_type,
66 hwmon_temp_lcrit,
67 hwmon_temp_lcrit_hyst,
68 hwmon_temp_min,
69 hwmon_temp_min_hyst,
70 hwmon_temp_max,
71 hwmon_temp_max_hyst,
72 hwmon_temp_crit,
73 hwmon_temp_crit_hyst,
74 hwmon_temp_emergency,
75 hwmon_temp_emergency_hyst,
76 hwmon_temp_alarm,
77 hwmon_temp_lcrit_alarm,
78 hwmon_temp_min_alarm,
79 hwmon_temp_max_alarm,
80 hwmon_temp_crit_alarm,
81 hwmon_temp_emergency_alarm,
82 hwmon_temp_fault,
83 hwmon_temp_offset,
84 hwmon_temp_label,
85 hwmon_temp_lowest,
86 hwmon_temp_highest,
87 hwmon_temp_reset_history,
88};
89
90#define HWMON_T_INPUT BIT(hwmon_temp_input)
91#define HWMON_T_TYPE BIT(hwmon_temp_type)
92#define HWMON_T_LCRIT BIT(hwmon_temp_lcrit)
93#define HWMON_T_LCRIT_HYST BIT(hwmon_temp_lcrit_hyst)
94#define HWMON_T_MIN BIT(hwmon_temp_min)
95#define HWMON_T_MIN_HYST BIT(hwmon_temp_min_hyst)
96#define HWMON_T_MAX BIT(hwmon_temp_max)
97#define HWMON_T_MAX_HYST BIT(hwmon_temp_max_hyst)
98#define HWMON_T_CRIT BIT(hwmon_temp_crit)
99#define HWMON_T_CRIT_HYST BIT(hwmon_temp_crit_hyst)
100#define HWMON_T_EMERGENCY BIT(hwmon_temp_emergency)
101#define HWMON_T_EMERGENCY_HYST BIT(hwmon_temp_emergency_hyst)
Peter Huewea5023a92017-03-17 00:28:56 +0100102#define HWMON_T_ALARM BIT(hwmon_temp_alarm)
Guenter Roeckd5601682015-08-26 19:38:11 -0700103#define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm)
104#define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm)
105#define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm)
Andrew Lunn2fe31e42018-07-17 21:48:10 +0200106#define HWMON_T_LCRIT_ALARM BIT(hwmon_temp_lcrit_alarm)
Guenter Roeckd5601682015-08-26 19:38:11 -0700107#define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm)
108#define HWMON_T_FAULT BIT(hwmon_temp_fault)
109#define HWMON_T_OFFSET BIT(hwmon_temp_offset)
110#define HWMON_T_LABEL BIT(hwmon_temp_label)
111#define HWMON_T_LOWEST BIT(hwmon_temp_lowest)
112#define HWMON_T_HIGHEST BIT(hwmon_temp_highest)
113#define HWMON_T_RESET_HISTORY BIT(hwmon_temp_reset_history)
114
Guenter Roeck00d616c2016-06-20 11:01:57 -0700115enum hwmon_in_attributes {
116 hwmon_in_input,
117 hwmon_in_min,
118 hwmon_in_max,
119 hwmon_in_lcrit,
120 hwmon_in_crit,
121 hwmon_in_average,
122 hwmon_in_lowest,
123 hwmon_in_highest,
124 hwmon_in_reset_history,
125 hwmon_in_label,
126 hwmon_in_alarm,
127 hwmon_in_min_alarm,
128 hwmon_in_max_alarm,
129 hwmon_in_lcrit_alarm,
130 hwmon_in_crit_alarm,
Nicolin Chen68c0d692018-10-05 16:59:04 -0700131 hwmon_in_enable,
Guenter Roeck00d616c2016-06-20 11:01:57 -0700132};
133
134#define HWMON_I_INPUT BIT(hwmon_in_input)
135#define HWMON_I_MIN BIT(hwmon_in_min)
136#define HWMON_I_MAX BIT(hwmon_in_max)
137#define HWMON_I_LCRIT BIT(hwmon_in_lcrit)
138#define HWMON_I_CRIT BIT(hwmon_in_crit)
139#define HWMON_I_AVERAGE BIT(hwmon_in_average)
140#define HWMON_I_LOWEST BIT(hwmon_in_lowest)
141#define HWMON_I_HIGHEST BIT(hwmon_in_highest)
142#define HWMON_I_RESET_HISTORY BIT(hwmon_in_reset_history)
143#define HWMON_I_LABEL BIT(hwmon_in_label)
144#define HWMON_I_ALARM BIT(hwmon_in_alarm)
145#define HWMON_I_MIN_ALARM BIT(hwmon_in_min_alarm)
146#define HWMON_I_MAX_ALARM BIT(hwmon_in_max_alarm)
147#define HWMON_I_LCRIT_ALARM BIT(hwmon_in_lcrit_alarm)
148#define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
Nicolin Chen68c0d692018-10-05 16:59:04 -0700149#define HWMON_I_ENABLE BIT(hwmon_in_enable)
Guenter Roeck00d616c2016-06-20 11:01:57 -0700150
Guenter Roeck9b269472016-06-20 11:10:33 -0700151enum hwmon_curr_attributes {
152 hwmon_curr_input,
153 hwmon_curr_min,
154 hwmon_curr_max,
155 hwmon_curr_lcrit,
156 hwmon_curr_crit,
157 hwmon_curr_average,
158 hwmon_curr_lowest,
159 hwmon_curr_highest,
160 hwmon_curr_reset_history,
161 hwmon_curr_label,
162 hwmon_curr_alarm,
163 hwmon_curr_min_alarm,
164 hwmon_curr_max_alarm,
165 hwmon_curr_lcrit_alarm,
166 hwmon_curr_crit_alarm,
167};
168
169#define HWMON_C_INPUT BIT(hwmon_curr_input)
170#define HWMON_C_MIN BIT(hwmon_curr_min)
171#define HWMON_C_MAX BIT(hwmon_curr_max)
172#define HWMON_C_LCRIT BIT(hwmon_curr_lcrit)
173#define HWMON_C_CRIT BIT(hwmon_curr_crit)
174#define HWMON_C_AVERAGE BIT(hwmon_curr_average)
175#define HWMON_C_LOWEST BIT(hwmon_curr_lowest)
176#define HWMON_C_HIGHEST BIT(hwmon_curr_highest)
177#define HWMON_C_RESET_HISTORY BIT(hwmon_curr_reset_history)
178#define HWMON_C_LABEL BIT(hwmon_curr_label)
179#define HWMON_C_ALARM BIT(hwmon_curr_alarm)
180#define HWMON_C_MIN_ALARM BIT(hwmon_curr_min_alarm)
181#define HWMON_C_MAX_ALARM BIT(hwmon_curr_max_alarm)
182#define HWMON_C_LCRIT_ALARM BIT(hwmon_curr_lcrit_alarm)
183#define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
184
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700185enum hwmon_power_attributes {
186 hwmon_power_average,
187 hwmon_power_average_interval,
188 hwmon_power_average_interval_max,
189 hwmon_power_average_interval_min,
190 hwmon_power_average_highest,
191 hwmon_power_average_lowest,
192 hwmon_power_average_max,
193 hwmon_power_average_min,
194 hwmon_power_input,
195 hwmon_power_input_highest,
196 hwmon_power_input_lowest,
197 hwmon_power_reset_history,
198 hwmon_power_accuracy,
199 hwmon_power_cap,
200 hwmon_power_cap_hyst,
201 hwmon_power_cap_max,
202 hwmon_power_cap_min,
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200203 hwmon_power_min,
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700204 hwmon_power_max,
205 hwmon_power_crit,
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200206 hwmon_power_lcrit,
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700207 hwmon_power_label,
208 hwmon_power_alarm,
209 hwmon_power_cap_alarm,
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200210 hwmon_power_min_alarm,
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700211 hwmon_power_max_alarm,
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200212 hwmon_power_lcrit_alarm,
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700213 hwmon_power_crit_alarm,
214};
215
216#define HWMON_P_AVERAGE BIT(hwmon_power_average)
217#define HWMON_P_AVERAGE_INTERVAL BIT(hwmon_power_average_interval)
218#define HWMON_P_AVERAGE_INTERVAL_MAX BIT(hwmon_power_average_interval_max)
219#define HWMON_P_AVERAGE_INTERVAL_MIN BIT(hwmon_power_average_interval_min)
220#define HWMON_P_AVERAGE_HIGHEST BIT(hwmon_power_average_highest)
221#define HWMON_P_AVERAGE_LOWEST BIT(hwmon_power_average_lowest)
222#define HWMON_P_AVERAGE_MAX BIT(hwmon_power_average_max)
223#define HWMON_P_AVERAGE_MIN BIT(hwmon_power_average_min)
224#define HWMON_P_INPUT BIT(hwmon_power_input)
225#define HWMON_P_INPUT_HIGHEST BIT(hwmon_power_input_highest)
226#define HWMON_P_INPUT_LOWEST BIT(hwmon_power_input_lowest)
227#define HWMON_P_RESET_HISTORY BIT(hwmon_power_reset_history)
228#define HWMON_P_ACCURACY BIT(hwmon_power_accuracy)
229#define HWMON_P_CAP BIT(hwmon_power_cap)
230#define HWMON_P_CAP_HYST BIT(hwmon_power_cap_hyst)
231#define HWMON_P_CAP_MAX BIT(hwmon_power_cap_max)
232#define HWMON_P_CAP_MIN BIT(hwmon_power_cap_min)
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200233#define HWMON_P_MIN BIT(hwmon_power_min)
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700234#define HWMON_P_MAX BIT(hwmon_power_max)
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200235#define HWMON_P_LCRIT BIT(hwmon_power_lcrit)
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700236#define HWMON_P_CRIT BIT(hwmon_power_crit)
237#define HWMON_P_LABEL BIT(hwmon_power_label)
238#define HWMON_P_ALARM BIT(hwmon_power_alarm)
239#define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm)
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200240#define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm)
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700241#define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
Andrew Lunnaa7f29b2018-07-17 21:48:11 +0200242#define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
Guenter Roeckb308f5c2016-06-20 11:27:36 -0700243#define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
244
Guenter Roeck6bfcca42016-06-20 11:38:37 -0700245enum hwmon_energy_attributes {
246 hwmon_energy_input,
247 hwmon_energy_label,
248};
249
250#define HWMON_E_INPUT BIT(hwmon_energy_input)
251#define HWMON_E_LABEL BIT(hwmon_energy_label)
252
253enum hwmon_humidity_attributes {
254 hwmon_humidity_input,
255 hwmon_humidity_label,
256 hwmon_humidity_min,
257 hwmon_humidity_min_hyst,
258 hwmon_humidity_max,
259 hwmon_humidity_max_hyst,
260 hwmon_humidity_alarm,
261 hwmon_humidity_fault,
262};
263
264#define HWMON_H_INPUT BIT(hwmon_humidity_input)
265#define HWMON_H_LABEL BIT(hwmon_humidity_label)
266#define HWMON_H_MIN BIT(hwmon_humidity_min)
267#define HWMON_H_MIN_HYST BIT(hwmon_humidity_min_hyst)
268#define HWMON_H_MAX BIT(hwmon_humidity_max)
269#define HWMON_H_MAX_HYST BIT(hwmon_humidity_max_hyst)
270#define HWMON_H_ALARM BIT(hwmon_humidity_alarm)
271#define HWMON_H_FAULT BIT(hwmon_humidity_fault)
272
Guenter Roeck8faee732016-06-25 19:52:13 -0700273enum hwmon_fan_attributes {
274 hwmon_fan_input,
275 hwmon_fan_label,
276 hwmon_fan_min,
277 hwmon_fan_max,
278 hwmon_fan_div,
279 hwmon_fan_pulses,
280 hwmon_fan_target,
281 hwmon_fan_alarm,
282 hwmon_fan_min_alarm,
283 hwmon_fan_max_alarm,
284 hwmon_fan_fault,
285};
286
287#define HWMON_F_INPUT BIT(hwmon_fan_input)
288#define HWMON_F_LABEL BIT(hwmon_fan_label)
289#define HWMON_F_MIN BIT(hwmon_fan_min)
290#define HWMON_F_MAX BIT(hwmon_fan_max)
291#define HWMON_F_DIV BIT(hwmon_fan_div)
292#define HWMON_F_PULSES BIT(hwmon_fan_pulses)
293#define HWMON_F_TARGET BIT(hwmon_fan_target)
294#define HWMON_F_ALARM BIT(hwmon_fan_alarm)
295#define HWMON_F_MIN_ALARM BIT(hwmon_fan_min_alarm)
296#define HWMON_F_MAX_ALARM BIT(hwmon_fan_max_alarm)
297#define HWMON_F_FAULT BIT(hwmon_fan_fault)
298
Guenter Roeckf9f7bb32016-06-26 12:20:46 -0700299enum hwmon_pwm_attributes {
300 hwmon_pwm_input,
301 hwmon_pwm_enable,
302 hwmon_pwm_mode,
303 hwmon_pwm_freq,
304};
305
306#define HWMON_PWM_INPUT BIT(hwmon_pwm_input)
307#define HWMON_PWM_ENABLE BIT(hwmon_pwm_enable)
308#define HWMON_PWM_MODE BIT(hwmon_pwm_mode)
309#define HWMON_PWM_FREQ BIT(hwmon_pwm_freq)
310
Guenter Roeckd5601682015-08-26 19:38:11 -0700311/**
312 * struct hwmon_ops - hwmon device operations
313 * @is_visible: Callback to return attribute visibility. Mandatory.
314 * Parameters are:
315 * @const void *drvdata:
316 * Pointer to driver-private data structure passed
317 * as argument to hwmon_device_register_with_info().
318 * @type: Sensor type
319 * @attr: Sensor attribute
320 * @channel:
321 * Channel number
322 * The function returns the file permissions.
323 * If the return value is 0, no attribute will be created.
Guenter Roecke159ab52016-08-07 20:51:25 -0700324 * @read: Read callback for data attributes. Mandatory if readable
325 * data attributes are present.
Guenter Roeckd5601682015-08-26 19:38:11 -0700326 * Parameters are:
327 * @dev: Pointer to hardware monitoring device
328 * @type: Sensor type
329 * @attr: Sensor attribute
330 * @channel:
331 * Channel number
332 * @val: Pointer to returned value
333 * The function returns 0 on success or a negative error number.
Guenter Roecke159ab52016-08-07 20:51:25 -0700334 * @read_string:
335 * Read callback for string attributes. Mandatory if string
336 * attributes are present.
337 * Parameters are:
338 * @dev: Pointer to hardware monitoring device
339 * @type: Sensor type
340 * @attr: Sensor attribute
341 * @channel:
342 * Channel number
343 * @str: Pointer to returned string
344 * The function returns 0 on success or a negative error number.
345 * @write: Write callback for data attributes. Mandatory if writeable
346 * data attributes are present.
Guenter Roeckd5601682015-08-26 19:38:11 -0700347 * Parameters are:
348 * @dev: Pointer to hardware monitoring device
349 * @type: Sensor type
350 * @attr: Sensor attribute
351 * @channel:
352 * Channel number
353 * @val: Value to write
354 * The function returns 0 on success or a negative error number.
355 */
356struct hwmon_ops {
357 umode_t (*is_visible)(const void *drvdata, enum hwmon_sensor_types type,
358 u32 attr, int channel);
359 int (*read)(struct device *dev, enum hwmon_sensor_types type,
360 u32 attr, int channel, long *val);
Guenter Roecke159ab52016-08-07 20:51:25 -0700361 int (*read_string)(struct device *dev, enum hwmon_sensor_types type,
Jean Delvare5ba6bcb2017-03-07 06:15:15 -0800362 u32 attr, int channel, const char **str);
Guenter Roeckd5601682015-08-26 19:38:11 -0700363 int (*write)(struct device *dev, enum hwmon_sensor_types type,
364 u32 attr, int channel, long val);
365};
366
367/**
368 * Channel information
369 * @type: Channel type.
370 * @config: Pointer to NULL-terminated list of channel parameters.
371 * Use for per-channel attributes.
372 */
373struct hwmon_channel_info {
374 enum hwmon_sensor_types type;
375 const u32 *config;
376};
377
Charles Keepaxc43a1132019-03-20 14:58:17 +0000378#define HWMON_CHANNEL_INFO(stype, ...) \
379 (&(struct hwmon_channel_info) { \
380 .type = hwmon_##stype, \
381 .config = (u32 []) { \
382 __VA_ARGS__, 0 \
383 } \
384 })
385
Guenter Roeckd5601682015-08-26 19:38:11 -0700386/**
387 * Chip configuration
388 * @ops: Pointer to hwmon operations.
389 * @info: Null-terminated list of channel information.
390 */
391struct hwmon_chip_info {
392 const struct hwmon_ops *ops;
393 const struct hwmon_channel_info **info;
394};
395
Guenter Roeckaf1bd362016-10-16 11:31:08 -0700396/* hwmon_device_register() is deprecated */
Tony Jones1beeffe2007-08-20 13:46:20 -0700397struct device *hwmon_device_register(struct device *dev);
Guenter Roeckaf1bd362016-10-16 11:31:08 -0700398
Guenter Roeckbab22432013-07-06 13:57:23 -0700399struct device *
400hwmon_device_register_with_groups(struct device *dev, const char *name,
401 void *drvdata,
402 const struct attribute_group **groups);
Guenter Roeck74188cb2013-07-11 20:00:12 -0700403struct device *
404devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
405 void *drvdata,
406 const struct attribute_group **groups);
Guenter Roeckd5601682015-08-26 19:38:11 -0700407struct device *
408hwmon_device_register_with_info(struct device *dev,
409 const char *name, void *drvdata,
410 const struct hwmon_chip_info *info,
Guenter Roeck848ba0a2016-10-16 17:20:43 -0700411 const struct attribute_group **extra_groups);
Guenter Roeckd5601682015-08-26 19:38:11 -0700412struct device *
413devm_hwmon_device_register_with_info(struct device *dev,
Guenter Roeck848ba0a2016-10-16 17:20:43 -0700414 const char *name, void *drvdata,
415 const struct hwmon_chip_info *info,
416 const struct attribute_group **extra_groups);
Mark M. Hoffman12364412005-07-15 21:38:08 -0400417
Tony Jones1beeffe2007-08-20 13:46:20 -0700418void hwmon_device_unregister(struct device *dev);
Guenter Roeck74188cb2013-07-11 20:00:12 -0700419void devm_hwmon_device_unregister(struct device *dev);
Mark M. Hoffman12364412005-07-15 21:38:08 -0400420
Andrew Lunndcb5d0f2018-07-17 21:48:12 +0200421/**
422 * hwmon_is_bad_char - Is the char invalid in a hwmon name
423 * @ch: the char to be considered
424 *
425 * hwmon_is_bad_char() can be used to determine if the given character
426 * may not be used in a hwmon name.
427 *
428 * Returns true if the char is invalid, false otherwise.
429 */
430static inline bool hwmon_is_bad_char(const char ch)
431{
432 switch (ch) {
433 case '-':
434 case '*':
435 case ' ':
436 case '\t':
437 case '\n':
438 return true;
439 default:
440 return false;
441 }
442}
443
Mark M. Hoffman12364412005-07-15 21:38:08 -0400444#endif