Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250232
b: refs/heads/master
c: 344d6c6
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Nieder authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 023ca38 commit a70e7f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 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: 1d6213ab995c61f7d1d81cf6cf876acf15d6e714
refs/heads/master: 344d6c6ba6ba5c4fede2f07adbd26d53109a2dd8
20 changes: 17 additions & 3 deletions trunk/drivers/media/video/cx88/cx88-mpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static void flush_request_modules(struct cx8802_dev *dev)


static LIST_HEAD(cx8802_devlist);
static DEFINE_MUTEX(cx8802_mutex);
/* ------------------------------------------------------------------ */

static int cx8802_start_dma(struct cx8802_dev *dev,
Expand Down Expand Up @@ -689,6 +690,8 @@ int cx8802_register_driver(struct cx8802_driver *drv)
return err;
}

mutex_lock(&cx8802_mutex);

list_for_each_entry(dev, &cx8802_devlist, devlist) {
printk(KERN_INFO
"%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n",
Expand All @@ -698,8 +701,10 @@ int cx8802_register_driver(struct cx8802_driver *drv)

/* Bring up a new struct for each driver instance */
driver = kzalloc(sizeof(*drv),GFP_KERNEL);
if (driver == NULL)
return -ENOMEM;
if (driver == NULL) {
err = -ENOMEM;
goto out;
}

/* Snapshot of the driver registration data */
drv->core = dev->core;
Expand All @@ -722,7 +727,10 @@ int cx8802_register_driver(struct cx8802_driver *drv)
mutex_unlock(&drv->core->lock);
}

return i ? 0 : -ENODEV;
err = i ? 0 : -ENODEV;
out:
mutex_unlock(&cx8802_mutex);
return err;
}

int cx8802_unregister_driver(struct cx8802_driver *drv)
Expand All @@ -736,6 +744,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");

mutex_lock(&cx8802_mutex);

list_for_each_entry(dev, &cx8802_devlist, devlist) {
printk(KERN_INFO
"%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n",
Expand All @@ -762,6 +772,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
mutex_unlock(&dev->core->lock);
}

mutex_unlock(&cx8802_mutex);

return err;
}

Expand Down Expand Up @@ -799,7 +811,9 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
goto fail_free;

INIT_LIST_HEAD(&dev->drvlist);
mutex_lock(&cx8802_mutex);
list_add_tail(&dev->devlist,&cx8802_devlist);
mutex_unlock(&cx8802_mutex);

/* now autoload cx88-dvb or cx88-blackbird */
request_modules(dev);
Expand Down

0 comments on commit a70e7f1

Please sign in to comment.