1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00

drm/client: Remove holds_console_lock parameter from suspend/resume

No caller of the client resume/suspend helpers holds the console
lock. The last such cases were removed from radeon in the patch
series at [1]. Now remove the related parameter and the TODO items.

v2:
- update placeholders for CONFIG_DRM_CLIENT=n

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/series/151624/ # [1]
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/20251001143709.419736-1-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann 2025-10-01 16:37:03 +02:00
parent b291e4f1a4
commit 7910d69376
11 changed files with 37 additions and 53 deletions

View File

@ -5212,7 +5212,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
dev_warn(adev->dev, "smart shift update failed\n");
if (notify_clients)
drm_client_dev_suspend(adev_to_drm(adev), false);
drm_client_dev_suspend(adev_to_drm(adev));
cancel_delayed_work_sync(&adev->delayed_init_work);
@ -5346,7 +5346,7 @@ exit:
flush_delayed_work(&adev->delayed_init_work);
if (notify_clients)
drm_client_dev_resume(adev_to_drm(adev), false);
drm_client_dev_resume(adev_to_drm(adev));
amdgpu_ras_resume(adev);
@ -5951,7 +5951,7 @@ int amdgpu_device_reinit_after_reset(struct amdgpu_reset_context *reset_context)
if (r)
goto out;
drm_client_dev_resume(adev_to_drm(tmp_adev), false);
drm_client_dev_resume(adev_to_drm(tmp_adev));
/*
* The GPU enters bad state once faulty pages
@ -6286,7 +6286,7 @@ static void amdgpu_device_halt_activities(struct amdgpu_device *adev,
*/
amdgpu_unregister_gpu_instance(tmp_adev);
drm_client_dev_suspend(adev_to_drm(tmp_adev), false);
drm_client_dev_suspend(adev_to_drm(tmp_adev));
/* disable ras on ALL IPs */
if (!need_emergency_restart && !amdgpu_reset_in_dpc(adev) &&

View File

@ -62,26 +62,20 @@ err_drm_err:
return ret;
}
static int drm_fbdev_client_suspend(struct drm_client_dev *client, bool holds_console_lock)
static int drm_fbdev_client_suspend(struct drm_client_dev *client)
{
struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
if (holds_console_lock)
drm_fb_helper_set_suspend(fb_helper, true);
else
drm_fb_helper_set_suspend_unlocked(fb_helper, true);
drm_fb_helper_set_suspend_unlocked(fb_helper, true);
return 0;
}
static int drm_fbdev_client_resume(struct drm_client_dev *client, bool holds_console_lock)
static int drm_fbdev_client_resume(struct drm_client_dev *client)
{
struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
if (holds_console_lock)
drm_fb_helper_set_suspend(fb_helper, false);
else
drm_fb_helper_set_suspend_unlocked(fb_helper, false);
drm_fb_helper_set_suspend_unlocked(fb_helper, false);
return 0;
}

View File

@ -319,7 +319,7 @@ static int drm_log_client_hotplug(struct drm_client_dev *client)
return 0;
}
static int drm_log_client_suspend(struct drm_client_dev *client, bool _console_lock)
static int drm_log_client_suspend(struct drm_client_dev *client)
{
struct drm_log *dlog = client_to_drm_log(client);
@ -328,7 +328,7 @@ static int drm_log_client_suspend(struct drm_client_dev *client, bool _console_l
return 0;
}
static int drm_log_client_resume(struct drm_client_dev *client, bool _console_lock)
static int drm_log_client_resume(struct drm_client_dev *client)
{
struct drm_log *dlog = client_to_drm_log(client);

View File

@ -122,7 +122,7 @@ void drm_client_dev_restore(struct drm_device *dev)
mutex_unlock(&dev->clientlist_mutex);
}
static int drm_client_suspend(struct drm_client_dev *client, bool holds_console_lock)
static int drm_client_suspend(struct drm_client_dev *client)
{
struct drm_device *dev = client->dev;
int ret = 0;
@ -131,7 +131,7 @@ static int drm_client_suspend(struct drm_client_dev *client, bool holds_console_
return 0;
if (client->funcs && client->funcs->suspend)
ret = client->funcs->suspend(client, holds_console_lock);
ret = client->funcs->suspend(client);
drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret);
client->suspended = true;
@ -139,20 +139,20 @@ static int drm_client_suspend(struct drm_client_dev *client, bool holds_console_
return ret;
}
void drm_client_dev_suspend(struct drm_device *dev, bool holds_console_lock)
void drm_client_dev_suspend(struct drm_device *dev)
{
struct drm_client_dev *client;
mutex_lock(&dev->clientlist_mutex);
list_for_each_entry(client, &dev->clientlist, list) {
if (!client->suspended)
drm_client_suspend(client, holds_console_lock);
drm_client_suspend(client);
}
mutex_unlock(&dev->clientlist_mutex);
}
EXPORT_SYMBOL(drm_client_dev_suspend);
static int drm_client_resume(struct drm_client_dev *client, bool holds_console_lock)
static int drm_client_resume(struct drm_client_dev *client)
{
struct drm_device *dev = client->dev;
int ret = 0;
@ -161,7 +161,7 @@ static int drm_client_resume(struct drm_client_dev *client, bool holds_console_l
return 0;
if (client->funcs && client->funcs->resume)
ret = client->funcs->resume(client, holds_console_lock);
ret = client->funcs->resume(client);
drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret);
client->suspended = false;
@ -172,14 +172,14 @@ static int drm_client_resume(struct drm_client_dev *client, bool holds_console_l
return ret;
}
void drm_client_dev_resume(struct drm_device *dev, bool holds_console_lock)
void drm_client_dev_resume(struct drm_device *dev)
{
struct drm_client_dev *client;
mutex_lock(&dev->clientlist_mutex);
list_for_each_entry(client, &dev->clientlist, list) {
if (client->suspended)
drm_client_resume(client, holds_console_lock);
drm_client_resume(client);
}
mutex_unlock(&dev->clientlist_mutex);
}

View File

@ -203,10 +203,10 @@ int drm_mode_config_helper_suspend(struct drm_device *dev)
if (dev->mode_config.poll_enabled)
drm_kms_helper_poll_disable(dev);
drm_client_dev_suspend(dev, false);
drm_client_dev_suspend(dev);
state = drm_atomic_helper_suspend(dev);
if (IS_ERR(state)) {
drm_client_dev_resume(dev, false);
drm_client_dev_resume(dev);
/*
* Don't enable polling if it was never initialized
@ -252,7 +252,7 @@ int drm_mode_config_helper_resume(struct drm_device *dev)
DRM_ERROR("Failed to resume (%d)\n", ret);
dev->mode_config.suspend_state = NULL;
drm_client_dev_resume(dev, false);
drm_client_dev_resume(dev);
/*
* Don't enable polling if it is not initialized

View File

@ -978,7 +978,7 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
intel_runtime_pm_disable(&i915->runtime_pm);
intel_power_domains_disable(display);
drm_client_dev_suspend(&i915->drm, false);
drm_client_dev_suspend(&i915->drm);
if (intel_display_device_present(display)) {
drm_kms_helper_poll_disable(&i915->drm);
intel_display_driver_disable_user_access(display);
@ -1061,7 +1061,7 @@ static int i915_drm_suspend(struct drm_device *dev)
/* We do a lot of poking in a lot of registers, make sure they work
* properly. */
intel_power_domains_disable(display);
drm_client_dev_suspend(dev, false);
drm_client_dev_suspend(dev);
if (intel_display_device_present(display)) {
drm_kms_helper_poll_disable(dev);
intel_display_driver_disable_user_access(display);
@ -1245,7 +1245,7 @@ static int i915_drm_resume(struct drm_device *dev)
intel_opregion_resume(display);
drm_client_dev_resume(dev, false);
drm_client_dev_resume(dev);
intel_power_domains_enable(display);

View File

@ -765,7 +765,7 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime)
{
struct nouveau_display *disp = nouveau_display(dev);
drm_client_dev_suspend(dev, false);
drm_client_dev_suspend(dev);
if (drm_drv_uses_atomic_modeset(dev)) {
if (!runtime) {
@ -796,7 +796,7 @@ nouveau_display_resume(struct drm_device *dev, bool runtime)
}
}
drm_client_dev_resume(dev, false);
drm_client_dev_resume(dev);
}
int

View File

@ -1635,7 +1635,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend,
}
if (notify_clients)
drm_client_dev_suspend(dev, false);
drm_client_dev_suspend(dev);
return 0;
}
@ -1739,7 +1739,7 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool notify_clients)
radeon_pm_compute_clocks(rdev);
if (notify_clients)
drm_client_dev_resume(dev, false);
drm_client_dev_resume(dev);
return 0;
}

