ASoC: cs35l56: Accept values greater than 0 as IRQ numbers
Subsystems (3)
PATCH 1/1 ASoC: cs35l56: Accept values greater than 0 as IRQ numbers
IRQ lookup functions such as those in ACPI can return error values when an IRQ is not defined. The i2c core driver converts the error codes to a value of 0 and the SPI bus driver passes them unaltered to client device drivers.
The cs35l56 driver should only accept positive non-zero values as IRQ numbers.
--- sound/soc/codecs/cs35l56-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs35l56-shared.c +1 -1
@@ -397,7 +397,7 @@ int cs35l56_irq_request(struct cs35l56_base *cs35l56_base, int irq) {int ret; -if (!irq) +if (irq <1 )return 0 ; ret = devm_request_threaded_irq(cs35l56_base->dev, irq, NULL, cs35l56_irq,
Signature · 1 line
2.34.1
Mark Brown
maintainerQuoted 7 lines · Simon Trimmer
IRQ lookup functions such as those in ACPI can return error values when an IRQ is not defined. The i2c core driver converts the error codes to a value of 0 and the SPI bus driver passes them unaltered to client device drivers.
The cs35l56 driver should only accept positive non-zero values as IRQ numbers.
Have all architectures removed 0 as a valid IRQ?
Richard Fitzgerald
maintainerQuoted 10 lines · Mark Brown
Quoted 7 lines · Simon Trimmer
IRQ lookup functions such as those in ACPI can return error values when an IRQ is not defined. The i2c core driver converts the error codes to a value of 0 and the SPI bus driver passes them unaltered to client device drivers.
The cs35l56 driver should only accept positive non-zero values as IRQ numbers.
Have all architectures removed 0 as a valid IRQ?
From discussion threads we can find 0 might still used on x86 for a legacy device.
But the conversations we can find on this don't seem to exclude passing a negative error number, just that 0 can normally be assumed invalid.
The kerneldoc for SPI says:
* @irq: Negative, or the number passed to request_irq() to receive
* interrupts from this device.
Quoted 6 lines
From: Richard Fitzgerald <[email protected]>
Sent: Monday, June 17, 2024 3:34 PMQuoted 3 lines · Mark Brown
Quoted 2 lines · Simon Trimmer
IRQ lookup functions such as those in ACPI can return error values when an IRQ is not defined. The i2c core driver converts the error codes to
a
Quoted 1 line
Quoted 1 line
Quoted 1 line
value of 0 and the SPI bus driver passes them unaltered to client
device
Quoted 12 lines
Quoted 6 lines
Quoted 4 lines
drivers.
The cs35l56 driver should only accept positive non-zero values as IRQ numbers.
Have all architectures removed 0 as a valid IRQ?
From discussion threads we can find 0 might still used on x86 for a
legacy device.
But the conversations we can find on this don't seem to exclude passing a negative error number, just that 0 can normally be assumed invalid.
Quoted 4 lines
The kerneldoc for SPI says:
* @irq: Negative, or the number passed to
request_irq()to receive
* interrupts from this device.
Yes and the threads of these lore links in these commits are rather feisty
ce753ad1549c platform: finally disallow IRQ0 in platform_get_irq() and its ilka85a6c86c25b driver core: platform: Clarify that IRQ 0 is invalid
Richard Fitzgerald
maintainerQuoted 23 lines · Simon Trimmer
Quoted 6 lines
From: Richard Fitzgerald <[email protected]>
Sent: Monday, June 17, 2024 3:34 PMQuoted 3 lines · Mark Brown
Quoted 2 lines · Simon Trimmer
IRQ lookup functions such as those in ACPI can return error values when an IRQ is not defined. The i2c core driver converts the error codes to
a
Quoted 1 line
Quoted 1 line
Quoted 1 line
value of 0 and the SPI bus driver passes them unaltered to client
device
Quoted 14 lines
Quoted 6 lines
Quoted 4 lines
drivers.
The cs35l56 driver should only accept positive non-zero values as IRQ numbers.
Have all architectures removed 0 as a valid IRQ?
From discussion threads we can find 0 might still used on x86 for a
legacy device.
But the conversations we can find on this don't seem to exclude passing a negative error number, just that 0 can normally be assumed invalid.The kerneldoc for SPI says:
Quoted 10 lines
Quoted 2 lines
* @irq: Negative, or the number passed to
request_irq()to receive
* interrupts from this device.Yes and the threads of these lore links in these commits are rather feisty
ce753ad1549cplatform: finally disallow IRQ0 inplatform_get_irq()and its ilka85a6c86c25bdriver core: platform: Clarify that IRQ 0 is invalid
So 0 is invalid. Question is: is it also valid to pass -ve errors, or is 0 the _only_ invalid value?
Mark Brown
maintainerQuoted 2 lines · Richard Fitzgerald
So 0 is invalid. Question is: is it also valid to pass -ve errors, or is 0 the _only_ invalid value?
Negative values should be fine.
Richard Fitzgerald
maintainerQuoted 6 lines · Mark Brown
Quoted 2 lines · Richard Fitzgerald
So 0 is invalid. Question is: is it also valid to pass -ve errors, or is 0 the _only_ invalid value?
Negative values should be fine.
In that case this patch is necessary so we reject negative values as not an IRQ. Otherwise we'll try to request a non-existant IRQ and fail with an error.
Mark Brown
maintainerQuoted 6 lines · Richard Fitzgerald
Quoted 1 line · Mark Brown
Have all architectures removed 0 as a valid IRQ?
From discussion threads we can find 0 might still used on x86 for a legacy device.
Some of the arm platforms were also an issue in the past, though possibly they've all been modernised by now. Don't know about other older architectures.
Quoted 2 lines
But the conversations we can find on this don't seem to exclude passing a negative error number, just that 0 can normally be assumed invalid.
Yes, the question was specifically about the assumption that 0 is invalid. The status of 0 is kind of a mess, people keep assuming that it isn't valid and it just depends if users of platforms which try to use 0 trip up over it. Sometimes people work on trying to eliminate uses of 0 but it tends to get you into older code nobody wants to touch.
Quoted 4 lines
The kerneldoc for SPI says:
* @irq: Negative, or the number passed to
request_irq()to receive
* interrupts from this device.
Which includes the 0 as valid thing...
Richard Fitzgerald
maintainerQuoted 21 lines · Mark Brown
Quoted 6 lines · Richard Fitzgerald
Quoted 1 line · Mark Brown
Have all architectures removed 0 as a valid IRQ?
From discussion threads we can find 0 might still used on x86 for a
legacy device.Some of the arm platforms were also an issue in the past, though possibly they've all been modernised by now. Don't know about other older architectures.
Quoted 2 lines
But the conversations we can find on this don't seem to exclude passing a negative error number, just that 0 can normally be assumed invalid.
Yes, the question was specifically about the assumption that 0 is invalid. The status of 0 is kind of a mess, people keep assuming that it isn't valid and it just depends if users of platforms which try to use 0 trip up over it. Sometimes people work on trying to eliminate uses of 0 but it tends to get you into older code nobody wants to touch.
Quoted 6 lines
Quoted 4 lines
The kerneldoc for SPI says:
* @irq: Negative, or the number passed to
request_irq()to receive
* interrupts from this device.Which includes the 0 as valid thing...
The statement of truth from Linus Torvalds et al. seems to be that 0 is invalid except on x86. And on x86 it is specifically reserved for a legacy timer IRQ so it can't be anything else.
Richard Fitzgerald
maintainerQuoted 19 lines · Simon Trimmer
IRQ lookup functions such as those in ACPI can return error values when an IRQ is not defined. The i2c core driver converts the error codes to a value of 0 and the SPI bus driver passes them unaltered to client device drivers.
The cs35l56 driver should only accept positive non-zero values as IRQ numbers.
Signed-off-by Simon Trimmer <[email protected]>Fixes 8a731fd37f8b ("ASoC: cs35l56: Move utility functions to shared file")--- sound/soc/codecs/cs35l56-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/codecs/cs35l56-shared.c +0
-0
sound/soc/codecs/cs35l56-shared.c int cs35l56_irq_request(struct cs35l56_base *cs35l56_base, int irq) · line 403
Quoted 8 lines
sound/soc/codecs/cs35l56-shared.c +1
-1@@ -397,7 +397,7 @@ int cs35l56_irq_request(struct cs35l56_base *cs35l56_base, int irq) {int ret; -if (!irq) +if (irq <1 )return 0 ; ret = devm_request_threaded_irq(cs35l56_base->dev, irq, NULL, cs35l56_irq,
Mark, I don't understand what your objection is. What is it you want us to do to get this bugfix accepted?
Mark Brown
maintainerQuoted 2 lines · Richard Fitzgerald
Mark, I don't understand what your objection is. What is it you want us to do to get this bugfix accepted?
Have patience.
Richard Fitzgerald
maintainerQuoted 6 lines · Mark Brown
Quoted 2 lines · Richard Fitzgerald
Mark, I don't understand what your objection is. What is it you want us to do to get this bugfix accepted?
Have patience.
Ah, ok. Sorry, I assumed you were objecting not just overloaded.
Mark Brown
maintainerQuoted 1 line · Richard Fitzgerald
Ah, ok. Sorry, I assumed you were objecting not just overloaded.
There's a latency between me deciding to apply a patch and the patch actually ending up in my tree - I test everything which takes time.
Mark Brown
maintainerQuoted 9 lines · Simon Trimmer
IRQ lookup functions such as those in ACPI can return error values when an IRQ is not defined. The i2c core driver converts the error codes to a value of 0 and the SPI bus driver passes them unaltered to client device drivers.
The cs35l56 driver should only accept positive non-zero values as IRQ numbers.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: cs35l56: Accept values greater than 0 as IRQ numbers
commit: 3ec1428d7b7c519d757a013cef908d7e33dee882
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark