FAILED: patch "[PATCH] auxdisplay: charlcd: cancel backlight work on registration" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x e3e3bf40916c1e810df03958cfa7ba6883cdce79
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090350-stencil-mud-1d68@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e3e3bf40916c1e810df03958cfa7ba6883cdce79 Mon Sep 17 00:00:00 2001
From: Hongyan Xu <[email protected]>
Date: Sat, 15 Aug 2026 18:59:50 +0800
Subject: [PATCH] auxdisplay: charlcd: cancel backlight work on registration
failure
With CONFIG_CHARLCD_BL_FLASH, charlcd_init() schedules bl_work before charlcd_register() calls misc_register(). If registration fails, the caller frees the charlcd object while delayed work still contains its address.
Add charlcd_deinit() to cancel the delayed work and turn the backlight off. Use it for both registration rollback and normal unregistration.
drivers/auxdisplay/charlcd.c +14 -7
@@ -595,6 +595,16 @@ static int charlcd_init(struct charlcd *lcd)return 0 ; } +static void charlcd_deinit (struct charlcd *lcd) +{ +struct charlcd_priv *priv =charlcd_to_priv (lcd); + +if (lcd->ops->backlight) { +cancel_delayed_work_sync (&priv->bl_work); + lcd->ops->backlight (lcd,CHARLCD_OFF ); + } +} +struct charlcd *charlcd_alloc (unsigned int drvdata_size) {struct charlcd_priv *priv;
@@ -654,8 +664,10 @@ int charlcd_register(struct charlcd *lcd)return ret; ret =misc_register (&charlcd_dev); -if (ret) +if (ret) { +charlcd_deinit (lcd);return ret; + } the_charlcd = lcd;register_reboot_notifier (&panel_notifier);
@@ -665,16 +677,11 @@ EXPORT_SYMBOL_GPL(charlcd_register);int charlcd_unregister (struct charlcd *lcd) { -struct charlcd_priv *priv =charlcd_to_priv (lcd); -unregister_reboot_notifier (&panel_notifier);charlcd_puts (lcd,"\x0cLCD driver unloaded.\x1b[Lc\x1b[Lb\x1b[L-" );misc_deregister (&charlcd_dev); the_charlcd =NULL ; -if (lcd->ops->backlight) { -cancel_delayed_work_sync (&priv->bl_work); - priv->lcd.ops->backlight (&priv->lcd,CHARLCD_OFF ); - } +charlcd_deinit (lcd);return 0 ; }
Sasha Levin
maintainerPATCH 1/2 auxdisplay: Move init_display to hd44780_common
From: Lars Poeschel <[email protected]>
[ Upstream commit 01ec46dfa633a52ccfe38d4a194460d6adb2ba00 ]
The init_display function is moved over to hd44780_common. charlcd uses it via its ops function pointer and drivers initialize the ops with the common hd44780_common_init_display function.
[ stable 5.10: The hd44780_common infrastructure and the prerequisite
refactoring series are not present. Drop the init_display move and carry only the charlcd backlight enum normalization needed by the follow-up fix. ]
[ sashal: Reduced backport -- upstream 01ec46dfa633a touches 6 file(s), this
backport carries 2. Not backported here:
drivers/auxdisplay/hd44780.c drivers/auxdisplay/hd44780_common.c drivers/auxdisplay/hd44780_common.h
drivers/auxdisplay/panel.c
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: e3e3bf40916c ("auxdisplay: charlcd: cancel backlight work on registration failure")
--- drivers/auxdisplay/charlcd.c | 6 +++--- drivers/auxdisplay/charlcd.h | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/auxdisplay/charlcd.c +3 -3
@@ -124,7 +124,7 @@ static void charlcd_bl_off(struct work_struct *work)if (priv->bl_tempo) { priv->bl_tempo = false;if (!(priv->flags &LCD_FLAG_L )) - priv->lcd.ops->backlight (&priv->lcd,0 ); + priv->lcd.ops->backlight (&priv->lcd,CHARLCD_OFF ); }mutex_unlock (&priv->bl_tempo_lock); }
@@ -141,7 +141,7 @@ void charlcd_poke(struct charlcd *lcd)mutex_lock (&priv->bl_tempo_lock);if (!priv->bl_tempo && !(priv->flags &LCD_FLAG_L )) - lcd->ops->backlight (lcd,1 ); + lcd->ops->backlight (lcd,CHARLCD_ON ); priv->bl_tempo = true;schedule_delayed_work (&priv->bl_work,LCD_BL_TEMPO_PERIOD *HZ );mutex_unlock (&priv->bl_tempo_lock);
@@ -862,7 +862,7 @@ int charlcd_unregister(struct charlcd *lcd) the_charlcd =NULL ;if (lcd->ops->backlight) {cancel_delayed_work_sync (&priv->bl_work); - priv->lcd.ops->backlight (&priv->lcd,0 ); + priv->lcd.ops->backlight (&priv->lcd,CHARLCD_OFF ); }return 0 ;
drivers/auxdisplay/charlcd.h +5 -0
@@ -9,6 +9,11 @@ #ifndef _CHARLCD_H #define _CHARLCD_H +enum charlcd_onoff { + CHARLCD_OFF = 0, + CHARLCD_ON, +}; + struct charlcd { const struct charlcd_ops *ops; const unsigned char *char_conv; /* Optional */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 auxdisplay: charlcd: cancel backlight work on registration failure
From: Hongyan Xu <[email protected]>
[ Upstream commit e3e3bf40916c1e810df03958cfa7ba6883cdce79 ]
With CONFIG_CHARLCD_BL_FLASH, charlcd_init() schedules bl_work before charlcd_register() calls misc_register(). If registration fails, the caller frees the charlcd object while delayed work still contains its address.
Add charlcd_deinit() to cancel the delayed work and turn the backlight off. Use it for both registration rollback and normal unregistration.
--- drivers/auxdisplay/charlcd.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/auxdisplay/charlcd.c +14 -7
@@ -779,6 +779,16 @@ static int charlcd_init(struct charlcd *lcd)return 0 ; } +static void charlcd_deinit (struct charlcd *lcd) +{ +struct charlcd_priv *priv =charlcd_to_priv (lcd); + +if (lcd->ops->backlight) { +cancel_delayed_work_sync (&priv->bl_work); + lcd->ops->backlight (lcd,CHARLCD_OFF ); + } +} +struct charlcd *charlcd_alloc (unsigned int drvdata_size) {struct charlcd_priv *priv;
@@ -843,8 +853,10 @@ int charlcd_register(struct charlcd *lcd)return ret; ret =misc_register (&charlcd_dev); -if (ret) +if (ret) { +charlcd_deinit (lcd);return ret; + } the_charlcd = lcd;register_reboot_notifier (&panel_notifier);
@@ -854,16 +866,11 @@ EXPORT_SYMBOL_GPL(charlcd_register);int charlcd_unregister (struct charlcd *lcd) { -struct charlcd_priv *priv =charlcd_to_priv (lcd); -unregister_reboot_notifier (&panel_notifier);charlcd_puts (lcd,"\x0cLCD driver unloaded.\x1b[Lc\x1b[Lb\x1b[L-" );misc_deregister (&charlcd_dev); the_charlcd =NULL ; -if (lcd->ops->backlight) { -cancel_delayed_work_sync (&priv->bl_work); - priv->lcd.ops->backlight (&priv->lcd,CHARLCD_OFF ); - } +charlcd_deinit (lcd);return 0 ; }
Signature · 1 line
2.53.0