Subject: Re: [PATCH v4 1/5] net: wan: Add support for QMC HDLC

From: Herve Codina <[email-masked]>
Date: Thu, 22 Feb 2024 18:45:05 +0100

Andy, Jakub,

On Thu, 22 Feb 2024 18:56:26 +0200
Andy Shevchenko <[email-masked]> wrote:

> On Thu, Feb 22, 2024 at 05:45:01PM +0100, Herve Codina wrote:
> > On Thu, 22 Feb 2024 17:29:05 +0200
> > Andy Shevchenko <[email-masked]> wrote:  
> > > On Thu, Feb 22, 2024 at 03:22:14PM +0100, Herve Codina wrote:  
> 
> ...
> 
> > > > +	spin_lock_irqsave(&qmc_hdlc->tx_lock, flags);    
> > > 
> > > Why not using cleanup.h from day 1?  
> > 
> > I don't know about cleanup.h.
> > Can you tell me more ?
> > How should I use it ?
> >   
> > > > +end:    
> > > 
> > > This label, in particular, will not be needed with above in place.
> > >   
> > > > +	spin_unlock_irqrestore(&qmc_hdlc->tx_lock, flags);
> > > > +	return ret;
> > > > +}    
> 
> Here are the examples:
> 6191e49de389 ("pinctrl: baytrail: Simplify code with cleanup helpers")
> 1d1b4770d4b6 ("platform/x86/intel/vsec: Use cleanup.h")
> e2eeddefb046 ("pstore: inode: Convert mutex usage to guard(mutex)")
> 
> Some advanced stuff:
> ced085ef369a ("PCI: Introduce cleanup helpers for device reference counts and locks")
> 
> Hope this helps.

Sure, thanks for the pointer.

Jakub,
nothing in drivers/net seems to use the guard() (from cleanup.h) family
macro.
Are you ok with having this HDLC driver that uses guard() macros ?

Best regards,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com