drivers/reset/core.c
Source file repositories/reference/linux-study-clean/drivers/reset/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/reset/core.c- Extension
.c- Size
- 41159 bytes
- Lines
- 1607
- Domain
- Driver Families
- Bucket
- drivers/reset
- 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/acpi.hlinux/atomic.hlinux/auxiliary_bus.hlinux/cleanup.hlinux/device.hlinux/err.hlinux/export.hlinux/fwnode.hlinux/gpio/driver.hlinux/gpio/machine.hlinux/gpio/property.hlinux/idr.hlinux/kernel.hlinux/kref.hlinux/module.hlinux/of.hlinux/property.hlinux/reset.hlinux/reset-controller.hlinux/slab.hlinux/srcu.h
Detected Declarations
struct reset_controlstruct reset_control_arraystruct reset_gpio_lookupstruct reset_control_bulk_devresfunction fwnode_reset_simple_xlatefunction reset_controller_registerfunction reset_controller_removefunction reset_controller_unregisterfunction scoped_guardfunction devm_reset_controller_releasefunction reset_controller_registerfunction rstc_to_arrayfunction reset_control_array_resetfunction reset_control_array_rearmfunction reset_control_array_assertfunction reset_control_array_deassertfunction reset_control_array_acquirefunction reset_control_array_releasefunction reset_control_is_arrayfunction reset_control_function reset_control_bulk_resetfunction reset_control_function reset_control_function reset_control_bulk_assertfunction reset_control_function reset_control_bulk_deassertfunction NULLfunction reset_control_acquirefunction scoped_guardfunction reset_control_bulk_get_exclusive_releasefunction reset_control_releasefunction reset_control_bulk_releasefunction __reset_control_get_internalfunction list_for_each_entryfunction __reset_control_releasefunction reset_control_put_internalfunction scoped_guardfunction reset_gpio_aux_device_releasefunction reset_create_gpio_aux_devicefunction reset_gpio_add_devlinkfunction fwnode_reference_args_equalfunction __reset_add_reset_gpio_devicefunction list_for_each_entryfunction __reset_find_rcdevfunction list_for_each_entryfunction __fwnode_reset_control_getfunction __reset_control_bulk_getfunction reset_control_array_put
Annotated Snippet
struct reset_control {
struct reset_controller_dev __rcu *rcdev;
struct srcu_struct srcu;
struct list_head list;
unsigned int id;
struct kref refcnt;
bool acquired;
bool shared;
bool array;
atomic_t deassert_count;
atomic_t triggered_count;
struct mutex lock;
};
/**
* struct reset_control_array - an array of reset controls
* @base: reset control for compatibility with reset control API functions
* @num_rstcs: number of reset controls
* @rstc: array of reset controls
*/
struct reset_control_array {
struct reset_control base;
unsigned int num_rstcs;
struct reset_control *rstc[] __counted_by(num_rstcs);
};
/**
* struct reset_gpio_lookup - lookup key for ad-hoc created reset-gpio devices
* @ref_args: Reference to the reset controller with all the args like GPIO number
* @swnode: Software node containing the reference to the GPIO provider
* @list: list entry for the reset_gpio_lookup_list
* @adev: Auxiliary device representing the reset controller
*/
struct reset_gpio_lookup {
struct fwnode_reference_args ref_args;
struct fwnode_handle *swnode;
struct list_head list;
struct auxiliary_device adev;
};
static const char *rcdev_name(struct reset_controller_dev *rcdev)
{
if (rcdev->dev)
return dev_name(rcdev->dev);
if (rcdev->fwnode)
return fwnode_get_name(rcdev->fwnode);
return NULL;
}
/**
* fwnode_reset_simple_xlate - translate reset_spec to the reset line number
* @rcdev: a pointer to the reset controller device
* @reset_spec: reset line specifier as found in firmware
*
* This static translation function is used by default if neither fwnode_xlate
* not of_xlate in :c:type:`reset_controller_dev` is not set. It is useful for
* all reset controllers with 1:1 mapping, where reset lines can be indexed by
* number without gaps.
*/
static int fwnode_reset_simple_xlate(struct reset_controller_dev *rcdev,
const struct fwnode_reference_args *reset_spec)
{
if (reset_spec->args[0] >= rcdev->nr_resets)
return -EINVAL;
return reset_spec->args[0];
}
/**
* reset_controller_register - register a reset controller device
* @rcdev: a pointer to the initialized reset controller device
*/
int reset_controller_register(struct reset_controller_dev *rcdev)
{
if ((rcdev->of_node && rcdev->fwnode) || (rcdev->of_xlate && rcdev->fwnode_xlate))
return -EINVAL;
if (rcdev->of_node && !rcdev->fwnode)
rcdev->fwnode = of_fwnode_handle(rcdev->of_node);
if (!rcdev->fwnode) {
rcdev->fwnode = dev_fwnode(rcdev->dev);
if (!rcdev->fwnode)
return -EINVAL;
}
if (rcdev->of_xlate)
rcdev->fwnode_reset_n_cells = rcdev->of_reset_n_cells;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/atomic.h`, `linux/auxiliary_bus.h`, `linux/cleanup.h`, `linux/device.h`, `linux/err.h`, `linux/export.h`, `linux/fwnode.h`.
- Detected declarations: `struct reset_control`, `struct reset_control_array`, `struct reset_gpio_lookup`, `struct reset_control_bulk_devres`, `function fwnode_reset_simple_xlate`, `function reset_controller_register`, `function reset_controller_remove`, `function reset_controller_unregister`, `function scoped_guard`, `function devm_reset_controller_release`.
- Atlas domain: Driver Families / drivers/reset.
- 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.