All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>,
	songxiaowei@hisilicon.com, wangbinghui@hisilicon.com,
	bhelgaas@google.com, linux-pci@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	paul.gortmaker@windriver.com
Subject: Re: [PATCH v2] PCI: kirin: Fix section mismatch warning
Date: Mon, 1 Oct 2018 15:53:41 +0100	[thread overview]
Message-ID: <20181001145341.GC13049@red-moon> (raw)
In-Reply-To: <20180920105828.GB838@e107981-ln.cambridge.arm.com>

On Thu, Sep 20, 2018 at 11:58:28AM +0100, Lorenzo Pieralisi wrote:
> [+Paul]
> 
> On Wed, Sep 19, 2018 at 02:08:08PM -0700, Nick Desaulniers wrote:
> > On Wed, Sep 19, 2018 at 11:55 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > >
> > > WARNING: vmlinux.o(.text+0x4758cc): Section mismatch in reference from
> > > the function kirin_pcie_probe() to the function
> > > .init.text:kirin_add_pcie_port()
> > > The function kirin_pcie_probe() references
> > > the function __init kirin_add_pcie_port().
> > > This is often because kirin_pcie_probe lacks a __init
> > > annotation or the annotation of kirin_add_pcie_port is wrong.
> > >
> > > Add the __init annotation to both kirin_pcie_probe and
> > > kirin_pcie_add_msi then use builtin_platform_driver_probe
> > > instead of builtin_platform_driver + .probe to avoid a section
> > > mismatch warning with kirin_pcie_driver.
> > >
> > > Fixes: fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver")
> > > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > > Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > >
> > > v1 -> v2:
> > >
> > > Instead of removing the annotation on kirin_add_pcie_port, add it to
> > > kirin_pcie_add_msi and kirin_pcie_probe. To avoid a warning with this
> > > configuration, use builtin_platform_driver_probe.
> > >
> > >  drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++-----
> > >  1 file changed, 4 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
> > > index 5352e0c3be82..f64fed12de51 100644
> > > --- a/drivers/pci/controller/dwc/pcie-kirin.c
> > > +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> > > @@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = {
> > >         .host_init = kirin_pcie_host_init,
> > >  };
> > >
> > > -static int kirin_pcie_add_msi(struct dw_pcie *pci,
> > > -                               struct platform_device *pdev)
> > > +static int __init kirin_pcie_add_msi(struct dw_pcie *pci,
> > > +                                    struct platform_device *pdev)
> > >  {
> > >         int irq;
> > >
> > > @@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci,
> > >         return dw_pcie_host_init(&pci->pp);
> > >  }
> > >
> > > -static int kirin_pcie_probe(struct platform_device *pdev)
> > > +static int __init kirin_pcie_probe(struct platform_device *pdev)
> > >  {
> > >         struct device *dev = &pdev->dev;
> > >         struct kirin_pcie *kirin_pcie;
> > > @@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = {
> > >  };
> > >
> > >  static struct platform_driver kirin_pcie_driver = {
> > > -       .probe                  = kirin_pcie_probe,
> > >         .driver                 = {
> > >                 .name                   = "kirin-pcie",
> > >                 .of_match_table = kirin_pcie_match,
> > >                 .suppress_bind_attrs = true,
> > >         },
> > >  };
> > > -builtin_platform_driver(kirin_pcie_driver);
> > > +builtin_platform_driver_probe(kirin_pcie_driver, kirin_pcie_probe);
> > 
> > It would be good to get additional review from someone who knows more
> > about driver callback lifecycles, but I think this is the correct fix.
> > Thanks Nathan.
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> 
> AFAICS we can't use builtin_platform_driver_probe() if the probe()
> itself may need deferral (and I *reckon* it may need that, see eg
> clk_get()) so I suspect we have to go back to v1 for the patch,
> apologies if so.

I think that the best course of action consists in merging v1 since
we have not reached a definitive conclusion on v2, please let me
know.

Thanks,
Lorenzo

  reply	other threads:[~2018-10-01 14:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19 18:53 [PATCH v2] PCI: kirin: Fix section mismatch warning Nathan Chancellor
2018-09-19 21:08 ` Nick Desaulniers
2018-09-20 10:58   ` Lorenzo Pieralisi
2018-10-01 14:53     ` Lorenzo Pieralisi [this message]
2018-10-01 15:12       ` Nathan Chancellor
2018-10-01 16:44         ` Lorenzo Pieralisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181001145341.GC13049@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=songxiaowei@hisilicon.com \
    --cc=wangbinghui@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.