diff options
author | Mark Brown <broonie@kernel.org> | 2018-01-16 15:21:19 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-01-16 15:21:19 +0000 |
commit | d84b4c7c706f4e226b038d120d6832d89bc59ac7 (patch) | |
tree | a24ea7a4fcb64148a99597e987f33b91d1422939 | |
parent | 2353758bc2d427809f5feb15f046ded91c60afef (diff) | |
parent | 1175d0f9f4031ce02845f6f843f58a9caaee7817 (diff) |
Merge branch 'topic/iio' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-st-dfsdm
-rw-r--r-- | drivers/iio/adc/stm32-dfsdm-adc.c | 17 | ||||
-rw-r--r-- | drivers/iio/adc/stm32-dfsdm-core.c | 7 |
2 files changed, 4 insertions, 20 deletions
diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c index e628d04d5c77..daa026d6a94f 100644 --- a/drivers/iio/adc/stm32-dfsdm-adc.c +++ b/drivers/iio/adc/stm32-dfsdm-adc.c @@ -1087,29 +1087,18 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; const struct stm32_dfsdm_dev_data *dev_data; struct iio_dev *iio; - const struct of_device_id *of_id; char *name; int ret, irq, val; - of_id = of_match_node(stm32_dfsdm_adc_match, np); - if (!of_id->data) { - dev_err(&pdev->dev, "Data associated to device is missing\n"); - return -EINVAL; - } - - dev_data = (const struct stm32_dfsdm_dev_data *)of_id->data; + dev_data = of_device_get_match_data(dev); iio = devm_iio_device_alloc(dev, sizeof(*adc)); - if (IS_ERR(iio)) { + if (!iio) { dev_err(dev, "%s: Failed to allocate IIO\n", __func__); - return PTR_ERR(iio); + return -ENOMEM; } adc = iio_priv(iio); - if (IS_ERR(adc)) { - dev_err(dev, "%s: Failed to allocate ADC\n", __func__); - return PTR_ERR(adc); - } adc->dfsdm = dev_get_drvdata(dev->parent); iio->dev.parent = dev; diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c index 6cd655f8239b..84277bcc465f 100644 --- a/drivers/iio/adc/stm32-dfsdm-core.c +++ b/drivers/iio/adc/stm32-dfsdm-core.c @@ -253,13 +253,8 @@ static int stm32_dfsdm_probe(struct platform_device *pdev) priv->pdev = pdev; - of_id = of_match_node(stm32_dfsdm_of_match, pdev->dev.of_node); - if (!of_id->data) { - dev_err(&pdev->dev, "Data associated to device is missing\n"); - return -EINVAL; - } + dev_data = of_device_get_match_data(&pdev->dev); - dev_data = (const struct stm32_dfsdm_dev_data *)of_id->data; dfsdm = &priv->dfsdm; dfsdm->fl_list = devm_kcalloc(&pdev->dev, dev_data->num_filters, sizeof(*dfsdm->fl_list), GFP_KERNEL); |