Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2425367rdb; Fri, 8 Dec 2023 07:49:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLpqA9i9vO4sFbyI3YAAo0vYUY/TkkoHZo8qW4bptOom9Vrv5cfVnwViPysEICYF3fD1c6 X-Received: by 2002:a17:902:7795:b0:1cf:fa64:6e50 with SMTP id o21-20020a170902779500b001cffa646e50mr250361pll.62.1702050577314; Fri, 08 Dec 2023 07:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702050577; cv=none; d=google.com; s=arc-20160816; b=1JeQEJFGHWClQEC6tOet2fVKZ+fepcCJA/aKbSPLMNbvuX3T/q3ui0cLFcIq2lFCo9 QchwPlBRteEm4hok+wc1Esy8WWLU/o3otafN90K0t80cqYPwJe8bLNydebzAAWs9oIe5 O8cPiSeE70V7Y+/HmEcdWyObBQ0oCX/uOwWsKP84pKBpfcp920tz4hIcnmlMyj906JH2 vFlOnP2n4PvAzUS+BqAihpNg+DabUrRSOfhE+PtwWiwgW2KK6qUzhFpyX8boEwoQ7Dy+ MI3aXrAhX3KxjMrsLgLBwj4GTSYrF6pM3YE0n1OL3nxeajwGgiNTFELjLpaV+RuygIjj M5Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=juCIKsOlSX2wDTW1S1v9bUaTdgo42s0VBtiTPZnusxI=; fh=22OzigPO3nnahHZMF2NU2A1hbDHEKyujp/qKVm1eHzw=; b=IXrReD93YK7o5838BbgxWyjOlEABXT0v5+ZMMDKAEedqngfA3QbTWyfj8FFn6/unXT KKU2oP2UgqS2WOZQMLF3mKXXwFXZaepoNBCd5xrYcF2xP4ZUpFaUFagg2l4l99rEVtb2 t+Vhdo3d47kviMJbiJUvP4rRBZQ/n0Hg0jwbgcscmq2f40MAL22rQsABDpsI5W42Zmth 4Mcl0On/sVcrNqck/LooLYg8Z1hxBEg+pR3tQeOv1WmYzMr8okIUAbOekGfSm3UlhTZ6 GYotv0KNJsK7QFtc8XUkEyaRdQgGlr8H5EC4xiKH2aH+q2LF4+toq5O5CQRyh96Z7ULF bxzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Y3Pb+AHg; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u9-20020a17090341c900b001cfd5a36b31si1832226ple.495.2023.12.08.07.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 07:49:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Y3Pb+AHg; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0DF4D8028E72; Fri, 8 Dec 2023 07:49:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574396AbjLHPt0 (ORCPT + 99 others); Fri, 8 Dec 2023 10:49:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233564AbjLHPtZ (ORCPT ); Fri, 8 Dec 2023 10:49:25 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D9181723; Fri, 8 Dec 2023 07:49:31 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1702050569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=juCIKsOlSX2wDTW1S1v9bUaTdgo42s0VBtiTPZnusxI=; b=Y3Pb+AHg+e/B+KFo6RhPjnjAT9uufkJH/wmuUin/ii/RkL12Xb2LhbwMU/slOoW1zVWfvy 3rtjqclt32IQoZln60DXTVkf9ZEeHYlHN5+ZUMlKpfQOQclzKYWoIgmA7FH2YMR91J15CS MezsCBKRTiV4bTMqtHaAXu3JDO5QIvXFpREpHh0M9nU4cTTuAeug6upCWZxzg+fUpva7ZA GI3z++jXDeIzjQs22W+ERv+BVjRBAktw0cI3t7dVIlV/8oEdeO5vL/723dD9gCzHGBpEJO KGVc128do0lHRtNowz5Gn5UYy5Fv1/xN5obeFLZ97lUUpgDAZNdow5LwZDKSOw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1702050569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=juCIKsOlSX2wDTW1S1v9bUaTdgo42s0VBtiTPZnusxI=; b=Eu6uS/85eE+nCL+E90qXegkkjbKO7V0Thb4Yh5ee/9SQH4n9uJOPkkfQPemqOnndB/6QWH b2rAtS9HnxV/kkDQ== To: Yoshinori Sato , linux-sh@vger.kernel.org Cc: Yoshinori Sato , Damien Le Moal , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Michael Turquette , Stephen Boyd , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Greg Kroah-Hartman , Jiri Slaby , Magnus Damm , Daniel Lezcano , Rich Felker , John Paul Adrian Glaubitz , Lee Jones , Helge Deller , Heiko Stuebner , Jernej Skrabec , Chris Morgan , Linus Walleij , Randy Dunlap , Arnd Bergmann , Hyeonggon Yoo <42.hyeyoo@gmail.com>, David Rientjes , Vlastimil Babka , Baoquan He , Andrew Morton , Guenter Roeck , Stephen Rothwell , Guo Ren , Javier Martinez Canillas , Azeem Shaikh , Palmer Dabbelt , Bin Meng , Max Filippov , Tom Rix , Herve Codina , Jacky Huang , Lukas Bulwahn , Jonathan Corbet , Biju Das , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Sam Ravnborg , Michael Karcher , Sergey Shtylyov , Laurent Pinchart , linux-ide@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org, linux-serial@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: Re: [DO NOT MERGE v5 16/37] irqchip: Add SH7751 INTC driver In-Reply-To: References: Date: Fri, 08 Dec 2023 16:49:28 +0100 Message-ID: <874jgssnhz.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 08 Dec 2023 07:49:36 -0800 (PST) On Tue, Dec 05 2023 at 18:45, Yoshinori Sato wrote: > +static void endisable_irq(struct irq_data *data, int enable) bool enable? > +{ > + struct sh7751_intc_priv *priv; > + unsigned int irq; > + > + priv = irq_data_to_priv(data); > + > + irq = irqd_to_hwirq(data); > + if (!is_valid_irq(irq)) { > + /* IRQ out of range */ > + pr_warn_once("%s: IRQ %u is out of range\n", __FILE__, irq); > + return; > + } > + > + if (irq <= MAX_IRL && !priv->irlm) > + /* IRL encoded external interrupt */ > + /* disable for SR.IMASK */ > + update_sr_imask(irq - IRQ_START, enable); > + else > + /* Internal peripheral interrupt */ > + /* mask for IPR priority 0 */ > + update_ipr(priv, irq, enable); Lacks curly brackets on the if/else > +static int irq_sh7751_map(struct irq_domain *h, unsigned int virq, > + irq_hw_number_t hw_irq_num) > +{ > + irq_set_chip_and_handler(virq, &sh7751_irq_chip, handle_level_irq); > + irq_get_irq_data(virq)->chip_data = h->host_data; > + irq_modify_status(virq, IRQ_NOREQUEST, IRQ_NOPROBE); > + return 0; > +} > +static const struct irq_domain_ops irq_ops = { Newline before 'static ...' > + .map = irq_sh7751_map, > + .xlate = irq_domain_xlate_onecell, > +}; > + > +static int __init load_ipr_map(struct device_node *intc, > + struct sh7751_intc_priv *priv) > +{ > + struct property *ipr_map; > + unsigned int num_ipr, i; > + struct ipr *ipr; > + const __be32 *p; > + u32 irq; > + > + ipr_map = of_find_property(intc, "renesas,ipr-map", &num_ipr); > + if (IS_ERR(ipr_map)) > + return PTR_ERR(ipr_map); > + num_ipr /= sizeof(u32); > + /* 3words per entry. */ > + if (num_ipr % 3) Three words per ... But you can spare the comment by doing: if (num_ipr % WORDS_PER_ENTRY) > + goto error1; > + num_ipr /= 3; > +static int __init sh7751_intc_of_init(struct device_node *intc, > + struct device_node *parent) > +{ > + struct sh7751_intc_priv *priv; > + void __iomem *base, *base2; > + struct irq_domain *domain; > + u16 icr; > + int ret; > + > + base = of_iomap(intc, 0); > + base2 = of_iomap(intc, 1); > + if (!base || !base2) { > + pr_err("%pOFP: Invalid register definition\n", intc); What unmaps 'base' if 'base' is valid and base2 == NULL? > + return -EINVAL; > + } > + > + priv = kzalloc(sizeof(struct sh7751_intc_priv), GFP_KERNEL); > + if (priv == NULL) > + return -ENOMEM; Leaks base[2] maps, no? > + ret = load_ipr_map(intc, priv); > + if (ret < 0) { > + kfree(priv); > + return ret; > + } > + > + priv->base = base; > + priv->intpri00 = base2; > + > + if (of_property_read_bool(intc, "renesas,irlm")) { > + priv->irlm = true; > + icr = __raw_readw(priv->base + R_ICR); > + icr |= ICR_IRLM; > + __raw_writew(icr, priv->base + R_ICR); > + } > + > + domain = irq_domain_add_linear(intc, NR_IRQS, &irq_ops, priv); > + if (domain == NULL) { > + pr_err("%pOFP: cannot initialize irq domain\n", intc); > + kfree(priv); > + return -ENOMEM; > + } > + > + irq_set_default_host(domain); > + pr_info("%pOFP: SH7751 Interrupt controller (%s external IRQ)", > + intc, priv->irlm ? "4 lines" : "15 level"); > + return 0; > +} > + > +IRQCHIP_DECLARE(sh_7751_intc, > + "renesas,sh7751-intc", sh7751_intc_of_init); One line please. Thanks, tglx