linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the usb tree with the v4l-dvb tree
@ 2010-05-12  5:57 Stephen Rothwell
  2010-05-12 19:49 ` Greg KH
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2010-05-12  5:57 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-next, linux-kernel, "Jean-François Moine",
	Mauro Carvalho Chehab, Daniel Mack

Hi Greg,

Today's linux-next merge of the usb tree got a conflict in
drivers/media/video/gspca/gspca.c between commit
659a02869f4a8be95df9efa76af02e53e400555f ("V4L/DVB: gspca - main: Convert
wMaxPacketSize from little endian 16 to cpu") from the v4l-dvb tree and
commit 42b4658241d4c16c838daf9d63c0029cd7269fe0 ("USB: rename
usb_buffer_alloc() and usb_buffer_free() users") from the usb tree.

I fixed it up (see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/media/video/gspca/gspca.c
index efe6159,00713f8..0000000
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@@ -213,7 -213,7 +213,7 @@@ static int alloc_and_submit_int_urb(str
  		goto error;
  	}
  
- 	buffer = usb_buffer_alloc(dev, buffer_len,
 -	buffer = usb_alloc_coherent(dev, ep->wMaxPacketSize,
++	buffer = usb_alloc_coherent(dev, buffer_len,
  				GFP_KERNEL, &urb->transfer_dma);
  	if (!buffer) {
  		ret = -ENOMEM;

^ permalink raw reply	[flat|nested] 16+ messages in thread
* linux-next: manual merge of the usb tree with the v4l-dvb tree
@ 2010-07-06  7:53 Stephen Rothwell
  2010-07-06  8:18 ` Laurent Pinchart
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2010-07-06  7:53 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-next, linux-kernel, Laurent Pinchart, Mauro Carvalho Chehab

Hi Greg,

