diff options
-rw-r--r-- | linux/drivers/media/video/cx231xx/cx231xx-audio.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-alsa.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/em28xx/em28xx-audio.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-alsa.c | 8 | ||||
-rw-r--r-- | v4l/compat.h | 17 | ||||
-rwxr-xr-x | v4l/scripts/make_config_compat.pl | 20 |
6 files changed, 53 insertions, 13 deletions
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-audio.c b/linux/drivers/media/video/cx231xx/cx231xx-audio.c index 0f7fb3ca7..3a060a746 100644 --- a/linux/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/linux/drivers/media/video/cx231xx/cx231xx-audio.c @@ -560,9 +560,10 @@ static int cx231xx_audio_init(struct cx231xx *dev) cx231xx_info("cx231xx-audio.c: probing for cx231xx " "non standard usbaudio\n"); - card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0); - if (card == NULL) - return -ENOMEM; + err = snd_card_create(index[devnr], "Cx231xx Audio", THIS_MODULE, + 0, &card); + if (err < 0) + return err; spin_lock_init(&adev->slock); err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm); diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c index ac9de0094..077c9f0d7 100644 --- a/linux/drivers/media/video/cx88/cx88-alsa.c +++ b/linux/drivers/media/video/cx88/cx88-alsa.c @@ -867,9 +867,10 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, return (-ENOENT); } - card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t)); - if (!card) - return (-ENOMEM); + err = snd_card_create(index[devno], id[devno], THIS_MODULE, + sizeof(snd_cx88_card_t), &card); + if (err < 0) + return err; card->private_free = snd_cx88_dev_free; diff --git a/linux/drivers/media/video/em28xx/em28xx-audio.c b/linux/drivers/media/video/em28xx/em28xx-audio.c index eb49a1364..089764d42 100644 --- a/linux/drivers/media/video/em28xx/em28xx-audio.c +++ b/linux/drivers/media/video/em28xx/em28xx-audio.c @@ -545,9 +545,10 @@ static int em28xx_audio_init(struct em28xx *dev) printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " "Rechberger\n"); - card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); - if (card == NULL) - return -ENOMEM; + err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0, + &card); + if (err < 0) + return err; spin_lock_init(&adev->slock); err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c index eaa03fc07..c09ec3e6f 100644 --- a/linux/drivers/media/video/saa7134/saa7134-alsa.c +++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c @@ -995,10 +995,10 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) if (!enable[devnum]) return -ENODEV; - card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t)); - - if (card == NULL) - return -ENOMEM; + err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, + sizeof(snd_card_saa7134_t), &card); + if (err < 0) + return err; strcpy(card->driver, "SAA7134"); diff --git a/v4l/compat.h b/v4l/compat.h index 8e778d7f5..34ae08152 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -36,6 +36,10 @@ #include <sound/driver.h> #endif +#ifdef NEED_SND_CARD_CREATE +#include <sound/core.h> +#endif + #ifdef NEED_ALGO_CONTROL #include <linux/i2c.h> #endif @@ -432,4 +436,17 @@ static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) } while (0) #endif +#ifdef NEED_SND_CARD_CREATE +static inline int snd_card_create(int idx, const char *id, + struct module *module, int extra_size, + struct snd_card **card) +{ + *card = snd_card_new(idx, id, module, extra_size); + + if (*card == NULL) + return -ENOMEM; + return 0; +} #endif + +#endif /* _COMPAT_H */ diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index 423dcff77..2fc37d06d 100755 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -254,6 +254,25 @@ sub check_pci_ioremap_bar() close INNET; } +sub check_snd_card_create() +{ + my $file = "$kdir/include/sound/core.h"; + my $need_compat = 1; + + open IN, "<$file" or die "File not found: $file"; + while (<IN>) { + if (m/snd_card_create/) { + $need_compat = 0; + last; + } + } + + if ($need_compat) { + $out.= "\n#define NEED_SND_CARD_CREATE\n"; + } + close IN; +} + sub check_other_dependencies() { check_spin_lock(); @@ -269,6 +288,7 @@ sub check_other_dependencies() check_net_dev(); check_usb_endpoint_type(); check_pci_ioremap_bar(); + check_snd_card_create(); } # Do the basic rules |