| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for an envelope detector using a DAC and a comparator |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2016 Axentia Technologies AB |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Peter Rosin <peda@axentia.se> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | /* |
|---|
| .. | .. |
|---|
| 346 | 343 | INIT_DELAYED_WORK(&env->comp_timeout, envelope_detector_timeout); |
|---|
| 347 | 344 | |
|---|
| 348 | 345 | indio_dev->name = dev_name(dev); |
|---|
| 349 | | - indio_dev->dev.parent = dev; |
|---|
| 350 | | - indio_dev->dev.of_node = dev->of_node; |
|---|
| 351 | 346 | indio_dev->info = &envelope_detector_info; |
|---|
| 352 | 347 | indio_dev->channels = &envelope_detector_iio_channel; |
|---|
| 353 | 348 | indio_dev->num_channels = 1; |
|---|
| 354 | 349 | |
|---|
| 355 | 350 | env->dac = devm_iio_channel_get(dev, "dac"); |
|---|
| 356 | | - if (IS_ERR(env->dac)) { |
|---|
| 357 | | - if (PTR_ERR(env->dac) != -EPROBE_DEFER) |
|---|
| 358 | | - dev_err(dev, "failed to get dac input channel\n"); |
|---|
| 359 | | - return PTR_ERR(env->dac); |
|---|
| 360 | | - } |
|---|
| 351 | + if (IS_ERR(env->dac)) |
|---|
| 352 | + return dev_err_probe(dev, PTR_ERR(env->dac), |
|---|
| 353 | + "failed to get dac input channel\n"); |
|---|
| 361 | 354 | |
|---|
| 362 | 355 | env->comp_irq = platform_get_irq_byname(pdev, "comp"); |
|---|
| 363 | | - if (env->comp_irq < 0) { |
|---|
| 364 | | - if (env->comp_irq != -EPROBE_DEFER) |
|---|
| 365 | | - dev_err(dev, "failed to get compare interrupt\n"); |
|---|
| 356 | + if (env->comp_irq < 0) |
|---|
| 366 | 357 | return env->comp_irq; |
|---|
| 367 | | - } |
|---|
| 368 | 358 | |
|---|
| 369 | 359 | ret = devm_request_irq(dev, env->comp_irq, envelope_detector_comp_isr, |
|---|
| 370 | 360 | 0, "envelope-detector", env); |
|---|
| 371 | | - if (ret) { |
|---|
| 372 | | - if (ret != -EPROBE_DEFER) |
|---|
| 373 | | - dev_err(dev, "failed to request interrupt\n"); |
|---|
| 374 | | - return ret; |
|---|
| 375 | | - } |
|---|
| 361 | + if (ret) |
|---|
| 362 | + return dev_err_probe(dev, ret, "failed to request interrupt\n"); |
|---|
| 363 | + |
|---|
| 376 | 364 | env->comp_irq_trigger = irq_get_trigger_type(env->comp_irq); |
|---|
| 377 | 365 | if (env->comp_irq_trigger & IRQF_TRIGGER_RISING) |
|---|
| 378 | 366 | env->comp_irq_trigger_inv |= IRQF_TRIGGER_FALLING; |
|---|