74
74
/**
75
75
* struct ad9832_state - driver instance specific data
76
76
* @spi: spi_device
77
- * @avdd: supply regulator for the analog section
78
- * @dvdd: supply regulator for the digital section
79
77
* @mclk: external master clock
80
78
* @ctrl_fp: cached frequency/phase control word
81
79
* @ctrl_ss: cached sync/selsrc control word
94
92
95
93
struct ad9832_state {
96
94
struct spi_device * spi ;
97
- struct regulator * avdd ;
98
- struct regulator * dvdd ;
99
95
struct clk * mclk ;
100
96
unsigned short ctrl_fp ;
101
97
unsigned short ctrl_ss ;
@@ -297,11 +293,6 @@ static const struct iio_info ad9832_info = {
297
293
.attrs = & ad9832_attribute_group ,
298
294
};
299
295
300
- static void ad9832_reg_disable (void * reg )
301
- {
302
- regulator_disable (reg );
303
- }
304
-
305
296
static int ad9832_probe (struct spi_device * spi )
306
297
{
307
298
struct ad9832_platform_data * pdata = dev_get_platdata (& spi -> dev );
@@ -320,33 +311,13 @@ static int ad9832_probe(struct spi_device *spi)
320
311
321
312
st = iio_priv (indio_dev );
322
313
323
- st -> avdd = devm_regulator_get (& spi -> dev , "avdd" );
324
- if (IS_ERR (st -> avdd ))
325
- return PTR_ERR (st -> avdd );
326
-
327
- ret = regulator_enable (st -> avdd );
328
- if (ret ) {
329
- dev_err (& spi -> dev , "Failed to enable specified AVDD supply\n" );
330
- return ret ;
331
- }
332
-
333
- ret = devm_add_action_or_reset (& spi -> dev , ad9832_reg_disable , st -> avdd );
314
+ ret = devm_regulator_get_enable (& spi -> dev , "avdd" );
334
315
if (ret )
335
- return ret ;
336
-
337
- st -> dvdd = devm_regulator_get (& spi -> dev , "dvdd" );
338
- if (IS_ERR (st -> dvdd ))
339
- return PTR_ERR (st -> dvdd );
316
+ return dev_err_probe (& spi -> dev , ret , "failed to enable specified AVDD voltage\n" );
340
317
341
- ret = regulator_enable (st -> dvdd );
342
- if (ret ) {
343
- dev_err (& spi -> dev , "Failed to enable specified DVDD supply\n" );
344
- return ret ;
345
- }
346
-
347
- ret = devm_add_action_or_reset (& spi -> dev , ad9832_reg_disable , st -> dvdd );
318
+ ret = devm_regulator_get_enable (& spi -> dev , "dvdd" );
348
319
if (ret )
349
- return ret ;
320
+ return dev_err_probe ( & spi -> dev , ret , "Failed to enable specified DVDD supply\n" ) ;
350
321
351
322
st -> mclk = devm_clk_get_enabled (& spi -> dev , "mclk" );
352
323
if (IS_ERR (st -> mclk ))
0 commit comments