linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergio Paracuellos <sergio.paracuellos@gmail.com>
To: Dan Carpenter <error27@gmail.com>
Cc: ye.xingchen@zte.com.cn, lpieralisi@kernel.org, kw@linux.com,
	robh@kernel.org, bhelgaas@google.com, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] PCI: mt7621: Use dev_err_probe()
Date: Mon, 3 Apr 2023 09:12:08 +0200	[thread overview]
Message-ID: <CAMhs-H8beY3AO83NkTM2_YYdcsqtv7Em01zqSE6wtPNdex8Dpw@mail.gmail.com> (raw)
In-Reply-To: <2e4f27f0-a4ac-4523-8f90-695a62973bd0@kili.mountain>

On Mon, Apr 3, 2023 at 6:50 AM Dan Carpenter <error27@gmail.com> wrote:
>
> On Thu, Mar 23, 2023 at 07:23:26AM +0100, Sergio Paracuellos wrote:
> > Hi,
> >
> > On Thu, Mar 23, 2023 at 4:45 AM <ye.xingchen@zte.com.cn> wrote:
> > >
> > > From: Ye Xingchen <ye.xingchen@zte.com.cn>
> > >
> > > Replace the open-code with dev_err_probe() to simplify the code.
> > >
> > > Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
> > > ---
> > >  drivers/pci/controller/pcie-mt7621.c | 7 +++----
> > >  1 file changed, 3 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
> > > index 63a5f4463a9f..964de0e8c6a0 100644
> > > --- a/drivers/pci/controller/pcie-mt7621.c
> > > +++ b/drivers/pci/controller/pcie-mt7621.c
> > > @@ -220,10 +220,9 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
> > >         }
> > >
> > >         port->pcie_rst = of_reset_control_get_exclusive(node, NULL);
> > > -       if (PTR_ERR(port->pcie_rst) == -EPROBE_DEFER) {
>
> So the theory here is that -EPROBE_DEFER is recoverable but other errors
> are not so we just ignore them?  Error pointers will trigger a WARN() in
> mt7621_control_assert/deassert().
>
>
> > > --
> > > 2.25.1
> >
> > Also, this is not a probe(), so I don't see a point of using
> > dev_err_probe() here.
>
> It's a weird thing to return -EPROBE_DEFER from something which is not
> a probe function...  Someone told me I should write a Smatch check for
> it but I never got around to doing that.

I don't remember clearly why this was returned in the first instance.
I think I just took the idea from pcie-mediatek driver for arm64 SoCs
platforms here:

https://elixir.bootlin.com/linux/v6.3-rc5/source/drivers/pci/controller/pcie-mediatek.c#L967

Thanks,
    Sergio Paracuellos
>
> In this case, I guess the user is supposed to see the error message and
> manually fix the probe order?  The dev_err_probe() will change the error
> message into a debug message so the user will not see it and will not be
> able to fix it.  So using dev_err_probe() will break things for the
> user.
>
> regards,
> dan carpenter
>

  reply	other threads:[~2023-04-03  7:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  3:45 [PATCH] PCI: mt7621: Use dev_err_probe() ye.xingchen
2023-03-23  6:23 ` Sergio Paracuellos
2023-04-03  4:50   ` Dan Carpenter
2023-04-03  7:12     ` Sergio Paracuellos [this message]
2023-03-23  8:21 ` AngeloGioacchino Del Regno
2023-04-03  4:41 ` Dan Carpenter
2023-04-03  5:05   ` Sergio Paracuellos
2023-04-03  6:09     ` Dan Carpenter
2023-04-03  7:12       ` Sergio Paracuellos

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=CAMhs-H8beY3AO83NkTM2_YYdcsqtv7Em01zqSE6wtPNdex8Dpw@mail.gmail.com \
    --to=sergio.paracuellos@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bhelgaas@google.com \
    --cc=error27@gmail.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    --cc=ye.xingchen@zte.com.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).