From: Matthias Goergens <matthias.goergens@gmail.com>
To: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/3] fbdev: pxafb: stop the smart-panel thread
Date: Mon, 2 Nov 2026 16:03:31 +0800 [thread overview]
Message-ID: <20261102080332.1466689-3-matthias.goergens@gmail.com> (raw)
In-Reply-To: <20261102080332.1466689-1-matthias.goergens@gmail.com>
pxafb_smart_init() starts the smart-panel refresh thread, but nothing
ever stops it: neither pxafb_remove() nor the probe error paths that
run after it. The thread then keeps running on the devm-allocated
struct pxafb_info after it has been freed.
Stop the thread on removal, after pxafb_disable_controller(), which
waits for a refresh that only the thread signals, and on those probe
error paths.
A thread that has already exited must not be passed to kthread_stop()
unless the caller holds a reference to its task_struct (see the comment
above kthread_stop()). This thread returns at once when the board
provides no smart_update callback, so check for the callback in
pxafb_smart_init() before starting the thread. Probe now fails with
-EINVAL in that case, instead of succeeding with a smart panel that is
never refreshed.
This needs CONFIG_FB_PXA_SMARTPANEL and a board with a smart panel; I
found no in-tree board that provides smart_update. Sashiko, the AI
review bot, pointed this out while reviewing a pxafb cleanup. I have
no PXA hardware; this is build-tested only.
Link: https://lore.kernel.org/all/20260722081427.413EF1F000E9@smtp.kernel.org/
Fixes: 3c42a449107b ("pxafb: preliminary smart panel interface support")
Fixes: 9f17f2874834 ("[ARM] 5118/1: pxafb: add exit and remove handlers")
Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com>
---
drivers/video/fbdev/pxafb.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 4f5c408eae56..b889a17e7304 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -1248,12 +1248,6 @@ static int pxafb_smart_thread(void *arg)
struct pxafb_info *fbi = arg;
struct pxafb_mach_info *inf = fbi->inf;
- if (!inf->smart_update) {
- pr_err("%s: not properly initialized, thread terminated\n",
- __func__);
- return -EINVAL;
- }
-
pr_debug("%s(): task starting\n", __func__);
set_freezable();
@@ -1290,6 +1284,9 @@ static int pxafb_smart_init(struct pxafb_info *fbi)
init_completion(&fbi->command_done);
init_completion(&fbi->refresh_done);
+ if (!fbi->inf->smart_update)
+ return -EINVAL;
+
fbi->smart_thread = kthread_run(pxafb_smart_thread, fbi,
"lcd_refresh");
if (IS_ERR(fbi->smart_thread)) {
@@ -1299,8 +1296,15 @@ static int pxafb_smart_init(struct pxafb_info *fbi)
return 0;
}
+
+static void pxafb_smart_exit(struct pxafb_info *fbi)
+{
+ if (!IS_ERR_OR_NULL(fbi->smart_thread))
+ kthread_stop(fbi->smart_thread);
+}
#else
static inline int pxafb_smart_init(struct pxafb_info *fbi) { return 0; }
+static inline void pxafb_smart_exit(struct pxafb_info *fbi) { }
#endif /* CONFIG_FB_PXA_SMARTPANEL */
static void setup_parallel_timing(struct pxafb_info *fbi,
@@ -2366,6 +2370,7 @@ static int pxafb_probe(struct platform_device *dev)
if (fbi->fb.cmap.len)
fb_dealloc_cmap(&fbi->fb.cmap);
failed_free_mem:
+ pxafb_smart_exit(fbi);
free_pages_exact(fbi->video_mem, fbi->video_mem_size);
failed_free_dma:
dma_free_coherent(&dev->dev, fbi->dma_buff_size,
@@ -2393,6 +2398,7 @@ static void pxafb_remove(struct platform_device *dev)
unregister_framebuffer(info);
pxafb_disable_controller(fbi);
+ pxafb_smart_exit(fbi);
if (fbi->fb.cmap.len)
fb_dealloc_cmap(&fbi->fb.cmap);
--
2.56.0
next prev parent reply other threads:[~2026-11-02 8:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 8:03 [PATCH v2 0/3] fbdev: pxafb: fix teardown and early-interrupt lifetimes Matthias Goergens
2026-11-02 8:03 ` [PATCH v2 1/3] fbdev: pxafb: unregister cpufreq notifier on removal Matthias Goergens
2026-11-02 8:03 ` Matthias Goergens [this message]
2026-11-02 8:03 ` [PATCH v2 3/3] fbdev: pxafb: initialize IRQ completions before requesting IRQ Matthias Goergens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102080332.1466689-3-matthias.goergens@gmail.com \
--to=matthias.goergens@gmail.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®