Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp109072pxf; Tue, 6 Apr 2021 16:30:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycWXMI1XfolT/mUHBpl9T+a/CIvSwTHMcTlVL9gYA7IjwjoliSCO+s9KehzBkqWr4CXKaY X-Received: by 2002:a17:907:2d9f:: with SMTP id gt31mr484114ejc.463.1617751857473; Tue, 06 Apr 2021 16:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617751857; cv=none; d=google.com; s=arc-20160816; b=jkRRmD3G0IxuKE1NPdU5QkrWfMJsVy3fGnYFAEKDCZcLicFmNl1SEey5VIUEfQIePc TrbR0pCMeuMiPqPA21qRZv/TRqiSjBbycZF/Js0a3Oyl8wUB/3B3Ex4UDQNutdkWjBww AjZDt/2+ZIZa69oynb1gH8yebkzdpeDXBL0GkXVik1BZ644+ks4Q+ibfnFG1FzrofozL Dg83loBBy5S7coQ2MRPEMFbpWN48knGrP7dMTSG/6ykUZfL9eDZUKbC+Y+8XGt9/59ds o/Pn5ht/Wa6XkizwwUAt0u4Ga221geqdul+JKuz5ybMdkRbThrQFKykpERebUU4X3tby 0Xkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=1kSHj6CQmfDHBEsn6WZEsy5CshaMq63XWAaUyDl644w=; b=am6qZ7NEzqFMb/EZieTp00g/2J3e5S4x3r/Ij6P7xFQljl+TGRq4eZ9+mDWTFka62t zHC9m3BPBQj+frRhdR4dXDx2DkVGRDdLa6H0lC+gNm5Qs/miK2l7Up0c5O5MMhTJHJJq lh+DAtuBYRmSbn/+FCKedQFWkDhFGDQK9Sv2/4NR1SmgBOZDKB7x3Rbb/vbCszDRms7o T6e7phsUolraKERb39lA78BBL/j0Hzd1PiG35ygaxRmifNrvxvET5EPmAVf78wshpyEt Zkd/nUCPN0qA/Qu7KxvW4qS65arogUjECid86tFN8h8sLE7zL3MsZWJV2IvD0aLRJQ4U MCzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga26si1764629ejc.301.2021.04.06.16.30.33; Tue, 06 Apr 2021 16:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236066AbhDFKcd convert rfc822-to-8bit (ORCPT + 99 others); Tue, 6 Apr 2021 06:32:33 -0400 Received: from mail-vk1-f169.google.com ([209.85.221.169]:39891 "EHLO mail-vk1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233025AbhDFKcc (ORCPT ); Tue, 6 Apr 2021 06:32:32 -0400 Received: by mail-vk1-f169.google.com with SMTP id c5so3067501vkm.6; Tue, 06 Apr 2021 03:32:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Ad26/T6d/ZnNr0Tc5NnJUf1s5ObiAcmgTWkpXBwrq1s=; b=YXwyiDAAm0rPSpsZg95ioR95mBA8TPbyquvhtOMdHdY6vVgh1e4CIsDPuarHmRBS3l 30fBawZq2JJK00v9NFUjXvpuk3UYcg79cEDhlT4R7bvXrVa6XgUD1jU59KI/1aTJvTIY akDa4JJWAFA7/e3id8HBJOqE2S7nzWX02f0qH4LWGhHY8zQzzkJ6InyMRP+RMO7ypkKQ bkcHQ1gvn9AvFvyx8csrgB7iGphxMXr9/8Ja703Qhu0M0pj0nFONJb2i01gZy0mMfmuF 2JEs7TBX1QeS0FVUFD2y2emiNoPygpIqSlGJfAe7zGpScrkMRw+/myEMCx0/Y2BHZ+wL A0tw== X-Gm-Message-State: AOAM530DYT9VGjGJpYHOryw+SMIon5ADWHKZz7BjcQsw+jYtIITbDDc9 x8h0lRDCt4y/BBBbWEWhYiDr5sVwbtkqkKgJhYA= X-Received: by 2002:ac5:ce04:: with SMTP id j4mr15807523vki.1.1617705144686; Tue, 06 Apr 2021 03:32:24 -0700 (PDT) MIME-Version: 1.0 References: <20210406093557.1073423-1-maz@kernel.org> <20210406093557.1073423-5-maz@kernel.org> In-Reply-To: <20210406093557.1073423-5-maz@kernel.org> From: Geert Uytterhoeven Date: Tue, 6 Apr 2021 12:32:13 +0200 Message-ID: Subject: Re: [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping() To: Marc Zyngier Cc: Linux ARM , Linux Kernel Mailing List , "open list:BROADCOM NVRAM DRIVER" , linuxppc-dev , Linux-sh list , Daniel Mack , Robert Jarzmik , Haojian Zhuang , Yoshinori Sato , Rich Felker , Thomas Bogendoerfer , Michael Ellerman , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On Tue, Apr 6, 2021 at 11:44 AM Marc Zyngier wrote: > Instead of playing games with using irq_create_identity_mapping() > and irq_domain_associate(), drop the use of the former and only > use the latter, together with the allocation of the irq_desc > as needed. > > It doesn't make the code less awful, but at least the intent > is clearer. > > Signed-off-by: Marc Zyngier Thanks for your patch! > --- a/drivers/sh/intc/core.c > +++ b/drivers/sh/intc/core.c > @@ -179,6 +179,23 @@ static unsigned int __init save_reg(struct intc_desc_int *d, > return 0; > } > > +static bool __init intc_map(struct irq_domain *domain, int irq) > +{ > + int res; warning: unused variable ‘res’ [-Wunused-variable] > + > + if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != irq) { > + pr_err("uname to allocate IRQ %d\n", irq); > + return false; > + } > + > + if (irq_domain_associate(domain, irq, irq)) { > + pr_err("domain association failure\n"); > + return false; > + } > + > + return true; > +} > + > int __init register_intc_controller(struct intc_desc *desc) > { > unsigned int i, k, smp; > @@ -316,19 +333,8 @@ int __init register_intc_controller(struct intc_desc *desc) warning: unused variable ‘res’ [-Wunused-variable] > if (!vect->enum_id) > continue; > > - res = irq_create_identity_mapping(d->domain, irq); > - if (unlikely(res)) { > - if (res == -EEXIST) { > - res = irq_domain_associate(d->domain, irq, irq); > - if (unlikely(res)) { > - pr_err("domain association failure\n"); > - continue; > - } > - } else { > - pr_err("can't identity map IRQ %d\n", irq); > - continue; > - } > - } > + if (!intc_map(d->domain, irq)) > + continue; > > intc_irq_xlate_set(irq, vect->enum_id, d); > intc_register_irq(desc, d, vect->enum_id, irq); Otherwise this seems to work fine on real hardware (landisk) and qemu (rts7751r2d). I did verify that the new function intc_map() is called. Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds