mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 23:16:37 +07:00
V4L/DVB (8776): radio: replace video_exclusive_open/release
Move the video_exclusive_open/release functionality into the driver itself. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
3b5df8ea40
commit
3ca685aae0
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -85,6 +85,7 @@ static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16 ;
|
||||
static int radio_nr = -1;
|
||||
module_param(radio_nr, int, 0);
|
||||
|
||||
static unsigned long in_use;
|
||||
|
||||
#define FREQ_LO 50*16000
|
||||
#define FREQ_HI 150*16000
|
||||
@ -99,10 +100,21 @@ module_param(radio_nr, int, 0);
|
||||
#define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF)
|
||||
|
||||
|
||||
static int maxiradio_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int maxiradio_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations maxiradio_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = maxiradio_exclusive_open,
|
||||
.release = maxiradio_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
|
@ -52,6 +52,7 @@ static spinlock_t lock;
|
||||
|
||||
struct rt_device
|
||||
{
|
||||
unsigned long in_use;
|
||||
int port;
|
||||
unsigned long curfreq;
|
||||
int muted;
|
||||
@ -284,10 +285,21 @@ static int vidioc_s_audio(struct file *file, void *priv,
|
||||
|
||||
static struct rt_device rtrack2_unit;
|
||||
|
||||
static int rtrack2_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &rtrack2_unit.in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int rtrack2_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &rtrack2_unit.in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations rtrack2_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = rtrack2_exclusive_open,
|
||||
.release = rtrack2_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
|
@ -45,6 +45,7 @@ static struct v4l2_queryctrl radio_qctrl[] = {
|
||||
|
||||
struct fmi_device
|
||||
{
|
||||
unsigned long in_use;
|
||||
int port;
|
||||
int curvol; /* 1 or 0 */
|
||||
unsigned long curfreq; /* freq in kHz */
|
||||
@ -284,10 +285,21 @@ static int vidioc_s_audio(struct file *file, void *priv,
|
||||
|
||||
static struct fmi_device fmi_unit;
|
||||
|
||||
static int fmi_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &fmi_unit.in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int fmi_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &fmi_unit.in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations fmi_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = fmi_exclusive_open,
|
||||
.release = fmi_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
|
@ -64,6 +64,7 @@ static struct v4l2_queryctrl radio_qctrl[] = {
|
||||
/* this should be static vars for module size */
|
||||
struct fmr2_device
|
||||
{
|
||||
unsigned long in_use;
|
||||
int port;
|
||||
int curvol; /* 0-15 */
|
||||
int mute;
|
||||
@ -400,10 +401,21 @@ static int vidioc_s_audio(struct file *file, void *priv,
|
||||
|
||||
static struct fmr2_device fmr2_unit;
|
||||
|
||||
static int fmr2_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &fmr2_unit.in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int fmr2_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &fmr2_unit.in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations fmr2_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = fmr2_exclusive_open,
|
||||
.release = fmr2_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
|
@ -79,6 +79,7 @@ static spinlock_t lock;
|
||||
|
||||
struct tt_device
|
||||
{
|
||||
unsigned long in_use;
|
||||
int port;
|
||||
int curvol;
|
||||
unsigned long curfreq;
|
||||
@ -356,10 +357,21 @@ static int vidioc_s_audio(struct file *file, void *priv,
|
||||
|
||||
static struct tt_device terratec_unit;
|
||||
|
||||
static int terratec_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &terratec_unit.in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int terratec_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &terratec_unit.in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations terratec_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = terratec_exclusive_open,
|
||||
.release = terratec_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
|
@ -78,6 +78,7 @@ static __u16 curtreble;
|
||||
static unsigned long curfreq;
|
||||
static int curstereo;
|
||||
static int curmute;
|
||||
static unsigned long in_use;
|
||||
|
||||
/* i2c addresses */
|
||||
#define TDA7318_ADDR 0x88
|
||||
@ -336,10 +337,21 @@ static int vidioc_s_audio(struct file *file, void *priv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trust_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int trust_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations trust_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = trust_exclusive_open,
|
||||
.release = trust_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
|
@ -79,7 +79,7 @@ static struct v4l2_queryctrl radio_qctrl[] = {
|
||||
#endif
|
||||
|
||||
struct typhoon_device {
|
||||
int users;
|
||||
unsigned long in_use;
|
||||
int iobase;
|
||||
int curvol;
|
||||
int muted;
|
||||
@ -334,10 +334,21 @@ static struct typhoon_device typhoon_unit =
|
||||
.mutefreq = CONFIG_RADIO_TYPHOON_MUTEFREQ,
|
||||
};
|
||||
|
||||
static int typhoon_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &typhoon_unit.in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int typhoon_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &typhoon_unit.in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations typhoon_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = typhoon_exclusive_open,
|
||||
.release = typhoon_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
@ -447,8 +458,7 @@ static int __init typhoon_init(void)
|
||||
}
|
||||
|
||||
typhoon_radio.priv = &typhoon_unit;
|
||||
if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) == -1)
|
||||
{
|
||||
if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
|
||||
release_region(io, 8);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ static int io = CONFIG_RADIO_ZOLTRIX_PORT;
|
||||
static int radio_nr = -1;
|
||||
|
||||
struct zol_device {
|
||||
unsigned long in_use;
|
||||
int port;
|
||||
int curvol;
|
||||
unsigned long curfreq;
|
||||
@ -396,11 +397,22 @@ static int vidioc_s_audio(struct file *file, void *priv,
|
||||
|
||||
static struct zol_device zoltrix_unit;
|
||||
|
||||
static int zoltrix_exclusive_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return test_and_set_bit(0, &zoltrix_unit.in_use) ? -EBUSY : 0;
|
||||
}
|
||||
|
||||
static int zoltrix_exclusive_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
clear_bit(0, &zoltrix_unit.in_use);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations zoltrix_fops =
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.open = video_exclusive_open,
|
||||
.release = video_exclusive_release,
|
||||
.open = zoltrix_exclusive_open,
|
||||
.release = zoltrix_exclusive_release,
|
||||
.ioctl = video_ioctl2,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = v4l_compat_ioctl32,
|
||||
|
Loading…
Reference in New Issue
Block a user