From: georgi.djakov@linaro.org (Georgi Djakov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 2/2] amba: Propagate match errors to the driver core
Date: Mon, 11 Apr 2016 17:58:36 +0300 [thread overview]
Message-ID: <1460386716-23262-2-git-send-email-georgi.djakov@linaro.org> (raw)
In-Reply-To: <1460386716-23262-1-git-send-email-georgi.djakov@linaro.org>
Currently, when we scan the bus for matching devices, we assume that
the clock controller is probed and available, but that might be not
always true. If the bus clock is unavailable, we just silently fail
to detect devices.
Handle this by propagating the errors up to the driver core, so that
it can retry the scan later.
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
drivers/amba/bus.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index a32a43dbaccc..0d9a342a73f8 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -86,15 +86,21 @@ static int amba_read_periphid(struct amba_device *adev)
iounmap(tmp);
+ if (r < 0)
+ return r;
+
return adev->periphid ? 0 : -ENODEV;
}
static const struct amba_id *
amba_lookup(const struct amba_id *table, struct amba_device *dev)
{
- int ret = 0;
+ int ret;
- if (amba_read_periphid(dev))
+ ret = amba_read_periphid(dev);
+ if (ret < 0)
+ return ERR_PTR(ret);
+ if (ret)
return NULL;
while (table->mask) {
@@ -111,12 +117,17 @@ static int amba_match(struct device *dev, struct device_driver *drv)
{
struct amba_device *pcdev = to_amba_device(dev);
struct amba_driver *pcdrv = to_amba_driver(drv);
+ const struct amba_id *id;
/* When driver_override is set, only bind to the matching driver */
if (pcdev->driver_override)
return !strcmp(pcdev->driver_override, drv->name);
- return amba_lookup(pcdrv->id_table, pcdev) != NULL;
+ id = amba_lookup(pcdrv->id_table, pcdev);
+ if (IS_ERR(id))
+ return PTR_ERR(id);
+
+ return id != NULL;
}
static int amba_uevent(struct device *dev, struct kobj_uevent_env *env)
next prev parent reply other threads:[~2016-04-11 14:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 14:58 [PATCH v1 1/2] amba: Defer device peripheral ID read Georgi Djakov
2016-04-11 14:58 ` Georgi Djakov [this message]
2016-04-11 15:01 ` Russell King - ARM Linux
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=1460386716-23262-2-git-send-email-georgi.djakov@linaro.org \
--to=georgi.djakov@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).