* [PATCH v8 1/8] iio: mb1232: relax return value check for IRQ get
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
@ 2023-08-01 12:02 ` Matti Vaittinen
2023-08-01 17:53 ` Jonathan Cameron
2023-08-01 12:02 ` [PATCH v8 2/8] iio: cdc: ad7150: " Matti Vaittinen
` (6 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:02 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Andreas Klinger, Jonathan Cameron, Lars-Peter Clausen, linux-iio,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1919 bytes --]
fwnode_irq_get() was changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
Revsion history:
v5 =>:
- No changes
v4 => v5:
- drop unnecessary data->irqnr = -1 assignment
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
---
drivers/iio/proximity/mb1232.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/proximity/mb1232.c b/drivers/iio/proximity/mb1232.c
index fb1073c8d9f7..614e65cb9d42 100644
--- a/drivers/iio/proximity/mb1232.c
+++ b/drivers/iio/proximity/mb1232.c
@@ -76,7 +76,7 @@ static s16 mb1232_read_distance(struct mb1232_data *data)
goto error_unlock;
}
- if (data->irqnr >= 0) {
+ if (data->irqnr > 0) {
/* it cannot take more than 100 ms */
ret = wait_for_completion_killable_timeout(&data->ranging,
HZ/10);
@@ -212,10 +212,7 @@ static int mb1232_probe(struct i2c_client *client)
init_completion(&data->ranging);
data->irqnr = fwnode_irq_get(dev_fwnode(&client->dev), 0);
- if (data->irqnr <= 0) {
- /* usage of interrupt is optional */
- data->irqnr = -1;
- } else {
+ if (data->irqnr > 0) {
ret = devm_request_irq(dev, data->irqnr, mb1232_handle_irq,
IRQF_TRIGGER_FALLING, id->name, indio_dev);
if (ret < 0) {
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v8 1/8] iio: mb1232: relax return value check for IRQ get
2023-08-01 12:02 ` [PATCH v8 1/8] iio: mb1232: relax return value check for IRQ get Matti Vaittinen
@ 2023-08-01 17:53 ` Jonathan Cameron
0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2023-08-01 17:53 UTC (permalink / raw)
To: Matti Vaittinen
Cc: Matti Vaittinen, Andreas Klinger, Lars-Peter Clausen, linux-iio,
linux-kernel
On Tue, 1 Aug 2023 15:02:10 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> fwnode_irq_get() was changed to not return 0 anymore.
>
> Drop check for return value 0.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
Applied fiddling above so I don't ack and sign off on it because
that confuses me :)
Applied to the togreg branch and pushed out as testing for all the
normal reasons.
Thanks,
Jonathan
> ---
> Revsion history:
> v5 =>:
> - No changes
> v4 => v5:
> - drop unnecessary data->irqnr = -1 assignment
>
> The patch changing the fwnode_irq_get() got merged during 5.4:
> https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
> This is a clean-up as agreed.
> ---
> drivers/iio/proximity/mb1232.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/proximity/mb1232.c b/drivers/iio/proximity/mb1232.c
> index fb1073c8d9f7..614e65cb9d42 100644
> --- a/drivers/iio/proximity/mb1232.c
> +++ b/drivers/iio/proximity/mb1232.c
> @@ -76,7 +76,7 @@ static s16 mb1232_read_distance(struct mb1232_data *data)
> goto error_unlock;
> }
>
> - if (data->irqnr >= 0) {
> + if (data->irqnr > 0) {
> /* it cannot take more than 100 ms */
> ret = wait_for_completion_killable_timeout(&data->ranging,
> HZ/10);
> @@ -212,10 +212,7 @@ static int mb1232_probe(struct i2c_client *client)
> init_completion(&data->ranging);
>
> data->irqnr = fwnode_irq_get(dev_fwnode(&client->dev), 0);
> - if (data->irqnr <= 0) {
> - /* usage of interrupt is optional */
> - data->irqnr = -1;
> - } else {
> + if (data->irqnr > 0) {
> ret = devm_request_irq(dev, data->irqnr, mb1232_handle_irq,
> IRQF_TRIGGER_FALLING, id->name, indio_dev);
> if (ret < 0) {
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v8 2/8] iio: cdc: ad7150: relax return value check for IRQ get
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
2023-08-01 12:02 ` [PATCH v8 1/8] iio: mb1232: relax return value check for IRQ get Matti Vaittinen
@ 2023-08-01 12:02 ` Matti Vaittinen
2023-08-01 17:54 ` Jonathan Cameron
2023-08-01 12:03 ` [PATCH v8 3/8] pinctrl: wpcm450: " Matti Vaittinen
` (5 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:02 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
linux-iio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 3354 bytes --]
fwnode_irq_get[_byname]() were changed to not return 0 anymore. The
special error case where device-tree based IRQ mapping fails can't no
longer be reliably detected from this return value. This yields a
functional change in the driver where the mapping failure is treated as
an error.
The mapping failure can occur for example when the device-tree IRQ
information translation call-back(s) (xlate) fail, IRQ domain is not
found, IRQ type conflicts, etc. In most cases this indicates an error in
the device-tree and special handling is not really required.
One more thing to note is that ACPI APIs do not return zero for any
failures so this special handling did only apply on device-tree based
systems.
Drop the special handling for DT mapping failures as these can no longer
be separated from other errors at driver side. Change all failures in
IRQ getting to be handled by continuing without the events instead of
aborting the probe upon certain errors.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
Revision history:
v5 => v6:
- Never abort the probe when IRQ getting fails but continue without
events.
Please note that I don't have the hardware to test this change.
Furthermore, testing this type of device-tree error cases is not
trivial, as the question we probably dive in is "what happens with the
existing users who have errors in the device-tree". Answering to this
question is not simple.
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
---
drivers/iio/cdc/ad7150.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/cdc/ad7150.c b/drivers/iio/cdc/ad7150.c
index d656d2f12755..4c03b9e834b8 100644
--- a/drivers/iio/cdc/ad7150.c
+++ b/drivers/iio/cdc/ad7150.c
@@ -541,6 +541,7 @@ static int ad7150_probe(struct i2c_client *client)
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct ad7150_chip_info *chip;
struct iio_dev *indio_dev;
+ bool use_irq = true;
int ret;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
@@ -561,14 +562,13 @@ static int ad7150_probe(struct i2c_client *client)
chip->interrupts[0] = fwnode_irq_get(dev_fwnode(&client->dev), 0);
if (chip->interrupts[0] < 0)
- return chip->interrupts[0];
- if (id->driver_data == AD7150) {
+ use_irq = false;
+ else if (id->driver_data == AD7150) {
chip->interrupts[1] = fwnode_irq_get(dev_fwnode(&client->dev), 1);
if (chip->interrupts[1] < 0)
- return chip->interrupts[1];
+ use_irq = false;
}
- if (chip->interrupts[0] &&
- (id->driver_data == AD7151 || chip->interrupts[1])) {
+ if (use_irq) {
irq_set_status_flags(chip->interrupts[0], IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(&client->dev,
chip->interrupts[0],
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v8 2/8] iio: cdc: ad7150: relax return value check for IRQ get
2023-08-01 12:02 ` [PATCH v8 2/8] iio: cdc: ad7150: " Matti Vaittinen
@ 2023-08-01 17:54 ` Jonathan Cameron
0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2023-08-01 17:54 UTC (permalink / raw)
To: Matti Vaittinen
Cc: Matti Vaittinen, Lars-Peter Clausen, Michael Hennerich, linux-iio,
linux-kernel
On Tue, 1 Aug 2023 15:02:47 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> fwnode_irq_get[_byname]() were changed to not return 0 anymore. The
> special error case where device-tree based IRQ mapping fails can't no
> longer be reliably detected from this return value. This yields a
> functional change in the driver where the mapping failure is treated as
> an error.
>
> The mapping failure can occur for example when the device-tree IRQ
> information translation call-back(s) (xlate) fail, IRQ domain is not
> found, IRQ type conflicts, etc. In most cases this indicates an error in
> the device-tree and special handling is not really required.
>
> One more thing to note is that ACPI APIs do not return zero for any
> failures so this special handling did only apply on device-tree based
> systems.
>
> Drop the special handling for DT mapping failures as these can no longer
> be separated from other errors at driver side. Change all failures in
> IRQ getting to be handled by continuing without the events instead of
> aborting the probe upon certain errors.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Again, fiddled tags so I don't have RB and SoB
Applied to the togreg branch of iio.git and pushed out as testing for
all the normal reasons.
Thanks,
Jonathan
>
> ---
> Revision history:
> v5 => v6:
> - Never abort the probe when IRQ getting fails but continue without
> events.
>
> Please note that I don't have the hardware to test this change.
> Furthermore, testing this type of device-tree error cases is not
> trivial, as the question we probably dive in is "what happens with the
> existing users who have errors in the device-tree". Answering to this
> question is not simple.
>
> The patch changing the fwnode_irq_get() got merged during 5.4:
> https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
> This is a clean-up as agreed.
> ---
> drivers/iio/cdc/ad7150.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/cdc/ad7150.c b/drivers/iio/cdc/ad7150.c
> index d656d2f12755..4c03b9e834b8 100644
> --- a/drivers/iio/cdc/ad7150.c
> +++ b/drivers/iio/cdc/ad7150.c
> @@ -541,6 +541,7 @@ static int ad7150_probe(struct i2c_client *client)
> const struct i2c_device_id *id = i2c_client_get_device_id(client);
> struct ad7150_chip_info *chip;
> struct iio_dev *indio_dev;
> + bool use_irq = true;
> int ret;
>
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
> @@ -561,14 +562,13 @@ static int ad7150_probe(struct i2c_client *client)
>
> chip->interrupts[0] = fwnode_irq_get(dev_fwnode(&client->dev), 0);
> if (chip->interrupts[0] < 0)
> - return chip->interrupts[0];
> - if (id->driver_data == AD7150) {
> + use_irq = false;
> + else if (id->driver_data == AD7150) {
> chip->interrupts[1] = fwnode_irq_get(dev_fwnode(&client->dev), 1);
> if (chip->interrupts[1] < 0)
> - return chip->interrupts[1];
> + use_irq = false;
> }
> - if (chip->interrupts[0] &&
> - (id->driver_data == AD7151 || chip->interrupts[1])) {
> + if (use_irq) {
> irq_set_status_flags(chip->interrupts[0], IRQ_NOAUTOEN);
> ret = devm_request_threaded_irq(&client->dev,
> chip->interrupts[0],
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v8 3/8] pinctrl: wpcm450: relax return value check for IRQ get
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
2023-08-01 12:02 ` [PATCH v8 1/8] iio: mb1232: relax return value check for IRQ get Matti Vaittinen
2023-08-01 12:02 ` [PATCH v8 2/8] iio: cdc: ad7150: " Matti Vaittinen
@ 2023-08-01 12:03 ` Matti Vaittinen
2023-08-01 12:03 ` [PATCH v8 4/8] pinctrl: ingenic: " Matti Vaittinen
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:03 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Jonathan Neuschäfer, Linus Walleij, openbmc, linux-gpio,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2428 bytes --]
fwnode_irq_get[_byname]() were changed to not return 0 anymore. The
special error case where device-tree based IRQ mapping fails can't no
longer be reliably detected from this return value. This yields a
functional change in the driver where the mapping failure is treated as
an error.
The mapping failure can occur for example when the device-tree IRQ
information translation call-back(s) (xlate) fail, IRQ domain is not
found, IRQ type conflicts, etc. In most cases this indicates an error in
the device-tree and special handling is not really required.
One more thing to note is that ACPI APIs do not return zero for any
failures so this special handling did only apply on device-tree based
systems.
Drop the special (no error, just skip the IRQ) handling for DT mapping
failures as these can no longer be separated from other errors at driver
side.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
Revision history:
v5 => :
- No changes
v4 => v5:
Fix typo in subject "elax" => "relax"
Please note, I took Linus' reply to v4 cover-letter as ack && added the
tag. Please let me know if this was not Ok.
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
---
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 2d1c1652cfd9..f9326210b5eb 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -1106,8 +1106,6 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
irq = fwnode_irq_get(child, i);
if (irq < 0)
break;
- if (!irq)
- continue;
girq->parents[i] = irq;
girq->num_parents++;
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v8 4/8] pinctrl: ingenic: relax return value check for IRQ get
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
` (2 preceding siblings ...)
2023-08-01 12:03 ` [PATCH v8 3/8] pinctrl: wpcm450: " Matti Vaittinen
@ 2023-08-01 12:03 ` Matti Vaittinen
2023-08-01 12:03 ` [PATCH v8 5/8] pinctrl: pistachio: " Matti Vaittinen
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:03 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Paul Cercueil, Linus Walleij, linux-mips, linux-gpio,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]
fwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
Revision history:
- No changes
Please note, I took Linus' reply to v4 cover-letter as ack && added the
tag. Please let me know if this was not Ok.
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
---
drivers/pinctrl/pinctrl-ingenic.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 2f220a47b749..86e71ad703a5 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -4201,8 +4201,6 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,
err = fwnode_irq_get(fwnode, 0);
if (err < 0)
return err;
- if (!err)
- return -EINVAL;
jzgc->irq = err;
girq = &jzgc->gc.irq;
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v8 5/8] pinctrl: pistachio: relax return value check for IRQ get
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
` (3 preceding siblings ...)
2023-08-01 12:03 ` [PATCH v8 4/8] pinctrl: ingenic: " Matti Vaittinen
@ 2023-08-01 12:03 ` Matti Vaittinen
2023-08-01 12:04 ` [PATCH v8 6/8] i2c: i2c-smbus: fwnode_irq_get_byname() return value fix Matti Vaittinen
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:03 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen; +Cc: Linus Walleij, linux-gpio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1638 bytes --]
fwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
Revision history:
- No changes
Please note, I took Linus' reply to v4 cover-letter as ack && added the
tag. Please let me know if this was not Ok.
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
---
drivers/pinctrl/pinctrl-pistachio.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
index 53408344927a..8c50e0091b32 100644
--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -1393,12 +1393,6 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
dev_err(pctl->dev, "Failed to retrieve IRQ for bank %u\n", i);
goto err;
}
- if (!ret) {
- fwnode_handle_put(child);
- dev_err(pctl->dev, "No IRQ for bank %u\n", i);
- ret = -EINVAL;
- goto err;
- }
irq = ret;
bank = &pctl->gpio_banks[i];
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v8 6/8] i2c: i2c-smbus: fwnode_irq_get_byname() return value fix
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
` (4 preceding siblings ...)
2023-08-01 12:03 ` [PATCH v8 5/8] pinctrl: pistachio: " Matti Vaittinen
@ 2023-08-01 12:04 ` Matti Vaittinen
2023-08-01 12:04 ` [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get Matti Vaittinen
2023-08-01 12:04 ` [PATCH v8 8/8] net-next: mvpp2: don't shadow error Matti Vaittinen
7 siblings, 0 replies; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:04 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen; +Cc: Wolfram Sang, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]
The fwnode_irq_get_byname() was changed to not return 0 upon failure so
return value check can be adjusted to reflect the change.
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
Revision history:
v5 =>:
- No changes
v4 => v5:
- Added back after this was accidentally dropped at v4.
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
The return value change did also cause a functional change here. Eg. when
IRQ mapping fails, the fwnode_irq_get_byname() no longer returns zero.
This will cause also the probe here to return nonzero failure. I guess
this is desired behaviour - but I would appreciate any confirmation.
Please, see also previous discussion here:
https://lore.kernel.org/all/fbd52f5f5253b382b8d7b3e8046134de29f965b8.1666710197.git.mazziesaccount@gmail.com/
Another suggestion has been to drop the check altogether. I am slightly
reluctant on doing that unless it gets confirmed that is the "right
thing to do".
---
drivers/i2c/i2c-smbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index 138c3f5e0093..893fe7cd3e41 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -129,7 +129,7 @@ static int smbalert_probe(struct i2c_client *ara)
} else {
irq = fwnode_irq_get_byname(dev_fwnode(adapter->dev.parent),
"smbus_alert");
- if (irq <= 0)
+ if (irq < 0)
return irq;
}
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
` (5 preceding siblings ...)
2023-08-01 12:04 ` [PATCH v8 6/8] i2c: i2c-smbus: fwnode_irq_get_byname() return value fix Matti Vaittinen
@ 2023-08-01 12:04 ` Matti Vaittinen
2023-08-01 12:31 ` Russell King (Oracle)
2023-08-01 12:04 ` [PATCH v8 8/8] net-next: mvpp2: don't shadow error Matti Vaittinen
7 siblings, 1 reply; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:04 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Marcin Wojtas, Russell King, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]
fwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
Revision history:
v5 =>:
- No changes
v4 = v5:
Fix the subject, mb1232 => mvpp2
The patch changing the fwnode_irq_get() got merged during 5.4:
https://lore.kernel.org/all/fb7241d3-d1d1-1c37-919b-488d6d007484@gmail.com/
This is a clean-up as agreed.
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 1fec84b4c068..2632ffe91ca5 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5833,7 +5833,7 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port,
v->irq = of_irq_get_byname(port_node, irqname);
else
v->irq = fwnode_irq_get(port->fwnode, i);
- if (v->irq <= 0) {
+ if (v->irq < 0) {
ret = -EINVAL;
goto err;
}
@@ -6764,7 +6764,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
err = -EPROBE_DEFER;
goto err_deinit_qvecs;
}
- if (port->port_irq <= 0)
+ if (port->port_irq < 0)
/* the link irq is optional */
port->port_irq = 0;
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get
2023-08-01 12:04 ` [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get Matti Vaittinen
@ 2023-08-01 12:31 ` Russell King (Oracle)
2023-08-01 12:44 ` Matti Vaittinen
0 siblings, 1 reply; 14+ messages in thread
From: Russell King (Oracle) @ 2023-08-01 12:31 UTC (permalink / raw)
To: Matti Vaittinen
Cc: Matti Vaittinen, Marcin Wojtas, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Tue, Aug 01, 2023 at 03:04:24PM +0300, Matti Vaittinen wrote:
> fwnode_irq_get[_byname]() were changed to not return 0 anymore.
>
> Drop check for return value 0.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Sorry, but I don't think you've properly considered the effects of your
patch.
> @@ -5833,7 +5833,7 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port,
> v->irq = of_irq_get_byname(port_node, irqname);
> else
> v->irq = fwnode_irq_get(port->fwnode, i);
> - if (v->irq <= 0) {
> + if (v->irq < 0) {
You're making this change based on the assumption that fwnode_irq_get()
has changed its return values, but I really don't think you've looked
at the code and considered the return value behaviour of the DT function
above. Reading it's documentation, it states that of_irq_get_byname()
may return 0 on IRQ mapping failure.
So, by making this change, you are allowing IRQ mapping failure in the
DT path to succeed rather than fail.
> ret = -EINVAL;
> goto err;
> }
> @@ -6764,7 +6764,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
> err = -EPROBE_DEFER;
> goto err_deinit_qvecs;
> }
> - if (port->port_irq <= 0)
> + if (port->port_irq < 0)
Exactly the same problem here, but...
> /* the link irq is optional */
> port->port_irq = 0;
this is less critical... but still wrong.
So, given that this patch is basically incorrect...
NAK.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get
2023-08-01 12:31 ` Russell King (Oracle)
@ 2023-08-01 12:44 ` Matti Vaittinen
0 siblings, 0 replies; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:44 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Matti Vaittinen, Marcin Wojtas, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On 8/1/23 15:31, Russell King (Oracle) wrote:
> On Tue, Aug 01, 2023 at 03:04:24PM +0300, Matti Vaittinen wrote:
>> fwnode_irq_get[_byname]() were changed to not return 0 anymore.
>>
>> Drop check for return value 0.
>>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
>
> Sorry, but I don't think you've properly considered the effects of your
> patch.
Don't be sorry.
>
>> @@ -5833,7 +5833,7 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port,
>> v->irq = of_irq_get_byname(port_node, irqname);
>> else
>> v->irq = fwnode_irq_get(port->fwnode, i);
>> - if (v->irq <= 0) {
>> + if (v->irq < 0) {
>
> You're making this change based on the assumption that fwnode_irq_get()
> has changed its return values, but I really don't think you've looked
> at the code and considered the return value behaviour of the DT function
> above. Reading it's documentation, it states that of_irq_get_byname()
> may return 0 on IRQ mapping failure.
You're correct. Thanks for spotting this! Seems like I really overlooked
the behaviour of the of_irq_get_byname().
> So, by making this change, you are allowing IRQ mapping failure in the
> DT path to succeed rather than fail.
>
>> ret = -EINVAL;
>> goto err;
>> }
>> @@ -6764,7 +6764,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>> err = -EPROBE_DEFER;
>> goto err_deinit_qvecs;
>> }
>> - if (port->port_irq <= 0)
>> + if (port->port_irq < 0)
>
> Exactly the same problem here, but...
>
>> /* the link irq is optional */
>> port->port_irq = 0;
>
> this is less critical... but still wrong.
>
> So, given that this patch is basically incorrect...
>
> NAK.
>
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v8 8/8] net-next: mvpp2: don't shadow error
2023-08-01 12:00 [PATCH v8 0/8] fix fwnode_irq_get[_byname()] returnvalue Matti Vaittinen
` (6 preceding siblings ...)
2023-08-01 12:04 ` [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get Matti Vaittinen
@ 2023-08-01 12:04 ` Matti Vaittinen
2023-08-01 12:31 ` Russell King (Oracle)
7 siblings, 1 reply; 14+ messages in thread
From: Matti Vaittinen @ 2023-08-01 12:04 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Marcin Wojtas, Russell King, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]
Do not overwrite error from lower layers but return the actual error to
user if obtaining an IRQ fails.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 2632ffe91ca5..2aba34a2ca76 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5830,13 +5830,13 @@ static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port,
}
if (port_node)
- v->irq = of_irq_get_byname(port_node, irqname);
+ ret = of_irq_get_byname(port_node, irqname);
else
- v->irq = fwnode_irq_get(port->fwnode, i);
- if (v->irq < 0) {
- ret = -EINVAL;
+ ret = fwnode_irq_get(port->fwnode, i);
+ if (ret < 0)
goto err;
- }
+
+ v->irq = ret;
netif_napi_add(port->dev, &v->napi, mvpp2_poll);
}
--
2.40.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v8 8/8] net-next: mvpp2: don't shadow error
2023-08-01 12:04 ` [PATCH v8 8/8] net-next: mvpp2: don't shadow error Matti Vaittinen
@ 2023-08-01 12:31 ` Russell King (Oracle)
0 siblings, 0 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2023-08-01 12:31 UTC (permalink / raw)
To: Matti Vaittinen
Cc: Matti Vaittinen, Marcin Wojtas, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Tue, Aug 01, 2023 at 03:04:40PM +0300, Matti Vaittinen wrote:
> Do not overwrite error from lower layers but return the actual error to
> user if obtaining an IRQ fails.
>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Since your previous patch is incorrect, this one is too.
NAK.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 14+ messages in thread