diff mbox series

[v4,2/5] fpga: fix for coding style issues

Message ID 20220416133719.3382895-3-nava.manne@xilinx.com (mailing list archive)
State New
Headers show
Series fpga: fix for coding style and kernel-doc issues | expand

Commit Message

Nava kishore Manne April 16, 2022, 1:37 p.m. UTC
fixes the below checks reported by checkpatch.pl
Lines should not end with a '('
Alignment should match open parenthesis

Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
---
Changes for v2:
                -None.
Changes for v3:
               -Fixed similar issue exists in "drivers/fpga/*".
Changes for v4:
               -None.

 drivers/fpga/fpga-mgr.c    | 4 ++--
 drivers/fpga/fpga-region.c | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Joe Perches April 16, 2022, 4:58 p.m. UTC | #1
On Sat, 2022-04-16 at 19:07 +0530, Nava kishore Manne wrote:
> fixes the below checks reported by checkpatch.pl
> Lines should not end with a '('
> Alignment should match open parenthesis

in fpga-mgr:
	Another possibillty would be to change the function arguments

and 

in fpga-region:
	Ideally keep the include declaration and definition styles synced

Perhaps:
---
 drivers/fpga/fpga-mgr.c          | 13 ++++++++-----
 drivers/fpga/fpga-region.c       |  6 +++---
 include/linux/fpga/fpga-region.h |  6 +++---
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index d49a9ce34568..c65b97450a67 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -148,12 +148,15 @@ static int fpga_mgr_write_init_buf(struct fpga_manager *mgr,
 	int ret;
 
 	mgr->state = FPGA_MGR_STATE_WRITE_INIT;
-	if (!mgr->mops->initial_header_size)
-		ret = fpga_mgr_write_init(mgr, info, NULL, 0);
-	else
-		ret = fpga_mgr_write_init(
-		    mgr, info, buf, min(mgr->mops->initial_header_size, count));
 
+	if (mgr->mops->initial_header_size) {
+		count = min(mgr->mops->initial_header_size, count);
+	} else {
+		buf = NULL;
+		count = 0;
+	}
+
+	ret = fpga_mgr_write_init(mgr, info, buf, count);
 	if (ret) {
 		dev_err(&mgr->dev, "Error preparing FPGA for writing\n");
 		mgr->state = FPGA_MGR_STATE_WRITE_INIT_ERR;
diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
index b0ac18de4885..485948e3c0db 100644
--- a/drivers/fpga/fpga-region.c
+++ b/drivers/fpga/fpga-region.c
@@ -18,9 +18,9 @@
 static DEFINE_IDA(fpga_region_ida);
 static struct class *fpga_region_class;
 
-struct fpga_region *fpga_region_class_find(
-	struct device *start, const void *data,
-	int (*match)(struct device *, const void *))
+struct fpga_region *
+fpga_region_class_find(struct device *start, const void *data,
+		       int (*match)(struct device *, const void *))
 {
 	struct device *dev;
 
diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h
index 3b87f232425c..9d4d32909340 100644
--- a/include/linux/fpga/fpga-region.h
+++ b/include/linux/fpga/fpga-region.h
@@ -52,9 +52,9 @@ struct fpga_region {
 
 #define to_fpga_region(d) container_of(d, struct fpga_region, dev)
 
-struct fpga_region *fpga_region_class_find(
-	struct device *start, const void *data,
-	int (*match)(struct device *, const void *));
+struct fpga_region *
+fpga_region_class_find(struct device *start, const void *data,
+		       int (*match)(struct device *, const void *));
 
 int fpga_region_program_fpga(struct fpga_region *region);
Xu Yilun April 16, 2022, 5:02 p.m. UTC | #2
On Sat, Apr 16, 2022 at 07:07:16PM +0530, Nava kishore Manne wrote:
> fixes the below checks reported by checkpatch.pl
> Lines should not end with a '('
> Alignment should match open parenthesis

Please help format the commit log, like:

fixes the below checks reported by checkpatch.pl:

- Lines should not end with a '('
- Alignment should match open parenthesis

> 
> Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>

With the minor fixes, please add my Acked-by.

Acked-by: Xu Yilun <yilun.xu@intel.com>

> ---
> Changes for v2:
>                 -None.
> Changes for v3:
>                -Fixed similar issue exists in "drivers/fpga/*".
> Changes for v4:
>                -None.
> 
>  drivers/fpga/fpga-mgr.c    | 4 ++--
>  drivers/fpga/fpga-region.c | 7 ++++---
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
> index d49a9ce34568..a699cc8e2fa6 100644
> --- a/drivers/fpga/fpga-mgr.c
> +++ b/drivers/fpga/fpga-mgr.c
> @@ -151,8 +151,8 @@ static int fpga_mgr_write_init_buf(struct fpga_manager *mgr,
>  	if (!mgr->mops->initial_header_size)
>  		ret = fpga_mgr_write_init(mgr, info, NULL, 0);
>  	else
> -		ret = fpga_mgr_write_init(
> -		    mgr, info, buf, min(mgr->mops->initial_header_size, count));
> +		ret = fpga_mgr_write_init(mgr, info, buf,
> +					  min(mgr->mops->initial_header_size, count));
>  
>  	if (ret) {
>  		dev_err(&mgr->dev, "Error preparing FPGA for writing\n");
> diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
> index b0ac18de4885..3864bf4f8920 100644
> --- a/drivers/fpga/fpga-region.c
> +++ b/drivers/fpga/fpga-region.c
> @@ -18,9 +18,10 @@
>  static DEFINE_IDA(fpga_region_ida);
>  static struct class *fpga_region_class;
>  
> -struct fpga_region *fpga_region_class_find(
> -	struct device *start, const void *data,
> -	int (*match)(struct device *, const void *))
> +struct fpga_region *fpga_region_class_find(struct device *start,
> +					   const void *data,
> +					   int (*match)(struct device *,
> +							const void *))
>  {
>  	struct device *dev;
>  
> -- 
> 2.25.1
Xu Yilun April 16, 2022, 5:15 p.m. UTC | #3
On Sun, Apr 17, 2022 at 01:02:57AM +0800, Xu Yilun wrote:
> On Sat, Apr 16, 2022 at 07:07:16PM +0530, Nava kishore Manne wrote:
> > fixes the below checks reported by checkpatch.pl
> > Lines should not end with a '('
> > Alignment should match open parenthesis
> 
> Please help format the commit log, like:
> 
> fixes the below checks reported by checkpatch.pl:
> 
> - Lines should not end with a '('
> - Alignment should match open parenthesis
> 
> > 
> > Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
> 
> With the minor fixes, please add my Acked-by.
> 
> Acked-by: Xu Yilun <yilun.xu@intel.com>

Sorry, please also check Joe's comments

Thanks,
Yilun

> 
> > ---
> > Changes for v2:
> >                 -None.
> > Changes for v3:
> >                -Fixed similar issue exists in "drivers/fpga/*".
> > Changes for v4:
> >                -None.
> > 
> >  drivers/fpga/fpga-mgr.c    | 4 ++--
> >  drivers/fpga/fpga-region.c | 7 ++++---
> >  2 files changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
> > index d49a9ce34568..a699cc8e2fa6 100644
> > --- a/drivers/fpga/fpga-mgr.c
> > +++ b/drivers/fpga/fpga-mgr.c
> > @@ -151,8 +151,8 @@ static int fpga_mgr_write_init_buf(struct fpga_manager *mgr,
> >  	if (!mgr->mops->initial_header_size)
> >  		ret = fpga_mgr_write_init(mgr, info, NULL, 0);
> >  	else
> > -		ret = fpga_mgr_write_init(
> > -		    mgr, info, buf, min(mgr->mops->initial_header_size, count));
> > +		ret = fpga_mgr_write_init(mgr, info, buf,
> > +					  min(mgr->mops->initial_header_size, count));
> >  
> >  	if (ret) {
> >  		dev_err(&mgr->dev, "Error preparing FPGA for writing\n");
> > diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
> > index b0ac18de4885..3864bf4f8920 100644
> > --- a/drivers/fpga/fpga-region.c
> > +++ b/drivers/fpga/fpga-region.c
> > @@ -18,9 +18,10 @@
> >  static DEFINE_IDA(fpga_region_ida);
> >  static struct class *fpga_region_class;
> >  
> > -struct fpga_region *fpga_region_class_find(
> > -	struct device *start, const void *data,
> > -	int (*match)(struct device *, const void *))
> > +struct fpga_region *fpga_region_class_find(struct device *start,
> > +					   const void *data,
> > +					   int (*match)(struct device *,
> > +							const void *))
> >  {
> >  	struct device *dev;
> >  
> > -- 
> > 2.25.1
Nava kishore Manne April 18, 2022, 9:54 a.m. UTC | #4
Hi Joe,

	Please find my response inline.

> -----Original Message-----
> From: Joe Perches <joe@perches.com>
> Sent: Saturday, April 16, 2022 10:29 PM
> To: Nava kishore Manne <navam@xilinx.com>; mdf@kernel.org;
> hao.wu@intel.com; yilun.xu@intel.com; trix@redhat.com; Michal Simek
> <michals@xilinx.com>; linux-fpga@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; git
> <git@xilinx.com>
> Subject: Re: [PATCH v4 2/5] fpga: fix for coding style issues
> 
> On Sat, 2022-04-16 at 19:07 +0530, Nava kishore Manne wrote:
> > fixes the below checks reported by checkpatch.pl Lines should not end
> > with a '('
> > Alignment should match open parenthesis
> 
> in fpga-mgr:
> 	Another possibillty would be to change the function arguments
> 
> and
> 
> in fpga-region:
> 	Ideally keep the include declaration and definition styles synced
> 

These changes are targeted to fix the checks reported by checkpatch.pl without touching the actual functionality.

Regards,
Navakishore.
Joe Perches April 18, 2022, 12:34 p.m. UTC | #5
On Mon, 2022-04-18 at 09:54 +0000, Nava kishore Manne wrote:
> Hi Joe,
> 
> 	Please find my response inline.
> 
> > -----Original Message-----
> > From: Joe Perches <joe@perches.com>
> > Sent: Saturday, April 16, 2022 10:29 PM

> > On Sat, 2022-04-16 at 19:07 +0530, Nava kishore Manne wrote:
> > > fixes the below checks reported by checkpatch.pl Lines should not end
> > > with a '('
> > > Alignment should match open parenthesis
> > 
> > in fpga-mgr:
> > 	Another possibillty would be to change the function arguments
> > 
> > and
> > 
> > in fpga-region:
> > 	Ideally keep the include declaration and definition styles synced
> 
> These changes are targeted to fix the checks reported by checkpatch.pl without touching the actual functionality.

Hello.

I am the checkpatch maintainer.

The goal of the checkpatch script is simply to mark things that
generally don't conform to the typical kernel coding style not
to mandate that all of the messages it emits is dicta.

checkpatch is a stupid little script.  It has no taste.

Please take what I wrote with a little consideration rather than
follow the advise of a brainless script.
Nava kishore Manne April 19, 2022, 8:15 a.m. UTC | #6
Hi Joe,

	Please find my response inline.

> -----Original Message-----
> From: Joe Perches <joe@perches.com>
> Sent: Monday, April 18, 2022 6:04 PM
> To: Nava kishore Manne <navam@xilinx.com>; mdf@kernel.org;
> hao.wu@intel.com; yilun.xu@intel.com; trix@redhat.com; Michal Simek
> <michals@xilinx.com>; linux-fpga@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; git
> <git@xilinx.com>
> Subject: Re: [PATCH v4 2/5] fpga: fix for coding style issues
> 
> On Mon, 2022-04-18 at 09:54 +0000, Nava kishore Manne wrote:
> > Hi Joe,
> >
> > 	Please find my response inline.
> >
> > > -----Original Message-----
> > > From: Joe Perches <joe@perches.com>
> > > Sent: Saturday, April 16, 2022 10:29 PM
> 
> > > On Sat, 2022-04-16 at 19:07 +0530, Nava kishore Manne wrote:
> > > > fixes the below checks reported by checkpatch.pl Lines should not
> > > > end with a '('
> > > > Alignment should match open parenthesis
> > >
> > > in fpga-mgr:
> > > 	Another possibillty would be to change the function arguments
> > >

This API is there for a long back. Not sure changing the function arguments is fine or Not.
@yilun: Is it ok to change the function arguments?

> > > and
> > >
> > > in fpga-region:
> > > 	Ideally keep the include declaration and definition styles synced
> >

Will fix it in next version.

Regards,
Navakishore.
Xu Yilun April 19, 2022, 9:45 a.m. UTC | #7
On Tue, Apr 19, 2022 at 08:15:57AM +0000, Nava kishore Manne wrote:
> Hi Joe,
> 
> 	Please find my response inline.
> 
> > -----Original Message-----
> > From: Joe Perches <joe@perches.com>
> > Sent: Monday, April 18, 2022 6:04 PM
> > To: Nava kishore Manne <navam@xilinx.com>; mdf@kernel.org;
> > hao.wu@intel.com; yilun.xu@intel.com; trix@redhat.com; Michal Simek
> > <michals@xilinx.com>; linux-fpga@vger.kernel.org; linux-
> > kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; git
> > <git@xilinx.com>
> > Subject: Re: [PATCH v4 2/5] fpga: fix for coding style issues
> > 
> > On Mon, 2022-04-18 at 09:54 +0000, Nava kishore Manne wrote:
> > > Hi Joe,
> > >
> > > 	Please find my response inline.
> > >
> > > > -----Original Message-----
> > > > From: Joe Perches <joe@perches.com>
> > > > Sent: Saturday, April 16, 2022 10:29 PM
> > 
> > > > On Sat, 2022-04-16 at 19:07 +0530, Nava kishore Manne wrote:
> > > > > fixes the below checks reported by checkpatch.pl Lines should not
> > > > > end with a '('
> > > > > Alignment should match open parenthesis
> > > >
> > > > in fpga-mgr:
> > > > 	Another possibillty would be to change the function arguments
> > > >
> 
> This API is there for a long back. Not sure changing the function arguments is fine or Not.
> @yilun: Is it ok to change the function arguments?

Joe's example code below doesn't actually change any function definition.
It just tries to store the value of 'min(mgr->mops->initial_header_size, count)'
in 'count', thus to reduce the length of the 'fpga_mgr_write_init(...)'
expression.

So I think it is OK.

Thanks,
Yilun

> 
> > > > and
> > > >
> > > > in fpga-region:
> > > > 	Ideally keep the include declaration and definition styles synced
> > >
> 
> Will fix it in next version.
> 
> Regards,
> Navakishore.
diff mbox series

Patch

diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index d49a9ce34568..a699cc8e2fa6 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -151,8 +151,8 @@  static int fpga_mgr_write_init_buf(struct fpga_manager *mgr,
 	if (!mgr->mops->initial_header_size)
 		ret = fpga_mgr_write_init(mgr, info, NULL, 0);
 	else
-		ret = fpga_mgr_write_init(
-		    mgr, info, buf, min(mgr->mops->initial_header_size, count));
+		ret = fpga_mgr_write_init(mgr, info, buf,
+					  min(mgr->mops->initial_header_size, count));
 
 	if (ret) {
 		dev_err(&mgr->dev, "Error preparing FPGA for writing\n");
diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
index b0ac18de4885..3864bf4f8920 100644
--- a/drivers/fpga/fpga-region.c
+++ b/drivers/fpga/fpga-region.c
@@ -18,9 +18,10 @@ 
 static DEFINE_IDA(fpga_region_ida);
 static struct class *fpga_region_class;
 
-struct fpga_region *fpga_region_class_find(
-	struct device *start, const void *data,
-	int (*match)(struct device *, const void *))
+struct fpga_region *fpga_region_class_find(struct device *start,
+					   const void *data,
+					   int (*match)(struct device *,
+							const void *))
 {
 	struct device *dev;