Remove the int irq_line field in struct ad_sigma_delta_info and all code that referenced it. This struct is intended to be used as static const data. Currently, the only user that doesn't uses the static const struct directly, namely the ad7173 driver is making a copy of this struct to be able to modify the irq_line field. However, this field is written and never used due to the fact that ad_sd_init() which reads the field is called before ad7173_fw_parse_device_config() which writes it. The runtime behavior does not change since ad_sd_init() was already (unintentionally) being called with irq_line = 0. But, even though this could be considered a bug, the behavior was still correct. The SPI subsystem always uses the first interrupt in the interrupts array from the devicetree and the devicetree bindings for this family of chips specify that the RDY interrupt is always the first interrupt. Therefore, we don't actually need the special call to fwnode_irq_get_byname(), so it is removed in this patch instead of moving it to the correct place. Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx> --- v2 changes: * Fixed chip name is subject line * Uwe's comment made me realize that the special case was actually never being used because of the ordering bug and could safely be removed rather than trying to preserve it. --- drivers/iio/adc/ad7173.c | 8 +------- drivers/iio/adc/ad_sigma_delta.c | 5 +---- include/linux/iio/adc/ad_sigma_delta.h | 2 -- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index c83c4c90b090..52fce43e4ce1 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -199,7 +199,7 @@ struct ad7173_channel { struct ad7173_state { struct ad_sigma_delta sd; - struct ad_sigma_delta_info sigma_delta_info; + struct ad_sigma_delta_chip_info sigma_delta_info; const struct ad7173_device_info *info; struct ad7173_channel *channels; struct regulator_bulk_data regulators[3]; @@ -1398,12 +1398,6 @@ static int ad7173_fw_parse_device_config(struct iio_dev *indio_dev) return ret; } - ret = fwnode_irq_get_byname(dev_fwnode(dev), "rdy"); - if (ret < 0) - return dev_err_probe(dev, ret, "Interrupt 'rdy' is required\n"); - - st->sigma_delta_info.irq_line = ret; - return ad7173_fw_parse_channel_config(indio_dev); } diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index 2f3b61765055..38c48743712e 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c @@ -674,10 +674,7 @@ int ad_sd_init(struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev, } } - if (info->irq_line) - sigma_delta->irq_line = info->irq_line; - else - sigma_delta->irq_line = spi->irq; + sigma_delta->irq_line = spi->irq; iio_device_set_drvdata(indio_dev, sigma_delta); diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h index f8c1d2505940..44f487323a43 100644 --- a/include/linux/iio/adc/ad_sigma_delta.h +++ b/include/linux/iio/adc/ad_sigma_delta.h @@ -52,7 +52,6 @@ struct iio_dev; * be used. * @irq_flags: flags for the interrupt used by the triggered buffer * @num_slots: Number of sequencer slots - * @irq_line: IRQ for reading conversions. If 0, spi->irq will be used */ struct ad_sigma_delta_info { int (*set_channel)(struct ad_sigma_delta *, unsigned int channel); @@ -68,7 +67,6 @@ struct ad_sigma_delta_info { unsigned int data_reg; unsigned long irq_flags; unsigned int num_slots; - int irq_line; }; /** -- 2.43.0