Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250229
b: refs/heads/master
c: 8a317a8
h: refs/heads/master
i:
  250227: a96c42c
v: v3
  • Loading branch information
Jonathan Nieder authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 4741053 commit 0795a54
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cae72c7c63fd4a8f20efc001108f12f34076c17b
refs/heads/master: 8a317a8760cfffa8185b56ff59fb4b6c58488d79
3 changes: 2 additions & 1 deletion trunk/drivers/media/video/cx88/cx88-blackbird.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,10 +1122,11 @@ static int mpeg_release(struct file *file)
mutex_lock(&dev->core->lock);
file->private_data = NULL;
kfree(fh);
mutex_unlock(&dev->core->lock);

/* Make sure we release the hardware */
drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
mutex_unlock(&dev->core->lock);

if (drv)
drv->request_release(drv);

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/media/video/cx88/cx88-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire)
return -EINVAL;
}

mutex_lock(&dev->core->lock);
drv = cx8802_get_driver(dev, CX88_MPEG_DVB);
mutex_unlock(&dev->core->lock);

if (drv) {
if (acquire){
dev->frontends.active_fe_id = fe_id;
Expand Down
11 changes: 7 additions & 4 deletions trunk/drivers/media/video/cx88/cx88-mpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,22 +748,23 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
dev->pci->subsystem_device, dev->core->board.name,
dev->core->boardnr);

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

list_for_each_entry_safe(d, dtmp, &dev->drvlist, drvlist) {
/* only unregister the correct driver type */
if (d->type_id != drv->type_id)
continue;

err = d->remove(d);
if (err == 0) {
mutex_lock(&drv->core->lock);
list_del(&d->drvlist);
mutex_unlock(&drv->core->lock);
kfree(d);
} else
printk(KERN_ERR "%s/2: cx8802 driver remove "
"failed (%d)\n", dev->core->name, err);
}

mutex_unlock(&dev->core->lock);
}

return err;
Expand Down Expand Up @@ -827,6 +828,8 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev)

flush_request_modules(dev);

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

if (!list_empty(&dev->drvlist)) {
struct cx8802_driver *drv, *tmp;
int err;
Expand All @@ -838,16 +841,16 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev)
list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) {
err = drv->remove(drv);
if (err == 0) {
mutex_lock(&drv->core->lock);
list_del(&drv->drvlist);
mutex_unlock(&drv->core->lock);
} else
printk(KERN_ERR "%s/2: cx8802 driver remove "
"failed (%d)\n", dev->core->name, err);
kfree(drv);
}
}

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

/* Destroy any 8802 reference. */
dev->core->dvbdev = NULL;

Expand Down
9 changes: 8 additions & 1 deletion trunk/drivers/media/video/cx88/cx88.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,11 @@ struct cx8802_driver {
int (*resume)(struct pci_dev *pci_dev);

/* MPEG 8802 -> mini driver - Driver probe and configuration */

/* Caller must _not_ hold core->lock */
int (*probe)(struct cx8802_driver *drv);

/* Caller must hold core->lock */
int (*remove)(struct cx8802_driver *drv);

/* MPEG 8802 -> mini driver - Access for hardware control */
Expand Down Expand Up @@ -561,8 +565,9 @@ struct cx8802_dev {
/* for switching modulation types */
unsigned char ts_gen_cntrl;

/* List of attached drivers */
/* List of attached drivers; must hold core->lock to access */
struct list_head drvlist;

struct work_struct request_module_wk;
};

Expand Down Expand Up @@ -685,6 +690,8 @@ int cx88_audio_thread(void *data);

int cx8802_register_driver(struct cx8802_driver *drv);
int cx8802_unregister_driver(struct cx8802_driver *drv);

/* Caller must hold core->lock */
struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);

/* ----------------------------------------------------------- */
Expand Down

0 comments on commit 0795a54

Please sign in to comment.