Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3593cab5 authored by Ingo Molnar's avatar Ingo Molnar Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (3318b): sem2mutex: drivers/media/, #2



Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 538f9630
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include <media/saa7146.h>

LIST_HEAD(saa7146_devices);
DECLARE_MUTEX(saa7146_devices_lock);
DEFINE_MUTEX(saa7146_devices_lock);

static int saa7146_num;

@@ -402,11 +402,11 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent

	pci_set_drvdata(pci, dev);

	init_MUTEX(&dev->lock);
	mutex_init(&dev->lock);
	spin_lock_init(&dev->int_slock);
	spin_lock_init(&dev->slock);

	init_MUTEX(&dev->i2c_lock);
	mutex_init(&dev->i2c_lock);

	dev->module = THIS_MODULE;
	init_waitqueue_head(&dev->i2c_wq);
+9 −9
Original line number Diff line number Diff line
@@ -17,18 +17,18 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit)
	}

	/* is it free? */
	down(&dev->lock);
	mutex_lock(&dev->lock);
	if (vv->resources & bit) {
		DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit));
		/* no, someone else uses it */
		up(&dev->lock);
		mutex_unlock(&dev->lock);
		return 0;
	}
	/* it's free, grab it */
	fh->resources  |= bit;
	vv->resources |= bit;
	DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources));
	up(&dev->lock);
	mutex_unlock(&dev->lock);
	return 1;
}

@@ -40,11 +40,11 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits)
	if ((fh->resources & bits) != bits)
		BUG();

	down(&dev->lock);
	mutex_lock(&dev->lock);
	fh->resources  &= ~bits;
	vv->resources &= ~bits;
	DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources));
	up(&dev->lock);
	mutex_unlock(&dev->lock);
}


@@ -204,7 +204,7 @@ static int fops_open(struct inode *inode, struct file *file)

	DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor));

	if (down_interruptible(&saa7146_devices_lock))
	if (mutex_lock_interruptible(&saa7146_devices_lock))
		return -ERESTARTSYS;

	list_for_each(list,&saa7146_devices) {
@@ -276,7 +276,7 @@ out:
		kfree(fh);
		file->private_data = NULL;
	}
	up(&saa7146_devices_lock);
	mutex_unlock(&saa7146_devices_lock);
	return result;
}

@@ -287,7 +287,7 @@ static int fops_release(struct inode *inode, struct file *file)

	DEB_EE(("inode:%p, file:%p\n",inode,file));

	if (down_interruptible(&saa7146_devices_lock))
	if (mutex_lock_interruptible(&saa7146_devices_lock))
		return -ERESTARTSYS;

	if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
@@ -303,7 +303,7 @@ static int fops_release(struct inode *inode, struct file *file)
	file->private_data = NULL;
	kfree(fh);

	up(&saa7146_devices_lock);
	mutex_unlock(&saa7146_devices_lock);

	return 0;
}
+2 −2
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
	int address_err = 0;
	int short_delay = 0;

	if (down_interruptible (&dev->i2c_lock))
	if (mutex_lock_interruptible(&dev->i2c_lock))
		return -ERESTARTSYS;

	for(i=0;i<num;i++) {
@@ -366,7 +366,7 @@ out:
		}
	}

	up(&dev->i2c_lock);
	mutex_unlock(&dev->i2c_lock);
	return err;
}

+1 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
			    V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
			    sizeof(struct saa7146_buf),
			    file);
	init_MUTEX(&fh->vbi_q.lock);
	mutex_init(&fh->vbi_q.lock);

	init_timer(&fh->vbi_read_timeout);
	fh->vbi_read_timeout.function = vbi_read_timeout;
