linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: most: video: fixed a parentheses coding style issue.
@ 2020-12-17 23:45 Daniel West
  2020-12-17 23:58 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel West @ 2020-12-17 23:45 UTC (permalink / raw)
  To: gregkh
  Cc: hverkuil-cisco, mchehab+huawei, christian.gromm, masahiroy,
	devel, linux-kernel, daniel.west.dev

Fixed a coding style issue.

Signed-off-by: Daniel West <daniel.west.dev@gmail.com>
---
 drivers/staging/most/video/video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 829df899b993..c58192ab0c2a 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -365,8 +365,8 @@ static const struct video_device comp_videodev_template = {
 
 /**************************************************************************/
 
-static struct most_video_dev *get_comp_dev(
-	struct most_interface *iface, int channel_idx)
+static struct most_video_dev *get_comp_dev
+	(struct most_interface *iface, int channel_idx)
 {
 	struct most_video_dev *mdev;
 	unsigned long flags;
-- 
2.25.1


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

* Re: [PATCH] staging: most: video: fixed a parentheses coding style issue.
  2020-12-17 23:45 [PATCH] staging: most: video: fixed a parentheses coding style issue Daniel West
@ 2020-12-17 23:58 ` Joe Perches
  2020-12-18  9:49   ` David Laight
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-12-17 23:58 UTC (permalink / raw)
  To: Daniel West, gregkh
  Cc: hverkuil-cisco, mchehab+huawei, christian.gromm, masahiroy,
	devel, linux-kernel

On Thu, 2020-12-17 at 15:45 -0800, Daniel West wrote:
> Fixed a coding style issue.

It may pass checkpatch without warning, but it's uncommon kernel coding style.

> diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
[]
> @@ -365,8 +365,8 @@ static const struct video_device comp_videodev_template = {
>  
> 
>  /**************************************************************************/
>  
> 
> -static struct most_video_dev *get_comp_dev(
> -	struct most_interface *iface, int channel_idx)
> +static struct most_video_dev *get_comp_dev
> +	(struct most_interface *iface, int channel_idx)

This would be better using any of:

(most common)

static struct most_video_dev *get_comp_dev(struct most_interface *iface,
					   int channel_idx)

or (less common)

static struct most_video_dev *
get_comp_dev(struct most_interface *iface, int channel_idx)

or (> 80 columns)

static struct most_video_dev *get_comp_dev(struct most_interface *iface, int channel_idx)


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

* RE: [PATCH] staging: most: video: fixed a parentheses coding style issue.
  2020-12-17 23:58 ` Joe Perches
@ 2020-12-18  9:49   ` David Laight
  2020-12-18 10:08     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: David Laight @ 2020-12-18  9:49 UTC (permalink / raw)
  To: 'Joe Perches', Daniel West, gregkh
  Cc: hverkuil-cisco, mchehab+huawei, christian.gromm, masahiroy,
	devel, linux-kernel

From: Joe Perches
> Sent: 17 December 2020 23:58
> 
> On Thu, 2020-12-17 at 15:45 -0800, Daniel West wrote:
> > Fixed a coding style issue.
> 
> It may pass checkpatch without warning, but it's uncommon kernel coding style.

checkpatch probably shouldn't complain about lines that end in (
if they are function definitions.
Even for function calls you would need to reduce the indentation
rather than move the (.
You need the xxx( to be together to help grep patterns.

> 
> > diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
> []
> > @@ -365,8 +365,8 @@ static const struct video_device comp_videodev_template = {
> >
> >
> >  /**************************************************************************/
> >
> >
> > -static struct most_video_dev *get_comp_dev(
> > -	struct most_interface *iface, int channel_idx)
> > +static struct most_video_dev *get_comp_dev
> > +	(struct most_interface *iface, int channel_idx)
> 
> This would be better using any of:
> 
> (most common)
> 
> static struct most_video_dev *get_comp_dev(struct most_interface *iface,
> 					   int channel_idx)
> 
> or (less common)
> 
> static struct most_video_dev *
> get_comp_dev(struct most_interface *iface, int channel_idx)
> 
> or (> 80 columns)
> 
> static struct most_video_dev *get_comp_dev(struct most_interface *iface, int channel_idx)

Or shorten the variable/type names a bit so it all fits.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

* Re: [PATCH] staging: most: video: fixed a parentheses coding style issue.
  2020-12-18  9:49   ` David Laight
@ 2020-12-18 10:08     ` Joe Perches
  2020-12-18 10:38       ` David Laight
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-12-18 10:08 UTC (permalink / raw)
  To: David Laight, Daniel West, gregkh
  Cc: hverkuil-cisco, mchehab+huawei, christian.gromm, masahiroy,
	devel, linux-kernel

On Fri, 2020-12-18 at 09:49 +0000, David Laight wrote:
> From: Joe Perches
> > Sent: 17 December 2020 23:58
> > 
> > On Thu, 2020-12-17 at 15:45 -0800, Daniel West wrote:
> > > Fixed a coding style issue.
> > 
> > It may pass checkpatch without warning, but it's uncommon kernel coding style.
> 
> checkpatch probably shouldn't complain about lines that end in (
> if they are function definitions.

Opinons vary.

Very few function declaration/definitions in the linux kernel use the
one line per argument style (gnu indent -bfde)

type function(
	type argument1,
	type argument2,
	...
	)
{
	...
}

It probably shouldn't be encouraged.

> > or (> 80 columns)
> > static struct most_video_dev *get_comp_dev(struct most_interface *iface, int channel_idx)
> Or shorten the variable/type names a bit so it all fits.

Always a possibility but probably not a good one here as even
renaming channel_idx to idx doesn't make it < 80 columns



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

* RE: [PATCH] staging: most: video: fixed a parentheses coding style issue.
  2020-12-18 10:08     ` Joe Perches
@ 2020-12-18 10:38       ` David Laight
  0 siblings, 0 replies; 5+ messages in thread
From: David Laight @ 2020-12-18 10:38 UTC (permalink / raw)
  To: 'Joe Perches', Daniel West, gregkh
  Cc: hverkuil-cisco, mchehab+huawei, christian.gromm, masahiroy,
	devel, linux-kernel

From: Joe Perches
> Sent: 18 December 2020 10:09
> On Fri, 2020-12-18 at 09:49 +0000, David Laight wrote:
> > From: Joe Perches
> > checkpatch probably shouldn't complain about lines that end in (
> > if they are function definitions.
> 
> Opinons vary.
> 
> Very few function declaration/definitions in the linux kernel use the
> one line per argument style (gnu indent -bfde)
> 
> type function(
> 	type argument1,
> 	type argument2,
> 	...
> 	)
> {
> 	...
> }
> 
> It probably shouldn't be encouraged.

The only excuse for anything like that is if there are comments for
each parameter that are used to generate the interface documentation.

Using that style for function calls just wastes vertical space.
At least that doesn't happen in the kernel.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

end of thread, other threads:[~2020-12-18 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 23:45 [PATCH] staging: most: video: fixed a parentheses coding style issue Daniel West
2020-12-17 23:58 ` Joe Perches
2020-12-18  9:49   ` David Laight
2020-12-18 10:08     ` Joe Perches
2020-12-18 10:38       ` David Laight

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