From patchwork Mon Mar 31 12:12:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 14033523 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 0B2691E32DD for ; Mon, 31 Mar 2025 12:14:25 +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=1743423266; cv=none; b=sKXNzowwMtLtlQI7NaTm4Q2545VSQ3KuymwAqBAy2yhl9orEd6MvsUss99pX2JYFjftGMdXZJiLtxPzEo5iOX02sWC6B7F9HlBSrDZSQmSJzCAeFXWoMUTgf6lz2bPp0QPE9O5/DshbW8u3PqgX4LdQ0uAztACg4JqPE312wzv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743423266; c=relaxed/simple; bh=1G8+RedA+cYnYN6BK8VVC6Ap1ZihZtFWfZ/E2J5ieZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cbpi/cx6UdKTPfwGoYs5xa/wATRZKFGfLKBtBr4TeW5JqvgQ5A3cwiyVizglj6PgdzlQnYTb0FDRspOwCGmov0y9DsHxBMPQFpDGKoZVYWggyvkkMK/XIFlRbJoSHyb3y135qDj3mMRBLeh0bcP13fBWZlVygEKsReNKzUxuB0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RhCEl4/q; 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="RhCEl4/q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB07EC4CEE3; Mon, 31 Mar 2025 12:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743423265; bh=1G8+RedA+cYnYN6BK8VVC6Ap1ZihZtFWfZ/E2J5ieZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RhCEl4/qfzQQRC2+6iPm4HvCTrLdv5bobXZQp49aLUiMKUKQ1PfXr8V/URUdl0psz dsOmMDkqzSGYrHjRuNXnkb13311FidaofioGmttaDeXw6mSxXJLnGLuPV1DiqA2H45 2Ou1pZ2RBQX1AGmYVOGadEEqS3kIKIUYR7DedMKGr8lQr4SsWaz8dqIBtQh9UzvgOe 0z6YLPxEyYDr2HQ9Ku2UaVgxuwfUY3IX8IUYc96vk1lZzk/5ocogm4ZjO1BIEGF86Y Q0davvvZQ2l/Y2enZxL/22pS+L5ufQmzKw3/fx+oOpx5bPp9uqgf4DevE0zp/oMWTf FMDPkZpw0M+NQ== 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 08/37] iio: gyro: adxrs290: Switch to sparse friendly iio_device_claim/release_direct() Date: Mon, 31 Mar 2025 13:12:48 +0100 Message-ID: <20250331121317.1694135-9-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 Cc: Nishant Malpani --- drivers/iio/gyro/adxrs290.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c index 223fc181109c..8fcb41f45baa 100644 --- a/drivers/iio/gyro/adxrs290.c +++ b/drivers/iio/gyro/adxrs290.c @@ -290,9 +290,8 @@ static int adxrs290_read_raw(struct iio_dev *indio_dev, 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; switch (chan->type) { case IIO_ANGL_VEL: @@ -316,7 +315,7 @@ static int adxrs290_read_raw(struct iio_dev *indio_dev, break; } - iio_device_release_direct_mode(indio_dev); + iio_device_release_direct(indio_dev); return ret; case IIO_CHAN_INFO_SCALE: switch (chan->type) { @@ -366,9 +365,8 @@ static int adxrs290_write_raw(struct iio_dev *indio_dev, struct adxrs290_state *st = iio_priv(indio_dev); int ret, lpf_idx, hpf_idx; - ret = iio_device_claim_direct_mode(indio_dev); - if (ret) - return ret; + if (!iio_device_claim_direct(indio_dev)) + return -EBUSY; switch (mask) { case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: @@ -408,7 +406,7 @@ static int adxrs290_write_raw(struct iio_dev *indio_dev, break; } - iio_device_release_direct_mode(indio_dev); + iio_device_release_direct(indio_dev); return ret; }