diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-08-16 14:38:46 -0700 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2007-08-16 14:38:46 -0700 |
commit | c1e12d920074b82dfca2b1c1c50176bc94629593 (patch) | |
tree | 7bad8d04d5a35ec8ebf257abd9ab38b64d05c8ca /linux/drivers/media/video/saa7134/saa7134-alsa.c | |
parent | 9c6700a30c3bdf29513d2821d725d25e728b9d68 (diff) | |
download | mediapointer-dvb-s2-c1e12d920074b82dfca2b1c1c50176bc94629593.tar.gz mediapointer-dvb-s2-c1e12d920074b82dfca2b1c1c50176bc94629593.tar.bz2 |
compat: ALSA compat code
From: Trent Piepho <xyzzy@speakeasy.org>
Removed some ALSA compat code from bt87x and put it into compat.h, then use
this code in cx88-alsa and saa7134-alsa to avoid lots and lots of #ifs.
All the kernel version checks in cx88-alsa and saa7134 were off by one too,
which is now fixed.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-alsa.c')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-alsa.c | 115 |
1 files changed, 1 insertions, 114 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c index 13916f207..aeedf3eec 100644 --- a/linux/drivers/media/video/saa7134/saa7134-alsa.c +++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c @@ -74,11 +74,7 @@ MODULE_PARM_DESC(enable, "Enable (or not) the SAA7134 capture interface(s)."); */ typedef struct snd_card_saa7134 { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_card_t *card; -#else struct snd_card *card; -#endif spinlock_t mixer_lock; int mixer_volume[MIXER_ADDR_LAST+1][2]; int capture_source[MIXER_ADDR_LAST+1][2]; @@ -106,18 +102,10 @@ typedef struct snd_card_saa7134_pcm { spinlock_t lock; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_pcm_substream_t *substream; -#else struct snd_pcm_substream *substream; -#endif } snd_card_saa7134_pcm_t; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static snd_card_t *snd_saa7134_cards[SNDRV_CARDS]; -#else static struct snd_card *snd_saa7134_cards[SNDRV_CARDS]; -#endif /* @@ -274,18 +262,10 @@ out: * */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_card_saa7134_capture_trigger(snd_pcm_substream_t * substream, -#else static int snd_card_saa7134_capture_trigger(struct snd_pcm_substream * substream, -#endif - int cmd) + int cmd) { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_pcm_runtime_t *runtime = substream->runtime; -#else struct snd_pcm_runtime *runtime = substream->runtime; -#endif snd_card_saa7134_pcm_t *pcm = runtime->private_data; struct saa7134_dev *dev=pcm->dev; int err = 0; @@ -363,17 +343,9 @@ static int dsp_buffer_free(struct saa7134_dev *dev) * */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) -#else static int snd_card_saa7134_capture_prepare(struct snd_pcm_substream * substream) -#endif { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_pcm_runtime_t *runtime = substream->runtime; -#else struct snd_pcm_runtime *runtime = substream->runtime; -#endif int bswap, sign; u32 fmt, control; snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); @@ -460,18 +432,10 @@ static int snd_card_saa7134_capture_prepare(struct snd_pcm_substream * substream * */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * substream) -#else static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(struct snd_pcm_substream * substream) -#endif { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_pcm_runtime_t *runtime = substream->runtime; -#else struct snd_pcm_runtime *runtime = substream->runtime; -#endif snd_card_saa7134_pcm_t *pcm = runtime->private_data; struct saa7134_dev *dev=pcm->dev; @@ -489,11 +453,7 @@ snd_card_saa7134_capture_pointer(struct snd_pcm_substream * substream) * ALSA hardware capabilities definition */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static snd_pcm_hardware_t snd_card_saa7134_capture = -#else static struct snd_pcm_hardware snd_card_saa7134_capture = -#endif { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -516,11 +476,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture = .periods_max = 1024, }; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static void snd_card_saa7134_runtime_free(snd_pcm_runtime_t *runtime) -#else static void snd_card_saa7134_runtime_free(struct snd_pcm_runtime *runtime) -#endif { snd_card_saa7134_pcm_t *pcm = runtime->private_data; @@ -537,13 +493,8 @@ static void snd_card_saa7134_runtime_free(struct snd_pcm_runtime *runtime) * */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) -#else static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, struct snd_pcm_hw_params * hw_params) -#endif { snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); struct saa7134_dev *dev; @@ -622,11 +573,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, * */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_card_saa7134_hw_free(snd_pcm_substream_t * substream) -#else static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream) -#endif { snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); struct saa7134_dev *dev; @@ -652,11 +599,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream) * */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_card_saa7134_capture_close(snd_pcm_substream_t * substream) -#else static int snd_card_saa7134_capture_close(struct snd_pcm_substream * substream) -#endif { snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); struct saa7134_dev *dev = saa7134->dev; @@ -678,17 +621,9 @@ static int snd_card_saa7134_capture_close(struct snd_pcm_substream * substream) * */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) -#else static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) -#endif { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_pcm_runtime_t *runtime = substream->runtime; -#else struct snd_pcm_runtime *runtime = substream->runtime; -#endif snd_card_saa7134_pcm_t *pcm; snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); struct saa7134_dev *dev = saa7134->dev; @@ -735,11 +670,7 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) * ALSA capture callbacks definition */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static snd_pcm_ops_t snd_card_saa7134_capture_ops = { -#else static struct snd_pcm_ops snd_card_saa7134_capture_ops = { -#endif .open = snd_card_saa7134_capture_open, .close = snd_card_saa7134_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -760,11 +691,7 @@ static struct snd_pcm_ops snd_card_saa7134_capture_ops = { static int snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device) { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_pcm_t *pcm; -#else struct snd_pcm *pcm; -#endif int err; if ((err = snd_pcm_new(saa7134->card, "SAA7134 PCM", device, 0, 1, &pcm)) < 0) @@ -782,12 +709,8 @@ static int snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device) .get = snd_saa7134_volume_get, .put = snd_saa7134_volume_put, \ .private_value = addr } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_saa7134_volume_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) -#else static int snd_saa7134_volume_info(struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo) -#endif { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -796,12 +719,8 @@ static int snd_saa7134_volume_info(struct snd_kcontrol * kcontrol, return 0; } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_saa7134_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) -#else static int snd_saa7134_volume_get(struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol) -#endif { snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); int addr = kcontrol->private_value; @@ -811,12 +730,8 @@ static int snd_saa7134_volume_get(struct snd_kcontrol * kcontrol, return 0; } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_saa7134_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) -#else static int snd_saa7134_volume_put(struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol) -#endif { snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); struct saa7134_dev *dev = chip->dev; @@ -891,12 +806,8 @@ static int snd_saa7134_volume_put(struct snd_kcontrol * kcontrol, .get = snd_saa7134_capsrc_get, .put = snd_saa7134_capsrc_put, \ .private_value = addr } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_saa7134_capsrc_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) -#else static int snd_saa7134_capsrc_info(struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo) -#endif { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 2; @@ -905,12 +816,8 @@ static int snd_saa7134_capsrc_info(struct snd_kcontrol * kcontrol, return 0; } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_saa7134_capsrc_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) -#else static int snd_saa7134_capsrc_get(struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol) -#endif { snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); int addr = kcontrol->private_value; @@ -923,12 +830,8 @@ static int snd_saa7134_capsrc_get(struct snd_kcontrol * kcontrol, return 0; } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) -#else static int snd_saa7134_capsrc_put(struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol) -#endif { snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); int change, addr = kcontrol->private_value; @@ -1005,11 +908,7 @@ static int snd_saa7134_capsrc_put(struct snd_kcontrol * kcontrol, return change; } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static snd_kcontrol_new_t snd_saa7134_controls[] = { -#else static struct snd_kcontrol_new snd_saa7134_controls[] = { -#endif SAA713x_VOLUME("Video Volume", 0, MIXER_ADDR_TVTUNER), SAA713x_CAPSRC("Video Capture Switch", 0, MIXER_ADDR_TVTUNER), SAA713x_VOLUME("Line Volume", 1, MIXER_ADDR_LINE1), @@ -1028,11 +927,7 @@ SAA713x_CAPSRC("Line Capture Switch", 2, MIXER_ADDR_LINE2), static int snd_card_saa7134_new_mixer(snd_card_saa7134_t * chip) { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_card_t *card = chip->card; -#else struct snd_card *card = chip->card; -#endif unsigned int idx; int err; @@ -1046,11 +941,7 @@ static int snd_card_saa7134_new_mixer(snd_card_saa7134_t * chip) return 0; } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -static void snd_saa7134_free(snd_card_t * card) -#else static void snd_saa7134_free(struct snd_card * card) -#endif { snd_card_saa7134_t *chip = card->private_data; @@ -1077,11 +968,7 @@ static void snd_saa7134_free(struct snd_card * card) static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_card_t *card; -#else struct snd_card *card; -#endif snd_card_saa7134_t *chip; int err; |