aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-alsa-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx18/cx18-alsa-main.c')
-rw-r--r--drivers/media/video/cx18/cx18-alsa-main.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/media/video/cx18/cx18-alsa-main.c b/drivers/media/video/cx18/cx18-alsa-main.c
index 3c339774522a..6433ff0ad859 100644
--- a/drivers/media/video/cx18/cx18-alsa-main.c
+++ b/drivers/media/video/cx18/cx18-alsa-main.c
@@ -190,11 +190,9 @@ err_exit:
190 return ret; 190 return ret;
191} 191}
192 192
193static int __init cx18_alsa_init_callback(struct device *dev, void *data) 193int cx18_alsa_load(struct cx18 *cx)
194{ 194{
195 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); 195 struct v4l2_device *v4l2_dev = &cx->v4l2_dev;
196 int *count = data;
197 struct cx18 *cx;
198 struct cx18_stream *s; 196 struct cx18_stream *s;
199 197
200 if (v4l2_dev == NULL) { 198 if (v4l2_dev == NULL) {
@@ -227,41 +225,16 @@ static int __init cx18_alsa_init_callback(struct device *dev, void *data)
227 __func__); 225 __func__);
228 } else { 226 } else {
229 CX18_DEBUG_ALSA_INFO("%s: created cx18 ALSA interface instance " 227 CX18_DEBUG_ALSA_INFO("%s: created cx18 ALSA interface instance "
230 "%d\n", __func__, *count); 228 "\n", __func__);
231 (*count)++;
232 } 229 }
233 return 0; 230 return 0;
234} 231}
235 232
236static int __init cx18_alsa_init(void) 233static int __init cx18_alsa_init(void)
237{ 234{
238 struct device_driver *drv;
239 int count = 0;
240 int ret;
241
242 printk(KERN_INFO "cx18-alsa: module loading...\n"); 235 printk(KERN_INFO "cx18-alsa: module loading...\n");
243 236 cx18_ext_init = &cx18_alsa_load;
244 drv = driver_find("cx18", &pci_bus_type); 237 return 0;
245 if (drv == NULL) {
246 printk("cx18-alsa: drv was null\n");
247 return -ENODEV;
248 }
249 ret = driver_for_each_device(drv, NULL, &count,
250 cx18_alsa_init_callback);
251 put_driver(drv);
252
253 if (count == 0) {
254 printk(KERN_ERR "cx18-alsa: no cx18 cards found with a PCM "
255 "capture stream allocated\n");
256 ret = -ENODEV;
257 } else {
258 printk(KERN_INFO "cx18-alsa: ALSA interface(s) created for %d "
259 "cx18 card(s)\n", count);
260 ret = 0;
261 }
262
263 printk(KERN_INFO "cx18-alsa: module load complete\n");
264 return ret;
265} 238}
266 239
267static void snd_cx18_exit(struct snd_cx18_card *cxsc) 240static void snd_cx18_exit(struct snd_cx18_card *cxsc)
@@ -308,6 +281,7 @@ static void cx18_alsa_exit(void)
308 ret = driver_for_each_device(drv, NULL, NULL, cx18_alsa_exit_callback); 281 ret = driver_for_each_device(drv, NULL, NULL, cx18_alsa_exit_callback);
309 put_driver(drv); 282 put_driver(drv);
310 283
284 cx18_ext_init = NULL;
311 printk(KERN_INFO "cx18-alsa: module unload complete\n"); 285 printk(KERN_INFO "cx18-alsa: module unload complete\n");
312} 286}
313 287