drivers/macintosh/smu.c
Source file repositories/reference/linux-study-clean/drivers/macintosh/smu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/macintosh/smu.c- Extension
.c- Size
- 31128 bytes
- Lines
- 1333
- Domain
- Driver Families
- Bucket
- drivers/macintosh
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/types.hlinux/kernel.hlinux/device.hlinux/dmapool.hlinux/memblock.hlinux/vmalloc.hlinux/highmem.hlinux/jiffies.hlinux/interrupt.hlinux/rtc.hlinux/completion.hlinux/miscdevice.hlinux/delay.hlinux/poll.hlinux/mutex.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/of_platform.hlinux/platform_device.hlinux/slab.hlinux/sched/signal.hasm/byteorder.hasm/io.hasm/machdep.hasm/pmac_feature.hasm/smu.hasm/sections.hlinux/uaccess.h
Detected Declarations
struct smu_cmd_bufstruct smu_devicestruct smu_privateenum smu_file_modefunction smu_start_cmdfunction smu_db_intrfunction smu_msg_intrfunction smu_queue_cmdfunction smu_queue_simplefunction smu_pollfunction smu_done_completefunction smu_spinwait_cmdfunction bcd2hexfunction hex2bcdfunction smu_fill_set_rtc_cmdfunction smu_get_rtc_timefunction smu_set_rtc_timefunction smu_shutdownfunction smu_restartfunction smu_presentfunction smu_initfunction smu_late_initfunction smu_expose_childsfunction smu_platform_probefunction smu_init_sysfsfunction smu_i2c_complete_commandfunction smu_i2c_retryfunction smu_i2c_low_completionfunction smu_queue_i2cfunction smu_read_datablockfunction smu_openfunction smu_user_cmd_donefunction smu_writefunction smu_read_commandfunction smu_read_eventsfunction smu_readfunction smu_fpollfunction smu_releasefunction smu_device_initmodule init smu_late_initmodule init smu_init_sysfsmodule init smu_device_initexport smu_queue_cmdexport smu_queue_simpleexport smu_pollexport smu_done_completeexport smu_spinwait_cmdexport smu_present
Annotated Snippet
static const struct file_operations smu_device_fops = {
.read = smu_read,
.write = smu_write,
.poll = smu_fpoll,
.open = smu_open,
.release = smu_release,
};
static struct miscdevice pmu_device = {
MISC_DYNAMIC_MINOR, "smu", &smu_device_fops
};
static int smu_device_init(void)
{
if (!smu)
return -ENODEV;
if (misc_register(&pmu_device) < 0)
printk(KERN_ERR "via-pmu: cannot register misc device.\n");
return 0;
}
device_initcall(smu_device_init);
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/device.h`, `linux/dmapool.h`, `linux/memblock.h`, `linux/vmalloc.h`, `linux/highmem.h`, `linux/jiffies.h`.
- Detected declarations: `struct smu_cmd_buf`, `struct smu_device`, `struct smu_private`, `enum smu_file_mode`, `function smu_start_cmd`, `function smu_db_intr`, `function smu_msg_intr`, `function smu_queue_cmd`, `function smu_queue_simple`, `function smu_poll`.
- Atlas domain: Driver Families / drivers/macintosh.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.