mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Bartosz Golaszewski" <bgolaszewski@baylibre.com>
Subject: Re: [PATCH v2 1/9] irq/irq_sim: don't share the irq_chip structure between simulators
Date: Mon, 11 Feb 2019 22:28:39 +0000	[thread overview]
Message-ID: <20190211222839.7a7ad87f@why.wild-wind.fr.eu.org> (raw)
In-Reply-To: <20190129084411.30495-2-brgl@bgdev.pl>

On Tue, 29 Jan 2019 09:44:03 +0100
Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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 <bgolaszewski@baylibre.com>
> ---
>  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 <linux/irq.h>
>  #include <linux/irq_work.h>
>  #include <linux/device.h>
>  
> @@ -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.

  reply	other threads:[~2019-02-11 22:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29  8:44 [PATCH v2 0/9] gpio: mockup: improve the user-space testing interface Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 1/9] irq/irq_sim: don't share the irq_chip structure between simulators Bartosz Golaszewski
2019-02-11 22:28   ` Marc Zyngier [this message]
2019-02-12  8:29     ` Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 2/9] irq/irq_sim: use irq domain Bartosz Golaszewski
2019-02-11 22:26   ` Marc Zyngier
2019-02-12  8:30     ` Bartosz Golaszewski
2019-02-12  8:53       ` Marc Zyngier
2019-02-12  8:56         ` Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 3/9] irq/irq_sim: provide irq_sim_fire_type() Bartosz Golaszewski
2019-01-29  9:07   ` Uwe Kleine-König
2019-01-29 11:01     ` Bartosz Golaszewski
2019-01-29 12:55       ` Uwe Kleine-König
2019-02-01 11:02         ` Bartosz Golaszewski
2019-02-12  9:10   ` Marc Zyngier
2019-02-12  9:19     ` Bartosz Golaszewski
2019-02-12 10:06       ` Uwe Kleine-König
2019-02-12 10:15         ` Bartosz Golaszewski
2019-02-12 10:27       ` Marc Zyngier
2019-02-12 10:37         ` Bartosz Golaszewski
2019-02-12 10:52           ` Marc Zyngier
2019-02-12 11:05         ` Uwe Kleine-König
2019-02-12 11:09           ` Bartosz Golaszewski
2019-02-12 11:35           ` Marc Zyngier
2019-01-29  8:44 ` [PATCH v2 4/9] gpio: mockup: add locking Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 5/9] gpio: mockup: implement get_multiple() Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 6/9] gpio: mockup: don't create the debugfs link named after the label Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 7/9] gpio: mockup: change the type of 'offset' to unsigned int Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 8/9] gpio: mockup: change the signature of unlocked get/set helpers Bartosz Golaszewski
2019-01-29  8:44 ` [PATCH v2 9/9] gpio: mockup: rework debugfs interface Bartosz Golaszewski
2019-02-06 10:23 ` [PATCH v2 0/9] gpio: mockup: improve the user-space testing interface Bartosz Golaszewski
2019-02-11 22:33   ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190211222839.7a7ad87f@why.wild-wind.fr.eu.org \
    --to=marc.zyngier@arm.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®