[PATCH] drm_fb_helper: Reduce duplicated execution of the drm_fb_helper_hotplug_event()

From: JaeJoon Jung
Date: Tue Mar 18 2025 - 01:47:18 EST


If drm_fb_helper->fb_info is already set,
Add an if condition as below to execute the hotplug event
only when the system_state is SYSTEM_RUNNING.
This will reduce duplicate execution.
In particular, It can prevent drm_fb_helper_hotplug_event()
from being executed repeatedly at booting time.

Signed-off-by: JaeJoon Jung <rgbi3307@xxxxxxxxx>
---
drivers/gpu/drm/drm_fb_helper.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index fb3614a7ba44..c042e5a2e046 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1939,6 +1939,9 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
if (!drm_fbdev_emulation || !fb_helper)
return 0;

+ if (fb_helper->info && system_state != SYSTEM_RUNNING)
+ return 0;
+
mutex_lock(&fb_helper->lock);
if (fb_helper->deferred_setup) {
err = __drm_fb_helper_initial_config_and_unlock(fb_helper);
--
2.43.0