linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: media: atomisp: replace pr_info() by dev_info()
@ 2021-04-22 10:30 Deepak R Varma
  2021-04-22 13:43 ` Fabio Aiuto
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Deepak R Varma @ 2021-04-22 10:30 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman
  Cc: linux-media, linux-staging, linux-kernel, mh12gx2825, drv

It is recommended to use driver model diagnostic macros dev_*() instead
of pr_*() since the former ensures that the log messages are always
associated with the corresponding device and driver.

Suggested-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
---

Note: There are few more pr_into() calls that I have not replaced since
they are very basic (entry and exit) and temporary. They can be removed 
if the APIs are fully tested. See this example:
	pr_info("%s S\n", __func__);

Let me know if I should remove them and resubmit this patch.


 .../media/atomisp/i2c/atomisp-gc0310.c        | 30 +++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index 7e4e123fdb52..27153ec6f65e 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -300,7 +300,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
 	/* pixel clock calculattion */
 	dev->vt_pix_clk_freq_mhz = 14400000; // 16.8MHz
 	buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz;
-	pr_info("vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
+	dev_info(&client->dev, "vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
 
 	/* get integration time */
 	buf->coarse_integration_time_min = GC0310_COARSE_INTG_TIME_MIN;
@@ -326,7 +326,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
 	if (ret)
 		return ret;
 	buf->crop_horizontal_start = val | (reg_val & 0xFF);
-	pr_info("crop_horizontal_start=%d\n", buf->crop_horizontal_start);
+	dev_info(&client->dev, "crop_horizontal_start=%d\n", buf->crop_horizontal_start);
 
 	/* Getting crop_vertical_start */
 	ret =  gc0310_read_reg(client, GC0310_8BIT,
@@ -339,7 +339,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
 	if (ret)
 		return ret;
 	buf->crop_vertical_start = val | (reg_val & 0xFF);
-	pr_info("crop_vertical_start=%d\n", buf->crop_vertical_start);
+	dev_info(&client->dev, "crop_vertical_start=%d\n", buf->crop_vertical_start);
 
 	/* Getting output_width */
 	ret = gc0310_read_reg(client, GC0310_8BIT,
@@ -352,7 +352,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
 	if (ret)
 		return ret;
 	buf->output_width = val | (reg_val & 0xFF);
-	pr_info("output_width=%d\n", buf->output_width);
+	dev_info(&client->dev, "output_width=%d\n", buf->output_width);
 
 	/* Getting output_height */
 	ret = gc0310_read_reg(client, GC0310_8BIT,
@@ -365,12 +365,12 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
 	if (ret)
 		return ret;
 	buf->output_height = val | (reg_val & 0xFF);
-	pr_info("output_height=%d\n", buf->output_height);
+	dev_info(&client->dev, "output_height=%d\n", buf->output_height);
 
 	buf->crop_horizontal_end = buf->crop_horizontal_start + buf->output_width - 1;
 	buf->crop_vertical_end = buf->crop_vertical_start + buf->output_height - 1;
-	pr_info("crop_horizontal_end=%d\n", buf->crop_horizontal_end);
-	pr_info("crop_vertical_end=%d\n", buf->crop_vertical_end);
+	dev_info(&client->dev, "crop_horizontal_end=%d\n", buf->crop_horizontal_end);
+	dev_info(&client->dev, "crop_vertical_end=%d\n", buf->crop_vertical_end);
 
 	/* Getting line_length_pck */
 	ret = gc0310_read_reg(client, GC0310_8BIT,
@@ -389,8 +389,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
 		return ret;
 	sh_delay = reg_val;
 	buf->line_length_pck = buf->output_width + hori_blanking + sh_delay + 4;
-	pr_info("hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
-		sh_delay, buf->line_length_pck);
+	dev_info(&client->dev, "hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
+		 sh_delay, buf->line_length_pck);
 
 	/* Getting frame_length_lines */
 	ret = gc0310_read_reg(client, GC0310_8BIT,
@@ -404,8 +404,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
 		return ret;
 	vert_blanking = val | (reg_val & 0xFF);
 	buf->frame_length_lines = buf->output_height + vert_blanking;
-	pr_info("vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
-		buf->frame_length_lines);
+	dev_info(&client->dev, "vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
+		 buf->frame_length_lines);
 
 	buf->binning_factor_x = res->bin_factor_x ?
 				res->bin_factor_x : 1;
@@ -434,7 +434,7 @@ static int gc0310_set_gain(struct v4l2_subdev *sd, int gain)
 		dgain = gain / 2;
 	}
 
-	pr_info("gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
+	dev_info(&client->dev, "gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
 
 	/* set analog gain */
 	ret = gc0310_write_reg(client, GC0310_8BIT,
@@ -458,7 +458,7 @@ static int __gc0310_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret;
 
-	pr_info("coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
+	dev_info(&client->dev, "coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
 
 	/* set exposure */
 	ret = gc0310_write_reg(client, GC0310_8BIT,
@@ -1085,7 +1085,7 @@ static int gc0310_detect(struct i2c_client *client)
 		return -ENODEV;
 	}
 	id = ((((u16)high) << 8) | (u16)low);
-	pr_info("sensor ID = 0x%x\n", id);
+	dev_info(&client->dev, "sensor ID = 0x%x\n", id);
 
 	if (id != GC0310_ID) {
 		dev_err(&client->dev, "sensor ID error, read id = 0x%x, target id = 0x%x\n", id,
@@ -1106,7 +1106,7 @@ static int gc0310_s_stream(struct v4l2_subdev *sd, int enable)
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret;
 
-	pr_info("%s S enable=%d\n", __func__, enable);
+	dev_info(&client->dev, "%s S enable=%d\n", __func__, enable);
 	mutex_lock(&dev->input_lock);
 
 	if (enable) {
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: media: atomisp: replace pr_info() by dev_info()
  2021-04-22 10:30 [PATCH] staging: media: atomisp: replace pr_info() by dev_info() Deepak R Varma
@ 2021-04-22 13:43 ` Fabio Aiuto
  2021-04-23  9:14 ` Hans Verkuil
  2021-04-26  9:21 ` Sakari Ailus
  2 siblings, 0 replies; 6+ messages in thread
