On Mon, Apr 01, 2002 at 11:37:01PM +0200, Vojtech Pavlik wrote:
> On Mon, Apr 01, 2002 at 01:33:27PM -0800, Greg KH wrote:
> > 
> > Should this also be added to 2.5?
> 
> Yes, please.

Ok, I had to hand edit it, but I applied it to the 2.5 tree.

In looking at the code, I realized that the following patch could reduce
the use of the #ifdefs in the code.  In the end all that happens is a
change to hid.h, the hid-core.c patch is just backing out Brad's
changes.  Is it ok for me to make this change?

I also think the #ifdef CONFIG_USB_HIDDEV code could be cleaned up this
way too.  Do you want a patch for it?

thanks,

greg k-h


diff -Nru a/drivers/usb/hid-core.c b/drivers/usb/hid-core.c
--- a/drivers/usb/hid-core.c    Mon Apr  1 16:13:11 2002
+++ b/drivers/usb/hid-core.c    Mon Apr  1 16:13:11 2002
@@ -739,10 +739,8 @@
 static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct 
hid_usage *usage, __s32 value)
 {
        hid_dump_input(usage, value);
-#ifdef CONFIG_USB_HIDINPUT
        if (hid->claimed & HID_CLAIMED_INPUT)
                hidinput_hid_event(hid, field, usage, value);
-#endif
 #ifdef CONFIG_USB_HIDDEV
        if (hid->claimed & HID_CLAIMED_HIDDEV) {
                struct hiddev_usage_ref uref;
@@ -1440,10 +1438,9 @@
 
        hid_init_reports(hid);
        hid_dump_device(hid);
-#ifdef CONFIG_USB_HIDINPUT
+
        if (!hidinput_connect(hid))
                hid->claimed |= HID_CLAIMED_INPUT;
-#endif
 #ifdef CONFIG_USB_HIDDEV
        if (!hiddev_connect(hid))
                hid->claimed |= HID_CLAIMED_HIDDEV;
@@ -1486,14 +1483,10 @@
        usb_unlink_urb(hid->urbout);
        usb_unlink_urb(hid->urbctrl);
 
-#ifdef CONFIG_USB_HIDINPUT
        if (hid->claimed & HID_CLAIMED_INPUT)
                hidinput_disconnect(hid);
-#endif
-#ifdef CONFIG_USB_HIDDEV
        if (hid->claimed & HID_CLAIMED_HIDDEV)
                hiddev_disconnect(hid);
-#endif
 
        usb_free_urb(hid->urbin);
        usb_free_urb(hid->urbctrl);
diff -Nru a/drivers/usb/hid.h b/drivers/usb/hid.h
--- a/drivers/usb/hid.h Mon Apr  1 16:13:11 2002
+++ b/drivers/usb/hid.h Mon Apr  1 16:13:11 2002
@@ -389,10 +389,6 @@
        struct hid_class_descriptor desc[1];
 } __attribute__ ((packed));
 
-void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, 
__s32);
-int hidinput_connect(struct hid_device *);
-void hidinput_disconnect(struct hid_device *);
-
 #ifdef DEBUG
 #include "hid-debug.h"
 #else
@@ -407,8 +403,14 @@
 /* Applications from HID Usage Tables 4/8/99 Version 1.1 */
 /* We ignore a few input applications that are not widely used */
 #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || ( a == 
0x00010080) || ( a == 0x000c0001))
+extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct 
+hid_usage *, __s32);
+extern int hidinput_connect(struct hid_device *);
+extern void hidinput_disconnect(struct hid_device *);
 #else
 #define IS_INPUT_APPLICATION(a) (0)
+static inline void hidinput_hid_event(struct hid_device *hid, struct hid_field 
+*field, struct hid_usage *usage, __s32 value) { }
+static inline int hidinput_connect(struct hid_device *hid) { return -ENODEV; }
+static inline void hidinput_disconnect(struct hid_device *hid) { }
 #endif
 
 int hid_open(struct hid_device *);

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to