[PATCH v2 2/2] iio: adc: meson: improve error logging at probe stage

George Stark posted 2 patches 2 years, 6 months ago
[PATCH v2 2/2] iio: adc: meson: improve error logging at probe stage
Posted by George Stark 2 years, 6 months ago
Add log messages for errors that may occur at probe stage

Signed-off-by: George Stark <gnstark@sberdevices.ru>
---
 drivers/iio/adc/meson_saradc.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 8397a5347f32..11b10459a028 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1046,8 +1046,10 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev)
 	u32 regval;
 
 	ret = meson_sar_adc_lock(indio_dev);
-	if (ret)
+	if (ret) {
+		dev_err(dev, "failed to lock adc\n");
 		goto err_lock;
+	}
 
 	ret = regulator_enable(priv->vref);
 	if (ret < 0) {
@@ -1355,15 +1357,15 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 
 	priv->regmap = devm_regmap_init_mmio(dev, base, priv->param->regmap_config);
 	if (IS_ERR(priv->regmap))
-		return PTR_ERR(priv->regmap);
+		return dev_err_probe(dev, PTR_ERR(priv->regmap), "failed to init regmap\n");
 
 	irq = irq_of_parse_and_map(dev->of_node, 0);
 	if (!irq)
-		return -EINVAL;
+		return dev_err_probe(dev, -EINVAL, "failed to get irq\n");
 
 	ret = devm_request_irq(dev, irq, meson_sar_adc_irq, IRQF_SHARED, dev_name(dev), indio_dev);
 	if (ret)
-		return ret;
+		return dev_err_probe(dev, ret, "failed to request irq\n");
 
 	priv->clkin = devm_clk_get(dev, "clkin");
 	if (IS_ERR(priv->clkin))
@@ -1385,7 +1387,7 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 	if (!priv->adc_clk) {
 		ret = meson_sar_adc_clk_init(indio_dev, base);
 		if (ret)
-			return ret;
+			return dev_err_probe(dev, ret, "failed to init internal clk\n");
 	}
 
 	priv->vref = devm_regulator_get(dev, "vref");
@@ -1427,8 +1429,10 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, indio_dev);
 
 	ret = iio_device_register(indio_dev);
-	if (ret)
+	if (ret) {
+		dev_err_probe(dev, ret, "failed to register iio device\n");
 		goto err_hw;
+	}
 
 	return 0;
 
-- 
2.38.4
Re: [PATCH v2 2/2] iio: adc: meson: improve error logging at probe stage
Posted by Andy Shevchenko 2 years, 6 months ago
On Fri, Jul 21, 2023 at 01:23:09PM +0300, George Stark wrote:
> Add log messages for errors that may occur at probe stage

the probe

stage.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v2 2/2] iio: adc: meson: improve error logging at probe stage
Posted by Jonathan Cameron 2 years, 6 months ago
On Fri, 21 Jul 2023 13:43:51 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Fri, Jul 21, 2023 at 01:23:09PM +0300, George Stark wrote:
> > Add log messages for errors that may occur at probe stage  
> 
> the probe

British English - excellent ! :) (I argue this one far too often in
specification committees :)


> 
> stage.
> 

I can tidy this up, but the patch will be a while anyway given the fix
needs to work it's way into the upstream for my togreg branch (and I need
to have send a pull request for togreg as well).

Jonathan
Re: [PATCH v2 2/2] iio: adc: meson: improve error logging at probe stage
Posted by George Stark 2 years, 4 months ago
Hello Jonathan

It seems like you haven't had time for this patch yet. Should I fix it 
myself or just be more patient?

On 7/22/23 20:15, Jonathan Cameron wrote:
> On Fri, 21 Jul 2023 13:43:51 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
>> On Fri, Jul 21, 2023 at 01:23:09PM +0300, George Stark wrote:
>>> Add log messages for errors that may occur at probe stage
>>
>> the probe
> 
> British English - excellent ! :) (I argue this one far too often in
> specification committees :)
> 
> 
>>
>> stage.
>>
> 
> I can tidy this up, but the patch will be a while anyway given the fix
> needs to work it's way into the upstream for my togreg branch (and I need
> to have send a pull request for togreg as well).
> 
> Jonathan
> 

-- 
Best regards
George
Re: [PATCH v2 2/2] iio: adc: meson: improve error logging at probe stage
Posted by Jonathan Cameron 2 years, 4 months ago
On Tue, 3 Oct 2023 15:47:23 +0300
George Stark <gnstark@sberdevices.ru> wrote:

> Hello Jonathan
> 
> It seems like you haven't had time for this patch yet. Should I fix it 
> myself or just be more patient?
I've been exceptionally slow on this one.  Was still sitting in patchwork
but I'd failed to notice the dependency was now upstream.

Applied to the togreg branch of iio.git and I'll push that out initially
as testing later today (I have to do a rebase to fix up an issue
0-day caught on previous push before I do).

Thanks for the poke and sorry it was necessary!

Jonathan

> 
> On 7/22/23 20:15, Jonathan Cameron wrote:
> > On Fri, 21 Jul 2023 13:43:51 +0300
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >   
> >> On Fri, Jul 21, 2023 at 01:23:09PM +0300, George Stark wrote:  
> >>> Add log messages for errors that may occur at probe stage  
> >>
> >> the probe  
> > 
> > British English - excellent ! :) (I argue this one far too often in
> > specification committees :)
> > 
> >   
> >>
> >> stage.
> >>  
> > 
> > I can tidy this up, but the patch will be a while anyway given the fix
> > needs to work it's way into the upstream for my togreg branch (and I need
> > to have send a pull request for togreg as well).
> > 
> > Jonathan
> >   
>