diff options
author | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-11 20:58:04 -0400 |
---|---|---|
committer | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-11 20:58:04 -0400 |
commit | a0600eb3e37815b9a780193dc7c9e4dff4cc9291 (patch) | |
tree | de13f810bf298ec7493a6d073b99de164aeac34a /linux/drivers/media/video/au0828 | |
parent | 1c6b90fa7084d63133a8418affbf10267f674abb (diff) | |
download | mediapointer-dvb-s2-a0600eb3e37815b9a780193dc7c9e4dff4cc9291.tar.gz mediapointer-dvb-s2-a0600eb3e37815b9a780193dc7c9e4dff4cc9291.tar.bz2 |
au0828: make sure v4l2_device name is unique
From: Devin Heitmueller <dheitmueller@linuxtv.org>
Make sure newly created v4l2 devices have a unique name, modeling the logic
after the cx18 driver.
Thanks to Andy Walls <awalls@radix.net> for pointing out the issue.
Priority: normal
Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/video/au0828')
-rw-r--r-- | linux/drivers/media/video/au0828/au0828-core.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/linux/drivers/media/video/au0828/au0828-core.c b/linux/drivers/media/video/au0828/au0828-core.c index 327c6edde..ffe1bf019 100644 --- a/linux/drivers/media/video/au0828/au0828-core.c +++ b/linux/drivers/media/video/au0828/au0828-core.c @@ -37,6 +37,8 @@ int au0828_debug; module_param_named(debug, au0828_debug, int, 0644); MODULE_PARM_DESC(debug, "enable debug messages"); +static atomic_t au0828_instance = ATOMIC_INIT(0); + #define _AU0828_BULKPIPE 0x03 #define _BULKPIPESIZE 0xffff @@ -168,7 +170,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface) static int au0828_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) { - int ifnum, retval; + int ifnum, retval, i; struct au0828_dev *dev; struct usb_device *usbdev = interface_to_usbdev(interface); @@ -196,8 +198,9 @@ static int au0828_usb_probe(struct usb_interface *interface, usb_set_intfdata(interface, dev); /* Create the v4l2_device */ + i = atomic_inc_return(&au0828_instance) - 1; snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s-%03d", - "au0828", 0); + "au0828", i); retval = v4l2_device_register(&dev->usbdev->dev, &dev->v4l2_dev); if (retval) { printk(KERN_ERR "%s() v4l2_device_register failed\n", |