drivers/hwmon/asus_atk0110.c
Source file repositories/reference/linux-study-clean/drivers/hwmon/asus_atk0110.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwmon/asus_atk0110.c- Extension
.c- Size
- 32510 bytes
- Lines
- 1395
- Domain
- Driver Families
- Bucket
- drivers/hwmon
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/kernel.hlinux/hwmon.hlinux/list.hlinux/module.hlinux/slab.hlinux/dmi.hlinux/jiffies.hlinux/err.hlinux/acpi.hlinux/platform_device.hlinux/string_choices.h
Detected Declarations
struct atk_datastruct atk_sensor_datastruct atk_acpi_ret_bufferstruct atk_acpi_input_bufenum atk_pack_memberfunction atk_input_showfunction atk_label_showfunction atk_limit1_showfunction atk_limit2_showfunction atk_init_attributefunction typefunction atk_print_sensorfunction atk_read_value_oldfunction atk_read_value_newfunction atk_read_valuefunction atk_debugfs_gitm_getfunction atk_acpi_printfunction atk_pack_printfunction atk_debugfs_ggrp_openfunction atk_debugfs_ggrp_readfunction atk_debugfs_ggrp_releasefunction atk_debugfs_initfunction atk_debugfs_cleanupfunction atk_debugfs_initfunction atk_enumerate_old_hwmonfunction atk_ec_presentfunction atk_ec_enabledfunction atk_ec_ctlfunction atk_enumerate_new_hwmonfunction atk_init_attribute_groupsfunction list_for_each_entryfunction atk_register_hwmonfunction atk_probe_iffunction atk_probefunction atk_removefunction atk0110_initfunction atk0110_exitmodule init atk0110_init
Annotated Snippet
static const struct file_operations atk_debugfs_ggrp_fops = {
.read = atk_debugfs_ggrp_read,
.open = atk_debugfs_ggrp_open,
.release = atk_debugfs_ggrp_release,
};
static void atk_debugfs_init(struct atk_data *data)
{
struct dentry *d;
data->debugfs.id = 0;
d = debugfs_create_dir("asus_atk0110", NULL);
debugfs_create_x32("id", 0600, d, &data->debugfs.id);
debugfs_create_file_unsafe("gitm", 0400, d, data, &atk_debugfs_gitm);
debugfs_create_file("ggrp", 0400, d, data, &atk_debugfs_ggrp_fops);
data->debugfs.root = d;
}
static void atk_debugfs_cleanup(struct atk_data *data)
{
debugfs_remove_recursive(data->debugfs.root);
}
#else /* CONFIG_DEBUG_FS */
static void atk_debugfs_init(struct atk_data *data)
{
}
static void atk_debugfs_cleanup(struct atk_data *data)
{
}
#endif
static int atk_add_sensor(struct atk_data *data, union acpi_object *obj)
{
struct device *dev = data->dev;
union acpi_object *flags;
union acpi_object *name;
union acpi_object *limit1;
union acpi_object *limit2;
union acpi_object *enable;
struct atk_sensor_data *sensor;
char const *base_name;
char const *limit1_name;
char const *limit2_name;
u64 type;
int err;
int *num;
int start;
if (obj->type != ACPI_TYPE_PACKAGE) {
/* wft is this? */
dev_warn(dev, "Unknown type for ACPI object: (%d)\n",
obj->type);
return -EINVAL;
}
err = validate_hwmon_pack(data, obj);
if (err)
return err;
/* Ok, we have a valid hwmon package */
type = atk_get_pack_member(data, obj, HWMON_PACK_FLAGS)->integer.value
& ATK_TYPE_MASK;
switch (type) {
case HWMON_TYPE_VOLT:
base_name = "in";
limit1_name = "min";
limit2_name = "max";
num = &data->voltage_count;
start = 0;
break;
case HWMON_TYPE_TEMP:
base_name = "temp";
limit1_name = "max";
limit2_name = "crit";
num = &data->temperature_count;
start = 1;
break;
case HWMON_TYPE_FAN:
base_name = "fan";
limit1_name = "min";
limit2_name = "max";
num = &data->fan_count;
start = 1;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/kernel.h`, `linux/hwmon.h`, `linux/list.h`, `linux/module.h`, `linux/slab.h`, `linux/dmi.h`, `linux/jiffies.h`.
- Detected declarations: `struct atk_data`, `struct atk_sensor_data`, `struct atk_acpi_ret_buffer`, `struct atk_acpi_input_buf`, `enum atk_pack_member`, `function atk_input_show`, `function atk_label_show`, `function atk_limit1_show`, `function atk_limit2_show`, `function atk_init_attribute`.
- Atlas domain: Driver Families / drivers/hwmon.
- Implementation status: pattern 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.