iio: adc: meson-saradc: use of_device_get_match_data
This simplifies our _probe function by using of_device_get_match_data instead of open-coding it. No functional changes. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
3d9bf07a72
commit
234c64a290
|
@ -978,11 +978,11 @@ MODULE_DEVICE_TABLE(of, meson_sar_adc_of_match);
|
||||||
|
|
||||||
static int meson_sar_adc_probe(struct platform_device *pdev)
|
static int meson_sar_adc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
const struct meson_sar_adc_data *match_data;
|
||||||
struct meson_sar_adc_priv *priv;
|
struct meson_sar_adc_priv *priv;
|
||||||
struct iio_dev *indio_dev;
|
struct iio_dev *indio_dev;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
const struct of_device_id *match;
|
|
||||||
int irq, ret;
|
int irq, ret;
|
||||||
|
|
||||||
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
|
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
|
||||||
|
@ -994,13 +994,13 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
|
||||||
priv = iio_priv(indio_dev);
|
priv = iio_priv(indio_dev);
|
||||||
init_completion(&priv->done);
|
init_completion(&priv->done);
|
||||||
|
|
||||||
match = of_match_device(meson_sar_adc_of_match, &pdev->dev);
|
match_data = of_device_get_match_data(&pdev->dev);
|
||||||
if (!match) {
|
if (!match_data) {
|
||||||
dev_err(&pdev->dev, "failed to match device\n");
|
dev_err(&pdev->dev, "failed to get match data\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->data = match->data;
|
priv->data = match_data;
|
||||||
|
|
||||||
indio_dev->name = priv->data->name;
|
indio_dev->name = priv->data->name;
|
||||||
indio_dev->dev.parent = &pdev->dev;
|
indio_dev->dev.parent = &pdev->dev;
|
||||||
|
|
Loading…
Reference in a new issue