> -----Original Message----- > From: Jonathan Cameron <jic23@xxxxxxxxxx> > Sent: Sunday, October 16, 2022 7:10 PM > To: linux-iio@xxxxxxxxxxxxxxx > Cc: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Subject: [PATCH 3/5] iio: adc: cc10001: Use devm_clk_get_enabled() to avoid > boilerplate. > > [External] > > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > As this driver just enables clock in probe() and disables in remove() > we can use this new function to replace boilerplate and simplify > error paths. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > --- > drivers/iio/adc/cc10001_adc.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c > index 4f42ceb40ded..332f0e06369f 100644 > --- a/drivers/iio/adc/cc10001_adc.c > +++ b/drivers/iio/adc/cc10001_adc.c > @@ -352,23 +352,16 @@ static int cc10001_adc_probe(struct > platform_device *pdev) > if (IS_ERR(adc_dev->reg_base)) > return PTR_ERR(adc_dev->reg_base); > > - adc_dev->adc_clk = devm_clk_get(dev, "adc"); > + adc_dev->adc_clk = devm_clk_get_enabled(dev, "adc"); > if (IS_ERR(adc_dev->adc_clk)) { > dev_err(dev, "failed to get the clock\n"); > return PTR_ERR(adc_dev->adc_clk); > } > I guess we could also tweak the err() message as we loose "failed to enable the clock"... - Nuno Sá