hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/iio/adc/envelope-detector.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Driver for an envelope detector using a DAC and a comparator
34 *
45 * Copyright (C) 2016 Axentia Technologies AB
56 *
67 * 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.
118 */
129
1310 /*
....@@ -346,33 +343,24 @@
346343 INIT_DELAYED_WORK(&env->comp_timeout, envelope_detector_timeout);
347344
348345 indio_dev->name = dev_name(dev);
349
- indio_dev->dev.parent = dev;
350
- indio_dev->dev.of_node = dev->of_node;
351346 indio_dev->info = &envelope_detector_info;
352347 indio_dev->channels = &envelope_detector_iio_channel;
353348 indio_dev->num_channels = 1;
354349
355350 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");
361354
362355 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)
366357 return env->comp_irq;
367
- }
368358
369359 ret = devm_request_irq(dev, env->comp_irq, envelope_detector_comp_isr,
370360 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
+
376364 env->comp_irq_trigger = irq_get_trigger_type(env->comp_irq);
377365 if (env->comp_irq_trigger & IRQF_TRIGGER_RISING)
378366 env->comp_irq_trigger_inv |= IRQF_TRIGGER_FALLING;