git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git]
/
drivers
/
usb
/
media
/
vicam.c
diff --git
a/drivers/media/video/usbvideo/vicam.c
b/drivers/usb/media/vicam.c
similarity index 98%
rename from
drivers/media/video/usbvideo/vicam.c
rename to
drivers/usb/media/vicam.c
index
90d48e8
..
5df1440
100644
(file)
--- a/
drivers/media/video/usbvideo/vicam.c
+++ b/
drivers/usb/media/vicam.c
@@
-42,7
+42,6
@@
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
-#include <linux/mutex.h>
#include "usbvideo.h"
// #define VICAM_DEBUG
#include "usbvideo.h"
// #define VICAM_DEBUG
@@
-69,10
+68,10
@@
#define VICAM_HEADER_SIZE 64
#define clamp( x, l, h ) max_t( __typeof__( x ), \
#define VICAM_HEADER_SIZE 64
#define clamp( x, l, h ) max_t( __typeof__( x ), \
- ( l ), \
- min_t( __typeof__( x ), \
- ( h ), \
- ( x ) ) )
+
( l ), \
+
min_t( __typeof__( x ), \
+
( h ), \
+
( x ) ) )
/* Not sure what all the bytes in these char
* arrays do, but they're necessary to make
/* Not sure what all the bytes in these char
* arrays do, but they're necessary to make
@@
-357,7
+356,7
@@
static unsigned char setup5[] = {
* Not sure why these are not yet non-statics which I can reference through
* usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime
* in the future.
* Not sure why these are not yet non-statics which I can reference through
* usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime
* in the future.
- *
+ *
*/
static void *rvmalloc(unsigned long size)
{
*/
static void *rvmalloc(unsigned long size)
{
@@
-408,7
+407,7
@@
struct vicam_camera {
struct usb_device *udev; // usb device
/* guard against simultaneous accesses to the camera */
struct usb_device *udev; // usb device
/* guard against simultaneous accesses to the camera */
- struct
mutex
cam_lock;
+ struct
semaphore
cam_lock;
int is_initialized;
u8 open_count;
int is_initialized;
u8 open_count;
@@
-462,12
+461,12
@@
static int send_control_msg(struct vicam_camera *cam,
u16 size)
{
int status = -ENODEV;
u16 size)
{
int status = -ENODEV;
-
mutex_lock
(&cam->cam_lock);
+
down
(&cam->cam_lock);
if (cam->udev) {
status = __send_control_msg(cam, request, value,
index, cp, size);
}
if (cam->udev) {
status = __send_control_msg(cam, request, value,
index, cp, size);
}
-
mutex_unlock
(&cam->cam_lock);
+
up
(&cam->cam_lock);
return status;
}
static int
return status;
}
static int
@@
-603,12
+602,12
@@
vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign
case VIDIOCSPICT:
{
struct video_picture vp;
case VIDIOCSPICT:
{
struct video_picture vp;
-
+
if (copy_from_user(&vp, user_arg, sizeof(vp))) {
retval = -EFAULT;
break;
}
if (copy_from_user(&vp, user_arg, sizeof(vp))) {
retval = -EFAULT;
break;
}
-
+
DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth,
vp.palette);
DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth,
vp.palette);
@@
-655,7
+654,7
@@
vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign
}
DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height);
}
DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height);
-
+
if ( vw.width != 320 || vw.height != 240 )
retval = -EFAULT;
if ( vw.width != 320 || vw.height != 240 )
retval = -EFAULT;
@@
-764,7
+763,6
@@
vicam_open(struct inode *inode, struct file *file)
if (!cam) {
printk(KERN_ERR
"vicam video_device improperly initialized");
if (!cam) {
printk(KERN_ERR
"vicam video_device improperly initialized");
- return -EINVAL;
}
/* the videodev_lock held above us protects us from
}
/* the videodev_lock held above us protects us from
@@
-809,12
+807,12
@@
vicam_open(struct inode *inode, struct file *file)
cam->needsDummyRead = 1;
cam->open_count++;
cam->needsDummyRead = 1;
cam->open_count++;
- file->private_data = cam;
-
+ file->private_data = cam;
+
return 0;
}
return 0;
}
-static int
+static int
vicam_close(struct inode *inode, struct file *file)
{
struct vicam_camera *cam = file->private_data;
vicam_close(struct inode *inode, struct file *file)
{
struct vicam_camera *cam = file->private_data;
@@
-833,13
+831,13
@@
vicam_close(struct inode *inode, struct file *file)
rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
kfree(cam->cntrlbuf);
rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
kfree(cam->cntrlbuf);
-
mutex_lock
(&cam->cam_lock);
+
down
(&cam->cam_lock);
cam->open_count--;
open_count = cam->open_count;
udev = cam->udev;
cam->open_count--;
open_count = cam->open_count;
udev = cam->udev;
-
mutex_unlock
(&cam->cam_lock);
+
up
(&cam->cam_lock);
if (!open_count && !udev) {
kfree(cam);
if (!open_count && !udev) {
kfree(cam);
@@
-962,7
+960,7
@@
read_frame(struct vicam_camera *cam, int framenum)
request[8] = 0;
// bytes 9-15 do not seem to affect exposure or image quality
request[8] = 0;
// bytes 9-15 do not seem to affect exposure or image quality
-
mutex_lock
(&cam->cam_lock);
+
down
(&cam->cam_lock);
if (!cam->udev) {
goto done;
if (!cam->udev) {
goto done;
@@
-987,7
+985,7
@@
read_frame(struct vicam_camera *cam, int framenum)
}
done:
}
done:
-
mutex_unlock
(&cam->cam_lock);
+
up
(&cam->cam_lock);
}
static ssize_t
}
static ssize_t
@@
-1187,7
+1185,7
@@
vicam_create_proc_entry(struct vicam_camera *cam)
if ( !cam->proc_dir )
return; // FIXME: We should probably return an error here
if ( !cam->proc_dir )
return; // FIXME: We should probably return an error here
-
+
ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR,
cam->proc_dir);
if (ent) {
ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR,
cam->proc_dir);
if (ent) {
@@
-1282,7
+1280,7
@@
vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
const struct usb_host_interface *interface;
const struct usb_endpoint_descriptor *endpoint;
struct vicam_camera *cam;
const struct usb_host_interface *interface;
const struct usb_endpoint_descriptor *endpoint;
struct vicam_camera *cam;
-
+
printk(KERN_INFO "ViCam based webcam connected\n");
interface = intf->cur_altsetting;
printk(KERN_INFO "ViCam based webcam connected\n");
interface = intf->cur_altsetting;
@@
-1311,7
+1309,7
@@
vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
cam->shutter_speed = 15;
cam->shutter_speed = 15;
-
mutex_init
(&cam->cam_lock);
+
init_MUTEX
(&cam->cam_lock);
memcpy(&cam->vdev, &vicam_template,
sizeof (vicam_template));
memcpy(&cam->vdev, &vicam_template,
sizeof (vicam_template));
@@
-1331,7
+1329,7
@@
vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor);
usb_set_intfdata (intf, cam);
printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor);
usb_set_intfdata (intf, cam);
-
+
return 0;
}
return 0;
}
@@
-1353,7
+1351,7
@@
vicam_disconnect(struct usb_interface *intf)
/* stop the camera from being used */
/* stop the camera from being used */
-
mutex_lock
(&cam->cam_lock);
+
down
(&cam->cam_lock);
/* mark the camera as gone */
/* mark the camera as gone */
@@
-1370,7
+1368,7
@@
vicam_disconnect(struct usb_interface *intf)
open_count = cam->open_count;
open_count = cam->open_count;
-
mutex_unlock
(&cam->cam_lock);
+
up
(&cam->cam_lock);
if (!open_count) {
kfree(cam);
if (!open_count) {
kfree(cam);