drivers/acpi/dock.c
Source file repositories/reference/linux-study-clean/drivers/acpi/dock.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/dock.c- Extension
.c- Size
- 16559 bytes
- Lines
- 635
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/moduleparam.hlinux/slab.hlinux/init.hlinux/types.hlinux/notifier.hlinux/platform_device.hlinux/jiffies.hlinux/stddef.hlinux/acpi.hinternal.h
Detected Declarations
struct dock_stationstruct dock_dependent_deviceenum dock_callback_typefunction add_dock_dependent_devicefunction dock_hotplug_eventfunction find_dock_dependent_devicefunction register_dock_dependent_devicefunction is_dock_devicefunction dock_presentfunction hot_remove_dock_devicesfunction hotplug_dock_devicesfunction acpi_bus_scanfunction dock_eventfunction handle_dockfunction dockfunction undockfunction begin_dockfunction complete_dockfunction begin_undockfunction complete_undockfunction dock_in_progressfunction handle_eject_requestfunction dock_notifyfunction docked_showfunction flags_showfunction undock_storefunction uid_showfunction type_showfunction acpi_dock_addexport is_dock_device
Annotated Snippet
struct dock_station {
acpi_handle handle;
unsigned long last_dock_time;
u32 flags;
struct list_head dependent_devices;
struct list_head sibling;
struct platform_device *dock_device;
};
static LIST_HEAD(dock_stations);
static int dock_station_count;
struct dock_dependent_device {
struct list_head list;
struct acpi_device *adev;
};
#define DOCK_DOCKING 0x00000001
#define DOCK_UNDOCKING 0x00000002
#define DOCK_IS_DOCK 0x00000010
#define DOCK_IS_ATA 0x00000020
#define DOCK_IS_BAT 0x00000040
#define DOCK_EVENT 3
#define UNDOCK_EVENT 2
enum dock_callback_type {
DOCK_CALL_HANDLER,
DOCK_CALL_FIXUP,
DOCK_CALL_UEVENT,
};
/*****************************************************************************
* Dock Dependent device functions *
*****************************************************************************/
/**
* add_dock_dependent_device - associate a device with the dock station
* @ds: Dock station.
* @adev: Dependent ACPI device object.
*
* Add the dependent device to the dock's dependent device list.
*/
static int add_dock_dependent_device(struct dock_station *ds,
struct acpi_device *adev)
{
struct dock_dependent_device *dd;
dd = kzalloc_obj(*dd);
if (!dd)
return -ENOMEM;
dd->adev = adev;
INIT_LIST_HEAD(&dd->list);
list_add_tail(&dd->list, &ds->dependent_devices);
return 0;
}
static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event,
enum dock_callback_type cb_type)
{
struct acpi_device *adev = dd->adev;
acpi_hp_fixup fixup = NULL;
acpi_hp_uevent uevent = NULL;
acpi_hp_notify notify = NULL;
acpi_lock_hp_context();
if (adev->hp) {
if (cb_type == DOCK_CALL_FIXUP)
fixup = adev->hp->fixup;
else if (cb_type == DOCK_CALL_UEVENT)
uevent = adev->hp->uevent;
else
notify = adev->hp->notify;
}
acpi_unlock_hp_context();
if (fixup)
fixup(adev);
else if (uevent)
uevent(adev, event);
else if (notify)
notify(adev, event);
}
static struct dock_station *find_dock_station(acpi_handle handle)
{
struct dock_station *ds;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/moduleparam.h`, `linux/slab.h`, `linux/init.h`, `linux/types.h`, `linux/notifier.h`, `linux/platform_device.h`, `linux/jiffies.h`.
- Detected declarations: `struct dock_station`, `struct dock_dependent_device`, `enum dock_callback_type`, `function add_dock_dependent_device`, `function dock_hotplug_event`, `function find_dock_dependent_device`, `function register_dock_dependent_device`, `function is_dock_device`, `function dock_present`, `function hot_remove_dock_devices`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration 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.