diff options
author | Arnaud Pouliquen <arnaud.pouliquen@st.com> | 2018-01-15 11:57:39 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-01-15 21:50:21 +0300 |
commit | abaca806fd13afd069e04e883de8ec75924b0598 (patch) | |
tree | a5de7c5afe851a6086af5b67b0022006ed208b99 /drivers/iio/adc/stm32-dfsdm-core.c | |
parent | d5ff18bcd4b5e66396eab7e8271172157ee1253e (diff) | |
download | linux-abaca806fd13afd069e04e883de8ec75924b0598.tar.xz |
IIO: ADC: stm32-dfsdm: code optimization
Use of_device_get_match_data to optimize the source code.
No check is needed on dev_data as match table is defined in driver.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/iio/adc/stm32-dfsdm-core.c')
-rw-r--r-- | drivers/iio/adc/stm32-dfsdm-core.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c index 6cd655f8239b..6290332cfd3f 100644 --- a/drivers/iio/adc/stm32-dfsdm-core.c +++ b/drivers/iio/adc/stm32-dfsdm-core.c @@ -242,7 +242,6 @@ MODULE_DEVICE_TABLE(of, stm32_dfsdm_of_match); static int stm32_dfsdm_probe(struct platform_device *pdev) { struct dfsdm_priv *priv; - const struct of_device_id *of_id; const struct stm32_dfsdm_dev_data *dev_data; struct stm32_dfsdm *dfsdm; int ret; @@ -253,13 +252,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); |