drivers/peci/internal.h

Source file repositories/reference/linux-study-clean/drivers/peci/internal.h

File Facts

System
Linux kernel
Corpus path
drivers/peci/internal.h
Extension
.h
Size
5119 bytes
Lines
132
Domain
Driver Families
Bucket
drivers/peci
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.

Dependency Surface

Detected Declarations

Annotated Snippet

extern const struct bus_type peci_bus_type;
extern const struct attribute_group *peci_bus_groups[];

/**
 * struct peci_driver - PECI driver
 * @driver: inherit device driver
 * @probe: probe callback
 * @remove: remove callback
 * @id_table: PECI device match table to decide which device to bind
 */
struct peci_driver {
	struct device_driver driver;
	int (*probe)(struct peci_device *device, const struct peci_device_id *id);
	void (*remove)(struct peci_device *device);
	const struct peci_device_id *id_table;
};

#define to_peci_driver(__drv)	container_of_const(__drv, struct peci_driver, driver)

int __peci_driver_register(struct peci_driver *driver, struct module *owner,
			   const char *mod_name);
/**
 * peci_driver_register() - register PECI driver
 * @driver: the driver to be registered
 *
 * PECI drivers that don't need to do anything special in module init should
 * use the convenience "module_peci_driver" macro instead
 *
 * Return: zero on success, else a negative error code.
 */
#define peci_driver_register(driver) \
	__peci_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
void peci_driver_unregister(struct peci_driver *driver);

/**
 * module_peci_driver() - helper macro for registering a modular PECI driver
 * @__peci_driver: peci_driver struct
 *
 * Helper macro for PECI drivers which do not do anything special in module
 * init/exit. This eliminates a lot of boilerplate. Each module may only
 * use this macro once, and calling it replaces module_init() and module_exit()
 */
#define module_peci_driver(__peci_driver) \
	module_driver(__peci_driver, peci_driver_register, peci_driver_unregister)

extern const struct device_type peci_controller_type;

int peci_controller_scan_devices(struct peci_controller *controller);

#endif /* __PECI_INTERNAL_H */

Annotation

Implementation Notes