From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Saravana Kannan <saravanak@google.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
John Stultz <john.stultz@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Android Kernel Team <kernel-team@android.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] amba: Remove deferred device addition
Date: Thu, 4 Mar 2021 14:12:05 +0000 [thread overview]
Message-ID: <20210304141205.GC1463@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAGETcx8KQ7cm7irv-vsBzqYfZqSMz4c3_hD_V55gxjVM1vd=PA@mail.gmail.com>
On Wed, Mar 03, 2021 at 08:08:44PM -0800, Saravana Kannan wrote:
> Marek,
>
> I tested it and saw the device get added before the resources were
> available and the uevent file looked okay. Would you mind testing it
> further?
To put it bluntly, if you have tested this, the testing was not very
effective. Deleting the lines that are removed by the patch so we can
see what the new code looks like below:
> > +int amba_device_add(struct amba_device *dev, struct resource *parent)
> > {
> > + int ret;
> >
> > WARN_ON(dev->irq[0] == (unsigned int)-1);
> > WARN_ON(dev->irq[1] == (unsigned int)-1);
> >
> > ret = request_resource(parent, &dev->res);
> > if (ret)
> > + return ret;
> >
> > + /* If primecell ID isn't hard-coded, figure it out */
> > + if (dev->periphid) {
> > + ret = amba_read_periphid(dev);
So, if the peripheral ID has _already_ been set, we attempt to read the
peripheral ID from the device. Isn't that just wrong?
> > + if (ret && ret != -EPROBE_DEFER)
> > + goto err_release;
> > /*
> > + * AMBA device uevents require reading its pid and cid
> > + * registers. To do this, the device must be on, clocked and
> > + * out of reset. However in some cases those resources might
> > + * not yet be available. If that's the case, we suppress the
> > + * generation of uevents until we can read the pid and cid
> > + * registers. See also amba_match().
> > */
> > + if (ret)
> > + dev_set_uevent_suppress(&dev->dev, true);
> > }
If the peripheral ID has not been set, we don't attempt to read it, and
we generate an add event when the amba device is added with a zero
peripheral ID.
I guess that if() statement should be negated - and with such an error,
I fail to see how this code could have been properly tested.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2021-03-04 14:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 3:59 [PATCH v2] amba: Remove deferred device addition Saravana Kannan
2021-03-04 4:08 ` Saravana Kannan
2021-03-04 14:12 ` Russell King - ARM Linux admin [this message]
2021-03-04 15:48 ` Saravana Kannan
2021-03-04 4:44 ` Saravana Kannan
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=20210304141205.GC1463@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsaenzjulienne@suse.de \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=sudeep.holla@arm.com \
--cc=ulf.hansson@linaro.org \
/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