mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shrikant Raskar via B4 Relay <devnull+raskar.shree97.gmail.com@kernel.org>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>
Cc: skhan@linuxfoundation.org, david.hunter.linux@gmail.com,
	 raskar.shree97@gmail.com, linux-iio@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: [PATCH v5 4/5] iio: proximity: rfd77402: Use devm-managed mutex initialization
Date: Thu, 15 Jan 2026 13:57:40 +0530	[thread overview]
Message-ID: <20260115-rfd77402_v5-v5-4-594eb57683e4@gmail.com> (raw)
In-Reply-To: <20260115-rfd77402_v5-v5-0-594eb57683e4@gmail.com>

From: Shrikant Raskar <raskar.shree97@gmail.com>

Use devm_mutex_init() to tie the mutex lifetime to the device and
simplify resource lifetime management.

Signed-off-by: Shrikant Raskar <raskar.shree97@gmail.com>
---
 drivers/iio/proximity/rfd77402.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/rfd77402.c b/drivers/iio/proximity/rfd77402.c
index dd79c9ee838b..43ace2beef7e 100644
--- a/drivers/iio/proximity/rfd77402.c
+++ b/drivers/iio/proximity/rfd77402.c
@@ -359,7 +359,10 @@ static int rfd77402_probe(struct i2c_client *client)
 
 	data = iio_priv(indio_dev);
 	data->client = client;
-	mutex_init(&data->lock);
+	ret = devm_mutex_init(&client->dev, &data->lock);
+	if (ret)
+		return ret;
+
 	init_completion(&data->completion);
 	i2c_set_clientdata(client, indio_dev);
 

-- 
2.43.0



  parent reply	other threads:[~2026-01-15  8:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15  8:27 [PATCH v5 0/5] iio: proximity: Add interrupt support for RFD77402 Shrikant Raskar via B4 Relay
2026-01-15  8:27 ` [PATCH v5 1/5] iio: proximity: rfd77402: Reorder header includes Shrikant Raskar via B4 Relay
2026-01-15  8:27 ` [PATCH v5 2/5] iio: proximity: rfd77402: Use kernel helper for result polling Shrikant Raskar via B4 Relay
2026-01-15  8:37   ` Andy Shevchenko
2026-01-16 20:09     ` Jonathan Cameron
2026-01-15  8:27 ` [PATCH v5 3/5] iio: proximity: rfd77402: Add interrupt handling support Shrikant Raskar via B4 Relay
2026-01-15  8:42   ` Andy Shevchenko
2026-01-19 18:48     ` Shrikant
2026-01-19 18:59       ` Andy Shevchenko
2026-01-20 15:59         ` Shrikant
2026-01-20 16:14           ` Andy Shevchenko
2026-01-15  8:27 ` Shrikant Raskar via B4 Relay [this message]
2026-01-15  8:27 ` [PATCH v5 5/5] iio: proximity: rfd77402: Document device private data structure Shrikant Raskar via B4 Relay
2026-01-15  8:43   ` 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=20260115-rfd77402_v5-v5-4-594eb57683e4@gmail.com \
    --to=devnull+raskar.shree97.gmail.com@kernel.org \
    --cc=andy@kernel.org \
    --cc=david.hunter.linux@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=raskar.shree97@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /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

all inboxes | Powered by JetHome®