include/linux/serdev.h
Source file repositories/reference/linux-study-clean/include/linux/serdev.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/serdev.h- Extension
.h- Size
- 10346 bytes
- Lines
- 348
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/device.hlinux/iopoll.hlinux/uaccess.hlinux/termios.hlinux/delay.h
Detected Declarations
struct serdev_controllerstruct serdev_devicestruct serdev_device_opsstruct serdev_devicestruct serdev_device_driverstruct serdev_controller_opsstruct serdev_controllerstruct tty_portstruct tty_driverstruct acpi_resourcestruct acpi_resource_uart_serialbusenum serdev_parityfunction serdev_device_set_drvdatafunction serdev_device_putfunction serdev_device_set_client_opsfunction serdev_controller_set_drvdatafunction serdev_controller_putfunction serdev_controller_write_wakeupfunction serdev_controller_receive_buffunction serdev_device_driver_unregisterfunction serdev_device_openfunction serdev_device_closefunction serdev_device_set_flow_controlfunction serdev_device_wait_until_sentfunction serdev_device_set_tiocmfunction serdev_device_break_ctlfunction serdev_device_writefunction serdev_device_write_flushfunction serdev_device_wait_for_ctsfunction serdev_device_set_rtsfunction serdev_tty_port_unregisterfunction serdev_acpi_get_uart_resource
Annotated Snippet
struct device_driver driver;
int (*probe)(struct serdev_device *);
void (*remove)(struct serdev_device *);
void (*shutdown)(struct serdev_device *);
};
#define to_serdev_device_driver(d) container_of_const(d, struct serdev_device_driver, driver)
enum serdev_parity {
SERDEV_PARITY_NONE,
SERDEV_PARITY_EVEN,
SERDEV_PARITY_ODD,
};
/*
* serdev controller structures
*/
struct serdev_controller_ops {
ssize_t (*write_buf)(struct serdev_controller *, const u8 *, size_t);
void (*write_flush)(struct serdev_controller *);
int (*open)(struct serdev_controller *);
void (*close)(struct serdev_controller *);
void (*set_flow_control)(struct serdev_controller *, bool);
int (*set_parity)(struct serdev_controller *, enum serdev_parity);
unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int);
void (*wait_until_sent)(struct serdev_controller *, long);
int (*get_tiocm)(struct serdev_controller *);
int (*set_tiocm)(struct serdev_controller *, unsigned int, unsigned int);
int (*break_ctl)(struct serdev_controller *ctrl, unsigned int break_state);
};
/**
* struct serdev_controller - interface to the serdev controller
* @dev: Driver model representation of the device.
* @host: Serial port hardware controller device
* @nr: number identifier for this controller/bus.
* @serdev: Pointer to slave device for this controller.
* @ops: Controller operations.
*/
struct serdev_controller {
struct device dev;
struct device *host;
unsigned int nr;
struct serdev_device *serdev;
const struct serdev_controller_ops *ops;
};
#define to_serdev_controller(d) container_of_const(d, struct serdev_controller, dev)
static inline void *serdev_device_get_drvdata(const struct serdev_device *serdev)
{
return dev_get_drvdata(&serdev->dev);
}
static inline void serdev_device_set_drvdata(struct serdev_device *serdev, void *data)
{
dev_set_drvdata(&serdev->dev, data);
}
/**
* serdev_device_put() - decrement serdev device refcount
* @serdev: serdev device.
*/
static inline void serdev_device_put(struct serdev_device *serdev)
{
if (serdev)
put_device(&serdev->dev);
}
static inline void serdev_device_set_client_ops(struct serdev_device *serdev,
const struct serdev_device_ops *ops)
{
serdev->ops = ops;
}
static inline
void *serdev_controller_get_drvdata(const struct serdev_controller *ctrl)
{
return ctrl ? dev_get_drvdata(&ctrl->dev) : NULL;
}
static inline void serdev_controller_set_drvdata(struct serdev_controller *ctrl,
void *data)
{
dev_set_drvdata(&ctrl->dev, data);
}
/**
* serdev_controller_put() - decrement controller refcount
* @ctrl: serdev controller.
Annotation
- Immediate include surface: `linux/types.h`, `linux/device.h`, `linux/iopoll.h`, `linux/uaccess.h`, `linux/termios.h`, `linux/delay.h`.
- Detected declarations: `struct serdev_controller`, `struct serdev_device`, `struct serdev_device_ops`, `struct serdev_device`, `struct serdev_device_driver`, `struct serdev_controller_ops`, `struct serdev_controller`, `struct tty_port`, `struct tty_driver`, `struct acpi_resource`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
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.