hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/iio/dac/dpot-dac.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * IIO DAC emulation driver using a digital potentiometer
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 /*
....@@ -81,7 +78,8 @@
8178 */
8279 *val2 = 1;
8380 ret = IIO_VAL_FRACTIONAL;
84
- /* ...and fall through. */
81
+ /* ...and fall through. Say it again for GCC. */
82
+ fallthrough;
8583 case IIO_VAL_FRACTIONAL:
8684 *val *= regulator_get_voltage(dac->vref) / 1000;
8785 *val2 *= dac->max_ohms;
....@@ -180,25 +178,20 @@
180178 dac = iio_priv(indio_dev);
181179
182180 indio_dev->name = dev_name(dev);
183
- indio_dev->dev.parent = dev;
184181 indio_dev->info = &dpot_dac_info;
185182 indio_dev->modes = INDIO_DIRECT_MODE;
186183 indio_dev->channels = &dpot_dac_iio_channel;
187184 indio_dev->num_channels = 1;
188185
189186 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");
195190
196191 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");
202195
203196 ret = iio_get_channel_type(dac->dpot, &type);
204197 if (ret < 0)