+15 −15
Original line number Diff line number Diff line
@@ -378,20 +378,20 @@ static int s_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
		err = try_win(dev,&f->fmt.win);
		if (0 != err)
			return err;
		down(&dev->lock);
		mutex_lock(&dev->lock);
		fh->ov.win    = f->fmt.win;
		fh->ov.nclips = f->fmt.win.clipcount;
		if (fh->ov.nclips > 16)
			fh->ov.nclips = 16;
		if (copy_from_user(fh->ov.clips,f->fmt.win.clips,sizeof(struct v4l2_clip)*fh->ov.nclips)) {
			up(&dev->lock);
			mutex_unlock(&dev->lock);
			return -EFAULT;
		}

		/* fh->ov.fh is used to indicate that we have valid overlay informations, too */
		fh->ov.fh = fh;

		up(&dev->lock);
		mutex_unlock(&dev->lock);

		/* check if our current overlay is active */
		if (IS_OVERLAY_ACTIVE(fh) != 0) {
@@ -516,7 +516,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
		return -EINVAL;
	}

	down(&dev->lock);
	mutex_lock(&dev->lock);

	switch (ctrl->type) {
	case V4L2_CTRL_TYPE_BOOLEAN:
@@ -560,7 +560,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
		/* fixme: we can support changing VFLIP and HFLIP here... */
		if (IS_CAPTURE_ACTIVE(fh) != 0) {
			DEB_D(("V4L2_CID_HFLIP while active capture.\n"));
			up(&dev->lock);
			mutex_unlock(&dev->lock);
			return -EINVAL;
		}
		vv->hflip = c->value;
@@ -568,7 +568,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
	case V4L2_CID_VFLIP:
		if (IS_CAPTURE_ACTIVE(fh) != 0) {
			DEB_D(("V4L2_CID_VFLIP while active capture.\n"));
			up(&dev->lock);
			mutex_unlock(&dev->lock);
			return -EINVAL;
		}
		vv->vflip = c->value;
@@ -577,7 +577,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
		return -EINVAL;
	}
	}
	up(&dev->lock);
	mutex_unlock(&dev->lock);

	if (IS_OVERLAY_ACTIVE(fh) != 0) {
		saa7146_stop_preview(fh);
@@ -939,7 +939,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
			}
		}

		down(&dev->lock);
		mutex_lock(&dev->lock);

		/* ok, accept it */
		vv->ov_fb = *fb;
@@ -948,7 +948,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
			vv->ov_fb.fmt.bytesperline =
				vv->ov_fb.fmt.width*fmt->depth/8;

		up(&dev->lock);
		mutex_unlock(&dev->lock);

		return 0;
	}
@@ -1086,7 +1086,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
			}
		}

		down(&dev->lock);
		mutex_lock(&dev->lock);

		for(i = 0; i < dev->ext_vv_data->num_stds; i++)
			if (*id & dev->ext_vv_data->stds[i].id)
@@ -1098,7 +1098,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
			found = 1;
		}

		up(&dev->lock);
		mutex_unlock(&dev->lock);

		if (vv->ov_suspend != NULL) {
			saa7146_start_preview(vv->ov_suspend);
@@ -1201,11 +1201,11 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
		DEB_D(("VIDIOCGMBUF \n"));

		q = &fh->video_q;
		down(&q->lock);
		mutex_lock(&q->lock);
		err = videobuf_mmap_setup(q,gbuffers,gbufsize,
					  V4L2_MEMORY_MMAP);
		if (err < 0) {
			up(&q->lock);
			mutex_unlock(&q->lock);
			return err;
		}
		memset(mbuf,0,sizeof(*mbuf));
@@ -1213,7 +1213,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
		mbuf->size   = gbuffers * gbufsize;
		for (i = 0; i < gbuffers; i++)
			mbuf->offsets[i] = i * gbufsize;
		up(&q->lock);
		mutex_unlock(&q->lock);
		return 0;
	}
	default:
@@ -1414,7 +1414,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
			    sizeof(struct saa7146_buf),
			    file);

	init_MUTEX(&fh->video_q.lock);
	mutex_init(&fh->video_q.lock);

	return 0;
}
Loading