Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2629273rdg; Mon, 16 Oct 2023 09:51:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLeW9GZDZND1+CngGRbUya2r926iIcY7NIvtN+3zK3AjC70A+AbnFoSS/uGbvqruGW1Aob X-Received: by 2002:a05:6a20:3d1e:b0:16b:80d3:7f10 with SMTP id y30-20020a056a203d1e00b0016b80d37f10mr27102858pzi.34.1697475091498; Mon, 16 Oct 2023 09:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697475091; cv=none; d=google.com; s=arc-20160816; b=bivYylo9STImFj/KmRnYXffljvhgjvi27xfo1kZZ9L9IqoFd4MyAsc/qRYG2h7u3Gd z9Yo5up0IwC2Ff5spaMPJqr0sK5gDmvbEN0aUglahJ4Rv2W9re+is1m7u6V97vU+1Zdz gvTnbljfDDROmEZWAhyFU7sDj3jGUI+tdoOg51ykUxSNxj4+4S2WG320jwgnPUyjlYyq hBwVetUn5ecUM3bWJ+WQL2v7N53vEJH4Bt8Cj0sYpLW/t72exh2Bc/n4iNrDwTSSLmlW FRvHXAThQ/M3yVPg9Y0nIJaKE7Mg747jshx33sKbnX8NChKvXjiy0PELUypsQHwGluHO vnTQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QMErPVjbDQWKUZJi0yx3PHwgd44uCsmqExmEKyoGenQ=; fh=VA/jyCjQbot0VzsAfJG54M7AW6RTyJd+G/F2Q2p5vJc=; b=tt8DT0IaIn26P/De8a/ZTj5B+ukDkM18dQapWhnRKFZMoXXDJ9niMbfvJHi1VC+KYZ sYEPVinF4Dma8XMcIhWsP5B6WSI0KO19RrfadsxhmPEGfmzroVlf3T2aIJo7l4kE0g5z 8RjqFrCGikfZWZvp71/DVzsXqkLcBl71Gc3eA2PyLSBmowydkp64kxnLECo8Yej3JcpV RmEIE08sHY3NC72d7Vrl5H40xPOHnyarHQwZtOsn5LzkLi8mCzSwjhPajziPDLjzBDuc fIyTeT7x3fBJOqzvcDFYTgzU7fFiFDWZVeZSd6UJTUiphzTF6JuwH+YCpfSQQEGaO+SU DyZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zWk9E7Ir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id l7-20020a632507000000b005702257f32esi10786481pgl.185.2023.10.16.09.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:51:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zWk9E7Ir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8997B8083B03; Mon, 16 Oct 2023 09:51:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233901AbjJPQus (ORCPT + 99 others); Mon, 16 Oct 2023 12:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233006AbjJPQua (ORCPT ); Mon, 16 Oct 2023 12:50:30 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63F9046CEA for ; Mon, 16 Oct 2023 09:40:47 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-66d134a019cso30842566d6.3 for ; Mon, 16 Oct 2023 09:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697474446; x=1698079246; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=QMErPVjbDQWKUZJi0yx3PHwgd44uCsmqExmEKyoGenQ=; b=zWk9E7Ir6vxH76P5DZnzRjvYqmPfoyDwHBQv23F85KEgYCgx6VJHoVNxizddvlapxL zEIt5kAkN1T8FVVHtzQzxo9O0JhXm52ZMQ0lxJ+b5e97huR2kGX6dQnmnszD91RcNK6d x5/qVinEqtCVIhoiF4y9t1vHFnLzfagUdmL8AkIfNjSetz2OLcepJ4WINuKt8nK79Pyz ipDZLfVbXpRwcQ+rXk6VEQP19HZG0YRLrBv7GP3zQJDnHctxmRKLuxnT46ReaUR6wRH7 k/BoCFfTPzYV7i9VPfd2xwzhwxsIj9h1qvZDcufx7GlPcaGuTqwk82Kw3JXA0n8omqID vPhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697474446; x=1698079246; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QMErPVjbDQWKUZJi0yx3PHwgd44uCsmqExmEKyoGenQ=; b=r18C8RpDhiYIpyYP1dmztBXxHmIzWD0/AxmayDyiqZVJXTWUWCMm/3f94tb5ZMqEB8 pyaKcb6PwYdPslCimQJniP7Zq86rrEMBPLOP7TuTOQj1CAJKa1Moh0TWqnR310eqR0gf 3skVbORurD0uSZmIixpl7VvBOrd51PPLJPmq1TGuIlr9fpF/6uV1GrgceaAGPBG3gjL6 ZofCxa8lxOOKJ08ivZhbl6zaW+izbis/LP3OLKsqF2ZnUQnzGKJiAiRmjaET809Pfk7R XpNMIg6ijLh0y3DhbwbYVO7xY/gVKC/XHV8doHgz7BvXRuRS2vkqhdWBsQtufc9Oju5G vkhQ== X-Gm-Message-State: AOJu0YwEkFQT3IwTQegc53xZeY2mVp34P8JF1PiwVRT3yJaQqcbYSSQq AaFACB1uoSOumcWkEGAmPk+e X-Received: by 2002:a05:6214:cae:b0:66d:28a5:d153 with SMTP id s14-20020a0562140cae00b0066d28a5d153mr11497866qvs.47.1697474445956; Mon, 16 Oct 2023 09:40:45 -0700 (PDT) Received: from thinkpad ([117.207.31.199]) by smtp.gmail.com with ESMTPSA id dn8-20020a056214094800b0065b0e724f83sm3548177qvb.6.2023.10.16.09.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:40:45 -0700 (PDT) Date: Mon, 16 Oct 2023 22:10:36 +0530 From: Manivannan Sadhasivam To: Frank Li Cc: Minghuan Lian , Mingkai Hu , Roy Zang , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , "open list:PCI DRIVER FOR FREESCALE LAYERSCAPE" , "open list:PCI DRIVER FOR FREESCALE LAYERSCAPE" , "moderated list:PCI DRIVER FOR FREESCALE LAYERSCAPE" , open list , imx@lists.linux.dev Subject: Re: [PATCH 1/3] PCI: layerscape: add function pointer for exit_from_l2() Message-ID: <20231016164036.GE39962@thinkpad> References: <20230915184306.2374670-1-Frank.Li@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230915184306.2374670-1-Frank.Li@nxp.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:51:28 -0700 (PDT) On Fri, Sep 15, 2023 at 02:43:04PM -0400, Frank Li wrote: > Difference layerscape chip have not difference exit_from_l2() method. > Using function pointer for ls1028. It prepare for other layerscape > suspend/resume support. > How about: Since difference SoCs require different sequence for exiting L2, let's add a separate "exit_from_l2()" callback. This callback can be used to execute SoC specific sequence. > Signed-off-by: Frank Li > --- > drivers/pci/controller/dwc/pci-layerscape.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c > index b931d597656f6..20c48c06e2248 100644 > --- a/drivers/pci/controller/dwc/pci-layerscape.c > +++ b/drivers/pci/controller/dwc/pci-layerscape.c > @@ -39,6 +39,8 @@ > > struct ls_pcie_drvdata { > const u32 pf_off; > + const struct dw_pcie_host_ops *ops; Where is this ops used? If this is added as a preparatory for next patches, I'd suggest you to move it to the respective one instead to avoid confusion. > + void (*exit_from_l2)(struct dw_pcie_rp *pp); > bool pm_support; > }; > > @@ -180,6 +182,7 @@ static const struct ls_pcie_drvdata ls1021a_drvdata = { > static const struct ls_pcie_drvdata layerscape_drvdata = { > .pf_off = 0xc0000, > .pm_support = true, > + .exit_from_l2 = ls_pcie_exit_from_l2, > }; > > static const struct of_device_id ls_pcie_of_match[] = { > @@ -213,7 +216,7 @@ static int ls_pcie_probe(struct platform_device *pdev) > pcie->drvdata = of_device_get_match_data(dev); > > pci->dev = dev; > - pci->pp.ops = &ls_pcie_host_ops; > + pci->pp.ops = pcie->drvdata->ops ? pcie->drvdata->ops : &ls_pcie_host_ops; This one also. > > pcie->pci = pci; > > @@ -251,7 +254,7 @@ static int ls_pcie_resume_noirq(struct device *dev) > if (!pcie->drvdata->pm_support) > return 0; > > - ls_pcie_exit_from_l2(&pcie->pci->pp); > + pcie->drvdata->exit_from_l2(&pcie->pci->pp); You should always check for the existence of the callback first before invoking it. - Mani > > return dw_pcie_resume_noirq(pcie->pci); > } > -- > 2.34.1 > -- மணிவண்ணன் சதாசிவம்