public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: spi->irq == 0 on module reload of driver using IRQF_TRIGGER_LOW
Date: Sun, 12 Nov 2017 14:13:49 +0000	[thread overview]
Message-ID: <20171112141349.6b4b3852@why.wild-wind.fr.eu.org> (raw)
In-Reply-To: <21FDD1B8-E8F6-4DCE-9D30-D82B713B0008@martin.sperl.org>

On Sun, 12 Nov 2017 13:32:44 +0100
<kernel@martin.sperl.org> wrote:

Martin,

> Hi!
> 
> During the development of a new spi driver on a raspberry pi CM1
> I have seen an issue with the following code triggering strange behavior:
> 
> 	ret = request_threaded_irq(spi->irq, NULL,
> 				   mcp2517fd_can_ist,
> 				   IRQF_ONESHOT | IRQF_TRIGGER_LOW,
> 				   DEVICE_NAME, priv);
> 
> This works fine the first time the module is loaded (spi->irq is not 0),
> but as soon as the module gets removed and reinstalled spi->irq is 0 
> and I get the message in dmesg:
> [ 1282.311991] irq: type mismatch, failed to map hwirq-16 for /soc/gpio at 7e200000!
> 
> This does not happen when using the IRQF_TRIGGER_FALLING flag.
> 
> in spi_drv_probe spi core does sets spi->dev to 0 in case 
> of_irq_get returns < 0;
> 
> The specific code that triggers this message and return 0 is 
> irq_create_fwspec_mapping.
> 
> After implementing: https://www.spinics.net/lists/arm-kernel/msg528469.html
> and also checking for spi->irq == 0, I get:
> 
> [   87.867456] irq: type mismatch (2/8), failed to map hwirq-16 for /soc/gpio at 7e200000!

Well, you have the answer here: The interrupt has been configured with
a falling edge trigger, while you're requesting a level low. Obviously,
something is changing it.

It would be interesting to see both the driver code and the DT file
where the interrupt is described...

> [   87.867512] mcp2517fd spi0.0: no valid irq line defined: irq = 0
> 
> The test for irq == 0 is the first thing that happens in the 
> spi.driver.probe code of the module.
> 
> So to me it looks as if something deeper down the stack during
> initialization.
> 
> As if the irq-type is not cleaned up during release of the irq on module
> unload - which I can confirm calls free_irq(spi->irq, priv).

I don't really understand this remark. The trigger type is a property
of the generating device, so "cleaning up" doesn't make much sense
(even if you;re not using the interrupt anymore, the device is still
there).

Thanks,

	M.
-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2017-11-12 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-12 12:32 spi->irq == 0 on module reload of driver using IRQF_TRIGGER_LOW kernel at martin.sperl.org
2017-11-12 14:13 ` Marc Zyngier [this message]
2017-11-12 15:13   ` kernel at martin.sperl.org
2017-11-12 15:41     ` Marc Zyngier
2017-11-12 16:49       ` kernel at martin.sperl.org
2017-11-13  9:35         ` Marc Zyngier
2017-11-13 18:25           ` kernel at martin.sperl.org
2017-11-12 18:19       ` Andrew Lunn

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=20171112141349.6b4b3852@why.wild-wind.fr.eu.org \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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