drivers/of/dynamic.c
Source file repositories/reference/linux-study-clean/drivers/of/dynamic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/of/dynamic.c- Extension
.c- Size
- 28985 bytes
- Lines
- 1135
- Domain
- Driver Families
- Bucket
- drivers/of
- 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.
- 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/cleanup.hlinux/device.hlinux/of.hlinux/spinlock.hlinux/slab.hlinux/string.hlinux/proc_fs.hof_private.h
Detected Declarations
function of_node_getfunction of_node_putfunction of_reconfig_notifier_registerfunction of_reconfig_notifier_unregisterfunction of_property_status_okfunction of_reconfig_notifyfunction of_reconfig_get_state_changefunction of_property_notifyfunction __of_attach_nodefunction of_attach_nodefunction __of_detach_nodefunction of_detach_nodefunction __of_prop_freefunction property_list_freefunction of_node_releasefunction of_node_getfunction __of_node_dupfunction for_each_property_of_nodefunction __of_changeset_entry_destroyfunction __of_changeset_entry_invertfunction __of_changeset_entry_notifyfunction __of_changeset_entry_applyfunction __of_changeset_entry_revertfunction of_changeset_initfunction of_changeset_destroyfunction __of_changeset_apply_entriesfunction list_for_each_entry_continue_reversefunction __of_changeset_apply_notifyfunction __of_changeset_applyfunction of_changeset_applyfunction __of_changeset_revert_entriesfunction list_for_each_entry_continuefunction __of_changeset_revert_notifyfunction __of_changeset_revertfunction of_changeset_revertfunction of_changeset_actionfunction of_changeset_add_prop_helperfunction of_changeset_add_prop_stringfunction of_changeset_add_prop_string_arrayfunction of_changeset_add_prop_u32_arrayfunction of_changeset_add_prop_boolfunction of_changeset_update_prop_helperfunction of_changeset_update_prop_stringexport of_node_getexport of_node_putexport of_reconfig_notifier_registerexport of_reconfig_notifier_unregisterexport of_reconfig_get_state_change
Annotated Snippet
if (is_status) {
/* no status property -> enabled (legacy) */
prev_state = 1;
new_state = status_state;
}
break;
case OF_RECONFIG_REMOVE_PROPERTY:
if (is_status) {
prev_state = status_state;
/* no status property -> enabled (legacy) */
new_state = 1;
}
break;
case OF_RECONFIG_UPDATE_PROPERTY:
if (is_status) {
prev_state = old_status_state != 0;
new_state = status_state != 0;
}
break;
}
if (prev_state == new_state)
return OF_RECONFIG_NO_CHANGE;
return new_state ? OF_RECONFIG_CHANGE_ADD : OF_RECONFIG_CHANGE_REMOVE;
}
EXPORT_SYMBOL_GPL(of_reconfig_get_state_change);
int of_property_notify(int action, struct device_node *np,
struct property *prop, struct property *oldprop)
{
struct of_reconfig_data pr;
/* only call notifiers if the node is attached */
if (!of_node_is_attached(np))
return 0;
pr.dn = np;
pr.prop = prop;
pr.old_prop = oldprop;
return of_reconfig_notify(action, &pr);
}
static void __of_attach_node(struct device_node *np)
{
const __be32 *phandle;
int sz;
unsigned long flags;
raw_spin_lock_irqsave(&devtree_lock, flags);
if (!of_node_check_flag(np, OF_OVERLAY)) {
np->name = __of_get_property(np, "name", NULL);
if (!np->name)
np->name = "<NULL>";
phandle = __of_get_property(np, "phandle", &sz);
if (!phandle)
phandle = __of_get_property(np, "linux,phandle", &sz);
if (IS_ENABLED(CONFIG_PPC_PSERIES) && !phandle)
phandle = __of_get_property(np, "ibm,phandle", &sz);
if (phandle && (sz >= 4))
np->phandle = be32_to_cpup(phandle);
else
np->phandle = 0;
}
np->child = NULL;
np->sibling = np->parent->child;
np->parent->child = np;
of_node_clear_flag(np, OF_DETACHED);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
__of_attach_node_sysfs(np);
}
/**
* of_attach_node() - Plug a device node into the tree and global list.
* @np: Pointer to the caller's Device Node
*/
int of_attach_node(struct device_node *np)
{
struct of_reconfig_data rd;
memset(&rd, 0, sizeof(rd));
rd.dn = np;
mutex_lock(&of_mutex);
__of_attach_node(np);
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/device.h`, `linux/of.h`, `linux/spinlock.h`, `linux/slab.h`, `linux/string.h`, `linux/proc_fs.h`, `of_private.h`.
- Detected declarations: `function of_node_get`, `function of_node_put`, `function of_reconfig_notifier_register`, `function of_reconfig_notifier_unregister`, `function of_property_status_ok`, `function of_reconfig_notify`, `function of_reconfig_get_state_change`, `function of_property_notify`, `function __of_attach_node`, `function of_attach_node`.
- Atlas domain: Driver Families / drivers/of.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.