From patchwork Mon Apr 11 14:58:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 8803201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 266C59F36E for ; Mon, 11 Apr 2016 15:08:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3EB0920303 for ; Mon, 11 Apr 2016 15:08:53 +0000 (UTC) Received: from bombadil.infradead.org (unknown [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 155AC202B8 for ; Mon, 11 Apr 2016 15:08:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1apdIw-0001H4-Hu; Mon, 11 Apr 2016 14:59:06 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1apdIs-0001D7-4Q for linux-arm-kernel@lists.infradead.org; Mon, 11 Apr 2016 14:59:03 +0000 Received: by mail-wm0-x22e.google.com with SMTP id n3so108514966wmn.0 for ; Mon, 11 Apr 2016 07:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3pYYojhGsd+PAStlI7zwIS6QqQ/EOEwBU7bB3FeJ9NI=; b=hcktIMBaXErkbYphBH9V8XY6dON4QnFGzF0ORc8FPh88j8b2tbT6RrQQSgzcdkyuzN TgtkIs0UdcKcDIWV8LPJBw+84dHTB1bM/cnOp18WqpWjZ/q8JHiY9+Ou5ltIO5xXJxW/ kN4RyswQPko2o66VUMNsivEQF/ezSUQhpBZJ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3pYYojhGsd+PAStlI7zwIS6QqQ/EOEwBU7bB3FeJ9NI=; b=e/JBLK8RDmtGqEZYZYi4JMD1VJhuxSTjjMWj0BEl4aF4oNtoFyQirA1yUNdpIM/my3 PvP/ctbwK3PqtYRnIbEAyG9IL35V2Jv5CXf+AuM53BHA4/FmS8DAnxxkAXhzu8s4RX0R Vgv4qHYn4AohmZvUaU+WIDB8JEHldTcboY+EAHte8LVOlmQt7a3DFYRggzvXB35LKZvP dzaRgBuCZcbLtk3Qn6YHHQfAjF9f9QWpsOUgNUwdHrOq/rgmzEGSxbT2BV+UyztJ3noz RyOOj481iSyrpZuWjn2GCuuBl5SkeTrdq8YSENXC42UmbvDO5+oVdrXly7BpMOB2RaFT ZbFA== X-Gm-Message-State: AD7BkJLMlJOh3yFxjkFCIZ7hHD7Sbx8mdht3nn9cswQxycXrJe6SCuu3f3B3amXXuukWvnQj X-Received: by 10.28.145.196 with SMTP id t187mr18431025wmd.81.1460386720310; Mon, 11 Apr 2016 07:58:40 -0700 (PDT) Received: from mms.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id qb8sm28332926wjc.24.2016.04.11.07.58.39 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Apr 2016 07:58:39 -0700 (PDT) From: Georgi Djakov To: linux@arm.linux.org.uk Subject: [PATCH v1 2/2] amba: Propagate match errors to the driver core Date: Mon, 11 Apr 2016 17:58:36 +0300 Message-Id: <1460386716-23262-2-git-send-email-georgi.djakov@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1460386716-23262-1-git-send-email-georgi.djakov@linaro.org> References: <1460386716-23262-1-git-send-email-georgi.djakov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160411_075902_326548_6CF7C1DE X-CRM114-Status: GOOD ( 15.72 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iivanov.xz@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RDNS_NONE,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)