Commit befd6e64 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (10511): saa7134: get rid of KBL

KBL is not needed on saa7134, so, let's remove it.

However, we should take some care to avoid opening the module while
initializing it. This issue exists with newer udev's that opens a device
as soon as the driver is registered. So, a proper lock is needed on
open.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 553d3c50
...@@ -86,8 +86,10 @@ MODULE_PARM_DESC(radio_nr, "radio device number"); ...@@ -86,8 +86,10 @@ MODULE_PARM_DESC(radio_nr, "radio device number");
MODULE_PARM_DESC(tuner, "tuner type"); MODULE_PARM_DESC(tuner, "tuner type");
MODULE_PARM_DESC(card, "card type"); MODULE_PARM_DESC(card, "card type");
static DEFINE_MUTEX(devlist_lock); DEFINE_MUTEX(saa7134_devlist_lock);
EXPORT_SYMBOL(saa7134_devlist_lock);
LIST_HEAD(saa7134_devlist); LIST_HEAD(saa7134_devlist);
EXPORT_SYMBOL(saa7134_devlist);
static LIST_HEAD(mops_list); static LIST_HEAD(mops_list);
static unsigned int saa7134_devcount; static unsigned int saa7134_devcount;
...@@ -991,6 +993,18 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -991,6 +993,18 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
v4l2_prio_init(&dev->prio); v4l2_prio_init(&dev->prio);
mutex_lock(&saa7134_devlist_lock);
list_for_each_entry(mops, &mops_list, next)
mpeg_ops_attach(mops, dev);
list_add_tail(&dev->devlist, &saa7134_devlist);
mutex_unlock(&saa7134_devlist_lock);
/* check for signal */
saa7134_irq_video_signalchange(dev);
if (TUNER_ABSENT != dev->tuner_type)
saa_call_all(dev, core, s_standby, 0);
/* register v4l devices */ /* register v4l devices */
if (saa7134_no_overlay > 0) if (saa7134_no_overlay > 0)
printk(KERN_INFO "%s: Overlay support disabled.\n", dev->name); printk(KERN_INFO "%s: Overlay support disabled.\n", dev->name);
...@@ -1028,21 +1042,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -1028,21 +1042,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
/* everything worked */ /* everything worked */
saa7134_devcount++; saa7134_devcount++;
mutex_lock(&devlist_lock); if (saa7134_dmasound_init && !dev->dmasound.priv_data)
list_for_each_entry(mops, &mops_list, next)
mpeg_ops_attach(mops, dev);
list_add_tail(&dev->devlist,&saa7134_devlist);
mutex_unlock(&devlist_lock);
/* check for signal */
saa7134_irq_video_signalchange(dev);
if (saa7134_dmasound_init && !dev->dmasound.priv_data) {
saa7134_dmasound_init(dev); saa7134_dmasound_init(dev);
}
if (TUNER_ABSENT != dev->tuner_type)
saa_call_all(dev, core, s_standby, 0);
return 0; return 0;
...@@ -1093,11 +1094,11 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) ...@@ -1093,11 +1094,11 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
saa7134_hwfini(dev); saa7134_hwfini(dev);
/* unregister */ /* unregister */
mutex_lock(&devlist_lock); mutex_lock(&saa7134_devlist_lock);
list_del(&dev->devlist); list_del(&dev->devlist);
list_for_each_entry(mops, &mops_list, next) list_for_each_entry(mops, &mops_list, next)
mpeg_ops_detach(mops, dev); mpeg_ops_detach(mops, dev);
mutex_unlock(&devlist_lock); mutex_unlock(&saa7134_devlist_lock);
saa7134_devcount--; saa7134_devcount--;
saa7134_i2c_unregister(dev); saa7134_i2c_unregister(dev);
...@@ -1254,11 +1255,11 @@ int saa7134_ts_register(struct saa7134_mpeg_ops *ops) ...@@ -1254,11 +1255,11 @@ int saa7134_ts_register(struct saa7134_mpeg_ops *ops)
{ {
struct saa7134_dev *dev; struct saa7134_dev *dev;
mutex_lock(&devlist_lock); mutex_lock(&saa7134_devlist_lock);
list_for_each_entry(dev, &saa7134_devlist, devlist) list_for_each_entry(dev, &saa7134_devlist, devlist)
mpeg_ops_attach(ops, dev); mpeg_ops_attach(ops, dev);
list_add_tail(&ops->next,&mops_list); list_add_tail(&ops->next,&mops_list);
mutex_unlock(&devlist_lock); mutex_unlock(&saa7134_devlist_lock);
return 0; return 0;
} }
...@@ -1266,11 +1267,11 @@ void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops) ...@@ -1266,11 +1267,11 @@ void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops)
{ {
struct saa7134_dev *dev; struct saa7134_dev *dev;
mutex_lock(&devlist_lock); mutex_lock(&saa7134_devlist_lock);
list_del(&ops->next); list_del(&ops->next);
list_for_each_entry(dev, &saa7134_devlist, devlist) list_for_each_entry(dev, &saa7134_devlist, devlist)
mpeg_ops_detach(ops, dev); mpeg_ops_detach(ops, dev);
mutex_unlock(&devlist_lock); mutex_unlock(&saa7134_devlist_lock);
} }
EXPORT_SYMBOL(saa7134_ts_register); EXPORT_SYMBOL(saa7134_ts_register);
...@@ -1314,7 +1315,6 @@ module_exit(saa7134_fini); ...@@ -1314,7 +1315,6 @@ module_exit(saa7134_fini);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
EXPORT_SYMBOL(saa7134_set_gpio); EXPORT_SYMBOL(saa7134_set_gpio);
EXPORT_SYMBOL(saa7134_devlist);
EXPORT_SYMBOL(saa7134_boards); EXPORT_SYMBOL(saa7134_boards);
/* ----------------- for the DMA sound modules --------------- */ /* ----------------- for the DMA sound modules --------------- */
......
...@@ -1335,7 +1335,7 @@ static int video_open(struct file *file) ...@@ -1335,7 +1335,7 @@ static int video_open(struct file *file)
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
int radio = 0; int radio = 0;
lock_kernel(); mutex_lock(&saa7134_devlist_lock);
list_for_each_entry(dev, &saa7134_devlist, devlist) { list_for_each_entry(dev, &saa7134_devlist, devlist) {
if (dev->video_dev && (dev->video_dev->minor == minor)) if (dev->video_dev && (dev->video_dev->minor == minor))
goto found; goto found;
...@@ -1348,19 +1348,20 @@ static int video_open(struct file *file) ...@@ -1348,19 +1348,20 @@ static int video_open(struct file *file)
goto found; goto found;
} }
} }
unlock_kernel(); mutex_unlock(&saa7134_devlist_lock);
return -ENODEV; return -ENODEV;
found:
found:
mutex_unlock(&saa7134_devlist_lock);
dprintk("open minor=%d radio=%d type=%s\n",minor,radio, dprintk("open minor=%d radio=%d type=%s\n",minor,radio,
v4l2_type_names[type]); v4l2_type_names[type]);
/* allocate + initialize per filehandle data */ /* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh),GFP_KERNEL); fh = kzalloc(sizeof(*fh),GFP_KERNEL);
if (NULL == fh) { if (NULL == fh)
unlock_kernel();
return -ENOMEM; return -ENOMEM;
}
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
fh->radio = radio; fh->radio = radio;
...@@ -1393,7 +1394,6 @@ static int video_open(struct file *file) ...@@ -1393,7 +1394,6 @@ static int video_open(struct file *file)
/* switch to video/vbi mode */ /* switch to video/vbi mode */
video_mux(dev,dev->ctl_input); video_mux(dev,dev->ctl_input);
} }
unlock_kernel();
return 0; return 0;
} }
......
...@@ -641,6 +641,7 @@ struct saa7134_dev { ...@@ -641,6 +641,7 @@ struct saa7134_dev {
/* saa7134-core.c */ /* saa7134-core.c */
extern struct list_head saa7134_devlist; extern struct list_head saa7134_devlist;
extern struct mutex saa7134_devlist_lock;
extern int saa7134_no_overlay; extern int saa7134_no_overlay;
void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment