[PATCH 0/4] simplify ufshcd with the guard() macro

Avri Altman posted 4 patches 1 year, 10 months ago
drivers/ufs/core/ufshcd.c | 623 +++++++++++++++++---------------------
1 file changed, 270 insertions(+), 353 deletions(-)
[PATCH 0/4] simplify ufshcd with the guard() macro
Posted by Avri Altman 1 year, 10 months ago
We can simplify the code with the guard() macro and co for  automatic
cleanup of locks. For making changes easier, this series is divided to
per-lock type patches and only address the ufshcd module. There are
still a few remaining explicit lock/unlock calls, and those are for the
places where we do temporary unlock/relock, which doesn't fit well with
the guard(), so far.

Only code refactoring, and no functional changes.


Avri Altman (4):
  scsi: ufs: core: Make use of guard(spinlock_irqsave)
  scsi: ufs: core: Make use of guard(spinlock)
  scsi: ufs: core: Make use of guard(spinlock_irq)
  scsi: ufs: core: Make use of guard(mutex)

 drivers/ufs/core/ufshcd.c | 623 +++++++++++++++++---------------------
 1 file changed, 270 insertions(+), 353 deletions(-)

-- 
2.42.0
Re: [PATCH 0/4] simplify ufshcd with the guard() macro
Posted by Bart Van Assche 1 year, 10 months ago
On 4/16/24 03:23, Avri Altman wrote:
> We can simplify the code with the guard() macro and co for  automatic
> cleanup of locks. For making changes easier, this series is divided to
> per-lock type patches and only address the ufshcd module. There are
> still a few remaining explicit lock/unlock calls, and those are for the
> places where we do temporary unlock/relock, which doesn't fit well with
> the guard(), so far.

Why to use only the existing primitives? Several error paths could be 
eliminated if new macros would be included for e.g. automatically
calling ufshcd_release() at the end of a scope.

Bart.