ChangeSet 1.893.2.15, 2002/12/24 11:56:19-08:00, [EMAIL PROTECTED]
[PATCH] 2.4.20 usbvideo cleanups 4/4
This is a backport of some usbvideo cleanups from 2.5:
typedef enum { .. } ScanState_t -> enum ScanState
typedef enum { .. } ParseState_t -> enum ParseState
typedef enum { .. } FrameState_t -> enum FrameState
typedef enum { .. } Deinterlace_t -> enum Deinterlace
typedef struct { .. } usbvideo_t -> struct usbvideo
diff -Nru a/drivers/usb/ibmcam.c b/drivers/usb/ibmcam.c
--- a/drivers/usb/ibmcam.c Mon Jan 6 11:30:50 2003
+++ b/drivers/usb/ibmcam.c Mon Jan 6 11:30:50 2003
@@ -87,7 +87,7 @@
} ibmcam_t;
#define IBMCAM_T(uvd) ((ibmcam_t *)((uvd)->user_data))
-usbvideo_t *cams = NULL;
+struct usbvideo *cams = NULL;
static int debug = 0;
@@ -249,7 +249,7 @@
* History:
* 1/21/00 Created.
*/
-static ParseState_t ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */
+static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */
{
struct usbvideo_frame *frame;
ibmcam_t *icam;
@@ -397,7 +397,7 @@
* 21-Jan-2000 Created.
* 12-Oct-2000 Reworked to reflect interlaced nature of the data.
*/
-static ParseState_t ibmcam_parse_lines(
+static enum ParseState ibmcam_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
@@ -662,7 +662,7 @@
* them both as R component in attempt to at least partially recover the
* lost resolution.
*/
-static ParseState_t ibmcam_model2_320x240_parse_lines(
+static enum ParseState ibmcam_model2_320x240_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
@@ -816,7 +816,7 @@
return scan_Continue;
}
-static ParseState_t ibmcam_model3_parse_lines(
+static enum ParseState ibmcam_model3_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
@@ -961,7 +961,7 @@
* History:
* 10-Feb-2001 Created.
*/
-static ParseState_t ibmcam_model4_128x96_parse_lines(
+static enum ParseState ibmcam_model4_128x96_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
@@ -1051,7 +1051,7 @@
*/
void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
{
- ParseState_t newstate;
+ enum ParseState newstate;
long copylen = 0;
int mod = IBMCAM_T(uvd)->camera_model;
diff -Nru a/drivers/usb/ultracam.c b/drivers/usb/ultracam.c
--- a/drivers/usb/ultracam.c Mon Jan 6 11:30:50 2003
+++ b/drivers/usb/ultracam.c Mon Jan 6 11:30:50 2003
@@ -25,7 +25,7 @@
} ultracam_t;
#define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data))
-static usbvideo_t *cams = NULL;
+static struct usbvideo *cams = NULL;
static int debug = 0;
diff -Nru a/drivers/usb/usbvideo.c b/drivers/usb/usbvideo.c
--- a/drivers/usb/usbvideo.c Mon Jan 6 11:30:50 2003
+++ b/drivers/usb/usbvideo.c Mon Jan 6 11:30:50 2003
@@ -42,8 +42,8 @@
* Local prototypes.
*/
#if USES_PROC_FS
-static void usbvideo_procfs_level1_create(usbvideo_t *ut);
-static void usbvideo_procfs_level1_destroy(usbvideo_t *ut);
+static void usbvideo_procfs_level1_create(struct usbvideo *ut);
+static void usbvideo_procfs_level1_destroy(struct usbvideo *ut);
static void usbvideo_procfs_level2_create(struct uvd *uvd);
static void usbvideo_procfs_level2_destroy(struct uvd *uvd);
static int usbvideo_default_procfs_read_proc(
@@ -707,14 +707,14 @@
}
int usbvideo_register(
- usbvideo_t **pCams,
+ struct usbvideo **pCams,
const int num_cams,
const int num_extra,
const char *driverName,
const struct usbvideo_cb *cbTbl,
struct module *md )
{
- usbvideo_t *cams;
+ struct usbvideo *cams;
int i, base_size;
/* Check parameters for sanity */
@@ -729,10 +729,10 @@
return -EINVAL;
}
- base_size = num_cams * sizeof(struct uvd) + sizeof(usbvideo_t);
- cams = (usbvideo_t *) kmalloc(base_size, GFP_KERNEL);
+ base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
+ cams = (struct usbvideo *) kmalloc(base_size, GFP_KERNEL);
if (cams == NULL) {
- err("Failed to allocate %d. bytes for usbvideo_t", base_size);
+ err("Failed to allocate %d. bytes for usbvideo struct", base_size);
return -ENOMEM;
}
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
@@ -823,9 +823,9 @@
* if you had some dynamically allocated components in ->user field then
* you should free them before calling here.
*/
-void usbvideo_Deregister(usbvideo_t **pCams)
+void usbvideo_Deregister(struct usbvideo **pCams)
{
- usbvideo_t *cams;
+ struct usbvideo *cams;
int i;
if (pCams == NULL) {
@@ -977,12 +977,12 @@
* History:
* 27-Jan-2000 Created.
*/
-static int usbvideo_find_struct(usbvideo_t *cams)
+static int usbvideo_find_struct(struct usbvideo *cams)
{
int u, rv = -1;
if (cams == NULL) {
- err("No usbvideo_t handle?");
+ err("No usbvideo handle?");
return -1;
}
down(&cams->lock);
@@ -1001,13 +1001,13 @@
return rv;
}
-struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams)
+struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams)
{
int i, devnum;
struct uvd *uvd = NULL;
if (cams == NULL) {
- err("No usbvideo_t handle?");
+ err("No usbvideo handle?");
return NULL;
}
@@ -2294,7 +2294,7 @@
extern struct proc_dir_entry *video_proc_entry;
-static void usbvideo_procfs_level1_create(usbvideo_t *ut)
+static void usbvideo_procfs_level1_create(struct usbvideo *ut)
{
if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__);
@@ -2313,7 +2313,7 @@
}
}
-static void usbvideo_procfs_level1_destroy(usbvideo_t *ut)
+static void usbvideo_procfs_level1_destroy(struct usbvideo *ut)
{
if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__);
diff -Nru a/drivers/usb/usbvideo.h b/drivers/usb/usbvideo.h
--- a/drivers/usb/usbvideo.h Mon Jan 6 11:30:50 2003
+++ b/drivers/usb/usbvideo.h Mon Jan 6 11:30:50 2003
@@ -125,37 +125,37 @@
wait_queue_head_t wqh; /* Processes waiting */
};
-typedef enum {
+enum ScanState {
ScanState_Scanning, /* Scanning for header */
ScanState_Lines /* Parsing lines */
-} ScanState_t;
+};
/* Completion states of the data parser */
-typedef enum {
+enum ParseState {
scan_Continue, /* Just parse next item */
scan_NextFrame, /* Frame done, send it to V4L */
scan_Out, /* Not enough data for frame */
scan_EndParse /* End parsing */
-} ParseState_t;
+};
-typedef enum {
+enum FrameState {
FrameState_Unused, /* Unused (no MCAPTURE) */
FrameState_Ready, /* Ready to start grabbing */
FrameState_Grabbing, /* In the process of being grabbed into */
FrameState_Done, /* Finished grabbing, but not been synced yet */
FrameState_Done_Hold, /* Are syncing or reading */
FrameState_Error, /* Something bad happened while processing */
-} FrameState_t;
+};
/*
* Some frames may contain only even or odd lines. This type
* specifies what type of deinterlacing is required.
*/
-typedef enum {
+enum Deinterlace {
Deinterlace_None=0,
Deinterlace_FillOddLines,
Deinterlace_FillEvenLines
-} Deinterlace_t;
+};
#define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */
#define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */
@@ -174,9 +174,9 @@
videosize_t request; /* That's what the application asked for */
unsigned short palette; /* The desired format */
- FrameState_t frameState;/* State of grabbing */
- ScanState_t scanstate; /* State of scanning */
- Deinterlace_t deinterlace;
+ enum FrameState frameState;/* State of grabbing */
+ enum ScanState scanstate; /* State of scanning */
+ enum Deinterlace deinterlace;
int flags; /* USBVIDEO_FRAME_FLAG_xxx bit flags */
int curline; /* Line of frame we're working on */
@@ -198,12 +198,12 @@
unsigned long iso_err_count; /* How many bad ISO packets received */
};
-struct s_usbvideo_t;
+struct usbvideo;
struct uvd {
struct video_device vdev; /* Must be the first field! */
struct usb_device *dev;
- struct s_usbvideo_t *handle; /* Points back to the usbvideo_t */
+ struct usbvideo *handle; /* Points back to the struct usbvideo */
void *user_data; /* Camera-dependent data */
int user_size; /* Size of that camera-dependent data */
int debug; /* Debug level for usbvideo */
@@ -269,7 +269,7 @@
int (*procfs_write)(struct file *file,const char *buffer,unsigned long
count,void *data);
};
-struct s_usbvideo_t {
+struct usbvideo {
int num_cameras; /* As allocated */
struct usb_driver usbdrv; /* Interface to the USB stack */
char drvName[80]; /* Driver name */
@@ -281,7 +281,7 @@
struct proc_dir_entry *procfs_dEntry; /* /proc/video/MYDRIVER */
struct module *md_module; /* Minidriver module */
};
-typedef struct s_usbvideo_t usbvideo_t;
+
/*
* This macro retrieves callback address from the struct uvd object.
@@ -332,15 +332,15 @@
void usbvideo_rvfree(void *mem, unsigned long size);
int usbvideo_register(
- usbvideo_t **pCams,
+ struct usbvideo **pCams,
const int num_cams,
const int num_extra,
const char *driverName,
const struct usbvideo_cb *cbTable,
struct module *md);
-struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams);
+struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams);
int usbvideo_RegisterVideoDevice(struct uvd *uvd);
-void usbvideo_Deregister(usbvideo_t **uvt);
+void usbvideo_Deregister(struct usbvideo **uvt);
void usbvideo_Disconnect(struct usb_device *dev, void *ptr);
void usbvideo_CameraRelease(struct uvd *uvd);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel