Skip to content

Kernel Driver API Reference

This section collects Linux kernel APIs used by the character driver, blocking I/O, pollable driver, fasync/SIGIO, GPIO, and IRQ labs.

Character Device Registration

API Purpose
file_operations Define VFS callbacks for a character device
alloc_chrdev_region Allocate a dynamic device number range
cdev_add Register a character device with the VFS
class_create Create a sysfs class for device nodes
device_create Create a device object and /dev node
misc_register Register a simple misc character device

User Access and Control Plane

API Purpose
copy_to_user Copy data from kernel to user space
copy_from_user Copy data from user space to kernel
ioctl Implement command-based control plane
sysfs attributes Expose simple device attributes

Blocking I/O and Event Notification

API Purpose
wait queues Sleep until a condition becomes true
poll_wait Integrate driver readiness with poll/epoll
non-blocking I/O Implement O_NONBLOCK behavior
fasync_helper Register async notification ownership

Locking, GPIO, and IRQ

API Purpose
mutex Sleepable mutual exclusion
spinlock IRQ-safe short critical sections
devm_gpiod_get Get GPIO descriptors from Device Tree
devm_request_threaded_irq Register threaded IRQ handlers

Platform Driver Helpers