drivers/net/wan/framer/framer-core.c
Source file repositories/reference/linux-study-clean/drivers/net/wan/framer/framer-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wan/framer/framer-core.c- Extension
.c- Size
- 23089 bytes
- Lines
- 874
- Domain
- Driver Families
- Bucket
- drivers/net
- 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/device.hlinux/framer/framer.hlinux/framer/framer-provider.hlinux/idr.hlinux/module.hlinux/notifier.hlinux/of.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/slab.h
Detected Declarations
function framer_pm_runtime_getfunction framer_pm_runtime_get_syncfunction framer_pm_runtime_putfunction framer_pm_runtime_put_syncfunction framer_power_onfunction framer_power_offfunction framer_initfunction framer_exitfunction framer_get_statusfunction framer_set_configfunction framer_get_configfunction framer_polling_workfunction framer_notifier_registerfunction framer_notifier_unregisterfunction list_for_each_entryfunction framer_putfunction framer_putfunction devm_framer_putfunction devm_framer_getfunction devm_framer_optional_getfunction framer_notify_status_workfunction framer_notify_status_changefunction framer_createfunction framer_destroyfunction devm_framer_destroyfunction devm_framer_createfunction framer_provider_simple_of_xlatefunction __framer_provider_of_registerfunction framer_provider_of_unregisterfunction devm_framer_provider_of_unregisterfunction __devm_framer_provider_of_registerfunction framer_releasefunction framer_core_initmodule init framer_core_initexport framer_pm_runtime_getexport framer_pm_runtime_get_syncexport framer_pm_runtime_putexport framer_pm_runtime_put_syncexport framer_initexport framer_exitexport framer_power_onexport framer_power_offexport framer_get_statusexport framer_set_configexport framer_get_configexport framer_notifier_registerexport framer_notifier_unregisterexport framer_get
Annotated Snippet
ret = device_add(&framer->dev);
if (ret)
goto put_dev;
if (pm_runtime_enabled(dev)) {
pm_runtime_enable(&framer->dev);
pm_runtime_no_callbacks(&framer->dev);
}
return framer;
put_dev:
put_device(&framer->dev); /* calls framer_release() which frees resources */
return ERR_PTR(ret);
free_framer:
kfree(framer);
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(framer_create);
/**
* framer_destroy() - destroy the framer
* @framer: the framer to be destroyed
*
* Called to destroy the framer.
*/
void framer_destroy(struct framer *framer)
{
/* polling_work should already be stopped but if framer_exit() was not
* called (bug), here it's the last time to do that ...
*/
cancel_delayed_work_sync(&framer->polling_work);
cancel_work_sync(&framer->notify_status_work);
pm_runtime_disable(&framer->dev);
device_unregister(&framer->dev); /* calls framer_release() which frees resources */
}
EXPORT_SYMBOL_GPL(framer_destroy);
static void devm_framer_destroy(struct device *dev, void *res)
{
struct framer *framer = *(struct framer **)res;
framer_destroy(framer);
}
/**
* devm_framer_create() - create a new framer
* @dev: device that is creating the new framer
* @node: device node of the framer
* @ops: function pointers for performing framer operations
*
* Creates a new framer device adding it to the framer class.
* While at that, it also associates the device with the framer using devres.
* On driver detach, release function is invoked on the devres data,
* then, devres data is freed.
*/
struct framer *devm_framer_create(struct device *dev, struct device_node *node,
const struct framer_ops *ops)
{
struct framer **ptr, *framer;
ptr = devres_alloc(devm_framer_destroy, sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return ERR_PTR(-ENOMEM);
framer = framer_create(dev, node, ops);
if (!IS_ERR(framer)) {
*ptr = framer;
devres_add(dev, ptr);
} else {
devres_free(ptr);
}
return framer;
}
EXPORT_SYMBOL_GPL(devm_framer_create);
/**
* framer_provider_simple_of_xlate() - returns the framer instance from framer provider
* @dev: the framer provider device (not used here)
* @args: of_phandle_args
*
* Intended to be used by framer provider for the common case where #framer-cells is
* 0. For other cases where #framer-cells is greater than '0', the framer provider
* should provide a custom of_xlate function that reads the *args* and returns
* the appropriate framer.
*/
struct framer *framer_provider_simple_of_xlate(struct device *dev,
const struct of_phandle_args *args)
Annotation
- Immediate include surface: `linux/device.h`, `linux/framer/framer.h`, `linux/framer/framer-provider.h`, `linux/idr.h`, `linux/module.h`, `linux/notifier.h`, `linux/of.h`, `linux/pm_runtime.h`.
- Detected declarations: `function framer_pm_runtime_get`, `function framer_pm_runtime_get_sync`, `function framer_pm_runtime_put`, `function framer_pm_runtime_put_sync`, `function framer_power_on`, `function framer_power_off`, `function framer_init`, `function framer_exit`, `function framer_get_status`, `function framer_set_config`.
- Atlas domain: Driver Families / drivers/net.
- 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.