linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH 1/2] irq/irq_sim: provide irq_sim_fire_edge()
Date: Wed, 21 Nov 2018 20:15:09 +0100	[thread overview]
Message-ID: <20181121191509.ia2vcklvx4q2rh56@pengutronix.de> (raw)
In-Reply-To: <CAMRc=MfKf_f+x3Wt5gScA5yb78kbpphL87bi2arxcKKGjg1S7Q@mail.gmail.com>

Hello Bartosz,

On Wed, Nov 21, 2018 at 05:34:32PM +0100, Bartosz Golaszewski wrote:
> wt., 20 lis 2018 o 18:17 Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> napisał(a):
> >
> > On Tue, Nov 20, 2018 at 02:40:31PM +0100, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >
> > > The irq_sim irqchip doesn't allow to configure the sensitivity so every
> > > call to irq_sim_fire() fires a dummy interrupt. This used to not matter
> > > for gpio-mockup (one of the irq_sim users) until commit fa38869b0161
> > > ("gpiolib: Don't support irq sharing for userspace") which made it
> > > impossible for gpio-mockup to ignore certain events (e.g. only receive
> > > notifications about rising edge events).
> > >
> > > Introduce a specialized variant of irq_sim_fire() which takes another
> > > argument called edge. allowing to specify the trigger type for the
> > > dummy interrupt.
> >
> > I wonder if it's worth the effort to fix irq_sim. If you take a look in
> > my gpio-simulator patch, it is trivial to get it right without external
> > help with an amount of code that is usual for a driver that handles
> > irqs.
> 
> You're basically recommending handcrafting another local piece of code
> for simulating interrupts - something that multiple users may be
> interested in. You did that in your proposed gpio-simulator and I
> still can't understand why you couldn't reuse the existing solution.
> Even if it's broken for your use-case, it's surely easier to fix it
> than to rewrite and duplicate it? There are very few cases where code
> consolidation is not a good thing and I don't think this is one of
> them.

I don't say that factoring out common stuff is bad. But if in the end
you call

	irq_sim_something(some, parameters, offset);

with the simulator and if you don't use the irq simulator you do

	irq = irq_find_mapping(irqdomain, offset);
	generic_handle_irq(irq);

I prefer the latter because it's only a single additional line and in
return it's more obvious what it does because it's the same that many
other drivers (for real hardware) also do.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2018-11-21 19:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 13:40 [PATCH 0/2] irq/irq_sim: provide a specialized variant of irq_sim_fire() Bartosz Golaszewski
2018-11-20 13:40 ` [PATCH 1/2] irq/irq_sim: provide irq_sim_fire_edge() Bartosz Golaszewski
2018-11-20 17:17   ` Uwe Kleine-König
2018-11-21 16:34     ` Bartosz Golaszewski
2018-11-21 19:15       ` Uwe Kleine-König [this message]
2018-11-23 15:59         ` Bartosz Golaszewski
2018-11-25 21:18           ` Uwe Kleine-König
2018-11-29 18:14             ` Bartosz Golaszewski
2018-11-30 22:26               ` Linus Walleij
2018-12-02 12:29                 ` Marc Zyngier
2018-12-02 17:00                   ` Bartosz Golaszewski
2018-12-02 21:56               ` Uwe Kleine-König
2018-12-02 22:20                 ` Bartosz Golaszewski
2018-12-03 10:23                   ` Bartosz Golaszewski
2018-12-03 10:49                     ` Uwe Kleine-König
2018-12-03 10:57                       ` Bartosz Golaszewski
2018-12-03 11:06                         ` Uwe Kleine-König
2018-12-05 12:19                           ` Linus Walleij
2018-12-05 12:38                             ` Bartosz Golaszewski
2018-12-05 12:55                               ` Linus Walleij
2018-12-17 10:32                               ` Bartosz Golaszewski
2018-12-17 12:59                                 ` Uwe Kleine-König
2018-12-17 13:59                                   ` Bartosz Golaszewski
2018-12-05 13:20                             ` Uwe Kleine-König
2018-12-14 14:07                               ` Linus Walleij
2018-12-17 11:19                                 ` Uwe Kleine-König
2018-11-20 13:40 ` [PATCH 2/2] gpio: mockup: use irq_sim_fire_edge() Bartosz Golaszewski
2018-12-03 11:09   ` Uwe Kleine-König
2018-12-11 14:15     ` Uwe Kleine-König
2018-12-11 15:38       ` Bartosz Golaszewski

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=20181121191509.ia2vcklvx4q2rh56@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --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 \
    /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;
as well as URLs for NNTP newsgroup(s).