drivers/net/can/xilinx_can.c
Source file repositories/reference/linux-study-clean/drivers/net/can/xilinx_can.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/can/xilinx_can.c- Extension
.c- Size
- 61870 bytes
- Lines
- 2118
- 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/bitfield.hlinux/clk.hlinux/errno.hlinux/ethtool.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/netdevice.hlinux/of.hlinux/platform_device.hlinux/property.hlinux/skbuff.hlinux/spinlock.hlinux/string.hlinux/types.hlinux/can/dev.hlinux/can/error.hlinux/phy/phy.hlinux/pm_runtime.hlinux/reset.hlinux/u64_stats_sync.h
Detected Declarations
struct xcan_devtype_datastruct xcan_privenum xcan_regenum xcan_ip_typeenum xcan_stats_typefunction xcan_write_reg_lefunction xcan_read_reg_lefunction xcan_write_reg_befunction xcan_read_reg_befunction xcan_rx_int_maskfunction set_reset_modefunction xcan_set_bittimingfunction xcan_chip_startfunction xcan_do_set_modefunction xcan_write_framefunction xcan_start_xmit_fifofunction xcan_start_xmit_mailboxfunction xcan_start_xmitfunction isrfunction isrfunction xcan_current_error_statefunction xcan_set_error_statefunction xcan_update_error_state_after_rxtxfunction xcan_err_interruptfunction xcan_state_interruptfunction xcan_rx_fifo_get_next_framefunction xcan_rx_pollfunction xcan_tx_interruptfunction satisfyfunction xcan_interruptfunction xcan_chip_stopfunction xcan_openfunction xcan_closefunction xcan_get_berr_counterfunction xcan_get_auto_tdcvfunction xcan_get_stringsfunction xcan_get_sset_countfunction xcan_get_ethtool_statsfunction xcan_suspendfunction xcan_resumefunction xcan_runtime_suspendfunction xcan_runtime_resumefunction xcan_probefunction xcan_remove
Annotated Snippet
static const struct net_device_ops xcan_netdev_ops = {
.ndo_open = xcan_open,
.ndo_stop = xcan_close,
.ndo_start_xmit = xcan_start_xmit,
};
static const struct ethtool_ops xcan_ethtool_ops = {
.get_ts_info = ethtool_op_get_ts_info,
.get_strings = xcan_get_strings,
.get_sset_count = xcan_get_sset_count,
.get_ethtool_stats = xcan_get_ethtool_stats,
};
/**
* xcan_suspend - Suspend method for the driver
* @dev: Address of the device structure
*
* Put the driver into low power mode.
* Return: 0 on success and failure value on error
*/
static int __maybe_unused xcan_suspend(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
if (netif_running(ndev)) {
netif_stop_queue(ndev);
netif_device_detach(ndev);
xcan_chip_stop(ndev);
}
return pm_runtime_force_suspend(dev);
}
/**
* xcan_resume - Resume from suspend
* @dev: Address of the device structure
*
* Resume operation after suspend.
* Return: 0 on success and failure value on error
*/
static int __maybe_unused xcan_resume(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
int ret;
ret = pm_runtime_force_resume(dev);
if (ret) {
dev_err(dev, "pm_runtime_force_resume failed on resume\n");
return ret;
}
if (netif_running(ndev)) {
ret = xcan_chip_start(ndev);
if (ret) {
dev_err(dev, "xcan_chip_start failed on resume\n");
return ret;
}
netif_device_attach(ndev);
netif_start_queue(ndev);
}
return 0;
}
/**
* xcan_runtime_suspend - Runtime suspend method for the driver
* @dev: Address of the device structure
*
* Put the driver into low power mode.
* Return: 0 always
*/
static int __maybe_unused xcan_runtime_suspend(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
struct xcan_priv *priv = netdev_priv(ndev);
clk_disable_unprepare(priv->bus_clk);
clk_disable_unprepare(priv->can_clk);
return 0;
}
/**
* xcan_runtime_resume - Runtime resume from suspend
* @dev: Address of the device structure
*
* Resume operation after suspend.
* Return: 0 on success and failure value on error
*/
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/errno.h`, `linux/ethtool.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`.
- Detected declarations: `struct xcan_devtype_data`, `struct xcan_priv`, `enum xcan_reg`, `enum xcan_ip_type`, `enum xcan_stats_type`, `function xcan_write_reg_le`, `function xcan_read_reg_le`, `function xcan_write_reg_be`, `function xcan_read_reg_be`, `function xcan_rx_int_mask`.
- 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.