From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (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 F29D9338582 for ; Mon, 15 Dec 2025 18:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765822176; cv=none; b=GlqQCCw4yP3gYDHhDRPP9dRni1kIO6cpkhappxS8FhiXDWuDxu9mds11JQ/O1OOHrf5HPpx6ckXKrA4bOPWCQQuFjL4C8KanPmKxRH0tlxX4N1iJJ+TCeSl2pxfvsUf5dU+B8P7zvXCT31NXUIBAnCTcdxlXWSh6f53Tdpwn9RA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765822176; c=relaxed/simple; bh=jJoPLn1fkI9wPRU/0HMgfFAMd/C9HMYFq8hNraw6c8s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tpwEAquRYvezqmB/hC2XW+HO15QOk88CvK/Y3JMGOFpo+YgPB/lfzavq0Jo1IlG1l+2SzZ5HXaKOR7aVA+pVr337P+51YL87EnDyADL0X+Na7Dss1ibjOzmlF4176t13T+GevRQ9SW4bDDHu8KkdY5vNLYJI9C3vv+sNVc761rI= 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=iZ/4CjFk; arc=none smtp.client-ip=209.85.210.41 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="iZ/4CjFk" Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-7c52fa75cd3so3378416a34.3 for ; Mon, 15 Dec 2025 10:09:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1765822173; x=1766426973; 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=P8D3gbs8j8tMtsoO/hc4EokJzJyu5XdrUi05ido4tmo=; b=iZ/4CjFk2LA4hX415hTiI2scaCuQDIqgruse8zSwUhG67SY1JKd9+WLPc+XsAufsDE Zn+vlHK63b2G1BZdmfBuGnl9cmlGegXdismUZIIe1FhuTYOiIAaIeECCGmSpF7m5fPHX GyjULtfMSKpcOWeO78IQjTA3uAEbvN7Hmpnt/0kBSEbILMPJbZlXOaz3xd1DTbcP2yPd eEJB18HgDVEkzVjgRKKrEInjuxsMKFI14p2yYK4/i4P9ABLSfCVvb9ePoBidaBIrXKve /e7+8utLQ3hYWNtTqano7HKlzYs/wu/NrXV/A+nLtASlh8/7TP4YVV3OdSmX71DB2WCB Yr1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765822173; x=1766426973; 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=P8D3gbs8j8tMtsoO/hc4EokJzJyu5XdrUi05ido4tmo=; b=haGqJVjbGmNU4DrA5lWJVexlpiPEQsEOrlfOG4ufHrcLUm39oA8GbcMX/twlQVedaJ LBMuGn5Zhu/oPlERCqjQqvEqTzshP0XDvNewTKi5ktP1Obp8UGrYnoEMfGuBjgQ5uN97 GUnXu2/V7Mirm2A1D/zN4+mXliFGWIYD3ViVuShDRzpMRJ98HsT7YEtZKJzJehHEkftH E1db+TqH6L99gnVIk6t3Hd8+aygesd1yUTkwetTkTOWLcQjORh2Q9bXRPwEH7Gc3YN3m ZPygLvvEvnGPhhXD6xp824OxFs81nNsaRLBucuJJ4oUY4pUK8zw24GyICSlPC3AOihpv ZRCg== X-Forwarded-Encrypted: i=1; AJvYcCXoojtI4gDjliKa3urus1QE3LtVLKwPGye8qJv5dDfgPpctji+hxJjhxygAsmyskOxzWmqPZVSe6NllxWk=@vger.kernel.org X-Gm-Message-State: AOJu0YwR6rep+umXp1RQ4yPKwLEkmS3vPc7aleitlsYo74qDPpi/AVRs AZss8yYMwLrwlaaaTMRVORal3jkUpndpxeknOhd1T00sTgmMqX4c6u2HKaUJAvEAII3FrvbFQlv KSGiB X-Gm-Gg: AY/fxX4viostt/j2VjrkaoNS3Nqn8E5IDRk/VxQYCWjMHJiLs2CU+ZWVkNsTYtlXpST yhFB9QXP6HqgojKvAFY4V6qLcu/8/VH/dOEEaxqWhTQCd3X/wNtq8/kORXCmyOvX2w+Fp2oENjl WF9/4z980IM0wDbMmUpHoc1ngro8dsGkNGf6vo/OMseeRPWaSH/canx1mDmobL7pWVxcCyfkxeC yTxsMvuhVljkoKYOHKgRFAUKy6Rl8Az0Q5plsyiuW72PC3ACWUcsh9K8W7EI50ShcavCCynI7BU h0sIje5rHBC6nOZTGTy1jF8P3T7Ma7ekbxucKvqzXnKN99ZtZ44VKqy2Ufj5oC5wNfXO+gRim6A J/SOwUmU2ym6u9NPQJ61w5hOlxBYsn+tOGX+X6XtfvH4t9/n90ejLPFQyMF04hGFi/Y+rlbp15k n0nqoo2QGOuCpRay4JUyVWvp4OhFncooq5TuxkVjBQ2xRrYwocrpqwVwvdIhAx X-Google-Smtp-Source: AGHT+IHHsNWWpcFL7pxsMf0NT+Ch5aoGLcrbIOKR0HmNu8rxcH3yGMLa5YDaJGBvj/3gZjcMR41VGg== X-Received: by 2002:a05:6830:4c08:b0:7c7:54e1:a3ad with SMTP id 46e09a7af769-7cae8366e93mr8570713a34.17.1765822172981; Mon, 15 Dec 2025 10:09:32 -0800 (PST) Received: from ?IPV6:2600:8803:e7e4:500:1635:b560:bfdd:f758? ([2600:8803:e7e4:500:1635:b560:bfdd:f758]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7cadb2fcc39sm9838677a34.19.2025.12.15.10.09.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Dec 2025 10:09:32 -0800 (PST) Message-ID: Date: Mon, 15 Dec 2025 12:09:31 -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 v8 2/2] iio: adc: Add ti-ads1018 driver To: Kurt Borja , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tobias Sperling Cc: =?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: <20251211-ads1x18-v8-0-5cd12ac556da@gmail.com> <20251211-ads1x18-v8-2-5cd12ac556da@gmail.com> <064e059b-5c86-4c41-8de8-b6a728361fd3@baylibre.com> Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/15/25 10:54 AM, Kurt Borja wrote: > On Mon Dec 15, 2025 at 10:55 AM -05, David Lechner wrote: >> On 12/11/25 10:25 PM, Kurt Borja wrote: >>> Add ti-ads1018 driver for Texas Instruments ADS1018 and ADS1118 SPI >>> analog-to-digital converters. >>> ... >>> +static irqreturn_t ads1018_trigger_handler(int irq, void *p) >>> +{ >>> + struct iio_poll_func *pf = p; >>> + struct iio_dev *indio_dev = pf->indio_dev; >>> + struct ads1018 *ads1018 = iio_priv(indio_dev); >>> + struct { >>> + __be16 conv; >>> + aligned_s64 ts; >>> + } scan = {}; >>> + int ret; >>> + >> >> >>> + if (iio_device_claim_buffer_mode(indio_dev)) >>> + goto out_notify_done; >> >> This should not be needed. It should not be possible to >> exit buffer mode without triggers being stopped first. >> (No other driver is doing this.) > > Previously I had my own lock here because ads1018_spi_read_exclusive() > needs locking. What exactly are we protecting against here? I.e. give side-by-side lists of possible concurrent function calls where there could be a problem. Any call to iio_device_claim_direct() will already fail without calling iio_device_claim_buffer_mode() here. And since this is an interrupt handler, we don't have to worry about reentrancy (it can't be called again until the previous call returns). And nowhere else in the driver is calling iio_device_claim_buffer_mode(). So calling it here doesn't actually add any protection AFAICT. > I dropped it per your suggestion in v1 I believe, but > given the discussion in the cleanup.h series I was thinking in bringing > it back. > > But yes, the scope can be adjusted too. >