include/linux/spi/spi.h
Source file repositories/reference/linux-study-clean/include/linux/spi/spi.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/spi/spi.h- Extension
.h- Size
- 65253 bytes
- Lines
- 1762
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bits.hlinux/completion.hlinux/device.hlinux/gpio/consumer.hlinux/kthread.hlinux/mod_devicetable.hlinux/overflow.hlinux/scatterlist.hlinux/slab.hlinux/u64_stats_sync.huapi/linux/spi/spi.h
Detected Declarations
struct dma_chanstruct software_nodestruct ptp_system_timestampstruct spi_controllerstruct spi_transferstruct spi_controller_mem_opsstruct spi_controller_mem_capsstruct spi_messagestruct spi_offloadstruct spi_offload_configstruct spi_statisticsstruct spi_delaystruct spi_devicestruct spi_driverstruct spi_controllerstruct spi_resstruct spi_transferstruct spi_messagestruct spi_message_with_transfersstruct spi_replaced_transfersstruct spi_replaced_transfersstruct spi_board_infofunction spi_dev_putfunction spi_set_ctldatafunction spi_set_drvdatafunction spi_get_chipselectfunction spi_set_chipselectfunction spi_set_csgpiodfunction spi_is_csgpiodfunction spi_unregister_driverfunction spi_controller_set_devdatafunction spi_controller_putfunction spi_controller_is_targetfunction acpi_spi_count_resourcesfunction spi_message_init_no_memsetfunction spi_message_initfunction spi_message_add_tailfunction spi_transfer_delfunction spi_transfer_delay_execfunction spi_message_init_with_transfersfunction spi_message_freefunction spi_max_message_sizefunction spi_max_transfer_sizefunction spi_is_bpw_supportedfunction Inputfunction spi_controller_xfer_timeoutfunction spi_syncfunction spi_write
Annotated Snippet
extern const struct bus_type spi_bus_type;
/**
* struct spi_statistics - statistics for spi transfers
* @syncp: seqcount to protect members in this struct for per-cpu update
* on 32-bit systems
*
* @messages: number of spi-messages handled
* @transfers: number of spi_transfers handled
* @errors: number of errors during spi_transfer
* @timedout: number of timeouts during spi_transfer
*
* @spi_sync: number of times spi_sync is used
* @spi_sync_immediate:
* number of times spi_sync is executed immediately
* in calling context without queuing and scheduling
* @spi_async: number of times spi_async is used
*
* @bytes: number of bytes transferred to/from device
* @bytes_tx: number of bytes sent to device
* @bytes_rx: number of bytes received from device
*
* @transfer_bytes_histo:
* transfer bytes histogram
*
* @transfers_split_maxsize:
* number of transfers that have been split because of
* maxsize limit
*/
struct spi_statistics {
struct u64_stats_sync syncp;
u64_stats_t messages;
u64_stats_t transfers;
u64_stats_t errors;
u64_stats_t timedout;
u64_stats_t spi_sync;
u64_stats_t spi_sync_immediate;
u64_stats_t spi_async;
u64_stats_t bytes;
u64_stats_t bytes_rx;
u64_stats_t bytes_tx;
#define SPI_STATISTICS_HISTO_SIZE 17
u64_stats_t transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE];
u64_stats_t transfers_split_maxsize;
};
#define SPI_STATISTICS_ADD_TO_FIELD(pcpu_stats, field, count) \
do { \
struct spi_statistics *__lstats; \
get_cpu(); \
__lstats = this_cpu_ptr(pcpu_stats); \
u64_stats_update_begin(&__lstats->syncp); \
u64_stats_add(&__lstats->field, count); \
u64_stats_update_end(&__lstats->syncp); \
put_cpu(); \
} while (0)
#define SPI_STATISTICS_INCREMENT_FIELD(pcpu_stats, field) \
do { \
struct spi_statistics *__lstats; \
get_cpu(); \
__lstats = this_cpu_ptr(pcpu_stats); \
u64_stats_update_begin(&__lstats->syncp); \
u64_stats_inc(&__lstats->field); \
u64_stats_update_end(&__lstats->syncp); \
put_cpu(); \
} while (0)
/**
* struct spi_delay - SPI delay information
* @value: Value for the delay
* @unit: Unit for the delay
*/
struct spi_delay {
#define SPI_DELAY_UNIT_USECS 0
#define SPI_DELAY_UNIT_NSECS 1
#define SPI_DELAY_UNIT_SCK 2
u16 value;
u8 unit;
};
extern int spi_delay_to_ns(struct spi_delay *_delay, struct spi_transfer *xfer);
extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer);
extern void spi_transfer_cs_change_delay_exec(struct spi_message *msg,
struct spi_transfer *xfer);
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/bits.h`, `linux/completion.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/kthread.h`, `linux/mod_devicetable.h`, `linux/overflow.h`.
- Detected declarations: `struct dma_chan`, `struct software_node`, `struct ptp_system_timestamp`, `struct spi_controller`, `struct spi_transfer`, `struct spi_controller_mem_ops`, `struct spi_controller_mem_caps`, `struct spi_message`, `struct spi_offload`, `struct spi_offload_config`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
- 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.