--- btsco.old/kernel/btsco.c 2006-10-28 16:39:27.000000000 +0200 +++ btsco-0.5/kernel/btsco.c 2007-07-12 22:13:13.000000000 +0200 @@ -54,9 +54,18 @@ #include #include #include +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) +#include +#endif #include #include +// this was ostensibly for newer kernels but fails on 2.6.19.2 +#if 0 +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) +#include +#endif +#endif #include #include #include @@ -90,7 +99,7 @@ MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{ALSA,Bluetooth SCO Soundcard}}"); -static char *mod_revision = "$Revision$"; +static char *mod_revision = "$Revision$"; static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ @@ -124,13 +133,13 @@ } snd_card_bt_sco_info_t; typedef struct snd_card_bt_sco { - snd_card_t *card; + struct snd_card *card; spinlock_t mixer_lock; int mixer_volume[MIXER_ADDR_LAST + 1]; #ifdef DYNAMIC_COMPRESSION - snd_kcontrol_t *mixer_controls[MIXER_ADDR_LAST + 2 + 1]; /* also loopback and agc */ + struct snd_kcontrol *mixer_controls[MIXER_ADDR_LAST + 2 + 1]; /* also loopback and agc */ #else - snd_kcontrol_t *mixer_controls[MIXER_ADDR_LAST + 2 ]; /* also loopback */ + struct snd_kcontrol *mixer_controls[MIXER_ADDR_LAST + 2 ]; /* also loopback */ #endif volatile int loopback; #ifdef DYNAMIC_COMPRESSION @@ -168,15 +177,15 @@ unsigned int pcm_bps; /* bytes per second */ unsigned int pcm_irq_pos; /* IRQ position */ unsigned int pcm_buf_pos; /* position in buffer */ - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; } snd_card_bt_sco_pcm_t; -static snd_card_t *snd_bt_sco_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +static struct snd_card *snd_bt_sco_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; -static int snd_card_bt_sco_playback_trigger(snd_pcm_substream_t * +static int snd_card_bt_sco_playback_trigger(struct snd_pcm_substream * substream, int cmd) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); @@ -194,10 +203,10 @@ return 0; } -static int snd_card_bt_sco_capture_trigger(snd_pcm_substream_t * +static int snd_card_bt_sco_capture_trigger(struct snd_pcm_substream * substream, int cmd) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); @@ -215,9 +224,9 @@ return 0; } -static int snd_card_bt_sco_pcm_prepare(snd_pcm_substream_t * substream) +static int snd_card_bt_sco_pcm_prepare(struct snd_pcm_substream * substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; unsigned int bps; @@ -236,12 +245,12 @@ return 0; } -static int snd_card_bt_sco_playback_prepare(snd_pcm_substream_t * substream) +static int snd_card_bt_sco_playback_prepare(struct snd_pcm_substream * substream) { return snd_card_bt_sco_pcm_prepare(substream); } -static int snd_card_bt_sco_capture_prepare(snd_pcm_substream_t * substream) +static int snd_card_bt_sco_capture_prepare(struct snd_pcm_substream * substream) { dprintk("capture_prepare\n"); return snd_card_bt_sco_pcm_prepare(substream); @@ -311,24 +320,24 @@ } static snd_pcm_uframes_t -snd_card_bt_sco_playback_pointer(snd_pcm_substream_t * substream) +snd_card_bt_sco_playback_pointer(struct snd_pcm_substream * substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; return bytes_to_frames(runtime, bspcm->pcm_buf_pos); } static snd_pcm_uframes_t -snd_card_bt_sco_capture_pointer(snd_pcm_substream_t * substream) +snd_card_bt_sco_capture_pointer(struct snd_pcm_substream * substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; return bytes_to_frames(runtime, bspcm->pcm_buf_pos); } -static snd_pcm_hardware_t snd_card_bt_sco_playback = { +static struct snd_pcm_hardware snd_card_bt_sco_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), .formats = SNDRV_PCM_FMTBIT_S16_LE, @@ -345,7 +354,7 @@ .fifo_size = 0, }; -static snd_pcm_hardware_t snd_card_bt_sco_capture = { +static struct snd_pcm_hardware snd_card_bt_sco_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), .formats = SNDRV_PCM_FMTBIT_S16_LE, @@ -362,15 +371,15 @@ .fifo_size = 0, }; -static void snd_card_bt_sco_runtime_free(snd_pcm_runtime_t * runtime) +static void snd_card_bt_sco_runtime_free(struct snd_pcm_runtime * runtime) { snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; kfree(bspcm); } -static int snd_card_bt_sco_playback_open(snd_pcm_substream_t * substream) +static int snd_card_bt_sco_playback_open(struct snd_pcm_substream * substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_pcm_t *bspcm; snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); @@ -401,9 +410,9 @@ return 0; } -static int snd_card_bt_sco_capture_open(snd_pcm_substream_t * substream) +static int snd_card_bt_sco_capture_open(struct snd_pcm_substream * substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_pcm_t *bspcm; snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); @@ -435,9 +444,9 @@ return 0; } -static int snd_card_bt_sco_playback_close(snd_pcm_substream_t * substream) +static int snd_card_bt_sco_playback_close(struct snd_pcm_substream * substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); snd_assert(bt_sco->playback == NULL,; @@ -457,9 +466,9 @@ return 0; } -static int snd_card_bt_sco_capture_close(snd_pcm_substream_t * substream) +static int snd_card_bt_sco_capture_close(struct snd_pcm_substream * substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; struct snd_card_bt_sco *bt_sco = (struct snd_card_bt_sco *)substream->private_data; @@ -480,7 +489,7 @@ return 0; } -static snd_pcm_ops_t snd_card_bt_sco_playback_ops = { +static struct snd_pcm_ops snd_card_bt_sco_playback_ops = { .open = snd_card_bt_sco_playback_open, .close = snd_card_bt_sco_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -489,7 +498,7 @@ .pointer = snd_card_bt_sco_playback_pointer, }; -static snd_pcm_ops_t snd_card_bt_sco_capture_ops = { +static struct snd_pcm_ops snd_card_bt_sco_capture_ops = { .open = snd_card_bt_sco_capture_open, .close = snd_card_bt_sco_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -500,7 +509,7 @@ static int __init snd_card_bt_sco_pcm(snd_card_bt_sco_t * bt_sco) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; if ((err = @@ -522,8 +531,8 @@ .get = snd_bt_sco_volume_get, .put = snd_bt_sco_volume_put, \ .private_value = addr } -static int snd_bt_sco_volume_info(snd_kcontrol_t * kcontrol, - snd_ctl_elem_info_t * uinfo) +static int snd_bt_sco_volume_info(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_info * uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -532,8 +541,8 @@ return 0; } -static int snd_bt_sco_volume_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_bt_sco_volume_get(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_value * ucontrol) { snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); unsigned long flags; @@ -545,8 +554,8 @@ return 0; } -static int snd_bt_sco_volume_put(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_bt_sco_volume_put(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_value * ucontrol) { snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); unsigned long flags; @@ -571,8 +580,8 @@ return changed; } -static int snd_bt_sco_boolean_info(snd_kcontrol_t * kcontrol, - snd_ctl_elem_info_t * uinfo) +static int snd_bt_sco_boolean_info(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_info * uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -581,8 +590,8 @@ return 0; } -static int snd_bt_sco_loopback_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_bt_sco_loopback_get(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_value * ucontrol) { snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); unsigned long flags; @@ -593,8 +602,8 @@ return 0; } -static int snd_bt_sco_loopback_put(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_bt_sco_loopback_put(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_value * ucontrol) { snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); unsigned long flags; @@ -611,8 +620,8 @@ } #ifdef DYNAMIC_COMPRESSION -static int snd_bt_sco_agc_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_bt_sco_agc_get(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_value * ucontrol) { snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); unsigned long flags; @@ -623,8 +632,8 @@ return 0; } -static int snd_bt_sco_agc_put(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_bt_sco_agc_put(struct snd_kcontrol * kcontrol, + struct snd_ctl_elem_value * ucontrol) { snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); unsigned long flags; @@ -641,9 +650,9 @@ } #endif -#define BT_SCO_CONTROLS (sizeof(snd_bt_sco_controls)/sizeof(snd_kcontrol_new_t)) +#define BT_SCO_CONTROLS (sizeof(snd_bt_sco_controls)/sizeof(struct snd_kcontrol_new)) -static snd_kcontrol_new_t snd_bt_sco_controls[] = { +static struct snd_kcontrol_new snd_bt_sco_controls[] = { BT_SCO_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER), BT_SCO_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC), {.iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -667,7 +676,7 @@ int __init snd_card_bt_sco_new_mixer(snd_card_bt_sco_t * bt_sco) { - snd_card_t *card = bt_sco->card; + struct snd_card *card = bt_sco->card; unsigned int idx; int err; @@ -686,17 +695,17 @@ return 0; } -static int snd_card_bt_open(snd_hwdep_t * hw, struct file *file) +static int snd_card_bt_open(struct snd_hwdep * hw, struct file *file) { return 0; } -static int snd_card_bt_release(snd_hwdep_t * hw, struct file *file) +static int snd_card_bt_release(struct snd_hwdep * hw, struct file *file) { return 0; } -static int snd_card_bt_ioctl(snd_hwdep_t * hw, struct file *file, +static int snd_card_bt_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg) { snd_card_bt_sco_t *bt_sco = hw->card->private_data; @@ -750,7 +759,7 @@ return err; } -static long snd_card_bt_write(snd_hwdep_t * hw, const char *buf, long count, +static long snd_card_bt_write(struct snd_hwdep * hw, const char *buf, long count, loff_t * offset) { snd_card_bt_sco_t *bt_sco = hw->card->private_data; @@ -785,7 +794,7 @@ return retval; } -static long snd_card_bt_read(snd_hwdep_t * hw, char *buf, long count, +static long snd_card_bt_read(struct snd_hwdep * hw, char *buf, long count, loff_t * offset) { snd_card_bt_sco_t *bt_sco = hw->card->private_data; @@ -839,7 +848,7 @@ return retval; } -static unsigned int snd_card_bt_poll(snd_hwdep_t * hw, +static unsigned int snd_card_bt_poll(struct snd_hwdep * hw, struct file *file, poll_table * wait) { snd_card_bt_sco_t *bt_sco = hw->card->private_data; @@ -863,7 +872,7 @@ static int snd_card_bt_sco_thread(void *data) { - snd_card_t *card = (snd_card_t *) data; + struct snd_card *card = (struct snd_card *) data; snd_card_bt_sco_t *bt_sco = card->private_data; struct socket *sock; int len; @@ -1117,7 +1126,7 @@ complete_and_exit(&bt_sco->thread_done, 0); } -static void snd_card_bt_private_free(snd_card_t * card) +static void snd_card_bt_private_free(struct snd_card * card) { snd_card_bt_sco_t *bt_sco = card->private_data; @@ -1139,10 +1148,10 @@ static int __init snd_card_bt_sco_probe(int dev) { - snd_card_t *card; + struct snd_card *card; snd_card_bt_sco_t *bt_sco; int err; - snd_hwdep_t *hw; + struct snd_hwdep *hw; card = snd_card_new(index[dev], SNDRV_DEFAULT_STR1,