diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2006-09-07 16:01:14 -0700 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2006-09-07 16:01:14 -0700 |
commit | b91b73e291565ec104b4f43ad9294fda133cf0f2 (patch) | |
tree | 2767cfb97c19bb55e79a88a5db827e066efe2261 /linux/sound/pci/bt87x.c | |
parent | 096c1eda1219da064179b5e8226fb8e507b87284 (diff) | |
download | mediapointer-dvb-s2-b91b73e291565ec104b4f43ad9294fda133cf0f2.tar.gz mediapointer-dvb-s2-b91b73e291565ec104b4f43ad9294fda133cf0f2.tar.bz2 |
bt87x.c: Backward compatibility changes
From: Trent Piepho <xyzzy@speakeasy.org>
There was massive ALSA typedef to struct conversion in 2.6.16. This
makes the code backward compatible with pre 2.6.16 ALSA.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'linux/sound/pci/bt87x.c')
-rw-r--r-- | linux/sound/pci/bt87x.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/linux/sound/pci/bt87x.c b/linux/sound/pci/bt87x.c index 9dd881d73..65888ed3c 100644 --- a/linux/sound/pci/bt87x.c +++ b/linux/sound/pci/bt87x.c @@ -35,6 +35,27 @@ #include <sound/control.h> #include <sound/initval.h> #include "compat.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) +/* structs that used to be typedefs */ +#define snd_card _snd_card +#define snd_pcm _snd_pcm +#define snd_pcm_substream _snd_pcm_substream +#define snd_pcm_hardware _snd_pcm_hardware +#define snd_pcm_runtime _snd_pcm_runtime +#define snd_pcm_hw_params sndrv_pcm_hw_params +#define snd_pcm_ops _snd_pcm_ops +#define snd_ctl_elem_info sndrv_ctl_elem_info +#define snd_ctl_elem_value sndrv_ctl_elem_value +#undef snd_kcontrol +#define snd_kcontrol _snd_kcontrol +#define snd_kcontrol_new _snd_kcontrol_new +#undef snd_device +#define snd_device _snd_device +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) +/* From linux/pch_ids.h, appeared in 2.6.14 */ +#define PCI_DEVICE_ID_BROOKTREE_879 0x0879 +#endif MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_DESCRIPTION("Brooktree Bt87x audio driver"); @@ -370,13 +391,21 @@ static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, struct snd_pcm_runti static int snd_bt87x_set_analog_hw(struct snd_bt87x *chip, struct snd_pcm_runtime *runtime) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) static struct snd_ratnum analog_clock = { +#else + static ratnum_t analog_clock = { +#endif .num = ANALOG_CLOCK, .den_min = CLOCK_DIV_MIN, .den_max = CLOCK_DIV_MAX, .den_step = 1 }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) static struct snd_pcm_hw_constraint_ratnums constraint_rates = { +#else + static snd_pcm_hw_constraint_ratnums_t constraint_rates = { +#endif .nrats = 1, .rats = &analog_clock }; @@ -709,7 +738,11 @@ static int __devinit snd_bt87x_create(struct snd_card *card, { struct snd_bt87x *chip; int err; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) static struct snd_device_ops ops = { +#else + static snd_device_ops_t ops = { +#endif .dev_free = snd_bt87x_dev_free }; @@ -817,30 +850,24 @@ static int __devinit snd_bt87x_detect_card(struct pci_dev *pci) int i; const struct pci_device_id *supported; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) supported = pci_match_device(&driver, pci); +#else + supported = pci_match_device(driver.id_table, pci); +#endif if (supported && supported->driver_data > 0) return supported->driver_data; for (i = 0; i < ARRAY_SIZE(blacklist); ++i) if (blacklist[i].subvendor == pci->subsystem_vendor && blacklist[i].subdevice == pci->subsystem_device) { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_printdd(KERN_INFO "card %#04x:%#04x has no audio\n", - pci->subsystem_vendor, pci->subsystem_device); -#else snd_printdd(KERN_INFO "card %#04x-%#04x:%#04x has no audio\n", pci->device, pci->subsystem_vendor, pci->subsystem_device); -#endif return -EBUSY; } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) - snd_printk(KERN_INFO "unknown card %#04x:%#04x, using default rate 32000\n", - pci->subsystem_vendor, pci->subsystem_device); -#else snd_printk(KERN_INFO "unknown card %#04x-%#04x:%#04x, using default rate 32000\n", pci->device, pci->subsystem_vendor, pci->subsystem_device); -#endif snd_printk(KERN_DEBUG "please mail id, board name, and, " "if it works, the correct digital_rate option to " "<alsa-devel@lists.sf.net>\n"); |