Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp766255lqd; Wed, 24 Apr 2024 17:01:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsVcRaNXL2s819/e5e6eqwECCTlkCvlGNGBdOwa7L/+kePAKKwosQthvu+8bgHh8iCEqBtiTxkTdsy5r7OjbQ32wqZejFALzh62vO5Zw== X-Google-Smtp-Source: AGHT+IF2fLh0av31ywPaiEzqiXTzKM9KOifDaKNrx5Dem+iiZPt6Pk3ywlCd2ZSKw7w0ZN8+v9SN X-Received: by 2002:a05:6a21:2787:b0:1a3:64d5:2dbf with SMTP id rn7-20020a056a21278700b001a364d52dbfmr3504908pzb.33.1714003276141; Wed, 24 Apr 2024 17:01:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714003276; cv=pass; d=google.com; s=arc-20160816; b=MJxYv2s9o4TzcpA/Y7GcwMqoL5ptG9PYE8/1i9V89VWj2wFVKaw3SdaOWBZEnCltFE tuEVyTWgoHhaZRD6Xl/sOFpAx4UdCsBxYrdWgptIS5XWFvNzX/PH8h6QN7uRyeBX+Sea x7Qqh5TP0QQO84rENgBaJGpd/SNDNL6eHkY+Hd5ndsyUYiK6BJ+ij82k0Zj26zbvlrxj aO32hcDTlFxLT9DqeOiyZQ8ZrCSIwyS93SD2uRmtYDrMkxFsvKDipsORkHHfmZ6Ar9ct 7yswfrTffjfwU5SJEEaim41/yxoxlLS+COqqssk+LQPRc0JWyvrWAU8aleS4ZosTdz7P XVeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date; bh=hsQaSgt/dWJwaX3rAci/jyhFbRrZYWXtUE6c6yp+e0s=; fh=VEoedhfMvetUwS8JwIhzylJ7uk9AT6d/rDGR6StcPxA=; b=hov0htPvTghNABxjtDgqvfBYbpHWpwska/LjdlVAym0VNf2CJ0VYIvJOAaINAf1wUx 4A3zPatDhjUv8sHM3fG67y+Btga1+nZc1verG7gXrEUM/zFrk5TAJwBvzWgjj9TdkPnZ HZRLuH/RRPf90M+cCMxzrdUK4iDRAwILzWfyGw5juE/Pa0rLtLBRY38gKFkRf+2HChlZ UmWMmYOBOEsJJ9Gl/EkiUtdYWZrrhtumVA+6aMfTqDtJP7+1MQtlFyPO2PYjR2MpjtgS qDvJV+9FuRL6mp/IeozEtsYCHi1JypANk/hF3MTVwqG/9Fp4XAB07/G+56wriHKUuxX/ S0qw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@peacevolution.org header.s=dkim header.b=LiPBsvRd; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-157869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u27-20020a63b55b000000b005f80567c9b5si9584190pgo.730.2024.04.24.17.01.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 17:01:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@peacevolution.org header.s=dkim header.b=LiPBsvRd; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-157869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.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 C7ED5286644 for ; Thu, 25 Apr 2024 00:01:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CEC83C0B; Thu, 25 Apr 2024 00:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b="LiPBsvRd" Received: from a.peacevolution.org (a.peacevolution.org [206.189.193.133]) (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 9E93918D; Thu, 25 Apr 2024 00:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=206.189.193.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714003267; cv=none; b=m/JZKHfDQFKZuhavB+SBOYcYoEJGkJ9/jQEDtE5wPHR3b4LpkC0m8U3UVYZ8Xp0PmD0inhxVWLz4qVYzqIZmsAJTwDM92yr/HAcoTmnliX4AGjHdyHr0FpBJNIl1rd1GdV2W/LeIRqSLusVndEzH+rKm4PVuY6W4uf6BqffIh1A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714003267; c=relaxed/simple; bh=YK8ZVJPPSgK6IuSHNRED/Qsya04fG5N0aal1ljRlwDM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qL0tdAwaOcHGk2GrOPdpmx89YZlqIEPK19V/Zowb1pD7dFOkmIrjUDT02KPlLNWOMKo7NrNos6vB0oOIUwCuW6x2iN3jHt68PyuhGXw5ktxnBrf6+Osw/mzvbBx6f+DuvKU0Qd+QxWGoM9arwIEZinuJx5L583p0H2kCiqB+4xk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org; spf=pass smtp.mailfrom=peacevolution.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b=LiPBsvRd; arc=none smtp.client-ip=206.189.193.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peacevolution.org Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 7A2A247A38; Thu, 25 Apr 2024 00:00:56 +0000 (UTC) Date: Wed, 24 Apr 2024 20:00:53 -0400 From: Aren To: Andy Shevchenko Cc: Jonathan Cameron , 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?Q?Kleine-K=C3=B6nig?= , 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: References: <20240423223309.1468198-2-aren@peacevolution.org> <20240423223309.1468198-4-aren@peacevolution.org> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spamd-Bar: / Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1714003257; h=from:subject:date:message-id:to:cc:mime-version:content-type:content-transfer-encoding:in-reply-to:references; bh=hsQaSgt/dWJwaX3rAci/jyhFbRrZYWXtUE6c6yp+e0s=; b=LiPBsvRdEn3iltMiuPVD2b/4acdmis9HqCbFJnqStx+wTdODZwAd4Lc8uC1s/Sp2tXGvKv 7wqZf2bJET+q0VlHXBhd5fjgMm5rkaFCHTklFy8jpT968iftpUi7eM+9wKWaWirwDrKoPY PT/UTF3sLvpEDML5Xhf39GimEbIT5qs= On Wed, Apr 24, 2024 at 02:16:06AM +0300, Andy Shevchenko wrote: > On Wed, Apr 24, 2024 at 1:41 AM 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. > > ... > > > ret = stk3310_init(indio_dev); > > if (ret < 0) > > - return ret; > > + goto err_vdd_disable; > > 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. Oh! now I see the issue you were talking about last time around. I expect that means the irq shouldn't be managed with devres, so it can be the first thing freed in the remove function (I haven't checked the docs to see if there's an easier way yet). I'll add a patch to fix the order of the handling of the irq (both this and the issue Ondřej brought up). > Side note, you may make the driver neater with help of > > struct device *dev = &client->dev; > > defined in this patch. Good point, it's minor, but it should be a net improvement. > ... > > > static int stk3310_suspend(struct device *dev) > > { > > struct stk3310_data *data; > > > data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); > > Side note: This may be updated (in a separate change) to use > dev_get_drvdata() directly. > > Jonathan, do we have something like iio_priv_from_drvdata(struct > device *dev)? Seems many drivers may utilise it. > At this rate I'm going to need to split off a separate style / code cleanup series so I don't keep introducing dumb bugs while rebasing this one. Thank you for your time - Aren