Skip to contentSkip to conversation

old style C declaration

KJ Yoann Padioleau 2 participants 2 messages May 24, 2007 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hi,

In drivers/net/atari_pamsnet.c many (not all) functions use an old style:

static HADDR
*read_hw_addr(target, buffer)

	int target;
	unsigned char *buffer;
{
	HADDR *ret = 0;
	unsigned char cmd_buffer[5];

	if (send_first(target, READSECTOR))
		goto bad;
	setup_dma(buffer, READ, 1);
	cmd_buffer[0] = cmd_buffer[1] = cmd_buffer[2] = cmd_buffer[4] = 0;
	cmd_buffer[3] = 1;
	if (send_1_5(5, cmd_buffer, 1) ||
	    !acsi_wait_for_IRQ(TIMEOUTDMA) ||
	    get_status())
		goto bad;
	ret = phys_to_virt((unsigned long)&(((DMAHWADDR *)buffer)->hwaddr));
	dma_cache_maintenance((unsigned long)buffer, 512, 0);
bad:
	return (ret);
}

Can I change them so that the file use a consistent style ?

On the example this would lead to:

static HADDR
*read_hw_addr(int target, unsigned char * buffer)
{
...

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 29 lines · Yoann Padioleau

Hi,

In drivers/net/atari_pamsnet.c many (not all) functions use an old style:

static HADDR
*read_hw_addr(target, buffer)

        int target;
        unsigned char *buffer;
{
        HADDR *ret = 0;
        unsigned char cmd_buffer[5];

        if (send_first(target, READSECTOR))
                goto bad;
        setup_dma(buffer, READ, 1);
        cmd_buffer[0] = cmd_buffer[1] = cmd_buffer[2] = cmd_buffer[4] = 0;
        cmd_buffer[3] = 1;
        if (send_1_5(5, cmd_buffer, 1) ||
            !acsi_wait_for_IRQ(TIMEOUTDMA) ||
            get_status())
                goto bad;
        ret = phys_to_virt((unsigned long)&(((DMAHWADDR *)buffer)->hwaddr));
        dma_cache_maintenance((unsigned long)buffer, 512, 0);
bad:
        return (ret);
}
Quoted 2 lines

Can I change them so that the file use a consistent style ?

That would probably be a good idea, but the maintainer of the file has the last word on that, but personally I'd just whip a patch together and submit it to the maintainer and lkml...

Quoted 7 lines

On the example this would lead to:

static HADDR
*read_hw_addr(int target, unsigned char * buffer)
{
...

Not quite, if you want to follow kernel coding style it would lead to either

static HADDR
*read_hw_addr(int target, unsigned char *buffer)
{
...

or

static HADDR *read_hw_addr(int target, unsigned char *buffer) {
...

Note the placement of the "*" before 'buffer'. :-)

Signature · 7 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors