Re: [PATCH] input: xpad.c - Xbox 360 wireless and sysfs support

From: Greg KH
Date: Mon Feb 16 2009 - 22:24:57 EST


On Mon, Feb 16, 2009 at 09:53:54PM -0500, Mike Murphy wrote:
> struct usb_xpad {
> struct input_dev *dev; /* input device interface */
> struct usb_device *udev; /* usb device */
> ...
> };
>
> This is not my code... it was set up this way in the stable xpad driver.

And it is correct :)

> So it looks like I'm stuck with a struct input_dev * pointer to the
> input device, a struct device * pointer in the show/store handlers,
> and no way to get back to struct usb_xpad * with the container_of
> macro. Unless, of course, there is something I don't know about
> container_of (or another macro I can use in this instance).

input_set_drvdata() and input_get_drvdata() is what you are looking for.

Hope this helps,

greg k-h
--
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/