Commit 3ca685aa authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (8776): radio: replace video_exclusive_open/release



Move the video_exclusive_open/release functionality into the driver itself.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3b5df8ea
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ static struct mutex lock;

struct rt_device
{
	unsigned long in_use;
	int port;
	int curvol;
	unsigned long curfreq;
@@ -378,10 +379,21 @@ static int vidioc_s_audio(struct file *file, void *priv,

static struct rt_device rtrack_unit;

static int rtrack_exclusive_open(struct inode *inode, struct file *file)
{
	return test_and_set_bit(0, &rtrack_unit.in_use) ? -EBUSY : 0;
}

static int rtrack_exclusive_release(struct inode *inode, struct file *file)
{
	clear_bit(0, &rtrack_unit.in_use);
	return 0;
}

static const struct file_operations rtrack_fops = {
	.owner		= THIS_MODULE,
	.open           = video_exclusive_open,
	.release        = video_exclusive_release,
	.open           = rtrack_exclusive_open,
	.release        = rtrack_exclusive_release,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
+14 −2
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ static struct mutex lock;

struct az_device
{
	unsigned long in_use;
	int curvol;
	unsigned long curfreq;
	int stereo;
@@ -342,10 +343,21 @@ static int vidioc_s_ctrl (struct file *file, void *priv,

static struct az_device aztech_unit;

static int aztech_exclusive_open(struct inode *inode, struct file *file)
{
	return test_and_set_bit(0, &aztech_unit.in_use) ? -EBUSY : 0;
}

static int aztech_exclusive_release(struct inode *inode, struct file *file)
{
	clear_bit(0, &aztech_unit.in_use);
	return 0;
}

static const struct file_operations aztech_fops = {
	.owner		= THIS_MODULE,
	.open           = video_exclusive_open,
	.release        = video_exclusive_release,
	.open           = aztech_exclusive_open,
	.release        = aztech_exclusive_release,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
+14 −4
Original line number Diff line number Diff line
@@ -100,9 +100,8 @@ struct gemtek_pci_card {
	u8  mute;
};

static const char rcsid[] = "$Id: radio-gemtek-pci.c,v 1.1 2001/07/23 08:08:16 ted Exp ted $";

static int nr_radio = -1;
static unsigned long in_use;

static inline u8 gemtek_pci_out( u16 value, u32 port )
{
@@ -364,10 +363,21 @@ MODULE_DEVICE_TABLE( pci, gemtek_pci_id );

static int mx = 1;

static int gemtek_pci_exclusive_open(struct inode *inode, struct file *file)
{
	return test_and_set_bit(0, &in_use) ? -EBUSY : 0;
}

static int gemtek_pci_exclusive_release(struct inode *inode, struct file *file)
{
	clear_bit(0, &in_use);
	return 0;
}

static const struct file_operations gemtek_pci_fops = {
	.owner		= THIS_MODULE,
	.open           = video_exclusive_open,
	.release        = video_exclusive_release,
	.open           = gemtek_pci_exclusive_open,
	.release        = gemtek_pci_exclusive_release,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
+14 −2
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ static int shutdown = 1;
static int keepmuted	= 1;
static int initmute	= 1;
static int radio_nr	= -1;
static unsigned long in_use;

module_param(io, int, 0444);
MODULE_PARM_DESC(io, "Force I/O port for the GemTek Radio card if automatic "
@@ -393,10 +394,21 @@ static struct v4l2_queryctrl radio_qctrl[] = {
	}
};

static int gemtek_exclusive_open(struct inode *inode, struct file *file)
{
	return test_and_set_bit(0, &in_use) ? -EBUSY : 0;
}

static int gemtek_exclusive_release(struct inode *inode, struct file *file)
{
	clear_bit(0, &in_use);
	return 0;
}

static const struct file_operations gemtek_fops = {
	.owner		= THIS_MODULE,
	.open		= video_exclusive_open,
	.release	= video_exclusive_release,
	.open		= gemtek_exclusive_open,
	.release	= gemtek_exclusive_release,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
+16 −2
Original line number Diff line number Diff line
@@ -75,7 +75,21 @@ static struct v4l2_queryctrl radio_qctrl[] = {
static int radio_nr = -1;
module_param(radio_nr, int, 0);

static unsigned long in_use;

static int maestro_probe(struct pci_dev *pdev, const struct pci_device_id *ent);

static int maestro_exclusive_open(struct inode *inode, struct file *file)
{
	return test_and_set_bit(0, &in_use) ? -EBUSY : 0;
}

static int maestro_exclusive_release(struct inode *inode, struct file *file)
{
	clear_bit(0, &in_use);
	return 0;
}

static void maestro_remove(struct pci_dev *pdev);

static struct pci_device_id maestro_r_pci_tbl[] = {
@@ -98,8 +112,8 @@ static struct pci_driver maestro_r_driver = {

static const struct file_operations maestro_fops = {
	.owner		= THIS_MODULE,
	.open           = video_exclusive_open,
	.release        = video_exclusive_release,
	.open           = maestro_exclusive_open,
	.release        = maestro_exclusive_release,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
Loading