Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: cdc: ad7150: relax return value check for IRQ get

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>
Link: https://lore.kernel.org/r/3ad1c6f195ead3dfa8711235e1dead139d27f700.1690890774.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Matti Vaittinen and committed by
Jonathan Cameron
b20f5801 1402913c

+5 -5
+5 -5
drivers/iio/cdc/ad7150.c
··· 541 541 const struct i2c_device_id *id = i2c_client_get_device_id(client); 542 542 struct ad7150_chip_info *chip; 543 543 struct iio_dev *indio_dev; 544 + bool use_irq = true; 544 545 int ret; 545 546 546 547 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); ··· 562 561 563 562 chip->interrupts[0] = fwnode_irq_get(dev_fwnode(&client->dev), 0); 564 563 if (chip->interrupts[0] < 0) 565 - return chip->interrupts[0]; 566 - if (id->driver_data == AD7150) { 564 + use_irq = false; 565 + else if (id->driver_data == AD7150) { 567 566 chip->interrupts[1] = fwnode_irq_get(dev_fwnode(&client->dev), 1); 568 567 if (chip->interrupts[1] < 0) 569 - return chip->interrupts[1]; 568 + use_irq = false; 570 569 } 571 - if (chip->interrupts[0] && 572 - (id->driver_data == AD7151 || chip->interrupts[1])) { 570 + if (use_irq) { 573 571 irq_set_status_flags(chip->interrupts[0], IRQ_NOAUTOEN); 574 572 ret = devm_request_threaded_irq(&client->dev, 575 573 chip->interrupts[0],