Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp529665lqd; Wed, 24 Apr 2024 09:15:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVM0DBZMdzm8iZ7Vt0MSkfTS4b5eF8lb7+d/v7Tvv1jN/XI6hlI3LZC2bzG3XdT5zJehSK8aLXX0hHArfBICGmHySeZLWq6y9kQbCwAnQ== X-Google-Smtp-Source: AGHT+IHdD4khRCG7nUrrbS0gMNllpiK4O29lFOTF0HoO7D3ZTJyCC4dgwCzEtZod5Anul+hOQLE0 X-Received: by 2002:a05:6e02:2167:b0:36a:23d1:659 with SMTP id s7-20020a056e02216700b0036a23d10659mr3675301ilv.29.1713975308223; Wed, 24 Apr 2024 09:15:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713975308; cv=pass; d=google.com; s=arc-20160816; b=t/oBR3W/voDsP+2CYCbCkj7+0ITOhFIwkEAOz/fyMnTEL9F9c9ktJTmhSo53zADon8 dKD9DFRlOgBw+r4UfitPTVXhB5yJH2LUlNCAAx7dWVdFYR5VE0RRT3n6H+m6p3fjWy5t LcAAHcwyfWVPbInHmndPrgENlfYVP7UXXPsmDK6dldJQAZiwgK0XR4fspEMJ9g2roQfP SkHEYeevNwTisj4Z83SvssWsmEkGJ8dX+af+/zEgOt6NhcGR3vGUfjGBkOgil8U9cgIH dynYszaN2oDbYBLvrr+F5hrQ1aFmwq1FrBCUuCGxi7bWAAHH7xccxaohR6Da7FIiGnlO Qq1Q== 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=Adp4v2pe/zvI48d5RdCekvh3JyJbnJMJBR/45Un9yJ8=; fh=KB98FGhLn3Xbhv6UuBtllgz9+y9/d3mE9gB544/pTLA=; b=FOjypUGBiEW6ek/81yQFxVhVTvjbVXoFJlOfPw7/0kgHUmdpcb2vuz3N+n6uhqJQOM TnZFAcFfczDyeFLc276kIp+YFGmVVCBjRj5THK8XAPcy4ALaH55m5uy7enlD+Wz9nUwS fbtAlzHWBy/ASvohHaxTWhMqBWsXqGqu+X6YkIMhd7BGK8WnoUN1tFFhpfKfVlWSSeEz tj/VKzs3/Bad0kc3/rIn39VVV4E0BRoY997QkXz1COj9jemdXhvDXN9NHWLSX1q+3ZVU 5W/aIXvcj8z1m7B4xsaAGViEoqXDzbMZ/0yKEPDtbSaVZf4QUhAw7pzz6k0ez9YW2bg6 qBog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=AV16uSg1; 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-157300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q26-20020a63751a000000b005f807dfdb0fsi8585133pgc.222.2024.04.24.09.15.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 09:15:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157300-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=@xff.cz header.s=mail header.b=AV16uSg1; 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-157300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157300-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BBBC7296180 for ; Wed, 24 Apr 2024 16:15:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEB9E168AF5; Wed, 24 Apr 2024 16:14:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="AV16uSg1" 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 B6070161322; Wed, 24 Apr 2024 16:14:13 +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=1713975256; cv=none; b=KsEvxqAJW52DRQKa4E7lD6iMbFCsy5cHW+wenSY1Nuomq3m3HyyW35uTFoO3ZEapoNaxf3u8I1TsdLhpkMzNcb/m9sRGXszQ13IBjWh89ItGz+YnLlZX0hVnDYgz6PgZANh349++pflSctQOdlsGsSqwt222qrgeHHsvwkbJg8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713975256; c=relaxed/simple; bh=A6NNMZIxwRDoaqJP/sVaKEK1Sqp369lZtQwhGk7s/xk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sesQFRrhsg8bJ+BlkG+TDGvQNsEs7L6IjUusb92uC/Gge2qAhBiPX3EyGFyI/YdaW1UszR2+PZs5fJFZ/lWPgiyyJZL/ML+x/E+g38kdHOcTd3wFiBdHLUeZ7/BA/NYbdCAiM2xvnCXc9mM7vRFroZNWChp9OPi3WDlgU7B72EM= 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=AV16uSg1; 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=1713975251; bh=A6NNMZIxwRDoaqJP/sVaKEK1Sqp369lZtQwhGk7s/xk=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=AV16uSg1wFnhhvZ4t52YPzs2VQRUqhd4lB5Bvib4MOLVgu2EzYQZUZbn+LF1IN4nm xqH7wwuUVHdQmNDONHXeErqKyB+ICIo3BA6DSSrQsHn0Xub7zsvxqEjCd8iKzKp1Ob ux/KQ/cWf9JiNaLdYggxsWhVALFmPpGN/r7Fl+js= Date: Wed, 24 Apr 2024 18:14:10 +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: 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> <5qqil7ltqhdeabml6toqpcy773uhjxgwaz3txpy4kv4sz55o2y@hmar674eey7s> 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 06:20:41PM GMT, Andy Shevchenko wrote: > On Wed, Apr 24, 2024 at 3:59 PM Ondřej Jirman wrote: > > 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: > > ... > > > > > 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. > > Exactly, IRQ is registered with devm and hence the error path and > remove stages will got it in a wrong order. Makes no sense. IRQ is not enabled here, yet. So in error path, the code will just disable the regulator and devm will unref it later on. IRQ doesn't enter the picture here at all in the error path. > > Original code has a bug that IRQ is enabled before registering the > > IIO device, > > Indeed, but this is another bug. > > > 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. :) > > Because nobody cares enough to enable DEBUG_SHIRQ. Nice debug tool. I bet it makes quite a mess when enabled. :) Kind regards, o. > -- > With Best Regards, > Andy Shevchenko