Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp662042lqd; Wed, 24 Apr 2024 13:01:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+HavWOzhCiZEebbsPAHDJiIpjdw9yx+ryMNDPQBewuEhpD4j2DMaTs1d0zkp5Fe2wGQ2GeAg8ci4Api1eFGcYApXvpDrXrxNaoyJVeQ== X-Google-Smtp-Source: AGHT+IH0dFJXSfMaP4LDahGNMg9ZA2sJzxMbdVWtjFFKB9eBwOfBs+DNkfzjdjRJ2Zt8ZbYw539A X-Received: by 2002:a05:6e02:1525:b0:36a:1f36:6be5 with SMTP id i5-20020a056e02152500b0036a1f366be5mr4240756ilu.11.1713988868405; Wed, 24 Apr 2024 13:01:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713988868; cv=pass; d=google.com; s=arc-20160816; b=f//7P6ornFRCnf6auDRgwfqpTyfei+scjy4pLtHK8IPryHqmW7oETjVCHehZXtxkn9 ZOh06mquDXTMwCIEkDo76XA47CHNU5QpYHAb1G26WpTjb1Zn1voVQPLyeBbnimP9bVd1 S+D8G12O+Pkjqq90KoEcSFl+TB5yguBtMLxltUbBNJZRAx9gYhSS3MJ9C4C2I2sbSYta mWAvRSL37k8gTB/dA3QrwcsEN8FyiUwtVu4apfR2/7yr0rTKpENbbIr1r6ftuonVqVA7 jgubNbAEdHBm5xwOTy/XaaT23Lgkr84+eejUDrW9dsv5vEXiFAEDI5/j8ENaojQigG8w Ufhw== 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=vMnJUbXv2iCt7Lvc6wi1WLoAvlzzax2Or5J66mwqL+E=; fh=KB98FGhLn3Xbhv6UuBtllgz9+y9/d3mE9gB544/pTLA=; b=Ve2Lbl1626B6aG31NGIXVmDzlsU8+aE7j4x8Jz20Zv3gV7wpu73oPIlDGybO17k/tq FcPe9n7E9jl5pErkudOYTXU1t6yuJx3NgFOozw3sPTSalRp7W30BsRBL0ar02h9faSvr zO+y0mmLWGe1u2Xy7efviw4gLgZFVUEJMuJp4Cb0yF2SkNc2T54Miv2YzSfCfKl2FznD vCWDmezX2KB75Ooa899LKdc4PpM5nwdRz8ssk72dDRACN+A4QQuzEVyKc3eZoBzLBRmu nzrPpSNUItjYGTVtEcUg/UIwUqsRe32dBSQOBRG8/Iy1j8Hu6NOvtVtaztDqis0ihzrI xoWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=ymkNnORv; 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-157638-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157638-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. [139.178.88.99]) by mx.google.com with ESMTPS id k70-20020a638449000000b006049b7b6656si2545803pgd.413.2024.04.24.13.01.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:01:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157638-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=pass header.i=@xff.cz header.s=mail header.b=ymkNnORv; 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-157638-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157638-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 099E2283829 for ; Wed, 24 Apr 2024 20:01:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E03613DDAA; Wed, 24 Apr 2024 20:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="ymkNnORv" 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 0E0EF13B59F; Wed, 24 Apr 2024 20:00:48 +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=1713988851; cv=none; b=VmB3PbAbobBdzb/DcOMgHlLY9lrqNYuwZSvVtQ7bgKUNhbmlypIse1JSQgzOrY3jOFoivJsxjEyDb8bErcE7YyXRMTF7PTY+E3WPr14nh8qU7vBC9yGqSNhsi3aAzHb1aMR6RXXYyu5D9x/BmbYz1DVz06JYnShhSsbxeGPxRJs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713988851; c=relaxed/simple; bh=PDAVfIibszca/yt5F0VeGPq35/5g0qR5+vGvPxJ0lMo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MXXZsoc2mT9KwVvAb8Y4akihtsbSljFBfIRR0sayJmlYCUVdOlp1pg8mfW/hyO6SUCv9Fb8p6OKF4OgFz7ShfG0fn0Gkj38MAfDs0JoSiiSiBTpwf/I5Lb7VM52+QjSHY1lC1Pgti0+jwVqLJADDiGu+HE7kFKIhWL9ywdrdBbI= 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=ymkNnORv; 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=1713988846; bh=PDAVfIibszca/yt5F0VeGPq35/5g0qR5+vGvPxJ0lMo=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=ymkNnORv5kDLrd8/rlrBZZrrDJyZnYn+T8AGN7ULKjl1Wmvh8aueVYmyyBN7p7ewp HN8PsOhzxULWUwjATSjr+cm8JwHSo8EQafnc1o53AkS2UWHDY9SwfzMdMzByio7hwl xN6e7C6J0BM25jsAMs6NjvdDcsMzFpn/R1ivHTdQ= Date: Wed, 24 Apr 2024 22:00:46 +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 08:31:27PM GMT, Andy Shevchenko wrote: > On Wed, Apr 24, 2024 at 7:14 PM Ondřej Jirman wrote: > > 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. > > Huh?! > > > 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. > > Error path _after_ IRQ handler has been _successfully_ installed. > And complete ->remove() stage. Allright. So fixing the other issue I mentioned will fix this one too, because there will be no error path after IRQ enable, then. kind regards, o. > > > > 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. :) > > FWIW, I have had it enabled for ages, but I have only a few devices, > so I fixed a few cases in the past WRT shared IRQ issues. > > -- > With Best Regards, > Andy Shevchenko