Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp914470lqa; Sun, 28 Apr 2024 09:34:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWtRMlNkkWESNayf5VnHJl4K8YWqhk9iO7ze3gbDH6az74w6+cvrudzQN/JZInwNQh/aJxBaokZJelb1l4O1fi1jXKi4uw1cxg2Gcftyw== X-Google-Smtp-Source: AGHT+IEoTCnAMpLIC9wB0t7oKeALZB2tLZh4w9IN8EFYVqeeUoqgX5MTRpCjhCVsA6f1CndrYX4m X-Received: by 2002:a17:90a:5982:b0:2ad:51d6:d578 with SMTP id l2-20020a17090a598200b002ad51d6d578mr4020673pji.10.1714322083413; Sun, 28 Apr 2024 09:34:43 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id nd17-20020a17090b4cd100b002ae8f5fb741si10619594pjb.20.2024.04.28.09.34.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 09:34:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161493-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=tKnGjU7D; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-161493-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161493-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E37AA281737 for ; Sun, 28 Apr 2024 16:34:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D570371B39; Sun, 28 Apr 2024 16:34:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tKnGjU7D" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E642A10F1; Sun, 28 Apr 2024 16:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714322075; cv=none; b=MFz3LchyMXqHwn6gapW5c/5ThN2nMf5ZAIGIPuMkIQefCgieAj+uNTaOXfLS+dAisAG9kWFVU2yVjwFn7m0wsaEhnXPjcgq/ACC5XnhuhP6xw2RP2Wvhlc7i6+ZarnKpLzcKUw95Oq441VrQn8gK1I3hMehrZZJLzJ2ZOZsZ8og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714322075; c=relaxed/simple; bh=/ZnkzW7mgNGMkQEi2367jg8Z87SujBjczjx+Ing/UQY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sgGVk3/JnKbdYfHoqBD5cG5xgEMXyZ+IWgNkQXFrv4nEALwpDce/rYp//l8bDjKNjnZHzLoVu9evgLKHSa/2n0AEPb+mMJh+erJRlQPLSD1c54gAPxa568kN7e9xmdbmeWY0++h5hJJBTUsYNOOpZDouG7yEPAVLBUa73Mp2uGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tKnGjU7D; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD75FC113CC; Sun, 28 Apr 2024 16:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714322074; bh=/ZnkzW7mgNGMkQEi2367jg8Z87SujBjczjx+Ing/UQY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tKnGjU7DWR6jT6vZ3c9NEvLAOdJ+s4gzSvSfuvVpF96zgCj/+y5dj+3U6JMAjj8cI yMiKUyUFH1PJN0yDqxsE1t5Qlt2iusd6aNWE23PM8ZPlvFtkEi755TryAKfOjcgyMD Hoekex1uxqA27b3r39Yxjz8AAWsnDyiszKe+bZOvbUD416nbDi+zA6j8THL/ACsVSr 1AYrtje6/73VYuFpios3t8ZwpVnaS56sRKvIPI7chDd8TREcgX/1amK/Uz3gzbPhZL KJwE157MOzWPjZbEqG4j2+zqRSCAI9ZskqkrGzsZ7CahmxLRkQIUCTXI4/nUSccZ3h 9cAVhbLqTj/XA== Date: Sun, 28 Apr 2024 17:34:22 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: Aren Moynihan , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Liam Girdwood , Mark Brown , Ondrej Jirman , Uwe =?UTF-8?B?S2xlaW5lLUvDtm5pZw==?= , linux-iio@vger.kernel.org, phone-devel@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Willow Barraco Subject: Re: [PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and power it off during suspend Message-ID: <20240428173422.7c0f44cf@jic23-huawei> In-Reply-To: References: <20240423223309.1468198-2-aren@peacevolution.org> <20240423223309.1468198-4-aren@peacevolution.org> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) 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=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 24 Apr 2024 02:16:06 +0300 Andy Shevchenko wrote: > On Wed, Apr 24, 2024 at 1:41=E2=80=AFAM Aren Moynihan wrote: > > > > From: Ondrej Jirman > > > > VDD power input can be used to completely power off the chip during > > system suspend. Do so if available. =20 >=20 > ... >=20 > > ret =3D stk3310_init(indio_dev); > > if (ret < 0) > > - return ret; > > + goto err_vdd_disable; =20 >=20 > This is wrong. You will have the regulator being disabled _before_ > IRQ. Note, that the original code likely has a bug which sets states > before disabling IRQ and removing a handler. >=20 > Side note, you may make the driver neater with help of >=20 > struct device *dev =3D &client->dev; >=20 > defined in this patch. >=20 > ... >=20 > > static int stk3310_suspend(struct device *dev) > > { > > struct stk3310_data *data; =20 >=20 > > data =3D iio_priv(i2c_get_clientdata(to_i2c_client(dev))); =20 >=20 > Side note: This may be updated (in a separate change) to use > dev_get_drvdata() directly. >=20 > Jonathan, do we have something like iio_priv_from_drvdata(struct > device *dev)? Seems many drivers may utilise it. Not yet, but I'm not sure it's a good idea as there is no inherent reason to assume the drvdata is a struct iio_dev. It often is but adding a function that assumes that is a path to subtle bugs. Jonathan >=20 > > } =20 >=20 > ... >=20 > > static int stk3310_resume(struct device *dev) =20 >=20 > Ditto. >=20 > -- > With Best Regards, > Andy Shevchenko