From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 AC2E5270552 for ; Wed, 15 Jul 2026 01:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784077704; cv=none; b=Nts/vyaHG5j/JSbeGRlGf3ndbCPVfp2H0HeBs+sdG3F+FhhHg4BDJ0i1LXgH3QRp7IuyG6ZZALpQasvz1cw9+kH2Tao7Xdm5jPh/efb8fQhi/YiGjrv+GGU+WLVdBOJPWy2IMdDSD3o/3TOWaFG7xj077JUCF71vFJY2HWSaoKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784077704; c=relaxed/simple; bh=tN35dLZPzwzi+5Sd9xksFVjFrsn7f2K4Ef6bj0jV96g=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tGoYzP2Io9vFs5NUL7R9nA8l1lccZvxnzTEKMDKluOKsuG4PGbT6e8KnX7XHoe7ruTIJNQ0PaadgplloKIzR1SnnlhrM8BxBkHy1hNBvhGo9rOc8JCbMdeGC0iG/8m2zUH8hUblxPKc2lIi2G0axHA+Rh6Ijf35J9rsDFVnvmAw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bTIv3TVG; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jCrhHjPd; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="bTIv3TVG"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jCrhHjPd" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66F0ITs32049624 for ; Wed, 15 Jul 2026 01:08:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= aXTMMshAVtUeQo0IZUDx3gK+TpvQrcV476loM7bSKzc=; b=bTIv3TVGY9TPZ32r WeYkeoiwDe+S4dCEL46RoqTcV9RQrbX3KUXFsbpgCmcgjE4iqFbEEopQlayy3D+W HGoovpmQnRJAO1OOOORAJFG1ZRT1XJ/zVmYBY1HT7Vlj03rQzoll0REwAOma2JZV lvmg4mzOa60ASK1WPwKkUSIpnG4LAdCLwegm77fih29cktCXfBwq0ihd5Pb/YpS/ oejQr3Mo09H8pvoCETvplmeoVqw0WGxkwAgPayWNYZqEPLRwwmtjFBb2IHbrHjs0 8KtLsWNLQZSySO/jlKYjYFcP7Y0OqMvwDgwh0qsJr3PcEWYQaA0QW2TQ39H1hsTZ E6Y/Cw== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fdwk30g4s-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 15 Jul 2026 01:08:17 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-ca8aee88725so7031347a12.3 for ; Tue, 14 Jul 2026 18:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784077696; x=1784682496; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=aXTMMshAVtUeQo0IZUDx3gK+TpvQrcV476loM7bSKzc=; b=jCrhHjPdiSt1PJFwxwdvi980LWTS+oRBSsRAjfeCqYO869sOiTkZIUOSRxwP2req5p 9AJQNIUhVNiBwQWCqcprC4YnkoHy3Fl4miar3p+PSQpJLdy2k8nAO9vCD5gKpUe8sW1+ YQCA1gDAno5EbuWz3aKKdHg+KVb2IS30Z4juAEuQskNRojriISwKxSRrX3tHlQZtNPjy issubbGRGLyuUX10MtZIXhZuSYBRBAeuk1LzImCat1S5J29YfPpTW8OT8cQ/1lCel6JV 3xI36SVW3PKEMIbrlWDNqJjLGrhu8JoYVpQf1eek3Inof1lDedrKLvYvGWyi1GSlo6Qq YgRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784077696; x=1784682496; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=aXTMMshAVtUeQo0IZUDx3gK+TpvQrcV476loM7bSKzc=; b=bVzuzpt0stroKvkYKJuKx7Us+QQEbskk9WCzzJ76sS1ifvAHLO+5wtwlqp8Zh14srn kI4FCz9+6FQlssw+u6Rm9n8UpiC7LCLZVx9ewMTWgJqwQd8o3Dmj3t/FoEz1DrAO7Fvk hgwp5QZjyTWlQQKkkc0zZrEndMtZR25SYhPlcBSg0HoZ2Bwiv7UA7E3L/fX7AyJJUs4E tdzGHqBHMEp18Fy4YSGA2MBMUScX8HAphbq3smC4+DYpU4/Hh8R7WhHG7nsauFyKO+wd Lo42+0p0Pp5HCgfRyPmAIHO9pqrNFfCtiRBKRmrqSG6FAuXRLsPNDZt6xUGOvqdZijF2 6fqg== X-Forwarded-Encrypted: i=1; AHgh+RpsVm3mljm8b8tf2yrkDULuTENYS3SbwTKzQhJGaVz+q/Jdn3pIcTdtlW4A5+OeFAIe6TCqXv+TKycq1zw=@vger.kernel.org X-Gm-Message-State: AOJu0YxGTsonZdKK8bB8MdeBgBDVwrOjsSGtsjxYtvhaySpg70WjzUxE 4rRv51ySVR5BuhGuij/uf7wOE7qlvcF7Kx16B4dSgWUWFKRbd8b3vz7lGjeONvqqZwsocyZ9MPa mKs7npjZQQLyO/O2wOwBHNt2Pna0bm1Wr8lRgzswIYfs/bxjcukh1lk21cKmYsZxNY74= X-Gm-Gg: AfdE7clO+ZU5EPw3XNAjd986Cak3XEKETXTxTjacZ0I0OoDpX5DrsYtYcg9SyVdIRcw bzyvqolEzKbt2qUFaYN1Kvyg5o1B7YoYFDn7Kwpvc2jWaXKui51umX4B2EQuW7vd2WIPEiM0a50 NVOxBS3uD+/3cYy5S2cV6JvpFGNJ7QyvOZ7MjZQF9x6+uUb0ECnIqaAsu8K8klZPFMN83ZuTAm0 n+cQxrIORAxbDsKKbWiNW7XsC48/0HzIMj/yElcFSq8eOlUVO7AC9HDagoS5M38SJFgXdvTaX4J 59lj8f1a6iZL2KaTuH0ujuylkSWVXCtnLRmRfZqQZlTKDJwbcHV54ShTtiN3T7VqUQlu99JQbeL JeQyzxfpWnSwaV/uWRnhmA16y0eF5FbrmxMma X-Received: by 2002:a05:6a21:694:b0:3c0:9c1a:8937 with SMTP id adf61e73a8af0-3c34d8b2322mr7739459637.63.1784077696490; Tue, 14 Jul 2026 18:08:16 -0700 (PDT) X-Received: by 2002:a05:6a21:694:b0:3c0:9c1a:8937 with SMTP id adf61e73a8af0-3c34d8b2322mr7739430637.63.1784077696047; Tue, 14 Jul 2026 18:08:16 -0700 (PDT) Received: from localhost ([50.35.46.84]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13b924258a2sm78642078c88.1.2026.07.14.18.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 18:08:15 -0700 (PDT) Date: Tue, 14 Jul 2026 18:08:12 -0700 From: Jonathan Cameron To: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> Cc: Jonathan Cameron , Rodrigo Alencar via B4 Relay , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-hardening@vger.kernel.org, Lars-Peter Clausen , Michael Hennerich , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Jonathan Corbet , Shuah Khan , Kees Cook , "Gustavo A. R. Silva" Subject: Re: [PATCH v7 07/17] iio: test: add kunit tests for channel prefix naming generation Message-ID: <20260714180812.000070c4@oss.qualcomm.com> In-Reply-To: References: <20260707-ad9910-iio-driver-v7-0-a4ec30f63700@analog.com> <20260707-ad9910-iio-driver-v7-7-a4ec30f63700@analog.com> <20260712020928.2c8d1667@jic23-huawei> Organization: Qualcomm X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=Yc6NIQRf c=1 sm=1 tr=0 ts=6a56dd81 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=qC1CW/w66vtJz1P9yTJxNA==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=pGLkceISAAAA:8 a=VwQbUJbxAAAA:8 a=gAnH3GRIAAAA:8 a=7zneujqQnARXn4JFaX0A:9 a=CjuIK1q_8ugA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 X-Proofpoint-ORIG-GUID: 8FiZNf47z2XoVG4hXXGEKTUv94Ojk5xp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE1MDAwOCBTYWx0ZWRfX7O/PwG+01kDv 2eVxUY4Tc0WPCUeCyMw/cLf2ZfXzj//SeRfPs1e9lwhPV8cmgOwmxzKjXX2Bmb+m1tbOAv+C/em X0c4nAFroUQm+WjHrI7Lr3VH4F8OceLbIYTgm/+Cd93XX9wJfDZr6dvdQIH3D7F5ZJxKz6DGn5J 4zBevD+itvNlaKSGItT18q0uypQ1lfXeRCoRe3u9F2d0DUYVs7wAG8xFDcS+L9VdbGq4YZbDr+8 LxE3wU5z7+ZEwlBZ5qJ4FTVsbilWnyZgWRtfyccFjL5m6OuTBvFmZBGCWKZ5l4rT5FZ1BhsQccO YRMvYz2AicRtwDR03dzzsGa3o06HOcJbVl44L6rgmmDHaEKMH1rGzWGcFJ5Tvnd5crkjXkUJoyj ZUBviFe/2F5Fl9EWO/IqfeOn2xeeKSD4YpiGB7OftX8PZJ/nMWolgt3NmaF8tCWgdUgkJhlidat Zb+01EyWvDhV5l/E/Yg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE1MDAwOCBTYWx0ZWRfX40ZTdVwBHx+0 S+UHi6sH/lHry9hDaDq2finnWRgpLDW1DpkJBS21wtFjr6ZrCnCc4aoh5GvshbMj9SxyzcFZ+8F G1K6k8DcgdXNbYDDRkzKFUDiWSGosrc= X-Proofpoint-GUID: 8FiZNf47z2XoVG4hXXGEKTUv94Ojk5xp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-15_01,2026-07-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607150008 On Mon, 13 Jul 2026 10:52:56 +0100 Rodrigo Alencar <455.rodrigo.alencar@gmail.com> wrote: > On 12/07/26 02:09, Jonathan Cameron wrote: > > On Tue, 07 Jul 2026 15:04:28 +0100 > > Rodrigo Alencar via B4 Relay wrote: > > > > > From: Rodrigo Alencar > > > > > > Add a KUnit test suite covering __iio_chan_prefix_emit(), the helper > > > that builds IIO sysfs attribute name prefixes from an iio_chan_spec. > > > The suite groups cases by the enum iio_shared_by mode it exercises: > > > > > > - IIO_SHARED_BY_ALL: produces an empty prefix. > > > - IIO_SHARED_BY_DIR: emits direction only ("in" / "out"). > > > - IIO_SHARED_BY_TYPE: emits "_" and the differential > > > "_-" variant. > > > - IIO_SEPARATE: covers the full matrix of indexed, differential, > > > modified, output and extend_name combinations, plus the two > > > documented error paths (differential without indexed, differential > > > with modifier). > > > > > > A final case exercises the seq_buf overflow path by passing an > > > undersized buffer and expects -EOVERFLOW. > > > > > > Because __iio_chan_prefix_emit() is static, the test translation unit > > > is pulled into industrialio-core.c. > > > > Isn't there some magic route cases like this that makes it non static > > only when self tests are enabled? > > Claude tells me to look at include/kunit/visibility.h > > There is, Although I think that using > > #if IS_ENABLED(CONFIG_IIO_CHANNEL_PREFIX_KUNIT_TEST) > #include "test/iio-test-channel-prefix.c" > #endif > > was more straight forward, less invasive and easier to change than.. > > /* In "drivers/iio/industrialio-core.c" */ > > #include > ... > VISIBLE_IF_KUNIT ssize_t __iio_chan_prefix_emit(...) > { > ... > } > EXPORT_SYMBOL_IF_KUNIT(__iio_chan_prefix_emit); > > /* In "iio_core.h" */ > > #if IS_ENABLED(CONFIG_KUNIT) > ssize_t __iio_chan_prefix_emit(...); > #endif > > /* In "drivers/iio/test/iio-test-channel-prefix.c" */ > > #include > #include > ... > MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); > ... > // Use __iio_chan_prefix_emit() in tests I'd rather this wasn't built into the core module. So prefer you jump though those hoops. Jonathan > > > > > Very nice. A couple of really small additions requested inline. > > I might well have missed where you exercised the corners requested though! > > + I'll need an Ack from Lars for that maintainers entry. I'll guess that > > Lars won't give one as not very active at the moment in this area. > > > > Jonathan > > > > > > > > Also, an entry is created under MAINTAINERS dedicated to tests for IIO > > > core helpers. > > > > > > Signed-off-by: Rodrigo Alencar > > > --- > > > MAINTAINERS | 8 + > > > drivers/iio/industrialio-core.c | 4 + > > > drivers/iio/test/Kconfig | 14 ++ > > > drivers/iio/test/iio-test-channel-prefix.c | 246 +++++++++++++++++++++++++++++ > > > 4 files changed, 272 insertions(+) > > > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > > index 2b1ec46c5919..57ffc0dcfdb6 100644 > > > --- a/MAINTAINERS > > > +++ b/MAINTAINERS > > > @@ -12634,6 +12634,14 @@ F: include/dt-bindings/iio/ > > > F: include/linux/iio/ > > > F: tools/iio/ > > > > > > +IIO CORE KUNIT TESTS > > > +M: Lars-Peter Clausen > > > > I'd need an Ack from Lars for this entry. If we don't get one are you > > fine looking after this without Lars listed? > > That is fine, will drop his name. >