All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Marc Zyngier <marc.zyngier@arm.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH 3/9] irq/irq_sim: provide irq_sim_get_type()
Date: Wed, 23 Jan 2019 20:18:24 +0100	[thread overview]
Message-ID: <20190123191824.btuaq4s5rvc236n3@pengutronix.de> (raw)
In-Reply-To: <20190123141538.29408-4-brgl@bgdev.pl>

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.

Best regards
Uwe

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

  reply	other threads:[~2019-01-23 19:18 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 [this message]
2019-01-24  7:46     ` Bartosz Golaszewski
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=20190123191824.btuaq4s5rvc236n3@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=marc.zyngier@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.