linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Marc Zyngier <marc.zyngier@arm.com>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH 3/9] irq/irq_sim: provide irq_sim_get_type()
Date: Thu, 24 Jan 2019 08:46:56 +0100	[thread overview]
Message-ID: <CAMRc=Me58SFJOMxie5aTkOAHRqS7bjdOSAaZSY8wjPK7tntTfQ@mail.gmail.com> (raw)
In-Reply-To: <20190123191824.btuaq4s5rvc236n3@pengutronix.de>

śr., 23 sty 2019 o 20:18 Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> napisał(a):
>
> Hello Bartosz,
>
> On Wed, Jan 23, 2019 at 03:15:32PM +0100, Bartosz Golaszewski wrote:
> > Provide a helper that allows users to retrieve the configured flow type
> > of dummy interrupts. That allows certain users to decide whether an irq
> > needs to be fired depending on its edge/level/... configuration.
>
> You don't talk about the .set_type callback here; is this intended?
>
> I wonder how you think this should be used. Assume the mockup-driver is
> directed to pull up a certain line, does it do something like that:
>
>         def mockup_setval(self, val):
>                 irqtype = irq_sim_get_type(...)
>                 if irqtype == LEVEL_HIGH:
>                         if val:
>                                 fire_irq()
>
>                 else if irqtype == EDGE_RISING:
>                         if val and not prev_val:
>                                 fire_irq()
>
>                 else if irqtype == LEVEL_LOW:
>                         if not val:
>                                 fire_irq()
>
>                 else if irqtype == EDGE_FALLING:
>                         if not val and prev_val:
>                                 fire_irq()
>
> I wonder if that logic should be done in the same place as where the irq
> type is stored. Otherwise that .type member is only a data store
> provided by the irq simulator. So I suggest to either move the variable
> that mirrors the current level of the line into the irq simulator, or
> keep the irqtype variable in the mockup driver. Both approaches would
> make it unnecessary to provide an accessor function for the type member.
>

Yeah, might be better to go back to my previous idea of adding
irq_sim_fire_edge(), but maybe it should be irq_sim_fire_type()
instead, so that irq_sim_fire() fires unconditionally and
irq_sim_fire_type() would fire only if the passed flag is the same as
the one previously configured by the set_type() callback.

Thanks,
Bartosz

  reply	other threads:[~2019-01-24  7:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 14:15 [PATCH 0/9] gpio: mockup: improve the user-space testing interface Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 1/9] irq/irq_sim: don't share the irq_chip structure between simulators Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 2/9] irq/irq_sim: use irq domain Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 3/9] irq/irq_sim: provide irq_sim_get_type() Bartosz Golaszewski
2019-01-23 19:18   ` Uwe Kleine-König
2019-01-24  7:46     ` Bartosz Golaszewski [this message]
2019-01-24  8:09       ` Uwe Kleine-König
2019-01-23 14:15 ` [PATCH 4/9] gpio: mockup: add locking Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 5/9] gpio: mockup: implement get_multiple() Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 6/9] gpio: mockup: don't create the debugfs link named after the label Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 7/9] gpio: mockup: change the type of 'offset' to unsigned int Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 8/9] gpio: mockup: change the signature of unlocked get/set helpers Bartosz Golaszewski
2019-01-23 14:15 ` [PATCH 9/9] gpio: mockup: rework debugfs interface Bartosz Golaszewski
2019-01-28 13:47 ` [PATCH 0/9] gpio: mockup: improve the user-space testing interface Linus Walleij

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='CAMRc=Me58SFJOMxie5aTkOAHRqS7bjdOSAaZSY8wjPK7tntTfQ@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --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;
as well as URLs for NNTP newsgroup(s).