From patchwork Tue Feb 4 20:02:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13959793 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 32F2014B094 for ; Tue, 4 Feb 2025 20:04:31 +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=1738699472; cv=none; b=ASgpsO7QAuRh8PnfbvphNrezQvgCiYKHMapYhzqTS9m/0Y7T2f3czyVN0daGmdk1vFYGK5XMH4ziKxm84vcDpRxyW/2/gdjPBOH9WSQdi1W6xAF//3kaLihSjnbh5nVWIbGA1IXuInfzWAnfxaJTYQedn/3zW3EjtnlrxS54+e0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738699472; c=relaxed/simple; bh=W1+YFF4zGS62LITFamYUxaCTZ5xJP5oBTswhyMteZAY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RhNAEAzAClCtBUxZYoWQ3gWxqxmeioX5/96n14eUCjCbhck4AGkRSOoT8XyftD7GTQgzKWtVvDbCiFSyrvw7cbKyNqKD4oJggeCir/DHfEAE0sUG/unsmzAc1w+KGLh1PRZpqVbVb2f5ntfqsvaeRlNqBI0+XexG+9S6JM1O28o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E9XcCsqF; 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="E9XcCsqF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BC29C4CEDF; Tue, 4 Feb 2025 20:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738699471; bh=W1+YFF4zGS62LITFamYUxaCTZ5xJP5oBTswhyMteZAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E9XcCsqFihWNwRynVzgt0Ug4frxvypt07YL8c4KGLgJEbdtUhSPhIu9EJDi/ww2tK YFrUwU/SDKxwlWzLhpYz9LNwmdc/e4JEHsdDSFq+vbd2tFm6OT7TiPGhaGahMK01F9 73KETFz4qI0hq1qeNN1JQKV60QcmECQf5qYn8oS0+1d7P7z1WCpRAETdrCKeBjQFl7 1TCxQ7AfHrSBqRyrU9Z0ukIaPP1XIZSu5Jpi+eqGQEAZevWIW/9oTkJ0tJVhMoVhP7 nS8xarDtT9cNiaESBId6cRR96b5Tz4L/ioRxie0PbxJHf3W0O7+91tVl08fASDxu4L GN7Xb6IdlegOw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Mudit Sharma , Julien Stephan , Mariel Tinaco , Angelo Dureghello , Gustavo Silva , Nuno Sa , =?utf-8?q?Jo=C3=A3o_Paulo_Gon=C3=A7alves?= , ChiYuan Huang , Ramona Alexandra Nechita , Trevor Gamblin , Guillaume Stols , David Lechner , Cosmin Tanislav , Marcelo Schmitt , Gwendal Grignou , Antoni Pokusinski , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 18/27] iio: adc: ti-adc161s626: Stop using iio_device_claim_direct_scoped() Date: Tue, 4 Feb 2025 20:02:40 +0000 Message-ID: <20250204200250.636721-19-jic23@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250204200250.636721-1-jic23@kernel.org> References: <20250204200250.636721-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 This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ti-adc161s626.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c index 474e733fb8e0..28aa6b80160c 100644 --- a/drivers/iio/adc/ti-adc161s626.c +++ b/drivers/iio/adc/ti-adc161s626.c @@ -137,13 +137,13 @@ static int ti_adc_read_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_RAW: - iio_device_claim_direct_scoped(return -EBUSY, indio_dev) { - ret = ti_adc_read_measurement(data, chan, val); - if (ret) - return ret; - return IIO_VAL_INT; - } - unreachable(); + if (!iio_device_claim_direct(indio_dev)) + return -EBUSY; + ret = ti_adc_read_measurement(data, chan, val); + iio_device_release_direct(indio_dev); + if (ret) + return ret; + return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: ret = regulator_get_voltage(data->ref); if (ret < 0)