Re: [PATCH 1/6] staging: media: atomisp: improve function argument alignment

2021-04-20 Thread Deepak R Varma
On Tue, Apr 20, 2021 at 03:24:32PM +0200, Hans Verkuil wrote:
> On 19/04/2021 21:12, Deepak R Varma wrote:
> > Improve multi-line function argument alignment according to the code style
> > guidelines. Resolves checkpatch feedback: "Alignment should match
> > open parenthesis".
> > 
> > Signed-off-by: Deepak R Varma 
> 
> WARNING: From:/Signed-off-by: email address mismatch: 'From: Deepak R Varma 
> ' != 'Signed-off-by: Deepak R Varma
> '
> 
> Which email should I use? Ideally you should post from the same email
> as the Signed-off-by.

I am really sorry for this. I was trying to set up mutt to handle both
my accounts and guess that led to this issue. I will resubmit the patch
set with the appropriate email match. Will that be okay?

Thank you,
deepak.

> 
> Regards,
> 
>   Hans
> 
> > ---
> >  drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 4 ++--
> >  drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 4 ++--
> >  drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 4 ++--
> >  3 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
> > b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > index 2b71de722ec3..6be3ee1d93a5 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > @@ -192,8 +192,8 @@ static int __gc0310_buf_reg_array(struct i2c_client 
> > *client,
> >  }
> >  
> >  static int __gc0310_write_reg_is_consecutive(struct i2c_client *client,
> > -   struct gc0310_write_ctrl *ctrl,
> > -   const struct gc0310_reg *next)
> > +struct gc0310_write_ctrl *ctrl,
> > +const struct gc0310_reg *next)
> >  {
> > if (ctrl->index == 0)
> > return 1;
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c 
> > b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> > index 78147ffb6099..6ba4a8adff7c 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> > @@ -171,8 +171,8 @@ static int __gc2235_buf_reg_array(struct i2c_client 
> > *client,
> >  }
> >  
> >  static int __gc2235_write_reg_is_consecutive(struct i2c_client *client,
> > -   struct gc2235_write_ctrl *ctrl,
> > -   const struct gc2235_reg *next)
> > +struct gc2235_write_ctrl *ctrl,
> > +const struct gc2235_reg *next)
> >  {
> > if (ctrl->index == 0)
> > return 1;
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c 
> > b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
> > index eecefcd734d0..aec7392fd1de 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
> > @@ -212,8 +212,8 @@ static int __ov2722_buf_reg_array(struct i2c_client 
> > *client,
> >  }
> >  
> >  static int __ov2722_write_reg_is_consecutive(struct i2c_client *client,
> > -   struct ov2722_write_ctrl *ctrl,
> > -   const struct ov2722_reg *next)
> > +struct ov2722_write_ctrl *ctrl,
> > +const struct ov2722_reg *next)
> >  {
> > if (ctrl->index == 0)
> > return 1;
> > 
> 


Re: [PATCH 4/6] staging: media: atomisp: reformat code comment blocks

2021-04-20 Thread Deepak R Varma
On Tue, Apr 20, 2021 at 10:44:48AM +0200, Fabio Aiuto wrote:
> On Tue, Apr 20, 2021 at 12:45:04AM +0530, Deepak R Varma wrote:
> > Reformat code comment blocks according to the coding style guidelines.
> > This resolves different checkpatch script WARNINGs around block comments.
> > 
> > Signed-off-by: Deepak R Varma 
> > ---
> >  .../media/atomisp/i2c/atomisp-gc2235.c|  8 +++
> >  .../atomisp/i2c/atomisp-libmsrlisthelper.c|  3 ++-
> >  .../media/atomisp/i2c/atomisp-mt9m114.c   | 22 +++
> >  .../media/atomisp/i2c/atomisp-ov2680.c|  3 ++-
> >  4 files changed, 21 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c 
> > b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> > index 548c572d3b57..a585d73665a6 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> > @@ -747,10 +747,10 @@ static int startup(struct v4l2_subdev *sd)
> >  
> > if (is_init == 0) {
> > /* force gc2235 to do a reset in res change, otherwise it
> > -   * can not output normal after switching res. and it is not
> > -   * necessary for first time run up after power on, for the sack
> > -   * of performance
> > -   */
> > +* can not output normal after switching res. and it is not
> > +* necessary for first time run up after power on, for the sack
> > +* of performance
> > +*/
> > power_down(sd);
> > power_up(sd);
> > gc2235_write_reg_array(client, gc2235_init_settings);
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c 
> > b/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c
> > index b93c80471f22..750b3484eb19 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c
> > @@ -57,7 +57,8 @@ static int set_msr_configuration(struct i2c_client 
> > *client, uint8_t *bufptr,
> >  * By convention, the first two bytes of actual data should be
> >  * understood as an address in the sensor address space (hibyte
> >  * followed by lobyte) where the remaining data in the sequence
> > -* will be written. */
> > +* will be written.
> > +*/
> >  
> > u8 *ptr = bufptr;
> >  
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c 
> > b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> > index 465fc4468442..160bb58ce708 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
> > @@ -478,7 +478,8 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
> > /* Note: current modules wire only one GPIO signal (RESET#),
> >  * but the schematic wires up two to the connector.  BIOS
> >  * versions have been unfortunately inconsistent with which
> > -* ACPI index RESET# is on, so hit both */
> > +* ACPI index RESET# is on, so hit both
> > +*/
> >  
> > if (flag) {
> > ret = dev->platform_data->gpio0_ctrl(sd, 0);
> > @@ -1019,8 +1020,8 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
> > dev->first_gain = AnalogGain;
> > dev->first_diggain = DigitalGain;
> > }
> > -   /* DigitalGain = 0x400 * (((u16) DigitalGain) >> 8) +
> > -   ((unsigned int)(0x400 * (((u16) DigitalGain) & 0xFF)) >>8); */
> > +   /* DigitalGain = 0x400 * (((u16) DigitalGain) >> 8) +   */
> > +   /* ((unsigned int)(0x400 * (((u16) DigitalGain) & 0xFF)) >>8);  */
> >  
> > /* set frame length */
> > if (FLines < coarse_integration + 6)
> > @@ -1035,7 +1036,8 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
> >  
> > /* set coarse integration */
> > /* 3A provide real exposure time.
> > -   should not translate to any value here. */
> > +* should not translate to any value here.
> > +*/
> > ret = mt9m114_write_reg(client, MISENSOR_16BIT,
> > REG_EXPO_COARSE, (u16)(coarse_integration));
> > if (ret) {
> > @@ -1044,7 +1046,7 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
> > }
> >  
> > /*
> > -   // set analog/digital gain
> > +* set analog/digital gain
> > swi

Re: [PATCH 6/6] staging: media: atomisp: use printk with KERN facility level

2021-04-20 Thread Deepak R Varma
On Tue, Apr 20, 2021 at 10:35:23AM +0200, Fabio Aiuto wrote:
> Hi Deepak,
> 
> On Tue, Apr 20, 2021 at 12:46:40AM +0530, Deepak R Varma wrote:
> > printk() without KERN_ facility is flagged by checkpatch as a
> > warning. It is better to use pr_info() which comes with an
> > inbuilt KERN_INFO level.
> > 
> > Signed-off-by: Deepak R Varma 
> > ---
> >  drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
> > b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > index b572551f1a0d..a0f3c5c32f94 100644
> > --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
> > @@ -1020,7 +1020,7 @@ static int gc0310_set_fmt(struct v4l2_subdev *sd,
> > return -EINVAL;
> > }
> >  
> > -   printk("%s: before gc0310_write_reg_array %s\n", __func__,
> > +   pr_info("%s: before gc0310_write_reg_array %s\n", __func__,
> >gc0310_res[dev->fmt_idx].desc);
> 
> in a driver is best recommended to replace a raw printk call
> with a dev_*() log. Check few lines above here to see
> how it is done.

Hello Fabio,
thank you for the feedback. Should I resubmit this patch with additional
printk() / pr_info() replacement by dev_*()? OR send in a new patch with
this change? Just want to make sure I am not including more than one
change type in the patch.

deepak.

> 
> 
> > ret = startup(sd);
> > if (ret) {
> > -- 
> > 2.25.1
> > 
> > 
> 
> 
> thank you,
> 
> fabio


[PATCH 6/6] staging: media: atomisp: use printk with KERN facility level

2021-04-19 Thread Deepak R Varma
printk() without KERN_ facility is flagged by checkpatch as a
warning. It is better to use pr_info() which comes with an
inbuilt KERN_INFO level.

Signed-off-by: Deepak R Varma 
---
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index b572551f1a0d..a0f3c5c32f94 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -1020,7 +1020,7 @@ static int gc0310_set_fmt(struct v4l2_subdev *sd,
return -EINVAL;
}
 
-   printk("%s: before gc0310_write_reg_array %s\n", __func__,
+   pr_info("%s: before gc0310_write_reg_array %s\n", __func__,
   gc0310_res[dev->fmt_idx].desc);
ret = startup(sd);
if (ret) {
-- 
2.25.1



[PATCH 5/6] staging: media: atomisp: fix CamelCase variable naming

2021-04-19 Thread Deepak R Varma
Mixed case variable names are discouraged and they result in checkpatch
script "Avoid CamelCase" warnings. Replace such CamelCase variable names
by lower case strings according to the coding style guidelines.

Signed-off-by: Deepak R Varma 
---
 .../media/atomisp/i2c/atomisp-mt9m114.c   | 62 +--
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c 
b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
index 160bb58ce708..e63906a69e30 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
@@ -999,10 +999,10 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
struct mt9m114_device *dev = to_mt9m114_sensor(sd);
int ret = 0;
unsigned int coarse_integration = 0;
-   unsigned int FLines = 0;
-   unsigned int FrameLengthLines = 0; /* ExposureTime.FrameLengthLines; */
-   unsigned int AnalogGain, DigitalGain;
-   u32 AnalogGainToWrite = 0;
+   unsigned int f_lines = 0;
+   unsigned int frame_len_lines = 0; /* ExposureTime.FrameLengthLines; */
+   unsigned int analog_gain, digital_gain;
+   u32 analog_gain_to_write = 0;
 
dev_dbg(>dev, "%s(0x%X 0x%X 0x%X)\n", __func__,
exposure->integration_time[0], exposure->gain[0],
@@ -1010,27 +1010,27 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
 
coarse_integration = exposure->integration_time[0];
/* fine_integration = ExposureTime.FineIntegrationTime; */
-   /* FrameLengthLines = ExposureTime.FrameLengthLines; */
-   FLines = mt9m114_res[dev->res].lines_per_frame;
-   AnalogGain = exposure->gain[0];
-   DigitalGain = exposure->gain[1];
+   /* frame_len_lines = ExposureTime.FrameLengthLines; */
+   f_lines = mt9m114_res[dev->res].lines_per_frame;
+   analog_gain = exposure->gain[0];
+   digital_gain = exposure->gain[1];
if (!dev->streamon) {
/*Save the first exposure values while stream is off*/
dev->first_exp = coarse_integration;
-   dev->first_gain = AnalogGain;
-   dev->first_diggain = DigitalGain;
+   dev->first_gain = analog_gain;
+   dev->first_diggain = digital_gain;
}
-   /* DigitalGain = 0x400 * (((u16) DigitalGain) >> 8) +   */
-   /* ((unsigned int)(0x400 * (((u16) DigitalGain) & 0xFF)) >>8);  */
+   /* digital_gain = 0x400 * (((u16) digital_gain) >> 8) + */
+   /* ((unsigned int)(0x400 * (((u16) digital_gain) & 0xFF)) >>8); */
 
/* set frame length */
-   if (FLines < coarse_integration + 6)
-   FLines = coarse_integration + 6;
-   if (FLines < FrameLengthLines)
-   FLines = FrameLengthLines;
-   ret = mt9m114_write_reg(client, MISENSOR_16BIT, 0x300A, FLines);
+   if (f_lines < coarse_integration + 6)
+   f_lines = coarse_integration + 6;
+   if (f_lines < frame_len_lines)
+   f_lines = frame_len_lines;
+   ret = mt9m114_write_reg(client, MISENSOR_16BIT, 0x300A, f_lines);
if (ret) {
-   v4l2_err(client, "%s: fail to set FLines\n", __func__);
+   v4l2_err(client, "%s: fail to set f_lines\n", __func__);
return -EINVAL;
}
 
@@ -1047,38 +1047,38 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
 
/*
 * set analog/digital gain
-   switch(AnalogGain)
+   switch(analog_gain)
{
case 0:
- AnalogGainToWrite = 0x0;
+ analog_gain_to_write = 0x0;
  break;
case 1:
- AnalogGainToWrite = 0x20;
+ analog_gain_to_write = 0x20;
  break;
case 2:
- AnalogGainToWrite = 0x60;
+ analog_gain_to_write = 0x60;
  break;
case 4:
- AnalogGainToWrite = 0xA0;
+ analog_gain_to_write = 0xA0;
  break;
case 8:
- AnalogGainToWrite = 0xE0;
+ analog_gain_to_write = 0xE0;
  break;
default:
- AnalogGainToWrite = 0x20;
+ analog_gain_to_write = 0x20;
  break;
}
*/
-   if (DigitalGain >= 16 || DigitalGain <= 1)
-   DigitalGain = 1;
+   if (digital_gain >= 16 || digital_gain <= 1)
+   digital_gain = 1;
 
-   /* AnalogGainToWrite = (u16)((DigitalGain << 12) | AnalogGainToWrite);
+   /* analog_gain_to_write = (u16)((digital_gain << 12) | 
analog_gain_to_write);
 */
-   AnalogGainToWrite = (u16)((DigitalGain << 12) | (u16)AnalogGain);
+   analog_gain_to_write = (u16)((digital_gain << 12) | (u16)analog_gain);
ret = mt9m114_write_reg(client, MISENSOR_16BIT,
-  

[PATCH 4/6] staging: media: atomisp: reformat code comment blocks

2021-04-19 Thread Deepak R Varma
Reformat code comment blocks according to the coding style guidelines.
This resolves different checkpatch script WARNINGs around block comments.

Signed-off-by: Deepak R Varma 
---
 .../media/atomisp/i2c/atomisp-gc2235.c|  8 +++
 .../atomisp/i2c/atomisp-libmsrlisthelper.c|  3 ++-
 .../media/atomisp/i2c/atomisp-mt9m114.c   | 22 +++
 .../media/atomisp/i2c/atomisp-ov2680.c|  3 ++-
 4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index 548c572d3b57..a585d73665a6 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -747,10 +747,10 @@ static int startup(struct v4l2_subdev *sd)
 
if (is_init == 0) {
/* force gc2235 to do a reset in res change, otherwise it
-   * can not output normal after switching res. and it is not
-   * necessary for first time run up after power on, for the sack
-   * of performance
-   */
+* can not output normal after switching res. and it is not
+* necessary for first time run up after power on, for the sack
+* of performance
+*/
power_down(sd);
power_up(sd);
gc2235_write_reg_array(client, gc2235_init_settings);
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c 
b/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c
index b93c80471f22..750b3484eb19 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c
@@ -57,7 +57,8 @@ static int set_msr_configuration(struct i2c_client *client, 
uint8_t *bufptr,
 * By convention, the first two bytes of actual data should be
 * understood as an address in the sensor address space (hibyte
 * followed by lobyte) where the remaining data in the sequence
-* will be written. */
+* will be written.
+*/
 
u8 *ptr = bufptr;
 
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c 
b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
index 465fc4468442..160bb58ce708 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
@@ -478,7 +478,8 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
/* Note: current modules wire only one GPIO signal (RESET#),
 * but the schematic wires up two to the connector.  BIOS
 * versions have been unfortunately inconsistent with which
-* ACPI index RESET# is on, so hit both */
+* ACPI index RESET# is on, so hit both
+*/
 
if (flag) {
ret = dev->platform_data->gpio0_ctrl(sd, 0);
@@ -1019,8 +1020,8 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
dev->first_gain = AnalogGain;
dev->first_diggain = DigitalGain;
}
-   /* DigitalGain = 0x400 * (((u16) DigitalGain) >> 8) +
-   ((unsigned int)(0x400 * (((u16) DigitalGain) & 0xFF)) >>8); */
+   /* DigitalGain = 0x400 * (((u16) DigitalGain) >> 8) +   */
+   /* ((unsigned int)(0x400 * (((u16) DigitalGain) & 0xFF)) >>8);  */
 
/* set frame length */
if (FLines < coarse_integration + 6)
@@ -1035,7 +1036,8 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
 
/* set coarse integration */
/* 3A provide real exposure time.
-   should not translate to any value here. */
+* should not translate to any value here.
+*/
ret = mt9m114_write_reg(client, MISENSOR_16BIT,
REG_EXPO_COARSE, (u16)(coarse_integration));
if (ret) {
@@ -1044,7 +1046,7 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
}
 
/*
-   // set analog/digital gain
+* set analog/digital gain
switch(AnalogGain)
{
case 0:
@@ -1069,8 +1071,9 @@ static long mt9m114_s_exposure(struct v4l2_subdev *sd,
*/
if (DigitalGain >= 16 || DigitalGain <= 1)
DigitalGain = 1;
-   /* AnalogGainToWrite =
-   (u16)((DigitalGain << 12) | AnalogGainToWrite); */
+
+   /* AnalogGainToWrite = (u16)((DigitalGain << 12) | AnalogGainToWrite);
+*/
AnalogGainToWrite = (u16)((DigitalGain << 12) | (u16)AnalogGain);
ret = mt9m114_write_reg(client, MISENSOR_16BIT,
REG_GAIN, AnalogGainToWrite);
@@ -1096,7 +1099,8 @@ static long mt9m114_ioctl(struct v4l2_subdev *sd, 
unsigned int cmd, void *arg)
 }
 
 /* This returns the exposure time being used. This should only be used
-   for filling in EXIF data, not for actual 

[PATCH 3/6] staging: media: atomisp: use __func__ over function names

2021-04-19 Thread Deepak R Varma
Replace hard coded function names from the debug print strings by
standard __func__ predefined identifier. This resolves following
checkpatch script WARNING:
Prefer using '"%s...", __func__' to using function's name, in a string.

Signed-off-by: Deepak R Varma 
---
 .../staging/media/atomisp/i2c/atomisp-gc0310.c   |  2 +-
 .../staging/media/atomisp/i2c/atomisp-gc2235.c   |  2 +-
 .../staging/media/atomisp/i2c/atomisp-lm3554.c   |  2 +-
 .../staging/media/atomisp/i2c/atomisp-ov2680.c   | 16 
 .../staging/media/atomisp/i2c/atomisp-ov2722.c   |  2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index d68a2bcc9ae1..b572551f1a0d 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -1292,7 +1292,7 @@ static int gc0310_remove(struct i2c_client *client)
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct gc0310_device *dev = to_gc0310_sensor(sd);
 
-   dev_dbg(>dev, "gc0310_remove...\n");
+   dev_dbg(>dev, "%s...\n", __func__);
 
dev->platform_data->csi_cfg(sd, 0);
 
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index e722c639b60d..548c572d3b57 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -1034,7 +1034,7 @@ static int gc2235_remove(struct i2c_client *client)
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct gc2235_device *dev = to_gc2235_sensor(sd);
 
-   dev_dbg(>dev, "gc2235_remove...\n");
+   dev_dbg(>dev, "%s...\n", __func__);
 
dev->platform_data->csi_cfg(sd, 0);
 
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c 
b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index 7ca7378b1859..ab10fd98dbc0 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -680,7 +680,7 @@ static int lm3554_detect(struct v4l2_subdev *sd)
int ret;
 
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
-   dev_err(>dev, "lm3554_detect i2c error\n");
+   dev_err(>dev, "%s i2c error\n", __func__);
return -ENODEV;
}
 
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c 
b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
index 92c52431bd8f..c17615149f46 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
@@ -146,7 +146,7 @@ static int ov2680_g_bin_factor_x(struct v4l2_subdev *sd, 
s32 *val)
struct ov2680_device *dev = to_ov2680_sensor(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
 
-   dev_dbg(>dev,  "ov2680_g_bin_factor_x\n");
+   dev_dbg(>dev,  "%s\n", __func__);
*val = ov2680_res[dev->fmt_idx].bin_factor_x;
 
return 0;
@@ -158,7 +158,7 @@ static int ov2680_g_bin_factor_y(struct v4l2_subdev *sd, 
s32 *val)
struct i2c_client *client = v4l2_get_subdevdata(sd);
 
*val = ov2680_res[dev->fmt_idx].bin_factor_y;
-   dev_dbg(>dev,  "ov2680_g_bin_factor_y\n");
+   dev_dbg(>dev,  "%s\n", __func__);
return 0;
 }
 
@@ -173,7 +173,7 @@ static int ov2680_get_intg_factor(struct i2c_client *client,
u16 reg_val;
int ret;
 
-   dev_dbg(>dev,  "ov2680_get_intg_factor\n");
+   dev_dbg(>dev,  "%s\n", __func__);
if (!info)
return -EINVAL;
 
@@ -251,8 +251,8 @@ static long __ov2680_set_exposure(struct v4l2_subdev *sd, 
int coarse_itg,
int ret, exp_val;
 
dev_dbg(>dev,
-   "+++__ov2680_set_exposure coarse_itg %d, gain %d, digitgain 
%d++\n",
-   coarse_itg, gain, digitgain);
+   "+++%s coarse_itg %d, gain %d, digitgain %d++\n",
+   __func__, coarse_itg, gain, digitgain);
 
vts = ov2680_res[dev->fmt_idx].lines_per_frame;
 
@@ -1061,9 +1061,9 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int 
enable)
 
mutex_lock(>input_lock);
if (enable)
-   dev_dbg(>dev, "ov2680_s_stream one\n");
+   dev_dbg(>dev, "%s one\n", __func__);
else
-   dev_dbg(>dev, "ov2680_s_stream off\n");
+   dev_dbg(>dev, "%s off\n", __func__);
 
ret = ov2680_write_reg(client, 1, OV2680_SW_STREAM,
   enable ? OV2680_START_STREAMING :
@@ -1227,7 +1227,7 @@ static int ov2680_remove(struct i2c_client *client)
   

[PATCH 2/6] staging: media: atomisp: balance braces around if...else block

2021-04-19 Thread Deepak R Varma
Balance braces around the if else blocks as per the code style guidelines.
Resolves checkpatch script CHECK / WARNING feedback messages.

Signed-off-by: Deepak R Varma 
---
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c  | 4 ++--
 drivers/staging/media/atomisp/i2c/atomisp-gc2235.c  | 4 ++--
 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 ++--
 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c  | 7 ---
 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c  | 4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index 6be3ee1d93a5..d68a2bcc9ae1 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -872,9 +872,9 @@ static int gc0310_s_power(struct v4l2_subdev *sd, int on)
 {
int ret;
 
-   if (on == 0)
+   if (on == 0) {
return power_down(sd);
-   else {
+   } else {
ret = power_up(sd);
if (!ret)
return gc0310_init(sd);
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index 6ba4a8adff7c..e722c639b60d 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -658,9 +658,9 @@ static int gc2235_s_power(struct v4l2_subdev *sd, int on)
 {
int ret;
 
-   if (on == 0)
+   if (on == 0) {
ret = power_down(sd);
-   else {
+   } else {
ret = power_up(sd);
if (!ret)
ret = __gc2235_init(sd);
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c 
b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
index f5de81132177..465fc4468442 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
@@ -568,9 +568,9 @@ static int power_down(struct v4l2_subdev *sd)
 
 static int mt9m114_s_power(struct v4l2_subdev *sd, int power)
 {
-   if (power == 0)
+   if (power == 0) {
return power_down(sd);
-   else {
+   } else {
if (power_up(sd))
return -EINVAL;
 
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c 
b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
index c90730513438..92c52431bd8f 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
@@ -461,11 +461,12 @@ static int ov2680_v_flip(struct v4l2_subdev *sd, s32 
value)
ret = ov2680_read_reg(client, 1, OV2680_FLIP_REG, );
if (ret)
return ret;
-   if (value) {
+
+   if (value)
val |= OV2680_FLIP_MIRROR_BIT_ENABLE;
-   } else {
+   else
val &= ~OV2680_FLIP_MIRROR_BIT_ENABLE;
-   }
+
ret = ov2680_write_reg(client, 1,
   OV2680_FLIP_REG, val);
if (ret)
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c 
b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
index aec7392fd1de..d046a9804f63 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
@@ -772,9 +772,9 @@ static int ov2722_s_power(struct v4l2_subdev *sd, int on)
 {
int ret;
 
-   if (on == 0)
+   if (on == 0) {
return power_down(sd);
-   else {
+   } else {
ret = power_up(sd);
if (!ret)
return ov2722_init(sd);
-- 
2.25.1



[PATCH 1/6] staging: media: atomisp: improve function argument alignment

2021-04-19 Thread Deepak R Varma
Improve multi-line function argument alignment according to the code style
guidelines. Resolves checkpatch feedback: "Alignment should match
open parenthesis".

Signed-off-by: Deepak R Varma 
---
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 4 ++--
 drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 4 ++--
 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index 2b71de722ec3..6be3ee1d93a5 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -192,8 +192,8 @@ static int __gc0310_buf_reg_array(struct i2c_client *client,
 }
 
 static int __gc0310_write_reg_is_consecutive(struct i2c_client *client,
-   struct gc0310_write_ctrl *ctrl,
-   const struct gc0310_reg *next)
+struct gc0310_write_ctrl *ctrl,
+const struct gc0310_reg *next)
 {
if (ctrl->index == 0)
return 1;
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index 78147ffb6099..6ba4a8adff7c 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -171,8 +171,8 @@ static int __gc2235_buf_reg_array(struct i2c_client *client,
 }
 
 static int __gc2235_write_reg_is_consecutive(struct i2c_client *client,
-   struct gc2235_write_ctrl *ctrl,
-   const struct gc2235_reg *next)
+struct gc2235_write_ctrl *ctrl,
+const struct gc2235_reg *next)
 {
if (ctrl->index == 0)
return 1;
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c 
b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
index eecefcd734d0..aec7392fd1de 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
@@ -212,8 +212,8 @@ static int __ov2722_buf_reg_array(struct i2c_client *client,
 }
 
 static int __ov2722_write_reg_is_consecutive(struct i2c_client *client,
-   struct ov2722_write_ctrl *ctrl,
-   const struct ov2722_reg *next)
+struct ov2722_write_ctrl *ctrl,
+const struct ov2722_reg *next)
 {
if (ctrl->index == 0)
return 1;
-- 
2.25.1



[PATCH 0/6] staging: media: atomisp: code cleanup fixes

2021-04-19 Thread Deepak R Varma
This patch set addresses different kinds of checkpatch WARNING and
CHECK complaints. 

Note: The patches should be applied in the ascending order.

Deepak R Varma (6):
  staging: media: atomisp: improve function argument alignment
  staging: media: atomisp: balance braces around if...else block
  staging: media: atomisp: use __func__ over function names
  staging: media: atomisp: reformat code comment blocks
  staging: media: atomisp: fix CamelCase variable naming
  staging: media: atomisp: use printk with KERN facility level

 .../media/atomisp/i2c/atomisp-gc0310.c| 12 +--
 .../media/atomisp/i2c/atomisp-gc2235.c| 18 ++--
 .../atomisp/i2c/atomisp-libmsrlisthelper.c|  3 +-
 .../media/atomisp/i2c/atomisp-lm3554.c|  2 +-
 .../media/atomisp/i2c/atomisp-mt9m114.c   | 82 ++-
 .../media/atomisp/i2c/atomisp-ov2680.c| 26 +++---
 .../media/atomisp/i2c/atomisp-ov2722.c| 10 +--
 7 files changed, 80 insertions(+), 73 deletions(-)

-- 
2.25.1



Re: [PATCH 3/3] gpio: zynq: Check return value of irq_get_irq_data

2021-04-17 Thread Deepak R Varma
On Fri, Apr 09, 2021 at 07:38:06PM +0530, Srinivas Neeli wrote:
> In two different instances the return value of "irq_get_irq_data"
> API was neither captured nor checked.
> Fixed it by capturing the return value and then checking for any error.
> 
> Addresses-Coverity: "returned_null"
> Signed-off-by: Srinivas Neeli 
> ---
>  drivers/gpio/gpio-zynq.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
> index c91302a16c77..f0cb8ccd03ed 100644
> --- a/drivers/gpio/gpio-zynq.c
> +++ b/drivers/gpio/gpio-zynq.c
> @@ -736,6 +736,11 @@ static int __maybe_unused zynq_gpio_suspend(struct 
> device *dev)
>   struct zynq_gpio *gpio = dev_get_drvdata(dev);
>   struct irq_data *data = irq_get_irq_data(gpio->irq);
>  
> + if (!data) {
> + dev_err(dev, "irq_get_irq_data() failed\n");

It will be useful to include a tag such as "suspend: " in the error
message to uniquely identify where it failed from.

> + return -EINVAL;
> + }
> +
>   if (!device_may_wakeup(dev))
>   disable_irq(gpio->irq);
>  
> @@ -753,6 +758,11 @@ static int __maybe_unused zynq_gpio_resume(struct device 
> *dev)
>   struct irq_data *data = irq_get_irq_data(gpio->irq);
>   int ret;
>  
> + if (!data) {
> + dev_err(dev, "irq_get_irq_data() failed\n");

Ditto. Suggest using "resume: " tag here.

> + return -EINVAL;
> + }
> +
>   if (!device_may_wakeup(dev))
>   enable_irq(gpio->irq);
>  
> -- 
> 2.9.1
> 




Re: [PATCH v2] drm/vc4: replace idr_init() by idr_init_base()

2020-11-08 Thread Deepak R Varma
On Fri, Nov 06, 2020 at 11:52:49AM +0100, Maxime Ripard wrote:
> On Thu, Nov 05, 2020 at 01:24:14PM -0800, Eric Anholt wrote:
> > On Thu, Nov 5, 2020 at 12:21 PM Deepak R Varma  wrote:
> > >
> > > idr_init() uses base 0 which is an invalid identifier for this driver.
> > > The idr_alloc for this driver uses VC4_PERFMONID_MIN as start value for
> > > ID range and it is #defined to 1. The new function idr_init_base allows
> > > IDR to set the ID lookup from base 1. This avoids all lookups that
> > > otherwise starts from 0 since 0 is always unused / available.
> > >
> > > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
> > >
> > > Signed-off-by: Deepak R Varma 
> > > ---
> > > Changes since v1:
> > >- Change suggested by Eric Anholt
> > >  1. Use VC4_PERFMONID_MIN instead of magic number 1
> > >
> > >  drivers/gpu/drm/vc4/vc4_perfmon.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/vc4/vc4_perfmon.c 
> > > b/drivers/gpu/drm/vc4/vc4_perfmon.c
> > > index f4aa75efd16b..18abc06335c1 100644
> > > --- a/drivers/gpu/drm/vc4/vc4_perfmon.c
> > > +++ b/drivers/gpu/drm/vc4/vc4_perfmon.c
> > > @@ -77,7 +77,7 @@ struct vc4_perfmon *vc4_perfmon_find(struct vc4_file 
> > > *vc4file, int id)
> > >  void vc4_perfmon_open_file(struct vc4_file *vc4file)
> > >  {
> > > mutex_init(>perfmon.lock);
> > > -   idr_init(>perfmon.idr);
> > > +   idr_init_base(>perfmon.idr, VC4_PERFMONID_MIN);
> > >  }
> > >
> > >  static int vc4_perfmon_idr_del(int id, void *elem, void *data)
> > > --
> > > 2.25.1
> > 
> > Reviewed-by: Eric Anholt 
> > 
> > hopefully Maxime can apply it.
> 
> Applied, thanks!

Thank you all. Appreciate your time.

./drv

> Maxime




[PATCH v2] drm/vc4: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier for this driver.
The idr_alloc for this driver uses VC4_PERFMONID_MIN as start value for
ID range and it is #defined to 1. The new function idr_init_base allows
IDR to set the ID lookup from base 1. This avoids all lookups that
otherwise starts from 0 since 0 is always unused / available.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
Changes since v1:
   - Change suggested by Eric Anholt
 1. Use VC4_PERFMONID_MIN instead of magic number 1

 drivers/gpu/drm/vc4/vc4_perfmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_perfmon.c 
b/drivers/gpu/drm/vc4/vc4_perfmon.c
index f4aa75efd16b..18abc06335c1 100644
--- a/drivers/gpu/drm/vc4/vc4_perfmon.c
+++ b/drivers/gpu/drm/vc4/vc4_perfmon.c
@@ -77,7 +77,7 @@ struct vc4_perfmon *vc4_perfmon_find(struct vc4_file 
*vc4file, int id)
 void vc4_perfmon_open_file(struct vc4_file *vc4file)
 {
mutex_init(>perfmon.lock);
-   idr_init(>perfmon.idr);
+   idr_init_base(>perfmon.idr, VC4_PERFMONID_MIN);
 }
 
 static int vc4_perfmon_idr_del(int id, void *elem, void *data)
-- 
2.25.1



Re: [PATCH] drm/vc4: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
On Thu, Nov 05, 2020 at 11:25:11AM -0800, Eric Anholt wrote:
> On Thu, Nov 5, 2020 at 10:25 AM Deepak R Varma  wrote:
> >
> > idr_init() uses base 0 which is an invalid identifier for this driver.
> > The idr_alloc for this driver uses VC4_PERFMONID_MIN as start value for
> > ID range and it is #defined to 1. The new function idr_init_base allows
> > IDR to set the ID lookup from base 1. This avoids all lookups that
> > otherwise starts from 0 since 0 is always unused / available.
> >
> > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
> >
> > Signed-off-by: Deepak R Varma 
> > ---
> >  drivers/gpu/drm/vc4/vc4_perfmon.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_perfmon.c 
> > b/drivers/gpu/drm/vc4/vc4_perfmon.c
> > index f4aa75efd16b..7d40f421d922 100644
> > --- a/drivers/gpu/drm/vc4/vc4_perfmon.c
> > +++ b/drivers/gpu/drm/vc4/vc4_perfmon.c
> > @@ -77,7 +77,7 @@ struct vc4_perfmon *vc4_perfmon_find(struct vc4_file 
> > *vc4file, int id)
> >  void vc4_perfmon_open_file(struct vc4_file *vc4file)
> >  {
> > mutex_init(>perfmon.lock);
> > -   idr_init(>perfmon.idr);
> > +   idr_init_base(>perfmon.idr, 1);
> >  }
> 
> Sounds like you should use VC4_PERFMONID_MIN instead of a magic 1 here.

Agreed. I will update and resend v2.

Thank you,
./drv


[PATCH] drm/vmwgfx: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier for this driver.
The idr_alloc for this driver uses 1 as start value for ID range. The
new function idr_init_base allows IDR to set the ID lookup from base 1.
This avoids all lookups that otherwise starts from 0 since 0 is always
unused / available.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/vmwgfx/ttm_object.c | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/ttm_object.c 
b/drivers/gpu/drm/vmwgfx/ttm_object.c
index 16077785ad47..cbedcb043803 100644
--- a/drivers/gpu/drm/vmwgfx/ttm_object.c
+++ b/drivers/gpu/drm/vmwgfx/ttm_object.c
@@ -540,7 +540,7 @@ ttm_object_device_init(struct ttm_mem_global *mem_glob,
if (ret != 0)
goto out_no_object_hash;
 
-   idr_init(>idr);
+   idr_init_base(>idr, 1);
tdev->ops = *ops;
tdev->dmabuf_release = tdev->ops.release;
tdev->ops.release = ttm_prime_dmabuf_release;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 31e3e5c9f362..a24d9363a17e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -675,7 +675,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned 
long chipset)
spin_lock_init(_priv->cursor_lock);
 
for (i = vmw_res_context; i < vmw_res_max; ++i) {
-   idr_init(_priv->res_idr[i]);
+   idr_init_base(_priv->res_idr[i], 1);
INIT_LIST_HEAD(_priv->res_lru[i]);
}
 
-- 
2.25.1



[PATCH] drm/qxl: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier for this driver.
The idr_alloc for this driver uses 1 as start value for ID range. The
new function idr_init_base allows IDR to set the ID lookup from base 1.
This avoids all lookups that otherwise starts from 0 since 0 is always
unused / available.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/qxl/qxl_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
index dc5b3850a4d4..228e2b9198f1 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -231,11 +231,11 @@ int qxl_device_init(struct qxl_device *qdev,
goto cursor_ring_free;
}
 
-   idr_init(>release_idr);
+   idr_init_base(>release_idr, 1);
spin_lock_init(>release_idr_lock);
spin_lock_init(>release_lock);
 
-   idr_init(>surf_id_idr);
+   idr_init_base(>surf_id_idr, 1);
spin_lock_init(>surf_id_idr_lock);
 
mutex_init(>async_io_mutex);
-- 
2.25.1



[PATCH] drm/vc4: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier for this driver.
The idr_alloc for this driver uses VC4_PERFMONID_MIN as start value for
ID range and it is #defined to 1. The new function idr_init_base allows
IDR to set the ID lookup from base 1. This avoids all lookups that
otherwise starts from 0 since 0 is always unused / available.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/vc4/vc4_perfmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_perfmon.c 
b/drivers/gpu/drm/vc4/vc4_perfmon.c
index f4aa75efd16b..7d40f421d922 100644
--- a/drivers/gpu/drm/vc4/vc4_perfmon.c
+++ b/drivers/gpu/drm/vc4/vc4_perfmon.c
@@ -77,7 +77,7 @@ struct vc4_perfmon *vc4_perfmon_find(struct vc4_file 
*vc4file, int id)
 void vc4_perfmon_open_file(struct vc4_file *vc4file)
 {
mutex_init(>perfmon.lock);
-   idr_init(>perfmon.idr);
+   idr_init_base(>perfmon.idr, 1);
 }
 
 static int vc4_perfmon_idr_del(int id, void *elem, void *data)
-- 
2.25.1



[PATCH] drm/tegra: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier for this driver.
The new function idr_init_base allows IDR to set the ID lookup from
base 1. This avoids all lookups that otherwise starts from 0 since
0 is always unused.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/tegra/drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index ba9d1c3e7cac..e4baf07992a4 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -90,7 +90,7 @@ static int tegra_drm_open(struct drm_device *drm, struct 
drm_file *filp)
if (!fpriv)
return -ENOMEM;
 
-   idr_init(>contexts);
+   idr_init_base(>contexts, 1);
mutex_init(>lock);
filp->driver_priv = fpriv;
 
-- 
2.25.1



Re: [PATCH] drm/vgm: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
On Thu, Nov 05, 2020 at 12:16:34PM +0100, Daniel Vetter wrote:
> On Thu, Nov 5, 2020 at 11:31 AM Deepak R Varma  wrote:
> >
> > On Thu, Nov 05, 2020 at 10:42:15AM +0100, Daniel Vetter wrote:
> > > On Wed, Nov 04, 2020 at 04:53:38PM +0530, Deepak R Varma wrote:
> > > > idr_init() uses base 0 which is an invalid identifier. The new function
> > > > idr_init_base allows IDR to set the ID lookup from base 1. This avoids
> > > > all lookups that otherwise starts from 0 since 0 is always unused.
> > > >
> > > > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more 
> > > > efficient")
> > > >
> > > > Signed-off-by: Deepak R Varma 
> > >
> > > Tiny typo in the commit message summary: s/vgm/vgem/
> > >
> > > Also can you pls resbumit this with intel-gfx mailing list on cc (like for
> > > i915)? There's a CI bot there which runs a few vgem tests, would be good
> > > to confirm nothing has been broken.
> >
> > Hi Daniel,
> > sure. I will correct the summary typo and also feed it to the CI bot.
> >
> > Also, according to Felix Kuehling's comment on a similar patch for
> > drm/amdkfd driver, an ID can be 0. The change I am proposing is more
> > efficient for conditions that do not want to use ID as 0. Otherwise,
> > id = 0 is an acceptable possibility. So, my statement that "Id 0 is an 
> > invalid
> > identifier" is not true.
> >
> > Can you please comment if this is accurate and I should reword my log
> > message as well?
> 
> You need to review the vgem code to see whether we're using id 0 as
> invalid identifier or not. That's part of the work that needs to be
> done here. Best would be to explain the evidence you've found in the
> commit message, why id 0 is invalid for this specific code. Since yes
> in general that's not true, it depends how the idr is used.
> -Daniel
> 
You are correct. For the vgem driver, id 0 is not used. The patch
should then apply to this driver.

Thank you very much Daniel. I have just sent v2 of the patch with your
suggestions.

./drv

> >
> > Thank you.
> > ./drv
> >
> > >
> > > Otherwise lgtm.
> > >
> > > Thanks, Daniel
> > >
> > > > ---
> > > >  drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c 
> > > > b/drivers/gpu/drm/vgem/vgem_fence.c
> > > > index 17f32f550dd9..2902dc6e64fa 100644
> > > > --- a/drivers/gpu/drm/vgem/vgem_fence.c
> > > > +++ b/drivers/gpu/drm/vgem/vgem_fence.c
> > > > @@ -233,7 +233,7 @@ int vgem_fence_signal_ioctl(struct drm_device *dev,
> > > >  int vgem_fence_open(struct vgem_file *vfile)
> > > >  {
> > > > mutex_init(>fence_mutex);
> > > > -   idr_init(>fence_idr);
> > > > +   idr_init_base(>fence_idr, 1);
> > > >
> > > > return 0;
> > > >  }
> > > > --
> > > > 2.25.1
> > > >
> > >
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> 
> 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


[PATCH v2] drm/vgem: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier. The new function
idr_init_base allows IDR to set the ID lookup from base 1. This avoids
all lookups that otherwise starts from 0 since 0 is always unused.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
Changes since v1:
   - Changes suggested by Daniel Vetter:
 1. Correct typo in patch summary
 2. cc intel-gfx to get the patch through CI bot test

 drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/vgem_fence.c 
b/drivers/gpu/drm/vgem/vgem_fence.c
index 17f32f550dd9..2902dc6e64fa 100644
--- a/drivers/gpu/drm/vgem/vgem_fence.c
+++ b/drivers/gpu/drm/vgem/vgem_fence.c
@@ -233,7 +233,7 @@ int vgem_fence_signal_ioctl(struct drm_device *dev,
 int vgem_fence_open(struct vgem_file *vfile)
 {
mutex_init(>fence_mutex);
-   idr_init(>fence_idr);
+   idr_init_base(>fence_idr, 1);
 
return 0;
 }
-- 
2.25.1



Re: [PATCH] drm/amdkfd: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
On Wed, Nov 04, 2020 at 03:01:17PM -0500, Felix Kuehling wrote:
> On 2020-11-04 10:13 a.m., Deepak R Varma wrote:
> > idr_init() uses base 0 which is an invalid identifier. The new function
> > idr_init_base allows IDR to set the ID lookup from base 1. This avoids
> > all lookups that otherwise starts from 0 since 0 is always unused.
> 
> I disagree. We call idr_alloc with start=0 for both these IDRs. That means 0
> seems to be a valid handle.

Hello Felix,
You are correct. There are calls made to idr_alloc with start range from
0. So, for this driver, id=0 seems a valid use case. The change I
proposed is not relevant for this driver. You may please ignore the
patch.

Thank you,
./drv

> 
> Regards,
>   Felix
> 
> 
> > 
> > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
> > 
> > Signed-off-by: Deepak R Varma 
> > ---
> >   drivers/gpu/drm/amd/amdkfd/kfd_events.c  | 2 +-
> >   drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c 
> > b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > index ba2c2ce0c55a..b3339b53c8ad 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> > @@ -230,7 +230,7 @@ static int create_other_event(struct kfd_process *p, 
> > struct kfd_event *ev)
> >   void kfd_event_init_process(struct kfd_process *p)
> >   {
> > mutex_init(>event_mutex);
> > -   idr_init(>event_idr);
> > +   idr_init_base(>event_idr, 1);
> > p->signal_page = NULL;
> > p->signal_event_count = 0;
> >   }
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c 
> > b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > index 65803e153a22..022e61babe30 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > @@ -1289,7 +1289,7 @@ struct kfd_process_device 
> > *kfd_create_process_device_data(struct kfd_dev *dev,
> > list_add(>per_device_list, >per_device_data);
> > /* Init idr used for memory handle translation */
> > -   idr_init(>alloc_idr);
> > +   idr_init_base(>alloc_idr, 1);
> > return pdd;


Re: [PATCH] drm/vgm: replace idr_init() by idr_init_base()

2020-11-05 Thread Deepak R Varma
On Thu, Nov 05, 2020 at 10:42:15AM +0100, Daniel Vetter wrote:
> On Wed, Nov 04, 2020 at 04:53:38PM +0530, Deepak R Varma wrote:
> > idr_init() uses base 0 which is an invalid identifier. The new function
> > idr_init_base allows IDR to set the ID lookup from base 1. This avoids
> > all lookups that otherwise starts from 0 since 0 is always unused.
> > 
> > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
> > 
> > Signed-off-by: Deepak R Varma 
> 
> Tiny typo in the commit message summary: s/vgm/vgem/
> 
> Also can you pls resbumit this with intel-gfx mailing list on cc (like for
> i915)? There's a CI bot there which runs a few vgem tests, would be good
> to confirm nothing has been broken.

Hi Daniel,
sure. I will correct the summary typo and also feed it to the CI bot.

Also, according to Felix Kuehling's comment on a similar patch for
drm/amdkfd driver, an ID can be 0. The change I am proposing is more
efficient for conditions that do not want to use ID as 0. Otherwise,
id = 0 is an acceptable possibility. So, my statement that "Id 0 is an invalid
identifier" is not true.

Can you please comment if this is accurate and I should reword my log
message as well?

Thank you.
./drv

> 
> Otherwise lgtm.
> 
> Thanks, Daniel
> 
> > ---
> >  drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c 
> > b/drivers/gpu/drm/vgem/vgem_fence.c
> > index 17f32f550dd9..2902dc6e64fa 100644
> > --- a/drivers/gpu/drm/vgem/vgem_fence.c
> > +++ b/drivers/gpu/drm/vgem/vgem_fence.c
> > @@ -233,7 +233,7 @@ int vgem_fence_signal_ioctl(struct drm_device *dev,
> >  int vgem_fence_open(struct vgem_file *vfile)
> >  {
> > mutex_init(>fence_mutex);
> > -   idr_init(>fence_idr);
> > +   idr_init_base(>fence_idr, 1);
> >  
> > return 0;
> >  }
> > -- 
> > 2.25.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


[PATCH] drm/amdgpu: replace idr_init() by idr_init_base()

2020-11-04 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier. The new function
idr_init_base allows IDR to set the ID lookup from base 1. This avoids
all lookups that otherwise starts from 0 since 0 is always unused.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index c80d8339f58c..b98ae173a9de 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -576,7 +576,7 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
 void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
 {
mutex_init(>lock);
-   idr_init(>ctx_handles);
+   idr_init_base(>ctx_handles, 1);
 }
 
 long amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr, long timeout)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index efda38349a03..d65a1888683b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1052,7 +1052,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
}
 
mutex_init(>bo_list_lock);
-   idr_init(>bo_list_handles);
+   idr_init_base(>bo_list_handles, 1);
 
amdgpu_ctx_mgr_init(>ctx_mgr);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index df110afa97bf..0154282771c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -3199,7 +3199,7 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev)
adev->vm_manager.vm_update_mode = 0;
 #endif
 
-   idr_init(>vm_manager.pasid_idr);
+   idr_init_base(>vm_manager.pasid_idr, 1);
spin_lock_init(>vm_manager.pasid_lock);
 }
 
-- 
2.25.1



[PATCH] drm/amdkfd: replace idr_init() by idr_init_base()

2020-11-04 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier. The new function
idr_init_base allows IDR to set the ID lookup from base 1. This avoids
all lookups that otherwise starts from 0 since 0 is always unused.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c  | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index ba2c2ce0c55a..b3339b53c8ad 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -230,7 +230,7 @@ static int create_other_event(struct kfd_process *p, struct 
kfd_event *ev)
 void kfd_event_init_process(struct kfd_process *p)
 {
mutex_init(>event_mutex);
-   idr_init(>event_idr);
+   idr_init_base(>event_idr, 1);
p->signal_page = NULL;
p->signal_event_count = 0;
 }
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 65803e153a22..022e61babe30 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -1289,7 +1289,7 @@ struct kfd_process_device 
*kfd_create_process_device_data(struct kfd_dev *dev,
list_add(>per_device_list, >per_device_data);
 
/* Init idr used for memory handle translation */
-   idr_init(>alloc_idr);
+   idr_init_base(>alloc_idr, 1);
 
return pdd;
 
-- 
2.25.1



[PATCH] drm/i915/perf: replace idr_init() by idr_init_base()

2020-11-04 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier. The new function
idr_init_base allows IDR to set the ID lookup from base 1. This avoids
all lookups that otherwise starts from 0 since 0 is always unused.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/i915/i915_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index e94976976571..2d033255b7cf 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -4367,7 +4367,7 @@ void i915_perf_init(struct drm_i915_private *i915)
RUNTIME_INFO(i915)->cs_timestamp_frequency_hz / 2;
 
mutex_init(>metrics_lock);
-   idr_init(>metrics_idr);
+   idr_init_base(>metrics_idr, 1);
 
/* We set up some ratelimit state to potentially throttle any
 * _NOTES about spurious, invalid OA reports which we don't
-- 
2.25.1



[PATCH] drm/i915/gvt: replace idr_init() by idr_init_base()

2020-11-04 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier. The new function
idr_init_base allows IDR to set the ID lookup from base 1. This avoids
all lookups that otherwise starts from 0 since 0 is always unused.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/i915/gvt/gvt.c  | 2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
index c7c561237883..45b492edbb19 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.c
+++ b/drivers/gpu/drm/i915/gvt/gvt.c
@@ -312,7 +312,7 @@ int intel_gvt_init_device(struct drm_i915_private *i915)
 
gvt_dbg_core("init gvt device\n");
 
-   idr_init(>vgpu_idr);
+   idr_init_base(>vgpu_idr, 1);
spin_lock_init(>scheduler.mmio_context_lock);
mutex_init(>lock);
mutex_init(>sched_lock);
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index f6d7e33c7099..1c8e63f84134 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -393,7 +393,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct 
intel_gvt *gvt,
mutex_init(>dmabuf_lock);
INIT_LIST_HEAD(>dmabuf_obj_list_head);
INIT_RADIX_TREE(>page_track_tree, GFP_KERNEL);
-   idr_init(>object_idr);
+   idr_init_base(>object_idr, 1);
intel_vgpu_init_cfg_space(vgpu, param->primary);
vgpu->d3_entered = false;
 
-- 
2.25.1



[PATCH] drm/vgm: replace idr_init() by idr_init_base()

2020-11-04 Thread Deepak R Varma
idr_init() uses base 0 which is an invalid identifier. The new function
idr_init_base allows IDR to set the ID lookup from base 1. This avoids
all lookups that otherwise starts from 0 since 0 is always unused.

References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/vgem_fence.c 
b/drivers/gpu/drm/vgem/vgem_fence.c
index 17f32f550dd9..2902dc6e64fa 100644
--- a/drivers/gpu/drm/vgem/vgem_fence.c
+++ b/drivers/gpu/drm/vgem/vgem_fence.c
@@ -233,7 +233,7 @@ int vgem_fence_signal_ioctl(struct drm_device *dev,
 int vgem_fence_open(struct vgem_file *vfile)
 {
mutex_init(>fence_mutex);
-   idr_init(>fence_idr);
+   idr_init_base(>fence_idr, 1);
 
return 0;
 }
-- 
2.25.1



[PATCH 6/6] drm/amdgpu: use "*" adjacent to data name

2020-11-02 Thread Deepak R Varma
When declaring pointer data, the "*" symbol should be used adjacent to
the data name as per the coding standards. This resolves following
issues reported by checkpatch script:
ERROR: "foo *   bar" should be "foo *bar"
ERROR: "foo * bar" should be "foo *bar"
ERROR: "foo*bar" should be "foo *bar"
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/atom.c | 16 
 drivers/gpu/drm/amd/amdgpu/atombios_i2c.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |  4 ++--
 drivers/gpu/drm/amd/amdgpu/mes_v10_1.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c|  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c 
b/drivers/gpu/drm/amd/amdgpu/atom.c
index 46c00ee580b1..515890f4f5a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -67,8 +67,8 @@ typedef struct {
 } atom_exec_context;
 
 int amdgpu_atom_debug;
-static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int 
index, uint32_t * params);
-int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t * 
params);
+static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int 
index, uint32_t *params);
+int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t 
*params);
 
 static uint32_t atom_arg_mask[8] =
{ 0x, 0x, 0x00, 0x, 0xFF, 0xFF00, 0xFF,
@@ -1201,7 +1201,7 @@ static struct {
atom_op_div32, ATOM_ARG_WS},
 };
 
-static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int 
index, uint32_t * params)
+static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int 
index, uint32_t *params)
 {
int base = CU16(ctx->cmd_table + 4 + 2 * index);
int len, ws, ps, ptr;
@@ -1262,7 +1262,7 @@ static int amdgpu_atom_execute_table_locked(struct 
atom_context *ctx, int index,
return ret;
 }
 
-int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t * 
params)
+int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t 
*params)
 {
int r;
 
@@ -1388,8 +1388,8 @@ void amdgpu_atom_destroy(struct atom_context *ctx)
 }
 
 bool amdgpu_atom_parse_data_header(struct atom_context *ctx, int index,
-   uint16_t * size, uint8_t * frev, uint8_t * crev,
-   uint16_t * data_start)
+   uint16_t *size, uint8_t *frev, uint8_t *crev,
+   uint16_t *data_start)
 {
int offset = index * 2 + 4;
int idx = CU16(ctx->data_table + offset);
@@ -1408,8 +1408,8 @@ bool amdgpu_atom_parse_data_header(struct atom_context 
*ctx, int index,
return true;
 }
 
-bool amdgpu_atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t 
* frev,
-  uint8_t * crev)
+bool amdgpu_atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t 
*frev,
+  uint8_t *crev)
 {
int offset = index * 2 + 4;
int idx = CU16(ctx->cmd_table + offset);
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c 
b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
index 09a538465ffd..af0335535f82 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
@@ -159,7 +159,7 @@ u32 amdgpu_atombios_i2c_func(struct i2c_adapter *adap)
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
 }
 
-void amdgpu_atombios_i2c_channel_trans(struct amdgpu_device* adev, u8 
slave_addr, u8 line_number, u8 offset, u8 data)
+void amdgpu_atombios_i2c_channel_trans(struct amdgpu_device *adev, u8 
slave_addr, u8 line_number, u8 offset, u8 data)
 {
PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION args;
int index = GetIndexIntoMasterTable(COMMAND, 
ProcessI2cChannelTransaction);
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 48f98c750956..e96ab5325af5 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -5167,7 +5167,7 @@ static void gfx_v9_0_ring_set_wptr_gfx(struct amdgpu_ring 
*ring)
 
if (ring->use_doorbell) {
/* XXX check if swapping is necessary on BE */
-   atomic64_set((atomic64_t*)>wb.wb[ring->wptr_offs], 
ring->wptr);
+   atomic64_set((atomic64_t *)>wb.wb[ring->wptr_offs], 
ring->wptr);
WDOORBELL64(ring->doorbell_index, ring->wptr);
} else {
WREG32_SOC15(GC, 0, mmCP_RB0_WPTR, lower_32_bits(ring->wptr));
@@ -5353,7 +5353,7 @@ static void gfx_v9_0_ring_set_wptr_compute(struct 
amdgpu_ring *ring)
 
/* XXX check if swapping is necessary on BE */
if (ring->use_doorbell) {
- 

[PATCH 5/6] drm/amdgpu/amdgpu: use "*" adjacent to data name

2020-11-02 Thread Deepak R Varma
When declaring pointer data, the "*" symbol should be used adjacent to
the data name as per the coding standards. This resolves following
issues reported by checkpatch script:
ERROR: "foo *   bar" should be "foo *bar"
ERROR: "foo * bar" should be "foo *bar"
ERROR: "foo*bar" should be "foo *bar"
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c  | 14 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c |  8 
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  |  6 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c|  4 ++--
 9 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
index 469352e2d6ec..86add0f4ea4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
@@ -1401,7 +1401,7 @@ static ATOM_VOLTAGE_OBJECT_V3 
*amdgpu_atombios_lookup_voltage_object_v3(ATOM_VOL
 {
u32 size = le16_to_cpu(v3->sHeader.usStructureSize);
u32 offset = offsetof(ATOM_VOLTAGE_OBJECT_INFO_V3_1, asVoltageObj[0]);
-   u8 *start = (u8*)v3;
+   u8 *start = (u8 *)v3;
 
while (offset < size) {
ATOM_VOLTAGE_OBJECT_V3 *vo = (ATOM_VOLTAGE_OBJECT_V3 *)(start + 
offset);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
index b4df6460e45a..70da779a4ba7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
@@ -70,7 +70,7 @@ int amdgpu_atomfirmware_allocate_fb_scratch(struct 
amdgpu_device *adev)
struct atom_context *ctx = adev->mode_info.atom_context;
int index = 
get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
vram_usagebyfirmware);
-   struct vram_usagebyfirmware_v2_1 *  firmware_usage;
+   struct vram_usagebyfirmware_v2_1 *firmware_usage;
uint32_t start_addr, size;
uint16_t data_offset;
int usage_bytes = 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 309464a8c06b..79342976fa76 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1461,7 +1461,7 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device 
*dev, void *data,
dma_fence_put(fence);
if (r)
return r;
-   r = drm_syncobj_get_fd(syncobj, (int*)>out.handle);
+   r = drm_syncobj_get_fd(syncobj, (int *)>out.handle);
drm_syncobj_put(syncobj);
return r;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index c80d8339f58c..6efdd5f6427e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -450,7 +450,7 @@ int amdgpu_ctx_put(struct amdgpu_ctx *ctx)
 
 void amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx,
  struct drm_sched_entity *entity,
- struct dma_fence *fence, uint64_t* handle)
+ struct dma_fence *fence, uint64_t *handle)
 {
struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity);
uint64_t seq = centity->sequence;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index c3b1b27df153..73f563b65a15 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -806,7 +806,7 @@ int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t 
*hive_id)
struct ta_xgmi_shared_memory *xgmi_cmd;
int ret;
 
-   xgmi_cmd = (struct 
ta_xgmi_shared_memory*)psp->xgmi_context.xgmi_shared_buf;
+   xgmi_cmd = (struct ta_xgmi_shared_memory 
*)psp->xgmi_context.xgmi_shared_buf;
memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
 
xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
@@ -826,7 +826,7 @@ int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t 
*node_id)
struct ta_xgmi_shared_memory *xgmi_cmd;
int ret;
 
-   xgmi_cmd = (struct 
ta_xgmi_shared_memory*)psp->xgmi_context.xgmi_shared_buf;
+   xgmi_cmd = (struct ta_xgmi_shared_memory 
*)psp->xgmi_context.xgmi_shared_buf;
memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
 

[PATCH 4/6] drm/amdgpu/sdma: use "*" adjacent to data name

2020-11-02 Thread Deepak R Varma
When declaring pointer data, the "*" symbol should be used adjacent to
the data name as per the coding standards. This resolves following
issues reported by checkpatch script:
ERROR: "foo *   bar" should be "foo *bar"
ERROR: "foo * bar" should be "foo *bar"
ERROR: "foo*bar" should be "foo *bar"
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 6 +++---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index 86fb1eddf5a6..d1150c33d02e 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -568,7 +568,7 @@ static void sdma_v4_0_destroy_inst_ctx(struct amdgpu_device 
*adev)
break;
}
 
-   memset((void*)adev->sdma.instance, 0,
+   memset((void *)adev->sdma.instance, 0,
sizeof(struct amdgpu_sdma_instance) * 
AMDGPU_MAX_SDMA_INSTANCES);
 }
 
@@ -639,8 +639,8 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device 
*adev)
if (adev->asic_type == CHIP_ARCTURUS) {
/* Acturus will leverage the same FW memory
   for every SDMA instance */
-   memcpy((void*)>sdma.instance[i],
-  (void*)>sdma.instance[0],
+   memcpy((void *)>sdma.instance[i],
+  (void *)>sdma.instance[0],
   sizeof(struct amdgpu_sdma_instance));
}
else {
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 9f3952723c63..90c47f1801fd 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -124,7 +124,7 @@ static void sdma_v5_2_destroy_inst_ctx(struct amdgpu_device 
*adev)
break;
}
 
-   memset((void*)adev->sdma.instance, 0,
+   memset((void *)adev->sdma.instance, 0,
   sizeof(struct amdgpu_sdma_instance) * AMDGPU_MAX_SDMA_INSTANCES);
 }
 
@@ -177,8 +177,8 @@ static int sdma_v5_2_init_microcode(struct amdgpu_device 
*adev)
for (i = 1; i < adev->sdma.num_instances; i++) {
if (adev->asic_type == CHIP_SIENNA_CICHLID ||
adev->asic_type == CHIP_NAVY_FLOUNDER) {
-   memcpy((void*)>sdma.instance[i],
-  (void*)>sdma.instance[0],
+   memcpy((void *)>sdma.instance[i],
+  (void *)>sdma.instance[0],
   sizeof(struct amdgpu_sdma_instance));
} else {
snprintf(fw_name, sizeof(fw_name), 
"amdgpu/%s_sdma%d.bin", chip_name, i);
-- 
2.25.1



[PATCH 3/6] drm/amdgpu/jpeg: use "*" adjacent to data name

2020-11-02 Thread Deepak R Varma
When declaring pointer data, the "*" symbol should be used adjacent to
the data name as per the coding standards. This resolves following
issues reported by checkpatch script:
ERROR: "foo *   bar" should be "foo *bar"
ERROR: "foo * bar" should be "foo *bar"
ERROR: "foo*bar" should be "foo *bar"
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 6 +++---
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c 
b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
index 7b1a18cbafc4..6b80dcea80ec 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
@@ -247,7 +247,7 @@ static int jpeg_v2_0_disable_power_gating(struct 
amdgpu_device *adev)
return 0;
 }
 
-static int jpeg_v2_0_enable_power_gating(struct amdgpu_device* adev)
+static int jpeg_v2_0_enable_power_gating(struct amdgpu_device *adev)
 {
if (adev->pg_flags & AMD_PG_SUPPORT_JPEG) {
uint32_t data;
@@ -274,7 +274,7 @@ static int jpeg_v2_0_enable_power_gating(struct 
amdgpu_device* adev)
return 0;
 }
 
-static void jpeg_v2_0_disable_clock_gating(struct amdgpu_device* adev)
+static void jpeg_v2_0_disable_clock_gating(struct amdgpu_device *adev)
 {
uint32_t data;
 
@@ -297,7 +297,7 @@ static void jpeg_v2_0_disable_clock_gating(struct 
amdgpu_device* adev)
WREG32_SOC15(JPEG, 0, mmJPEG_CGC_GATE, data);
 }
 
-static void jpeg_v2_0_enable_clock_gating(struct amdgpu_device* adev)
+static void jpeg_v2_0_enable_clock_gating(struct amdgpu_device *adev)
 {
uint32_t data;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c 
b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
index 845306f63cdb..c6724a0e0c43 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
@@ -247,7 +247,7 @@ static int jpeg_v2_5_resume(void *handle)
return r;
 }
 
-static void jpeg_v2_5_disable_clock_gating(struct amdgpu_device* adev, int 
inst)
+static void jpeg_v2_5_disable_clock_gating(struct amdgpu_device *adev, int 
inst)
 {
uint32_t data;
 
@@ -276,7 +276,7 @@ static void jpeg_v2_5_disable_clock_gating(struct 
amdgpu_device* adev, int inst)
WREG32_SOC15(JPEG, inst, mmJPEG_CGC_CTRL, data);
 }
 
-static void jpeg_v2_5_enable_clock_gating(struct amdgpu_device* adev, int inst)
+static void jpeg_v2_5_enable_clock_gating(struct amdgpu_device *adev, int inst)
 {
uint32_t data;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
index 3a0dff53654d..e8fbb2a0de34 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c
@@ -213,7 +213,7 @@ static int jpeg_v3_0_resume(void *handle)
return r;
 }
 
-static void jpeg_v3_0_disable_clock_gating(struct amdgpu_device* adev)
+static void jpeg_v3_0_disable_clock_gating(struct amdgpu_device *adev)
 {
uint32_t data = 0;
 
@@ -243,7 +243,7 @@ static void jpeg_v3_0_disable_clock_gating(struct 
amdgpu_device* adev)
WREG32_SOC15(JPEG, 0, mmJPEG_CGC_CTRL, data);
 }
 
-static void jpeg_v3_0_enable_clock_gating(struct amdgpu_device* adev)
+static void jpeg_v3_0_enable_clock_gating(struct amdgpu_device *adev)
 {
uint32_t data = 0;
 
@@ -286,7 +286,7 @@ static int jpeg_v3_0_disable_static_power_gating(struct 
amdgpu_device *adev)
return 0;
 }
 
-static int jpeg_v3_0_enable_static_power_gating(struct amdgpu_device* adev)
+static int jpeg_v3_0_enable_static_power_gating(struct amdgpu_device *adev)
 {
/* enable anti hang mechanism */
WREG32_P(SOC15_REG_OFFSET(JPEG, 0, mmUVD_JPEG_POWER_STATUS),
-- 
2.25.1



[PATCH 2/6] drm/amdgpu/umc: use "*" adjacent to data name

2020-11-02 Thread Deepak R Varma
When declaring pointer data, the "*" symbol should be used adjacent to
the data name as per the coding standards. This resolves following
issues reported by checkpatch script:
ERROR: "foo *   bar" should be "foo *bar"
ERROR: "foo * bar" should be "foo *bar"
ERROR: "foo*bar" should be "foo *bar"
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/umc_v6_1.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/umc_v8_7.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c 
b/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c
index 5288617ca552..96d7769609f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v6_1.c
@@ -253,7 +253,7 @@ static void 
umc_v6_1_querry_uncorrectable_error_count(struct amdgpu_device *adev
 static void umc_v6_1_query_ras_error_count(struct amdgpu_device *adev,
   void *ras_error_status)
 {
-   struct ras_err_data* err_data = (struct ras_err_data*)ras_error_status;
+   struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
 
uint32_t umc_inst= 0;
uint32_t ch_inst = 0;
@@ -368,7 +368,7 @@ static void umc_v6_1_query_error_address(struct 
amdgpu_device *adev,
 static void umc_v6_1_query_ras_error_address(struct amdgpu_device *adev,
 void *ras_error_status)
 {
-   struct ras_err_data* err_data = (struct ras_err_data*)ras_error_status;
+   struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
 
uint32_t umc_inst= 0;
uint32_t ch_inst = 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c 
b/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c
index 5665c77a9d58..a064c097690c 100644
--- a/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v8_7.c
@@ -170,7 +170,7 @@ static void 
umc_v8_7_querry_uncorrectable_error_count(struct amdgpu_device *adev
 static void umc_v8_7_query_ras_error_count(struct amdgpu_device *adev,
   void *ras_error_status)
 {
-   struct ras_err_data* err_data = (struct ras_err_data*)ras_error_status;
+   struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
 
uint32_t umc_inst= 0;
uint32_t ch_inst = 0;
@@ -260,7 +260,7 @@ static void umc_v8_7_query_error_address(struct 
amdgpu_device *adev,
 static void umc_v8_7_query_ras_error_address(struct amdgpu_device *adev,
 void *ras_error_status)
 {
-   struct ras_err_data* err_data = (struct ras_err_data*)ras_error_status;
+   struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
 
uint32_t umc_inst= 0;
uint32_t ch_inst = 0;
-- 
2.25.1



[PATCH 1/6] drm/amdgpu/vcn: use "*" adjacent to data name

2020-11-02 Thread Deepak R Varma
When declaring pointer data, the "*" symbol should be used adjacent to
the data name as per the coding style standards. This resolves following
issues reported by checkpatch script:
ERROR: "foo *   bar" should be "foo *bar"
ERROR: "foo * bar" should be "foo *bar"
ERROR: "foo*bar" should be "foo *bar"
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 136270e4af7b..e285f9c9d460 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -800,7 +800,7 @@ static int vcn_v2_0_start_dpg_mode(struct amdgpu_device 
*adev, bool indirect)
WREG32_SOC15(UVD, 0, mmUVD_POWER_STATUS, tmp);
 
if (indirect)
-   adev->vcn.inst->dpg_sram_curr_addr = 
(uint32_t*)adev->vcn.inst->dpg_sram_cpu_addr;
+   adev->vcn.inst->dpg_sram_curr_addr = (uint32_t 
*)adev->vcn.inst->dpg_sram_cpu_addr;
 
/* enable clock gating */
vcn_v2_0_clock_gating_dpg_mode(adev, 0, indirect);
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
index 4094718ae27a..b6e0f4ba6272 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
@@ -777,7 +777,7 @@ static int vcn_v2_5_start_dpg_mode(struct amdgpu_device 
*adev, int inst_idx, boo
WREG32_SOC15(VCN, inst_idx, mmUVD_POWER_STATUS, tmp);
 
if (indirect)
-   adev->vcn.inst[inst_idx].dpg_sram_curr_addr = 
(uint32_t*)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr;
+   adev->vcn.inst[inst_idx].dpg_sram_curr_addr = (uint32_t 
*)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr;
 
/* enable clock gating */
vcn_v2_5_clock_gating_dpg_mode(adev, 0, inst_idx, indirect);
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index 13e511d77bb1..749bf9503470 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -915,7 +915,7 @@ static int vcn_v3_0_start_dpg_mode(struct amdgpu_device 
*adev, int inst_idx, boo
WREG32_SOC15(VCN, inst_idx, mmUVD_POWER_STATUS, tmp);
 
if (indirect)
-   adev->vcn.inst[inst_idx].dpg_sram_curr_addr = 
(uint32_t*)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr;
+   adev->vcn.inst[inst_idx].dpg_sram_curr_addr = (uint32_t 
*)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr;
 
/* enable clock gating */
vcn_v3_0_clock_gating_dpg_mode(adev, 0, inst_idx, indirect);
-- 
2.25.1



[PATCH] drm/amdgpu: do not initialise global variables to 0 or NULL

2020-11-02 Thread Deepak R Varma
Initializing global variable to 0 or NULL is not necessary and should
be avoided. Issue reported by checkpatch script as:
ERROR: do not initialise globals to 0 (or NULL).

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 46 -
 drivers/gpu/drm/amd/amdgpu/atom.c   |  4 +--
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 8ab6126ff70c..6de94c46bc91 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -94,16 +94,16 @@
 #define KMS_DRIVER_MINOR   40
 #define KMS_DRIVER_PATCHLEVEL  0
 
-int amdgpu_vram_limit = 0;
-int amdgpu_vis_vram_limit = 0;
+int amdgpu_vram_limit;
+int amdgpu_vis_vram_limit;
 int amdgpu_gart_size = -1; /* auto */
 int amdgpu_gtt_size = -1; /* auto */
 int amdgpu_moverate = -1; /* auto */
-int amdgpu_benchmarking = 0;
-int amdgpu_testing = 0;
+int amdgpu_benchmarking;
+int amdgpu_testing;
 int amdgpu_audio = -1;
-int amdgpu_disp_priority = 0;
-int amdgpu_hw_i2c = 0;
+int amdgpu_disp_priority;
+int amdgpu_hw_i2c;
 int amdgpu_pcie_gen2 = -1;
 int amdgpu_msi = -1;
 char amdgpu_lockup_timeout[AMDGPU_MAX_TIMEOUT_PARAM_LENGTH];
@@ -113,43 +113,43 @@ int amdgpu_aspm = -1;
 int amdgpu_runtime_pm = -1;
 uint amdgpu_ip_block_mask = 0x;
 int amdgpu_bapm = -1;
-int amdgpu_deep_color = 0;
+int amdgpu_deep_color;
 int amdgpu_vm_size = -1;
 int amdgpu_vm_fragment_size = -1;
 int amdgpu_vm_block_size = -1;
-int amdgpu_vm_fault_stop = 0;
-int amdgpu_vm_debug = 0;
+int amdgpu_vm_fault_stop;
+int amdgpu_vm_debug;
 int amdgpu_vm_update_mode = -1;
-int amdgpu_exp_hw_support = 0;
+int amdgpu_exp_hw_support;
 int amdgpu_dc = -1;
 int amdgpu_sched_jobs = 32;
 int amdgpu_sched_hw_submission = 2;
-uint amdgpu_pcie_gen_cap = 0;
-uint amdgpu_pcie_lane_cap = 0;
+uint amdgpu_pcie_gen_cap;
+uint amdgpu_pcie_lane_cap;
 uint amdgpu_cg_mask = 0x;
 uint amdgpu_pg_mask = 0x;
 uint amdgpu_sdma_phase_quantum = 32;
-char *amdgpu_disable_cu = NULL;
-char *amdgpu_virtual_display = NULL;
+char *amdgpu_disable_cu;
+char *amdgpu_virtual_display;
 /* OverDrive(bit 14) disabled by default*/
 uint amdgpu_pp_feature_mask = 0xbfff;
-uint amdgpu_force_long_training = 0;
-int amdgpu_job_hang_limit = 0;
+uint amdgpu_force_long_training;
+int amdgpu_job_hang_limit;
 int amdgpu_lbpw = -1;
 int amdgpu_compute_multipipe = -1;
 int amdgpu_gpu_recovery = -1; /* auto */
-int amdgpu_emu_mode = 0;
-uint amdgpu_smu_memory_pool_size = 0;
+int amdgpu_emu_mode;
+uint amdgpu_smu_memory_pool_size;
 /* FBC (bit 0) disabled by default*/
-uint amdgpu_dc_feature_mask = 0;
-uint amdgpu_dc_debug_mask = 0;
+uint amdgpu_dc_feature_mask;
+uint amdgpu_dc_debug_mask;
 int amdgpu_async_gfx_ring = 1;
-int amdgpu_mcbp = 0;
+int amdgpu_mcbp;
 int amdgpu_discovery = -1;
-int amdgpu_mes = 0;
+int amdgpu_mes;
 int amdgpu_noretry = -1;
 int amdgpu_force_asic_type = -1;
-int amdgpu_tmz = 0;
+int amdgpu_tmz;
 int amdgpu_reset_method = -1; /* auto */
 int amdgpu_num_kcq = -1;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c 
b/drivers/gpu/drm/amd/amdgpu/atom.c
index 696e97ab77eb..46c00ee580b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -66,7 +66,7 @@ typedef struct {
bool abort;
 } atom_exec_context;
 
-int amdgpu_atom_debug = 0;
+int amdgpu_atom_debug;
 static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int 
index, uint32_t * params);
 int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t * 
params);
 
@@ -88,7 +88,7 @@ static int atom_dst_to_src[8][4] = {
 };
 static int atom_def_dst[8] = { 0, 0, 1, 2, 0, 1, 2, 3 };
 
-static int debug_depth = 0;
+static int debug_depth;
 #ifdef ATOM_DEBUG
 static void debug_print_spaces(int n)
 {
-- 
2.25.1



[PATCH 6/6] drm/amdgpu: improve code indentation and alignment

2020-11-02 Thread Deepak R Varma
General code indentation and alignment changes such as replace spaces
by tabs or align function arguments as per the coding style
guidelines. The patch covers various .c files for this driver.
Issue reported by checkpatch script.

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/atom.c   | 4 ++--
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/df_v1_7.c| 2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c  | 2 +-
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c  | 8 
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/si.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/si_ih.c  | 2 +-
 drivers/gpu/drm/amd/amdgpu/soc15.c  | 2 +-
 9 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c 
b/drivers/gpu/drm/amd/amdgpu/atom.c
index 4cfc786699c7..696e97ab77eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -71,8 +71,8 @@ static int amdgpu_atom_execute_table_locked(struct 
atom_context *ctx, int index,
 int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t * 
params);
 
 static uint32_t atom_arg_mask[8] =
-{ 0x, 0x, 0x00, 0x, 0xFF, 0xFF00, 0xFF,
-0xFF00 };
+   { 0x, 0x, 0x00, 0x, 0xFF, 0xFF00, 0xFF,
+ 0xFF00 };
 static int atom_arg_shift[8] = { 0, 0, 8, 16, 0, 8, 16, 24 };
 
 static int atom_dst_to_src[8][4] = {
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index 20f108818b2b..52f05d2f5ed9 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -195,7 +195,7 @@ static void cik_sdma_ring_set_wptr(struct amdgpu_ring *ring)
struct amdgpu_device *adev = ring->adev;
 
WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[ring->me],
-   (lower_32_bits(ring->wptr) << 2) & 0x3fffc);
+  (lower_32_bits(ring->wptr) << 2) & 0x3fffc);
 }
 
 static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
diff --git a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c 
b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
index d6aca1c08068..2d01ac0d4c11 100644
--- a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
+++ b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
@@ -41,7 +41,7 @@ static void df_v1_7_sw_fini(struct amdgpu_device *adev)
 }
 
 static void df_v1_7_enable_broadcast_mode(struct amdgpu_device *adev,
-  bool enable)
+ bool enable)
 {
u32 tmp;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index dbc8b76b9b78..6b04729d8fec 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -145,7 +145,7 @@ static const struct amdgpu_irq_src_funcs 
gmc_v10_0_ecc_funcs = {
.process = amdgpu_umc_process_ecc_irq,
 };
 
- static void gmc_v10_0_set_irq_funcs(struct amdgpu_device *adev)
+static void gmc_v10_0_set_irq_funcs(struct amdgpu_device *adev)
 {
adev->gmc.vm_fault.num_types = 1;
adev->gmc.vm_fault.funcs = _v10_0_irq_funcs;
diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c 
b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
index 94caf5204c8b..7b1a18cbafc4 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
@@ -32,19 +32,19 @@
 #include "vcn/vcn_2_0_0_sh_mask.h"
 #include "ivsrcid/vcn/irqsrcs_vcn_2_0.h"
 
-#define mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET0x1bfff
+#define mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET
0x1bfff
 #define mmUVD_JPEG_GPCOM_CMD_INTERNAL_OFFSET   0x4029
 #define mmUVD_JPEG_GPCOM_DATA0_INTERNAL_OFFSET 0x402a
 #define mmUVD_JPEG_GPCOM_DATA1_INTERNAL_OFFSET 0x402b
 #define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40ea
-#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_HIGH_INTERNAL_OFFSET0x40eb
+#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_HIGH_INTERNAL_OFFSET
0x40eb
 #define mmUVD_LMI_JRBC_IB_VMID_INTERNAL_OFFSET 0x40cf
 #define mmUVD_LMI_JPEG_VMID_INTERNAL_OFFSET0x40d1
-#define mmUVD_LMI_JRBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET0x40e8
+#define mmUVD_LMI_JRBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET
0x40e8
 #define mmUVD_LMI_JRBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET   0x40e9
 #define mmUVD_JRBC_IB_SIZE_INTERNAL_OFFSET 0x4082
 #define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40ec
-#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH_INTERNAL_OFFSET0x40ed
+#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH_INTERNAL_OFFSET
0x40ed
 #define mmUVD_JRBC_RB_COND_R

[PATCH 5/6] drm/amdgpu/amdgpu: improve code indentation and alignment

2020-11-02 Thread Deepak R Varma
General code indentation and alignment changes such as replace spaces
by tabs or align function arguments as per the coding style
guidelines. The patch corrects issues for various amdgpu_*.c files
for this driver. Issue reported by checkpatch script.

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c   | 22 +--
 .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c  | 20 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   | 12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   | 18 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c   | 10 -
 .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c| 16 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c   | 14 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.c  |  2 +-
 13 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
index d3e51d361179..1400957034a1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
@@ -36,17 +36,17 @@
 
 #include "acp_gfx_if.h"
 
-#define ACP_TILE_ON_MASK   0x03
-#define ACP_TILE_OFF_MASK  0x02
-#define ACP_TILE_ON_RETAIN_REG_MASK0x1f
-#define ACP_TILE_OFF_RETAIN_REG_MASK   0x20
+#define ACP_TILE_ON_MASK   0x03
+#define ACP_TILE_OFF_MASK  0x02
+#define ACP_TILE_ON_RETAIN_REG_MASK0x1f
+#define ACP_TILE_OFF_RETAIN_REG_MASK   0x20
 
-#define ACP_TILE_P1_MASK   0x3e
-#define ACP_TILE_P2_MASK   0x3d
-#define ACP_TILE_DSP0_MASK 0x3b
-#define ACP_TILE_DSP1_MASK 0x37
+#define ACP_TILE_P1_MASK   0x3e
+#define ACP_TILE_P2_MASK   0x3d
+#define ACP_TILE_DSP0_MASK 0x3b
+#define ACP_TILE_DSP1_MASK 0x37
 
-#define ACP_TILE_DSP2_MASK 0x2f
+#define ACP_TILE_DSP2_MASK 0x2f
 
 #define ACP_DMA_REGS_END   0x146c0
 #define ACP_I2S_PLAY_REGS_START0x14840
@@ -75,8 +75,8 @@
 #define mmACP_CONTROL  0x5131
 #define mmACP_STATUS   0x5133
 #define mmACP_SOFT_RESET   0x5134
-#define ACP_CONTROL__ClkEn_MASK0x1
-#define ACP_SOFT_RESET__SoftResetAud_MASK  0x100
+#define ACP_CONTROL__ClkEn_MASK0x1
+#define ACP_SOFT_RESET__SoftResetAud_MASK  0x100
 #define ACP_SOFT_RESET__SoftResetAudDone_MASK  0x100
 #define ACP_CLOCK_EN_TIME_OUT_VALUE0x00FF
 #define ACP_SOFT_RESET_DONE_TIME_OUT_VALUE 0x00FF
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 5da487b64a66..3fee885f6ac8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1115,19 +1115,19 @@ void amdgpu_amdkfd_gpuvm_destroy_process_vm(struct 
kgd_dev *kgd, void *vm)
 void amdgpu_amdkfd_gpuvm_release_process_vm(struct kgd_dev *kgd, void *vm)
 {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
-struct amdgpu_vm *avm = (struct amdgpu_vm *)vm;
+   struct amdgpu_vm *avm = (struct amdgpu_vm *)vm;
 
if (WARN_ON(!kgd || !vm))
-return;
+   return;
 
-pr_debug("Releasing process vm %p\n", vm);
+   pr_debug("Releasing process vm %p\n", vm);
 
-/* The original pasid of amdgpu vm has already been
- * released during making a amdgpu vm to a compute vm
- * The current pasid is managed by kfd and will be
- * released on kfd process destroy. Set amdgpu pasid
- * to 0 to avoid duplicate release.
- */
+   /* The original pasid of amdgpu vm has already been
+* released during making a amdgpu vm to a compute vm
+* The current pasid is managed by kfd and will be
+* released on kfd process destroy. Set amdgpu pasid
+* to 0 to avoid duplicate release.
+*/
amdgpu_vm_release_compute(adev, avm);
 }
 
@@ -1694,7 +1694,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd,
 
INIT_LIST_HEAD(&(*mem)->bo_va_list);
mutex_init(&(*mem)->lock);
-   
+
(*mem)->alloc_flags =
((bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ?
KFD_IOC_ALLOC_MEM_FLAGS_VRAM : KFD_IOC_ALLOC_MEM_FLAGS_GTT)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/dri

[PATCH 4/6] drm/amdgpu/nbio: improve code indentation and alignment

2020-11-02 Thread Deepak R Varma
General code indentation and alignment changes such as replace spaces
by tabs or align function arguments as per the coding style
guidelines. Issue reported by checkpatch script.

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c 
b/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
index 7b2fb050407d..d2f1fe55d388 100644
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
@@ -32,7 +32,7 @@
 
 static u32 nbio_v6_1_get_rev_id(struct amdgpu_device *adev)
 {
-u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
+   u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
 
tmp &= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0_MASK;
tmp >>= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0__SHIFT;
@@ -114,7 +114,7 @@ static void 
nbio_v6_1_enable_doorbell_selfring_aperture(struct amdgpu_device *ad
 static void nbio_v6_1_ih_doorbell_range(struct amdgpu_device *adev,
bool use_doorbell, int doorbell_index)
 {
-   u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0 , mmBIF_IH_DOORBELL_RANGE);
+   u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0, mmBIF_IH_DOORBELL_RANGE);
 
if (use_doorbell) {
ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, 
BIF_IH_DOORBELL_RANGE, OFFSET, doorbell_index);
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c 
b/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c
index d34628e113fc..ae685813c419 100644
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c
@@ -43,7 +43,7 @@ static void nbio_v7_0_remap_hdp_registers(struct 
amdgpu_device *adev)
 
 static u32 nbio_v7_0_get_rev_id(struct amdgpu_device *adev)
 {
-u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
+   u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
 
tmp &= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0_MASK;
tmp >>= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0__SHIFT;
@@ -126,7 +126,7 @@ static void 
nbio_v7_0_enable_doorbell_selfring_aperture(struct amdgpu_device *ad
 static void nbio_v7_0_ih_doorbell_range(struct amdgpu_device *adev,
bool use_doorbell, int doorbell_index)
 {
-   u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0 , mmBIF_IH_DOORBELL_RANGE);
+   u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0, mmBIF_IH_DOORBELL_RANGE);
 
if (use_doorbell) {
ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, 
BIF_IH_DOORBELL_RANGE, OFFSET, doorbell_index);
-- 
2.25.1



[PATCH 3/6] drm/amdgpu/vcn: improve code indentation and alignment

2020-11-02 Thread Deepak R Varma
General code indentation and alignment changes such as replace spaces
by tabs or align function arguments as per the coding style
guidelines. Issue reported by checkpatch script.

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 10 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index e5d29dee0c88..136270e4af7b 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -45,7 +45,7 @@
 #define mmUVD_SCRATCH9_INTERNAL_OFFSET 0xc01d
 
 #define mmUVD_LMI_RBC_IB_VMID_INTERNAL_OFFSET  0x1e1
-#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET0x5a6
+#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET0x5a6
 #define mmUVD_LMI_RBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET 0x5a7
 #define mmUVD_RBC_IB_SIZE_INTERNAL_OFFSET  0x1e2
 
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
index 0f1d3ef8baa7..4094718ae27a 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
@@ -45,7 +45,7 @@
 
 #define mmUVD_LMI_RBC_IB_VMID_INTERNAL_OFFSET  0x431
 #define mmUVD_LMI_RBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET 0x3b4
-#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET0x3b5
+#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET0x3b5
 #define mmUVD_RBC_IB_SIZE_INTERNAL_OFFSET  0x25c
 
 #define VCN25_MAX_HW_INSTANCES_ARCTURUS2
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
index e074f7ed388c..13e511d77bb1 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
@@ -44,10 +44,10 @@
 
 #define mmUVD_LMI_RBC_IB_VMID_INTERNAL_OFFSET  0x431
 #define mmUVD_LMI_RBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET 0x3b4
-#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET0x3b5
+#define mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET0x3b5
 #define mmUVD_RBC_IB_SIZE_INTERNAL_OFFSET  0x25c
 
-#define VCN_INSTANCES_SIENNA_CICHLID   2
+#define VCN_INSTANCES_SIENNA_CICHLID   2
 
 static int amdgpu_ih_clientid_vcns[] = {
SOC15_IH_CLIENTID_VCN,
@@ -55,8 +55,8 @@ static int amdgpu_ih_clientid_vcns[] = {
 };
 
 static int amdgpu_ucode_id_vcns[] = {
-   AMDGPU_UCODE_ID_VCN,
-   AMDGPU_UCODE_ID_VCN1
+   AMDGPU_UCODE_ID_VCN,
+   AMDGPU_UCODE_ID_VCN1
 };
 
 static int vcn_v3_0_start_sriov(struct amdgpu_device *adev);
@@ -1371,7 +1371,7 @@ static int vcn_v3_0_start_sriov(struct amdgpu_device 
*adev)
}
 
/* Update init table header in memory */
-size = sizeof(struct mmsch_v3_0_init_header);
+   size = sizeof(struct mmsch_v3_0_init_header);
table_loc = (uint32_t *)table->cpu_addr;
memcpy((void *)table_loc, , size);
 
-- 
2.25.1



[PATCH 2/6] drm/amdgpu/gfx: improve code indentation and alignment

2020-11-02 Thread Deepak R Varma
General code indentation and alignment changes such as replace spaces
by tabs or align function arguments as per the coding style
guidelines. Issue reported by checkpatch script.

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 10 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 56fdbe626d30..987f9b6dbc3f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -3192,7 +3192,7 @@ static void gfx_v10_0_set_irq_funcs(struct amdgpu_device 
*adev);
 static void gfx_v10_0_set_gds_init(struct amdgpu_device *adev);
 static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev);
 static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev,
- struct amdgpu_cu_info *cu_info);
+struct amdgpu_cu_info *cu_info);
 static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev);
 static void gfx_v10_0_select_se_sh(struct amdgpu_device *adev, u32 se_num,
   u32 sh_num, u32 instance);
@@ -4200,10 +4200,10 @@ static void gfx_v10_0_read_wave_vgprs(struct 
amdgpu_device *adev, uint32_t simd,
 }
 
 static void gfx_v10_0_select_me_pipe_q(struct amdgpu_device *adev,
- u32 
me, u32 pipe, u32 q, u32 vm)
- {
-   nv_grbm_select(adev, me, pipe, q, vm);
- }
+  u32 me, u32 pipe, u32 q, u32 vm)
+{
+   nv_grbm_select(adev, me, pipe, q, vm);
+}
 
 
 static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs = {
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 94b7e0531d09..3e9a230f84df 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5058,7 +5058,7 @@ static int gfx_v8_0_pre_soft_reset(void *handle)
gfx_v8_0_cp_compute_enable(adev, false);
}
 
-   return 0;
+   return 0;
 }
 
 static int gfx_v8_0_soft_reset(void *handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 6959aebae6d4..48f98c750956 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -787,7 +787,7 @@ static void gfx_v9_0_set_irq_funcs(struct amdgpu_device 
*adev);
 static void gfx_v9_0_set_gds_init(struct amdgpu_device *adev);
 static void gfx_v9_0_set_rlc_funcs(struct amdgpu_device *adev);
 static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
- struct amdgpu_cu_info *cu_info);
+   struct amdgpu_cu_info *cu_info);
 static uint64_t gfx_v9_0_get_gpu_clock_counter(struct amdgpu_device *adev);
 static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring);
 static u64 gfx_v9_0_ring_get_rptr_compute(struct amdgpu_ring *ring);
-- 
2.25.1



[PATCH 1/6] drm/amdgpu/dce: improve code indentation and alignment

2020-11-02 Thread Deepak R Varma
General code indentation and alignment changes such as replace spaces
by tabs or align function arguments as per the coding style
guidelines. Issue reported by checkpatch script.

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c  | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 5963cbe0d455..00f8e60909b2 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2677,7 +2677,7 @@ static int dce_v10_0_crtc_set_base_atomic(struct drm_crtc 
*crtc,
 struct drm_framebuffer *fb,
 int x, int y, enum mode_set_atomic 
state)
 {
-   return dce_v10_0_crtc_do_set_base(crtc, fb, x, y, 1);
+   return dce_v10_0_crtc_do_set_base(crtc, fb, x, y, 1);
 }
 
 static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 1954472c8e8f..80036f7ce560 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2785,7 +2785,7 @@ static int dce_v11_0_crtc_set_base_atomic(struct drm_crtc 
*crtc,
 struct drm_framebuffer *fb,
 int x, int y, enum mode_set_atomic 
state)
 {
-   return dce_v11_0_crtc_do_set_base(crtc, fb, x, y, 1);
+   return dce_v11_0_crtc_do_set_base(crtc, fb, x, y, 1);
 }
 
 static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 3a44753a80d1..943976349346 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2567,7 +2567,7 @@ static int dce_v6_0_crtc_set_base_atomic(struct drm_crtc 
*crtc,
 struct drm_framebuffer *fb,
 int x, int y, enum mode_set_atomic 
state)
 {
-   return dce_v6_0_crtc_do_set_base(crtc, fb, x, y, 1);
+   return dce_v6_0_crtc_do_set_base(crtc, fb, x, y, 1);
 }
 
 static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 3603e5f13077..7973183fa335 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2498,7 +2498,7 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
case ATOM_PPLL2:
/* disable the ppll */
amdgpu_atombios_crtc_program_pll(crtc, amdgpu_crtc->crtc_id, 
amdgpu_crtc->pll_id,
- 0, 0, ATOM_DISABLE, 0, 0, 0, 
0, 0, false, );
+0, 0, ATOM_DISABLE, 0, 0, 0, 
0, 0, false, );
break;
case ATOM_PPLL0:
/* disable the ppll */
@@ -2585,7 +2585,7 @@ static int dce_v8_0_crtc_set_base_atomic(struct drm_crtc 
*crtc,
 struct drm_framebuffer *fb,
 int x, int y, enum mode_set_atomic 
state)
 {
-   return dce_v8_0_crtc_do_set_base(crtc, fb, x, y, 1);
+   return dce_v8_0_crtc_do_set_base(crtc, fb, x, y, 1);
 }
 
 static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
-- 
2.25.1



Re: [Outreachy kernel] [PATCH] drm/amdgpu: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-30 Thread Deepak R Varma
On Fri, Oct 30, 2020 at 10:24:57AM +0100, Daniel Vetter wrote:
> On Fri, Oct 30, 2020 at 10:15:21AM +0100, Daniel Vetter wrote:
> > On Fri, Oct 30, 2020 at 09:25:18AM +0100, Greg KH wrote:
> > > On Fri, Oct 30, 2020 at 09:00:04AM +0100, Christian König wrote:
> > > > Am 30.10.20 um 08:57 schrieb Deepak R Varma:
> > > > > On Fri, Oct 30, 2020 at 08:11:20AM +0100, Greg KH wrote:
> > > > > > On Fri, Oct 30, 2020 at 08:52:45AM +0530, Deepak R Varma wrote:
> > > > > > > Using DEFINE_DEBUGFS_ATTRIBUTE macro with 
> > > > > > > debugfs_create_file_unsafe()
> > > > > > > function in place of the debugfs_create_file() function will make 
> > > > > > > the
> > > > > > > file operation struct "reset" aware of the file's lifetime. 
> > > > > > > Additional
> > > > > > > details here: 
> > > > > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.archive.carbon60.com%2Flinux%2Fkernel%2F2369498data=04%7C01%7Cchristian.koenig%40amd.com%7Cddd7a6ac8164415a639708d87ca97004%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637396414464384011%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=o6GOHvMxNMuOPlC4nhDyURCHBLqfQZhYQq%2BiIMt3D3s%3Dreserved=0
> > > > > > > 
> > > > > > > Issue reported by Coccinelle script:
> > > > > > > scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
> > > > > > > 
> > > > > > > Signed-off-by: Deepak R Varma 
> > > > > > > ---
> > > > > > > Please Note: This is a Outreachy project task patch.
> > > > > > > 
> > > > > > >   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 20 
> > > > > > > ++--
> > > > > > >   1 file changed, 10 insertions(+), 10 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
> > > > > > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > > > > > index 2d125b8b15ee..f076b1ba7319 100644
> > > > > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > > > > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > > > > > @@ -1551,29 +1551,29 @@ static int amdgpu_debugfs_sclk_set(void 
> > > > > > > *data, u64 val)
> > > > > > >   return 0;
> > > > > > >   }
> > > > > > > -DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
> > > > > > > - amdgpu_debugfs_ib_preempt, "%llu\n");
> > > > > > > +DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
> > > > > > > +  amdgpu_debugfs_ib_preempt, "%llu\n");
> > > > > > Are you sure this is ok?  Do these devices need this additional
> > > > > > "protection"?  Do they have the problem that these macros were 
> > > > > > written
> > > > > > for?
> > > > > > 
> > > > > > Same for the other patches you just submitted here, I think you 
> > > > > > need to
> > > > > > somehow "prove" that these changes are necessary, checkpatch isn't 
> > > > > > able
> > > > > > to determine this all the time.
> > > > > Hi Greg,
> > > > > Based on my understanding, the current function debugfs_create_file()
> > > > > adds an overhead of lifetime managing proxy for such fop structs. This
> > > > > should be applicable to these set of drivers as well. Hence I think 
> > > > > this
> > > > > change will be useful.
> > > > 
> > > > Well since this is only created once per device instance I don't really 
> > > > care
> > > > about this little overhead.
> > > > 
> > > > But what exactly is debugfs doing or not doing here?
> > > 
> > > It is trying to save drivers from having debugfs files open that point
> > > to memory that can go away at any time.  For graphics devices, I doubt
> > > that is the case.
> > 
> > So for anything we add/remove we have two-stage cleanup
> > 
> > 1. drm_dev_unregister (or drm_connector_unregisters, those are the only
> > two hotunpluggable things we have) unregister a

Re: [Outreachy kernel] [PATCH] drm/amdgpu: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-30 Thread Deepak R Varma
On Fri, Oct 30, 2020 at 08:11:20AM +0100, Greg KH wrote:
> On Fri, Oct 30, 2020 at 08:52:45AM +0530, Deepak R Varma wrote:
> > Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
> > function in place of the debugfs_create_file() function will make the
> > file operation struct "reset" aware of the file's lifetime. Additional
> > details here: https://lists.archive.carbon60.com/linux/kernel/2369498
> > 
> > Issue reported by Coccinelle script:
> > scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
> > 
> > Signed-off-by: Deepak R Varma 
> > ---
> > Please Note: This is a Outreachy project task patch.
> > 
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 20 ++--
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > index 2d125b8b15ee..f076b1ba7319 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > @@ -1551,29 +1551,29 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 
> > val)
> > return 0;
> >  }
> >  
> > -DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
> > -   amdgpu_debugfs_ib_preempt, "%llu\n");
> > +DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
> > +amdgpu_debugfs_ib_preempt, "%llu\n");
> 
> Are you sure this is ok?  Do these devices need this additional
> "protection"?  Do they have the problem that these macros were written
> for?
> 
> Same for the other patches you just submitted here, I think you need to
> somehow "prove" that these changes are necessary, checkpatch isn't able
> to determine this all the time.

Hi Greg,
Based on my understanding, the current function debugfs_create_file()
adds an overhead of lifetime managing proxy for such fop structs. This
should be applicable to these set of drivers as well. Hence I think this
change will be useful.

I will wait for comments from other experts for driver specific
consideration / behavior.

Thanks,
drv


> 
> thanks,
> 
> greg k-h


[PATCH v2] drm/amd/pm: replace kmalloc+memcpy by kmemdup

2020-10-29 Thread Deepak R Varma
Use kmemdup() for instructions using kmalloc() + memcpy(). More
information here: https://lwn.net/Articles/198928/
Issue reported by coccinelle script: scripts/coccinelle/api/memdup.cocci

Signed-off-by: Deepak R Varma 
---
Changes since v1:
   - Update patch subject and log message to match proposed change.
   
Please Note: This is a Outreachy project task patch.

 .../gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c 
b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
index 740e2fc7a034..1e79baab753e 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
@@ -252,12 +252,11 @@ static int init_powerplay_table_information(
phm_copy_clock_limits_array(hwmgr, 
_information->power_saving_clock_max, 
powerplay_table->PowerSavingClockMax, ATOM_VEGA12_PPCLOCK_COUNT);
phm_copy_clock_limits_array(hwmgr, 
_information->power_saving_clock_min, 
powerplay_table->PowerSavingClockMin, ATOM_VEGA12_PPCLOCK_COUNT);
 
-   pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), 
GFP_KERNEL);
+   pptable_information->smc_pptable = 
kmemdup(&(powerplay_table->smcPPTable),
+  sizeof(PPTable_t), 
GFP_KERNEL);
if (pptable_information->smc_pptable == NULL)
return -ENOMEM;
 
