aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cpia.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cpia.c')
-rw-r--r--drivers/media/video/cpia.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index 9f59541155d9..c2405029a720 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -39,7 +39,7 @@
39#include <linux/pagemap.h> 39#include <linux/pagemap.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/semaphore.h> 42#include <linux/mutex.h>
43 43
44#ifdef CONFIG_KMOD 44#ifdef CONFIG_KMOD
45#include <linux/kmod.h> 45#include <linux/kmod.h>
@@ -622,7 +622,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf,
622 622
623 buffer = page; 623 buffer = page;
624 624
625 if (down_interruptible(&cam->param_lock)) 625 if (mutex_lock_interruptible(&cam->param_lock))
626 return -ERESTARTSYS; 626 return -ERESTARTSYS;
627 627
628 /* 628 /*
@@ -1350,7 +1350,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf,
1350 } else 1350 } else
1351 DBG("error: %d\n", retval); 1351 DBG("error: %d\n", retval);
1352 1352
1353 up(&cam->param_lock); 1353 mutex_unlock(&cam->param_lock);
1354 1354
1355out: 1355out:
1356 free_page((unsigned long)page); 1356 free_page((unsigned long)page);
@@ -1664,7 +1664,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
1664 case CPIA_COMMAND_GetColourParams: 1664 case CPIA_COMMAND_GetColourParams:
1665 case CPIA_COMMAND_GetColourBalance: 1665 case CPIA_COMMAND_GetColourBalance:
1666 case CPIA_COMMAND_GetExposure: 1666 case CPIA_COMMAND_GetExposure:
1667 down(&cam->param_lock); 1667 mutex_lock(&cam->param_lock);
1668 datasize=8; 1668 datasize=8;
1669 break; 1669 break;
1670 case CPIA_COMMAND_ReadMCPorts: 1670 case CPIA_COMMAND_ReadMCPorts:
@@ -1691,7 +1691,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
1691 if (command == CPIA_COMMAND_GetColourParams || 1691 if (command == CPIA_COMMAND_GetColourParams ||
1692 command == CPIA_COMMAND_GetColourBalance || 1692 command == CPIA_COMMAND_GetColourBalance ||
1693 command == CPIA_COMMAND_GetExposure) 1693 command == CPIA_COMMAND_GetExposure)
1694 up(&cam->param_lock); 1694 mutex_unlock(&cam->param_lock);
1695 } else { 1695 } else {
1696 switch(command) { 1696 switch(command) {
1697 case CPIA_COMMAND_GetCPIAVersion: 1697 case CPIA_COMMAND_GetCPIAVersion:
@@ -1726,13 +1726,13 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
1726 cam->params.colourParams.brightness = data[0]; 1726 cam->params.colourParams.brightness = data[0];
1727 cam->params.colourParams.contrast = data[1]; 1727 cam->params.colourParams.contrast = data[1];
1728 cam->params.colourParams.saturation = data[2]; 1728 cam->params.colourParams.saturation = data[2];
1729 up(&cam->param_lock); 1729 mutex_unlock(&cam->param_lock);
1730 break; 1730 break;
1731 case CPIA_COMMAND_GetColourBalance: 1731 case CPIA_COMMAND_GetColourBalance:
1732 cam->params.colourBalance.redGain = data[0]; 1732 cam->params.colourBalance.redGain = data[0];
1733 cam->params.colourBalance.greenGain = data[1]; 1733 cam->params.colourBalance.greenGain = data[1];
1734 cam->params.colourBalance.blueGain = data[2]; 1734 cam->params.colourBalance.blueGain = data[2];
1735 up(&cam->param_lock); 1735 mutex_unlock(&cam->param_lock);
1736 break; 1736 break;
1737 case CPIA_COMMAND_GetExposure: 1737 case CPIA_COMMAND_GetExposure:
1738 cam->params.exposure.gain = data[0]; 1738 cam->params.exposure.gain = data[0];
@@ -1743,7 +1743,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d)
1743 cam->params.exposure.green1Comp = data[5]; 1743 cam->params.exposure.green1Comp = data[5];
1744 cam->params.exposure.green2Comp = data[6]; 1744 cam->params.exposure.green2Comp = data[6];
1745 cam->params.exposure.blueComp = data[7]; 1745 cam->params.exposure.blueComp = data[7];
1746 up(&cam->param_lock); 1746 mutex_unlock(&cam->param_lock);
1747 break; 1747 break;
1748 1748
1749 case CPIA_COMMAND_ReadMCPorts: 1749 case CPIA_COMMAND_ReadMCPorts:
@@ -2059,7 +2059,7 @@ static int parse_picture(struct cam_data *cam, int size)
2059 int rows, cols, linesize, subsample_422; 2059 int rows, cols, linesize, subsample_422;
2060 2060
2061 /* make sure params don't change while we are decoding */ 2061 /* make sure params don't change while we are decoding */
2062 down(&cam->param_lock); 2062 mutex_lock(&cam->param_lock);
2063 2063
2064 obuf = cam->decompressed_frame.data; 2064 obuf = cam->decompressed_frame.data;
2065 end_obuf = obuf+CPIA_MAX_FRAME_SIZE; 2065 end_obuf = obuf+CPIA_MAX_FRAME_SIZE;
@@ -2069,26 +2069,26 @@ static int parse_picture(struct cam_data *cam, int size)
2069 2069
2070 if ((ibuf[0] != MAGIC_0) || (ibuf[1] != MAGIC_1)) { 2070 if ((ibuf[0] != MAGIC_0) || (ibuf[1] != MAGIC_1)) {
2071 LOG("header not found\n"); 2071 LOG("header not found\n");
2072 up(&cam->param_lock); 2072 mutex_unlock(&cam->param_lock);
2073 return -1; 2073 return -1;
2074 } 2074 }
2075 2075
2076 if ((ibuf[16] != VIDEOSIZE_QCIF) && (ibuf[16] != VIDEOSIZE_CIF)) { 2076 if ((ibuf[16] != VIDEOSIZE_QCIF) && (ibuf[16] != VIDEOSIZE_CIF)) {
2077 LOG("wrong video size\n"); 2077 LOG("wrong video size\n");
2078 up(&cam->param_lock); 2078 mutex_unlock(&cam->param_lock);
2079 return -1; 2079 return -1;
2080 } 2080 }
2081 2081
2082 if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) { 2082 if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) {
2083 LOG("illegal subtype %d\n",ibuf[17]); 2083 LOG("illegal subtype %d\n",ibuf[17]);
2084 up(&cam->param_lock); 2084 mutex_unlock(&cam->param_lock);
2085 return -1; 2085 return -1;
2086 } 2086 }
2087 subsample_422 = ibuf[17] == SUBSAMPLE_422; 2087 subsample_422 = ibuf[17] == SUBSAMPLE_422;
2088 2088
2089 if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) { 2089 if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) {
2090 LOG("illegal yuvorder %d\n",ibuf[18]); 2090 LOG("illegal yuvorder %d\n",ibuf[18]);
2091 up(&cam->param_lock); 2091 mutex_unlock(&cam->param_lock);
2092 return -1; 2092 return -1;
2093 } 2093 }
2094 in_uyvy = ibuf[18] == YUVORDER_UYVY; 2094 in_uyvy = ibuf[18] == YUVORDER_UYVY;
@@ -2098,7 +2098,7 @@ static int parse_picture(struct cam_data *cam, int size)
2098 (ibuf[26] != cam->params.roi.rowStart) || 2098 (ibuf[26] != cam->params.roi.rowStart) ||
2099 (ibuf[27] != cam->params.roi.rowEnd)) { 2099 (ibuf[27] != cam->params.roi.rowEnd)) {
2100 LOG("ROI mismatch\n"); 2100 LOG("ROI mismatch\n");
2101 up(&cam->param_lock); 2101 mutex_unlock(&cam->param_lock);
2102 return -1; 2102 return -1;
2103 } 2103 }
2104 cols = 8*(ibuf[25] - ibuf[24]); 2104 cols = 8*(ibuf[25] - ibuf[24]);
@@ -2107,14 +2107,14 @@ static int parse_picture(struct cam_data *cam, int size)
2107 2107
2108 if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) { 2108 if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) {
2109 LOG("illegal compression %d\n",ibuf[28]); 2109 LOG("illegal compression %d\n",ibuf[28]);
2110 up(&cam->param_lock); 2110 mutex_unlock(&cam->param_lock);
2111 return -1; 2111 return -1;
2112 } 2112 }
2113 compressed = (ibuf[28] == COMPRESSED); 2113 compressed = (ibuf[28] == COMPRESSED);
2114 2114
2115 if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) { 2115 if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) {
2116 LOG("illegal decimation %d\n",ibuf[29]); 2116 LOG("illegal decimation %d\n",ibuf[29]);
2117 up(&cam->param_lock); 2117 mutex_unlock(&cam->param_lock);
2118 return -1; 2118 return -1;
2119 } 2119 }
2120 decimation = (ibuf[29] == DECIMATION_ENAB); 2120 decimation = (ibuf[29] == DECIMATION_ENAB);
@@ -2130,7 +2130,7 @@ static int parse_picture(struct cam_data *cam, int size)
2130 cam->params.status.vpStatus = ibuf[38]; 2130 cam->params.status.vpStatus = ibuf[38];
2131 cam->params.status.errorCode = ibuf[39]; 2131 cam->params.status.errorCode = ibuf[39];
2132 cam->fps = ibuf[41]; 2132 cam->fps = ibuf[41];
2133 up(&cam->param_lock); 2133 mutex_unlock(&cam->param_lock);
2134 2134
2135 linesize = skipcount(cols, out_fmt); 2135 linesize = skipcount(cols, out_fmt);
2136 ibuf += FRAME_HEADER_SIZE; 2136 ibuf += FRAME_HEADER_SIZE;
@@ -2271,9 +2271,9 @@ static int find_over_exposure(int brightness)
2271/* update various camera modes and settings */ 2271/* update various camera modes and settings */
2272static void dispatch_commands(struct cam_data *cam) 2272static void dispatch_commands(struct cam_data *cam)
2273{ 2273{
2274 down(&cam->param_lock); 2274 mutex_lock(&cam->param_lock);
2275 if (cam->cmd_queue==COMMAND_NONE) { 2275 if (cam->cmd_queue==COMMAND_NONE) {
2276 up(&cam->param_lock); 2276 mutex_unlock(&cam->param_lock);
2277 return; 2277 return;
2278 } 2278 }
2279 DEB_BYTE(cam->cmd_queue); 2279 DEB_BYTE(cam->cmd_queue);
@@ -2415,7 +2415,7 @@ static void dispatch_commands(struct cam_data *cam)
2415 } 2415 }
2416 2416
2417 cam->cmd_queue = COMMAND_NONE; 2417 cam->cmd_queue = COMMAND_NONE;
2418 up(&cam->param_lock); 2418 mutex_unlock(&cam->param_lock);
2419 return; 2419 return;
2420} 2420}
2421 2421
@@ -2562,7 +2562,7 @@ static void monitor_exposure(struct cam_data *cam)
2562 gain = data[2]; 2562 gain = data[2];
2563 coarseL = data[3]; 2563 coarseL = data[3];
2564 2564
2565 down(&cam->param_lock); 2565 mutex_lock(&cam->param_lock);
2566 light_exp = cam->params.colourParams.brightness + 2566 light_exp = cam->params.colourParams.brightness +
2567 TC - 50 + EXP_ACC_LIGHT; 2567 TC - 50 + EXP_ACC_LIGHT;
2568 if(light_exp > 255) 2568 if(light_exp > 255)
@@ -2762,7 +2762,7 @@ static void monitor_exposure(struct cam_data *cam)
2762 LOG("Automatically increasing sensor_fps\n"); 2762 LOG("Automatically increasing sensor_fps\n");
2763 } 2763 }
2764 } 2764 }
2765 up(&cam->param_lock); 2765 mutex_unlock(&cam->param_lock);
2766} 2766}
2767 2767
2768/*-----------------------------------------------------------------*/ 2768/*-----------------------------------------------------------------*/
@@ -2778,10 +2778,10 @@ static void restart_flicker(struct cam_data *cam)
2778 int cam_exposure, old_exp; 2778 int cam_exposure, old_exp;
2779 if(!FIRMWARE_VERSION(1,2)) 2779 if(!FIRMWARE_VERSION(1,2))
2780 return; 2780 return;
2781 down(&cam->param_lock); 2781 mutex_lock(&cam->param_lock);
2782 if(cam->params.flickerControl.flickerMode == 0 || 2782 if(cam->params.flickerControl.flickerMode == 0 ||
2783 cam->raw_image[39] == 0) { 2783 cam->raw_image[39] == 0) {
2784 up(&cam->param_lock); 2784 mutex_unlock(&cam->param_lock);
2785 return; 2785 return;
2786 } 2786 }
2787 cam_exposure = cam->raw_image[39]*2; 2787 cam_exposure = cam->raw_image[39]*2;
@@ -2810,7 +2810,7 @@ static void restart_flicker(struct cam_data *cam)
2810 cam->exposure_status = EXPOSURE_NORMAL; 2810 cam->exposure_status = EXPOSURE_NORMAL;
2811 2811
2812 } 2812 }
2813 up(&cam->param_lock); 2813 mutex_unlock(&cam->param_lock);
2814} 2814}
2815#undef FIRMWARE_VERSION 2815#undef FIRMWARE_VERSION
2816 2816
@@ -3186,7 +3186,7 @@ static int cpia_open(struct inode *inode, struct file *file)
3186 if (!try_module_get(cam->ops->owner)) 3186 if (!try_module_get(cam->ops->owner))
3187 return -ENODEV; 3187 return -ENODEV;
3188 3188
3189 down(&cam->busy_lock); 3189 mutex_lock(&cam->busy_lock);
3190 err = -ENOMEM; 3190 err = -ENOMEM;
3191 if (!cam->raw_image) { 3191 if (!cam->raw_image) {
3192 cam->raw_image = rvmalloc(CPIA_MAX_IMAGE_SIZE); 3192 cam->raw_image = rvmalloc(CPIA_MAX_IMAGE_SIZE);
@@ -3227,7 +3227,7 @@ static int cpia_open(struct inode *inode, struct file *file)
3227 3227
3228 ++cam->open_count; 3228 ++cam->open_count;
3229 file->private_data = dev; 3229 file->private_data = dev;
3230 up(&cam->busy_lock); 3230 mutex_unlock(&cam->busy_lock);
3231 return 0; 3231 return 0;
3232 3232
3233 oops: 3233 oops:
@@ -3239,7 +3239,7 @@ static int cpia_open(struct inode *inode, struct file *file)
3239 rvfree(cam->raw_image, CPIA_MAX_IMAGE_SIZE); 3239 rvfree(cam->raw_image, CPIA_MAX_IMAGE_SIZE);
3240 cam->raw_image = NULL; 3240 cam->raw_image = NULL;
3241 } 3241 }
3242 up(&cam->busy_lock); 3242 mutex_unlock(&cam->busy_lock);
3243 put_cam(cam->ops); 3243 put_cam(cam->ops);
3244 return err; 3244 return err;
3245} 3245}
@@ -3303,24 +3303,24 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
3303 int err; 3303 int err;
3304 3304
3305 /* make this _really_ smp and multithread-safe */ 3305 /* make this _really_ smp and multithread-safe */
3306 if (down_interruptible(&cam->busy_lock)) 3306 if (mutex_lock_interruptible(&cam->busy_lock))
3307 return -EINTR; 3307 return -EINTR;
3308 3308
3309 if (!buf) { 3309 if (!buf) {
3310 DBG("buf NULL\n"); 3310 DBG("buf NULL\n");
3311 up(&cam->busy_lock); 3311 mutex_unlock(&cam->busy_lock);
3312 return -EINVAL; 3312 return -EINVAL;
3313 } 3313 }
3314 3314
3315 if (!count) { 3315 if (!count) {
3316 DBG("count 0\n"); 3316 DBG("count 0\n");
3317 up(&cam->busy_lock); 3317 mutex_unlock(&cam->busy_lock);
3318 return 0; 3318 return 0;
3319 } 3319 }
3320 3320
3321 if (!cam->ops) { 3321 if (!cam->ops) {
3322 DBG("ops NULL\n"); 3322 DBG("ops NULL\n");
3323 up(&cam->busy_lock); 3323 mutex_unlock(&cam->busy_lock);
3324 return -ENODEV; 3324 return -ENODEV;
3325 } 3325 }
3326 3326
@@ -3329,7 +3329,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
3329 cam->mmap_kludge=0; 3329 cam->mmap_kludge=0;
3330 if((err = fetch_frame(cam)) != 0) { 3330 if((err = fetch_frame(cam)) != 0) {
3331 DBG("ERROR from fetch_frame: %d\n", err); 3331 DBG("ERROR from fetch_frame: %d\n", err);
3332 up(&cam->busy_lock); 3332 mutex_unlock(&cam->busy_lock);
3333 return err; 3333 return err;
3334 } 3334 }
3335 cam->decompressed_frame.state = FRAME_UNUSED; 3335 cam->decompressed_frame.state = FRAME_UNUSED;
@@ -3338,17 +3338,17 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
3338 if (cam->decompressed_frame.count > count) { 3338 if (cam->decompressed_frame.count > count) {
3339 DBG("count wrong: %d, %lu\n", cam->decompressed_frame.count, 3339 DBG("count wrong: %d, %lu\n", cam->decompressed_frame.count,
3340 (unsigned long) count); 3340 (unsigned long) count);
3341 up(&cam->busy_lock); 3341 mutex_unlock(&cam->busy_lock);
3342 return -EFAULT; 3342 return -EFAULT;
3343 } 3343 }
3344 if (copy_to_user(buf, cam->decompressed_frame.data, 3344 if (copy_to_user(buf, cam->decompressed_frame.data,
3345 cam->decompressed_frame.count)) { 3345 cam->decompressed_frame.count)) {
3346 DBG("copy_to_user failed\n"); 3346 DBG("copy_to_user failed\n");
3347 up(&cam->busy_lock); 3347 mutex_unlock(&cam->busy_lock);
3348 return -EFAULT; 3348 return -EFAULT;
3349 } 3349 }
3350 3350
3351 up(&cam->busy_lock); 3351 mutex_unlock(&cam->busy_lock);
3352 return cam->decompressed_frame.count; 3352 return cam->decompressed_frame.count;
3353} 3353}
3354 3354
@@ -3363,7 +3363,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3363 return -ENODEV; 3363 return -ENODEV;
3364 3364
3365 /* make this _really_ smp-safe */ 3365 /* make this _really_ smp-safe */
3366 if (down_interruptible(&cam->busy_lock)) 3366 if (mutex_lock_interruptible(&cam->busy_lock))
3367 return -EINTR; 3367 return -EINTR;
3368 3368
3369 //DBG("cpia_ioctl: %u\n", ioctlnr); 3369 //DBG("cpia_ioctl: %u\n", ioctlnr);
@@ -3439,7 +3439,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3439 break; 3439 break;
3440 } 3440 }
3441 3441
3442 down(&cam->param_lock); 3442 mutex_lock(&cam->param_lock);
3443 /* brightness, colour, contrast need no check 0-65535 */ 3443 /* brightness, colour, contrast need no check 0-65535 */
3444 cam->vp = *vp; 3444 cam->vp = *vp;
3445 /* update cam->params.colourParams */ 3445 /* update cam->params.colourParams */
@@ -3466,7 +3466,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3466 3466
3467 /* queue command to update camera */ 3467 /* queue command to update camera */
3468 cam->cmd_queue |= COMMAND_SETCOLOURPARAMS; 3468 cam->cmd_queue |= COMMAND_SETCOLOURPARAMS;
3469 up(&cam->param_lock); 3469 mutex_unlock(&cam->param_lock);
3470 DBG("VIDIOCSPICT: %d / %d // %d / %d / %d / %d\n", 3470 DBG("VIDIOCSPICT: %d / %d // %d / %d / %d / %d\n",
3471 vp->depth, vp->palette, vp->brightness, vp->hue, vp->colour, 3471 vp->depth, vp->palette, vp->brightness, vp->hue, vp->colour,
3472 vp->contrast); 3472 vp->contrast);
@@ -3501,13 +3501,13 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3501 /* we set the video window to something smaller or equal to what 3501 /* we set the video window to something smaller or equal to what
3502 * is requested by the user??? 3502 * is requested by the user???
3503 */ 3503 */
3504 down(&cam->param_lock); 3504 mutex_lock(&cam->param_lock);
3505 if (vw->width != cam->vw.width || vw->height != cam->vw.height) { 3505 if (vw->width != cam->vw.width || vw->height != cam->vw.height) {
3506 int video_size = match_videosize(vw->width, vw->height); 3506 int video_size = match_videosize(vw->width, vw->height);
3507 3507
3508 if (video_size < 0) { 3508 if (video_size < 0) {
3509 retval = -EINVAL; 3509 retval = -EINVAL;
3510 up(&cam->param_lock); 3510 mutex_unlock(&cam->param_lock);
3511 break; 3511 break;
3512 } 3512 }
3513 cam->video_size = video_size; 3513 cam->video_size = video_size;
@@ -3520,7 +3520,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3520 cam->cmd_queue |= COMMAND_SETFORMAT; 3520 cam->cmd_queue |= COMMAND_SETFORMAT;
3521 } 3521 }
3522 3522
3523 up(&cam->param_lock); 3523 mutex_unlock(&cam->param_lock);
3524 3524
3525 /* setformat ignored by camera during streaming, 3525 /* setformat ignored by camera during streaming,
3526 * so stop/dispatch/start */ 3526 * so stop/dispatch/start */
@@ -3682,7 +3682,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3682 3682
3683 DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height); 3683 DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height);
3684 3684
3685 down(&cam->param_lock); 3685 mutex_lock(&cam->param_lock);
3686 3686
3687 cam->vc.x = vc->x; 3687 cam->vc.x = vc->x;
3688 cam->vc.y = vc->y; 3688 cam->vc.y = vc->y;
@@ -3692,7 +3692,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3692 set_vw_size(cam); 3692 set_vw_size(cam);
3693 cam->cmd_queue |= COMMAND_SETFORMAT; 3693 cam->cmd_queue |= COMMAND_SETFORMAT;
3694 3694
3695 up(&cam->param_lock); 3695 mutex_unlock(&cam->param_lock);
3696 3696
3697 /* setformat ignored by camera during streaming, 3697 /* setformat ignored by camera during streaming,
3698 * so stop/dispatch/start */ 3698 * so stop/dispatch/start */
@@ -3736,7 +3736,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3736 break; 3736 break;
3737 } 3737 }
3738 3738
3739 up(&cam->busy_lock); 3739 mutex_unlock(&cam->busy_lock);
3740 return retval; 3740 return retval;
3741} 3741}
3742 3742
@@ -3769,12 +3769,12 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
3769 return -ENODEV; 3769 return -ENODEV;
3770 3770
3771 /* make this _really_ smp-safe */ 3771 /* make this _really_ smp-safe */
3772 if (down_interruptible(&cam->busy_lock)) 3772 if (mutex_lock_interruptible(&cam->busy_lock))
3773 return -EINTR; 3773 return -EINTR;
3774 3774
3775 if (!cam->frame_buf) { /* we do lazy allocation */ 3775 if (!cam->frame_buf) { /* we do lazy allocation */
3776 if ((retval = allocate_frame_buf(cam))) { 3776 if ((retval = allocate_frame_buf(cam))) {
3777 up(&cam->busy_lock); 3777 mutex_unlock(&cam->busy_lock);
3778 return retval; 3778 return retval;
3779 } 3779 }
3780 } 3780 }
@@ -3783,7 +3783,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
3783 while (size > 0) { 3783 while (size > 0) {
3784 page = vmalloc_to_pfn((void *)pos); 3784 page = vmalloc_to_pfn((void *)pos);
3785 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) { 3785 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) {
3786 up(&cam->busy_lock); 3786 mutex_unlock(&cam->busy_lock);
3787 return -EAGAIN; 3787 return -EAGAIN;
3788 } 3788 }
3789 start += PAGE_SIZE; 3789 start += PAGE_SIZE;
@@ -3795,7 +3795,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
3795 } 3795 }
3796 3796
3797 DBG("cpia_mmap: %ld\n", size); 3797 DBG("cpia_mmap: %ld\n", size);
3798 up(&cam->busy_lock); 3798 mutex_unlock(&cam->busy_lock);
3799 3799
3800 return 0; 3800 return 0;
3801} 3801}
@@ -3936,8 +3936,8 @@ static void init_camera_struct(struct cam_data *cam,
3936 memset(cam, 0, sizeof(struct cam_data)); 3936 memset(cam, 0, sizeof(struct cam_data));
3937 3937
3938 cam->ops = ops; 3938 cam->ops = ops;
3939 init_MUTEX(&cam->param_lock); 3939 mutex_init(&cam->param_lock);
3940 init_MUTEX(&cam->busy_lock); 3940 mutex_init(&cam->busy_lock);
3941 3941
3942 reset_camera_struct(cam); 3942 reset_camera_struct(cam);
3943 3943