From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 D3E7D2C08C8 for ; Thu, 2 Jul 2026 01:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782956477; cv=none; b=RqrAhB2nHg0osk8rYWu1wpoiCXHQ8XlY/FIpfHLkKng3FzVEuhuo6akNZ9MniU8LrSD8eSgOJFjvOPUlJaI34KOi1TIPImj8Vm+bVCcRXHYGd6TxS0iYjTQw5XXOpWtgjsTbDYgDGfv664jCdr6+RonDWCwyqmC1CkuXP9rGB5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782956477; c=relaxed/simple; bh=UEIngbVpgPQmaeUHLYYQek6IDrSlEeFzwurktpFRBSU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SUcXf4cNaAi4wbgIVxZL9kT19pAwO4KRJCeERv5fFLa2gGX/uSB9uy8enEe5hWQ7GUhpmMIT90X60cA4Oo7KY9xbKBWJZ6LEo/PJncZTXKlT9J3DQN7QDRXdPzYbX4L3MzVuziMhY8efCFGM1V57+S0vUWxjoYULvFmWNkTzkOg= 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=MkSjaMKU; arc=none smtp.client-ip=209.85.210.170 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="MkSjaMKU" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-846970f0acaso1127796b3a.3 for ; Wed, 01 Jul 2026 18:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782956476; x=1783561276; 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=ShQQKj8s/Lgk+6VwLi37Fynh9m2UvesLoaAxNarS/n0=; b=MkSjaMKU2nA19uExOWaNYa/4Bf0lw0wKYvk0BjZPdkwWDwDoVWLpfpbzUNupVjJ2ys pgp7dIU0MAI2ZsR3ekg97AmGtAAieesMS4SW2byp3TTRDIbiWNvf59qCa0qNg3QV2loH 1FSqZ1eUexPKLx3htRJNLTgW5DGWzFPYxJL7xBYKyI6pvftP0WDmgmXiCZeNPxjDX/AK GBYl5VhZhdynZA4subavQoEsI8ASI7zJHWNC0IIi3hfCUtRbYn9TG05cpXSa5F93jgA7 wCGs75z5LbrDXOW7tBgkS1Ap6/thdz5Xsm+1EOLi90NLmy2xkYs/I0o/PVCLe4xOl2NK gwQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782956476; x=1783561276; 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=ShQQKj8s/Lgk+6VwLi37Fynh9m2UvesLoaAxNarS/n0=; b=S9DsiNntRYOcNpg5CmiNz9kV6nJUiV+iGhejKAeX8crBg8llHM8wfxnKOr8qrSD3f8 cNIMtozQwjTEH+KZ23m+FTjUTJmv/Fqms/HIXw+GenM+C2k2Q2SOkzTMBzfJ7ZwuJ+BL Tkbrxok2fjkrvfvZVsdEm9gCbex2WEu+1mNEHEgWoQd+4i1gk8/cfnvaInPFeeLRJDjD HON5DhIS5BDvBS/zdpNWSGyO+ioPpGk3HDNTrUpKu9VlB2WzL/BL12ZHE8AdEqa0JBYh YA7hndqm5UP07XwQkuFe4q3Yu6r0CLfwD+Dyxx1blBTar/yUymCvQbO61D/6hUbJNc7h 3viw== X-Forwarded-Encrypted: i=1; AFNElJ/g8vLNvb/HvCHWsI2iP+AIDQrE75v72Zpgw6IUWcdZJm90mH+lDyU1/tZn8wP/k4j+rLCdBjyqZPW/mDw=@vger.kernel.org X-Gm-Message-State: AOJu0YyweXEaIseIM5PfhZs3UAh9ONQ35kUoE6Cl/bFVAMbiM9ySwZt0 Mmj2g0GAeQtDgdxJ71+cUZPykYUz66ql959dm5oZqJ7dzjAyHoK7Z043 X-Gm-Gg: AfdE7cltUJJUVkkywOOtrJfgXPztwp134vKvL8aTnPDmlBKJOeZfB3f+nKFcZswMBX1 892Aq5dw34hGTZ3mWunlKGjI9dVULovo5mBhFd/smkemXENtfsBXv84fHYnihgQ7gxGWEma+ghc noXSJ2f4/Z41z3np9BmfBRqQBID4WcsHh3huR9CPzuQg76Y38tfA0JG/qCsrZiE7qn0HGtouk6p a0kUqEVZpsPt40p9i1CyISgKXrUt/DCxQtjaW0+mHEvGcLS9eBgCsDNqBe/2P34onDszcMXDC9h 5GZR8blC6tddqwQRf3/fjnPr+dEe0wHIyK59mrSlB5Wfz6kqEt5TXBhdY2cXBSW5mNR4080PChq ThOMNaSgrBtYF8HnDD4dwFCz5k4kqnFhR2ajv+kW2DDVMOL+esFnkwIjDrV9kzLBM2MrHR1UlAZ 1przi7qglAACHzGWYoekAEPKFWmxPpiX8/86c2mM7qWDqrkioRa/siQmYC6s6PGQ1s X-Received: by 2002:a05:6a00:cc9:b0:847:8449:2ba6 with SMTP id d2e1a72fcca58-847c06739bemr3641015b3a.8.1782956475767; Wed, 01 Jul 2026 18:41:15 -0700 (PDT) Received: from [172.19.1.42] (60-250-196-139.hinet-ip.hinet.net. [60.250.196.139]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847cb99f546sm546592b3a.46.2026.07.01.18.41.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2026 18:41:15 -0700 (PDT) Message-ID: Date: Thu, 2 Jul 2026 09:41:12 +0800 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 2/2] iio: adc: Add Nuvoton MA35D1 EADC driver To: Jonathan Cameron Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, cwweng@nuvoton.com References: <20260625110638.38438-1-cwweng.linux@gmail.com> <20260625110638.38438-3-cwweng.linux@gmail.com> <20260701221115.544e33fd@jic23-huawei> Content-Language: en-US From: Chi-Wen Weng In-Reply-To: <20260701221115.544e33fd@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Jonathan, Thanks for the review. > Look at the ACQUIRE() macros for claim direct stuff (in iio.h) > and then use guard() for this.  Be careful to add {} to define scope > to being this case block.  May not save much code but it will be easeir > to read than this currently is. Understood. I will switch the direct read path to IIO_DEV_ACQUIRE_DIRECT_MODE() / IIO_DEV_ACQUIRE_FAILED() and use guard(mutex) for the driver lock. I will also add a scope around the IIO_CHAN_INFO_RAW case block. > Move assignment down to just above the loop.  Makes it easier for > reviewers to associate the initial value with what is going on. Will do. > For new code >     ret = devm_mutex_init(&adc->lock); >     if (ret) >         return ret; Will fix this in v2. > Second part of this is set by the triggered_buffer call later. So don't set it > here. Understood. I will keep only INDIO_DIRECT_MODE here and let devm_iio_triggered_buffer_setup() set the triggered-buffer mode. > Failing suspend because a buffer is enabled is unlikely to be popular. > Can you not save necessary state and restore so buffered capture continues > on resume? Yes, I will rework the PM callbacks so suspend does not fail just because the buffer is enabled. For v2, I plan to suspend the IIO triggering path, stop the EADC conversion/interrupt path, save the state needed for buffered capture, and then disable the ADC and its clock. On resume, I will re-enable the clock, reinitialize the ADC, restore the scan configuration, and restart the buffered conversion path if it was active before suspend. Thanks, Chi-Wen