Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp280604pxb; Tue, 19 Oct 2021 02:45:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeT67xDmrhgFsgDmddwWKS4P74tykHAF/Ouccr+a3Ukt1HbNP/wbuJto/ADTnx9n/EjYlb X-Received: by 2002:a17:907:6d87:: with SMTP id sb7mr36716013ejc.254.1634636728376; Tue, 19 Oct 2021 02:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634636728; cv=none; d=google.com; s=arc-20160816; b=v5gAXNGt4iM44nWMoLzCPsvBEz48tyW8cbGz9nSg6QU5LBKhffdOYxxw03pJq6ihy2 fcKgK6vs9ysFEz/Aa293ikhBNGmZ96c9sLc0jhSiKfw8pnz3cQwK5P49g9gBzykpRmHC nXz5392DxMyiH/wewbkaTE7MNzt/zqlbKmn1jiHDD4oN7VeokjjPdXQrBpoap/RaUpHv xwARRVHKLBvvtqXhztJhjqLSLnoMw28MXIps9kap7+zCMQUn5CyzU0wBnUOSm+RPsxny aARymERynQruyWvlQP8X/6l5SBuE0GCbsWl2QuAgo2zR5ZHve+8ykN4W2jqhGxPBBAd/ aIpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=n7YKRxwse793lrKqSk9SHqL6dxdBxDnxSrAXWiPtmjE=; b=skv2UU2CtxPCk18Ew0MYrwdMXRtZZivnda+XcR4SZRYco05OGUiBEehDTUp19Ls7UG NVld7ReHjJBfaAZcEyWrbKeZ1J5GEa0u7cYDcBeaYSON7+VQG6Pib72cQIrek8hK+5jY NumhwJC3jy5MtBnlP7B2WsX72tOhnm8VEsvAMTL6nbD1ICHRpPT07gYzssk4vK6AFQPo HMGqlNeQHfmL95CU9H+h+yFHtUUoayAx3StNX0tYYheRx/w4vNUOf45m0/5OR78c8lWk 9O9/nA2fqfEmXTHr/K4PaLi67pUcKP0XyQgKVBDnlXNwKFDi8XIwVKClZI8KztcSo6x6 fqcg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds5si30173957ejc.377.2021.10.19.02.45.02; Tue, 19 Oct 2021 02:45:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234955AbhJSJnL (ORCPT + 99 others); Tue, 19 Oct 2021 05:43:11 -0400 Received: from foss.arm.com ([217.140.110.172]:46748 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234680AbhJSJnH (ORCPT ); Tue, 19 Oct 2021 05:43:07 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0F6B3D6E; Tue, 19 Oct 2021 02:40:55 -0700 (PDT) Received: from lpieralisi (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B166C3F73D; Tue, 19 Oct 2021 02:40:53 -0700 (PDT) Date: Tue, 19 Oct 2021 10:40:48 +0100 From: Lorenzo Pieralisi To: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Songxiaowei , Binghui Wang , Bjorn Helgaas , Rob Herring , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v13 09/10] PCI: kirin: fix poweroff sequence Message-ID: <20211019094048.GA24481@lpieralisi> References: <8116a4ddaaeda8dd056e80fa0ee506c5c6f42ca7.1634539769.git.mchehab+huawei@kernel.org> <20211018102127.GD17152@lpieralisi> <20211018153716.0370a66c@sal.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211018153716.0370a66c@sal.lan> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 18, 2021 at 03:37:16PM +0100, Mauro Carvalho Chehab wrote: > Em Mon, 18 Oct 2021 11:21:27 +0100 > Lorenzo Pieralisi escreveu: > > > On Mon, Oct 18, 2021 at 08:07:34AM +0100, Mauro Carvalho Chehab wrote: > > > This driver currently doesn't call dw_pcie_host_deinit() > > > at the .remove() callback. This can cause an OOPS if the driver > > > is unbound. > > > > This looks like a fix, it has to be marked as such. > > Well, without patch 10/10, the .remove() ops won't be called, > so, it is not really a fix, but I can surely add a c/c > stable@vger.kernel.org and add a Fixes: tag here. You have a point - unless we send patch 10 to stable as well I would not tag it then. > > > While here, add a poweroff function, in order to abstract > > > between the internal and external PHY logic. > > > > > > Acked-by: Xiaowei Song > > > Signed-off-by: Mauro Carvalho Chehab > > > --- > > > > > > See [PATCH v13 00/10] at: https://lore.kernel.org/all/cover.1634539769.git.mchehab+huawei@kernel.org/ > > > > > > drivers/pci/controller/dwc/pcie-kirin.c | 30 ++++++++++++++++--------- > > > 1 file changed, 20 insertions(+), 10 deletions(-) > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c > > > index b17a194cf78d..ffc63d12f8ed 100644 > > > --- a/drivers/pci/controller/dwc/pcie-kirin.c > > > +++ b/drivers/pci/controller/dwc/pcie-kirin.c > > > @@ -680,6 +680,23 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { > > > .host_init = kirin_pcie_host_init, > > > }; > > > > > > +static int kirin_pcie_power_off(struct kirin_pcie *kirin_pcie) > > > +{ > > > + int i; > > > + > > > + if (kirin_pcie->type == PCIE_KIRIN_INTERNAL_PHY) > > > + return hi3660_pcie_phy_power_off(kirin_pcie); > > > + > > > + for (i = 0; i < kirin_pcie->n_gpio_clkreq; i++) { > > > + gpio_direction_output(kirin_pcie->gpio_id_clkreq[i], 1); > > > + } > > > > It looks like you are adding functionality here (ie gpio), not > > just wrapping common code in a function. > > It is just reverting the power on logic there. What I am saying is that executing: for (i = 0; i < kirin_pcie->n_gpio_clkreq; i++) gpio_direction_output(kirin_pcie->gpio_id_clkreq[i], 1); is an addition to what current code does AFAICS (ie you are not just moving code into a function - kirin_pcie_power_off(), you are adding to it), it is a logical change that belongs in a separate patch. There are two logical changes: - Adding dw_pcie_host_deinit() - Moving PHY power off code into kirin_pcie_power_off() (and adding gpio handling in it) That's what I read from the diffstat, please correct me if I am wrong. Thanks, Lorenzo > > > > Also, remove the braces, they aren't needed. > > Yeah, I forgot to drop it, when I dropped a tem code that had some > dev_dbg() on it. > > I'll drop on v14. > > Regards, > Mauro