From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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 0056C36AB6F for ; Sat, 31 Jan 2026 20:30:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769891447; cv=none; b=NFZk9ceooHNqe3eSO2et/QkbauwKrYoaMxr+UVStkMiohf48f0bJ8EgREykiOGwRT7KimTceXGYFh+FOYTQGIQZCfdJTvFEyO09AhpYDh8mVvvTLVRUUhKNjrYc9fMrUdQIhHOX9MeXpB6RWb1nwDS3dCURzOd7GGI5E2ZOGaAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769891447; c=relaxed/simple; bh=L9XJve0ulj8tKYF10Wkb04uXGOq5u4DHLER2Q3q5jNg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=snhSt8iLQRftKzGiyqn6gf1g1C987OHYrRKm8Uco0VDBeMMRBd+X3cABWG5d95vnMecvuqPapjMnp/PaYZR3S9x2if4dNsouZ5Pq31c7Ds6TS7j+H8ccJny1unB7ykw0x25J8Ad3sA45Tq8RjeWvz0RzWgmxLmsYIwFYzeAnfC8= 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=HnwlS2uK; arc=none smtp.client-ip=209.85.161.48 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="HnwlS2uK" Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-662fe3ff6f6so1880165eaf.0 for ; Sat, 31 Jan 2026 12:30:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1769891444; x=1770496244; 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=oGj1VrnHQQ76sXlhAlBiObgm7QPOVd0/aqgVTeAbbdk=; b=HnwlS2uK0S7+uhtd/kpw4oNnPDtA1oMk+taVOm8GEbZv0kCWa5tCT4HdAHD9ipzqHf K/Cgc/qFI243mcCCcaipfiwn0c0Uhj5vChUCwuMlCCRPBf3ErnYYJD3H/I18/STkikGO sRjLR+sGafyKt7SZYziO8bBNmaIV0Etm64m3/kLCruAucifHVWQeNkbdl7UpP1OBrDQj ceOxo8PRUmKkSlTFWa7wEUikfLzc7nNin73m2BQrZopLB8iQr/AG6GFBhCcUiwDs2Pn5 aYdot3volbcBo0Uw8YOCFsp3at/Mn5+h2z2McCDYQmaNu3WHslu7HqURu0HhlhZppWku 7lWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769891444; x=1770496244; 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=oGj1VrnHQQ76sXlhAlBiObgm7QPOVd0/aqgVTeAbbdk=; b=Td0sbete0QxvsoVTLn71AJH3b7nSNjfUNZNSvDdtDhCEGifVWJfU7W7WoS9EgGj2oB zfbTz/+g6Z7TjxnPoAGyLyHI0kJXXmhDT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69:e0d4 with SMTP id 006d021491bc7-6630f3b4d03mr3283555eaf.70.1769891443760; Sat, 31 Jan 2026 12:30:43 -0800 (PST) Received: from ?IPV6:2600:8803:e7e4:500:c7ef:51f2:4f7a:6cd7? ([2600:8803:e7e4:500:c7ef:51f2:4f7a:6cd7]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-662f9963799sm6975601eaf.7.2026.01.31.12.30.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 31 Jan 2026 12:30:42 -0800 (PST) Message-ID: <688cbfb1-0944-492a-929d-91ebb9ab22fb@baylibre.com> Date: Sat, 31 Jan 2026 14:30:41 -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 v5 1/4] iio: industrialio-backend: support backend capabilities To: Tomas Melin , Michael Hennerich , Nuno Sa , Lars-Peter Clausen , Jonathan Cameron , Andy Shevchenko , Olivier Moysan Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260130-b4-ad9467-optional-backend-v5-0-7da803ba7326@vaisala.com> <20260130-b4-ad9467-optional-backend-v5-1-7da803ba7326@vaisala.com> Content-Language: en-US From: David Lechner In-Reply-To: <20260130-b4-ad9467-optional-backend-v5-1-7da803ba7326@vaisala.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/30/26 3:16 AM, Tomas Melin wrote: > Not all backends support the full set of capabilities provided by the > industrialio-backend framework. Capability bits can be used in frontends > and backends for checking for a certain feature set, or if using > related functions can be expected to fail. > > Capability bits should be set by a compatible backend and provided when > registering the backend. > ... > +/** > + * enum iio_backend_capabilities - Backend capabilities > + * Backend capabilities can be used by frontends to check if a given > + * functionality is supported by the backend. This is useful for frontend > + * devices which are expected to work with alternative backend > + * implementations. Capabilities are loosely coupled with operations, > + * meaning that a capability requires certain operations to be implemented > + * by the backend. A capability might be mapped to a single operation or > + * multiple operations. It would be helpful to list these operations explicitly for each enum member. > + * > + * @IIO_BACKEND_CAP_CALIBRATION: Backend supports digital interface > + * calibration. Calibration procedure is device specific. > + * @IIO_BACKEND_CAP_BUFFERING: Backend supports buffering. I assume this means it supports devm_iio_backend_request_buffer()? In IIO, we usually say "buffer" and rarely "buffering" so this name and description is a bit confusing to me. > + * @IIO_BACKEND_CAP_ALWAYS_ON: Backend does not need to be explicitly > + * enabled/disabled. It is always on. Do we actually need this one? Alternative could be, for example: int iio_backend_enable(struct iio_backend *back) { int ret; ret = iio_backend_op_call(back, enable); return ret == -EOPNOTSUPP ? 0 : ret; } Or make a iio_backend_optional_op_call() macro. Or if there is some other nuance where this capability makes a difference, it should be explained in more detail. > + */ > +enum iio_backend_capabilities { Documenting members like this works too (saves a bit of cross-referencing). /** @IIO_BACKEND_CAP_CALIBRATION: ... */ > + IIO_BACKEND_CAP_CALIBRATION = BIT(0), > + IIO_BACKEND_CAP_BUFFERING = BIT(1), > + IIO_BACKEND_CAP_ALWAYS_ON = BIT(2), > +};