linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* spi->irq == 0 on module reload of driver using IRQF_TRIGGER_LOW
@ 2017-11-12 12:32 kernel-TqfNSX0MhmxHKSADF0wUEw
       [not found] ` <21FDD1B8-E8F6-4DCE-9D30-D82B713B0008-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: kernel-TqfNSX0MhmxHKSADF0wUEw @ 2017-11-12 12:32 UTC (permalink / raw)
  To: linux-rpi-kernel, linux-spi,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Marc Zyngier

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@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@7e200000!
[   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).

After modprobe the module the first time the following entry in
/proc/interrupts shows:
 88:          0  pinctrl-bcm2835  16 Level     mcp2517fd

Any ideas why this happens and what can done about it?

Thanks, Martin

P.s: This issue shows on 4.14.0-rc8, but also on the downstream 4.9.57.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-11-13 18:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-12 12:32 spi->irq == 0 on module reload of driver using IRQF_TRIGGER_LOW kernel-TqfNSX0MhmxHKSADF0wUEw
     [not found] ` <21FDD1B8-E8F6-4DCE-9D30-D82B713B0008-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2017-11-12 14:13   ` Marc Zyngier
     [not found]     ` <20171112141349.6b4b3852-Fmn/x+r+pSA9//JtdbceeD8Kkb2uy4ct@public.gmane.org>
2017-11-12 15:13       ` kernel-TqfNSX0MhmxHKSADF0wUEw
     [not found]         ` <CD4EBEF8-DDFD-40C3-A03E-7EC964B32357-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2017-11-12 15:41           ` Marc Zyngier
     [not found]             ` <20171112154101.483d21d2-Fmn/x+r+pSA9//JtdbceeD8Kkb2uy4ct@public.gmane.org>
2017-11-12 16:49               ` kernel-TqfNSX0MhmxHKSADF0wUEw
     [not found]                 ` <6CD8E928-2143-4295-A5B3-4B95026E7261-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2017-11-13  9:35                   ` Marc Zyngier
     [not found]                     ` <87k1yuttaa.fsf-vRCh2aeoaAgb5lhT7GhwOB/iLCjYCKR+VpNB7YpNyf8@public.gmane.org>
2017-11-13 18:25                       ` kernel-TqfNSX0MhmxHKSADF0wUEw
2017-11-12 18:19               ` Andrew Lunn

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).