From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 602B4500941 for ; Sat, 17 Jan 2026 19:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768678390; cv=none; b=cVh6jLCIJ+9wwC2iNLrvKuv7vcfwiACOIDBtSqGJlTE5bFivJn2KHmmiXCoxV36Tl7BpeM95kDvppV8oYbGX2LkWUaJIiLURZzfKhNWSscYAVyRFKX9heumtnnFQYVKvNd8gdCxAgSP73ovdfnzOVbjOh6og1PTkUYtf4R2XUA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768678390; c=relaxed/simple; bh=XA5Os3nG8Cu1wG7aVk4y/cruV4b/sDP00pOQjMtqfwU=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=DfXkuFTzbfDKzcPjkbqO5YDhR4gaCiWCzEtVhtcUqezaB7HowFPnPIYiTvF0H50RtOSmjROOULD5QYNmnNvm1g1gUIfkr99kIRjIfKa2Rsfbuhl3tLtbdeBbjJXSaqRINHRJoP5GjK4QkQ7bCLsnAw5QrFLV3BEregw96IKujOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=giw/Gp7r; arc=none smtp.client-ip=209.85.222.47 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) header.d=gmail.com header.i=@gmail.com header.b="giw/Gp7r" Received: by mail-ua1-f47.google.com with SMTP id a1e0cc1a2514c-93f6bd3a8f4so990064241.3 for ; Sat, 17 Jan 2026 11:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768678388; x=1769283188; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=B/QjNU03Un5xr+pOfz4kD/Wx3TW7UJG3zU+9aNTvu14=; b=giw/Gp7rVeR8NaoPtQx120Y7Md6q70T3hlKZIqXa1Z0vgEtJb9nEROe4qDJdfZdgdP m1UQ7o+bqB2mxYfDxJN9/Rt4u4EV5ifSfM3D7ZgkcJ/ZtoGr7QLGQcaa2dcXRoF2cLkM Swr2cjy6GZPpcjAuHUsnbX8sopIVEGU1K1zdC0IZHGz0UZF9E2BpM5gAzO4DR9umkOp/ neB3sMJ+a36Ky8LV2BVay4Wl34Zs3+qCiF+OPzs6JGoS1NyCtA1bHtHPjZ4uclWeEbYt OVPepibokkpmXTAUIkMFI/qt5ZQoeaK8rL/6nsd+y/iUeEaNAjgJD7Kg4buiF8Jb39EZ /7nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768678388; x=1769283188; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=B/QjNU03Un5xr+pOfz4kD/Wx3TW7UJG3zU+9aNTvu14=; b=iJFnJPsuhLseqA5iXRH1fB2u4168uVz5TMVn7wHkebfQ2qgyQ5LCT9VIbnYyNaJoeB UPIl2TS0f+3oUyBrbG3uNJmQHHH1n8eo14LPiUky0jc5BWBjd+56Um4dgTAjX8hhnqz2 It+MnsieEHbVK4qYazMI1pLHbdfU43a//oQ/2I1IqxD3fk3wxnlcOhLuyCjKwF3HObBn qPpCZ7WpQnKoxamN1U8P7KANgboaq1PuBmRNjrOjjT52Z59RD/vBrB3bd1GnVsmtpRdp dz7BlZNtWvpUPfpPLoFiyOBymI9wzEOl989Xg26YQtWM7rK+h2d4p977L+HloFvi0rZd lOCg== X-Forwarded-Encrypted: i=1; AJvYcCWeHDQKW7w414UUEyoaCiUgJb6SB/Wty+LOjg01c8DocowCbdSqZVX6/u99cvPyKK8VIQ4mc/oLSpphM2M=@vger.kernel.org X-Gm-Message-State: AOJu0YwjsxB1+b12eYStzxdNvFvq9UDPOtQPbG289mnRoB1EM3aZvoVZ yVM6pnXl/gF6jmLTaF5s2RYFjjTikPbmUk0XgEK+/7jTYWRA5JHewBRz X-Gm-Gg: AY/fxX6e0u0xO318s7JX2W9yvmQX8/efpjdC74RPG9Gi5vYfFWXSn3wbJTlSJ3500EE jlknIdE8DoWJi58/LAJvmewT2NrFK0PokxAQGzzOYq+JrlSpsBUrZDoRUY0QFsbXHfs+d3CBq58 VUzLoj+g64P4HGziM+3h5XvtbtXeuY8WkZU1OS4qzbJV5g4frmpwRSY1TIo5DKnYuqiJUOTMpQf QzSBZ7R9PsOcFt6GkoxwsbcgfTfgVLrYGoTjMLTEHJB9M/y7MUzXAiLqi1M2M1Ek/E1hSnrDOic EAKj5l7NHRHlYqgvSwS5TtHRQ3J0HeDPonBqwOD6sn4MkTx6jTd1ilmrXbNAclj86f4zScLcbx0 0Xv8B41Bdh6+UmMm9fNmD628AcACs+ZcKRAHQJJSw1AZupEhPkBSy4T2+lDerTw3hA9XOOshgcv iVTA== X-Received: by 2002:a05:6122:3d48:b0:55b:74ac:72cf with SMTP id 71dfb90a1353d-563b738c487mr1679358e0c.17.1768678388225; Sat, 17 Jan 2026 11:33:08 -0800 (PST) Received: from localhost ([2800:bf0:82:11a2:7ac4:1f2:947b:2b6]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-563b7123621sm1573049e0c.22.2026.01.17.11.33.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Jan 2026 11:33:07 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sat, 17 Jan 2026 14:32:59 -0500 Message-Id: Cc: "Andy Shevchenko" , "Lars-Peter Clausen" , "Michael Hennerich" , "Benson Leung" , "Antoniu Miclaus" , "Gwendal Grignou" , "Shrikant Raskar" , "Per-Daniel Olsson" , "David Lechner" , =?utf-8?q?Nuno_S=C3=A1?= , "Andy Shevchenko" , "Guenter Roeck" , "Jonathan Cameron" , , , Subject: Re: [PATCH v3 1/7] iio: core: Add and export __iio_dev_mode_lock() From: "Kurt Borja" To: "Jonathan Cameron" , "Kurt Borja" X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260106-lock-impr-v3-0-1db909b192c0@gmail.com> <20260106-lock-impr-v3-1-1db909b192c0@gmail.com> <20260116201847.3560a2e2@jic23-huawei> In-Reply-To: <20260116201847.3560a2e2@jic23-huawei> On Fri Jan 16, 2026 at 3:18 PM -05, Jonathan Cameron wrote: > On Tue, 06 Jan 2026 03:06:56 -0500 > Kurt Borja wrote: > >> Add unconditional wrappers around the internal IIO mode lock. >>=20 >> As mentioned in the documentation, this is not meant to be used by >> drivers, instead this will aid in the eventual addition of cleanup >> classes around conditional locks. >>=20 >> Signed-off-by: Kurt Borja > Hi Kurt, > > I'm being a bit conservative in looking to apply this so apologies > if it seems like I'm ignoring you! I wanted to give plenty of time > for others to take a look. Hi Jonathan, Oh -- don't worry. It's understandable for API changes. Thanks for clarifying! > > A few comments, but if we go with this version I'll tweak the > punctuation if I remember whilst applying. I will fix the ones you mentioned here. Apologies if there is more. ... >> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h >> index 872ebdf0dd77..aecda887d833 100644 >> --- a/include/linux/iio/iio.h >> +++ b/include/linux/iio/iio.h >> @@ -661,6 +661,9 @@ void iio_device_unregister(struct iio_dev *indio_dev= ); >> int __devm_iio_device_register(struct device *dev, struct iio_dev *indi= o_dev, >> struct module *this_mod); >> int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestam= p); >> + >> +void __iio_dev_mode_lock(struct iio_dev *indio_dev) __acquires(indio_de= v); >> +void __iio_dev_mode_unlock(struct iio_dev *indio_dev) __releases(indio_= dev); > This is an interesting notation choice as there are several locks embedde= d > in iio_devs but I think it is the only one we want to expose so fair enou= gh > if we don't see any false warnings from this! The previous implementation also used __acquire(indio_dev) and I do believe is the best choice, for the reasons you mentioned. Also the mlock is inside iio_dev_opaque and we don't have access to that in iio.h. > > Jonathan > >> bool __iio_device_claim_direct(struct iio_dev *indio_dev); >> void __iio_device_release_direct(struct iio_dev *indio_dev); >> =20 >>=20 --=20 Thanks, ~ Kurt