From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (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 EB4D82F49F8 for ; Fri, 16 Jan 2026 22:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768601291; cv=none; b=TsCcbD0g7r1A5RSQpWUyfuAdyjqTBzSy6K3D1d9iYSiXccFz29YxGkiLXpwhJcL569d5ka/W1v+4pOgLy2vR86EZYkkwAxduC+V7FAmLOjisbfGM49Ye5G6rsgEuHXAEdHvTFOQ6ULOw4/aMICiQCBhhyPfl3gEpCAynqA5BNXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768601291; c=relaxed/simple; bh=oEe9OHwJMl1JJM8nh2NuUNyf1hkrjraAipLQfPvexEY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kGQm+FRmJG1/2WstTeaGAaieSWw2HxfQJ8fg1MZtXGYfsiNXrXlCGH2mYUAea1Oj1LxZA/wfII/Jbug4Pf4jdVTmfPiJ+/vqu22X35KOPfTaaI49gdj8vnJdLcmA5IRHYIpo3ZMM+Jnw++uGmo6nxH9VT0rcn1Ih6xkgC10yekw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=hp0ZOVff; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="hp0ZOVff" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-7cfd9b4e3f8so744796a34.3 for ; Fri, 16 Jan 2026 14:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1768601289; x=1769206089; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=hnxLBlPiG6XltTI+ghGxYDwfnQMTS3jgBfwR6N4+E+I=; b=hp0ZOVffc/UpagjbyLm1fFA0F6JXj2H1KDJQGCz8n5vBO7zqgnUm4gmDRUYlhBWpBG lagI7g7DwC4A7xGyhK0iFITmtCSst+JZiOev8y2p6BhROmCWtsVGH4Z0/mzrY9J1pGjy 4BpJmbNltPAMhPoPkuZg4tOKQ7QkH4d9XWugMlVvvHIyzD5t4H8iGYHw5ibsejt8ARv1 B/9dS7ROxCGZCAt6R/sPdFZN/j2sYja4cn0q2AQKffnsmzIaB/5pGGzg7glSZMU7zMRt NWMHW8vrwU5SeSGCjUsVIrgRICbHj8IJthTOB9F6yEnZmqmWiVh3IO63tc5K2JPhM7ZG /WGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768601289; x=1769206089; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hnxLBlPiG6XltTI+ghGxYDwfnQMTS3jgBfwR6N4+E+I=; b=AEP6E9dgmJqDyEL7/dJVeUB1pSoD4e790b/3exE/wiUFCMnqZUzeYDpLtr7zGUbTSH CbWmV812jKkMWIDFzZgqbCTencUTuphQHFSnns4UCiKlBs0lNGssnfjyPcV4VXpYWC3y jZk++WdSn3YfkEJVQm1xIgGWSmrykF+7cO4nWxLZ+h5ObpETOk1RdE6Nu7vnLvpUjToV dWQOOqaM8MtbhDZzn03yPs8ylZeAb28rxNI+8wOC9j7JOF9+G2Fmgg2LGTCyx+6VfGGU ll6YZu8CLYYN6HbLNI27harLulkAwoLSJXRFQfuyDbA0fc/0NEUQ03beLzzfmm0V9iXU FTUg== X-Forwarded-Encrypted: i=1; AJvYcCW7s/nEMUCMFpB2Y45PVLwRBqoajxN9CICRs2HcIJ36smwIjMKaHL3pJJrACSqmh7gUoKpM1LOWCF+eY/g=@vger.kernel.org X-Gm-Message-State: AOJu0YynnGwRUpuZJ7MDRNkfWuF8b+uVzFzimiTrbDGDHilPMFeKRlAR OKBk1GYDsZbZVwoOG7fPmoFis34mPbmt0DZx7DvjYtNbsN2JO+bFPBFJnU1mpbBT1Ik= X-Gm-Gg: AY/fxX7BqQ7JqN4lieOGHVYrWerm9sl6+AhDEcYLoaIT2FQGEo84osM6gYECCT1zkgv QyQnvKGlLMC9eGinc4Ve+6G6wHqNbbDjuT3BE7JZT4CWuaXdBWjZeTC+CJBPUJt7CCon1KVaDy1 MXr6vWCF0L6bqLbB84HGLnklL0xdFMPiiWmdi103ldpJ1VuiWjLZR8Qg1Q6hvGlFwt8V/W4vw0D 830ED8OtX6vzasd2vguWyudC6ZwYM0q91CM9L1iYj95LJGRwBtwdnunFnaPuVyPCHnvnFmWKbuu 8BnuwWDbYuM0/V7OmneurjOG6M3mbnWIpKFssq/E7MGxR75XPlILagbLmpovgz0/OU07OMfmlTT kPJCbeFOy7ad9C2bbLsyMyPeV6SzzeSqD28BTBMRFE/8zsbYwv+2x5bTnI3tnRS0xE8uCx2G/3P scVQ2RZQOB90HHJXu5tjM3PRRzzuTPAX5PJ2caRAdgsEEs33Z4xj2LwmmicfsS X-Received: by 2002:a05:6830:f85:b0:7cf:d191:2a50 with SMTP id 46e09a7af769-7cfded8025cmr1842614a34.13.1768601288855; Fri, 16 Jan 2026 14:08:08 -0800 (PST) Received: from ?IPV6:2600:8803:e7e4:500:bd39:740e:f70f:5f7d? ([2600:8803:e7e4:500:bd39:740e:f70f:5f7d]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7cfdf2a5f0dsm2452490a34.24.2026.01.16.14.08.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Jan 2026 14:08:08 -0800 (PST) Message-ID: <4e77ebef-07b3-49ae-9d53-d24616569a74@baylibre.com> Date: Fri, 16 Jan 2026 16:08:07 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 0/7] iio: core: Introduce cleanup.h support for mode locks To: Kurt Borja , Andy Shevchenko , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Benson Leung , Antoniu Miclaus , Gwendal Grignou , Shrikant Raskar , Per-Daniel Olsson Cc: =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko , Guenter Roeck , Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev References: <20260106-lock-impr-v3-0-1db909b192c0@gmail.com> Content-Language: en-US From: David Lechner In-Reply-To: <20260106-lock-impr-v3-0-1db909b192c0@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/6/26 2:06 AM, Kurt Borja wrote: > Hi, > > In a recent driver review discussion [1], Andy Shevchenko suggested we > add cleanup.h support for the lock API: > > iio_device_claim_{direct,buffer_mode}(). > > Which would allow some nice code simplification in many places. Some > examples are given as patches, but the last two are the biggest > differences. > > In this version I dropped the RFC tag, as the general feeling is to go > through with this after some modifications. Main one is the addition of > IIO_DEV_ACQUIRE_{BUFFER,CLAIM}_MODE() wrappers to avoid drivers using > the guard classes directly. I also added comments on the forbidden ways > to use this API but I definitely still take suggestions on this. > > For now I dropped iio_device_claim_buffer_mode() rename, as this point > is still being discussed. My suggestion based on the RFC discussion is > to do it, but in a separate patch (using coccinelle) and while we're at > it rename the whole API like this: > > iio_dev_mode_lock() > iio_dev_mode_direct_trylock() > iio_dev_mode_buffer_trylock() > iio_dev_mode_unlock() > > Let me know what you think and thanks for taking a look! > > Signed-off-by: Kurt Borja > --- Like Jonathan, I just had a few minor suggestions, but overall: Reviewed-by: David Lechner