Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Umang Jain <umang.jain@ideasonboard.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>,
	linux-media@vger.kernel.org, dave.stevenson@raspberrypi.com,
	sakari.ailus@linux.intel.com,
	Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: Re: [PATCH] media: i2c: imx219: Use dev_err_probe on probe
Date: Thu, 28 Mar 2024 13:09:13 +0200	[thread overview]
Message-ID: <20240328110913.GC26064@pendragon.ideasonboard.com> (raw)
In-Reply-To: <d5d210d9-b638-4790-a9fe-0816462ba58a@ideasonboard.com>

Sakari, there's a question for you below.

On Thu, Mar 28, 2024 at 04:29:41PM +0530, Umang Jain wrote:
> On 28/03/24 4:23 pm, Laurent Pinchart wrote:
> > On Fri, Mar 15, 2024 at 12:13:15PM +0530, Umang Jain wrote:
> >> On 14/03/24 8:51 pm, Laurent Pinchart wrote:
> >>> On Thu, Mar 14, 2024 at 06:51:04PM +0530, Umang Jain wrote:
> >>>> On 11/03/24 5:05 pm, Tommaso Merciai wrote:
> >>>>> On Mon, Mar 11, 2024 at 02:30:42PM +0530, Umang Jain wrote:
> >>>>>> Drop dev_err() and use the dev_err_probe() helper on probe path.
> >>>>>>
> >>>>>> No functional changes intended.
> >>>>>>
> >>>>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> >>>>>> ---
> >>>>>>     drivers/media/i2c/imx219.c | 64 +++++++++++++++++++-------------------
> >>>>>>     1 file changed, 32 insertions(+), 32 deletions(-)
> >>>>>>
> >>>>>> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> >>>>>> index e17ef2e9d9d0..acd27e2ef849 100644
> >>>>>> --- a/drivers/media/i2c/imx219.c
> >>>>>> +++ b/drivers/media/i2c/imx219.c
> >>>>>> @@ -551,8 +551,9 @@ static int imx219_init_controls(struct imx219 *imx219)
> >>>>>>     
> >>>>>>     	if (ctrl_hdlr->error) {
> >>>>>>     		ret = ctrl_hdlr->error;
> >>>>>> -		dev_err(&client->dev, "%s control init failed (%d)\n",
> >>>>>> -			__func__, ret);
> >>>>>> +		dev_err_probe(&client->dev, ret,
> >>>>>> +			      "%s control init failed\n",
> >>>>>> +			      __func__);
> >>> ctrl_hdlr->error can never be -EPROBE_DEFER, is dev_err_probe() really
> >>> useful here ?
> >> is dev_err_probe() really /only/ about -EPROBE_DEFER ?  or all probe()
> >> errors?
> >>
> >> The documentation is explicitly stating for dev_Err_probe()
> >>
> >> ```
> >>    * Note that it is deemed acceptable to use this function for error
> >>    * prints during probe even if the @err is known to never be -EPROBE_DEFER.
> >>    * The benefit compared to a normal dev_err() is the standardized format
> >>    * of the error code and the fact that the error code is returned.
> >>    *
> >>
> >> ```
> > As in so many cases, it's partly a matter of taste :-) When it comes to
> > changes such as
> >
> > -		dev_err(dev, "xclk frequency not supported: %d Hz\n",
> > -			imx219->xclk_freq);
> > -		return -EINVAL;
> > +		return dev_err_probe(dev, -EINVAL,
> > +				     "xclk frequency not supported: %d Hz\n",
> > +				     imx219->xclk_freq);
> >
> > I find the resulting less readable. The indentation is higher, you have
> > to look at the parameters to dev_err_probe() to see what is returned
> > (compared to reading "return -EINVAL"), and adding the error code to the
> > printed message also makes the kernel log less as the error code really
> > doesn't need to be printed in this case.
> 
> Indeed, a matter of taste ...
> 
> On IMX283 driver, I got the feedback that all probe errors should go via 
> dev_err_probe()
> 
> "Make all messages in ->probe() stage to use the same pattern." [1]
> 
> For IMX219, (since it's the most appropriate reference driver from 
> framework PoV), I saw that it is not logging through dev_err_probe(), 
> and in such cases hence tried to align with [1]

I'd say we should have common guidelines for all sensor drivers. As
Sakari is the maintainer here, he can be the judge too :-)

> [1] https://lore.kernel.org/all/CAHp75Vcvvadd6EeTWk2ZDrmtCQzWBV8rOoxNCotzYRRPwecaEA@mail.gmail.com/
>
> >>>>>>     		goto error;
> >>>>>>     	}
> >
> > [snip]

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-03-28 11:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11  9:00 [PATCH] media: i2c: imx219: Use dev_err_probe on probe Umang Jain
2024-03-11 11:35 ` Tommaso Merciai
2024-03-14 13:21   ` Umang Jain
2024-03-14 14:58     ` Tommaso Merciai
2024-03-15  6:38       ` Sakari Ailus
2024-03-14 15:21     ` Laurent Pinchart
2024-03-15  6:43       ` Umang Jain
2024-03-28 10:53         ` Laurent Pinchart
2024-03-28 10:59           ` Umang Jain
2024-03-28 11:09             ` Laurent Pinchart [this message]
2024-03-28 11:22               ` Umang Jain
2024-04-15  9:13               ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240328110913.GC26064@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomm.merciai@gmail.com \
    --cc=umang.jain@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox