drivers/platform/x86/serdev_helpers.h
Source file repositories/reference/linux-study-clean/drivers/platform/x86/serdev_helpers.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/serdev_helpers.h- Extension
.h- Size
- 2628 bytes
- Lines
- 89
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/device.hlinux/err.hlinux/printk.hlinux/sprintf.hlinux/string.h
Detected Declarations
function UartSerialBusV2function get_serdev_controller
Annotated Snippet
switch (i) {
case 0:
snprintf(name, sizeof(name), "%s:0", dev_name(ctrl_dev));
break;
case 1:
snprintf(name, sizeof(name), "%s.%d",
dev_name(ctrl_dev), serial_ctrl_port);
break;
case 2:
strscpy(name, serdev_ctrl_name, sizeof(name));
break;
}
child = device_find_child_by_name(ctrl_dev, name);
put_device(ctrl_dev);
if (!child) {
pr_err("error could not find '%s' device\n", name);
return ERR_PTR(-ENODEV);
}
ctrl_dev = child;
}
return ctrl_dev;
}
static inline struct device *
get_serdev_controller(const char *serial_ctrl_hid,
const char *serial_ctrl_uid,
int serial_ctrl_port,
const char *serdev_ctrl_name)
{
struct acpi_device *adev;
struct device *parent;
adev = acpi_dev_get_first_match_dev(serial_ctrl_hid, serial_ctrl_uid, -1);
if (!adev) {
pr_err("error could not get %s/%s serial-ctrl adev\n",
serial_ctrl_hid, serial_ctrl_uid ?: "*");
return ERR_PTR(-ENODEV);
}
/* get_first_physical_node() returns a weak ref */
parent = get_device(acpi_get_first_physical_node(adev));
acpi_dev_put(adev);
if (!parent) {
pr_err("error could not get %s/%s serial-ctrl physical node\n",
serial_ctrl_hid, serial_ctrl_uid ?: "*");
return ERR_PTR(-ENODEV);
}
/* This puts our reference on parent and returns a ref on the ctrl */
return get_serdev_controller_from_parent(parent, serial_ctrl_port, serdev_ctrl_name);
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/device.h`, `linux/err.h`, `linux/printk.h`, `linux/sprintf.h`, `linux/string.h`.
- Detected declarations: `function UartSerialBusV2`, `function get_serdev_controller`.
- Atlas domain: Driver Families / drivers/platform.
- 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.