public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, kees@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] iio: ssp_sensors: ssp_spi: use guard() to release mutexes
Date: Thu, 26 Mar 2026 08:43:26 +0530	[thread overview]
Message-ID: <F181DFF2-DB16-4771-A0C4-30FD089D7FC7@gmail.com> (raw)
In-Reply-To: <abgUaXpJOveAtAWF@ashevche-desk.local>



On 16 March 2026 8:02:09 pm IST, Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
>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.
>

Thank you Andy for the review.

I understand your point about refactoring if pattern is repeated to simply things.

Also, while revisiting the changes, I noticed that unintended mistake where list_del() was replaced with list_add_tail() in couple of place during guard() conversion. I'll fix that in v4 along with suggestions and input from you and Jonathan.

I’ll send an updated version shortly.

  reply	other threads:[~2026-03-26  3:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-15 12:55 [PATCH v3 0/3] iio: ssp_sensors: improve resource cleanup with cleanup.h Sanjay Chitroda
2026-03-15 12:55 ` [PATCH v3 1/3] iio: ssp_sensors: ssp_spi: use guard() to release mutexes Sanjay Chitroda
2026-03-15 18:52   ` Jonathan Cameron
2026-03-16 14:32   ` Andy Shevchenko
2026-03-26  3:13     ` Sanjay Chitroda [this message]
2026-03-15 12:55 ` [PATCH v3 2/3] iio: ssp_sensors: simplify cleanup using __free Sanjay Chitroda
2026-03-15 18:54   ` Jonathan Cameron
2026-03-15 12:55 ` [PATCH v3 3/3] iio: ssp_sensors: cleanup codestyle warning Sanjay Chitroda
2026-03-15 18:55   ` Jonathan Cameron
2026-03-16 14:34   ` Andy Shevchenko

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=F181DFF2-DB16-4771-A0C4-30FD089D7FC7@gmail.com \
    --to=sanjayembeddedse@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /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