From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EED57D40A for ; Thu, 28 Mar 2024 11:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711624167; cv=none; b=RDRIy0kOoxJKU3FSkzveLAIoZHW668jB+MHzQrGx/3blNW+L+XuVwnOqS8+7loN8YKdxp84Plai8K4FLz+VntppcW7DXwsbdNjX1kdZ8x/Zu5VvoVtCdXVPkyeMpXXEB1r5zHBQR76oFC0rM0KFtodcnIFH2UC2J0xwR65Leko8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711624167; c=relaxed/simple; bh=fsKCJ0lFYf9rYHJ/xB4jJf66QZT6tQYp1b4vOH3sqhY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XKVSfHgtgcNrc0xelbiHSqwpsdFcpZHrJ8Fbzem3EeuPP15eqELLOe2AtBkW58HWy+XUJ5l2p5FBjcGFwhWBawEk1v8RyS/ggoOsZv1yIYnsS/VjvTmoQgDJskfW4r6arSCmyBv6A+60Lch5wV6e+tRMyIruQIoJjfk2fTurA50= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=uidxVQTm; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uidxVQTm" Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4B4ADE0C; Thu, 28 Mar 2024 12:08:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1711624130; bh=fsKCJ0lFYf9rYHJ/xB4jJf66QZT6tQYp1b4vOH3sqhY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uidxVQTmzu4s30ddzIkZqTYxvhZXHJO2gWosbHQmGsE3Ys14YXLKEk+bzNi+nAHqu 0tXy6LaKN8E/YDLmTVAYoyvC9swMPUNrkRefMymBrlT/yx0wGJY3MDCrFsfqmH629a g5tnDg+6VfOMmUYp6zlyw7+KZq9l0gwEA/3/11ck= Date: Thu, 28 Mar 2024 13:09:13 +0200 From: Laurent Pinchart To: Umang Jain Cc: Tommaso Merciai , linux-media@vger.kernel.org, dave.stevenson@raspberrypi.com, sakari.ailus@linux.intel.com, Kieran Bingham Subject: Re: [PATCH] media: i2c: imx219: Use dev_err_probe on probe Message-ID: <20240328110913.GC26064@pendragon.ideasonboard.com> References: <20240311090042.30280-1-umang.jain@ideasonboard.com> <20240314152147.GB2441@pendragon.ideasonboard.com> <7b3724aa-04ac-463c-834a-3902fae4b505@ideasonboard.com> <20240328105305.GB26064@pendragon.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 > >>>>>> --- > >>>>>> 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