aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2009-11-19 20:46:10 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:42 -0500
commit4cb565cc2700e6fcd57243cacc4c2826956bc088 (patch)
tree243606d6e5afdd173c1e944c69f5e839cb94f9c7 /drivers/media/video/cx18
parent0d8e1d0637a4636b0c19c94ba633812421544d91 (diff)
V4L/DVB: cx18: make it so cx18-alsa-main.c compiles
Fix some basic compilation issues with Andy's original code. In particular, temporarily #ifdef out the mixer code, add some additional exception handling, fix a couple of typos, and add a copyright line. This work was sponsored by ONELAN Limited. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r--drivers/media/video/cx18/cx18-alsa-main.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/media/video/cx18/cx18-alsa-main.c b/drivers/media/video/cx18/cx18-alsa-main.c
index dde2b0482f34..3c339774522a 100644
--- a/drivers/media/video/cx18/cx18-alsa-main.c
+++ b/drivers/media/video/cx18/cx18-alsa-main.c
@@ -2,6 +2,9 @@
2 * ALSA interface to cx18 PCM capture streams 2 * ALSA interface to cx18 PCM capture streams
3 * 3 *
4 * Copyright (C) 2009 Andy Walls <awalls@radix.net> 4 * Copyright (C) 2009 Andy Walls <awalls@radix.net>
5 * Copyright (C) 2009 Devin Heitmueller <dheitmueller@kernellabs.com>
6 *
7 * Portions of this work were sponsored by ONELAN Limited.
5 * 8 *
6 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -31,11 +34,15 @@
31#include <sound/initval.h> 34#include <sound/initval.h>
32 35
33#include "cx18-driver.h" 36#include "cx18-driver.h"
37#include "cx18-version.h"
38#include "cx18-alsa.h"
34#include "cx18-alsa-mixer.h" 39#include "cx18-alsa-mixer.h"
35#include "cx18-alsa-pcm.h" 40#include "cx18-alsa-pcm.h"
36 41
37int cx18_alsa_debug; 42int cx18_alsa_debug;
38 43
44#define CX18_DEBUG_ALSA_INFO(fmt, arg...) printk(KERN_INFO "%s: " fmt, "cx18-alsa", ## arg)
45
39module_param_named(debug, cx18_alsa_debug, int, 0644); 46module_param_named(debug, cx18_alsa_debug, int, 0644);
40MODULE_PARM_DESC(debug, 47MODULE_PARM_DESC(debug,
41 "Debug level (bitmask). Default: 0\n" 48 "Debug level (bitmask). Default: 0\n"
@@ -116,6 +123,8 @@ static int __init snd_cx18_card_set_names(struct snd_cx18_card *cxsc)
116 snprintf(sc->longname, sizeof(sc->longname), 123 snprintf(sc->longname, sizeof(sc->longname),
117 "CX23418 #%d %s TV/FM Radio/Line-In Capture", 124 "CX23418 #%d %s TV/FM Radio/Line-In Capture",
118 cx->instance, cx->card_name); 125 cx->instance, cx->card_name);
126
127 return 0;
119} 128}
120 129
121static int __init snd_cx18_init(struct v4l2_device *v4l2_dev) 130static int __init snd_cx18_init(struct v4l2_device *v4l2_dev)
@@ -151,12 +160,6 @@ static int __init snd_cx18_init(struct v4l2_device *v4l2_dev)
151 /* (4) Set the driver ID and name strings */ 160 /* (4) Set the driver ID and name strings */
152 snd_cx18_card_set_names(cxsc); 161 snd_cx18_card_set_names(cxsc);
153 162
154 /* (5) Create other components: mixer, PCM, & proc files */
155 ret = snd_cx18_mixer_create(cxsc);
156 if (ret) {
157 CX18_ALSA_WARN("%s: snd_cx18_mixer_create() failed with err %d:"
158 "proceeding anyway\n", __func__, ret);
159 }
160 163
161 ret = snd_cx18_pcm_create(cxsc); 164 ret = snd_cx18_pcm_create(cxsc);
162 if (ret) { 165 if (ret) {
@@ -201,6 +204,11 @@ static int __init cx18_alsa_init_callback(struct device *dev, void *data)
201 } 204 }
202 205
203 cx = to_cx18(v4l2_dev); 206 cx = to_cx18(v4l2_dev);
207 if (cx == NULL) {
208 printk(KERN_ERR "cx18-alsa cx is NULL\n");
209 return 0;
210 }
211
204 s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM]; 212 s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM];
205 if (s->video_dev == NULL) { 213 if (s->video_dev == NULL) {
206 CX18_DEBUG_ALSA_INFO("%s: PCM stream for card is disabled - " 214 CX18_DEBUG_ALSA_INFO("%s: PCM stream for card is disabled - "
@@ -234,6 +242,10 @@ static int __init cx18_alsa_init(void)
234 printk(KERN_INFO "cx18-alsa: module loading...\n"); 242 printk(KERN_INFO "cx18-alsa: module loading...\n");
235 243
236 drv = driver_find("cx18", &pci_bus_type); 244 drv = driver_find("cx18", &pci_bus_type);
245 if (drv == NULL) {
246 printk("cx18-alsa: drv was null\n");
247 return -ENODEV;
248 }
237 ret = driver_for_each_device(drv, NULL, &count, 249 ret = driver_for_each_device(drv, NULL, &count,
238 cx18_alsa_init_callback); 250 cx18_alsa_init_callback);
239 put_driver(drv); 251 put_driver(drv);
@@ -254,7 +266,7 @@ static int __init cx18_alsa_init(void)
254 266
255static void snd_cx18_exit(struct snd_cx18_card *cxsc) 267static void snd_cx18_exit(struct snd_cx18_card *cxsc)
256{ 268{
257 struct cx18 *cx = to_cx18(cxsc->4l2_dev); 269 struct cx18 *cx = to_cx18(cxsc->v4l2_dev);
258 270
259 /* FIXME - pointer checks & shutdown cxsc */ 271 /* FIXME - pointer checks & shutdown cxsc */
260 272