From patchwork Mon Feb 17 14:16:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13977936 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 912BA21D5BD for ; Mon, 17 Feb 2025 14:17:10 +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=1739801830; cv=none; b=WrHvCo9FLJfzoU8fxd9BTyJ1KpRRFN4iwCzpftF8O5IsOsmyEVTyj2HU6qSap/XKcAk98tA9EtCs4uQkD1Vcsblna+quF0LlRRPO9ktiiDgDHIV4SJBKbMRD4gOqESTCcJpSm8PV20SttJuFYr+Q0+NoW4J0+SjU5MWG3zl8JDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739801830; c=relaxed/simple; bh=atNVxPelO0EvIhapjy+GuilNReWE4gyI3jWjGSwFQSY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZRMMe62PeksFBvJQUYGreEEBbSHCt/VycBOjuq8sXLqkJ+5PsFIfwVbpPwSz5NebVUDLBfW8KTldKnEYpyiDOZFAQjMQC/bApi0rAgUfjY4C4+Uqdo2VPr1TdFzVDur6R4Wez+olze3f7GF2D1qnNp92uhAZU7cZen9AxZruzoM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UdTpzXsH; 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="UdTpzXsH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1D5C4CEE7; Mon, 17 Feb 2025 14:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739801830; bh=atNVxPelO0EvIhapjy+GuilNReWE4gyI3jWjGSwFQSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UdTpzXsHTSPm/K/Q+2sAWqhN1MhNH10sWFam0OAnprq+dym+6B/bN5wbMv/jKFn6U JdRXe8BkJyDm9yKRqVMTjvR22HANmICkvphD7rGMfRifAtt4VS2S0S0KxR8Qs6q2AU fgpStg2KnpqNNN7ZHXMTjN1lRgcUmdTmMlxddaxoyDNiO4jP9Waw3IUzrHaKh4N1D5 ZYFdixEaxsmWCldlcLqLBaa3ADbLC5DSgVLIGOGahgt7CHj4Hbcq9W4WPAhK89nEX2 enV0KPdU1KdCBEOr2Ehpo7t31lw+Q8D312aLFp+2JaLmJH2jjRF5EvhOYGz7FupPdo uePxOiYyuggZw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Olivier Moysan , Mike Looijmans , Phil Reid , Marek Vasut , Miquel Raynal , Claudiu Beznea , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Alisa-Dariana Roman , Marek Vasut , Frank Li , Jonathan Cameron Subject: [PATCH 04/29] iio: adc: ti-ads1100: Switch to sparse friendly iio_device_claim/release_direct() Date: Mon, 17 Feb 2025 14:16:04 +0000 Message-ID: <20250217141630.897334-5-jic23@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250217141630.897334-1-jic23@kernel.org> References: <20250217141630.897334-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 Cc: Mike Looijmans --- drivers/iio/adc/ti-ads1100.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/ti-ads1100.c b/drivers/iio/adc/ti-ads1100.c index 0519f8afb033..b0790e300b18 100644 --- a/drivers/iio/adc/ti-ads1100.c +++ b/drivers/iio/adc/ti-ads1100.c @@ -223,12 +223,11 @@ static int ads1100_read_raw(struct iio_dev *indio_dev, guard(mutex)(&data->lock); switch (mask) { case IIO_CHAN_INFO_RAW: - ret = iio_device_claim_direct_mode(indio_dev); - if (ret) - return ret; + if (!iio_device_claim_direct(indio_dev)) + return -EBUSY; ret = ads1100_get_adc_result(data, chan->address, val); - iio_device_release_direct_mode(indio_dev); + iio_device_release_direct(indio_dev); if (ret < 0) return ret;