From: Fabio Aiuto @ 2021-04-22 13:43 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	linux-media, linux-staging, linux-kernel, mh12gx2825

On Thu, Apr 22, 2021 at 04:00:37PM +0530, Deepak R Varma wrote:
> It is recommended to use driver model diagnostic macros dev_*() instead
> of pr_*() since the former ensures that the log messages are always
> associated with the corresponding device and driver.
> 
> Suggested-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> 
> Note: There are few more pr_into() calls that I have not replaced since
> they are very basic (entry and exit) and temporary. They can be removed 
> if the APIs are fully tested. See this example:
> 	pr_info("%s S\n", __func__);
> 
> Let me know if I should remove them and resubmit this patch.
> 

Hi Deepak,

usually log functions saying "we are here in the code" are not needed,
ftrace is designed for function tracing and other useful things.

I think this patch is aimed for substitution which is logically
different from deletion of function calls.

pr_info deletions can be provided in a separate patch.

Thank you,

fabio

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: media: atomisp: replace pr_info() by dev_info()
  2021-04-22 10:30 [PATCH] staging: media: atomisp: replace pr_info() by dev_info() Deepak R Varma
  2021-04-22 13:43 ` Fabio Aiuto
@ 2021-04-23  9:14 ` Hans Verkuil
  2021-04-23 16:47   ` Deepak R Varma
  2021-04-26  9:21 ` Sakari Ailus
  2 siblings, 1 reply; 6+ messages in thread
From: Hans Verkuil @ 2021-04-23  9:14 UTC (permalink / raw)
  To: Deepak R Varma, Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman
  Cc: linux-media, linux-staging, linux-kernel, mh12gx2825

On 22/04/2021 12:30, Deepak R Varma wrote:
> It is recommended to use driver model diagnostic macros dev_*() instead
> of pr_*() since the former ensures that the log messages are always
> associated with the corresponding device and driver.
> 
> Suggested-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> 
> Note: There are few more pr_into() calls that I have not replaced since
> they are very basic (entry and exit) and temporary. They can be removed 
> if the APIs are fully tested. See this example:
> 	pr_info("%s S\n", __func__);
> 
> Let me know if I should remove them and resubmit this patch.
> 
> 
>  .../media/atomisp/i2c/atomisp-gc0310.c        | 30 +++++++++----------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> index 7e4e123fdb52..27153ec6f65e 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> @@ -300,7 +300,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	/* pixel clock calculattion */
>  	dev->vt_pix_clk_freq_mhz = 14400000; // 16.8MHz
>  	buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz;
> -	pr_info("vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
> +	dev_info(&client->dev, "vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);

Use dev_dbg instead to avoid spamming the kernel log with all these
messages. dev_dbg is perfectly fine for this, but not pr_info/dev_info.

Regards,

	Hans

>  
>  	/* get integration time */
>  	buf->coarse_integration_time_min = GC0310_COARSE_INTG_TIME_MIN;
> @@ -326,7 +326,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->crop_horizontal_start = val | (reg_val & 0xFF);
> -	pr_info("crop_horizontal_start=%d\n", buf->crop_horizontal_start);
> +	dev_info(&client->dev, "crop_horizontal_start=%d\n", buf->crop_horizontal_start);
>  
>  	/* Getting crop_vertical_start */
>  	ret =  gc0310_read_reg(client, GC0310_8BIT,
> @@ -339,7 +339,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->crop_vertical_start = val | (reg_val & 0xFF);
> -	pr_info("crop_vertical_start=%d\n", buf->crop_vertical_start);
> +	dev_info(&client->dev, "crop_vertical_start=%d\n", buf->crop_vertical_start);
>  
>  	/* Getting output_width */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -352,7 +352,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->output_width = val | (reg_val & 0xFF);
> -	pr_info("output_width=%d\n", buf->output_width);
> +	dev_info(&client->dev, "output_width=%d\n", buf->output_width);
>  
>  	/* Getting output_height */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -365,12 +365,12 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->output_height = val | (reg_val & 0xFF);
> -	pr_info("output_height=%d\n", buf->output_height);
> +	dev_info(&client->dev, "output_height=%d\n", buf->output_height);
>  
>  	buf->crop_horizontal_end = buf->crop_horizontal_start + buf->output_width - 1;
>  	buf->crop_vertical_end = buf->crop_vertical_start + buf->output_height - 1;
> -	pr_info("crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> -	pr_info("crop_vertical_end=%d\n", buf->crop_vertical_end);
> +	dev_info(&client->dev, "crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> +	dev_info(&client->dev, "crop_vertical_end=%d\n", buf->crop_vertical_end);
>  
>  	/* Getting line_length_pck */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -389,8 +389,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  		return ret;
>  	sh_delay = reg_val;
>  	buf->line_length_pck = buf->output_width + hori_blanking + sh_delay + 4;
> -	pr_info("hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> -		sh_delay, buf->line_length_pck);
> +	dev_info(&client->dev, "hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> +		 sh_delay, buf->line_length_pck);
>  
>  	/* Getting frame_length_lines */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -404,8 +404,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  		return ret;
>  	vert_blanking = val | (reg_val & 0xFF);
>  	buf->frame_length_lines = buf->output_height + vert_blanking;
> -	pr_info("vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> -		buf->frame_length_lines);
> +	dev_info(&client->dev, "vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> +		 buf->frame_length_lines);
>  
>  	buf->binning_factor_x = res->bin_factor_x ?
>  				res->bin_factor_x : 1;
> @@ -434,7 +434,7 @@ static int gc0310_set_gain(struct v4l2_subdev *sd, int gain)
>  		dgain = gain / 2;
>  	}
>  
> -	pr_info("gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
> +	dev_info(&client->dev, "gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
>  
>  	/* set analog gain */
>  	ret = gc0310_write_reg(client, GC0310_8BIT,
> @@ -458,7 +458,7 @@ static int __gc0310_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  	int ret;
>  
> -	pr_info("coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
> +	dev_info(&client->dev, "coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
>  
>  	/* set exposure */
>  	ret = gc0310_write_reg(client, GC0310_8BIT,
> @@ -1085,7 +1085,7 @@ static int gc0310_detect(struct i2c_client *client)
>  		return -ENODEV;
>  	}
>  	id = ((((u16)high) << 8) | (u16)low);
> -	pr_info("sensor ID = 0x%x\n", id);
> +	dev_info(&client->dev, "sensor ID = 0x%x\n", id);
>  
>  	if (id != GC0310_ID) {
>  		dev_err(&client->dev, "sensor ID error, read id = 0x%x, target id = 0x%x\n", id,
> @@ -1106,7 +1106,7 @@ static int gc0310_s_stream(struct v4l2_subdev *sd, int enable)
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  	int ret;
>  
> -	pr_info("%s S enable=%d\n", __func__, enable);
> +	dev_info(&client->dev, "%s S enable=%d\n", __func__, enable);
>  	mutex_lock(&dev->input_lock);
>  
>  	if (enable) {
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: media: atomisp: replace pr_info() by dev_info()
  2021-04-23  9:14 ` Hans Verkuil
@ 2021-04-23 16:47   ` Deepak R Varma
  0 siblings, 0 replies; 6+ messages in thread
From: Deepak R Varma @ 2021-04-23 16:47 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	linux-media, linux-staging, linux-kernel, mh12gx2825

On Fri, Apr 23, 2021 at 11:14:57AM +0200, Hans Verkuil wrote:
> On 22/04/2021 12:30, Deepak R Varma wrote:
> > It is recommended to use driver model diagnostic macros dev_*() instead
> > of pr_*() since the former ensures that the log messages are always
> > associated with the corresponding device and driver.
> > 
> > Suggested-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
> > ---
> > 
> > Note: There are few more pr_into() calls that I have not replaced since
> > they are very basic (entry and exit) and temporary. They can be removed 
> > if the APIs are fully tested. See this example:
> > 	pr_info("%s S\n", __func__);
> > 
> > Let me know if I should remove them and resubmit this patch.
> > 
> > 
> >  .../media/atomisp/i2c/atomisp-gc0310.c        | 30 +++++++++----------
> >  1 file changed, 15 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > index 7e4e123fdb52..27153ec6f65e 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > @@ -300,7 +300,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	/* pixel clock calculattion */
> >  	dev->vt_pix_clk_freq_mhz = 14400000; // 16.8MHz
> >  	buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz;
> > -	pr_info("vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
> > +	dev_info(&client->dev, "vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
> 
> Use dev_dbg instead to avoid spamming the kernel log with all these
> messages. dev_dbg is perfectly fine for this, but not pr_info/dev_info.

Hi Hans,
Thank you for the feedback. I will make the improvement and resubmit v2.

Regards,
deepak.

> 
> Regards,
> 
> 	Hans
> 
> >  
> >  	/* get integration time */
> >  	buf->coarse_integration_time_min = GC0310_COARSE_INTG_TIME_MIN;
> > @@ -326,7 +326,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->crop_horizontal_start = val | (reg_val & 0xFF);
> > -	pr_info("crop_horizontal_start=%d\n", buf->crop_horizontal_start);
> > +	dev_info(&client->dev, "crop_horizontal_start=%d\n", buf->crop_horizontal_start);
> >  
> >  	/* Getting crop_vertical_start */
> >  	ret =  gc0310_read_reg(client, GC0310_8BIT,
> > @@ -339,7 +339,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->crop_vertical_start = val | (reg_val & 0xFF);
> > -	pr_info("crop_vertical_start=%d\n", buf->crop_vertical_start);
> > +	dev_info(&client->dev, "crop_vertical_start=%d\n", buf->crop_vertical_start);
> >  
> >  	/* Getting output_width */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -352,7 +352,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->output_width = val | (reg_val & 0xFF);
> > -	pr_info("output_width=%d\n", buf->output_width);
> > +	dev_info(&client->dev, "output_width=%d\n", buf->output_width);
> >  
> >  	/* Getting output_height */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -365,12 +365,12 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->output_height = val | (reg_val & 0xFF);
> > -	pr_info("output_height=%d\n", buf->output_height);
> > +	dev_info(&client->dev, "output_height=%d\n", buf->output_height);
> >  
> >  	buf->crop_horizontal_end = buf->crop_horizontal_start + buf->output_width - 1;
> >  	buf->crop_vertical_end = buf->crop_vertical_start + buf->output_height - 1;
> > -	pr_info("crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> > -	pr_info("crop_vertical_end=%d\n", buf->crop_vertical_end);
> > +	dev_info(&client->dev, "crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> > +	dev_info(&client->dev, "crop_vertical_end=%d\n", buf->crop_vertical_end);
> >  
> >  	/* Getting line_length_pck */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -389,8 +389,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  		return ret;
> >  	sh_delay = reg_val;
> >  	buf->line_length_pck = buf->output_width + hori_blanking + sh_delay + 4;
> > -	pr_info("hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> > -		sh_delay, buf->line_length_pck);
> > +	dev_info(&client->dev, "hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> > +		 sh_delay, buf->line_length_pck);
> >  
> >  	/* Getting frame_length_lines */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -404,8 +404,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  		return ret;
> >  	vert_blanking = val | (reg_val & 0xFF);
> >  	buf->frame_length_lines = buf->output_height + vert_blanking;
> > -	pr_info("vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> > -		buf->frame_length_lines);
> > +	dev_info(&client->dev, "vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> > +		 buf->frame_length_lines);
> >  
> >  	buf->binning_factor_x = res->bin_factor_x ?
> >  				res->bin_factor_x : 1;
> > @@ -434,7 +434,7 @@ static int gc0310_set_gain(struct v4l2_subdev *sd, int gain)
> >  		dgain = gain / 2;
> >  	}
> >  
> > -	pr_info("gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
> > +	dev_info(&client->dev, "gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
> >  
> >  	/* set analog gain */
> >  	ret = gc0310_write_reg(client, GC0310_8BIT,
> > @@ -458,7 +458,7 @@ static int __gc0310_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
> >  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> >  	int ret;
> >  
> > -	pr_info("coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
> > +	dev_info(&client->dev, "coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
> >  
> >  	/* set exposure */
> >  	ret = gc0310_write_reg(client, GC0310_8BIT,
> > @@ -1085,7 +1085,7 @@ static int gc0310_detect(struct i2c_client *client)
> >  		return -ENODEV;
> >  	}
> >  	id = ((((u16)high) << 8) | (u16)low);
> > -	pr_info("sensor ID = 0x%x\n", id);
> > +	dev_info(&client->dev, "sensor ID = 0x%x\n", id);
> >  
> >  	if (id != GC0310_ID) {
> >  		dev_err(&client->dev, "sensor ID error, read id = 0x%x, target id = 0x%x\n", id,
> > @@ -1106,7 +1106,7 @@ static int gc0310_s_stream(struct v4l2_subdev *sd, int enable)
> >  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> >  	int ret;
> >  
> > -	pr_info("%s S enable=%d\n", __func__, enable);
> > +	dev_info(&client->dev, "%s S enable=%d\n", __func__, enable);
> >  	mutex_lock(&dev->input_lock);
> >  
> >  	if (enable) {
> > 
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: media: atomisp: replace pr_info() by dev_info()
  2021-04-22 10:30 [PATCH] staging: media: atomisp: replace pr_info() by dev_info() Deepak R Varma
  2021-04-22 13:43 ` Fabio Aiuto
  2021-04-23  9:14 ` Hans Verkuil
@ 2021-04-26  9:21 ` Sakari Ailus
  2021-04-26 14:23   ` Deepak R Varma
  2 siblings, 1 reply; 6+ messages in thread
From: Sakari Ailus @ 2021-04-26  9:21 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, linux-media,
	linux-staging, linux-kernel, mh12gx2825

Hi Deepak,

Thanks for the patch.

On Thu, Apr 22, 2021 at 04:00:37PM +0530, Deepak R Varma wrote:
> It is recommended to use driver model diagnostic macros dev_*() instead
> of pr_*() since the former ensures that the log messages are always
> associated with the corresponding device and driver.
> 
> Suggested-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> 
> Note: There are few more pr_into() calls that I have not replaced since
> they are very basic (entry and exit) and temporary. They can be removed 
> if the APIs are fully tested. See this example:
> 	pr_info("%s S\n", __func__);
> 
> Let me know if I should remove them and resubmit this patch.

Most probably leftovers from development time. I think these could be
removed but perhaps by a separate patch.

> 
> 
>  .../media/atomisp/i2c/atomisp-gc0310.c        | 30 +++++++++----------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> index 7e4e123fdb52..27153ec6f65e 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> @@ -300,7 +300,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	/* pixel clock calculattion */
>  	dev->vt_pix_clk_freq_mhz = 14400000; // 16.8MHz
>  	buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz;
> -	pr_info("vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
> +	dev_info(&client->dev, "vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);

Over 80; please wrap. The same for the rest of such lines.

>  
>  	/* get integration time */
>  	buf->coarse_integration_time_min = GC0310_COARSE_INTG_TIME_MIN;
> @@ -326,7 +326,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->crop_horizontal_start = val | (reg_val & 0xFF);
> -	pr_info("crop_horizontal_start=%d\n", buf->crop_horizontal_start);
> +	dev_info(&client->dev, "crop_horizontal_start=%d\n", buf->crop_horizontal_start);
>  
>  	/* Getting crop_vertical_start */
>  	ret =  gc0310_read_reg(client, GC0310_8BIT,
> @@ -339,7 +339,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->crop_vertical_start = val | (reg_val & 0xFF);
> -	pr_info("crop_vertical_start=%d\n", buf->crop_vertical_start);
> +	dev_info(&client->dev, "crop_vertical_start=%d\n", buf->crop_vertical_start);
>  
>  	/* Getting output_width */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -352,7 +352,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->output_width = val | (reg_val & 0xFF);
> -	pr_info("output_width=%d\n", buf->output_width);
> +	dev_info(&client->dev, "output_width=%d\n", buf->output_width);
>  
>  	/* Getting output_height */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -365,12 +365,12 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  	if (ret)
>  		return ret;
>  	buf->output_height = val | (reg_val & 0xFF);
> -	pr_info("output_height=%d\n", buf->output_height);
> +	dev_info(&client->dev, "output_height=%d\n", buf->output_height);
>  
>  	buf->crop_horizontal_end = buf->crop_horizontal_start + buf->output_width - 1;
>  	buf->crop_vertical_end = buf->crop_vertical_start + buf->output_height - 1;
> -	pr_info("crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> -	pr_info("crop_vertical_end=%d\n", buf->crop_vertical_end);
> +	dev_info(&client->dev, "crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> +	dev_info(&client->dev, "crop_vertical_end=%d\n", buf->crop_vertical_end);
>  
>  	/* Getting line_length_pck */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -389,8 +389,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  		return ret;
>  	sh_delay = reg_val;
>  	buf->line_length_pck = buf->output_width + hori_blanking + sh_delay + 4;
> -	pr_info("hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> -		sh_delay, buf->line_length_pck);
> +	dev_info(&client->dev, "hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> +		 sh_delay, buf->line_length_pck);
>  
>  	/* Getting frame_length_lines */
>  	ret = gc0310_read_reg(client, GC0310_8BIT,
> @@ -404,8 +404,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
>  		return ret;
>  	vert_blanking = val | (reg_val & 0xFF);
>  	buf->frame_length_lines = buf->output_height + vert_blanking;
> -	pr_info("vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> -		buf->frame_length_lines);
> +	dev_info(&client->dev, "vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> +		 buf->frame_length_lines);
>  
>  	buf->binning_factor_x = res->bin_factor_x ?
>  				res->bin_factor_x : 1;
> @@ -434,7 +434,7 @@ static int gc0310_set_gain(struct v4l2_subdev *sd, int gain)
>  		dgain = gain / 2;
>  	}
>  
> -	pr_info("gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
> +	dev_info(&client->dev, "gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
>  
>  	/* set analog gain */
>  	ret = gc0310_write_reg(client, GC0310_8BIT,
> @@ -458,7 +458,7 @@ static int __gc0310_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  	int ret;
>  
> -	pr_info("coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
> +	dev_info(&client->dev, "coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
>  
>  	/* set exposure */
>  	ret = gc0310_write_reg(client, GC0310_8BIT,
> @@ -1085,7 +1085,7 @@ static int gc0310_detect(struct i2c_client *client)
>  		return -ENODEV;
>  	}
>  	id = ((((u16)high) << 8) | (u16)low);
> -	pr_info("sensor ID = 0x%x\n", id);
> +	dev_info(&client->dev, "sensor ID = 0x%x\n", id);
>  
>  	if (id != GC0310_ID) {
>  		dev_err(&client->dev, "sensor ID error, read id = 0x%x, target id = 0x%x\n", id,
> @@ -1106,7 +1106,7 @@ static int gc0310_s_stream(struct v4l2_subdev *sd, int enable)
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  	int ret;
>  
> -	pr_info("%s S enable=%d\n", __func__, enable);
> +	dev_info(&client->dev, "%s S enable=%d\n", __func__, enable);
>  	mutex_lock(&dev->input_lock);
>  
>  	if (enable) {

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: media: atomisp: replace pr_info() by dev_info()
  2021-04-26  9:21 ` Sakari Ailus
@ 2021-04-26 14:23   ` Deepak R Varma
  0 siblings, 0 replies; 6+ messages in thread
From: Deepak R Varma @ 2021-04-26 14:23 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, linux-media,
	linux-staging, linux-kernel, mh12gx2825

On Mon, Apr 26, 2021 at 12:21:26PM +0300, Sakari Ailus wrote:
> Hi Deepak,
> 
> Thanks for the patch.
> 
> On Thu, Apr 22, 2021 at 04:00:37PM +0530, Deepak R Varma wrote:
> > It is recommended to use driver model diagnostic macros dev_*() instead
> > of pr_*() since the former ensures that the log messages are always
> > associated with the corresponding device and driver.
> > 
> > Suggested-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
> > ---
> > 
> > Note: There are few more pr_into() calls that I have not replaced since
> > they are very basic (entry and exit) and temporary. They can be removed 
> > if the APIs are fully tested. See this example:
> > 	pr_info("%s S\n", __func__);
> > 
> > Let me know if I should remove them and resubmit this patch.
> 
> Most probably leftovers from development time. I think these could be
> removed but perhaps by a separate patch.

Yes, sure. Will send in a separate patch. In fact, I will include this
and the other patch and send those in the earlier clear up patch set. It
all does the same thing for this driver.

> 
> > 
> > 
> >  .../media/atomisp/i2c/atomisp-gc0310.c        | 30 +++++++++----------
> >  1 file changed, 15 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > index 7e4e123fdb52..27153ec6f65e 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > @@ -300,7 +300,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	/* pixel clock calculattion */
> >  	dev->vt_pix_clk_freq_mhz = 14400000; // 16.8MHz
> >  	buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz;
> > -	pr_info("vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
> > +	dev_info(&client->dev, "vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
> 
> Over 80; please wrap. The same for the rest of such lines.

My apologies for the over sight. I will review and correct these.

> 
> >  
> >  	/* get integration time */
> >  	buf->coarse_integration_time_min = GC0310_COARSE_INTG_TIME_MIN;
> > @@ -326,7 +326,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->crop_horizontal_start = val | (reg_val & 0xFF);
> > -	pr_info("crop_horizontal_start=%d\n", buf->crop_horizontal_start);
> > +	dev_info(&client->dev, "crop_horizontal_start=%d\n", buf->crop_horizontal_start);
> >  
> >  	/* Getting crop_vertical_start */
> >  	ret =  gc0310_read_reg(client, GC0310_8BIT,
> > @@ -339,7 +339,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->crop_vertical_start = val | (reg_val & 0xFF);
> > -	pr_info("crop_vertical_start=%d\n", buf->crop_vertical_start);
> > +	dev_info(&client->dev, "crop_vertical_start=%d\n", buf->crop_vertical_start);
> >  
> >  	/* Getting output_width */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -352,7 +352,7 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->output_width = val | (reg_val & 0xFF);
> > -	pr_info("output_width=%d\n", buf->output_width);
> > +	dev_info(&client->dev, "output_width=%d\n", buf->output_width);
> >  
> >  	/* Getting output_height */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -365,12 +365,12 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  	if (ret)
> >  		return ret;
> >  	buf->output_height = val | (reg_val & 0xFF);
> > -	pr_info("output_height=%d\n", buf->output_height);
> > +	dev_info(&client->dev, "output_height=%d\n", buf->output_height);
> >  
> >  	buf->crop_horizontal_end = buf->crop_horizontal_start + buf->output_width - 1;
> >  	buf->crop_vertical_end = buf->crop_vertical_start + buf->output_height - 1;
> > -	pr_info("crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> > -	pr_info("crop_vertical_end=%d\n", buf->crop_vertical_end);
> > +	dev_info(&client->dev, "crop_horizontal_end=%d\n", buf->crop_horizontal_end);
> > +	dev_info(&client->dev, "crop_vertical_end=%d\n", buf->crop_vertical_end);
> >  
> >  	/* Getting line_length_pck */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -389,8 +389,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  		return ret;
> >  	sh_delay = reg_val;
> >  	buf->line_length_pck = buf->output_width + hori_blanking + sh_delay + 4;
> > -	pr_info("hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> > -		sh_delay, buf->line_length_pck);
> > +	dev_info(&client->dev, "hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
> > +		 sh_delay, buf->line_length_pck);
> >  
> >  	/* Getting frame_length_lines */
> >  	ret = gc0310_read_reg(client, GC0310_8BIT,
> > @@ -404,8 +404,8 @@ static int gc0310_get_intg_factor(struct i2c_client *client,
> >  		return ret;
> >  	vert_blanking = val | (reg_val & 0xFF);
> >  	buf->frame_length_lines = buf->output_height + vert_blanking;
> > -	pr_info("vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> > -		buf->frame_length_lines);
> > +	dev_info(&client->dev, "vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
> > +		 buf->frame_length_lines);
> >  
> >  	buf->binning_factor_x = res->bin_factor_x ?
> >  				res->bin_factor_x : 1;
> > @@ -434,7 +434,7 @@ static int gc0310_set_gain(struct v4l2_subdev *sd, int gain)
> >  		dgain = gain / 2;
> >  	}
> >  
> > -	pr_info("gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
> > +	dev_info(&client->dev, "gain=0x%x again=0x%x dgain=0x%x\n", gain, again, dgain);
> >  
> >  	/* set analog gain */
> >  	ret = gc0310_write_reg(client, GC0310_8BIT,
> > @@ -458,7 +458,7 @@ static int __gc0310_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
> >  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> >  	int ret;
> >  
> > -	pr_info("coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
> > +	dev_info(&client->dev, "coarse_itg=%d gain=%d digitgain=%d\n", coarse_itg, gain, digitgain);
> >  
> >  	/* set exposure */
> >  	ret = gc0310_write_reg(client, GC0310_8BIT,
> > @@ -1085,7 +1085,7 @@ static int gc0310_detect(struct i2c_client *client)
> >  		return -ENODEV;
> >  	}
> >  	id = ((((u16)high) << 8) | (u16)low);
> > -	pr_info("sensor ID = 0x%x\n", id);
> > +	dev_info(&client->dev, "sensor ID = 0x%x\n", id);
> >  
> >  	if (id != GC0310_ID) {
> >  		dev_err(&client->dev, "sensor ID error, read id = 0x%x, target id = 0x%x\n", id,
> > @@ -1106,7 +1106,7 @@ static int gc0310_s_stream(struct v4l2_subdev *sd, int enable)
> >  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> >  	int ret;
> >  
> > -	pr_info("%s S enable=%d\n", __func__, enable);
> > +	dev_info(&client->dev, "%s S enable=%d\n", __func__, enable);
> >  	mutex_lock(&dev->input_lock);
> >  
> >  	if (enable) {
> 
> -- 
> Kind regards,
> 
> Sakari Ailus

Thank you Sakari.
deepak.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-26 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 10:30 [PATCH] staging: media: atomisp: replace pr_info() by dev_info() Deepak R Varma
2021-04-22 13:43 ` Fabio Aiuto
2021-04-23  9:14 ` Hans Verkuil
2021-04-23 16:47   ` Deepak R Varma
2021-04-26  9:21 ` Sakari Ailus
2021-04-26 14:23   ` Deepak R Varma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).