| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * IIO DAC emulation driver using a digital potentiometer |
|---|
| 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 | /* |
|---|
| .. | .. |
|---|
| 81 | 78 | */ |
|---|
| 82 | 79 | *val2 = 1; |
|---|
| 83 | 80 | ret = IIO_VAL_FRACTIONAL; |
|---|
| 84 | | - /* ...and fall through. */ |
|---|
| 81 | + /* ...and fall through. Say it again for GCC. */ |
|---|
| 82 | + fallthrough; |
|---|
| 85 | 83 | case IIO_VAL_FRACTIONAL: |
|---|
| 86 | 84 | *val *= regulator_get_voltage(dac->vref) / 1000; |
|---|
| 87 | 85 | *val2 *= dac->max_ohms; |
|---|
| .. | .. |
|---|
| 180 | 178 | dac = iio_priv(indio_dev); |
|---|
| 181 | 179 | |
|---|
| 182 | 180 | indio_dev->name = dev_name(dev); |
|---|
| 183 | | - indio_dev->dev.parent = dev; |
|---|
| 184 | 181 | indio_dev->info = &dpot_dac_info; |
|---|
| 185 | 182 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 186 | 183 | indio_dev->channels = &dpot_dac_iio_channel; |
|---|
| 187 | 184 | indio_dev->num_channels = 1; |
|---|
| 188 | 185 | |
|---|
| 189 | 186 | dac->vref = devm_regulator_get(dev, "vref"); |
|---|
| 190 | | - if (IS_ERR(dac->vref)) { |
|---|
| 191 | | - if (PTR_ERR(dac->vref) != -EPROBE_DEFER) |
|---|
| 192 | | - dev_err(&pdev->dev, "failed to get vref regulator\n"); |
|---|
| 193 | | - return PTR_ERR(dac->vref); |
|---|
| 194 | | - } |
|---|
| 187 | + if (IS_ERR(dac->vref)) |
|---|
| 188 | + return dev_err_probe(&pdev->dev, PTR_ERR(dac->vref), |
|---|
| 189 | + "failed to get vref regulator\n"); |
|---|
| 195 | 190 | |
|---|
| 196 | 191 | dac->dpot = devm_iio_channel_get(dev, "dpot"); |
|---|
| 197 | | - if (IS_ERR(dac->dpot)) { |
|---|
| 198 | | - if (PTR_ERR(dac->dpot) != -EPROBE_DEFER) |
|---|
| 199 | | - dev_err(dev, "failed to get dpot input channel\n"); |
|---|
| 200 | | - return PTR_ERR(dac->dpot); |
|---|
| 201 | | - } |
|---|
| 192 | + if (IS_ERR(dac->dpot)) |
|---|
| 193 | + return dev_err_probe(&pdev->dev, PTR_ERR(dac->dpot), |
|---|
| 194 | + "failed to get dpot input channel\n"); |
|---|
| 202 | 195 | |
|---|
| 203 | 196 | ret = iio_get_channel_type(dac->dpot, &type); |
|---|
| 204 | 197 | if (ret < 0) |
|---|