From 0b398f4f124e2b4b03f9acf726370c8459610c5c Mon Sep 17 00:00:00 2001 From: Pete Eberlein Date: Mon, 16 Nov 2009 15:07:42 -0300 Subject: V4L/DVB (13455): go7007: Add struct v4l2_device. This adds a struct v4l2_device to the go7007 device struct and registers it during v4l2 initialization. The v4l2_device registration overwrites the go->dev device_data, which is a struct usb_interface with intfdata set to the struct go7007. This changes intfdata to point to the struct v4l2_device inside struct go7007, which is what v4l2_device_register will also set it to (and warn about non-null drvdata on register.) Since usb disconnect can happen any time, this intfdata should always be present. Signed-off-by: Pete Eberlein Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/go7007/go7007-priv.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/staging/go7007/go7007-priv.h') diff --git a/drivers/staging/go7007/go7007-priv.h b/drivers/staging/go7007/go7007-priv.h index ce9307e3e18..b58c394c655 100644 --- a/drivers/staging/go7007/go7007-priv.h +++ b/drivers/staging/go7007/go7007-priv.h @@ -21,6 +21,8 @@ * user-space applications. */ +#include + struct go7007; /* IDs to activate board-specific support code */ @@ -167,6 +169,7 @@ struct go7007 { int channel_number; /* for multi-channel boards like Adlink PCI-MPG24 */ char name[64]; struct video_device *video_dev; + struct v4l2_device v4l2_dev; int ref_count; enum { STATUS_INIT, STATUS_ONLINE, STATUS_SHUTDOWN } status; spinlock_t spinlock; @@ -240,6 +243,11 @@ struct go7007 { unsigned short interrupt_data; }; +static inline struct go7007 *to_go7007(struct v4l2_device *v4l2_dev) +{ + return container_of(v4l2_dev, struct go7007, v4l2_dev); +} + /* All of these must be called with the hpi_lock mutex held! */ #define go7007_interface_reset(go) \ ((go)->hpi_ops->interface_reset(go)) -- cgit v1.2.3