Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793105401; b=BWEaQQbT3r4cU02RRTC7x0I0/Idgt3+Jtsvo7SYr6ZQMMe0pEsTJtva+2FdJf0r2AGNx rbfnxcBLDtawIz1JbL5eVkRc3Hlju2HX8bQbzG/T3TzuQsGEiN+9IDsPTbXkF4xgdbI7P 7yKaflQTRBrw8tU669vuzpoi0tAwJicm71GgJzA0+A4avV5nCMJJFEUwuIsARVIPXBVaB Mx3/4PjaeY3wZH2+snyWcWpoaVJ4xk3V5+7MQsNRyK6yfF9L1Ac6qQZqT/LM9aLW7wE7d xRgcKOWcygMSUm4R0C3RVdKQ4Wekwi7cu+ENYAOKQw4Nt06sVusRFFwUvSHrZ4CXSWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793105401; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=i3eoTk/bStSxof4N8Gfz3DvypjlvmOdA8edsrMpkUbM=; b=uRp8/nhf7xlKpglbzIZcG9HRxiOL+mDUWn31fHLx6JL1TmdcecJwxIjmTBPnKqdSxQ5G xxMIobMrqc2cMUVQLv168k/JUlrvlqZ+UfcZ3dCCatbZt4OuPnFD7KxVAf2/ifshOgKzQ pBPy+E7Rp/Yx/4rZ3F49B+CkTZVueN7hdERsXscmug0CtrLQUozdxJdE8xWZIF0ufoJhz 9CRBQM5hW5Tz9SMaTmucPUdWUPSeDTIm4pXsMOZc44aqydzbrSOsXGm0nFHtGQPfEAKaL ajgxNLnuGWznZ2thqKbBDaZ0vyaOr2UFNHqSPRYnSReVE0RMuFEQvcpFMF35Ww9qXNA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=go97fd+8; arc=none smtp.remote-ip=209.85.208.172 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22127606A31E for ; Tue, 27 Oct 2026 12:50:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 22127606A31E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=go97fd+8 Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-3a9787a156eso35230421fa.3 for ; Tue, 27 Oct 2026 05:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1793105398; x=1793710198; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=i3eoTk/bStSxof4N8Gfz3DvypjlvmOdA8edsrMpkUbM=; b=go97fd+89Q9kTOhdKFIMfToF7HmWsg8y8xV58w6b3C7ps6EVHp7Nn8u2j4SEqVYjaR 8AToBE3L5X6Brb/p66cELM633c1Sd9N26Rpl+SVbosWVRcxXor8GXkNDXYiDqneH9rFC Ou2FziosCy29xuPkw5syr6ZKyXe2BG69PDhX/ROjkXgh6W55feqDL183zRvo6gv9APBj HcaqHa67wNIOwpKpab+faA9V5g39L2DvK0WimHoz90HQ/YXidodtBYzCbqS3nYiydlrH U+gF+db4YeasESo2ET61IIjAFVPkXwPWO4B5i9MHd0N6wNLQa2D7uQNtWVMPCQHu0k0w 6aPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793105398; x=1793710198; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=i3eoTk/bStSxof4N8Gfz3DvypjlvmOdA8edsrMpkUbM=; b=IC2FdSQO5I5vIxoEIrwPCXPCRL053NU5xMR8Id0IivZbYwMGBSnt7loYFMvNz2znZP 4iscWXbr92EGehJjaJ1MfX2IDsXvx55pm259PEAoXNABBpcOn5UnIO+XJ09w9xK1Qmyu ajU94ZNhOGB7OwomiTunssVG6IkH10AVNeA2yybUSCRJ/Gu8sMMErAbcvTeNl2eWsprl JzWVi4WXp/sZq9Fy81ui09Te9AcK2pjU0BeZXx3BO38VDfNkWGljvHr7LOrJPCK8BQr7 US/ZSliCVkW1qMDonbHjlq/kwQ8wHBo/LT7uukdL5CVgg1uU9eIxuOBMC2NLZO1sVque Aeew== X-Gm-Message-State: AFq9FYLtvvr8qwlv61cHBHuzC4q/zxhAlnWA93Bng/17vdkHul1JAeY3 BbhOwKwvQa89g5pbPn2w3e7zq1LIO61boQz7FyLRtOP69KJQTGzuZmx8 X-Gm-Gg: AYBFou3BCv+4N/SKw/wglSmCzNN8njnY6xgGI9DpFTs6agPeqtVqO7pvnDR+zZMXEud VR6ccsszRFhW/15W8CZzMCnbC0qlj6Rd1LXzzo57vP+Js5vChDPjQw9YV7iUCQuXaLexuEDXYSv 8UQEOOaLSY+nfQf5P/jORrN6KVp3WszLp9vXgWy4GEKN7VRXwGUTyzNysRrhi9lZA8SNfTB14xv Nx3Vey4Px6Dj6og5r49XEzB2jB4vFfP/SWxquaXLPvdRdo8uc74ZTvdET70PGfGRkV8zH1JGiLE qXQ1feMYdYAaCcU+opCSVu2ViDQ/1O4ufk4+nh6YJVL58gAbALgJS4ROzKe/fD3Wcd0Mg58ui8t 9NhXkGJd6PNMME9CSEkne9teHvZf/SnIxPq7s0m7+iNRYZeATCerVKVUgQcjF5oYQC3timbngmG bfpD1VO7GsAisjyafy4KTdi16JJpZFZ78MsbSFBMiuUZRYYsrrheoBprhYtdrtfv1K2uCK5kzJw wgvkkOeUm2oPme78hppOKmrAWYZxn3NhU6eww0h91rjZexRw3mkWRKujTRVCBR/iFO6QP/5IhuE lGbSVffEEY4i7Gjc92GB2e3LpceyltiFZ7J9ehJZ/it92z9CAH1NtK7ULrVgrsI+I8dtE+WGSnQ ujq2OVq7vJg== X-Received: by 2002:a05:651c:b27:b0:3a9:e428:d2f8 with SMTP id 38308e7fff4ca-3ac6fd68faamr25300931fa.29.1793105398128; Tue, 27 Oct 2026 05:49:58 -0700 (PDT) Received: from yantra.. (nekmmqtcmoboczbkdcs-1.v6.elisa-laajakaista.fi. [2001:99a:d7d:c300:55c8:a52b:6ba2:979c]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5bfb7e7cb24sm2052803e87.25.2026.10.27.05.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 05:49:57 -0700 (PDT) From: Rupesh Majhi To: Alex Lanzano , Andy Shevchenko , Benson Leung , David Lechner , Guenter Roeck , Jagath Jog J , Javier Carrasco , Jean-Baptiste Maneyrol , Jerome Brunet , Jinseob Kim , Jonathan Cameron , Kevin Hilman , Lorenzo Bianconi , Martin Blumenstingl , Matti Vaittinen , Neil Armstrong , =?UTF-8?q?Nuno=20S=C3=A1?= , Remi Buisson Cc: chrome-platform@lists.linux.dev, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Rupesh Majhi , Marco Elver , Bart Van Assche Subject: [PATCH v4 0/9] iio: enable context analysis for all drivers Date: Tue, 27 Oct 2026 14:49:45 +0200 Message-ID: <20261027124954.110697-1-zoone.rupert@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Jonathan asked for the qcom-spmi-adc5-gen3 fix to become the first patch of a series that enables context analysis across IIO [1]. This is that series. With CONTEXT_ANALYSIS := y in every drivers/iio Makefile, testing gives 256 warnings and 2 errors in 126 files (x86_64 allmodconfig, clang 23.1). Patch 1 fixes the two qcom errors, as v3 did, but names the lock the way Bart suggested [2]. Patch 2 annotates the two conditional mode claims in iio.h, which accounts for 241 of the warnings, in 120 files. Patch 3 covers the core helpers behind them. Patches 4 to 8 annotate lock helpers in kx022a, meson_saradc, the DMA buffer, opt3001 and veml6031x00. None of them is a locking bug. Patch 9 enables the analysis. The common and sensorhubs Makefiles only list subdirectories and are left alone. With the series applied all 726 files build without warnings, also with W=1. bma180, ab8500-gpadc and intel_dc_ti_adc are not in allmodconfig and were built on their own. gcc W=1 builds show no warnings. Removing an unlock or a release is still reported, tried in kx022a, ms5611 and veml6031x00. Bart's thread-safety branch [3] has most of the same annotations. For meson_saradc and the DMA buffer he uses __context_unsafe(). Here they name the lock, so the helpers are checked, and for meson_saradc the callers too. Written with help from an LLM coding assistant. v4: was a single qcom patch, now the first of nine v3: https://lore.kernel.org/linux-iio/20261025191510.22261-1-zoone.rupert@gmail.com/ [1] https://lore.kernel.org/linux-iio/20261025215954.73549810@jic23-hlaptop/ [2] https://lore.kernel.org/linux-iio/76bbebb4-7337-486d-8f21-a39bcb6dca93@acm.org/ [3] https://github.com/bvanassche/linux/tree/thread-safety Cc: Marco Elver Cc: Bart Van Assche Rupesh Majhi (9): iio: adc: qcom-spmi-adc5-gen3: fix lock annotations on mutex helpers iio: core: annotate the conditional mode claims iio: core: mark the mode lock helpers __context_unsafe iio: accel: kionix-kx022a: annotate the lock helpers iio: adc: meson_saradc: annotate the lock helpers iio: buffer-dma: annotate the queue lock helpers iio: light: opt3001: mark the interrupt handler __context_unsafe iio: light: veml6031x00: annotate the event enable helpers iio: enable context analysis for all drivers drivers/iio/Makefile | 2 ++ drivers/iio/accel/Makefile | 2 ++ drivers/iio/accel/kionix-kx022a.c | 2 ++ drivers/iio/adc/Makefile | 2 ++ drivers/iio/adc/meson_saradc.c | 2 ++ drivers/iio/adc/qcom-spmi-adc5-gen3.c | 4 ++-- drivers/iio/addac/Makefile | 2 ++ drivers/iio/afe/Makefile | 2 ++ drivers/iio/amplifiers/Makefile | 2 ++ drivers/iio/buffer/Makefile | 2 ++ drivers/iio/buffer/industrialio-buffer-dma.c | 2 ++ drivers/iio/cdc/Makefile | 2 ++ drivers/iio/chemical/Makefile | 2 ++ drivers/iio/common/cros_ec_sensors/Makefile | 2 ++ drivers/iio/common/hid-sensors/Makefile | 2 ++ drivers/iio/common/inv_sensors/Makefile | 2 ++ drivers/iio/common/ms_sensors/Makefile | 2 ++ drivers/iio/common/scmi_sensors/Makefile | 3 +++ drivers/iio/common/ssp_sensors/Makefile | 2 ++ drivers/iio/common/st_sensors/Makefile | 2 ++ drivers/iio/dac/Makefile | 2 ++ drivers/iio/dummy/Makefile | 2 ++ drivers/iio/filter/Makefile | 2 ++ drivers/iio/flow/Makefile | 2 ++ drivers/iio/frequency/Makefile | 2 ++ drivers/iio/gyro/Makefile | 2 ++ drivers/iio/health/Makefile | 2 ++ drivers/iio/humidity/Makefile | 2 ++ drivers/iio/imu/Makefile | 2 ++ drivers/iio/imu/bmi160/Makefile | 3 +++ drivers/iio/imu/bmi270/Makefile | 3 +++ drivers/iio/imu/bmi323/Makefile | 3 +++ drivers/iio/imu/bno055/Makefile | 2 ++ drivers/iio/imu/inv_icm42600/Makefile | 2 ++ drivers/iio/imu/inv_icm42607/Makefile | 2 ++ drivers/iio/imu/inv_icm45600/Makefile | 2 ++ drivers/iio/imu/inv_mpu6050/Makefile | 2 ++ drivers/iio/imu/smi330/Makefile | 3 +++ drivers/iio/imu/st_lsm6dsx/Makefile | 3 +++ drivers/iio/imu/st_lsm9ds0/Makefile | 3 +++ drivers/iio/industrialio-core.c | 2 ++ drivers/iio/light/Makefile | 2 ++ drivers/iio/light/opt3001.c | 1 + drivers/iio/light/veml6031x00.c | 2 ++ drivers/iio/magnetometer/Makefile | 2 ++ drivers/iio/multiplexer/Makefile | 2 ++ drivers/iio/orientation/Makefile | 2 ++ drivers/iio/position/Makefile | 2 ++ drivers/iio/potentiometer/Makefile | 2 ++ drivers/iio/potentiostat/Makefile | 2 ++ drivers/iio/pressure/Makefile | 2 +- drivers/iio/proximity/Makefile | 2 ++ drivers/iio/resolver/Makefile | 2 ++ drivers/iio/sensorhubs/osf/Makefile | 2 ++ drivers/iio/temperature/Makefile | 2 ++ drivers/iio/test/Makefile | 2 ++ drivers/iio/trigger/Makefile | 2 ++ include/linux/iio/iio.h | 9 ++------- 58 files changed, 121 insertions(+), 10 deletions(-) base-commit: 7d80b4b383bc53b48abd3a30ca4a91cdab568bfa -- 2.43.0