diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-27 11:13:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-27 11:13:08 +0200 |
commit | 85078fd095470fb85772deb62466bf69a001c098 (patch) | |
tree | be3bb178944c38d78f81fe328f71670453805092 /drivers/iio/adc | |
parent | 7706abf5a0eb4c082897fd2a17a0ac0898e39666 (diff) | |
parent | f98677cf315e61403aefef72b056c643dd152c54 (diff) | |
download | linux-85078fd095470fb85772deb62466bf69a001c098.tar.gz linux-85078fd095470fb85772deb62466bf69a001c098.tar.bz2 linux-85078fd095470fb85772deb62466bf69a001c098.zip |
Merge tag 'iio-for-4.15c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Third set of new device support, cleanups and features for IIO in the 4.15 cycle
New device support
* ti-dac082s085 dac
- new driver supporting 8, 10 and 12 bit TI DACs with 2 and 4 channels:
DAC082S085, DAC102S085, DAC122S085, DAC104s085 and DAC124S085.
Minor features and cleanps
* adc12138
- make array ch_to_mux static for small object code size reduction.
* sun4i-gpadc
- use of_device_get_match_data rather than opencoding it.
* stm32 trigger
- add tim15 tigger on STM32H7
- check clock rate to avoid potential division by zero
* tsl2x7x staging cleanups.
- move *_thresh_period to being created by IIO core.
- remove unused tsl2x7x_parse_result structure.
- sort includes
- drop a repeat iio_dev forward definition
- fix some code alignment of defines.
- use IIO_CONST_ATTR for constant string attribute
- drop some unnecessary parentheses
- fix various alignment with parenthese
- rename power defines for readability reasons
- fix a missaligned break statement
- Tidy up function definitions so they fit on a single line.
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/stm32-adc-core.c | 13 | ||||
-rw-r--r-- | drivers/iio/adc/stm32-adc.c | 1 | ||||
-rw-r--r-- | drivers/iio/adc/sun4i-gpadc-iio.c | 6 | ||||
-rw-r--r-- | drivers/iio/adc/ti-adc12138.c | 2 |
4 files changed, 17 insertions, 5 deletions
diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index 804198eb0eef..6aefef99f935 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -139,6 +139,11 @@ static int stm32f4_adc_clk_sel(struct platform_device *pdev, } rate = clk_get_rate(priv->aclk); + if (!rate) { + dev_err(&pdev->dev, "Invalid clock rate: 0\n"); + return -EINVAL; + } + for (i = 0; i < ARRAY_SIZE(stm32f4_pclk_div); i++) { if ((rate / stm32f4_pclk_div[i]) <= STM32F4_ADC_MAX_CLK_RATE) break; @@ -216,6 +221,10 @@ static int stm32h7_adc_clk_sel(struct platform_device *pdev, * From spec: PLL output musn't exceed max rate */ rate = clk_get_rate(priv->aclk); + if (!rate) { + dev_err(&pdev->dev, "Invalid adc clock rate: 0\n"); + return -EINVAL; + } for (i = 0; i < ARRAY_SIZE(stm32h7_adc_ckmodes_spec); i++) { ckmode = stm32h7_adc_ckmodes_spec[i].ckmode; @@ -232,6 +241,10 @@ static int stm32h7_adc_clk_sel(struct platform_device *pdev, /* Synchronous clock modes (e.g. ckmode is 1, 2 or 3) */ rate = clk_get_rate(priv->bclk); + if (!rate) { + dev_err(&pdev->dev, "Invalid bus clock rate: 0\n"); + return -EINVAL; + } for (i = 0; i < ARRAY_SIZE(stm32h7_adc_ckmodes_spec); i++) { ckmode = stm32h7_adc_ckmodes_spec[i].ckmode; diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 8b7c24780a8a..c9d96f935dba 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -531,6 +531,7 @@ static struct stm32_adc_trig_info stm32h7_adc_trigs[] = { { TIM2_TRGO, STM32_EXT11 }, { TIM4_TRGO, STM32_EXT12 }, { TIM6_TRGO, STM32_EXT13 }, + { TIM15_TRGO, STM32_EXT14 }, { TIM3_CH4, STM32_EXT15 }, { LPTIM1_OUT, STM32_EXT18 }, { LPTIM2_OUT, STM32_EXT19 }, diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index c4e70f1cad79..04d7147e0110 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -501,17 +501,15 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, struct iio_dev *indio_dev) { struct sun4i_gpadc_iio *info = iio_priv(indio_dev); - const struct of_device_id *of_dev; struct resource *mem; void __iomem *base; int ret; - of_dev = of_match_device(sun4i_gpadc_of_id, &pdev->dev); - if (!of_dev) + info->data = of_device_get_match_data(&pdev->dev); + if (!info->data) return -ENODEV; info->no_irq = true; - info->data = (struct gpadc_data *)of_dev->data; indio_dev->num_channels = ARRAY_SIZE(sun8i_a33_gpadc_channels); indio_dev->channels = sun8i_a33_gpadc_channels; diff --git a/drivers/iio/adc/ti-adc12138.c b/drivers/iio/adc/ti-adc12138.c index bf890244789a..703d68ae96b7 100644 --- a/drivers/iio/adc/ti-adc12138.c +++ b/drivers/iio/adc/ti-adc12138.c @@ -164,7 +164,7 @@ static int __adc12138_start_conv(struct adc12138 *adc, void *data, int len) { - const u8 ch_to_mux[] = { 0, 4, 1, 5, 2, 6, 3, 7 }; + static const u8 ch_to_mux[] = { 0, 4, 1, 5, 2, 6, 3, 7 }; u8 mode = (ch_to_mux[channel->channel] << 4) | (channel->differential ? 0 : 0x80); |