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: 65531 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1523045lbl; Mon, 11 Apr 2016 07:59:18 -0700 (PDT) X-Received: by 10.98.31.218 with SMTP id l87mr33524210pfj.101.1460386758798; Mon, 11 Apr 2016 07:59:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ya3si4063417pab.2.2016.04.11.07.59.18; Mon, 11 Apr 2016 07:59:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753183AbcDKO6x (ORCPT + 8 others); Mon, 11 Apr 2016 10:58:53 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36038 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753200AbcDKO6l (ORCPT ); Mon, 11 Apr 2016 10:58:41 -0400 Received: by mail-wm0-f42.google.com with SMTP id v188so90132504wme.1 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=jJMBQhCkXlYILNAYmjQdszHqXMYBXLLxvNRnylR8UADXoir4JCnXhMH0GZRHXE5ZW6 BhMVFVw0f+6TXdenpISQ1vTGLF2gKM8rvzc+pfQwKyIXry0K2FzGgKm/srfo/QiKSm05 F1+xde4udAK24V8qpYEijr1UzG3tEftSrgR1IM0OC9qgqrtzg886r87I4jg2i8P/7QLe /lZfwZF37z9VhWzXlVSg3VhiaxSU++ZUE/tKW8cWuP4iDIEnski40u/BZ+/NHD116zta aTPeTYNko1wat+lqhzh8Bg8AeAyGxY+XxG6kFzCev2v8XuOVSRqzoDDTEk9F0TSosVmG Mudg== X-Gm-Message-State: AD7BkJJdjdhUew7MdjR0d1eCYzvAgc7XFc9tJ4n1FDsn7JGUv4UCOfTAyWDJj4wkCZcMjXxz 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 Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, iivanov.xz@gmail.com, georgi.djakov@linaro.org 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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.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 --- drivers/amba/bus.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)