View File

@ -324,7 +324,7 @@ void xe_display_pm_suspend(struct xe_device *xe)
* properly.
*/
intel_power_domains_disable(display);
drm_client_dev_suspend(&xe->drm, false);
drm_client_dev_suspend(&xe->drm);
if (intel_display_device_present(display)) {
drm_kms_helper_poll_disable(&xe->drm);
@ -356,7 +356,7 @@ void xe_display_pm_shutdown(struct xe_device *xe)
return;
intel_power_domains_disable(display);
drm_client_dev_suspend(&xe->drm, false);
drm_client_dev_suspend(&xe->drm);
if (intel_display_device_present(display)) {
drm_kms_helper_poll_disable(&xe->drm);
@ -481,7 +481,7 @@ void xe_display_pm_resume(struct xe_device *xe)
intel_opregion_resume(display);
drm_client_dev_resume(&xe->drm, false);
drm_client_dev_resume(&xe->drm);
intel_power_domains_enable(display);
}

View File

@ -70,13 +70,8 @@ struct drm_client_funcs {
* Called when suspending the device.
*
* This callback is optional.
*
* FIXME: Some callers hold the console lock when invoking this
* function. This interferes with fbdev emulation, which
* also tries to acquire the lock. Push the console lock
* into the callback and remove 'holds_console_lock'.
*/
int (*suspend)(struct drm_client_dev *client, bool holds_console_lock);
int (*suspend)(struct drm_client_dev *client);
/**
* @resume:
@ -84,13 +79,8 @@ struct drm_client_funcs {
* Called when resuming the device from suspend.
*
* This callback is optional.
*
* FIXME: Some callers hold the console lock when invoking this
* function. This interferes with fbdev emulation, which
* also tries to acquire the lock. Push the console lock
* into the callback and remove 'holds_console_lock'.
*/
int (*resume)(struct drm_client_dev *client, bool holds_console_lock);
int (*resume)(struct drm_client_dev *client);
};
/**

View File

@ -11,8 +11,8 @@ struct drm_device;
void drm_client_dev_unregister(struct drm_device *dev);
void drm_client_dev_hotplug(struct drm_device *dev);
void drm_client_dev_restore(struct drm_device *dev);
void drm_client_dev_suspend(struct drm_device *dev, bool holds_console_lock);
void drm_client_dev_resume(struct drm_device *dev, bool holds_console_lock);
void drm_client_dev_suspend(struct drm_device *dev);
void drm_client_dev_resume(struct drm_device *dev);
#else
static inline void drm_client_dev_unregister(struct drm_device *dev)
{ }
@ -20,9 +20,9 @@ static inline void drm_client_dev_hotplug(struct drm_device *dev)
{ }
static inline void drm_client_dev_restore(struct drm_device *dev)
{ }
static inline void drm_client_dev_suspend(struct drm_device *dev, bool holds_console_lock)
static inline void drm_client_dev_suspend(struct drm_device *dev)
{ }
static inline void drm_client_dev_resume(struct drm_device *dev, bool holds_console_lock)
static inline void drm_client_dev_resume(struct drm_device *dev)
{ }
#endif