Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3019pxb; Fri, 29 Oct 2021 04:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsKKFsFbgDJd4kZ4Iizkxlvx334kjNkotv8u1xQXI1LST6lVh0kHp86TN21pcBKhU5t7U4 X-Received: by 2002:a63:c:: with SMTP id 12mr7894507pga.477.1635508068714; Fri, 29 Oct 2021 04:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635508068; cv=none; d=google.com; s=arc-20160816; b=k/tZbvA3pBAIG77u8mzeHOpONP7L95g2LCE7JjY9aR3Ow1ntSKvDpIKsfIJVCBmoUl 5WrR6PmxPnoUW/WGPWxSZyB7fnkogkMH4sVtAsPGfuELtyWspsU9hOsHYTjHf8M0Bsxk CI3ZNOIqcM19cdxwIK08lJPJRx93QstvxekBy7/gRm8YVIb+Yy5P+i6/RMYnkL4dpVfs KATmYgGvPJrQufraftcGNWu4ju4NIQBAw7B8upE2vZEujmE8fA4CCFYbD3DYa87LIxuw T6LP8zWttEkiYcEarArMiMqRvf/AgkqCzvIAnLQaCdhrEiR/cgCIlZFCRV0Z0jSxthlU W+eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WUlBSR5DFRcggmXNyKCGMxxHuzwxCH3G5dvNP1xv3Zk=; b=m0BY6xtJ9s+pQkaGwE+cME+lG4sNDn7thWQX24IvTRdIFEjcgvJ1ijFDXqfKNziRTm Tcgxl+38mmdN2aMzJ4ZM/J/wEB9sMv4rwerkyo0hyLlPWu689U8UDhJCrZyhlNbFLeIk M4FpdRldAJbezMBlJX9ww/h3pkJx3cbRE8TGDciTZU5YyasvGc3VuVN4QnR+QZcxzLN1 jiI9qnKyy9zBXGf0wXlT+OETu5IC4R6h/3r7TVUx7bnptgnY9gevsyovzPPMZbWP+znj 5rjTe/zaZxko3GcZZgO/dUZOCcVXstOqd0ZwgkptO5ltDXEULy8x5HMSdx+SwmPh6yZR SG8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sO28/ddo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si2327214pji.184.2021.10.29.04.47.34; Fri, 29 Oct 2021 04:47:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sO28/ddo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231411AbhJ2Lse (ORCPT + 99 others); Fri, 29 Oct 2021 07:48:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:52664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230492AbhJ2Lse (ORCPT ); Fri, 29 Oct 2021 07:48:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 657E960FC4; Fri, 29 Oct 2021 11:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635507965; bh=ADRsTG4KktqVoeo8au9Xp0rvCANd8RBoqqfeQJgiGEA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sO28/ddoZql7s0Bfn4pYerXoM34G8N1Zse6CK9yYoLJA+HIYf4DOcawUn8MaMUgQy FhkBqwXGqeN9wGXKKG8d5DYtJacckppyEgGn4vLtRThZ41zw3ksAcSiHfKPtRVA0JS bXBr3mDgER35cE+0RgnFjZwfzn2Nm2kClusbqGyrpdnZAuMhxwbBSUANfNa9MG8axk q9DcgNWpRqR+R4IuG1eFGdnlhLPTDIYgiXIPrIW2z5GNMxq6pxND5Y2Usl50abEXwf 6v/Zi3yzxxBth0Bq9SIZQSAY10Hb6iPrOPxP/4mGQf6+nMrsQ/TXkEqy1MhOPrI/be 7GCLROftAItsA== Date: Fri, 29 Oct 2021 12:46:00 +0100 From: Mark Brown To: Richard Zhu Cc: Francesco Dolcini , "l.stach@pengutronix.de" , "bhelgaas@google.com" , "lorenzo.pieralisi@arm.com" , "jingoohan1@gmail.com" , "linux-pci@vger.kernel.org" , dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" Subject: Re: [PATCH v3 3/7] PCI: imx6: Fix the regulator dump when link never came up Message-ID: References: <1634886750-13861-1-git-send-email-hongxing.zhu@nxp.com> <1634886750-13861-4-git-send-email-hongxing.zhu@nxp.com> <20211025111312.GA31419@francesco-nb.int.toradex.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ypW26rZg14WCTdak" Content-Disposition: inline In-Reply-To: X-Cookie: "Just the facts, Ma'am" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ypW26rZg14WCTdak Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 29, 2021 at 03:58:41AM +0000, Richard Zhu wrote: > > The driver should undo any enables it did itself, it should not undo any > > enables that anything else did which means it should never be basing > > decisions on regulator_is_enabled(). While the regulator may not be > > shared in the particular board you're looking at it may be shared in ot= her > > systems. > [Richard Zhu] Understood. Thanks. > Can I disabled this regulator in PCIe probe failure handler without the > regulator_is_enabled() check? If the driver called regulator_enable() (and that didn't return an error) it can always call regulator_disable() as many times as it called regulator_enable(), no need to check if the regulator is still enabled. =20 When the driver hasn't successfully called regulator_enable() it shouldn't call regulator_disable() even if the regualtor is enabled. This means that after your driver has enabled the regulator it can just disable it but between the regulator_get() and regulator_enable() it shouldn't do that. --ypW26rZg14WCTdak Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmF73vcACgkQJNaLcl1U h9AhbwgAgIcDmfHvv15AGtB8E/+5w/Jb0ChT7nLC0JRtsFgKrTA91hhmwjwOuQzb WmH5Ef8qFggm/GpfB58c48KB7SA4vks6kGjzAzro/fJQ4+9Bh6S0o62Ghnf78lKu dWdIvSnbeX1rXE/FoMF7sUMOi3dyKYAhOgYOQJFV0o6vEkgQJVqkkvCjupeGg8YO 7PeZfXvfzyTySuXVAmeSoinqb7EOR0U40WhbTqo9JzA2n8xp42GhJtdwIuX9b3Ml J1t0QLqdFvfcr+cdW28R+fJNF7JDdSyTmuAtjfIryp9LylxqcK9hV2ySAs6Gourw wvbdT+rMkhIjbi744gQnAdDXOQ49kg== =Upjl -----END PGP SIGNATURE----- --ypW26rZg14WCTdak--