drivers/gpu/host1x/bus.c
Source file repositories/reference/linux-study-clean/drivers/gpu/host1x/bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/host1x/bus.c- Extension
.c- Size
- 25489 bytes
- Lines
- 1022
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/dma-mapping.hlinux/host1x.hlinux/of.hlinux/seq_file.hlinux/slab.hlinux/of_device.hbus.hdev.h
Detected Declarations
struct host1x_subdevfunction host1x_subdev_addfunction host1x_subdev_delfunction host1x_device_parse_dtfunction for_each_child_of_node_scopedfunction host1x_subdev_registerfunction __host1x_subdev_unregisterfunction host1x_subdev_unregisterfunction host1x_device_initfunction list_for_each_entryfunction list_for_each_entryfunction host1x_device_exitfunction list_for_each_entry_reversefunction list_for_each_entry_reversefunction host1x_add_clientfunction list_for_each_entryfunction host1x_del_clientfunction list_for_each_entry_safefunction host1x_device_matchfunction host1x_device_ueventfunction host1x_device_probefunction host1x_device_removefunction host1x_device_shutdownfunction __host1x_device_delfunction host1x_device_releasefunction host1x_device_addfunction list_for_each_entry_safefunction host1x_device_delfunction host1x_attach_driverfunction list_for_each_entryfunction host1x_detach_driverfunction host1x_devices_showfunction list_for_each_entryfunction host1x_registerfunction host1x_unregisterfunction host1x_driver_register_fullfunction host1x_driver_unregisterfunction __host1x_client_initfunction host1x_client_exitfunction __host1x_client_registerfunction list_for_each_entryfunction host1x_client_unregisterfunction list_for_each_entryfunction list_for_each_entryfunction host1x_client_suspendfunction host1x_client_resumefunction host1x_bo_pinfunction list_for_each_entry
Annotated Snippet
static int host1x_device_match(struct device *dev, const struct device_driver *drv)
{
return strcmp(dev_name(dev), drv->name) == 0;
}
/*
* Note that this is really only needed for backwards compatibility
* with libdrm, which parses this information from sysfs and will
* fail if it can't find the OF_FULLNAME, specifically.
*/
static int host1x_device_uevent(const struct device *dev,
struct kobj_uevent_env *env)
{
of_device_uevent(dev->parent, env);
return 0;
}
static int host1x_device_probe(struct device *dev)
{
struct host1x_driver *driver = to_host1x_driver(dev->driver);
struct host1x_device *device = to_host1x_device(dev);
if (driver->probe)
return driver->probe(device);
return 0;
}
static void host1x_device_remove(struct device *dev)
{
struct host1x_driver *driver = to_host1x_driver(dev->driver);
struct host1x_device *device = to_host1x_device(dev);
if (driver->remove)
driver->remove(device);
}
static void host1x_device_shutdown(struct device *dev)
{
struct host1x_driver *driver = to_host1x_driver(dev->driver);
struct host1x_device *device = to_host1x_device(dev);
if (dev->driver && driver->shutdown)
driver->shutdown(device);
}
static const struct dev_pm_ops host1x_device_pm_ops = {
.suspend = pm_generic_suspend,
.resume = pm_generic_resume,
.freeze = pm_generic_freeze,
.thaw = pm_generic_thaw,
.poweroff = pm_generic_poweroff,
.restore = pm_generic_restore,
};
const struct bus_type host1x_bus_type = {
.name = "host1x",
.match = host1x_device_match,
.uevent = host1x_device_uevent,
.probe = host1x_device_probe,
.remove = host1x_device_remove,
.shutdown = host1x_device_shutdown,
.pm = &host1x_device_pm_ops,
};
static void __host1x_device_del(struct host1x_device *device)
{
struct host1x_subdev *subdev, *sd;
struct host1x_client *client, *cl;
mutex_lock(&device->subdevs_lock);
/* unregister subdevices */
list_for_each_entry_safe(subdev, sd, &device->active, list) {
/*
* host1x_subdev_unregister() will remove the client from
* any lists, so we'll need to manually add it back to the
* list of idle clients.
*
* XXX: Alternatively, perhaps don't remove the client from
* any lists in host1x_subdev_unregister() and instead do
* that explicitly from host1x_unregister_client()?
*/
client = subdev->client;
__host1x_subdev_unregister(device, subdev);
/* add the client to the list of idle clients */
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/dma-mapping.h`, `linux/host1x.h`, `linux/of.h`, `linux/seq_file.h`, `linux/slab.h`, `linux/of_device.h`, `bus.h`.
- Detected declarations: `struct host1x_subdev`, `function host1x_subdev_add`, `function host1x_subdev_del`, `function host1x_device_parse_dt`, `function for_each_child_of_node_scoped`, `function host1x_subdev_register`, `function __host1x_subdev_unregister`, `function host1x_subdev_unregister`, `function host1x_device_init`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.