summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-08-16 14:38:46 -0700
committerTrent Piepho <xyzzy@speakeasy.org>2007-08-16 14:38:46 -0700
commitc1e12d920074b82dfca2b1c1c50176bc94629593 (patch)
tree7bad8d04d5a35ec8ebf257abd9ab38b64d05c8ca /linux/drivers/media/video/cx88
parent9c6700a30c3bdf29513d2821d725d25e728b9d68 (diff)
downloadmediapointer-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/cx88')
-rw-r--r--linux/drivers/media/video/cx88/cx88-alsa.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c
index a2d0abae6..bf5477afa 100644
--- a/linux/drivers/media/video/cx88/cx88-alsa.c
+++ b/linux/drivers/media/video/cx88/cx88-alsa.c
@@ -66,11 +66,7 @@ struct cx88_audio_dev {
/* audio controls */
int irq;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
- snd_card_t *card;
-#else
struct snd_card *card;
-#endif
spinlock_t reg_lock;
@@ -89,11 +85,7 @@ struct cx88_audio_dev {
struct cx88_buffer *buf;
long opened;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
- snd_pcm_substream_t *substream;
-#else
struct snd_pcm_substream *substream;
-#endif
};
typedef struct cx88_audio_dev snd_cx88_card_t;
@@ -110,11 +102,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t;
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static snd_card_t *snd_cx88_cards[SNDRV_CARDS];
-#else
static struct snd_card *snd_cx88_cards[SNDRV_CARDS];
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
static unsigned int dummy;
@@ -352,11 +340,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
/*
* Digital hardware definition
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static snd_pcm_hardware_t snd_cx88_digital_hw = {
-#else
static struct snd_pcm_hardware snd_cx88_digital_hw = {
-#endif
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -378,28 +362,16 @@ static struct snd_pcm_hardware snd_cx88_digital_hw = {
/*
* audio pcm capture runtime free
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static void snd_card_cx88_runtime_free(snd_pcm_runtime_t *runtime)
-#else
static void snd_card_cx88_runtime_free(struct snd_pcm_runtime *runtime)
-#endif
{
}
/*
* audio pcm capture open callback
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_pcm_open(snd_pcm_substream_t *substream)
-#else
static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
-#endif
{
snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
-#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 err;
if (test_and_set_bit(0, &chip->opened))
@@ -428,11 +400,7 @@ _error:
/*
* audio close callback
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_close(snd_pcm_substream_t *substream)
-#else
static int snd_cx88_close(struct snd_pcm_substream *substream)
-#endif
{
snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
@@ -445,13 +413,8 @@ static int snd_cx88_close(struct snd_pcm_substream *substream)
/*
* hw_params callback
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_hw_params(snd_pcm_substream_t * substream,
- snd_pcm_hw_params_t * hw_params)
-#else
static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
struct snd_pcm_hw_params * hw_params)
-#endif
{
snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
struct cx88_buffer *buf;
@@ -508,11 +471,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
/*
* hw free callback
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_hw_free(snd_pcm_substream_t * substream)
-#else
static int snd_cx88_hw_free(struct snd_pcm_substream * substream)
-#endif
{
snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
@@ -528,11 +487,7 @@ static int snd_cx88_hw_free(struct snd_pcm_substream * substream)
/*
* prepare callback
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_prepare(snd_pcm_substream_t *substream)
-#else
static int snd_cx88_prepare(struct snd_pcm_substream *substream)
-#endif
{
return 0;
}
@@ -541,11 +496,7 @@ static int snd_cx88_prepare(struct snd_pcm_substream *substream)
/*
* trigger callback
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_card_trigger(snd_pcm_substream_t *substream, int cmd)
-#else
static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd)
-#endif
{
snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
int err;
@@ -572,18 +523,10 @@ static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd)
/*
* pointer callback
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static snd_pcm_uframes_t snd_cx88_pointer(snd_pcm_substream_t *substream)
-#else
static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
-#endif
{
snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
-#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
if (chip->read_count) {
chip->read_count -= snd_pcm_lib_period_bytes(substream);
@@ -600,11 +543,7 @@ static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
/*
* operators
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static snd_pcm_ops_t snd_cx88_pcm_ops = {
-#else
static struct snd_pcm_ops snd_cx88_pcm_ops = {
-#endif
.open = snd_cx88_pcm_open,
.close = snd_cx88_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -621,11 +560,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = {
static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name)
{
int err;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
- snd_pcm_t *pcm;
-#else
struct snd_pcm *pcm;
-#endif
err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm);
if (err < 0)
@@ -640,12 +575,8 @@ static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name)
/****************************************************************************
CONTROL INTERFACE
****************************************************************************/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_capture_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *info)
-#else
static int snd_cx88_capture_volume_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *info)
-#endif
{
info->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
info->count = 1;
@@ -656,12 +587,8 @@ static int snd_cx88_capture_volume_info(struct snd_kcontrol *kcontrol,
}
/* OK - TODO: test it */
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_capture_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value)
-#else
static int snd_cx88_capture_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
-#endif
{
snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
struct cx88_core *core=chip->core;
@@ -672,12 +599,8 @@ static int snd_cx88_capture_volume_get(struct snd_kcontrol *kcontrol,
}
/* OK - TODO: test it */
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int snd_cx88_capture_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value)
-#else
static int snd_cx88_capture_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
-#endif
{
snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
struct cx88_core *core=chip->core;
@@ -693,11 +616,7 @@ static int snd_cx88_capture_volume_put(struct snd_kcontrol *kcontrol,
return v != old_control;
}
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static snd_kcontrol_new_t snd_cx88_capture_volume = {
-#else
static struct snd_kcontrol_new snd_cx88_capture_volume = {
-#endif
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Capture Volume",
.info = snd_cx88_capture_volume_info,
@@ -743,11 +662,7 @@ static int snd_cx88_free(snd_cx88_card_t *chip)
/*
* Component Destructor
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static void snd_cx88_dev_free(snd_card_t * card)
-#else
static void snd_cx88_dev_free(struct snd_card * card)
-#endif
{
snd_cx88_card_t *chip = card->private_data;
@@ -760,14 +675,9 @@ static void snd_cx88_dev_free(struct snd_card * card)
*/
static int devno;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
-static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci,
- snd_cx88_card_t **rchip)
-#else
static int __devinit snd_cx88_create(struct snd_card *card,
struct pci_dev *pci,
snd_cx88_card_t **rchip)
-#endif
{
snd_cx88_card_t *chip;
struct cx88_core *core;
@@ -837,11 +747,7 @@ static int __devinit snd_cx88_create(struct snd_card *card,
static int __devinit cx88_audio_initdev(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
- snd_card_t *card;
-#else
struct snd_card *card;
-#endif
snd_cx88_card_t *chip;
int err;