| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for the Diolan DLN-2 USB-ADC adapter |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2017 Jack Andersen |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 8 | | - * published by the Free Software Foundation, version 2. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 526 | 523 | u16 conflict; |
|---|
| 527 | 524 | unsigned int trigger_chan; |
|---|
| 528 | 525 | |
|---|
| 529 | | - ret = iio_triggered_buffer_postenable(indio_dev); |
|---|
| 530 | | - if (ret) |
|---|
| 531 | | - return ret; |
|---|
| 532 | | - |
|---|
| 533 | 526 | mutex_lock(&dln2->mutex); |
|---|
| 534 | 527 | |
|---|
| 535 | 528 | /* Enable ADC */ |
|---|
| .. | .. |
|---|
| 543 | 536 | (int)conflict); |
|---|
| 544 | 537 | ret = -EBUSY; |
|---|
| 545 | 538 | } |
|---|
| 546 | | - iio_triggered_buffer_predisable(indio_dev); |
|---|
| 547 | 539 | return ret; |
|---|
| 548 | 540 | } |
|---|
| 549 | 541 | |
|---|
| .. | .. |
|---|
| 557 | 549 | mutex_unlock(&dln2->mutex); |
|---|
| 558 | 550 | if (ret < 0) { |
|---|
| 559 | 551 | dev_dbg(&dln2->pdev->dev, "Problem in %s\n", __func__); |
|---|
| 560 | | - iio_triggered_buffer_predisable(indio_dev); |
|---|
| 561 | 552 | return ret; |
|---|
| 562 | 553 | } |
|---|
| 563 | 554 | } else { |
|---|
| .. | .. |
|---|
| 570 | 561 | |
|---|
| 571 | 562 | static int dln2_adc_triggered_buffer_predisable(struct iio_dev *indio_dev) |
|---|
| 572 | 563 | { |
|---|
| 573 | | - int ret, ret2; |
|---|
| 564 | + int ret; |
|---|
| 574 | 565 | struct dln2_adc *dln2 = iio_priv(indio_dev); |
|---|
| 575 | 566 | |
|---|
| 576 | 567 | mutex_lock(&dln2->mutex); |
|---|
| .. | .. |
|---|
| 587 | 578 | mutex_unlock(&dln2->mutex); |
|---|
| 588 | 579 | if (ret < 0) |
|---|
| 589 | 580 | dev_dbg(&dln2->pdev->dev, "Problem in %s\n", __func__); |
|---|
| 590 | | - |
|---|
| 591 | | - ret2 = iio_triggered_buffer_predisable(indio_dev); |
|---|
| 592 | | - if (ret == 0) |
|---|
| 593 | | - ret = ret2; |
|---|
| 594 | 581 | |
|---|
| 595 | 582 | return ret; |
|---|
| 596 | 583 | } |
|---|
| .. | .. |
|---|
| 654 | 641 | IIO_CHAN_SOFT_TIMESTAMP_ASSIGN(dln2->iio_channels[i], i); |
|---|
| 655 | 642 | |
|---|
| 656 | 643 | indio_dev->name = DLN2_ADC_MOD_NAME; |
|---|
| 657 | | - indio_dev->dev.parent = dev; |
|---|
| 658 | 644 | indio_dev->info = &dln2_adc_info; |
|---|
| 659 | 645 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 660 | 646 | indio_dev->channels = dln2->iio_channels; |
|---|