Today's linux-next merge of the usb tree got a conflict in
drivers/media/video/uvc/uvcvideo.h include/linux/usb/video.h between
commits c3810b43416155d040a200e7a7301f379c8ae8a0 ("V4L/DVB: uvcvideo:
Support menu controls in the control mapping API") and
da1df555fcbb98a9d2054304ea54545d9ff523cf ("V4L/DVB: uvcvideo: Define
control information bits using macros") from the v4l-dvb tree and commit
bb03b5daa9ab053adcce09e939d4115a873abf39 ("USB: uvc: Move constants and
structures definitions to linux/usb/video.h") from the usb tree.

I fixed it up (see below) and can carry the fix as necessary.  Though
moving the USB patch into the v4l-dvb tree may fix the conflicts as
well ...

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/media/video/uvc/uvcvideo.h
index 47b20e7,65ec0d1..0000000
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@@ -196,24 -179,10 +196,6 @@@ struct uvc_device
  /* TODO: Put the most frequently accessed fields at the beginning of
   * structures to maximize cache efficiency.
   */
- struct uvc_streaming_control {
- 	__u16 bmHint;
- 	__u8  bFormatIndex;
- 	__u8  bFrameIndex;
- 	__u32 dwFrameInterval;
- 	__u16 wKeyFrameRate;
- 	__u16 wPFrameRate;
- 	__u16 wCompQuality;
- 	__u16 wCompWindowSize;
- 	__u16 wDelay;
- 	__u32 dwMaxVideoFrameSize;
- 	__u32 dwMaxPayloadTransferSize;
- 	__u32 dwClockFrequency;
- 	__u8  bmFramingInfo;
- 	__u8  bPreferedVersion;
- 	__u8  bMinVersion;
- 	__u8  bMaxVersion;
- };
 -struct uvc_menu_info {
 -	__u32 value;
 -	__u8 name[32];
 -};
  
  struct uvc_control_info {
  	struct list_head list;
diff --cc include/linux/usb/video.h
index 2d5b7fc,429c91a..0000000
--- a/include/linux/usb/video.h
+++ b/include/linux/usb/video.h
@@@ -160,12 -160,402 +160,409 @@@
  #define UVC_STATUS_TYPE_CONTROL				1
  #define UVC_STATUS_TYPE_STREAMING			2
  
+ /* 2.4.3.3. Payload Header Information */
+ #define UVC_STREAM_EOH					(1 << 7)
+ #define UVC_STREAM_ERR					(1 << 6)
+ #define UVC_STREAM_STI					(1 << 5)
+ #define UVC_STREAM_RES					(1 << 4)
+ #define UVC_STREAM_SCR					(1 << 3)
+ #define UVC_STREAM_PTS					(1 << 2)
+ #define UVC_STREAM_EOF					(1 << 1)
+ #define UVC_STREAM_FID					(1 << 0)
+ 
+ /* ------------------------------------------------------------------------
+  * UVC structures
+  */
+ 
+ /* All UVC descriptors have these 3 fields at the beginning */
+ struct uvc_descriptor_header {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ } __attribute__((packed));
+ 
+ /* 3.7.2. Video Control Interface Header Descriptor */
+ struct uvc_header_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u16 bcdUVC;
+ 	__u16 wTotalLength;
+ 	__u32 dwClockFrequency;
+ 	__u8  bInCollection;
+ 	__u8  baInterfaceNr[];
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_HEADER_SIZE(n)				(12+(n))
+ 
+ #define UVC_HEADER_DESCRIPTOR(n) \
+ 	uvc_header_descriptor_##n
+ 
+ #define DECLARE_UVC_HEADER_DESCRIPTOR(n)		\
+ struct UVC_HEADER_DESCRIPTOR(n) {			\
+ 	__u8  bLength;					\
+ 	__u8  bDescriptorType;				\
+ 	__u8  bDescriptorSubType;			\
+ 	__u16 bcdUVC;					\
+ 	__u16 wTotalLength;				\
+ 	__u32 dwClockFrequency;				\
+ 	__u8  bInCollection;				\
+ 	__u8  baInterfaceNr[n];				\
+ } __attribute__ ((packed))
+ 
+ /* 3.7.2.1. Input Terminal Descriptor */
+ struct uvc_input_terminal_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bTerminalID;
+ 	__u16 wTerminalType;
+ 	__u8  bAssocTerminal;
+ 	__u8  iTerminal;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_INPUT_TERMINAL_SIZE			8
+ 
+ /* 3.7.2.2. Output Terminal Descriptor */
+ struct uvc_output_terminal_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bTerminalID;
+ 	__u16 wTerminalType;
+ 	__u8  bAssocTerminal;
+ 	__u8  bSourceID;
+ 	__u8  iTerminal;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_OUTPUT_TERMINAL_SIZE			9
+ 
+ /* 3.7.2.3. Camera Terminal Descriptor */
+ struct uvc_camera_terminal_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bTerminalID;
+ 	__u16 wTerminalType;
+ 	__u8  bAssocTerminal;
+ 	__u8  iTerminal;
+ 	__u16 wObjectiveFocalLengthMin;
+ 	__u16 wObjectiveFocalLengthMax;
+ 	__u16 wOcularFocalLength;
+ 	__u8  bControlSize;
+ 	__u8  bmControls[3];
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_CAMERA_TERMINAL_SIZE(n)			(15+(n))
+ 
+ /* 3.7.2.4. Selector Unit Descriptor */
+ struct uvc_selector_unit_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bUnitID;
+ 	__u8  bNrInPins;
+ 	__u8  baSourceID[0];
+ 	__u8  iSelector;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_SELECTOR_UNIT_SIZE(n)			(6+(n))
+ 
+ #define UVC_SELECTOR_UNIT_DESCRIPTOR(n)	\
+ 	uvc_selector_unit_descriptor_##n
+ 
+ #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n)	\
+ struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) {		\
+ 	__u8  bLength;					\
+ 	__u8  bDescriptorType;				\
+ 	__u8  bDescriptorSubType;			\
+ 	__u8  bUnitID;					\
+ 	__u8  bNrInPins;				\
+ 	__u8  baSourceID[n];				\
+ 	__u8  iSelector;				\
+ } __attribute__ ((packed))
+ 
+ /* 3.7.2.5. Processing Unit Descriptor */
+ struct uvc_processing_unit_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bUnitID;
+ 	__u8  bSourceID;
+ 	__u16 wMaxMultiplier;
+ 	__u8  bControlSize;
+ 	__u8  bmControls[2];
+ 	__u8  iProcessing;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_PROCESSING_UNIT_SIZE(n)			(9+(n))
+ 
+ /* 3.7.2.6. Extension Unit Descriptor */
+ struct uvc_extension_unit_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bUnitID;
+ 	__u8  guidExtensionCode[16];
+ 	__u8  bNumControls;
+ 	__u8  bNrInPins;
+ 	__u8  baSourceID[0];
+ 	__u8  bControlSize;
+ 	__u8  bmControls[0];
+ 	__u8  iExtension;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_EXTENSION_UNIT_SIZE(p, n)		(24+(p)+(n))
+ 
+ #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
+ 	uvc_extension_unit_descriptor_##p_##n
+ 
+ #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n)	\
+ struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) {		\
+ 	__u8  bLength;					\
+ 	__u8  bDescriptorType;				\
+ 	__u8  bDescriptorSubType;			\
+ 	__u8  bUnitID;					\
+ 	__u8  guidExtensionCode[16];			\
+ 	__u8  bNumControls;				\
+ 	__u8  bNrInPins;				\
+ 	__u8  baSourceID[p];				\
+ 	__u8  bControlSize;				\
+ 	__u8  bmControls[n];				\
+ 	__u8  iExtension;				\
+ } __attribute__ ((packed))
+ 
+ /* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
+ struct uvc_control_endpoint_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u16 wMaxTransferSize;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_CONTROL_ENDPOINT_SIZE			5
+ 
+ /* 3.9.2.1. Input Header Descriptor */
+ struct uvc_input_header_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bNumFormats;
+ 	__u16 wTotalLength;
+ 	__u8  bEndpointAddress;
+ 	__u8  bmInfo;
+ 	__u8  bTerminalLink;
+ 	__u8  bStillCaptureMethod;
+ 	__u8  bTriggerSupport;
+ 	__u8  bTriggerUsage;
+ 	__u8  bControlSize;
+ 	__u8  bmaControls[];
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_INPUT_HEADER_SIZE(n, p)			(13+(n*p))
+ 
+ #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
+ 	uvc_input_header_descriptor_##n_##p
+ 
+ #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p)	\
+ struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) {		\
+ 	__u8  bLength;					\
+ 	__u8  bDescriptorType;				\
+ 	__u8  bDescriptorSubType;			\
+ 	__u8  bNumFormats;				\
+ 	__u16 wTotalLength;				\
+ 	__u8  bEndpointAddress;				\
+ 	__u8  bmInfo;					\
+ 	__u8  bTerminalLink;				\
+ 	__u8  bStillCaptureMethod;			\
+ 	__u8  bTriggerSupport;				\
+ 	__u8  bTriggerUsage;				\
+ 	__u8  bControlSize;				\
+ 	__u8  bmaControls[p][n];			\
+ } __attribute__ ((packed))
+ 
+ /* 3.9.2.2. Output Header Descriptor */
+ struct uvc_output_header_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bNumFormats;
+ 	__u16 wTotalLength;
+ 	__u8  bEndpointAddress;
+ 	__u8  bTerminalLink;
+ 	__u8  bControlSize;
+ 	__u8  bmaControls[];
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_OUTPUT_HEADER_SIZE(n, p)			(9+(n*p))
+ 
+ #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
+ 	uvc_output_header_descriptor_##n_##p
+ 
+ #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p)	\
+ struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) {		\
+ 	__u8  bLength;					\
+ 	__u8  bDescriptorType;				\
+ 	__u8  bDescriptorSubType;			\
+ 	__u8  bNumFormats;				\
+ 	__u16 wTotalLength;				\
+ 	__u8  bEndpointAddress;				\
+ 	__u8  bTerminalLink;				\
+ 	__u8  bControlSize;				\
+ 	__u8  bmaControls[p][n];			\
+ } __attribute__ ((packed))
+ 
+ /* 3.9.2.6. Color matching descriptor */
+ struct uvc_color_matching_descriptor {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bColorPrimaries;
+ 	__u8  bTransferCharacteristics;
+ 	__u8  bMatrixCoefficients;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_COLOR_MATCHING_SIZE			6
+ 
 +/* 4.1.2. Control Capabilities */
 +#define UVC_CONTROL_CAP_GET				(1 << 0)
 +#define UVC_CONTROL_CAP_SET				(1 << 1)
 +#define UVC_CONTROL_CAP_DISABLED			(1 << 2)
 +#define UVC_CONTROL_CAP_AUTOUPDATE			(1 << 3)
 +#define UVC_CONTROL_CAP_ASYNCHRONOUS			(1 << 4)
 +
+ /* 4.3.1.1. Video Probe and Commit Controls */
+ struct uvc_streaming_control {
+ 	__u16 bmHint;
+ 	__u8  bFormatIndex;
+ 	__u8  bFrameIndex;
+ 	__u32 dwFrameInterval;
+ 	__u16 wKeyFrameRate;
+ 	__u16 wPFrameRate;
+ 	__u16 wCompQuality;
+ 	__u16 wCompWindowSize;
+ 	__u16 wDelay;
+ 	__u32 dwMaxVideoFrameSize;
+ 	__u32 dwMaxPayloadTransferSize;
+ 	__u32 dwClockFrequency;
+ 	__u8  bmFramingInfo;
+ 	__u8  bPreferedVersion;
+ 	__u8  bMinVersion;
+ 	__u8  bMaxVersion;
+ } __attribute__((__packed__));
+ 
+ /* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */
+ struct uvc_format_uncompressed {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bFormatIndex;
+ 	__u8  bNumFrameDescriptors;
+ 	__u8  guidFormat[16];
+ 	__u8  bBitsPerPixel;
+ 	__u8  bDefaultFrameIndex;
+ 	__u8  bAspectRatioX;
+ 	__u8  bAspectRatioY;
+ 	__u8  bmInterfaceFlags;
+ 	__u8  bCopyProtect;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE			27
+ 
+ /* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
+ struct uvc_frame_uncompressed {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bFrameIndex;
+ 	__u8  bmCapabilities;
+ 	__u16 wWidth;
+ 	__u16 wHeight;
+ 	__u32 dwMinBitRate;
+ 	__u32 dwMaxBitRate;
+ 	__u32 dwMaxVideoFrameBufferSize;
+ 	__u32 dwDefaultFrameInterval;
+ 	__u8  bFrameIntervalType;
+ 	__u32 dwFrameInterval[];
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n)		(26+4*(n))
+ 
+ #define UVC_FRAME_UNCOMPRESSED(n) \
+ 	uvc_frame_uncompressed_##n
+ 
+ #define DECLARE_UVC_FRAME_UNCOMPRESSED(n)		\
+ struct UVC_FRAME_UNCOMPRESSED(n) {			\
+ 	__u8  bLength;					\
+ 	__u8  bDescriptorType;				\
+ 	__u8  bDescriptorSubType;			\
+ 	__u8  bFrameIndex;				\
+ 	__u8  bmCapabilities;				\
+ 	__u16 wWidth;					\
+ 	__u16 wHeight;					\
+ 	__u32 dwMinBitRate;				\
+ 	__u32 dwMaxBitRate;				\
+ 	__u32 dwMaxVideoFrameBufferSize;		\
+ 	__u32 dwDefaultFrameInterval;			\
+ 	__u8  bFrameIntervalType;			\
+ 	__u32 dwFrameInterval[n];			\
+ } __attribute__ ((packed))
+ 
+ /* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
+ struct uvc_format_mjpeg {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bFormatIndex;
+ 	__u8  bNumFrameDescriptors;
+ 	__u8  bmFlags;
+ 	__u8  bDefaultFrameIndex;
+ 	__u8  bAspectRatioX;
+ 	__u8  bAspectRatioY;
+ 	__u8  bmInterfaceFlags;
+ 	__u8  bCopyProtect;
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_FORMAT_MJPEG_SIZE			11
+ 
+ /* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
+ struct uvc_frame_mjpeg {
+ 	__u8  bLength;
+ 	__u8  bDescriptorType;
+ 	__u8  bDescriptorSubType;
+ 	__u8  bFrameIndex;
+ 	__u8  bmCapabilities;
+ 	__u16 wWidth;
+ 	__u16 wHeight;
+ 	__u32 dwMinBitRate;
+ 	__u32 dwMaxBitRate;
+ 	__u32 dwMaxVideoFrameBufferSize;
+ 	__u32 dwDefaultFrameInterval;
+ 	__u8  bFrameIntervalType;
+ 	__u32 dwFrameInterval[];
+ } __attribute__((__packed__));
+ 
+ #define UVC_DT_FRAME_MJPEG_SIZE(n)			(26+4*(n))
+ 
+ #define UVC_FRAME_MJPEG(n) \
+ 	uvc_frame_mjpeg_##n
+ 
+ #define DECLARE_UVC_FRAME_MJPEG(n)			\
+ struct UVC_FRAME_MJPEG(n) {				\
+ 	__u8  bLength;					\
+ 	__u8  bDescriptorType;				\
+ 	__u8  bDescriptorSubType;			\
+ 	__u8  bFrameIndex;				\
+ 	__u8  bmCapabilities;				\
+ 	__u16 wWidth;					\
+ 	__u16 wHeight;					\
+ 	__u32 dwMinBitRate;				\
+ 	__u32 dwMaxBitRate;				\
+ 	__u32 dwMaxVideoFrameBufferSize;		\
+ 	__u32 dwDefaultFrameInterval;			\
+ 	__u8  bFrameIntervalType;			\
+ 	__u32 dwFrameInterval[n];			\
+ } __attribute__ ((packed))
+ 
  #endif /* __LINUX_USB_VIDEO_H */
  

^ permalink raw reply	[flat|nested] 16+ messages in thread
* linux-next: manual merge of the usb tree with the v4l-dvb tree
@ 2012-05-21  6:06 Stephen Rothwell
  2012-05-23  6:22 ` Greg KH
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2012-05-21  6:06 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-next, linux-kernel, Mauro Carvalho Chehab,
	"Ezequiel García"

[-- Attachment #1: Type: text/plain, Size: 6919 bytes --]

Hi Greg,

Today's linux-next merge of the usb tree got a conflict in
drivers/staging/media/easycap/easycap_main.c between various commits from
the v4l-dvb tree and commit 5df773120477 ("USB: Staging: media: easycap:
remove err() usage") from the usb tree.

I fixed it up (I think - see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/staging/media/easycap/easycap_main.c
index aed9537,6f83d36..0000000
--- a/drivers/staging/media/easycap/easycap_main.c
+++ b/drivers/staging/media/easycap/easycap_main.c
@@@ -3401,176 -3126,6 +3401,175 @@@ static void config_easycap(struct easyc
  			}
  		}
  	}
 +}
 +
 +/*
 + * This function is called from within easycap_usb_disconnect() and is
 + * protected by semaphores set and cleared by easycap_usb_disconnect().
 + * By this stage the device has already been physically unplugged,
 + * so peasycap->pusb_device is no longer valid.
 + */
 +static void easycap_delete(struct kref *pkref)
 +{
 +	struct easycap *peasycap;
 +
 +	peasycap = container_of(pkref, struct easycap, kref);
 +	if (!peasycap) {
 +		SAM("ERROR: peasycap is NULL: cannot perform deletions\n");
 +		return;
 +	}
 +
 +	/* Free video urbs */
 +	free_video_urbs(peasycap);
 +
 +	/* Free video isoc buffers */
 +	free_isocbuffers(peasycap);
 +
 +	/* Free video field buffers */
 +	free_fieldbuffers(peasycap);
 +
 +	/* Free video frame buffers */
 +	free_framebuffers(peasycap);
 +
 +	/* Free audio urbs */
 +	free_audio_urbs(peasycap);
 +
 +	/* Free audio isoc buffers */
 +	free_audio_buffers(peasycap);
 +
 +	free_easycap(peasycap);
 +
 +	JOT(4, "ending.\n");
 +}
 +
 +static const struct v4l2_file_operations v4l2_fops = {
 +	.owner		= THIS_MODULE,
 +	.open		= easycap_open_noinode,
 +	.unlocked_ioctl	= easycap_unlocked_ioctl,
 +	.poll		= easycap_poll,
 +	.mmap		= easycap_mmap,
 +};
 +
 +static int easycap_register_video(struct easycap *peasycap)
 +{
 +	/*
 +	 * FIXME: This is believed to be harmless,
 +	 * but may well be unnecessary or wrong.
 +	 */
 +	peasycap->video_device.v4l2_dev = NULL;
 +
 +	strcpy(&peasycap->video_device.name[0], "easycapdc60");
 +	peasycap->video_device.fops = &v4l2_fops;
 +	peasycap->video_device.minor = -1;
 +	peasycap->video_device.release = (void *)(&videodev_release);
 +
 +	video_set_drvdata(&(peasycap->video_device), (void *)peasycap);
 +
 +	if (0 != (video_register_device(&(peasycap->video_device),
 +					VFL_TYPE_GRABBER, -1))) {
- 		err("Not able to register with videodev");
 +		videodev_release(&(peasycap->video_device));
 +		return -ENODEV;
 +	}
 +
 +	peasycap->registered_video++;
 +
 +	SAM("registered with videodev: %i=minor\n",
 +	    peasycap->video_device.minor);
 +	    peasycap->minor = peasycap->video_device.minor;
 +
 +	return 0;
 +}
 +
 +/*
 + * When the device is plugged, this function is called three times,
 + * one for each interface.
 + */
 +static int easycap_usb_probe(struct usb_interface *intf,
 +			    const struct usb_device_id *id)
 +{
 +	struct usb_device *usbdev;
 +	struct usb_host_interface *alt;
 +	struct usb_endpoint_descriptor *ep;
 +	struct usb_interface_descriptor *interface;
 +	struct easycap *peasycap;
 +	int i, j, rc;
 +	u8 bInterfaceNumber;
 +	u8 bInterfaceClass;
 +	u8 bInterfaceSubClass;
 +	int okalt[8], isokalt;
 +	int okepn[8];
 +	int okmps[8];
 +	int maxpacketsize;
 +
 +	usbdev = interface_to_usbdev(intf);
 +
 +	alt = usb_altnum_to_altsetting(intf, 0);
 +	if (!alt) {
 +		SAY("ERROR: usb_host_interface not found\n");
 +		return -EFAULT;
 +	}
 +
 +	interface = &alt->desc;
 +	if (!interface) {
 +		SAY("ERROR: intf_descriptor is NULL\n");
 +		return -EFAULT;
 +	}
 +
 +	/* Get properties of probed interface */
 +	bInterfaceNumber = interface->bInterfaceNumber;
 +	bInterfaceClass = interface->bInterfaceClass;
 +	bInterfaceSubClass = interface->bInterfaceSubClass;
 +
 +	JOT(4, "intf[%i]: num_altsetting=%i\n",
 +			bInterfaceNumber, intf->num_altsetting);
 +	JOT(4, "intf[%i]: cur_altsetting - altsetting=%li\n",
 +		bInterfaceNumber,
 +		(long int)(intf->cur_altsetting - intf->altsetting));
 +	JOT(4, "intf[%i]: bInterfaceClass=0x%02X bInterfaceSubClass=0x%02X\n",
 +			bInterfaceNumber, bInterfaceClass, bInterfaceSubClass);
 +
 +	/*
 +	 * A new struct easycap is always allocated when interface 0 is probed.
 +	 * It is not possible here to free any existing struct easycap.
 +	 * This should have been done by easycap_delete() when the device was
 +	 * physically unplugged.
 +	 * The allocated struct easycap is saved for later usage when
 +	 * interfaces 1 and 2 are probed.
 +	 */
 +	if (0 == bInterfaceNumber) {
 +		/*
 +		 * Alloc structure and save it in a free slot in
 +		 * easycapdc60_dongle array
 +		 */
 +		peasycap = alloc_easycap(bInterfaceNumber);
 +		if (!peasycap)
 +			return -ENOMEM;
 +
 +		/* Perform basic struct initialization */
 +		init_easycap(peasycap, usbdev, intf, bInterfaceNumber);
 +
 +		/* Dynamically fill in the available formats */
 +		rc = easycap_video_fillin_formats();
 +		if (0 > rc) {
 +			SAM("ERROR: fillin_formats() rc = %i\n", rc);
 +			return -EFAULT;
 +		}
 +		JOM(4, "%i formats available\n", rc);
 +
 +		/* Populate easycap.inputset[] */
 +		rc = populate_inputset(peasycap);
 +		if (rc < 0)
 +			return rc;
 +		JOM(4, "finished initialization\n");
 +	} else {
 +		peasycap = get_easycap(usbdev, bInterfaceNumber);
 +		if (!peasycap)
 +			return -ENODEV;
 +	}
 +
 +	config_easycap(peasycap, bInterfaceNumber,
 +				 bInterfaceClass,
 +				 bInterfaceSubClass);
  
  	/*
  	 * Investigate all altsettings. This is done in detail
@@@ -3854,9 -3562,33 +3853,12 @@@
  		JOM(4, "registered device instance: %s\n",
  			peasycap->v4l2_device.name);
  
 -		/*
 -		 * FIXME: This is believed to be harmless,
 -		 * but may well be unnecessary or wrong.
 -		 */
 -		peasycap->video_device.v4l2_dev = NULL;
 -
 -
 -		strcpy(&peasycap->video_device.name[0], "easycapdc60");
 -		peasycap->video_device.fops = &v4l2_fops;
 -		peasycap->video_device.minor = -1;
 -		peasycap->video_device.release = (void *)(&videodev_release);
 -
 -		video_set_drvdata(&(peasycap->video_device), (void *)peasycap);
 -
 -		if (0 != (video_register_device(&(peasycap->video_device),
 -							VFL_TYPE_GRABBER, -1))) {
 +		rc = easycap_register_video(peasycap);
- 		if (rc < 0)
++		if (rc < 0) {
+ 			dev_err(&intf->dev,
+ 				"Not able to register with videodev\n");
 -			videodev_release(&(peasycap->video_device));
  			return -ENODEV;
+ 		}
 -
 -		peasycap->registered_video++;
 -		SAM("registered with videodev: %i=minor\n",
 -						peasycap->video_device.minor);
 -		peasycap->minor = peasycap->video_device.minor;
 -
  		break;
  	}
  	/* 1: Audio control */

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-05-23  6:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12  5:57 linux-next: manual merge of the usb tree with the v4l-dvb tree Stephen Rothwell
2010-05-12 19:49 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2010-07-06  7:53 Stephen Rothwell
2010-07-06  8:18 ` Laurent Pinchart
2010-07-06  8:51   ` Stephen Rothwell
2010-07-06 11:10     ` Laurent Pinchart
2010-07-06 12:34       ` Mauro Carvalho Chehab
2010-07-07 15:13         ` Greg KH
2010-07-13 15:34           ` Mauro Carvalho Chehab
2010-07-13 17:23             ` Laurent Pinchart
2010-07-24 15:32               ` Mauro Carvalho Chehab
2010-07-26  8:24                 ` Laurent Pinchart
2010-07-26 14:01                   ` Mauro Carvalho Chehab
2010-07-26 21:42                     ` Greg KH
2012-05-21  6:06 Stephen Rothwell
2012-05-23  6:22 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).