Re: newbies CheckpatchTips for multiline statements (Breaking function calls)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joe Perches <joe@xxxxxxxxxxx> writes:

> This style is fine, and generally perferred. However, some driver
> writers prefer to have the trailing line of a function call line up with
> the starting '('. They use tabs, followed by spaces, to align the
> trailing line: 
>
>  
>         pdata->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN,
>                                             GFP_KERNEL,
>                                             &pdata->urb->transfer_dma);

It might be worth noting that the network subsystem maintainer prefers
this style as well.  So most networking patches should probably use it.
The exception would be files which already use the other style.

You should also be aware of the implications of this style: You have to
modify all three lines if you change anything on the first line causing
the position of the starting '(' to change.  I.e., a patch like this is
not acceptable:

         -pdata->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN,
         +p->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN,
                                              GFP_KERNEL,
                                              &pdata->urb->transfer_dma);


It needs to be

         -pdata->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN,
         -                                    GFP_KERNEL,
         -                                    &pdata->urb->transfer_dma);
         +p->urbdata = usb_alloc_coherent(pdata->udev, ACD_URB_BUFFER_LEN,
         +                                GFP_KERNEL,
         +                                &pdata->urb->transfer_dma);


Bjørn

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies





[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux