aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/isa/sb/sb16_csp.c44
-rw-r--r--sound/oss/midibuf.c2
-rw-r--r--sound/oss/skeleton.c219
-rw-r--r--sound/oss/soundcard.c3
-rw-r--r--sound/oss/sys_timer.c3
-rw-r--r--sound/oss/uart6850.c3
-rw-r--r--sound/usb/usbaudio.c10
7 files changed, 29 insertions, 255 deletions
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index b62920eead3d..d64790bcd831 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -42,8 +42,6 @@ MODULE_LICENSE("GPL");
42#else 42#else
43#define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) 43#define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
44#endif 44#endif
45#define LE_SHORT(v) le16_to_cpu(v)
46#define LE_INT(v) le32_to_cpu(v)
47 45
48#define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F') 46#define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F')
49#define CSP__HEADER CSP_HDR_VALUE('C', 'S', 'P', ' ') 47#define CSP__HEADER CSP_HDR_VALUE('C', 'S', 'P', ' ')
@@ -56,20 +54,20 @@ MODULE_LICENSE("GPL");
56/* 54/*
57 * RIFF data format 55 * RIFF data format
58 */ 56 */
59typedef struct riff_header { 57struct riff_header {
60 __u32 name; 58 __u32 name;
61 __u32 len; 59 __u32 len;
62} riff_header_t; 60};
63 61
64typedef struct desc_header { 62struct desc_header {
65 riff_header_t info; 63 struct riff_header info;
66 __u16 func_nr; 64 __u16 func_nr;
67 __u16 VOC_type; 65 __u16 VOC_type;
68 __u16 flags_play_rec; 66 __u16 flags_play_rec;
69 __u16 flags_16bit_8bit; 67 __u16 flags_16bit_8bit;
70 __u16 flags_stereo_mono; 68 __u16 flags_stereo_mono;
71 __u16 flags_rates; 69 __u16 flags_rates;
72} desc_header_t; 70};
73 71
74/* 72/*
75 * prototypes 73 * prototypes
@@ -302,9 +300,9 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
302 unsigned char __user *data_end; 300 unsigned char __user *data_end;
303 unsigned short func_nr = 0; 301 unsigned short func_nr = 0;
304 302
305 riff_header_t file_h, item_h, code_h; 303 struct riff_header file_h, item_h, code_h;
306 __u32 item_type; 304 __u32 item_type;
307 desc_header_t funcdesc_h; 305 struct desc_header funcdesc_h;
308 306
309 unsigned long flags; 307 unsigned long flags;
310 int err; 308 int err;
@@ -316,12 +314,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
316 if (copy_from_user(&file_h, data_ptr, sizeof(file_h))) 314 if (copy_from_user(&file_h, data_ptr, sizeof(file_h)))
317 return -EFAULT; 315 return -EFAULT;
318 if ((file_h.name != RIFF_HEADER) || 316 if ((file_h.name != RIFF_HEADER) ||
319 (LE_INT(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { 317 (le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) {
320 snd_printd("%s: Invalid RIFF header\n", __FUNCTION__); 318 snd_printd("%s: Invalid RIFF header\n", __FUNCTION__);
321 return -EINVAL; 319 return -EINVAL;
322 } 320 }
323 data_ptr += sizeof(file_h); 321 data_ptr += sizeof(file_h);
324 data_end = data_ptr + LE_INT(file_h.len); 322 data_end = data_ptr + le32_to_cpu(file_h.len);
325 323
326 if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) 324 if (copy_from_user(&item_type, data_ptr, sizeof(item_type)))
327 return -EFAULT; 325 return -EFAULT;
@@ -331,7 +329,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
331 } 329 }
332 data_ptr += sizeof (item_type); 330 data_ptr += sizeof (item_type);
333 331
334 for (; data_ptr < data_end; data_ptr += LE_INT(item_h.len)) { 332 for (; data_ptr < data_end; data_ptr += le32_to_cpu(item_h.len)) {
335 if (copy_from_user(&item_h, data_ptr, sizeof(item_h))) 333 if (copy_from_user(&item_h, data_ptr, sizeof(item_h)))
336 return -EFAULT; 334 return -EFAULT;
337 data_ptr += sizeof(item_h); 335 data_ptr += sizeof(item_h);
@@ -344,7 +342,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
344 case FUNC_HEADER: 342 case FUNC_HEADER:
345 if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h))) 343 if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h)))
346 return -EFAULT; 344 return -EFAULT;
347 func_nr = LE_SHORT(funcdesc_h.func_nr); 345 func_nr = le16_to_cpu(funcdesc_h.func_nr);
348 break; 346 break;
349 case CODE_HEADER: 347 case CODE_HEADER:
350 if (func_nr != info.func_req) 348 if (func_nr != info.func_req)
@@ -370,11 +368,11 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
370 if (code_h.name != INIT_HEADER) 368 if (code_h.name != INIT_HEADER)
371 break; 369 break;
372 data_ptr += sizeof(code_h); 370 data_ptr += sizeof(code_h);
373 err = snd_sb_csp_load_user(p, data_ptr, LE_INT(code_h.len), 371 err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len),
374 SNDRV_SB_CSP_LOAD_INITBLOCK); 372 SNDRV_SB_CSP_LOAD_INITBLOCK);
375 if (err) 373 if (err)
376 return err; 374 return err;
377 data_ptr += LE_INT(code_h.len); 375 data_ptr += le32_to_cpu(code_h.len);
378 } 376 }
379 /* main microcode block */ 377 /* main microcode block */
380 if (copy_from_user(&code_h, data_ptr, sizeof(code_h))) 378 if (copy_from_user(&code_h, data_ptr, sizeof(code_h)))
@@ -386,17 +384,17 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
386 } 384 }
387 data_ptr += sizeof(code_h); 385 data_ptr += sizeof(code_h);
388 err = snd_sb_csp_load_user(p, data_ptr, 386 err = snd_sb_csp_load_user(p, data_ptr,
389 LE_INT(code_h.len), 0); 387 le32_to_cpu(code_h.len), 0);
390 if (err) 388 if (err)
391 return err; 389 return err;
392 390
393 /* fill in codec header */ 391 /* fill in codec header */
394 strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); 392 strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name));
395 p->func_nr = func_nr; 393 p->func_nr = func_nr;
396 p->mode = LE_SHORT(funcdesc_h.flags_play_rec); 394 p->mode = le16_to_cpu(funcdesc_h.flags_play_rec);
397 switch (LE_SHORT(funcdesc_h.VOC_type)) { 395 switch (le16_to_cpu(funcdesc_h.VOC_type)) {
398 case 0x0001: /* QSound decoder */ 396 case 0x0001: /* QSound decoder */
399 if (LE_SHORT(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) { 397 if (le16_to_cpu(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) {
400 if (snd_sb_qsound_build(p) == 0) 398 if (snd_sb_qsound_build(p) == 0)
401 /* set QSound flag and clear all other mode flags */ 399 /* set QSound flag and clear all other mode flags */
402 p->mode = SNDRV_SB_CSP_MODE_QSOUND; 400 p->mode = SNDRV_SB_CSP_MODE_QSOUND;
@@ -426,12 +424,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user
426 p->mode = 0; 424 p->mode = 0;
427 snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", 425 snd_printd("%s: Unsupported CSP codec type: 0x%04x\n",
428 __FUNCTION__, 426 __FUNCTION__,
429 LE_SHORT(funcdesc_h.VOC_type)); 427 le16_to_cpu(funcdesc_h.VOC_type));
430 return -EINVAL; 428 return -EINVAL;
431 } 429 }
432 p->acc_channels = LE_SHORT(funcdesc_h.flags_stereo_mono); 430 p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono);
433 p->acc_width = LE_SHORT(funcdesc_h.flags_16bit_8bit); 431 p->acc_width = le16_to_cpu(funcdesc_h.flags_16bit_8bit);
434 p->acc_rates = LE_SHORT(funcdesc_h.flags_rates); 432 p->acc_rates = le16_to_cpu(funcdesc_h.flags_rates);
435 433
436 /* Decouple CSP from IRQ and DMAREQ lines */ 434 /* Decouple CSP from IRQ and DMAREQ lines */
437 spin_lock_irqsave(&p->chip->reg_lock, flags); 435 spin_lock_irqsave(&p->chip->reg_lock, flags);
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
index b2676fa34630..6982556ded56 100644
--- a/sound/oss/midibuf.c
+++ b/sound/oss/midibuf.c
@@ -50,7 +50,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
50static void midi_poll(unsigned long dummy); 50static void midi_poll(unsigned long dummy);
51 51
52 52
53static struct timer_list poll_timer = TIMER_INITIALIZER(midi_poll, 0, 0); 53static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
54 54
55static volatile int open_devs; 55static volatile int open_devs;
56static DEFINE_SPINLOCK(lock); 56static DEFINE_SPINLOCK(lock);
diff --git a/sound/oss/skeleton.c b/sound/oss/skeleton.c
deleted file mode 100644
index 8fea783dd0cb..000000000000
--- a/sound/oss/skeleton.c
+++ /dev/null
@@ -1,219 +0,0 @@
1/*
2 * PCI sound skeleton example
3 *
4 * (c) 1998 Red Hat Software
5 *
6 * This software may be used and distributed according to the
7 * terms of the GNU General Public License, incorporated herein by
8 * reference.
9 *
10 * This example is designed to be built in the linux/drivers/sound
11 * directory as part of a kernel build. The example is modular only
12 * drop me a note once you have a working modular driver and want
13 * to integrate it with the main code.
14 * -- Alan <alan@redhat.com>
15 *
16 * This is a first draft. Please report any errors, corrections or
17 * improvements to me.
18 */
19
20#include <linux/module.h>
21#include <linux/delay.h>
22#include <linux/errno.h>
23#include <linux/fs.h>
24#include <linux/kernel.h>
25#include <linux/pci.h>
26
27#include <asm/io.h>
28
29#include "sound_config.h"
30
31/*
32 * Define our PCI vendor ID here
33 */
34
35#ifndef PCI_VENDOR_MYIDENT
36#define PCI_VENDOR_MYIDENT 0x125D
37
38/*
39 * PCI identity for the card.
40 */
41
42#define PCI_DEVICE_ID_MYIDENT_MYCARD1 0x1969
43#endif
44
45#define CARD_NAME "ExampleWave 3D Pro Ultra ThingyWotsit"
46
47#define MAX_CARDS 8
48
49/*
50 * Each address_info object holds the information about one of
51 * our card resources. In this case the MSS emulation of our
52 * ficticious card. Its used to manage and attach things.
53 */
54
55static struct address_info mss_data[MAX_CARDS];
56static int cards;
57
58/*
59 * Install the actual card. This is an example
60 */
61
62static int mycard_install(struct pci_dev *pcidev)
63{
64 int iobase;
65 int mssbase;
66 int mpubase;
67 u8 x;
68 u16 w;
69 u32 v;
70 int i;
71 int dma;
72
73 /*
74 * Our imaginary code has its I/O on PCI address 0, a
75 * MSS on PCI address 1 and an MPU on address 2
76 *
77 * For the example we will only initialise the MSS
78 */
79
80 iobase = pci_resource_start(pcidev, 0);
81 mssbase = pci_resource_start(pcidev, 1);
82 mpubase = pci_resource_start(pcidev, 2);
83
84 /*
85 * Reset the board
86 */
87
88 /*
89 * Wait for completion. udelay() waits in microseconds
90 */
91
92 udelay(100);
93
94 /*
95 * Ok card ready. Begin setup proper. You might for example
96 * load the firmware here
97 */
98
99 dma = card_specific_magic(ioaddr);
100
101 /*
102 * Turn on legacy mode (example), There are also byte and
103 * dword (32bit) PCI configuration function calls
104 */
105
106 pci_read_config_word(pcidev, 0x40, &w);
107 w&=~(1<<15); /* legacy decode on */
108 w|=(1<<14); /* Reserved write as 1 in this case */
109 w|=(1<<3)|(1<<1)|(1<<0); /* SB on , FM on, MPU on */
110 pci_write_config_word(pcidev, 0x40, w);
111
112 /*
113 * Let the user know we found his toy.
114 */
115
116 printk(KERN_INFO "Programmed "CARD_NAME" at 0x%X to legacy mode.\n",
117 iobase);
118
119 /*
120 * Now set it up the description of the card
121 */
122
123 mss_data[cards].io_base = mssbase;
124 mss_data[cards].irq = pcidev->irq;
125 mss_data[cards].dma = dma;
126
127 /*
128 * Check there is an MSS present
129 */
130
131 if(ad1848_detect(mssbase, NULL, mss_data[cards].osp)==0)
132 return 0;
133
134 /*
135 * Initialize it
136 */
137
138 mss_data[cards].slots[3] = ad1848_init("MyCard MSS 16bit",
139 mssbase,
140 mss_data[cards].irq,
141 mss_data[cards].dma,
142 mss_data[cards].dma,
143 0,
144 0,
145 THIS_MODULE);
146
147 cards++;
148 return 1;
149}
150
151
152/*
153 * This loop walks the PCI configuration database and finds where
154 * the sound cards are.
155 */
156
157int init_mycard(void)
158{
159 struct pci_dev *pcidev=NULL;
160 int count=0;
161
162 while((pcidev = pci_find_device(PCI_VENDOR_MYIDENT, PCI_DEVICE_ID_MYIDENT_MYCARD1, pcidev))!=NULL)
163 {
164 if (pci_enable_device(pcidev))
165 continue;
166 count+=mycard_install(pcidev);
167 if(count)
168 return 0;
169 if(count==MAX_CARDS)
170 break;
171 }
172
173 if(count==0)
174 return -ENODEV;
175 return 0;
176}
177
178/*
179 * This function is called when the user or kernel loads the
180 * module into memory.
181 */
182
183
184int init_module(void)
185{
186 if(init_mycard()<0)
187 {
188 printk(KERN_ERR "No "CARD_NAME" cards found.\n");
189 return -ENODEV;
190 }
191
192 return 0;
193}
194
195/*
196 * This is called when it is removed. It will only be removed
197 * when its use count is 0.
198 */
199
200void cleanup_module(void)
201{
202 for(i=0;i< cards; i++)
203 {
204 /*
205 * Free attached resources
206 */
207
208 ad1848_unload(mss_data[i].io_base,
209 mss_data[i].irq,
210 mss_data[i].dma,
211 mss_data[i].dma,
212 0);
213 /*
214 * And disconnect the device from the kernel
215 */
216 sound_unload_audiodevice(mss_data[i].slots[3]);
217 }
218}
219
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index a686be936aff..95fa81e26de2 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -681,8 +681,7 @@ static void do_sequencer_timer(unsigned long dummy)
681} 681}
682 682
683 683
684static struct timer_list seq_timer = 684static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
685 TIMER_INITIALIZER(do_sequencer_timer, 0, 0);
686 685
687void request_sound_timer(int count) 686void request_sound_timer(int count)
688{ 687{
diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
index 6afe29b763b7..c9d04518b172 100644
--- a/sound/oss/sys_timer.c
+++ b/sound/oss/sys_timer.c
@@ -28,8 +28,7 @@ static unsigned long prev_event_time;
28 28
29static void poll_def_tmr(unsigned long dummy); 29static void poll_def_tmr(unsigned long dummy);
30static DEFINE_SPINLOCK(lock); 30static DEFINE_SPINLOCK(lock);
31 31static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
32static struct timer_list def_tmr = TIMER_INITIALIZER(poll_def_tmr, 0, 0);
33 32
34static unsigned long 33static unsigned long
35tmr2ticks(int tmr_value) 34tmr2ticks(int tmr_value)
diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
index be00cf128651..74ae75f9e2dc 100644
--- a/sound/oss/uart6850.c
+++ b/sound/oss/uart6850.c
@@ -78,8 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
78static void poll_uart6850(unsigned long dummy); 78static void poll_uart6850(unsigned long dummy);
79 79
80 80
81static struct timer_list uart6850_timer = 81static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
82 TIMER_INITIALIZER(poll_uart6850, 0, 0);
83 82
84static void uart6850_input_loop(void) 83static void uart6850_input_loop(void)
85{ 84{
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 5aa5fe651a8a..bfbec5876659 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -735,10 +735,9 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep)
735 if (test_bit(i, &subs->active_mask)) { 735 if (test_bit(i, &subs->active_mask)) {
736 if (! test_and_set_bit(i, &subs->unlink_mask)) { 736 if (! test_and_set_bit(i, &subs->unlink_mask)) {
737 struct urb *u = subs->dataurb[i].urb; 737 struct urb *u = subs->dataurb[i].urb;
738 if (async) { 738 if (async)
739 u->transfer_flags |= URB_ASYNC_UNLINK;
740 usb_unlink_urb(u); 739 usb_unlink_urb(u);
741 } else 740 else
742 usb_kill_urb(u); 741 usb_kill_urb(u);
743 } 742 }
744 } 743 }
@@ -748,10 +747,9 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep)
748 if (test_bit(i+16, &subs->active_mask)) { 747 if (test_bit(i+16, &subs->active_mask)) {
749 if (! test_and_set_bit(i+16, &subs->unlink_mask)) { 748 if (! test_and_set_bit(i+16, &subs->unlink_mask)) {
750 struct urb *u = subs->syncurb[i].urb; 749 struct urb *u = subs->syncurb[i].urb;
751 if (async) { 750 if (async)
752 u->transfer_flags |= URB_ASYNC_UNLINK;
753 usb_unlink_urb(u); 751 usb_unlink_urb(u);
754 } else 752 else
755 usb_kill_urb(u); 753 usb_kill_urb(u);
756 } 754 }
757 } 755 }