From patchwork Mon Nov 15 13:51:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 12692583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A15DBC433FE for ; Mon, 15 Nov 2021 13:42:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70BD863218 for ; Mon, 15 Nov 2021 13:42:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 70BD863218 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9b24XEJqJvTZLnaBr7h8CqOAAJX1gVVngpZFrbijcHQ=; b=vntx0eRYhxWjIc NCGQK6+ikTzhAisUHJZ8ojgBQo240L0cuYV2HnjEb5ofn+H2rrnuA3sTBTYUdlSo4m3OEgGELxzre n7050PSMIuk5GIi65X5NLoaJSLJ4rMgSzmVyimtbbj66oImCScUq/SUeuRdBza7U2FY24m8Usbx8c EhmtM8FxhW2dxd+mBmd8JZLoKMhb5Y3phMnj7TUKFGGhClYcpqshHqaoKbT3jMEfJKw7tpjIFrrzK hjO9tcvxtUghoqjk00DWKn34deEMcNvq7157hXmqhbXDDoDKs1Ni9jODsU7YHxZyH7eIuN84W+QPL gX8dDjh+tA7aXrAcKNTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmcEP-00FhlE-7X; Mon, 15 Nov 2021 13:41:09 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmcDt-00Fhcl-0t for linux-arm-kernel@lists.infradead.org; Mon, 15 Nov 2021 13:40:38 +0000 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Ht9Dr2ysDzbhtB; Mon, 15 Nov 2021 21:35:40 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 15 Nov 2021 21:40:24 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 15 Nov 2021 21:40:23 +0800 From: Kefeng Wang To: , , CC: , , Kefeng Wang Subject: [PATCH Resend 2/2] amba: Move of_amba_device_decode_irq() into amba_probe() Date: Mon, 15 Nov 2021 21:51:48 +0800 Message-ID: <20211115135148.171786-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211115135148.171786-1-wangkefeng.wang@huawei.com> References: <20211115135148.171786-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_054037_292166_D5E3A195 X-CRM114-Status: GOOD ( 15.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Similar to other resources the AMBA bus "gets" for the device, move irq obtain from amba_device_add() to amba_probe(). Signed-off-by: Kefeng Wang --- drivers/amba/bus.c | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 16d3c009505b..e1a5eca3ae3c 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -171,6 +171,28 @@ static int amba_uevent(struct device *dev, struct kobj_uevent_env *env) return retval; } +static int of_amba_device_decode_irq(struct amba_device *dev) +{ + struct device_node *node = dev->dev.of_node; + int i, irq = 0; + + if (IS_ENABLED(CONFIG_OF_IRQ) && node) { + /* Decode the IRQs and address ranges */ + for (i = 0; i < AMBA_NR_IRQS; i++) { + irq = of_irq_get(node, i); + if (irq < 0) { + if (irq == -EPROBE_DEFER) + return irq; + irq = 0; + } + + dev->irq[i] = irq; + } + } + + return 0; +} + /* * These are the device model conversion veneers; they convert the * device model structures to our more specific structures. @@ -183,6 +205,10 @@ static int amba_probe(struct device *dev) int ret; do { + ret = of_amba_device_decode_irq(pcdev); + if (ret) + break; + ret = of_clk_set_defaults(dev->of_node, false); if (ret < 0) break; @@ -368,38 +394,12 @@ static void amba_device_release(struct device *dev) kfree(d); } -static int of_amba_device_decode_irq(struct amba_device *dev) -{ - struct device_node *node = dev->dev.of_node; - int i, irq = 0; - - if (IS_ENABLED(CONFIG_OF_IRQ) && node) { - /* Decode the IRQs and address ranges */ - for (i = 0; i < AMBA_NR_IRQS; i++) { - irq = of_irq_get(node, i); - if (irq < 0) { - if (irq == -EPROBE_DEFER) - return irq; - irq = 0; - } - - dev->irq[i] = irq; - } - } - - return 0; -} - static int amba_device_try_add(struct amba_device *dev, struct resource *parent) { u32 size; void __iomem *tmp; int i, ret; - ret = of_amba_device_decode_irq(dev); - if (ret) - goto err_out; - ret = request_resource(parent, &dev->res); if (ret) goto err_out;