Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6754712 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-fixes-for-4.16a' of...

Merge tag 'iio-fixes-for-4.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First round of IIO fixes for the 4.16 cycle.

One nasty very old crash around polling for buffers that aren't there
- though that can only cause effects on drivers that support events
but not buffers.

* buffer / kfifo handling in the core.
  - Check there is a buffer and return 0 from poll directly if there
    isn't.  Poll doesn't make sense in this circumstances, but best to close
    the hole.
* ad5933
  - Change the marked buffer mode to a software buffer as the meaning of
    the hardware buffer label has long since changed and this uses a front
    end software buffer anyway.
* ad7192
  - Fix the fact the external clock frequency was only set when using the
    internal clock which was less than helpful.
* adis_lib
  - Initialize the trigger before requesting the interrupt.  Some newer
    parts can power up with interrupt generation enabled so ordering now
    matters.
* aspeed-adc
  - Fix an errror handling path as labels and general ordering were wrong.
* srf08
  - Fix a link error due to undefined devm_iio_triggered_buffer_setup.
* stm32-adc
  - Fix error handling unwind squence in stm32h7_adc_enable.
parents 6d79bd5b 4cd140bd
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -243,7 +243,7 @@ static int aspeed_adc_probe(struct platform_device *pdev)
					 ASPEED_ADC_INIT_POLLING_TIME,
					 ASPEED_ADC_INIT_POLLING_TIME,
					 ASPEED_ADC_INIT_TIMEOUT);
					 ASPEED_ADC_INIT_TIMEOUT);
		if (ret)
		if (ret)
			goto scaler_error;
			goto poll_timeout_error;
	}
	}


	/* Start all channels in normal mode. */
	/* Start all channels in normal mode. */
@@ -274,9 +274,10 @@ static int aspeed_adc_probe(struct platform_device *pdev)
	writel(ASPEED_OPERATION_MODE_POWER_DOWN,
	writel(ASPEED_OPERATION_MODE_POWER_DOWN,
		data->base + ASPEED_REG_ENGINE_CONTROL);
		data->base + ASPEED_REG_ENGINE_CONTROL);
	clk_disable_unprepare(data->clk_scaler->clk);
	clk_disable_unprepare(data->clk_scaler->clk);
reset_error:
	reset_control_assert(data->rst);
clk_enable_error:
clk_enable_error:
poll_timeout_error:
	reset_control_assert(data->rst);
reset_error:
	clk_hw_unregister_divider(data->clk_scaler);
	clk_hw_unregister_divider(data->clk_scaler);
scaler_error:
scaler_error:
	clk_hw_unregister_divider(data->clk_prescaler);
	clk_hw_unregister_divider(data->clk_prescaler);
+4 −3
Original line number Original line Diff line number Diff line
@@ -722,8 +722,6 @@ static int stm32h7_adc_enable(struct stm32_adc *adc)
	int ret;
	int ret;
	u32 val;
	u32 val;


	/* Clear ADRDY by writing one, then enable ADC */
	stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);
	stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);
	stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);


	/* Poll for ADRDY to be set (after adc startup time) */
	/* Poll for ADRDY to be set (after adc startup time) */
@@ -731,8 +729,11 @@ static int stm32h7_adc_enable(struct stm32_adc *adc)
					   val & STM32H7_ADRDY,
					   val & STM32H7_ADRDY,
					   100, STM32_ADC_TIMEOUT_US);
					   100, STM32_ADC_TIMEOUT_US);
	if (ret) {
	if (ret) {
		stm32_adc_clr_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);
		stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADDIS);
		dev_err(&indio_dev->dev, "Failed to enable ADC\n");
		dev_err(&indio_dev->dev, "Failed to enable ADC\n");
	} else {
		/* Clear ADRDY by writing one */
		stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);
	}
	}


	return ret;
	return ret;
+4 −3
Original line number Original line Diff line number Diff line
@@ -46,6 +46,10 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
	if (adis->trig == NULL)
	if (adis->trig == NULL)
		return -ENOMEM;
		return -ENOMEM;


	adis->trig->dev.parent = &adis->spi->dev;
	adis->trig->ops = &adis_trigger_ops;
	iio_trigger_set_drvdata(adis->trig, adis);

	ret = request_irq(adis->spi->irq,
	ret = request_irq(adis->spi->irq,
			  &iio_trigger_generic_data_rdy_poll,
			  &iio_trigger_generic_data_rdy_poll,
			  IRQF_TRIGGER_RISING,
			  IRQF_TRIGGER_RISING,
@@ -54,9 +58,6 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
	if (ret)
	if (ret)
		goto error_free_trig;
		goto error_free_trig;


	adis->trig->dev.parent = &adis->spi->dev;
	adis->trig->ops = &adis_trigger_ops;
	iio_trigger_set_drvdata(adis->trig, adis);
	ret = iio_trigger_register(adis->trig);
	ret = iio_trigger_register(adis->trig);


	indio_dev->trig = iio_trigger_get(adis->trig);
	indio_dev->trig = iio_trigger_get(adis->trig);
+1 −1
Original line number Original line Diff line number Diff line
@@ -175,7 +175,7 @@ __poll_t iio_buffer_poll(struct file *filp,
	struct iio_dev *indio_dev = filp->private_data;
	struct iio_dev *indio_dev = filp->private_data;
	struct iio_buffer *rb = indio_dev->buffer;
	struct iio_buffer *rb = indio_dev->buffer;


	if (!indio_dev->info)
	if (!indio_dev->info || rb == NULL)
		return 0;
		return 0;


	poll_wait(filp, &rb->pollq, wait);
	poll_wait(filp, &rb->pollq, wait);
+2 −0
Original line number Original line Diff line number Diff line
@@ -68,6 +68,8 @@ config SX9500


config SRF08
config SRF08
	tristate "Devantech SRF02/SRF08/SRF10 ultrasonic ranger sensor"
	tristate "Devantech SRF02/SRF08/SRF10 ultrasonic ranger sensor"
	select IIO_BUFFER
	select IIO_TRIGGERED_BUFFER
	depends on I2C
	depends on I2C
	help
	help
	  Say Y here to build a driver for Devantech SRF02/SRF08/SRF10
	  Say Y here to build a driver for Devantech SRF02/SRF08/SRF10
Loading