Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp395215lqd; Wed, 24 Apr 2024 06:00:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKz4+KSTQCTMk/bT99Xrz+/t2Ooje+4kzAIieLax+0VS1LzPhJGN7gp+l0q0UCJk4UgqoxJGqqWDknKjj6Jqw6q9MtXOoBKzd0VtkNkg== X-Google-Smtp-Source: AGHT+IEao++TVd4RDI5w/4eVLnzWV2RAQlXgQBny5lpEYTx7LHealCNYEh50FxiH5nY7z3KIKsLV X-Received: by 2002:a05:622a:d1:b0:43a:1414:b94a with SMTP id p17-20020a05622a00d100b0043a1414b94amr3567220qtw.5.1713963625063; Wed, 24 Apr 2024 06:00:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713963625; cv=pass; d=google.com; s=arc-20160816; b=cZwIgq+pFPZfBPo7WGAoEmmTljM6Wq0hY0bGaGd7Tfu0ms3HZII0uLMuzhfKgb/ZvH IDFzOEqk5nxH+/8UkuueAxhJdGhAuPiXGMjvcNY5BIDOvcL3rk4JEYfMYew//XoPqV/n psatclxH0PIjkqMQpoVBmfqGetJYQIHzjTLx22VHTESoYtVuiyurvvq+hrDTPHxUlOYr /kyNTTr7JWVbnTjJ9vfJxrqqnV9sm8SoOyZta6KSRFWb5C3mVxlwriNsTNGt2L+SaRpR uyPL5oSYZGeigM7vE4bbs3CNqBlWd7M4k5SyTgJ5t9HdZKYU4mxJI5Cn/pHBvMgs28d8 FAsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=IQ7ZF+xtoVnB7nN4cGt5M7r7b9YbIwpCqkNZaNSziE4=; fh=KB98FGhLn3Xbhv6UuBtllgz9+y9/d3mE9gB544/pTLA=; b=hLAleB0aZDHlJ8MrptNm6UPBlMTRidHpYF9hoCRkRCwv5PwXm45/Y9d8rsAI23ZkkC +Lz0OrAzY81GPWgk5AcapHHO4Zlc8m0HYlOid0mK4slhVge+2tqjCA/5kyfUmsSvZ3xt 6w2mEDAXc0YcHksnzhvBZNk2DkXu9LPBLqlFCXDNPRFPtyeReG3eR7zEEFKrGb8gW+LX 8rn2GeSniH/Js18CMTfAi8SiQA7x2XsnBdrsd7w7YoIXbbDNsI/Zb3EeKvhm8ryVKTr1 Rmum+VftoAJdX03qoS4jX7aFAr73PhvLFDctr6Lst6XsgruUIK4n+bUg6nvmtsT3QCE8 1goA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=m2Opc8GE; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-156915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156915-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ca9-20020a05622a1f0900b0043988fe77f0si9816067qtb.164.2024.04.24.06.00.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 06:00:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=m2Opc8GE; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-156915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156915-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D0C31C248C4 for ; Wed, 24 Apr 2024 13:00:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 642EE142E70; Wed, 24 Apr 2024 13:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="m2Opc8GE" Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (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 C5CA115B576; Wed, 24 Apr 2024 12:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.181.215.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713963599; cv=none; b=A5jDNZ44oONk38aZ5CMlWTCvRjVT2NRl+8N39KGMdVYVpBVCxwyIGSC9u7+cKF9wM6iIMhsN/9KPsCs18VhZCyn1jjBazEf5vYlde9z5fit18mIOzZfKWArsR/XdW6UJ13tFf9C5+cqnWS/LlxIytthZYRrun/gCohT1FH0NMLE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713963599; c=relaxed/simple; bh=kamfKpDUAuUVYKc3JD6fhJN/bs5aaqGFBEBTvufzKSA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ciHFUfx0mWhSGKhwwTSETTe8YoV+1zgR/0krI7gdcBhm85O5LjbILd9JJnFtaKFqYTCR8YvMhQcerRlVSKVd8x7OdIMIg4u5OVDi5c7tZEZR/Jx5Xn4hSiNCopLsTE+tOe8b3vaHliEP7W1jeACDo91YPMc9Bh1YQVB8OxU9kb0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz; spf=pass smtp.mailfrom=xff.cz; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b=m2Opc8GE; arc=none smtp.client-ip=195.181.215.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xff.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1713963589; bh=kamfKpDUAuUVYKc3JD6fhJN/bs5aaqGFBEBTvufzKSA=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=m2Opc8GEH5y1OCPgcUHTFE55CkaXhDFNC4qU5zJuox4opmWh69YhB6n2wMWjbLBew iA9GtdDPXTHD7fXEV5ewxEJen0QK5Byy+ZQrWJWDnxEvXD2onLoNfnFu1kqiijSerA m/BxquIGSzeUxD7Eitsp/l5Uuxbg6yxVAETYL/EE= Date: Wed, 24 Apr 2024 14:59:48 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Andy Shevchenko Cc: Aren Moynihan , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Liam Girdwood , Mark Brown , 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: <5qqil7ltqhdeabml6toqpcy773uhjxgwaz3txpy4kv4sz55o2y@hmar674eey7s> Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Andy Shevchenko , Aren Moynihan , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Liam Girdwood , Mark Brown , 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 X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED 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: On Wed, Apr 24, 2024 at 02:16:06AM GMT, 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. How so? stk3310_init is called before enabling the interrupt. Original code has a bug that IRQ is enabled before registering the IIO device, so if IRQ is triggered before registration, iio_push_event from IRQ handler may be called on a not yet registered IIO device. Never saw it happen, though. :) kind regards, o. > Side note, you may make the driver neater with help of > > struct device *dev = &client->dev; > > defined in this patch. > > ... > > > 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. > > > } > > ... > > > static int stk3310_resume(struct device *dev) > > Ditto. > > -- > With Best Regards, > Andy Shevchenko