diff mbox series

[v3,2/6] iio: adc: meson_saradc: Align messages to be with physical device prefix

Message ID 20220603100004.70336-2-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/6] iio: adc: meson_saradc: Don't attach managed resource to IIO device object | expand

Commit Message

Andy Shevchenko June 3, 2022, 10 a.m. UTC
Align messages to be printed with the physical device prefix as it's done
everywhere else in this driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v3: new patch (inspired by previous change)
 drivers/iio/adc/meson_saradc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Jonathan Cameron June 3, 2022, 4:21 p.m. UTC | #1
On Fri,  3 Jun 2022 13:00:00 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Align messages to be printed with the physical device prefix as it's done
> everywhere else in this driver.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Here I'm fine with the use of the parent as can only happen after all
the setup is done, so it's obvious the parent will be assigned
(some might argue it is obvious in the previous patch, but I had to check
as I couldn't remember when we set it :)

Anyhow, LGTM. 
> ---
> v3: new patch (inspired by previous change)
>  drivers/iio/adc/meson_saradc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 4fe6b997cd03..658047370db0 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -345,6 +345,7 @@ static int meson_sar_adc_read_raw_sample(struct iio_dev *indio_dev,
>  					 int *val)
>  {
>  	struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
> +	struct device *dev = indio_dev->dev.parent;
>  	int regval, fifo_chan, fifo_val, count;
>  
>  	if (!wait_for_completion_timeout(&priv->done,
> @@ -353,16 +354,14 @@ static int meson_sar_adc_read_raw_sample(struct iio_dev *indio_dev,
>  
>  	count = meson_sar_adc_get_fifo_count(indio_dev);
>  	if (count != 1) {
> -		dev_err(&indio_dev->dev,
> -			"ADC FIFO has %d element(s) instead of one\n", count);
> +		dev_err(dev, "ADC FIFO has %d element(s) instead of one\n", count);
>  		return -EINVAL;
>  	}
>  
>  	regmap_read(priv->regmap, MESON_SAR_ADC_FIFO_RD, &regval);
>  	fifo_chan = FIELD_GET(MESON_SAR_ADC_FIFO_RD_CHAN_ID_MASK, regval);
>  	if (fifo_chan != chan->address) {
> -		dev_err(&indio_dev->dev,
> -			"ADC FIFO entry belongs to channel %d instead of %lu\n",
> +		dev_err(dev, "ADC FIFO entry belongs to channel %d instead of %lu\n",
>  			fifo_chan, chan->address);
>  		return -EINVAL;
>  	}
Andy Shevchenko June 3, 2022, 4:50 p.m. UTC | #2
On Fri, Jun 03, 2022 at 05:21:17PM +0100, Jonathan Cameron wrote:
> On Fri,  3 Jun 2022 13:00:00 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Align messages to be printed with the physical device prefix as it's done
> > everywhere else in this driver.

> Here I'm fine with the use of the parent as can only happen after all
> the setup is done, so it's obvious the parent will be assigned
> (some might argue it is obvious in the previous patch, but I had to check
> as I couldn't remember when we set it :)
> 
> Anyhow, LGTM. 

Thanks!

> > v3: new patch (inspired by previous change)
Martin Blumenstingl June 5, 2022, 9:52 p.m. UTC | #3
On Fri, Jun 3, 2022 at 12:00 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Align messages to be printed with the physical device prefix as it's done
> everywhere else in this driver.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
diff mbox series

Patch

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 4fe6b997cd03..658047370db0 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -345,6 +345,7 @@  static int meson_sar_adc_read_raw_sample(struct iio_dev *indio_dev,
 					 int *val)
 {
 	struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
+	struct device *dev = indio_dev->dev.parent;
 	int regval, fifo_chan, fifo_val, count;
 
 	if (!wait_for_completion_timeout(&priv->done,
@@ -353,16 +354,14 @@  static int meson_sar_adc_read_raw_sample(struct iio_dev *indio_dev,
 
 	count = meson_sar_adc_get_fifo_count(indio_dev);
 	if (count != 1) {
-		dev_err(&indio_dev->dev,
-			"ADC FIFO has %d element(s) instead of one\n", count);
+		dev_err(dev, "ADC FIFO has %d element(s) instead of one\n", count);
 		return -EINVAL;
 	}
 
 	regmap_read(priv->regmap, MESON_SAR_ADC_FIFO_RD, &regval);
 	fifo_chan = FIELD_GET(MESON_SAR_ADC_FIFO_RD_CHAN_ID_MASK, regval);
 	if (fifo_chan != chan->address) {
-		dev_err(&indio_dev->dev,
-			"ADC FIFO entry belongs to channel %d instead of %lu\n",
+		dev_err(dev, "ADC FIFO entry belongs to channel %d instead of %lu\n",
 			fifo_chan, chan->address);
 		return -EINVAL;
 	}