Commit 55dc2952 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Jonathan Cameron

iio: adc: envelope-detector: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarPeter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20200829064726.26268-3-krzk@kernel.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent c8b9a023
...@@ -348,11 +348,9 @@ static int envelope_detector_probe(struct platform_device *pdev) ...@@ -348,11 +348,9 @@ static int envelope_detector_probe(struct platform_device *pdev)
indio_dev->num_channels = 1; indio_dev->num_channels = 1;
env->dac = devm_iio_channel_get(dev, "dac"); env->dac = devm_iio_channel_get(dev, "dac");
if (IS_ERR(env->dac)) { if (IS_ERR(env->dac))
if (PTR_ERR(env->dac) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(env->dac),
dev_err(dev, "failed to get dac input channel\n"); "failed to get dac input channel\n");
return PTR_ERR(env->dac);
}
env->comp_irq = platform_get_irq_byname(pdev, "comp"); env->comp_irq = platform_get_irq_byname(pdev, "comp");
if (env->comp_irq < 0) if (env->comp_irq < 0)
...@@ -360,11 +358,9 @@ static int envelope_detector_probe(struct platform_device *pdev) ...@@ -360,11 +358,9 @@ static int envelope_detector_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, env->comp_irq, envelope_detector_comp_isr, ret = devm_request_irq(dev, env->comp_irq, envelope_detector_comp_isr,
0, "envelope-detector", env); 0, "envelope-detector", env);
if (ret) { if (ret)
if (ret != -EPROBE_DEFER) return dev_err_probe(dev, ret, "failed to request interrupt\n");
dev_err(dev, "failed to request interrupt\n");
return ret;
}
env->comp_irq_trigger = irq_get_trigger_type(env->comp_irq); env->comp_irq_trigger = irq_get_trigger_type(env->comp_irq);
if (env->comp_irq_trigger & IRQF_TRIGGER_RISING) if (env->comp_irq_trigger & IRQF_TRIGGER_RISING)
env->comp_irq_trigger_inv |= IRQF_TRIGGER_FALLING; env->comp_irq_trigger_inv |= IRQF_TRIGGER_FALLING;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment