[Linux-kernel-mentees] [PATCH 4/6] media: dvb_dummy_fe: Fix long lines

Mauro Carvalho Chehab mchehab at kernel.org
Mon Dec 2 05:35:55 UTC 2019


Em Sun, 1 Dec 2019 22:07:22 +0530
Amit Choudhary <amitchoudhary2305 at gmail.com> escreveu:

> +static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend *fe,
> 
> > +                                            u16 *strength)
> >  
> 
> In my opinion, the arguments on new line should be just below the start of
> arguments on top line. Like this:
> 
> +static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend *fe,
> +                                                                     u16
> *strength)

No, that is not the way we indent. The alignment is relative to the open
parenthesis:

  foo(arg1,
      arg2);

Btw, if you run checkpatch --strict, you'll see it complaining if the
alignment is different:

	CHECK: Alignment should match open parenthesis
	#2: FILE: a.c:2:
	+void foo(int arg1,
	+		int arg2)

> +               .caps = FE_CAN_FEC_1_2 |
> > +                       FE_CAN_FEC_2_3 |

The alignment here is given by the first argument:

   bitfield = BIT_1 |
              BIT_2 |
              BIT_3 |
              ...

or

   bitfield = BIT_1
              | BIT_2
              | BIT_3
              ...

On media, we usually prefer the first form.

Cheers,
Mauro


More information about the Linux-kernel-mentees mailing list