Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3126143imj; Mon, 11 Feb 2019 14:29:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IYYVre9GTa4XFDZmOKZh/moc6IUwIR7uZH7tgWeTLWt6uo4PHLfjqIite7KC1KT16/oBqRc X-Received: by 2002:a63:cd14:: with SMTP id i20mr531502pgg.288.1549924160902; Mon, 11 Feb 2019 14:29:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549924160; cv=none; d=google.com; s=arc-20160816; b=I4OuSkf/7btk/KmdXjgpvkxikHrFrTPq/MIGDr1UAEOWZEPZobo1YP/qQnlNH+gfLA nlpopmpTaSCWrnMa0DqJca77jFFokp2cU9BWa84ByLeLj6mJWu1+PbWCXMGdYiS+pHZH KdE2VSfNgUJxLjElm5oAZ0gC2YBJCtV/+mDrA8qO8XdtAM66xYYh0FxilXbs79qLdAht LMKWJzTLhYsMV/OAZOAej4vaTHC/MTncGb6O3KjZ7uzZvfOLV85Wq6aWLaGf3qyOvhKs y1nOG+ihYnhOkgabmDqqfx6h+cQJwlbaKLZInnFgw1dDQ1vBmBquVNO7KMDnpuDeMYN3 QdPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=QKE5bLlBA2JX0uZVsXW/5RwTj7jEGXH3y53CdVEnJug=; b=IFgZWio/CE1Y5sTS7ZgF71PU8y+xqe41OAVRNNymTAR4wGqJmHA7btZCEJgZEXY55b uffcrDcHLONuKhseW05OJzzIpvqNpuHV6KBTI59ybCUfack2T+ANIKJiXClYZh1DwOZW uyaX/lnxnbdgz0rvmyNhFecmND7bMjay1iUxFt1kFN0+rJob6c3NFTMg1rVEkRcuYWsK 0IgMFIFKtjCwccpP+E4cL9VAfe4aP622Oh2z8DHuwzvdByasLGHe5gvzI6+2ZUW+ZpQl OP0c6yJLW3H9cNtOfAUPwynYJ1XzwdwYypCXZv8pUep2iWKQ24dUJvPQCfBJ7iFkivqT 4jQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2si4951031pfc.189.2019.02.11.14.29.04; Mon, 11 Feb 2019 14:29:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727373AbfBKW2v (ORCPT + 99 others); Mon, 11 Feb 2019 17:28:51 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57856 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbfBKW2u (ORCPT ); Mon, 11 Feb 2019 17:28:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 46E9BEBD; Mon, 11 Feb 2019 14:28:50 -0800 (PST) Received: from why.wild-wind.fr.eu.org (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C64E23F675; Mon, 11 Feb 2019 14:28:43 -0800 (PST) Date: Mon, 11 Feb 2019 22:28:39 +0000 From: Marc Zyngier To: Bartosz Golaszewski Cc: Linus Walleij , Thomas Gleixner , Uwe =?UTF-8?B?S2xlaW5lLUvDtm5pZw==?= , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 1/9] irq/irq_sim: don't share the irq_chip structure between simulators Message-ID: <20190211222839.7a7ad87f@why.wild-wind.fr.eu.org> In-Reply-To: <20190129084411.30495-2-brgl@bgdev.pl> References: <20190129084411.30495-1-brgl@bgdev.pl> <20190129084411.30495-2-brgl@bgdev.pl> Organization: ARM Ltd X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Jan 2019 09:44:03 +0100 Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > We want to support multiple instances of irq_sim. Make struct irq_chip > part of the irq_sim structure. Why? There is nothing dynamic in an irqchip structure. It is all code that is set in stone for the lifetime of the irqchip. I've sure you have a use for such indirection, so why don't you explain what you have in mind? Thanks, M. > > Signed-off-by: Bartosz Golaszewski > --- > include/linux/irq_sim.h | 2 ++ > kernel/irq/irq_sim.c | 12 +++++------- > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/include/linux/irq_sim.h b/include/linux/irq_sim.h > index 4500d453a63e..eda132c22b57 100644 > --- a/include/linux/irq_sim.h > +++ b/include/linux/irq_sim.h > @@ -6,6 +6,7 @@ > #ifndef _LINUX_IRQ_SIM_H > #define _LINUX_IRQ_SIM_H > > +#include > #include > #include > > @@ -25,6 +26,7 @@ struct irq_sim_irq_ctx { > }; > > struct irq_sim { > + struct irq_chip chip; > struct irq_sim_work_ctx work_ctx; > int irq_base; > unsigned int irq_count; > diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c > index 98a20e1594ce..b732e4e2e45b 100644 > --- a/kernel/irq/irq_sim.c > +++ b/kernel/irq/irq_sim.c > @@ -25,12 +25,6 @@ static void irq_sim_irqunmask(struct irq_data *data) > irq_ctx->enabled = true; > } > > -static struct irq_chip irq_sim_irqchip = { > - .name = "irq_sim", > - .irq_mask = irq_sim_irqmask, > - .irq_unmask = irq_sim_irqunmask, > -}; > - > static void irq_sim_handle_irq(struct irq_work *work) > { > struct irq_sim_work_ctx *work_ctx; > @@ -74,6 +68,10 @@ int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs) > return sim->irq_base; > } > > + sim->chip.name = "irq_sim"; > + sim->chip.irq_mask = irq_sim_irqmask; > + sim->chip.irq_unmask = irq_sim_irqunmask; > + > sim->work_ctx.pending = bitmap_zalloc(num_irqs, GFP_KERNEL); > if (!sim->work_ctx.pending) { > kfree(sim->irqs); > @@ -84,7 +82,7 @@ int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs) > for (i = 0; i < num_irqs; i++) { > sim->irqs[i].irqnum = sim->irq_base + i; > sim->irqs[i].enabled = false; > - irq_set_chip(sim->irq_base + i, &irq_sim_irqchip); > + irq_set_chip(sim->irq_base + i, &sim->chip); > irq_set_chip_data(sim->irq_base + i, &sim->irqs[i]); > irq_set_handler(sim->irq_base + i, &handle_simple_irq); > irq_modify_status(sim->irq_base + i, -- Without deviation from the norm, progress is not possible.