Re: [PATCH] staging: fbtft: make dirty_lock IRQ-safe
From: Dan Carpenter
Date: Fri Aug 07 2026 - 09:19:46 EST
On Fri, Aug 07, 2026 at 02:53:26PM +0200, Nam Cao wrote:
> sh_def@xxxxxxx writes:
> > diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> > index ca0c38221c16..193643d0329d 100644
> > --- a/drivers/staging/fbtft/fbtft-core.c
> > +++ b/drivers/staging/fbtft/fbtft-core.c
> > @@ -298,14 +298,20 @@ static void fbtft_mkdirty(struct fb_info *info, int y, int height)
> > {
> > struct fbtft_par *par = info->par;
> > struct fb_deferred_io *fbdefio = info->fbdefio;
> > + unsigned long flags;
> >
> > /* Mark display lines/area as dirty */
> > - spin_lock(&par->dirty_lock);
> > + /*
> > + * fbcon takes dirty_lock while holding console_owner. Disable local
> > + * interrupts here so a printk hardirq cannot acquire console_owner
> > + * while dirty_lock is held and create the inverse lock ordering.
> > + */
>
> Beside that reason, we also need spin_lock_irqsave() because
> fbtft_mkdirty() can be called in both task context and hardirq
> context. And this reason alone suffices and usually is why
> spin_lock_irqsave() is used, so I think a comment is not necessary.
>
> But I am fine with it either way.
AI always adds comments. If we keep alowing obvious comments, the kernel
will turn into reading the Terms and Conditions which are impossible to
read in a single human life time.
regards,
dan carpenter