diff options
author | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-11 20:58:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:27 -0400 |
commit | e13ce79734348610a2b782cb818db65659b0dc83 (patch) | |
tree | 41b70ab7cfd93b553ce3c0cb59dd75a187396887 /drivers/media/video | |
parent | b14667f32ad0f85f986847ef65f9f3d12a44b71a (diff) |
V4L/DVB (11081): au0828: make sure v4l2_device name is unique
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.
Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/au0828/au0828-core.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c index 3281a17fa2cd..8c761d164442 100644 --- a/drivers/media/video/au0828/au0828-core.c +++ b/drivers/media/video/au0828/au0828-core.c | |||
@@ -36,6 +36,8 @@ int au0828_debug; | |||
36 | module_param_named(debug, au0828_debug, int, 0644); | 36 | module_param_named(debug, au0828_debug, int, 0644); |
37 | MODULE_PARM_DESC(debug, "enable debug messages"); | 37 | MODULE_PARM_DESC(debug, "enable debug messages"); |
38 | 38 | ||
39 | static atomic_t au0828_instance = ATOMIC_INIT(0); | ||
40 | |||
39 | #define _AU0828_BULKPIPE 0x03 | 41 | #define _AU0828_BULKPIPE 0x03 |
40 | #define _BULKPIPESIZE 0xffff | 42 | #define _BULKPIPESIZE 0xffff |
41 | 43 | ||
@@ -167,7 +169,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface) | |||
167 | static int au0828_usb_probe(struct usb_interface *interface, | 169 | static int au0828_usb_probe(struct usb_interface *interface, |
168 | const struct usb_device_id *id) | 170 | const struct usb_device_id *id) |
169 | { | 171 | { |
170 | int ifnum, retval; | 172 | int ifnum, retval, i; |
171 | struct au0828_dev *dev; | 173 | struct au0828_dev *dev; |
172 | struct usb_device *usbdev = interface_to_usbdev(interface); | 174 | struct usb_device *usbdev = interface_to_usbdev(interface); |
173 | 175 | ||
@@ -195,8 +197,9 @@ static int au0828_usb_probe(struct usb_interface *interface, | |||
195 | usb_set_intfdata(interface, dev); | 197 | usb_set_intfdata(interface, dev); |
196 | 198 | ||
197 | /* Create the v4l2_device */ | 199 | /* Create the v4l2_device */ |
200 | i = atomic_inc_return(&au0828_instance) - 1; | ||
198 | snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s-%03d", | 201 | snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s-%03d", |
199 | "au0828", 0); | 202 | "au0828", i); |
200 | retval = v4l2_device_register(&dev->usbdev->dev, &dev->v4l2_dev); | 203 | retval = v4l2_device_register(&dev->usbdev->dev, &dev->v4l2_dev); |
201 | if (retval) { | 204 | if (retval) { |
202 | printk(KERN_ERR "%s() v4l2_device_register failed\n", | 205 | printk(KERN_ERR "%s() v4l2_device_register failed\n", |