ChangeSet 1.883.3.5, 2002/12/16 10:35:48-08:00, spse@secret.org.uk [PATCH] 2.5.51 More typedef removal from usbvideo This patch against 2.5.51 removes the remaining typedefs from usbvideo 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/media/ibmcam.c b/drivers/usb/media/ibmcam.c --- a/drivers/usb/media/ibmcam.c Wed Dec 18 00:35:08 2002 +++ b/drivers/usb/media/ibmcam.c Wed Dec 18 00:35:08 2002 @@ -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/media/konicawc.c b/drivers/usb/media/konicawc.c --- a/drivers/usb/media/konicawc.c Wed Dec 18 00:35:08 2002 +++ b/drivers/usb/media/konicawc.c Wed Dec 18 00:35:08 2002 @@ -51,7 +51,7 @@ #define MAX_FRAME_SIZE SIZE_320X240 -static usbvideo_t *cams; +static struct usbvideo *cams; #ifdef CONFIG_USB_DEBUG static int debug; diff -Nru a/drivers/usb/media/ultracam.c b/drivers/usb/media/ultracam.c --- a/drivers/usb/media/ultracam.c Wed Dec 18 00:35:08 2002 +++ b/drivers/usb/media/ultracam.c Wed Dec 18 00:35:08 2002 @@ -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/media/usbvideo.c b/drivers/usb/media/usbvideo.c --- a/drivers/usb/media/usbvideo.c Wed Dec 18 00:35:08 2002 +++ b/drivers/usb/media/usbvideo.c Wed Dec 18 00:35:08 2002 @@ -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( @@ -765,7 +765,7 @@ } int usbvideo_register( - usbvideo_t **pCams, + struct usbvideo **pCams, const int num_cams, const int num_extra, const char *driverName, @@ -773,7 +773,7 @@ struct module *md, const struct usb_device_id *id_table) { - usbvideo_t *cams; + struct usbvideo *cams; int i, base_size; /* Check parameters for sanity */ @@ -788,10 +788,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,7 +823,7 @@ #else /* !USES_PROC_FS */ /* Report a warning so that user knows why there is no /proc entries */ if ((cams->cb.procfs_read != NULL) || (cams->cb.procfs_write == NULL)) { - dbg("%s: /proc fs support requested but not configured!", proc); + dbg("%s: /proc fs support requested but not configured!", __FUNCTION__); } #endif cams->num_cameras = num_cams; @@ -889,9 +889,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) { @@ -1049,12 +1049,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); @@ -1089,13 +1089,13 @@ .fops = &usbvideo_fops, }; -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; } @@ -2357,7 +2357,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__); @@ -2376,7 +2376,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/media/usbvideo.h b/drivers/usb/media/usbvideo.h --- a/drivers/usb/media/usbvideo.h Wed Dec 18 00:35:08 2002 +++ b/drivers/usb/media/usbvideo.h Wed Dec 18 00:35:08 2002 @@ -126,37 +126,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 */ @@ -175,9 +175,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 */ @@ -199,12 +199,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 */ @@ -273,7 +273,7 @@ int (*setVideoMode)(struct uvd *uvd, struct video_window *vw); }; -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 */ @@ -285,7 +285,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,16 +332,16 @@ unsigned long usbvideo_kvirt_to_pa(unsigned long adr); 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, const struct usb_device_id *id_table); -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); int usbvideo_v4l_initialize(struct video_device *dev);