drivers/platform/surface/aggregator/controller.c
Source file repositories/reference/linux-study-clean/drivers/platform/surface/aggregator/controller.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/surface/aggregator/controller.c- Extension
.c- Size
- 87651 bytes
- Lines
- 2848
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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.
- 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/acpi.hlinux/atomic.hlinux/completion.hlinux/gpio/consumer.hlinux/interrupt.hlinux/kref.hlinux/limits.hlinux/list.hlinux/lockdep.hlinux/mutex.hlinux/rculist.hlinux/rbtree.hlinux/rwsem.hlinux/serdev.hlinux/slab.hlinux/spinlock.hlinux/srcu.hlinux/types.hlinux/workqueue.hlinux/surface_aggregator/controller.hlinux/surface_aggregator/serial_hub.hcontroller.hssh_msgb.hssh_request_layer.htrace.h
Detected Declarations
struct ssam_nf_refcount_keystruct ssam_nf_refcount_entrystruct ssh_notification_paramsenum ssh_dsm_fnfunction Copyrightfunction ssh_seq_nextfunction ssh_rqid_resetfunction ssh_rqid_nextfunction ssam_event_matches_notifierfunction ssam_nfblk_call_chainfunction list_for_each_entry_rcufunction ssam_nfblk_insertfunction ssam_nfblk_findfunction ssam_nfblk_removefunction ssam_nf_head_initfunction ssam_nf_head_destroyfunction ssam_nf_refcount_incfunction ssam_nf_refcount_decfunction ssam_nf_refcount_dec_freefunction ssam_nf_refcount_emptyfunction ssam_nf_callfunction ssam_nf_initfunction ssam_nf_destroyfunction ssam_event_item_cache_initfunction ssam_event_item_cache_destroyfunction __ssam_event_item_free_cachedfunction __ssam_event_item_free_genericfunction ssam_event_item_freefunction ssam_event_item_allocfunction ssam_event_queue_pushfunction ssam_event_queue_popfunction ssam_event_queue_is_emptyfunction ssam_cplt_get_event_queuefunction ssam_cplt_submitfunction ssam_cplt_submit_eventfunction ssam_cplt_flushfunction ssam_event_queue_work_fnfunction ssam_event_queue_initfunction ssam_cplt_initfunction ssam_cplt_destroyfunction ssam_controller_devicefunction __ssam_controller_releasefunction ssam_controller_getfunction ssam_controller_putfunction ssam_controller_statelockfunction ssam_controller_stateunlockfunction ssam_controller_lockfunction ssam_controller_unlock
Annotated Snippet
struct ssam_nf_refcount_key {
struct ssam_event_registry reg;
struct ssam_event_id id;
};
/**
* struct ssam_nf_refcount_entry - RB-tree entry for reference counting event
* activations.
* @node: The node of this entry in the rb-tree.
* @key: The key of the event.
* @refcount: The reference-count of the event.
* @flags: The flags used when enabling the event.
*/
struct ssam_nf_refcount_entry {
struct rb_node node;
struct ssam_nf_refcount_key key;
int refcount;
u8 flags;
};
/**
* ssam_nf_refcount_inc() - Increment reference-/activation-count of the given
* event.
* @nf: The notifier system reference.
* @reg: The registry used to enable/disable the event.
* @id: The event ID.
*
* Increments the reference-/activation-count associated with the specified
* event type/ID, allocating a new entry for this event ID if necessary. A
* newly allocated entry will have a refcount of one.
*
* Note: ``nf->lock`` must be held when calling this function.
*
* Return: Returns the refcount entry on success. Returns an error pointer
* with %-ENOSPC if there have already been %INT_MAX events of the specified
* ID and type registered, or %-ENOMEM if the entry could not be allocated.
*/
static struct ssam_nf_refcount_entry *
ssam_nf_refcount_inc(struct ssam_nf *nf, struct ssam_event_registry reg,
struct ssam_event_id id)
{
struct ssam_nf_refcount_entry *entry;
struct ssam_nf_refcount_key key;
struct rb_node **link = &nf->refcount.rb_node;
struct rb_node *parent = NULL;
int cmp;
lockdep_assert_held(&nf->lock);
key.reg = reg;
key.id = id;
while (*link) {
entry = rb_entry(*link, struct ssam_nf_refcount_entry, node);
parent = *link;
cmp = memcmp(&key, &entry->key, sizeof(key));
if (cmp < 0) {
link = &(*link)->rb_left;
} else if (cmp > 0) {
link = &(*link)->rb_right;
} else if (entry->refcount < INT_MAX) {
entry->refcount++;
return entry;
} else {
WARN_ON(1);
return ERR_PTR(-ENOSPC);
}
}
entry = kzalloc_obj(*entry);
if (!entry)
return ERR_PTR(-ENOMEM);
entry->key = key;
entry->refcount = 1;
rb_link_node(&entry->node, parent, link);
rb_insert_color(&entry->node, &nf->refcount);
return entry;
}
/**
* ssam_nf_refcount_dec() - Decrement reference-/activation-count of the given
* event.
* @nf: The notifier system reference.
* @reg: The registry used to enable/disable the event.
* @id: The event ID.
*
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/atomic.h`, `linux/completion.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/kref.h`, `linux/limits.h`, `linux/list.h`.
- Detected declarations: `struct ssam_nf_refcount_key`, `struct ssam_nf_refcount_entry`, `struct ssh_notification_params`, `enum ssh_dsm_fn`, `function Copyright`, `function ssh_seq_next`, `function ssh_rqid_reset`, `function ssh_rqid_next`, `function ssam_event_matches_notifier`, `function ssam_nfblk_call_chain`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: integration implementation candidate.
- 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.