genirq: Fix [devm_]irq_alloc_desc returning irq 0
cover genirq: Fix [devm_]irq_alloc_desc returning irq 0
Hi All,
This patch seems to have fallen through the cracks, hence this resend.
Note this fixes an WARN/backtrace at boot with recent kernels on all Intel Bay Trail and Cherry Trail based devices, as such it would be good if we can get this merged.
If this is not the right way to fix this, then please let me know. The WARN can also be avoided with a simple i915 driver patch, but this seems to be the more correct way to fix this.
Regards,
Hans
Hans de Goede (1):
genirq: Fix [devm_]irq_alloc_desc returning irq 0
include/linux/irq.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH 1/1 genirq: Fix [devm_]irq_alloc_desc returning irq 0
Since commit a85a6c86c25b ("driver core: platform: Clarify that IRQ 0 is invalid"), having a linux-irq with number 0 will trigger a WARN when calling platform_get_irq*() to retrieve that linux-irq.
Since [devm_]irq_alloc_desc allocs 1 single irq and since irq 0 is normally not used, it would return 0 before this commit, triggering that WARN. This happens e.g. on Intel Bay Trail and Cherry Trail devices using the LPE audio engine for HDMI audio:
[ 22.761392] ------------[ cut here ]------------ [ 22.761405] 0 is an invalid IRQ number [ 22.761462] WARNING: CPU: 3 PID: 472 at drivers/base/platform.c:238 platform_get_irq_optional+0x108/0x180 [ 22.761470] Modules linked in: snd_hdmi_lpe_audio(+) ... ... [ 22.762133] Call Trace: [ 22.762158] platform_get_irq+0x17/0x30 [ 22.762182] hdmi_lpe_audio_probe+0x4a/0x6c0 [snd_hdmi_lpe_audio] ... [ 22.762726] ---[ end trace ceece38854223a0b ]---
Change the 'from' parameter passed to __[devm_]irq_alloc_descs() by the [devm_]irq_alloc_desc macros from 0 to 1, so that these macros will no longer return 0.
---
A quick grep for 'irq_alloc_desc\(' shows only 2 users of irq_alloc_desc():
1. drivers/gpu/drm/i915/display/intel_lpe_audio.c
2. drivers/sh/intc/virq.c
But that might very well be an incomplete list.
--- include/linux/irq.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/irq.h +2 -2
@@ -928,7 +928,7 @@ int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from, __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE, NULL)#define irq_alloc_desc (node) \ - irq_alloc_descs(-1, 0, 1, node) + irq_alloc_descs(-1, 1, 1, node)#define irq_alloc_desc_at (at, node) \ irq_alloc_descs(at, at, 1, node)
@@ -943,7 +943,7 @@ int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from, __devm_irq_alloc_descs(dev, irq, from, cnt, node, THIS_MODULE, NULL)#define devm_irq_alloc_desc (dev, node) \ - devm_irq_alloc_descs(dev, -1, 0, 1, node) + devm_irq_alloc_descs(dev, -1, 1, 1, node)#define devm_irq_alloc_desc_at (dev, at, node) \ devm_irq_alloc_descs(dev, at, at, 1, node)
Signature · 1 line
2.29.2