[PATCH 9/9] staging: comedi: das08: Add attach_pci() hook

H Hartley Sweeten hartleys at visionengravers.com
Thu May 24 16:27:27 UTC 2012


On Thursday, May 24, 2012 8:16 AM, Ian Abbott wrote:
> On 2012-05-23 21:22, Dan Carpenter wrote:
>> On Wed, May 23, 2012 at 05:50:28PM +0100, Ian Abbott wrote:
>>> +
>>> +#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
>>> +static const struct das08_board_struct
>>> +*das08_find_pci_board(struct pci_dev *pdev)
>>
>> Normally the * would go on the first line.
>>
>> static const struct das08_board_struct *
>> das08_find_pci_board(struct pci_dev *pdev)
>>
>> That way before cscope was around you can grep for functions by
>> doing:  egrep -B1 '^[a-z]+\(' *.c
>>
>> There are 30 some places in the kernel which put the * on the second
>> line but they are mostly in ugly subsystems.
>
> CodingStyle section 3.1 suggests it should be adjacent to the function name.

I don't think this particular case is covered by the CodingStyle
document.

The cases mentioned in that document all deal with single line
statements:

	char *linux_banner;
	unsigned long long memparse(char *ptr, char **retptr);
	char *match_strdup(substring_t *s);

When you are breaking a function declaration, moving the '*' down
With the function name makes the return type less clear, simple
example:

char
*foo(inx x)

vs.

char *
foo(int x)

Just by glancing at the code, it's clear in the second form that the
return type is a 'char *'. In the first form the initial
impression is that the return type is a 'char'.

Just my 2 cents...

Regards,
Hartley




More information about the devel mailing list