include/linux/i3c/device.h
Source file repositories/reference/linux-study-clean/include/linux/i3c/device.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/i3c/device.h- Extension
.h- Size
- 10944 bytes
- Lines
- 368
- 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/bitops.hlinux/device.hlinux/i2c.hlinux/kconfig.hlinux/mod_devicetable.hlinux/module.h
Detected Declarations
struct i3c_xferstruct i3c_device_infostruct i3c_devicestruct i3c_driverstruct i3c_ibi_payloadstruct i3c_ibi_setupenum i3c_error_codeenum i3c_xfer_modeenum i3c_dcrfunction i3cdev_set_drvdatafunction module_i3c_driverfunction i3c_i2c_driver_unregisterfunction i3c_device_do_xfersfunction i3c_device_get_supported_xfer_mode
Annotated Snippet
struct device_driver driver;
int (*probe)(struct i3c_device *dev);
void (*remove)(struct i3c_device *dev);
const struct i3c_device_id *id_table;
};
#define drv_to_i3cdrv(__drv) container_of_const(__drv, struct i3c_driver, driver)
struct device *i3cdev_to_dev(struct i3c_device *i3cdev);
/**
* dev_to_i3cdev() - Returns the I3C device containing @dev
* @__dev: device object
*
* Return: a pointer to an I3C device object.
*/
#define dev_to_i3cdev(__dev) container_of_const(__dev, struct i3c_device, dev)
const struct i3c_device_id *
i3c_device_match_id(struct i3c_device *i3cdev,
const struct i3c_device_id *id_table);
static inline void i3cdev_set_drvdata(struct i3c_device *i3cdev,
void *data)
{
struct device *dev = i3cdev_to_dev(i3cdev);
dev_set_drvdata(dev, data);
}
static inline void *i3cdev_get_drvdata(struct i3c_device *i3cdev)
{
struct device *dev = i3cdev_to_dev(i3cdev);
return dev_get_drvdata(dev);
}
int i3c_driver_register_with_owner(struct i3c_driver *drv,
struct module *owner);
void i3c_driver_unregister(struct i3c_driver *drv);
#define i3c_driver_register(__drv) \
i3c_driver_register_with_owner(__drv, THIS_MODULE)
/**
* module_i3c_driver() - Register a module providing an I3C driver
* @__drv: the I3C driver to register
*
* Provide generic init/exit functions that simply register/unregister an I3C
* driver.
* Should be used by any driver that does not require extra init/cleanup steps.
*/
#define module_i3c_driver(__drv) \
module_driver(__drv, i3c_driver_register, i3c_driver_unregister)
/**
* i3c_i2c_driver_register() - Register an i2c and an i3c driver
* @i3cdrv: the I3C driver to register
* @i2cdrv: the I2C driver to register
*
* This function registers both @i2cdev and @i3cdev, and fails if one of these
* registrations fails. This is mainly useful for devices that support both I2C
* and I3C modes.
* Note that when CONFIG_I3C is not enabled, this function only registers the
* I2C driver.
*
* Return: 0 if both registrations succeeds, a negative error code otherwise.
*/
static __always_inline int i3c_i2c_driver_register(struct i3c_driver *i3cdrv,
struct i2c_driver *i2cdrv)
{
int ret;
ret = i2c_add_driver(i2cdrv);
if (ret || !IS_ENABLED(CONFIG_I3C))
return ret;
ret = i3c_driver_register(i3cdrv);
if (ret)
i2c_del_driver(i2cdrv);
return ret;
}
/**
* i3c_i2c_driver_unregister() - Unregister an i2c and an i3c driver
* @i3cdrv: the I3C driver to register
* @i2cdrv: the I2C driver to register
*
* This function unregisters both @i3cdrv and @i2cdrv.
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/device.h`, `linux/i2c.h`, `linux/kconfig.h`, `linux/mod_devicetable.h`, `linux/module.h`.
- Detected declarations: `struct i3c_xfer`, `struct i3c_device_info`, `struct i3c_device`, `struct i3c_driver`, `struct i3c_ibi_payload`, `struct i3c_ibi_setup`, `enum i3c_error_code`, `enum i3c_xfer_mode`, `enum i3c_dcr`, `function i3cdev_set_drvdata`.
- 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.