drivers/gpu/drm/drm_client_event.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_client_event.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_client_event.c- Extension
.c- Size
- 5343 bytes
- Lines
- 215
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/list.hlinux/mutex.hlinux/seq_file.hdrm/drm_client.hdrm/drm_client_event.hdrm/drm_debugfs.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_print.hdrm_internal.h
Detected Declarations
function drm_dev_unregisterfunction drm_client_hotplugfunction drm_kms_helper_hotplug_eventfunction drm_client_dev_restorefunction drm_client_suspendfunction drm_client_dev_suspendfunction drm_client_resumefunction drm_client_dev_resumefunction drm_client_debugfs_internal_clientsfunction drm_client_debugfs_initexport drm_client_dev_unregisterexport drm_client_dev_hotplugexport drm_client_dev_suspendexport drm_client_dev_resume
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0 or MIT
/*
* Copyright 2018 Noralf Trønnes
*/
#include <linux/export.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/seq_file.h>
#include <drm/drm_client.h>
#include <drm/drm_client_event.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_device.h>
#include <drm/drm_drv.h>
#include <drm/drm_print.h>
#include "drm_internal.h"
/**
* drm_client_dev_unregister - Unregister clients
* @dev: DRM device
*
* This function releases all clients by calling each client's
* &drm_client_funcs.unregister callback. The callback function
* is responsibe for releaseing all resources including the client
* itself.
*
* The helper drm_dev_unregister() calls this function. Drivers
* that use it don't need to call this function themselves.
*/
void drm_client_dev_unregister(struct drm_device *dev)
{
struct drm_client_dev *client, *tmp;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return;
mutex_lock(&dev->clientlist_mutex);
list_for_each_entry_safe(client, tmp, &dev->clientlist, list) {
list_del(&client->list);
/*
* Unregistering consumes and frees the client.
*/
if (client->funcs && client->funcs->unregister)
client->funcs->unregister(client);
else
drm_client_release(client);
}
mutex_unlock(&dev->clientlist_mutex);
}
EXPORT_SYMBOL(drm_client_dev_unregister);
static void drm_client_hotplug(struct drm_client_dev *client)
{
struct drm_device *dev = client->dev;
int ret;
if (!client->funcs || !client->funcs->hotplug)
return;
if (client->hotplug_failed)
return;
if (client->suspended) {
client->hotplug_pending = true;
return;
}
client->hotplug_pending = false;
ret = client->funcs->hotplug(client);
drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret);
if (ret)
client->hotplug_failed = true;
}
/**
* drm_client_dev_hotplug - Send hotplug event to clients
* @dev: DRM device
*
* This function calls the &drm_client_funcs.hotplug callback on the attached clients.
*
* drm_kms_helper_hotplug_event() calls this function, so drivers that use it
* don't need to call this function themselves.
*/
void drm_client_dev_hotplug(struct drm_device *dev)
{
struct drm_client_dev *client;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
Annotation
- Immediate include surface: `linux/export.h`, `linux/list.h`, `linux/mutex.h`, `linux/seq_file.h`, `drm/drm_client.h`, `drm/drm_client_event.h`, `drm/drm_debugfs.h`, `drm/drm_device.h`.
- Detected declarations: `function drm_dev_unregister`, `function drm_client_hotplug`, `function drm_kms_helper_hotplug_event`, `function drm_client_dev_restore`, `function drm_client_suspend`, `function drm_client_dev_suspend`, `function drm_client_resume`, `function drm_client_dev_resume`, `function drm_client_debugfs_internal_clients`, `function drm_client_debugfs_init`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.