drivers/staging/greybus/gbphy.h
Source file repositories/reference/linux-study-clean/drivers/staging/greybus/gbphy.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/greybus/gbphy.h- Extension
.h- Size
- 2946 bytes
- Lines
- 110
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- 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.
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct gbphy_devicestruct gbphy_device_idstruct gbphy_driverfunction gb_gbphy_set_datafunction module_gbphy_driverfunction gbphy_runtime_put_autosuspendfunction gbphy_runtime_get_noresumefunction gbphy_runtime_put_noidlefunction gbphy_runtime_get_syncfunction gbphy_runtime_put_autosuspend
Annotated Snippet
struct device_driver driver;
};
#define to_gbphy_driver(d) container_of(d, struct gbphy_driver, driver)
int gb_gbphy_register_driver(struct gbphy_driver *driver,
struct module *owner, const char *mod_name);
void gb_gbphy_deregister_driver(struct gbphy_driver *driver);
#define gb_gbphy_register(driver) \
gb_gbphy_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
#define gb_gbphy_deregister(driver) \
gb_gbphy_deregister_driver(driver)
/**
* module_gbphy_driver() - Helper macro for registering a gbphy driver
* @__gbphy_driver: gbphy_driver structure
*
* Helper macro for gbphy drivers to set up proper module init / exit
* functions. Replaces module_init() and module_exit() and keeps people from
* printing pointless things to the kernel log when their driver is loaded.
*/
#define module_gbphy_driver(__gbphy_driver) \
module_driver(__gbphy_driver, gb_gbphy_register, gb_gbphy_deregister)
#ifdef CONFIG_PM
static inline int gbphy_runtime_get_sync(struct gbphy_device *gbphy_dev)
{
struct device *dev = &gbphy_dev->dev;
int ret;
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
dev_err(dev, "pm_runtime_get_sync failed: %d\n", ret);
pm_runtime_put_noidle(dev);
return ret;
}
return 0;
}
static inline void gbphy_runtime_put_autosuspend(struct gbphy_device *gbphy_dev)
{
struct device *dev = &gbphy_dev->dev;
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
}
static inline void gbphy_runtime_get_noresume(struct gbphy_device *gbphy_dev)
{
pm_runtime_get_noresume(&gbphy_dev->dev);
}
static inline void gbphy_runtime_put_noidle(struct gbphy_device *gbphy_dev)
{
pm_runtime_put_noidle(&gbphy_dev->dev);
}
#else
static inline int gbphy_runtime_get_sync(struct gbphy_device *gbphy_dev) { return 0; }
static inline void gbphy_runtime_put_autosuspend(struct gbphy_device *gbphy_dev) {}
static inline void gbphy_runtime_get_noresume(struct gbphy_device *gbphy_dev) {}
static inline void gbphy_runtime_put_noidle(struct gbphy_device *gbphy_dev) {}
#endif
#endif /* __GBPHY_H */
Annotation
- Detected declarations: `struct gbphy_device`, `struct gbphy_device_id`, `struct gbphy_driver`, `function gb_gbphy_set_data`, `function module_gbphy_driver`, `function gbphy_runtime_put_autosuspend`, `function gbphy_runtime_get_noresume`, `function gbphy_runtime_put_noidle`, `function gbphy_runtime_get_sync`, `function gbphy_runtime_put_autosuspend`.
- Atlas domain: Driver Families / drivers/staging.
- 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.