From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 A827521FF5B for ; Tue, 16 Dec 2025 20:49:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765918167; cv=none; b=KyOpNF5/3xiQZXBJfqcLkcq9V8e9fJ3lVy0QrQbMWtuwSBpZQu50ugRzjwzETzBcIuFahbhQ8WvLY1fkfaX8EsElBFyaSXfjHVSdmV5ioMyjkU/QLyaXBnfABqC6/Exs6kmN44giyTQHb44PQc25yd3ENt3AKmV027aEymMajgU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765918167; c=relaxed/simple; bh=R7S5XBixF3uYt2ltrMgrPEDqaR/EhDDXEQ41SJyHdbs=; h=Mime-Version:Content-Type:Date:Message-Id:To:Cc:Subject:From: References:In-Reply-To; b=GzR54m35tq5VoBonGpreis/lT5z65l85ypY25RrFdlusOXAJGUteM+0Npkc3skItrXhs1LE1Nbo/oZ9VfrqJU+1GiMItPk6yAy4ziBzysvAvP3LhaOtgbdpKhq/AW84Srm6NzupCj8PkGpx1RB5LKIol8MPiaDA90TB3/5KkFVs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kGKVs8b4; arc=none smtp.client-ip=209.85.217.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kGKVs8b4" Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-5dbd1421182so4353759137.1 for ; Tue, 16 Dec 2025 12:49:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765918164; x=1766522964; darn=vger.kernel.org; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8dxKHiLj7ErsPLc8qt6gIwV3RiYG6xR2jl3i32WC7oI=; b=kGKVs8b4CQBMWy8QamnEBYsJSYi6Xq+KkqjVKWmDqdgWEQInOASuVyrLfne1aFXMqV DMgQrYSoExKQAvAQUNq+VdmfyZ75mkuyG1ece8kn7WCS2H/UxqT7ItAP+O1DM5s+CNHB cC4BQ3MhBq3Y+9k6vKdlT6fe2yYd82PpcAc91PR2Iw6QUkE1arQK/IW9smodsFOcmRXg 8tsQsCDNFAtnADUNg1iJkHbFHaIco0wFf+2b3fbU8xvDk1pjarOFR1oQxIdnXpZEG22G U/0+5cr+oHlH3Ec1UW41cr7LC3CYhct6ExXA3Wk2eUqvDUkj4HrITaqfi4bgTdLYi8LX Moxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765918164; x=1766522964; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8dxKHiLj7ErsPLc8qt6gIwV3RiYG6xR2jl3i32WC7oI=; b=qmKKzxiG8FmlDq6YQ6x9hhlgEuRKSuGhhdpnvMUQaaP/FQZekdPAG5n1ZFwh1wabD9 brCePvyYACm6C4oxZLAMwkl3KKO7AVP5AyxaazKBOL7CLwsRl5eB2iIqzmLwWRYmWbG/ 9oeY7pxtrO9ZysvoceU8/cjGcrTKJKQVzHWC1mbWF6XgAtYQFQ775nyHCoPks9NQr95P JulIp0G0kbTQiGrwfLf9YKNzjVJ9KjmO1nI6WfNx8iD4xEBLPFv3C3amK5p9SDerHI7h FDho2ro7GT3tHRyjKIen/UJbCMbBMpsuAXZQWw2acAz5bqGI4PKPbu3+nt3ARfiTm987 izBA== X-Forwarded-Encrypted: i=1; AJvYcCVf10LXQA0+p4sLi7pvkRmDHzKEh2e0lGR3u20lWR0W4bIHPGZ0kookdAFOfl2x2u1iZxEfzqy2jIgvJh8=@vger.kernel.org X-Gm-Message-State: AOJu0YwEJip3IIfnINeoA1glHSnz8Txh5WioxvfkqWamuc9DZa94SJyh P7GCJAg4JxrMMRDtJXIjiIlxXHugSBLxqaXmF/mLpnfQfkDahVrBhtjE X-Gm-Gg: AY/fxX7/iaiST4JVBwmDS59c1L/xkB4KoniYnZhvtiMCiAF/DNFL2yqSsnJ8/Ye7w9X 0C5neqkGBhM7c52zMTeoNTWKjqc8K3ylJDfo0XIoFB2pT4EFjBoC/90vV5KMG3vRyUAwXlXtUuI 4LjObSBSJWL6ZcA09IugfROkhwvUmnSt4QdLZbClSbec1pQilI+9ahseuN3qxmJivvAcmzPuF7/ zjOBCtj8wb88J5eq4o6RztsPEZgTtKE9R0jrEMVa9S04DMrHcBaiArHMYZ29bY8XN9HuoRdNFRR kefuunA34f57A962edZVyYue3jk0Nk1kXvIvugUhMkBlPEFdtLuvHk8WzYa/1YCuiJ6T57VP8O+ ip8jHAPCfAOwwDrh4AERfd26sNjwJ75KrXGWQV/Ts+8vsiZeNxddfi53rP08WWa0HgMqM3ABp4f 5/Gf/eYw== X-Google-Smtp-Source: AGHT+IFA0ZxxYgAsVtA9i5elaqbLDSzPCkraW+M0I1/U7o+x0Y5JFSfqrO5PMnkRvovtXH6qMbPNsA== X-Received: by 2002:a05:6102:4412:b0:5d6:218a:66bf with SMTP id ada2fe7eead31-5e8274895demr5093041137.6.1765918164559; Tue, 16 Dec 2025 12:49:24 -0800 (PST) Received: from localhost ([2800:bf0:4580:3149:7d4:54b1:c444:6f2f]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-93f5acacc12sm6316965241.1.2025.12.16.12.49.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Dec 2025 12:49:24 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 16 Dec 2025 15:49:22 -0500 Message-Id: To: "Jonathan Cameron" , "David Lechner" Cc: "Kurt Borja" , "Jonathan Cameron" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Tobias Sperling" , =?utf-8?q?Nuno_S=C3=A1?= , "Andy Shevchenko" , , , Subject: Re: [PATCH v8 2/2] iio: adc: Add ti-ads1018 driver From: "Kurt Borja" X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20251211-ads1x18-v8-0-5cd12ac556da@gmail.com> <20251211-ads1x18-v8-2-5cd12ac556da@gmail.com> <064e059b-5c86-4c41-8de8-b6a728361fd3@baylibre.com> <20251216182106.000051c3@huawei.com> In-Reply-To: <20251216182106.000051c3@huawei.com> On Tue Dec 16, 2025 at 1:21 PM -05, Jonathan Cameron wrote: > On Mon, 15 Dec 2025 12:09:31 -0600 > David Lechner wrote: > >> On 12/15/25 10:54 AM, Kurt Borja wrote: >> > On Mon Dec 15, 2025 at 10:55 AM -05, David Lechner wrote: =20 >> >> On 12/11/25 10:25 PM, Kurt Borja wrote: =20 >> >>> Add ti-ads1018 driver for Texas Instruments ADS1018 and ADS1118 SPI >> >>> analog-to-digital converters. >> >>> =20 >>=20 >> ... >>=20 >> >>> +static irqreturn_t ads1018_trigger_handler(int irq, void *p) >> >>> +{ >> >>> + struct iio_poll_func *pf =3D p; >> >>> + struct iio_dev *indio_dev =3D pf->indio_dev; >> >>> + struct ads1018 *ads1018 =3D iio_priv(indio_dev); >> >>> + struct { >> >>> + __be16 conv; >> >>> + aligned_s64 ts; >> >>> + } scan =3D {}; >> >>> + int ret; >> >>> + =20 >> >> >> >> =20 >> >>> + if (iio_device_claim_buffer_mode(indio_dev)) >> >>> + goto out_notify_done; =20 >> >> >> >> 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.) =20 >> >=20 >> > Previously I had my own lock here because ads1018_spi_read_exclusive() >> > needs locking. =20 >>=20 >> 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. >>=20 >> 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. You're right. I assumed threaded IRQs were reentrant, which doesn't seem to be the case. Thanks for pointing it out! > > Agreed we shouldn't need this. Given these comment and my lazy nature, > Kurt, would you mind spinning a patch on top of this series that I can > squash with it on my tree? That should be easier to review than > a full v9. If you prefer a v9 of the whole thing, that would be fine too= . Sure! I'll send a patch later today. > > Thanks, > > Jonathan --=20 Thanks, ~ Kurt