From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCE22C4320A for ; Tue, 31 Aug 2021 20:54:42 +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 7CFBF60F9E for ; Tue, 31 Aug 2021 20:54:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7CFBF60F9E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U7lAuDZsBqLuenRoVbhMtn9YAV7u1b8/4YJfiBArGds=; b=WCa/tXQWCM0IuK ITeWDhkREi+OJsHR+e5elqC/+g7NljWcct8xSA+vRnjKQA2DuCIBk0I+cMa9PCU3rpxOSpZzBE0Ui JyRBtOlkDB5apsuFC8GqLJ7DUuJ8hKEzDaxIdwh5nQvlEz/fGSTlFNl8a2cjEIwNe+VE85TDVnk5z Mnb/OmZNNCblOzZ8EyXg3bnaq25PY6kSJdLr1LYPJWWkbQvx2Lm1zL+/wWeEb2uduoFD8LJZcC8m0 9S/cP9PHYpXmDAeSU4fleBxGVk2GoFAdiNta/KDJCVntMXGvDXtw/gydfarjmFE8iTpE8mfBTP28a AsP10WpCSI0w9JGw8SUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLAg3-00395o-9m; Tue, 31 Aug 2021 20:48:15 +0000 Received: from mail-ot1-f43.google.com ([209.85.210.43]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLAfz-003950-9w for linux-arm-kernel@lists.infradead.org; Tue, 31 Aug 2021 20:48:12 +0000 Received: by mail-ot1-f43.google.com with SMTP id a20-20020a0568300b9400b0051b8ca82dfcso806091otv.3 for ; Tue, 31 Aug 2021 13:48:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wNNp70ZeS1CkFL+U1J77pDYe0j7gaaFJgPTD6drutso=; b=KQnDrLgYegA/jS0Y1JU5uUoqYf1RmWr7G3mdiSd4mDPz2L+rPbMornMI9vNu27g9ur uLKrnfKS5bsdku/mppccJpz4fHvpjupInkMoAaYo2t0tRnnXySfy5nWcSHdR49NC07mK qLmjvHv3ZXQFSDQIptZF4F2mcSAjEK8BIuGWT6DIWXUIX0pQ2MYgYi0LmjLRnp1YgbSR +gUIbnU+7XsXEw8Ovr5+9a72hut3kahQO/6tBA14T7yLGxTA0+q0h0rxfXQZuTUHvlyK hp1qW8iU19cIOQ8GJsbuNihszmgtOp2lL4TvHxLDTHAJllOxYPuLxLjYslzbcfF9pLpi 1ggQ== X-Gm-Message-State: AOAM532f+9sjBx7Ae30SCLqPqcjXHsfnZTXry8h6PR45Qhqk2zytQe7L 94aoFC6fiUZu2rb0Illdcg== X-Google-Smtp-Source: ABdhPJzFy3Ujv5wUhcg6/TUy2Ei8DusEEY8iaFpVICUkEJ+8N0SrQvTJ0un7XWJKW550cQ27rF9Dng== X-Received: by 2002:a9d:4a8d:: with SMTP id i13mr2190320otf.180.1630442890470; Tue, 31 Aug 2021 13:48:10 -0700 (PDT) Received: from robh.at.kernel.org (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.gmail.com with ESMTPSA id bg38sm2211456oib.26.2021.08.31.13.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 13:48:09 -0700 (PDT) Received: (nullmailer pid 623003 invoked by uid 1000); Tue, 31 Aug 2021 20:48:09 -0000 Date: Tue, 31 Aug 2021 15:48:09 -0500 From: Rob Herring To: Kefeng Wang Cc: linux-kernel@vger.kernel.org, frowand.list@gmail.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, saravanak@google.com, linus.walleij@linaro.org, devicetree@vger.kernel.org, Ruizhe Lin Subject: Re: [PATCH v2 4/4] amba: Properly handle device probe without IRQ domain Message-ID: References: <20210827150600.78811-1-wangkefeng.wang@huawei.com> <20210827150600.78811-5-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210827150600.78811-5-wangkefeng.wang@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210831_134811_392779_4BD354F6 X-CRM114-Status: GOOD ( 30.74 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 27, 2021 at 11:06:00PM +0800, Kefeng Wang wrote: > of_amba_device_create() uses irq_of_parse_and_map() to translate > a DT interrupt specification into a Linux virtual interrupt number. > > But it doesn't properly handle the case where the interrupt controller > is not yet available, eg, when pl011 interrupt is connected to MBIGEN > interrupt controller, because the mbigen initialization is too late, > which will lead to no IRQ due to no IRQ domain found, log is shown below, > "irq: no irq domain found for uart0 !" > > use of_irq_get() to return -EPROBE_DEFER as above, and in the driver > deferred probe, it will properly handle in such case, also return 0 > in other fail cases to be consistent as before. > > Cc: Russell King > Cc: Rob Herring > Cc: Frank Rowand > Reported-by: Ruizhe Lin > Signed-off-by: Kefeng Wang > --- > drivers/amba/bus.c | 27 +++++++++++++++++++++++++++ > drivers/of/platform.c | 6 +----- > 2 files changed, 28 insertions(+), 5 deletions(-) > > diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c > index 4d3a565ca079..96e84ce66e9a 100644 > --- a/drivers/amba/bus.c > +++ b/drivers/amba/bus.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > > #define to_amba_driver(d) container_of(d, struct amba_driver, drv) > > @@ -170,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; > + > + if (IS_ENABLED(CONFIG_OF_IRQ) && node) { I don't think this check is needed. If either is false, we should return an errno from of_irq_get(). > + /* 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. > @@ -182,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; > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > index 74afbb7a4f5e..32d5ff8df747 100644 > --- a/drivers/of/platform.c > +++ b/drivers/of/platform.c > @@ -222,7 +222,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, > { > struct amba_device *dev; > const void *prop; > - int i, ret; > + int ret; > > pr_debug("Creating amba device %pOF\n", node); > > @@ -253,10 +253,6 @@ static struct amba_device *of_amba_device_create(struct device_node *node, > if (prop) > dev->periphid = of_read_ulong(prop, 1); > > - /* Decode the IRQs and address ranges */ > - for (i = 0; i < AMBA_NR_IRQS; i++) > - dev->irq[i] = irq_of_parse_and_map(node, i); > - > ret = of_address_to_resource(node, 0, &dev->res); > if (ret) { > pr_err("amba: of_address_to_resource() failed (%d) for %pOF\n", > -- > 2.18.0.huawei.25 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel