include/linux/hwmon.h
Source file repositories/reference/linux-study-clean/include/linux/hwmon.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/hwmon.h- Extension
.h- Size
- 16670 bytes
- Lines
- 528
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/cleanup.h
Detected Declarations
struct devicestruct attribute_groupstruct hwmon_opsstruct hwmon_channel_infostruct hwmon_chip_infoenum hwmon_sensor_typesenum hwmon_chip_attributesenum hwmon_temp_attributesenum hwmon_in_attributesenum hwmon_curr_attributesenum hwmon_power_attributesenum hwmon_energy_attributesenum hwmon_humidity_attributesenum hwmon_fan_attributesenum hwmon_pwm_attributesenum hwmon_intrusion_attributesfunction hwmon_is_bad_char
Annotated Snippet
struct hwmon_ops {
umode_t visible;
umode_t (*is_visible)(const void *drvdata, enum hwmon_sensor_types type,
u32 attr, int channel);
int (*read)(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val);
int (*read_string)(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, const char **str);
int (*write)(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val);
};
/**
* struct hwmon_channel_info - Channel information
* @type: Channel type.
* @config: Pointer to NULL-terminated list of channel parameters.
* Use for per-channel attributes.
*/
struct hwmon_channel_info {
enum hwmon_sensor_types type;
const u32 *config;
};
#define HWMON_CHANNEL_INFO(stype, ...) \
(&(const struct hwmon_channel_info) { \
.type = hwmon_##stype, \
.config = (const u32 []) { \
__VA_ARGS__, 0 \
} \
})
/**
* struct hwmon_chip_info - Chip configuration
* @ops: Pointer to hwmon operations.
* @info: Null-terminated list of channel information.
*/
struct hwmon_chip_info {
const struct hwmon_ops *ops;
const struct hwmon_channel_info * const *info;
};
/* hwmon_device_register() is deprecated */
struct device *hwmon_device_register(struct device *dev);
/*
* hwmon_device_register_with_groups() and
* devm_hwmon_device_register_with_groups() are deprecated.
*/
struct device *
hwmon_device_register_with_groups(struct device *dev, const char *name,
void *drvdata,
const struct attribute_group **groups);
struct device *
devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
void *drvdata,
const struct attribute_group **groups);
struct device *
hwmon_device_register_with_info(struct device *dev,
const char *name, void *drvdata,
const struct hwmon_chip_info *info,
const struct attribute_group **extra_groups);
struct device *
hwmon_device_register_for_thermal(struct device *dev, const char *name,
void *drvdata,
const struct attribute_group **extra_groups);
struct device *
devm_hwmon_device_register_with_info(struct device *dev,
const char *name, void *drvdata,
const struct hwmon_chip_info *info,
const struct attribute_group **extra_groups);
void hwmon_device_unregister(struct device *dev);
int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel);
char *hwmon_sanitize_name(const char *name);
char *devm_hwmon_sanitize_name(struct device *dev, const char *name);
void hwmon_lock(struct device *dev);
void hwmon_unlock(struct device *dev);
DEFINE_GUARD(hwmon_lock, struct device *, hwmon_lock(_T), hwmon_unlock(_T))
/**
* 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.
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/cleanup.h`.
- Detected declarations: `struct device`, `struct attribute_group`, `struct hwmon_ops`, `struct hwmon_channel_info`, `struct hwmon_chip_info`, `enum hwmon_sensor_types`, `enum hwmon_chip_attributes`, `enum hwmon_temp_attributes`, `enum hwmon_in_attributes`, `enum hwmon_curr_attributes`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.