Re: [OOPS/HACK] atmel_cs and the latest changes in sysfs/symlink.c

Greg KH
2004-04-23T18:04:17Z

On Fri, Apr 23, 2004 at 10:19:53AM -0700, Greg KH wrote:
> On Fri, Apr 23, 2004 at 08:31:11AM -0700, Greg KH wrote:
> >
> > No, we need to oops, as that's a real bug. Can you post the whole oops
> > that was generated with this usb problem? I can't seem to duplicate
> > this here.
>
> Nevermind I dug up a device here that causes this problem. I'll track
> it down...

Ok, here's a patch that fixes it for me. I was waiting for a good
reason to finally get rid of this fake usb_interface structure, and now
I have it :)

Let me know if it solves the problem for you too and then I'll send it
off to Linus.

Any objections Vojtech?

thanks,

greg k-h

# USB: fix up fake usb_interface structure in hiddev
#
# This fixes a oops in the current kernel tree.

diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
--- a/drivers/usb/input/hiddev.c Fri Apr 23 11:00:23 2004
+++ b/drivers/usb/input/hiddev.c Fri Apr 23 11:00:23 2004
@@ -53,7 +53,6 @@
wait_queue_head_t wait;
struct hid_device *hid;
struct hiddev_list *list;
- struct usb_interface intf;
};

struct hiddev_list {
@@ -234,7 +233,7 @@
static struct usb_class_driver hiddev_class;
static void hiddev_cleanup(struct hiddev *hiddev)
{
- usb_deregister_dev(&hiddev->intf, &hiddev_class);
+ usb_deregister_dev(hiddev->hid->intf, &hiddev_class);
hiddev_table[hiddev->minor] = NULL;
kfree(hiddev);
}
@@ -775,7 +774,7 @@
return -1;
memset(hiddev, 0, sizeof(struct hiddev));

- retval = usb_register_dev(&hiddev->intf, &hiddev_class);
+ retval = usb_register_dev(hid->intf, &hiddev_class);
if (retval) {
err("Not able to get a minor for this device.");
kfree(hiddev);
@@ -784,13 +783,13 @@

init_waitqueue_head(&hiddev->wait);

- hiddev->minor = hiddev->intf.minor;
- hiddev_table[hiddev->intf.minor - HIDDEV_MINOR_BASE] = hiddev;
+ hiddev->minor = hid->intf->minor;
+ hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;

hiddev->hid = hid;
hiddev->exist = 1;

- hid->minor = hiddev->intf.minor;
+ hid->minor = hid->intf->minor;
hid->hiddev = hiddev;

return 0;