Commit d4c0db20 authored by Kai Germaschewski's avatar Kai Germaschewski

Properly export drivers/usb/media video interface

Mark the API functions accessed by other drivers with EXPORT_SYMBOL() and
make the remaining functions static.
parent 7fb7f2ac
......@@ -4,7 +4,7 @@
O_TARGET := media.o
export-objs := ov511.o pwc-uncompress.o
export-objs := ov511.o pwc-uncompress.o usbvideo.o
pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
......
......@@ -18,7 +18,6 @@
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/slab.h>
#define __NO_VERSION__ /* Temporary: usbvideo is not a module yet */
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>
......@@ -55,6 +54,24 @@ static int usbvideo_default_procfs_write_proc(
unsigned long count, void *data);
#endif
static void usbvideo_Disconnect(struct usb_device *dev, void *ptr);
static void usbvideo_CameraRelease(uvd_t *uvd);
static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma);
static int usbvideo_v4l_open(struct inode *inode, struct file *file);
static int usbvideo_v4l_read(struct file *file, char *buf,
size_t count, loff_t *ppos);
static int usbvideo_v4l_close(struct inode *inode, struct file *file);
static int usbvideo_StartDataPump(uvd_t *uvd);
static void usbvideo_StopDataPump(uvd_t *uvd);
static int usbvideo_GetFrame(uvd_t *uvd, int frameNum);
static int usbvideo_NewFrame(uvd_t *uvd, int framenum);
static void usbvideo_SoftwareContrastAdjustment(uvd_t *uvd,
usbvideo_frame_t *frame);
/*******************************/
/* Memory management functions */
/*******************************/
......@@ -73,7 +90,7 @@ unsigned long usbvideo_kvirt_to_pa(unsigned long adr)
return ret;
}
void *usbvideo_rvmalloc(unsigned long size)
static void *usbvideo_rvmalloc(unsigned long size)
{
void *mem;
unsigned long adr;
......@@ -94,7 +111,7 @@ void *usbvideo_rvmalloc(unsigned long size)
return mem;
}
void usbvideo_rvfree(void *mem, unsigned long size)
static void usbvideo_rvfree(void *mem, unsigned long size)
{
unsigned long adr;
......@@ -110,13 +127,13 @@ void usbvideo_rvfree(void *mem, unsigned long size)
vfree(mem);
}
void RingQueue_Initialize(RingQueue_t *rq)
static void RingQueue_Initialize(RingQueue_t *rq)
{
assert(rq != NULL);
init_waitqueue_head(&rq->wqh);
}
void RingQueue_Allocate(RingQueue_t *rq, int rqLen)
static void RingQueue_Allocate(RingQueue_t *rq, int rqLen)
{
assert(rq != NULL);
assert(rqLen > 0);
......@@ -125,14 +142,14 @@ void RingQueue_Allocate(RingQueue_t *rq, int rqLen)
assert(rq->queue != NULL);
}
int RingQueue_IsAllocated(const RingQueue_t *rq)
static int RingQueue_IsAllocated(const RingQueue_t *rq)
{
if (rq == NULL)
return 0;
return (rq->queue != NULL) && (rq->length > 0);
}
void RingQueue_Free(RingQueue_t *rq)
static void RingQueue_Free(RingQueue_t *rq)
{
assert(rq != NULL);
if (RingQueue_IsAllocated(rq)) {
......@@ -154,6 +171,8 @@ int RingQueue_Dequeue(RingQueue_t *rq, unsigned char *dst, int len)
return len;
}
EXPORT_SYMBOL(RingQueue_Dequeue);
int RingQueue_Enqueue(RingQueue_t *rq, const unsigned char *cdata, int n)
{
int enqueued = 0;
......@@ -184,6 +203,8 @@ int RingQueue_Enqueue(RingQueue_t *rq, const unsigned char *cdata, int n)
return enqueued;
}
EXPORT_SYMBOL(RingQueue_Enqueue);
int RingQueue_GetLength(const RingQueue_t *rq)
{
int ri, wi;
......@@ -200,7 +221,9 @@ int RingQueue_GetLength(const RingQueue_t *rq)
return wi + (rq->length - ri);
}
void RingQueue_InterruptibleSleepOn(RingQueue_t *rq)
EXPORT_SYMBOL(RingQueue_GetLength);
static void RingQueue_InterruptibleSleepOn(RingQueue_t *rq)
{
assert(rq != NULL);
interruptible_sleep_on(&rq->wqh);
......@@ -213,6 +236,8 @@ void RingQueue_WakeUpInterruptible(RingQueue_t *rq)
wake_up_interruptible(&rq->wqh);
}
EXPORT_SYMBOL(RingQueue_WakeUpInterruptible);
/*
* usbvideo_VideosizeToString()
*
......@@ -222,7 +247,7 @@ void RingQueue_WakeUpInterruptible(RingQueue_t *rq)
* 07-Aug-2000 Created.
* 19-Oct-2000 Reworked for usbvideo module.
*/
void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs)
static void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs)
{
char tmp[40];
int n;
......@@ -241,7 +266,7 @@ void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs)
* History:
* 01-Feb-2000 Created.
*/
void usbvideo_OverlayChar(uvd_t *uvd, usbvideo_frame_t *frame,
static void usbvideo_OverlayChar(uvd_t *uvd, usbvideo_frame_t *frame,
int x, int y, int ch)
{
static const unsigned short digits[16] = {
......@@ -296,7 +321,7 @@ void usbvideo_OverlayChar(uvd_t *uvd, usbvideo_frame_t *frame,
* History:
* 01-Feb-2000 Created.
*/
void usbvideo_OverlayString(uvd_t *uvd, usbvideo_frame_t *frame,
static void usbvideo_OverlayString(uvd_t *uvd, usbvideo_frame_t *frame,
int x, int y, const char *str)
{
while (*str) {
......@@ -314,7 +339,7 @@ void usbvideo_OverlayString(uvd_t *uvd, usbvideo_frame_t *frame,
* History:
* 01-Feb-2000 Created.
*/
void usbvideo_OverlayStats(uvd_t *uvd, usbvideo_frame_t *frame)
static void usbvideo_OverlayStats(uvd_t *uvd, usbvideo_frame_t *frame)
{
const int y_diff = 8;
char tmp[16];
......@@ -437,7 +462,7 @@ void usbvideo_OverlayStats(uvd_t *uvd, usbvideo_frame_t *frame)
* History:
* 14-Jan-2000 Corrected default multiplier.
*/
void usbvideo_ReportStatistics(const uvd_t *uvd)
static void usbvideo_ReportStatistics(const uvd_t *uvd)
{
if ((uvd != NULL) && (uvd->stats.urb_count > 0)) {
unsigned long allPackets, badPackets, goodPackets, percent;
......@@ -549,6 +574,8 @@ void usbvideo_DrawLine(
}
}
EXPORT_SYMBOL(usbvideo_DrawLine);
/*
* usbvideo_TestPattern()
*
......@@ -636,6 +663,8 @@ void usbvideo_TestPattern(uvd_t *uvd, int fullframe, int pmode)
usbvideo_OverlayStats(uvd, frame);
}
EXPORT_SYMBOL(usbvideo_TestPattern);
/*
* usbvideo_HexDump()
*
......@@ -663,6 +692,8 @@ void usbvideo_HexDump(const unsigned char *data, int len)
printk("%s\n", tmp);
}
EXPORT_SYMBOL(usbvideo_HexDump);
/* Debugging aid */
void usbvideo_SayAndWait(const char *what)
{
......@@ -672,6 +703,8 @@ void usbvideo_SayAndWait(const char *what)
interruptible_sleep_on_timeout (&wq, HZ*3); /* Timeout */
}
EXPORT_SYMBOL(usbvideo_SayAndWait);
/* ******************************************************************** */
static void usbvideo_ClientIncModCount(uvd_t *uvd)
......@@ -825,6 +858,8 @@ int usbvideo_register(
return 0;
}
EXPORT_SYMBOL(usbvideo_register);
/*
* usbvideo_Deregister()
*
......@@ -886,6 +921,8 @@ void usbvideo_Deregister(usbvideo_t **pCams)
*pCams = NULL;
}
EXPORT_SYMBOL(usbvideo_Deregister);
/*
* usbvideo_Disconnect()
*
......@@ -908,7 +945,7 @@ void usbvideo_Deregister(usbvideo_t **pCams)
* 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT).
* 19-Oct-2000 Moved to usbvideo module.
*/
void usbvideo_Disconnect(struct usb_device *dev, void *ptr)
static void usbvideo_Disconnect(struct usb_device *dev, void *ptr)
{
static const char proc[] = "usbvideo_Disconnect";
uvd_t *uvd = (uvd_t *) ptr;
......@@ -958,7 +995,7 @@ void usbvideo_Disconnect(struct usb_device *dev, void *ptr)
* History:
* 27-Jan-2000 Created.
*/
void usbvideo_CameraRelease(uvd_t *uvd)
static void usbvideo_CameraRelease(uvd_t *uvd)
{
static const char proc[] = "usbvideo_CameraRelease";
if (uvd == NULL) {
......@@ -1079,6 +1116,8 @@ uvd_t *usbvideo_AllocateDevice(usbvideo_t *cams)
return uvd;
}
EXPORT_SYMBOL(usbvideo_AllocateDevice);
int usbvideo_RegisterVideoDevice(uvd_t *uvd)
{
static const char proc[] = "usbvideo_RegisterVideoDevice";
......@@ -1139,9 +1178,11 @@ int usbvideo_RegisterVideoDevice(uvd_t *uvd)
return 0;
}
EXPORT_SYMBOL(usbvideo_RegisterVideoDevice);
/* ******************************************************************** */
int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma)
static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma)
{
uvd_t *uvd = file->private_data;
unsigned long start = vma->vm_start;
......@@ -1185,7 +1226,7 @@ int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma)
* 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers.
* 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT).
*/
int usbvideo_v4l_open(struct inode *inode, struct file *file)
static int usbvideo_v4l_open(struct inode *inode, struct file *file)
{
static const char proc[] = "usbvideo_v4l_open";
struct video_device *dev = video_devdata(file);
......@@ -1300,7 +1341,7 @@ int usbvideo_v4l_open(struct inode *inode, struct file *file)
* 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers.
* 24-May-2000 Moved MOD_DEC_USE_COUNT outside of code that can sleep.
*/
int usbvideo_v4l_close(struct inode *inode, struct file *file)
static int usbvideo_v4l_close(struct inode *inode, struct file *file)
{
static const char proc[] = "usbvideo_v4l_close";
struct video_device *dev = file->private_data;
......@@ -1554,7 +1595,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
return 0;
}
int usbvideo_v4l_ioctl(struct inode *inode, struct file *file,
static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
return video_usercopy(inode, file, cmd, arg, usbvideo_v4l_do_ioctl);
......@@ -1571,7 +1612,7 @@ int usbvideo_v4l_ioctl(struct inode *inode, struct file *file,
* 20-Oct-2000 Created.
* 01-Nov-2000 Added mutex (uvd->lock).
*/
int usbvideo_v4l_read(struct file *file, char *buf,
static int usbvideo_v4l_read(struct file *file, char *buf,
size_t count, loff_t *ppos)
{
static const char proc[] = "usbvideo_v4l_read";
......@@ -1809,7 +1850,7 @@ static void usbvideo_IsocIrq(struct urb *urb)
* of hardcoded values. Simplified by using for loop,
* allowed any number of URBs.
*/
int usbvideo_StartDataPump(uvd_t *uvd)
static int usbvideo_StartDataPump(uvd_t *uvd)
{
static const char proc[] = "usbvideo_StartDataPump";
struct usb_device *dev = uvd->dev;
......@@ -1885,7 +1926,7 @@ int usbvideo_StartDataPump(uvd_t *uvd)
* 22-Jan-2000 Corrected order of actions to work after surprise removal.
* 27-Jan-2000 Used uvd->iface, uvd->ifaceAltInactive instead of hardcoded values.
*/
void usbvideo_StopDataPump(uvd_t *uvd)
static void usbvideo_StopDataPump(uvd_t *uvd)
{
static const char proc[] = "usbvideo_StopDataPump";
int i, j;
......@@ -1929,7 +1970,7 @@ void usbvideo_StopDataPump(uvd_t *uvd)
* 29-Mar-00 Added copying of previous frame into the current one.
* 6-Aug-00 Added model 3 video sizes, removed redundant width, height.
*/
int usbvideo_NewFrame(uvd_t *uvd, int framenum)
static int usbvideo_NewFrame(uvd_t *uvd, int framenum)
{
usbvideo_frame_t *frame;
int n;
......@@ -2004,7 +2045,7 @@ int usbvideo_NewFrame(uvd_t *uvd, int framenum)
* FLAGS_NO_DECODING set. Therefore, any regular build of any driver
* based on usbvideo can use this feature at any time.
*/
void usbvideo_CollectRawData(uvd_t *uvd, usbvideo_frame_t *frame)
static void usbvideo_CollectRawData(uvd_t *uvd, usbvideo_frame_t *frame)
{
int n;
......@@ -2034,7 +2075,7 @@ void usbvideo_CollectRawData(uvd_t *uvd, usbvideo_frame_t *frame)
}
}
int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
static int usbvideo_GetFrame(uvd_t *uvd, int frameNum)
{
static const char proc[] = "usbvideo_GetFrame";
usbvideo_frame_t *frame = &uvd->frame[frameNum];
......@@ -2225,6 +2266,8 @@ void usbvideo_DeinterlaceFrame(uvd_t *uvd, usbvideo_frame_t *frame)
usbvideo_OverlayStats(uvd, frame);
}
EXPORT_SYMBOL(usbvideo_DeinterlaceFrame);
/*
* usbvideo_SoftwareContrastAdjustment()
*
......@@ -2235,7 +2278,8 @@ void usbvideo_DeinterlaceFrame(uvd_t *uvd, usbvideo_frame_t *frame)
* History:
* 09-Feb-2001 Created.
*/
void usbvideo_SoftwareContrastAdjustment(uvd_t *uvd, usbvideo_frame_t *frame)
static void usbvideo_SoftwareContrastAdjustment(uvd_t *uvd,
usbvideo_frame_t *frame)
{
static const char proc[] = "usbvideo_SoftwareContrastAdjustment";
int i, j, v4l_linesize;
......
......@@ -304,35 +304,22 @@ typedef struct s_usbvideo_t usbvideo_t;
#define VALID_CALLBACK(uvd,cbName) ((((uvd) != NULL) && \
((uvd)->handle != NULL)) ? GET_CALLBACK(uvd,cbName) : NULL)
void RingQueue_Initialize(RingQueue_t *rq);
void RingQueue_Allocate(RingQueue_t *rq, int rqLen);
int RingQueue_IsAllocated(const RingQueue_t *rq);
void RingQueue_Free(RingQueue_t *rq);
int RingQueue_Dequeue(RingQueue_t *rq, unsigned char *dst, int len);
int RingQueue_Enqueue(RingQueue_t *rq, const unsigned char *cdata, int n);
int RingQueue_GetLength(const RingQueue_t *rq);
void RingQueue_InterruptibleSleepOn(RingQueue_t *rq);
void RingQueue_WakeUpInterruptible(RingQueue_t *rq);
void usbvideo_CollectRawData(uvd_t *uvd, usbvideo_frame_t *frame);
void usbvideo_DrawLine(
usbvideo_frame_t *frame,
int x1, int y1,
int x2, int y2,
unsigned char cr, unsigned char cg, unsigned char cb);
void usbvideo_HexDump(const unsigned char *data, int len);
void usbvideo_OverlayChar(uvd_t *uvd, usbvideo_frame_t *frame, int x, int y, int ch);
void usbvideo_OverlayString(uvd_t *uvd, usbvideo_frame_t *frame, int x, int y, const char *str);
void usbvideo_OverlayStats(uvd_t *uvd, usbvideo_frame_t *frame);
void usbvideo_ReportStatistics(const uvd_t *uvd);
void usbvideo_SayAndWait(const char *what);
void usbvideo_TestPattern(uvd_t *uvd, int fullframe, int pmode);
void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs);
/* Memory allocation routines */
unsigned long usbvideo_kvirt_to_pa(unsigned long adr);
void *usbvideo_rvmalloc(unsigned long size);
void usbvideo_rvfree(void *mem, unsigned long size);
int usbvideo_register(
usbvideo_t **pCams,
......@@ -344,24 +331,10 @@ int usbvideo_register(
uvd_t *usbvideo_AllocateDevice(usbvideo_t *cams);
int usbvideo_RegisterVideoDevice(uvd_t *uvd);
void usbvideo_Deregister(usbvideo_t **uvt);
void usbvideo_Disconnect(struct usb_device *dev, void *ptr);
void usbvideo_CameraRelease(uvd_t *uvd);
int usbvideo_v4l_close(struct inode *inode, struct file *file);
int usbvideo_v4l_initialize(struct video_device *dev);
int usbvideo_v4l_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma);
int usbvideo_v4l_open(struct inode *inode, struct file *file);
int usbvideo_v4l_read(struct file *file, char *buf,
size_t count, loff_t *ppos);
int usbvideo_GetFrame(uvd_t *uvd, int frameNum);
int usbvideo_NewFrame(uvd_t *uvd, int framenum);
int usbvideo_StartDataPump(uvd_t *uvd);
void usbvideo_StopDataPump(uvd_t *uvd);
void usbvideo_DeinterlaceFrame(uvd_t *uvd, usbvideo_frame_t *frame);
void usbvideo_SoftwareContrastAdjustment(uvd_t *uvd, usbvideo_frame_t *frame);
/*
* This code performs bounds checking - use it when working with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment