From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 EFF36333433 for ; Mon, 1 Dec 2025 16:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764605263; cv=none; b=tMrDfAVNOHKOGBAi1FHDiUjqp/hvsFjqJHA8rBI2nWMtkSbxbgsPBLkus+iiL1iKJzsEXYPQjaFyp47Y6lM25mMGIKjSgchQtfQmLXW5NsvPVKls052ZqRBdL+NzrFl0+zS8RDsVWr4uMa/nyJHu7M9eYFQLDUytWEp75/3vmSo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764605263; c=relaxed/simple; bh=4KqoW2kY6Y0iDicS4AkddU/tL9W9u5yhRKwbjPy3c8g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=d2pemy2qxYHeiZauTwQS4OMA3ZYAmpd4Mu3F9VfHx2PQk2LlM5vMnllPLGxoafQ2rroytRhA856LbcVOfeupqWbYy1TVIG8CXhfGjJW/nNnCVbtnLWpW/YZEtEdp2T/xsMSY+PQgnh5szEzkhaQgX+fDnuQe299nqdVsCSzDW9A= 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=ejKZL7nD; arc=none smtp.client-ip=209.85.210.45 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="ejKZL7nD" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-7c704bdd57aso2141641a34.3 for ; Mon, 01 Dec 2025 08:07:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1764605260; x=1765210060; 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=jDr0GYQPVWIPku3v/vQDg4xQ67n9L+U+dEfsUiT0Xbk=; b=ejKZL7nDsubd1BrcmsKgOQaVAoebsNbdDRLe9JbXEr7Do9PUTG4Aptg58KErIFJUsm eyTqPLNbV259gIXnyPIRXi8KL5Q3bIb4apKcj7A8fW88uCMiKK3f8cwshmA+7RH9THtU Mb28vw8+Kxg920iotrc4tul66TzyZ5N/os/JPRczXrn1wb+ghgChrjjVphOMo5bwpK21 QJp8MJSOXk3aSA6Sk5ljxDCZcdDG5/4HII1zHkeDJntckooNWu9qml7f5BxjL/5Pdm8X iMfjyAg4hPL1bp8ELTwiQDaAxaz883swWuWRmGW0e+bN0PzYSLeNYQPa1N617ONpskJT 49xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764605260; x=1765210060; 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=jDr0GYQPVWIPku3v/vQDg4xQ67n9L+U+dEfsUiT0Xbk=; b=ShhRk2mwKOXzF/5dPSAUsTxYAooramP7Xuv2ROjuPnu5G7ccEF92zQIG3nHnGqGR3r RsR7yYQ6M8hxdYE6lpimWG5JqZmBhLmPxEP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vHxtedYLd1GigO8m2QJ6Zn/I5u+9WClQ== X-Received: by 2002:a05:6830:915:b0:7c7:4bd:d527 with SMTP id 46e09a7af769-7c7c4466fa9mr10570580a34.21.1764605259959; Mon, 01 Dec 2025 08:07:39 -0800 (PST) Received: from ?IPV6:2600:8803:e7e4:500:b67b:16c:f7ae:4908? ([2600:8803:e7e4:500:b67b:16c:f7ae:4908]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7c90f5ffad8sm4717328a34.12.2025.12.01.08.07.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Dec 2025 08:07:39 -0800 (PST) Message-ID: <18fbf486-c1cc-4cd2-af12-ffa093fa9ce7@baylibre.com> Date: Mon, 1 Dec 2025 10:07:38 -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 2/2] iio: adc: Add ti-ads1018 driver To: Kurt Borja , Andy Shevchenko Cc: Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tobias Sperling , =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Cameron References: <20251128-ads1x18-v3-0-a6ebab815b2d@gmail.com> <20251128-ads1x18-v3-2-a6ebab815b2d@gmail.com> Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/29/25 9:31 PM, Kurt Borja wrote: > On Sat Nov 29, 2025 at 9:21 AM -05, Andy Shevchenko wrote: > ... > >>> +static int ads1018_read_unlocked(struct ads1018 *ads1018, __be16 *cnv, bool hold_cs) >> >> Hmm... Don't we want to return value in CPU order? I don't know the answer >> here, and IIRC IIO triggers might be actually good with endianess conversion >> done, if required, in user space. > > I specified IIO_BE endianness in each channel's .scan_type, so this > works. However, I don't have issue especifying IIO_CPU and just > returning CPU order values. > Usually, we want to change the data as little as possible, so leaving it as IIO_BE is fine. > ... > >>> + * Context: Expects iio_device_claim_direct() is held. >> >> Jonathan et al., do we have lockdep assert available for this? >> I really prefer to see the code for it, while comment is good, >> it is not good enough. > > This would be nice. > > ... > >>> + if (iio_device_claim_buffer_mode(indio_dev)) >>> + goto out_notify_done; >>> + >>> + if (iio_trigger_using_own(indio_dev)) { >>> + disable_irq(ads1018->drdy_irq); >>> + ret = ads1018_read_unlocked(ads1018, &scan.conv, true); >>> + enable_irq(ads1018->drdy_irq); >>> + } else { >>> + ret = spi_read(ads1018->spi, ads1018->rx_buf, sizeof(ads1018->rx_buf)); >>> + scan.conv = ads1018->rx_buf[0]; >>> + } >>> + >>> + iio_device_release_buffer_mode(indio_dev); >>> + >>> + if (ret) >>> + goto out_notify_done; >>> + >>> + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), pf->timestamp); >>> + >>> +out_notify_done: >>> + iio_trigger_notify_done(ads1018->indio_trig); >> >> Jonathan et al., maybe we need an ACQUIRE() class for this? It will solve >> the conditional scoped guard case, no? No, ACQUIRE() is not scoped, just conditional. I don't think it will improve anything here. > > ... > > If no one prefers to do it, I can submit a patch implementing this. Same > for the lockdep issue above. >