Re: [PATCH v3 1/3] iio: ssp_sensors: ssp_spi: use guard() to release mutexes
From: Andy Shevchenko
Date: Mon Mar 16 2026 - 10:32:19 EST
On Sun, Mar 15, 2026 at 06:25:07PM +0530, Sanjay Chitroda wrote:
> Replace explicit mutex_lock() and mutex_unlock() with the guard() macro
> for cleaner and safer mutex handling.
TBH I don't see much benefit in this form. What I am thinking of is to refactor
to have the guard and timeout_cnt++ in the top level, and
static void ...(flag)
{
if (flag)
return;
guard(mutex)(&data->pending_lock);
list_add_tail(&msg->list, &data->pending_list);
}
helper for three (*yes, 3) repetitive code snippets.
--
With Best Regards,
Andy Shevchenko