Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1489334pxb; Thu, 28 Oct 2021 04:52:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS+abcXOlDJga+ageyjHufANoTvY084/NLJjYJN9y0Sy9q+lD1t1NxXG4Zo4KZWKgmrsLF X-Received: by 2002:a17:907:6ea1:: with SMTP id sh33mr4863369ejc.432.1635421946082; Thu, 28 Oct 2021 04:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635421946; cv=none; d=google.com; s=arc-20160816; b=AQ6dkmhJh8Hp45GFrgAgWNubO3DwZXxxeZfyI6jMI+elPDdpS+d8liCAzfUqjUoiJe +3oQr15JAOTIz0n65gHYnLYSeHNC19IHa2pVP3NaKbgJWfKBIoJQUvrM8ADNbpj5Fg04 1eVLsjQwJkJxiYq6Bh6YqM0MbMmdLzKsrykppB93nw8LxLPYSHelcdvAQuiWLGWRZtzO rQKdyKCRSmwRsOnlLLqnCn1RzY1KVOjGRkZtlAIadg4z/WGES7rSwBSEeTFJR6ONZXa9 CaUIWhkLv5q5kvWF1FCBzg7vPXQ+eVZEubaVjsLySuJkk3FXQWN2Ak/YpmaEmADC61p7 UYdw== 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=oM8rGtvPOxYRTHYeb3IcTiWFL//r52mlDFnjfyo807I=; b=fwpbaTlzJ93hydjdbATH442Pqcx+rnLgoCj9m3qnyScojnB6C1dFSFITUzxr/owXmA ue/zWYY9M7zSQKMnn2aXjaqp4kpOYlMhZU1+BSocqe6mu0DEGpXeekgQHs9yC12kTnh4 eZF8chBOyWnnGUgPJRiSJIHE4xiIrNHpyNfqR9Rje3Tp7W4jXswZAFdkEv7i8xdlR4mD WgZccpgNYPgt3zinYN6iCTwGP5s6ruovuy/JUvtn7e4wz2O0wCGdRhFAd0GwlwaEE39G AlTE3ixrykxllbyyoTpvwmPm1hxknkG4iln8dKU45u4AAP/ARFc1L6Kd49CImaKubtZu vj1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KgMLQjA4; 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 a25si3289021ejc.304.2021.10.28.04.52.02; Thu, 28 Oct 2021 04:52:26 -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=KgMLQjA4; 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 S230202AbhJ1Lwm (ORCPT + 99 others); Thu, 28 Oct 2021 07:52:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbhJ1Lwl (ORCPT ); Thu, 28 Oct 2021 07:52:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97A0D60FF2; Thu, 28 Oct 2021 11:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635421814; bh=hgapdR6qmDmcLaknmcSzOPWpHEWQJN4oJ2A60mUz22E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KgMLQjA40UB0Oac51b5wK4aZ7xx0UMxlA4RAJ16ovhhwvvbxhk7D4b70Pz/+S8uSz r+i/F2HTqDF09Ofl7Es6xWKpmGTaaJWS2Yg/KMpUNvmbDwt8XF8U4q4ithCUrDt4Q3 umCl434jYw4vBlhgxhsJLAGCqWZ0GruZvTfwBWhaWkNCbci8o0/GWsPcc+dciVY8PN LgnycatH/yG9IgJSfAODHTqc3cIw6zTU7MEngZgPi6+JrylHJg5ffOC67ARaq3N7B9 Zyy/B2tYwUvjZ4DjksV3jOREt/J9yGIViU5jqEkpH36q0mOD5SuHVXU+qs2tdHWYno mBNIa7ZW6WJ/g== Date: Thu, 28 Oct 2021 12:50:08 +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="RKFvMGWaPRDm/WJh" Content-Disposition: inline In-Reply-To: X-Cookie: try again Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --RKFvMGWaPRDm/WJh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 28, 2021 at 06:50:58AM +0000, Richard Zhu wrote: > > I would be really surprised to see PCI hardware that was able to support a > > supply being physically absent, and this use of _is_enabled() is quite > > simply not how any of this is supposed to work in the regulator API even > > for regulators that can be optional. > [Richard Zhu] Actually, this regulator is one GPIO fixed regulator. > Controlled by SW to turn on (GPIO high) or turn off (GPIO low) the supply. > In some boards designs, this supply might be always on(GPIO high). > So, in point of SW driver view, this regulator is optional. No, it's not. The regulator API supports the systems where the regualtor is always on perfectly well, the client driver should not need to do anything to support them. > > Perhaps it's not causing problems in this design but if the supply is ever > > shared with anything else then the software will run into trouble. > > There will also be problems with the error handling on a system where > > the regulator needs to be controlled. > [Richard Zhu] This GPIO fixed regulator is only used by controller driver. > It makes sense to disable the enabled regulator when driver probe is failed. 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 other systems. --RKFvMGWaPRDm/WJh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmF6jm8ACgkQJNaLcl1U h9BLxgf/Zm+IGEbLXWh7e1XuPxfanEkwKtL8XvVb+F4KlVIKego05HBRd7BLknFd /HzU7BxR6iGIJE9KlLgl9p7qL6n6RZXatqZTFdkqElP/LS0WdwofBU0mYngVwUoJ Bt9LDQBMLxU/elYGbWCDTEQ1OmZc54if7ty5z+UQuZib/L8qQqF3hDKci5jcUsOx lPr2+lvxzDlbHRGZxseE7TZMcKtdUri58cBttYQTOgptD5HPwgD1gyx/Vg0rdimo xfCY52Hrv7C3UToRss7CySnSZV29AY3lONKh3IjtvMqpvNo2gDWIyFARtpM/5Nob ZJEZ+qQg+AjCsze/u0ox6CQgajm+SA== =HgqY -----END PGP SIGNATURE----- --RKFvMGWaPRDm/WJh--