From patchwork Mon Mar 31 12:12:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 14033526 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C181E377F for ; Mon, 31 Mar 2025 12:14:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743423284; cv=none; b=ULHXKD3BvRehXVXuO/93WnQpmBQbgqfZwyu68U6DV7gakRyBv2yJ2xC9Q2wcUy2PwAF1mUShvYwtKU7SufRUSTdJlVcKSgeV2grwxSUfVwDp57QzzgEMPR5lPZiVzb7UXPY71yxVk/LtAOAQVTfJnyF0Bm9aTbhE5/Nre/s5uUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743423284; c=relaxed/simple; bh=4oPsywMeiF36Vp5tgpV6wJJcJj8jP1JxM+zu/c34YXA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qTPSCQbXQKmfpv5ikGd5bKRW3cNUFcdoc1rAiJ5EZKc+xPTMchi2zi61mmD9cSrdtyoF/8Ki75Ywm1TPxbD4YL8o5FtMmP7ikO5zKEl26nAIxNRsANKRZif/YUt11UciuMgexDFQd84DMIb5AH9QxkevoO0rjmBZ9Eg948vnk+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KPgFjLl7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KPgFjLl7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5DFFC4CEE3; Mon, 31 Mar 2025 12:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743423284; bh=4oPsywMeiF36Vp5tgpV6wJJcJj8jP1JxM+zu/c34YXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KPgFjLl7Rh1QbaZhYbfDzH/brpaTHmzduebpbrj74ZOyC1LDk6Pj/a9kRhyPeY/cT MjXMDTjQFxhSYgLHz/6BrAcwsoVXXA/NUpvSsAdPiitOLMxQ7voBmcgcS8TuaBUTko OS7vbg8xOpcM9R+KEg2Zn47mYE5dQPNEoKMehbECdI0xkfEHhcTnKz85RK2yyktLiu YExRZ9p9rvEJ0PskMZxqHLn05LOyRbS1VzTUz5CSOEDXZOyaWcturTYotMqyHy6YPd l6NUAWGwoOaA5+JmcnTSlTgoAJfp03cznvqNeSTtwRSSVbcCjhTU0epaVf5O9r4ttZ 6C6fzn1KOd9lQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Cosmin Tanislav , Roan van Dijk , Jyoti Bhayana , Nishant Malpani , Eugene Zaikonnikov , Jean-Baptiste Maneyrol , Shen Jianping , Lorenzo Bianconi , Matti Vaittinen , Yasin Lee , Andy Shevchenko , Jonathan Cameron Subject: [PATCH 11/37] iio: humidity: hdc100x: Switch to sparse friendly iio_device_claim/release_direct() Date: Mon, 31 Mar 2025 13:12:51 +0100 Message-ID: <20250331121317.1694135-12-jic23@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250331121317.1694135-1-jic23@kernel.org> References: <20250331121317.1694135-1-jic23@kernel.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Jonathan Cameron These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Signed-off-by: Jonathan Cameron --- drivers/iio/humidity/hdc100x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c index fb8584423ad8..c2b36e682e06 100644 --- a/drivers/iio/humidity/hdc100x.c +++ b/drivers/iio/humidity/hdc100x.c @@ -212,12 +212,11 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, *val = hdc100x_get_heater_status(data); return IIO_VAL_INT; } - ret = iio_device_claim_direct_mode(indio_dev); - if (ret) - return ret; + if (!iio_device_claim_direct(indio_dev)) + return -EBUSY; ret = hdc100x_get_measurement(data, chan); - iio_device_release_direct_mode(indio_dev); + iio_device_release_direct(indio_dev); if (ret < 0) return ret; *val = ret;