-   memcpy(pptable_information->smc_pptable, 
&(powerplay_table->smcPPTable), sizeof(PPTable_t));
-
result = append_vbios_pptable(hwmgr, 
(pptable_information->smc_pptable));
 
return result;
-- 
2.25.1



[PATCH] drm/sti: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-29 Thread Deepak R Varma
Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
function in place of the debugfs_create_file() function will make the
file operation struct "reset" aware of the file's lifetime. Additional
details here: https://lists.archive.carbon60.com/linux/kernel/2369498

Issue reported by Coccinelle script:
scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: Deepak R Varma 
---
Please Note: This is a Outreachy project task patch.

 drivers/gpu/drm/sti/sti_drv.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 3f54efa36098..18c6639e4dbf 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -68,8 +68,8 @@ static int sti_drm_fps_set(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(sti_drm_fps_fops,
-   sti_drm_fps_get, sti_drm_fps_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(sti_drm_fps_fops, sti_drm_fps_get,
+sti_drm_fps_set, "%llu\n");
 
 static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
 {
@@ -98,8 +98,8 @@ static void sti_drm_dbg_init(struct drm_minor *minor)
 ARRAY_SIZE(sti_drm_dbg_list),
 minor->debugfs_root, minor);
 
-   debugfs_create_file("fps_show", S_IRUGO | S_IWUSR, minor->debugfs_root,
-   minor->dev, _drm_fps_fops);
+   debugfs_create_file_unsafe("fps_show", S_IRUGO | S_IWUSR, 
minor->debugfs_root,
+  minor->dev, _drm_fps_fops);
 
DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
 }
-- 
2.25.1



[PATCH] drm/panel: st7703: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-29 Thread Deepak R Varma
Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
function in place of the debugfs_create_file() function will make the
file operation struct "reset" aware of the file's lifetime. Additional
details here: https://lists.archive.carbon60.com/linux/kernel/2369498

Issue reported by Coccinelle script:
scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: Deepak R Varma 
---
Please Note: This is a Outreachy project task patch.

 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c 
b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index c22e7c49e077..89b71d4f810d 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -502,15 +502,14 @@ static int allpixelson_set(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL,
-   allpixelson_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(allpixelson_fops, NULL, allpixelson_set, "%llu\n");
 
 static void st7703_debugfs_init(struct st7703 *ctx)
 {
ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL);
 
-   debugfs_create_file("allpixelson", 0600, ctx->debugfs, ctx,
-   _fops);
+   debugfs_create_file_unsafe("allpixelson", 0600, ctx->debugfs, ctx,
+  _fops);
 }
 
 static void st7703_debugfs_remove(struct st7703 *ctx)
-- 
2.25.1



[PATCH] drm/i915/gvt: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-29 Thread Deepak R Varma
Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
function in place of the debugfs_create_file() function will make the
file operation struct "reset" aware of the file's lifetime. Additional
details here: https://lists.archive.carbon60.com/linux/kernel/2369498

Issue reported by Coccinelle script:
scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: Deepak R Varma 
---
Please Note: This is a Outreachy project task patch.

 drivers/gpu/drm/i915/gvt/debugfs.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c 
b/drivers/gpu/drm/i915/gvt/debugfs.c
index 62e6a14ad58e..18adfa2d5f5b 100644
--- a/drivers/gpu/drm/i915/gvt/debugfs.c
+++ b/drivers/gpu/drm/i915/gvt/debugfs.c
@@ -147,9 +147,8 @@ vgpu_scan_nonprivbb_set(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(vgpu_scan_nonprivbb_fops,
-   vgpu_scan_nonprivbb_get, vgpu_scan_nonprivbb_set,
-   "0x%llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(vgpu_scan_nonprivbb_fops, vgpu_scan_nonprivbb_get,
+vgpu_scan_nonprivbb_set, "0x%llx\n");
 
 /**
  * intel_gvt_debugfs_add_vgpu - register debugfs entries for a vGPU
@@ -165,8 +164,8 @@ void intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu)
debugfs_create_bool("active", 0444, vgpu->debugfs, >active);
debugfs_create_file("mmio_diff", 0444, vgpu->debugfs, vgpu,
_mmio_diff_fops);
-   debugfs_create_file("scan_nonprivbb", 0644, vgpu->debugfs, vgpu,
-   _scan_nonprivbb_fops);
+   debugfs_create_file_unsafe("scan_nonprivbb", 0644, vgpu->debugfs, vgpu,
+  _scan_nonprivbb_fops);
 }
 
 /**
-- 
2.25.1



[PATCH] drm/amd/pm: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-29 Thread Deepak R Varma
Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
function in place of the debugfs_create_file() function will make the
file operation struct "reset" aware of the file's lifetime. Additional
details here: https://lists.archive.carbon60.com/linux/kernel/2369498

Issue reported by Coccinelle script:
scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: Deepak R Varma 
---
Please Note: This is a Outreachy project task patch.

 .../gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c 
b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
index 740e2fc7a034..1e79baab753e 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_processpptables.c
@@ -252,12 +252,11 @@ static int init_powerplay_table_information(
phm_copy_clock_limits_array(hwmgr, 
_information->power_saving_clock_max, 
powerplay_table->PowerSavingClockMax, ATOM_VEGA12_PPCLOCK_COUNT);
phm_copy_clock_limits_array(hwmgr, 
_information->power_saving_clock_min, 
powerplay_table->PowerSavingClockMin, ATOM_VEGA12_PPCLOCK_COUNT);
 
-   pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), 
GFP_KERNEL);
+   pptable_information->smc_pptable = 
kmemdup(&(powerplay_table->smcPPTable),
+  sizeof(PPTable_t), 
GFP_KERNEL);
if (pptable_information->smc_pptable == NULL)
return -ENOMEM;
 
-   memcpy(pptable_information->smc_pptable, 
&(powerplay_table->smcPPTable), sizeof(PPTable_t));
-
result = append_vbios_pptable(hwmgr, 
(pptable_information->smc_pptable));
 
return result;
-- 
2.25.1



[PATCH] drm/amdgpu: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-29 Thread Deepak R Varma
Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
function in place of the debugfs_create_file() function will make the
file operation struct "reset" aware of the file's lifetime. Additional
details here: https://lists.archive.carbon60.com/linux/kernel/2369498

Issue reported by Coccinelle script:
scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: Deepak R Varma 
---
Please Note: This is a Outreachy project task patch.

 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 2d125b8b15ee..f076b1ba7319 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1551,29 +1551,29 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
-   amdgpu_debugfs_ib_preempt, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
+amdgpu_debugfs_ib_preempt, "%llu\n");
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_sclk_set, NULL,
-   amdgpu_debugfs_sclk_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_sclk_set, NULL,
+amdgpu_debugfs_sclk_set, "%llu\n");
 
 int amdgpu_debugfs_init(struct amdgpu_device *adev)
 {
int r, i;
 
adev->debugfs_preempt =
-   debugfs_create_file("amdgpu_preempt_ib", 0600,
-   adev_to_drm(adev)->primary->debugfs_root, 
adev,
-   _ib_preempt);
+   debugfs_create_file_unsafe("amdgpu_preempt_ib", 0600,
+  
adev_to_drm(adev)->primary->debugfs_root, adev,
+  _ib_preempt);
if (!(adev->debugfs_preempt)) {
DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n");
return -EIO;
}
 
adev->smu.debugfs_sclk =
-   debugfs_create_file("amdgpu_force_sclk", 0200,
-   adev_to_drm(adev)->primary->debugfs_root, 
adev,
-   _sclk_set);
+   debugfs_create_file_unsafe("amdgpu_force_sclk", 0200,
+  
adev_to_drm(adev)->primary->debugfs_root, adev,
+  _sclk_set);
if (!(adev->smu.debugfs_sclk)) {
DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n");
return -EIO;
-- 
2.25.1



[PATCH 2/2] drm: msm: adreno: improve code indentation & alignment

2020-10-29 Thread Deepak R Varma
Align instructions split across multiple lines as per the coding
standards. Issue flagged by checkpatch script.

Signed-off-by: Deepak R Varma 
---
Please note: This is a project task specific patch.

 drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c 
b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
index ffe1fb9be155..ac9296f314be 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
@@ -20,7 +20,7 @@ static void pfp_print(struct msm_gpu *gpu, struct drm_printer 
*p)
for (i = 0; i < 36; i++) {
gpu_write(gpu, REG_A5XX_CP_PFP_STAT_ADDR, i);
drm_printf(p, "  %02x: %08x\n", i,
-   gpu_read(gpu, REG_A5XX_CP_PFP_STAT_DATA));
+  gpu_read(gpu, REG_A5XX_CP_PFP_STAT_DATA));
}
 }
 
@@ -33,7 +33,7 @@ static void me_print(struct msm_gpu *gpu, struct drm_printer 
*p)
for (i = 0; i < 29; i++) {
gpu_write(gpu, REG_A5XX_CP_ME_STAT_ADDR, i);
drm_printf(p, "  %02x: %08x\n", i,
-   gpu_read(gpu, REG_A5XX_CP_ME_STAT_DATA));
+  gpu_read(gpu, REG_A5XX_CP_ME_STAT_DATA));
}
 }
 
@@ -46,7 +46,7 @@ static void meq_print(struct msm_gpu *gpu, struct drm_printer 
*p)
 
for (i = 0; i < 64; i++) {
drm_printf(p, "  %02x: %08x\n", i,
-   gpu_read(gpu, REG_A5XX_CP_MEQ_DBG_DATA));
+  gpu_read(gpu, REG_A5XX_CP_MEQ_DBG_DATA));
}
 }
 
@@ -63,7 +63,7 @@ static void roq_print(struct msm_gpu *gpu, struct drm_printer 
*p)
for (j = 0; j < 4; j++)
val[j] = gpu_read(gpu, REG_A5XX_CP_ROQ_DBG_DATA);
drm_printf(p, "  %02x: %08x %08x %08x %08x\n", i,
-   val[0], val[1], val[2], val[3]);
+  val[0], val[1], val[2], val[3]);
}
 }
 
@@ -155,5 +155,5 @@ void a5xx_debugfs_init(struct msm_gpu *gpu, struct 
drm_minor *minor)
 minor->debugfs_root, minor);
 
debugfs_create_file_unsafe("reset", S_IWUGO, minor->debugfs_root, dev,
-   _fops);
+  _fops);
 }
-- 
2.25.1



[PATCH 1/2] drm: msm: adreno: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2020-10-29 Thread Deepak R Varma
Using DEFINE_DEBUGFS_ATTRIBUTE macro with debugfs_create_file_unsafe()
function in place of the debugfs_create_file() function will make the
file operation struct "reset" aware of the file's lifetime. Additional
details here: https://lists.archive.carbon60.com/linux/kernel/2369498

Issue reported by Coccinelle script:
scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: Deepak R Varma 
---
Please Note: This is project task specific patch.

 drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c 
b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
index fc2c905b6c9e..ffe1fb9be155 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
@@ -138,7 +138,7 @@ reset_set(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(reset_fops, NULL, reset_set, "%llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(reset_fops, NULL, reset_set, "%llx\n");
 
 
 void a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor)
@@ -154,6 +154,6 @@ void a5xx_debugfs_init(struct msm_gpu *gpu, struct 
drm_minor *minor)
 ARRAY_SIZE(a5xx_debugfs_list),
 minor->debugfs_root, minor);
 
-   debugfs_create_file("reset", S_IWUGO, minor->debugfs_root, dev,
-   _fops);
+   debugfs_create_file_unsafe("reset", S_IWUGO, minor->debugfs_root, dev,
+   _fops);
 }
-- 
2.25.1