Re: [patch 1/3] m68k/mac: Make mac_hid_mouse_emulate_buttons() declaration visible

Dmitry Torokhov
2007-07-20T19:30:57Z

On 7/20/07, Adrian Bunk <bunk@stusta.de> wrote:
> On Fri, Jul 20, 2007 at 02:51:02PM -0400, Dmitry Torokhov wrote:
> > On 7/20/07, Adrian Bunk <bunk@stusta.de> wrote:
> >> On Fri, Jul 20, 2007 at 01:47:36PM -0400, Dmitry Torokhov wrote:
> >> > Hi Geert,
> >> >
> >> > On 7/20/07, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >> >> From: Geert Uytterhoeven <geert@linux-m68k.org>
> >> >>
> >> >> m68k/mac: Make mac_hid_mouse_emulate_buttons() declaration visible
> >> >>
> >> >> drivers/char/keyboard.c: In function 'kbd_keycode':
> >> >> drivers/char/keyboard.c:1142: error: implicit declaration of function
> >> >> 'mac_hid_mouse_emulate_buttons'
> >> >>
> >> >> The forward declaration of mac_hid_mouse_emulate_buttons() is not
> >> visible
> >> >> on
> >> >> m68k because it's hidden in the middle of a big #ifdef block.
> >> >>
> >> >> Move it to <linux/hid.h>, correct the type of the second parameter, and
> >> >> include <linux/hid.h> where needed.
> >> >
> >> > linux/hid.h contains definitions needed for drivers speaking HID
> >> > protocol, I don't think we want to put quirks for legacy keyboard
> >> > driver there. I'd just move the #ifdef within drivers/char/keyboard.c
> >> > for now.
> >> >...
> >>
> >> If you only move it you will keep the bug of the wrong second parameter.
> >>
> >> But if you move it to any header file gcc is able to figure out such
> >> errors itself instead of them being nasty runtime errors.
> >>
> >> Such prototypes in C files are really bad since (like in this case) they
> >> prevent the finding of bugs. It doesn't matter which header file you put
> >> the prototype into (it can even be a new one), but it belongs into a
> >> header file.
> >
> > I am OK with adding a new header file. I was just saying that placing
> > that declaration in linux/hid.h makes about the same sense as putting
> > it into linux/scsi.h
>
> scsi.h would also be fine with me. ;-)
>
> Are you making a patch or should I send one? [1]
>

If you send one I'll gladly take it ;)

--
Dmitry