fix fwnode_irq_get[_byname()] returnvalue
Subsystems (13)
v8 cover fix fwnode_irq_get[_byname()] returnvalue
The fwnode_irq_get() and the fwnode_irq_get_byname() may have returned zero if mapping the IRQ fails. This contradicts the fwnode_irq_get_byname() documentation. Furthermore, returning zero or errno on error is unepected and can easily lead to problems like:
int probe(foo)
{
...
ret = fwnode_irq_get_byname(...); if (ret < 0) return ret;
...
}
or
int probe(foo)
{
...
ret = fwnode_irq_get_byname(...); if (ret <= 0) return ret;
...
}
which are both likely to be wrong. First treats zero as successful call and misses the IRQ mapping failure. Second returns zero from probe even though it detects the IRQ mapping failure correvtly.
Thus the fwnode_irq_get() and the fwnode_irq_get_byname() were changed to always return a negative errno upon failure.
https://lore.kernel.org/all/[email protected]/
This is a clean-up patch to adjust callers. Please note that callers were audited based on v6.4-rc2:
fwnode_irq_get_byname():drivers/i2c/i2c-smbus.cdrivers/iio/accel/adxl355_core.cdrivers/iio/accel/kionix-kx022a.cdrivers/iio/adc/ad4130.cdrivers/iio/adc/max11410.cdrivers/iio/addac/ad74115.cdrivers/iio/gyro/fxas21002c_core.cdrivers/iio/imu/adis16480.cdrivers/iio/imu/bmi160/bmi160_core.cdrivers/iio/imu/bmi160/bmi160_core.c
fwnode_irq_get():drivers/gpio/gpio-dwapb.cdrivers/iio/chemical/scd30_serial.cdrivers/iio/proximity/mb1232.cdrivers/net/ethernet/marvell/mvpp2/mvpp2_main.cdrivers/net/mdio/fwnode_mdio.cdrivers/pinctrl/pinctrl-ingenic.cdrivers/pinctrl/pinctrl-microchip-sgpio.cdrivers/pinctrl/pinctrl-pistachio.c
and it seems to me these calls will be Ok after this clean-up. The i2c-smbus.c and kionix-kx022a.c will gain a functional change (bugfix?) as after this patch the probe will return -EINVAL should the IRQ mapping fail. The series will also adjust the return value check for zero to be omitted.
NOTES:
Changes are compile-tested only.
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
will also gain a functional change. The pinctrl-wpcm450.c change is easy to see - after this series the device-tree mapping failures will be handled as any other errors - probe will be aborted with -EINVAL. Other feasible option could be treating other errors in IRQ getting same way as the DT mapping failures - just silently skip the IRQ. Please see comment in the respective patch.
drivers/iio/cdc/ad7150.c
Changed logic so that all the IRQ getting errors jump to the same 'no-IRQ' branch as the DT mapping error did.
Revision history:
v7 => v8:
- drop ptach 1/N which was merged during 6.4 development.
- rebase on top of the v6.5-rc4.
v6 => v7:
- re-ordered patches per subsystem
- mvpp2 - added a patch for not shadowing the return value
v5 => v6:
- iio: cdc: ad7150 - never abort probe if IRQ getting fails
v4 => v5:
- Fix subject lines for mvpp2 and wpcm450
- drop unnecessary irqno assignment from mb1232
- add back the drivers/i2c/i2c-smbus.c change which was accidentally dropped during v3 => v4 work
v3 => v4:
- Change also the fwnode_irq_get() as was suggested by Jonathan.
Changelog v2 => v3:
- rebase/resend/add kx022a fix.
Changelog v1 => v2:
- minor styling
---
Matti Vaittinen (8):
iio: mb1232: relax return value check for IRQ get
iio: cdc: ad7150: relax return value check for IRQ get
pinctrl: wpcm450: relax return value check for IRQ get
pinctrl: ingenic: relax return value check for IRQ get
pinctrl: pistachio: relax return value check for IRQ get
i2c: i2c-smbus: fwnode_irq_get_byname() return value fix
net-next: mvpp2: relax return value check for IRQ get
net-next: mvpp2: don't shadow error
drivers/i2c/i2c-smbus.c | 2 +- drivers/iio/cdc/ad7150.c | 10 +++++----- drivers/iio/proximity/mb1232.c | 7 ++----- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 12 ++++++------ drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 2 -- drivers/pinctrl/pinctrl-ingenic.c | 2 -- drivers/pinctrl/pinctrl-pistachio.c | 6 ------ 7 files changed, 14 insertions(+), 27 deletions(-)
base-commit: 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4
Signature · 14 lines
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 =]
PATCH v8 1/8 iio: mb1232: relax return value check for IRQ get
fwnode_irq_get() was changed to not return 0 anymore.
Drop check for return value 0.
---
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/[email protected]/
This is a clean-up as agreed.
--- drivers/iio/proximity/mb1232.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/proximity/mb1232.c +2 -5
@@ -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 ) {
Signature · 14 lines
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 =]
Jonathan Cameron
maintainerRe: [PATCH v8 1/8] iio: mb1232: relax return value check for IRQ get
Quoted 8 lines · On Tue, 1 Aug 2023 15:02:10 +0300 Matti Vaittinen <[email protected]>…
fwnode_irq_get()was changed to not return 0 anymore.Drop check for return value 0.
Signed-off-by Matti Vaittinen <[email protected]>Acked-by Jonathan Cameron <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
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
Quoted 39 lines
---
Revsion history:
v5 =>:
- No changes
v4 => v5:
- drop unnecessarydata->irqnr= -1 assignmentThe patch changing the
fwnode_irq_get()got merged during 5.4:
https://lore.kernel.org/all/[email protected]/
This is a clean-up as agreed.--- drivers/iio/proximity/mb1232.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/iio/proximity/mb1232.c +2
-5@@ -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 ) {
PATCH v8 2/8 iio: cdc: ad7150: relax return value check for IRQ get
In reply to Matti Vaittinenfwnode_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.
---
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/[email protected]/
This is a clean-up as agreed.
--- drivers/iio/cdc/ad7150.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/iio/cdc/ad7150.c +5 -5
@@ -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],
Signature · 14 lines
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 =]
Jonathan Cameron
maintainerRe: [PATCH v8 2/8] iio: cdc: ad7150: relax return value check for IRQ get
Quoted 15 lines · On Tue, 1 Aug 2023 15:02:47 +0300 Matti Vaittinen <[email protected]>…
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.
Quoted 7 lines
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 <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>
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
Quoted 51 lines
---
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/[email protected]/
This is a clean-up as agreed.--- drivers/iio/cdc/ad7150.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/iio/cdc/ad7150.c +5
-5@@ -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],
PATCH v8 3/8 pinctrl: wpcm450: relax return value check for IRQ get
In reply to Matti Vaittinenfwnode_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.
---
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/[email protected]/
This is a clean-up as agreed.
--- drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 2 -- 1 file changed, 2 deletions(-)
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c +0 -2
@@ -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++;
Signature · 14 lines
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 =]
PATCH v8 4/8 pinctrl: ingenic: relax return value check for IRQ get
In reply to Matti Vaittinenfwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
---
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/[email protected]/
This is a clean-up as agreed.
--- drivers/pinctrl/pinctrl-ingenic.c | 2 -- 1 file changed, 2 deletions(-)
drivers/pinctrl/pinctrl-ingenic.c +0 -2
@@ -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;
Signature · 14 lines
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 =]
PATCH v8 5/8 pinctrl: pistachio: relax return value check for IRQ get
In reply to Matti Vaittinenfwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
---
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/[email protected]/
This is a clean-up as agreed.
--- drivers/pinctrl/pinctrl-pistachio.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/pinctrl/pinctrl-pistachio.c +0 -6
@@ -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];
Signature · 14 lines
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 =]
PATCH v8 6/8 i2c: i2c-smbus: fwnode_irq_get_byname() return value fix
In reply to Matti VaittinenThe fwnode_irq_get_byname() was changed to not return 0 upon failure so return value check can be adjusted to reflect the change.
---
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/[email protected]/
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(-)
drivers/i2c/i2c-smbus.c +1 -1
@@ -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; }
Signature · 14 lines
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 =]
PATCH v8 7/8 net-next: mvpp2: relax return value check for IRQ get
In reply to Matti Vaittinenfwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
---
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/[email protected]/
This is a clean-up as agreed.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2 -2
@@ -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 ;
Signature · 14 lines
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 =]
Re: [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get
Quoted 5 lines · Matti Vaittinen
fwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by Matti Vaittinen <[email protected]>
Sorry, but I don't think you've properly considered the effects of your patch.
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port, · line 5836
Quoted 6 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1
-1@@ -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.
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_port_probe(struct platform_device *pdev, · line 6767
Quoted 9 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1
-1ret = -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...
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_port_probe(struct platform_device *pdev, · line 6769
Quoted 2 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +0
-0/* 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.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH v8 7/8] net-next: mvpp2: relax return value check for IRQ get
Quoted 9 lines · Russell King (Oracle)
Quoted 5 lines · Matti Vaittinen
fwnode_irq_get[_byname]() were changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by Matti Vaittinen <[email protected]>Sorry, but I don't think you've properly considered the effects of your patch.
Don't be sorry.
Quoted 13 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_multi_queue_vectors_init(struct mvpp2_port *port, · line 5836
Quoted 7 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1
-1@@ -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 thatof_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().
Quoted 24 lines
So, by making this change, you are allowing IRQ mapping failure in the DT path to succeed rather than fail.
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_port_probe(struct platform_device *pdev, · line 6767
Quoted 9 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1
-1ret = -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...
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_port_probe(struct platform_device *pdev, · line 6769
Quoted 2 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +0
-0/* 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.
Signature · 5 lines
Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~
PATCH v8 8/8 net-next: mvpp2: don't shadow error
In reply to Matti VaittinenDo not overwrite error from lower layers but return the actual error to user if obtaining an IRQ fails.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +5 -5
@@ -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); }
Signature · 14 lines
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 =]
Re: [PATCH v8 8/8] net-next: mvpp2: don't shadow error
Quoted 6 lines · Matti Vaittinen
Do not overwrite error from lower layers but return the actual error to user if obtaining an IRQ fails.
Suggested-by Andy Shevchenko <[email protected]>Suggested-by Jonathan Cameron <[email protected]>Signed-off-by Matti Vaittinen <[email protected]>
Since your previous patch is incorrect, this one is too.
NAK.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!