Re: [PATCH] floppy driver cleanup

From: Mikael Pettersson
Date: Thu Aug 28 2003 - 06:20:49 EST


Randy.Dunlap writes:
> -static void schedule_bh( void (*handler)(void*) )
> +static void schedule_bh(void (*handler) (void *))
...
> - schedule_bh( (void *)(void *) handler);
> + schedule_bh((void *) handler);
...
> - schedule_bh((void *)(void *)handler);
> + schedule_bh((void *) handler);
...
> - schedule_bh( (void *)(void *) floppy_start);
> + schedule_bh((void *) floppy_start);
...
> - schedule_bh( (void *)(void *) redo_fd_request);
> + schedule_bh((void *) redo_fd_request);

Am I the only one having problems with code like this?
(Not Randy's, the original.)

1. void* and function pointers are not interchangeable.
The casts should be to (void(*)(void*)) not (void*).

2. If shedule_bh() causes handler to be invoked as a
(void(*)(void*)), then handler had better point to a
function with exactly that prototype and nothing else.
Fixing this also eliminates the need for the casts.

IMO changing whitespace while these issues remain is just
a waste of time.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/