drivers/net/can/c_can/c_can_main.c
Source file repositories/reference/linux-study-clean/drivers/net/can/c_can/c_can_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/can/c_can/c_can_main.c- Extension
.c- Size
- 35781 bytes
- Lines
- 1393
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/interrupt.hlinux/delay.hlinux/netdevice.hlinux/if_arp.hlinux/if_ether.hlinux/list.hlinux/io.hlinux/pm_runtime.hlinux/pinctrl/consumer.hlinux/can.hlinux/can/dev.hlinux/can/error.hc_can.h
Detected Declarations
enum c_can_lec_typeenum c_can_bus_error_typesfunction c_can_pm_runtime_get_syncfunction c_can_pm_runtime_put_syncfunction c_can_reset_ramfunction c_can_irq_controlfunction c_can_obj_updatefunction c_can_object_getfunction c_can_object_putfunction c_can_inval_tx_objectfunction c_can_inval_msg_objectfunction c_can_setup_tx_objectfunction c_can_handle_lost_msg_objfunction c_can_read_msg_objectfunction c_can_setup_receive_objectfunction c_can_tx_busyfunction c_can_start_xmitfunction c_can_wait_for_ctrl_initfunction c_can_set_bittimingfunction c_can_configure_msg_objectsfunction c_can_software_resetfunction c_can_chip_configfunction c_can_startfunction c_can_stopfunction c_can_set_modefunction __c_can_get_berr_counterfunction c_can_get_berr_counterfunction c_can_do_txfunction c_can_adjust_pendingfunction c_can_rx_object_getfunction c_can_rx_finalizefunction c_can_read_objectsfunction c_can_get_pendingfunction freefunction c_can_handle_state_changefunction c_can_handle_bus_errfunction c_can_pollfunction c_can_isrfunction c_can_openfunction c_can_closefunction c_can_power_downfunction c_can_power_upfunction free_c_can_devfunction register_c_can_devfunction unregister_c_can_devexport alloc_c_can_devexport c_can_power_downexport c_can_power_up
Annotated Snippet
static const struct net_device_ops c_can_netdev_ops = {
.ndo_open = c_can_open,
.ndo_stop = c_can_close,
.ndo_start_xmit = c_can_start_xmit,
};
int register_c_can_dev(struct net_device *dev)
{
/* Deactivate pins to prevent DRA7 DCAN IP from being
* stuck in transition when module is disabled.
* Pins are activated in c_can_start() and deactivated
* in c_can_stop()
*/
pinctrl_pm_select_sleep_state(dev->dev.parent);
dev->flags |= IFF_ECHO; /* we support local echo */
dev->netdev_ops = &c_can_netdev_ops;
dev->ethtool_ops = &c_can_ethtool_ops;
return register_candev(dev);
}
EXPORT_SYMBOL_GPL(register_c_can_dev);
void unregister_c_can_dev(struct net_device *dev)
{
unregister_candev(dev);
}
EXPORT_SYMBOL_GPL(unregister_c_can_dev);
MODULE_AUTHOR("Bhupesh Sharma <bhupesh.sharma@st.com>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("CAN bus driver for Bosch C_CAN controller");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/netdevice.h`, `linux/if_arp.h`, `linux/if_ether.h`, `linux/list.h`.
- Detected declarations: `enum c_can_lec_type`, `enum c_can_bus_error_types`, `function c_can_pm_runtime_get_sync`, `function c_can_pm_runtime_put_sync`, `function c_can_reset_ram`, `function c_can_irq_control`, `function c_can_obj_update`, `function c_can_object_get`, `function c_can_object_put`, `function c_can_inval_tx_object`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.