CodingStyle indentation and alignment

Laurence Rochfort laurence.rochfort at gmail.com
Mon Sep 26 13:28:58 EDT 2016


Hi all,

I've read Documentation/CodingStyle and it states to use 8 character tabs.

Reading several USB driver files including drivers/usb/usb-skeleton.c, I see that multi-line lists of argument and operands are often aligned on top of each other using a mixture of tabs and spaces. checkpatch doesn't complain about the mixture.

For instance from usb-skeleton.c:

static int skel_probe(struct usb_interface *interface,                              
                      const struct usb_device_id *id)

uses two tabs and 6 spaces, not just tabs like:

static int skel_probe(struct usb_interface *interface,
       	   const struct usb_device_id *id)

or

static int skel_probe(struct usb_interface *interface,
       	   		     const struct usb_device_id *id)


Is a mixture of tabs and spaces acceptable if it enhances readability? If not, which of the tabs-only forms is correct?

Similarly, what about assignment alignment in structs?

Cheers,
Laurence.



More information about the Kernelnewbies mailing list