aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/bitops.h1
-rw-r--r--include/asm-arm/arch-pxa/ohci.h18
-rw-r--r--include/asm-arm/bitops.h2
-rw-r--r--include/asm-arm26/bitops.h1
-rw-r--r--include/asm-cris/bitops.h1
-rw-r--r--include/asm-frv/bitops.h1
-rw-r--r--include/asm-generic/bitops.h1
-rw-r--r--include/asm-h8300/bitops.h1
-rw-r--r--include/asm-i386/bitops.h1
-rw-r--r--include/asm-ia64/bitops.h1
-rw-r--r--include/asm-m32r/bitops.h1
-rw-r--r--include/asm-m68k/bitops.h1
-rw-r--r--include/asm-m68knommu/bitops.h1
-rw-r--r--include/asm-mips/.gitignore1
-rw-r--r--include/asm-mips/bitops.h2
-rw-r--r--include/asm-parisc/bitops.h1
-rw-r--r--include/asm-powerpc/bitops.h1
-rw-r--r--include/asm-s390/bitops.h1
-rw-r--r--include/asm-sh/bitops.h1
-rw-r--r--include/asm-sh64/bitops.h1
-rw-r--r--include/asm-sparc/bitops.h1
-rw-r--r--include/asm-sparc64/bitops.h1
-rw-r--r--include/asm-v850/bitops.h1
-rw-r--r--include/asm-x86_64/bitops.h27
-rw-r--r--include/asm-xtensa/bitops.h1
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitops.h9
-rw-r--r--include/linux/blkdev.h9
-rw-r--r--include/linux/cpufreq.h10
-rw-r--r--include/linux/dccp.h7
-rw-r--r--include/linux/device.h14
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/firmware.h2
-rw-r--r--include/linux/if_pppox.h3
-rw-r--r--include/linux/input.h79
-rw-r--r--include/linux/ip.h121
-rw-r--r--include/linux/ipv6.h79
-rw-r--r--include/linux/kobject.h54
-rw-r--r--include/linux/kobject_uevent.h57
-rw-r--r--include/linux/libata.h13
-rw-r--r--include/linux/net.h4
-rw-r--r--include/linux/netdevice.h11
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/pfkeyv2.h13
-rw-r--r--include/linux/pkt_sched.h7
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pnp.h9
-rw-r--r--include/linux/random.h6
-rw-r--r--include/linux/security.h132
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/linux/socket.h1
-rw-r--r--include/linux/spinlock.h3
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/udf_fs.h5
-rw-r--r--include/linux/udf_fs_i.h5
-rw-r--r--include/linux/udf_fs_sb.h5
-rw-r--r--include/linux/udp.h6
-rw-r--r--include/linux/usb.h35
-rw-r--r--include/linux/usb_usual.h126
-rw-r--r--include/linux/xfrm.h29
-rw-r--r--include/net/af_unix.h12
-rw-r--r--include/net/atmclip.h2
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/flow.h7
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/icmp.h9
-rw-r--r--include/net/ieee80211_crypt.h9
-rw-r--r--include/net/inet6_connection_sock.h42
-rw-r--r--include/net/inet6_hashtables.h32
-rw-r--r--include/net/inet_common.h4
-rw-r--r--include/net/inet_connection_sock.h45
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/inet_hashtables.h24
-rw-r--r--include/net/inet_sock.h193
-rw-r--r--include/net/inet_timewait_sock.h8
-rw-r--r--include/net/inetpeer.h1
-rw-r--r--include/net/ip.h19
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/ip_vs.h12
-rw-r--r--include/net/ipv6.h12
-rw-r--r--include/net/ndisc.h17
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/pkt_act.h1
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/raw.h2
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/sctp/structs.h76
-rw-r--r--include/net/sctp/user.h30
-rw-r--r--include/net/sock.h32
-rw-r--r--include/net/tcp.h246
-rw-r--r--include/net/tcp_states.h16
-rw-r--r--include/net/timewait_sock.h31
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h4
-rw-r--r--include/net/xfrm.h30
-rw-r--r--include/scsi/scsi_cmnd.h2
-rw-r--r--include/scsi/scsi_dbg.h1
-rw-r--r--include/scsi/scsi_device.h12
-rw-r--r--include/scsi/scsi_transport_spi.h4
-rw-r--r--include/sound/ac97_codec.h169
-rw-r--r--include/sound/ad1816a.h22
-rw-r--r--include/sound/ad1848.h33
-rw-r--r--include/sound/ainstr_fm.h28
-rw-r--r--include/sound/ainstr_gf1.h46
-rw-r--r--include/sound/ainstr_iw.h115
-rw-r--r--include/sound/ainstr_simple.h35
-rw-r--r--include/sound/ak4114.h30
-rw-r--r--include/sound/ak4117.h24
-rw-r--r--include/sound/ak4531_codec.h17
-rw-r--r--include/sound/ak4xxx-adda.h22
-rw-r--r--include/sound/asequencer.h378
-rw-r--r--include/sound/asound.h566
-rw-r--r--include/sound/asound_fm.h24
-rw-r--r--include/sound/control.h94
-rw-r--r--include/sound/core.h223
-rw-r--r--include/sound/cs4231.h113
-rw-r--r--include/sound/cs46xx.h89
-rw-r--r--include/sound/cs46xx_dsp_scb_types.h145
-rw-r--r--include/sound/cs46xx_dsp_spos.h119
-rw-r--r--include/sound/cs46xx_dsp_task_types.h35
-rw-r--r--include/sound/cs8403.h8
-rw-r--r--include/sound/cs8427.h17
-rw-r--r--include/sound/driver.h7
-rw-r--r--include/sound/emu10k1.h371
-rw-r--r--include/sound/emu10k1_synth.h6
-rw-r--r--include/sound/emu8000.h39
-rw-r--r--include/sound/emux_synth.h105
-rw-r--r--include/sound/es1688.h22
-rw-r--r--include/sound/gus.h379
-rw-r--r--include/sound/hdsp.h51
-rw-r--r--include/sound/hdspm.h45
-rw-r--r--include/sound/hwdep.h43
-rw-r--r--include/sound/i2c.h78
-rw-r--r--include/sound/info.h107
-rw-r--r--include/sound/initval.h14
-rw-r--r--include/sound/minors.h29
-rw-r--r--include/sound/mixer_oss.h54
-rw-r--r--include/sound/mpu401.h26
-rw-r--r--include/sound/opl3.h57
-rw-r--r--include/sound/opl4.h6
-rw-r--r--include/sound/pcm-indirect.h28
-rw-r--r--include/sound/pcm.h476
-rw-r--r--include/sound/pcm_oss.h41
-rw-r--r--include/sound/pcm_params.h86
-rw-r--r--include/sound/rawmidi.h125
-rw-r--r--include/sound/sb.h74
-rw-r--r--include/sound/sb16_csp.h52
-rw-r--r--include/sound/seq_device.h18
-rw-r--r--include/sound/seq_instr.h64
-rw-r--r--include/sound/seq_kernel.h125
-rw-r--r--include/sound/seq_midi_emul.h44
-rw-r--r--include/sound/seq_midi_event.h22
-rw-r--r--include/sound/seq_oss.h30
-rw-r--r--include/sound/seq_virmidi.h22
-rw-r--r--include/sound/sfnt_info.h36
-rw-r--r--include/sound/snd_wavefront.h20
-rw-r--r--include/sound/soundfont.h75
-rw-r--r--include/sound/tea575x-tuner.h12
-rw-r--r--include/sound/tea6330t.h17
-rw-r--r--include/sound/timer.h94
-rw-r--r--include/sound/trident.h153
-rw-r--r--include/sound/typedefs.h173
-rw-r--r--include/sound/uda1341.h109
-rw-r--r--include/sound/util_mem.h32
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/vx_core.h131
-rw-r--r--include/sound/ymfpci.h112
168 files changed, 4175 insertions, 3706 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h
index 578ed3f1a607..302201f1a097 100644
--- a/include/asm-alpha/bitops.h
+++ b/include/asm-alpha/bitops.h
@@ -321,6 +321,7 @@ static inline int fls(int word)
321#else 321#else
322#define fls generic_fls 322#define fls generic_fls
323#endif 323#endif
324#define fls64 generic_fls64
324 325
325/* Compute powers of two for the given integer. */ 326/* Compute powers of two for the given integer. */
326static inline long floor_log2(unsigned long word) 327static inline long floor_log2(unsigned long word)
diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h
new file mode 100644
index 000000000000..7da89569061e
--- /dev/null
+++ b/include/asm-arm/arch-pxa/ohci.h
@@ -0,0 +1,18 @@
1#ifndef ASMARM_ARCH_OHCI_H
2#define ASMARM_ARCH_OHCI_H
3
4struct device;
5
6struct pxaohci_platform_data {
7 int (*init)(struct device *);
8 void (*exit)(struct device *);
9
10 int port_mode;
11#define PMM_NPS_MODE 1
12#define PMM_GLOBAL_MODE 2
13#define PMM_PERPORT_MODE 3
14};
15
16extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
17
18#endif
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index 7399d431edfe..d02de721ecc1 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -332,6 +332,7 @@ static inline unsigned long __ffs(unsigned long word)
332 */ 332 */
333 333
334#define fls(x) generic_fls(x) 334#define fls(x) generic_fls(x)
335#define fls64(x) generic_fls64(x)
335 336
336/* 337/*
337 * ffs: find first bit set. This is defined the same way as 338 * ffs: find first bit set. This is defined the same way as
@@ -351,6 +352,7 @@ static inline unsigned long __ffs(unsigned long word)
351#define fls(x) \ 352#define fls(x) \
352 ( __builtin_constant_p(x) ? generic_fls(x) : \ 353 ( __builtin_constant_p(x) ? generic_fls(x) : \
353 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) 354 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) )
355#define fls64(x) generic_fls64(x)
354#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) 356#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
355#define __ffs(x) (ffs(x) - 1) 357#define __ffs(x) (ffs(x) - 1)
356#define ffz(x) __ffs( ~(x) ) 358#define ffz(x) __ffs( ~(x) )
diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h
index 7d062fb2e343..15cc6f2da792 100644
--- a/include/asm-arm26/bitops.h
+++ b/include/asm-arm26/bitops.h
@@ -259,6 +259,7 @@ static inline unsigned long __ffs(unsigned long word)
259 */ 259 */
260 260
261#define fls(x) generic_fls(x) 261#define fls(x) generic_fls(x)
262#define fls64(x) generic_fls64(x)
262 263
263/* 264/*
264 * ffs: find first bit set. This is defined the same way as 265 * ffs: find first bit set. This is defined the same way as
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index 1bddb3f3a289..d3eb0f1e4208 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -240,6 +240,7 @@ static inline int test_bit(int nr, const volatile unsigned long *addr)
240 */ 240 */
241 241
242#define fls(x) generic_fls(x) 242#define fls(x) generic_fls(x)
243#define fls64(x) generic_fls64(x)
243 244
244/* 245/*
245 * hweightN - returns the hamming weight of a N-bit word 246 * hweightN - returns the hamming weight of a N-bit word
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index b664bd5b6663..02be7b3a8a83 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -228,6 +228,7 @@ found_middle:
228 \ 228 \
229 bit ? 33 - bit : bit; \ 229 bit ? 33 - bit : bit; \
230}) 230})
231#define fls64(x) generic_fls64(x)
231 232
232/* 233/*
233 * Every architecture must define this function. It's the fastest 234 * Every architecture must define this function. It's the fastest
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index ce31b739fd80..0e6d9852008c 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -56,6 +56,7 @@ extern __inline__ int test_bit(int nr, const unsigned long * addr)
56 */ 56 */
57 57
58#define fls(x) generic_fls(x) 58#define fls(x) generic_fls(x)
59#define fls64(x) generic_fls64(x)
59 60
60#ifdef __KERNEL__ 61#ifdef __KERNEL__
61 62
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
index 5036f595f8c9..c0411ec9d651 100644
--- a/include/asm-h8300/bitops.h
+++ b/include/asm-h8300/bitops.h
@@ -406,5 +406,6 @@ found_middle:
406#endif /* __KERNEL__ */ 406#endif /* __KERNEL__ */
407 407
408#define fls(x) generic_fls(x) 408#define fls(x) generic_fls(x)
409#define fls64(x) generic_fls64(x)
409 410
410#endif /* _H8300_BITOPS_H */ 411#endif /* _H8300_BITOPS_H */
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index ddf1739dc7fd..4807aa1d2e3d 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -372,6 +372,7 @@ static inline unsigned long ffz(unsigned long word)
372 */ 372 */
373 373
374#define fls(x) generic_fls(x) 374#define fls(x) generic_fls(x)
375#define fls64(x) generic_fls64(x)
375 376
376#ifdef __KERNEL__ 377#ifdef __KERNEL__
377 378
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index 7232528e2d0c..36d0fb95ea89 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -345,6 +345,7 @@ fls (int t)
345 x |= x >> 16; 345 x |= x >> 16;
346 return ia64_popcnt(x); 346 return ia64_popcnt(x);
347} 347}
348#define fls64(x) generic_fls64(x)
348 349
349/* 350/*
350 * ffs: find first bit set. This is defined the same way as the libc and compiler builtin 351 * ffs: find first bit set. This is defined the same way as the libc and compiler builtin
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index e78443981349..abea2fdd8689 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -465,6 +465,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
465 * fls: find last bit set. 465 * fls: find last bit set.
466 */ 466 */
467#define fls(x) generic_fls(x) 467#define fls(x) generic_fls(x)
468#define fls64(x) generic_fls64(x)
468 469
469#ifdef __KERNEL__ 470#ifdef __KERNEL__
470 471
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index b1bcf7c66516..13f4c0048463 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -310,6 +310,7 @@ static inline int fls(int x)
310 310
311 return 32 - cnt; 311 return 32 - cnt;
312} 312}
313#define fls64(x) generic_fls64(x)
313 314
314/* 315/*
315 * Every architecture must define this function. It's the fastest 316 * Every architecture must define this function. It's the fastest
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index c42f88a9b9f9..4058dd086a02 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -499,5 +499,6 @@ found_middle:
499 * fls: find last bit set. 499 * fls: find last bit set.
500 */ 500 */
501#define fls(x) generic_fls(x) 501#define fls(x) generic_fls(x)
502#define fls64(x) generic_fls64(x)
502 503
503#endif /* _M68KNOMMU_BITOPS_H */ 504#endif /* _M68KNOMMU_BITOPS_H */
diff --git a/include/asm-mips/.gitignore b/include/asm-mips/.gitignore
deleted file mode 100644
index 4ec57ad5bc3c..000000000000
--- a/include/asm-mips/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1asm_offsets.h
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 5496f9064a6a..3b0c8aaf6e8b 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -695,7 +695,7 @@ static inline unsigned long fls(unsigned long word)
695 695
696 return flz(~word) + 1; 696 return flz(~word) + 1;
697} 697}
698 698#define fls64(x) generic_fls64(x)
699 699
700/* 700/*
701 * find_next_zero_bit - find the first zero bit in a memory region 701 * find_next_zero_bit - find the first zero bit in a memory region
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 55b98c67fd82..15d8c2b51584 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -263,6 +263,7 @@ static __inline__ int fls(int x)
263 263
264 return ret; 264 return ret;
265} 265}
266#define fls64(x) generic_fls64(x)
266 267
267/* 268/*
268 * hweightN: returns the hamming weight (i.e. the number 269 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 5727229b0444..1996eaa8aeae 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -310,6 +310,7 @@ static __inline__ int fls(unsigned int x)
310 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); 310 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
311 return 32 - lz; 311 return 32 - lz;
312} 312}
313#define fls64(x) generic_fls64(x)
313 314
314/* 315/*
315 * hweightN: returns the hamming weight (i.e. the number 316 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index b07c578b22ea..61232760cc3b 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -839,6 +839,7 @@ static inline int sched_find_first_bit(unsigned long *b)
839 * fls: find last bit set. 839 * fls: find last bit set.
840 */ 840 */
841#define fls(x) generic_fls(x) 841#define fls(x) generic_fls(x)
842#define fls64(x) generic_fls64(x)
842 843
843/* 844/*
844 * hweightN: returns the hamming weight (i.e. the number 845 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index 5163d1ff2f1b..1c5260860045 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -470,6 +470,7 @@ found_middle:
470 */ 470 */
471 471
472#define fls(x) generic_fls(x) 472#define fls(x) generic_fls(x)
473#define fls64(x) generic_fls64(x)
473 474
474#endif /* __KERNEL__ */ 475#endif /* __KERNEL__ */
475 476
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h
index e1ff63e09227..ce9c3ad45fe0 100644
--- a/include/asm-sh64/bitops.h
+++ b/include/asm-sh64/bitops.h
@@ -510,6 +510,7 @@ found_middle:
510 510
511#define ffs(x) generic_ffs(x) 511#define ffs(x) generic_ffs(x)
512#define fls(x) generic_fls(x) 512#define fls(x) generic_fls(x)
513#define fls64(x) generic_fls64(x)
513 514
514#endif /* __KERNEL__ */ 515#endif /* __KERNEL__ */
515 516
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index bfbd795a0a80..41722b5e45ef 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -298,6 +298,7 @@ static inline int ffs(int x)
298 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. 298 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
299 */ 299 */
300#define fls(x) generic_fls(x) 300#define fls(x) generic_fls(x)
301#define fls64(x) generic_fls64(x)
301 302
302/* 303/*
303 * hweightN: returns the hamming weight (i.e. the number 304 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 6388b8376c50..6efc0162fb09 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -119,6 +119,7 @@ static inline unsigned long __ffs(unsigned long word)
119 */ 119 */
120 120
121#define fls(x) generic_fls(x) 121#define fls(x) generic_fls(x)
122#define fls64(x) generic_fls64(x)
122 123
123#ifdef __KERNEL__ 124#ifdef __KERNEL__
124 125
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h
index b91e799763fd..8955d2376ac8 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -276,6 +276,7 @@ found_middle:
276 276
277#define ffs(x) generic_ffs (x) 277#define ffs(x) generic_ffs (x)
278#define fls(x) generic_fls (x) 278#define fls(x) generic_fls (x)
279#define fls64(x) generic_fls64(x)
279#define __ffs(x) ffs(x) 280#define __ffs(x) ffs(x)
280 281
281 282
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index 05a0d374404b..a4d5d0909453 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -340,6 +340,20 @@ static __inline__ unsigned long __ffs(unsigned long word)
340 return word; 340 return word;
341} 341}
342 342
343/*
344 * __fls: find last bit set.
345 * @word: The word to search
346 *
347 * Undefined if no zero exists, so code should check against ~0UL first.
348 */
349static __inline__ unsigned long __fls(unsigned long word)
350{
351 __asm__("bsrq %1,%0"
352 :"=r" (word)
353 :"rm" (word));
354 return word;
355}
356
343#ifdef __KERNEL__ 357#ifdef __KERNEL__
344 358
345static inline int sched_find_first_bit(const unsigned long *b) 359static inline int sched_find_first_bit(const unsigned long *b)
@@ -370,6 +384,19 @@ static __inline__ int ffs(int x)
370} 384}
371 385
372/** 386/**
387 * fls64 - find last bit set in 64 bit word
388 * @x: the word to search
389 *
390 * This is defined the same way as fls.
391 */
392static __inline__ int fls64(__u64 x)
393{
394 if (x == 0)
395 return 0;
396 return __fls(x) + 1;
397}
398
399/**
373 * hweightN - returns the hamming weight of a N-bit word 400 * hweightN - returns the hamming weight of a N-bit word
374 * @x: the word to weigh 401 * @x: the word to weigh
375 * 402 *
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index e76ee889e21d..0a2065f1a372 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -245,6 +245,7 @@ static __inline__ int fls (unsigned int x)
245{ 245{
246 return __cntlz(x); 246 return __cntlz(x);
247} 247}
248#define fls64(x) generic_fls64(x)
248 249
249static __inline__ int 250static __inline__ int
250find_next_bit(const unsigned long *addr, int size, int offset) 251find_next_bit(const unsigned long *addr, int size, int offset)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 685fd3720df5..b60ffe32cd21 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,6 +292,8 @@ extern struct bio *bio_clone(struct bio *, gfp_t);
292extern void bio_init(struct bio *); 292extern void bio_init(struct bio *);
293 293
294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); 294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
295extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
296 unsigned int, unsigned int);
295extern int bio_get_nr_vecs(struct block_device *); 297extern int bio_get_nr_vecs(struct block_device *);
296extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 298extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
297 unsigned long, unsigned int, int); 299 unsigned long, unsigned int, int);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 38c2fb7ebe09..6a2a19f14bb2 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x)
76 */ 76 */
77#include <asm/bitops.h> 77#include <asm/bitops.h>
78 78
79
80static inline int generic_fls64(__u64 x)
81{
82 __u32 h = x >> 32;
83 if (h)
84 return fls(x) + 32;
85 return fls(x);
86}
87
79static __inline__ int get_bitmask_order(unsigned int count) 88static __inline__ int get_bitmask_order(unsigned int count)
80{ 89{
81 int order; 90 int order;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a33a31e71bbc..a18500d196e1 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -184,6 +184,7 @@ struct request {
184 void *sense; 184 void *sense;
185 185
186 unsigned int timeout; 186 unsigned int timeout;
187 int retries;
187 188
188 /* 189 /*
189 * For Power Management requests 190 * For Power Management requests
@@ -558,6 +559,7 @@ extern void blk_unregister_queue(struct gendisk *disk);
558extern void register_disk(struct gendisk *dev); 559extern void register_disk(struct gendisk *dev);
559extern void generic_make_request(struct bio *bio); 560extern void generic_make_request(struct bio *bio);
560extern void blk_put_request(struct request *); 561extern void blk_put_request(struct request *);
562extern void __blk_put_request(request_queue_t *, struct request *);
561extern void blk_end_sync_rq(struct request *rq); 563extern void blk_end_sync_rq(struct request *rq);
562extern void blk_attempt_remerge(request_queue_t *, struct request *); 564extern void blk_attempt_remerge(request_queue_t *, struct request *);
563extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 565extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
@@ -579,6 +581,10 @@ extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned
579extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); 581extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
580extern int blk_execute_rq(request_queue_t *, struct gendisk *, 582extern int blk_execute_rq(request_queue_t *, struct gendisk *,
581 struct request *, int); 583 struct request *, int);
584extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
585 struct request *, int,
586 void (*done)(struct request *));
587
582static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 588static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
583{ 589{
584 return bdev->bd_disk->queue; 590 return bdev->bd_disk->queue;
@@ -696,7 +702,8 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
696 702
697#define MAX_PHYS_SEGMENTS 128 703#define MAX_PHYS_SEGMENTS 128
698#define MAX_HW_SEGMENTS 128 704#define MAX_HW_SEGMENTS 128
699#define MAX_SECTORS 255 705#define SAFE_MAX_SECTORS 255
706#define BLK_DEF_MAX_SECTORS 1024
700 707
701#define MAX_SEGMENT_SIZE 65536 708#define MAX_SEGMENT_SIZE 65536
702 709
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index d068176b7ad7..c31650df9241 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -256,6 +256,16 @@ int cpufreq_update_policy(unsigned int cpu);
256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
257unsigned int cpufreq_get(unsigned int cpu); 257unsigned int cpufreq_get(unsigned int cpu);
258 258
259/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
260#ifdef CONFIG_CPU_FREQ
261unsigned int cpufreq_quick_get(unsigned int cpu);
262#else
263static inline unsigned int cpufreq_quick_get(unsigned int cpu)
264{
265 return 0;
266}
267#endif
268
259 269
260/********************************************************************* 270/*********************************************************************
261 * CPUFREQ DEFAULT GOVERNOR * 271 * CPUFREQ DEFAULT GOVERNOR *
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 71fab4311e92..088529f54965 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -192,10 +192,9 @@ enum {
192#include <linux/workqueue.h> 192#include <linux/workqueue.h>
193 193
194#include <net/inet_connection_sock.h> 194#include <net/inet_connection_sock.h>
195#include <net/inet_sock.h>
195#include <net/inet_timewait_sock.h> 196#include <net/inet_timewait_sock.h>
196#include <net/sock.h>
197#include <net/tcp_states.h> 197#include <net/tcp_states.h>
198#include <net/tcp.h>
199 198
200enum dccp_state { 199enum dccp_state {
201 DCCP_OPEN = TCP_ESTABLISHED, 200 DCCP_OPEN = TCP_ESTABLISHED,
@@ -408,8 +407,6 @@ struct dccp_ackvec;
408 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 407 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
409 * @dccps_timestamp_time - time of latest TIMESTAMP option 408 * @dccps_timestamp_time - time of latest TIMESTAMP option
410 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 409 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
411 * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options)
412 * @dccps_pmtu_cookie - Last pmtu seen by socket
413 * @dccps_packet_size - Set thru setsockopt 410 * @dccps_packet_size - Set thru setsockopt
414 * @dccps_role - Role of this sock, one of %dccp_role 411 * @dccps_role - Role of this sock, one of %dccp_role
415 * @dccps_ndp_count - number of Non Data Packets since last data packet 412 * @dccps_ndp_count - number of Non Data Packets since last data packet
@@ -434,8 +431,6 @@ struct dccp_sock {
434 __u32 dccps_timestamp_echo; 431 __u32 dccps_timestamp_echo;
435 __u32 dccps_packet_size; 432 __u32 dccps_packet_size;
436 unsigned long dccps_ndp_count; 433 unsigned long dccps_ndp_count;
437 __u16 dccps_ext_header_len;
438 __u32 dccps_pmtu_cookie;
439 __u32 dccps_mss_cache; 434 __u32 dccps_mss_cache;
440 struct dccp_options dccps_options; 435 struct dccp_options dccps_options;
441 struct dccp_ackvec *dccps_hc_rx_ackvec; 436 struct dccp_ackvec *dccps_hc_rx_ackvec;
diff --git a/include/linux/device.h b/include/linux/device.h
index 17cbc6db67b4..0cdee78e5ce1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,8 +47,8 @@ struct bus_type {
47 struct driver_attribute * drv_attrs; 47 struct driver_attribute * drv_attrs;
48 48
49 int (*match)(struct device * dev, struct device_driver * drv); 49 int (*match)(struct device * dev, struct device_driver * drv);
50 int (*hotplug) (struct device *dev, char **envp, 50 int (*uevent)(struct device *dev, char **envp,
51 int num_envp, char *buffer, int buffer_size); 51 int num_envp, char *buffer, int buffer_size);
52 int (*suspend)(struct device * dev, pm_message_t state); 52 int (*suspend)(struct device * dev, pm_message_t state);
53 int (*resume)(struct device * dev); 53 int (*resume)(struct device * dev);
54}; 54};
@@ -151,7 +151,7 @@ struct class {
151 struct class_attribute * class_attrs; 151 struct class_attribute * class_attrs;
152 struct class_device_attribute * class_dev_attrs; 152 struct class_device_attribute * class_dev_attrs;
153 153
154 int (*hotplug)(struct class_device *dev, char **envp, 154 int (*uevent)(struct class_device *dev, char **envp,
155 int num_envp, char *buffer, int buffer_size); 155 int num_envp, char *buffer, int buffer_size);
156 156
157 void (*release)(struct class_device *dev); 157 void (*release)(struct class_device *dev);
@@ -209,9 +209,9 @@ extern int class_device_create_file(struct class_device *,
209 * set, this will be called instead of the class specific release function. 209 * set, this will be called instead of the class specific release function.
210 * Only use this if you want to override the default release function, like 210 * Only use this if you want to override the default release function, like
211 * when you are nesting class_device structures. 211 * when you are nesting class_device structures.
212 * @hotplug: pointer to a hotplug function for this struct class_device. If 212 * @uevent: pointer to a uevent function for this struct class_device. If
213 * set, this will be called instead of the class specific hotplug function. 213 * set, this will be called instead of the class specific uevent function.
214 * Only use this if you want to override the default hotplug function, like 214 * Only use this if you want to override the default uevent function, like
215 * when you are nesting class_device structures. 215 * when you are nesting class_device structures.
216 */ 216 */
217struct class_device { 217struct class_device {
@@ -227,7 +227,7 @@ struct class_device {
227 struct class_device *parent; /* parent of this child device, if there is one */ 227 struct class_device *parent; /* parent of this child device, if there is one */
228 228
229 void (*release)(struct class_device *dev); 229 void (*release)(struct class_device *dev);
230 int (*hotplug)(struct class_device *dev, char **envp, 230 int (*uevent)(struct class_device *dev, char **envp,
231 int num_envp, char *buffer, int buffer_size); 231 int num_envp, char *buffer, int buffer_size);
232 char class_id[BUS_ID_SIZE]; /* unique to this class */ 232 char class_id[BUS_ID_SIZE]; /* unique to this class */
233}; 233};
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 5f49a30eb6f2..745c988359c0 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -63,10 +63,11 @@ static inline int is_zero_ether_addr(const u8 *addr)
63 * @addr: Pointer to a six-byte array containing the Ethernet address 63 * @addr: Pointer to a six-byte array containing the Ethernet address
64 * 64 *
65 * Return true if the address is a multicast address. 65 * Return true if the address is a multicast address.
66 * By definition the broadcast address is also a multicast address.
66 */ 67 */
67static inline int is_multicast_ether_addr(const u8 *addr) 68static inline int is_multicast_ether_addr(const u8 *addr)
68{ 69{
69 return ((addr[0] != 0xff) && (0x01 & addr[0])); 70 return (0x01 & addr[0]);
70} 71}
71 72
72/** 73/**
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 2063c0839d4f..2d716080be4a 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -14,7 +14,7 @@ struct device;
14int request_firmware(const struct firmware **fw, const char *name, 14int request_firmware(const struct firmware **fw, const char *name,
15 struct device *device); 15 struct device *device);
16int request_firmware_nowait( 16int request_firmware_nowait(
17 struct module *module, int hotplug, 17 struct module *module, int uevent,
18 const char *name, struct device *device, void *context, 18 const char *name, struct device *device, void *context,
19 void (*cont)(const struct firmware *fw, void *context)); 19 void (*cont)(const struct firmware *fw, void *context));
20 20
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index e677f73f13dd..4fab3d0a4bce 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -157,8 +157,7 @@ struct pppox_proto {
157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); 157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp);
158extern void unregister_pppox_proto(int proto_num); 158extern void unregister_pppox_proto(int proto_num);
159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ 159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
160extern int pppox_channel_ioctl(struct ppp_channel *pc, unsigned int cmd, 160extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
161 unsigned long arg);
162 161
163/* PPPoX socket states */ 162/* PPPoX socket states */
164enum { 163enum {
diff --git a/include/linux/input.h b/include/linux/input.h
index 3c5823368ddb..6d4cc3c110d6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -13,6 +13,7 @@
13#include <linux/time.h> 13#include <linux/time.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
16#else 17#else
17#include <sys/time.h> 18#include <sys/time.h>
18#include <sys/ioctl.h> 19#include <sys/ioctl.h>
@@ -511,6 +512,8 @@ struct input_absinfo {
511#define KEY_FN_S 0x1e3 512#define KEY_FN_S 0x1e3
512#define KEY_FN_B 0x1e4 513#define KEY_FN_B 0x1e4
513 514
515/* We avoid low common keys in module aliases so they don't get huge. */
516#define KEY_MIN_INTERESTING KEY_MUTE
514#define KEY_MAX 0x1ff 517#define KEY_MAX 0x1ff
515 518
516/* 519/*
@@ -793,6 +796,44 @@ struct ff_effect {
793 796
794#define FF_MAX 0x7f 797#define FF_MAX 0x7f
795 798
799struct input_device_id {
800
801 kernel_ulong_t flags;
802
803 struct input_id id;
804
805 kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];
806 kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];
807 kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];
808 kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];
809 kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];
810 kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];
811 kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];
812 kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];
813 kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];
814
815 kernel_ulong_t driver_info;
816};
817
818/*
819 * Structure for hotplug & device<->driver matching.
820 */
821
822#define INPUT_DEVICE_ID_MATCH_BUS 1
823#define INPUT_DEVICE_ID_MATCH_VENDOR 2
824#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
825#define INPUT_DEVICE_ID_MATCH_VERSION 8
826
827#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
828#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
829#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
830#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
831#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
832#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
833#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
834#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
835#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
836
796#ifdef __KERNEL__ 837#ifdef __KERNEL__
797 838
798/* 839/*
@@ -901,49 +942,11 @@ struct input_dev {
901}; 942};
902#define to_input_dev(d) container_of(d, struct input_dev, cdev) 943#define to_input_dev(d) container_of(d, struct input_dev, cdev)
903 944
904/*
905 * Structure for hotplug & device<->driver matching.
906 */
907
908#define INPUT_DEVICE_ID_MATCH_BUS 1
909#define INPUT_DEVICE_ID_MATCH_VENDOR 2
910#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
911#define INPUT_DEVICE_ID_MATCH_VERSION 8
912
913#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
914#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
915#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
916#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
917#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
918#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
919#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
920#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
921#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
922
923#define INPUT_DEVICE_ID_MATCH_DEVICE\ 945#define INPUT_DEVICE_ID_MATCH_DEVICE\
924 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) 946 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
925#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ 947#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
926 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) 948 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
927 949
928struct input_device_id {
929
930 unsigned long flags;
931
932 struct input_id id;
933
934 unsigned long evbit[NBITS(EV_MAX)];
935 unsigned long keybit[NBITS(KEY_MAX)];
936 unsigned long relbit[NBITS(REL_MAX)];
937 unsigned long absbit[NBITS(ABS_MAX)];
938 unsigned long mscbit[NBITS(MSC_MAX)];
939 unsigned long ledbit[NBITS(LED_MAX)];
940 unsigned long sndbit[NBITS(SND_MAX)];
941 unsigned long ffbit[NBITS(FF_MAX)];
942 unsigned long swbit[NBITS(SW_MAX)];
943
944 unsigned long driver_info;
945};
946
947struct input_handle; 950struct input_handle;
948 951
949struct input_handler { 952struct input_handler {
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 33e8a19a1a0f..9e2eb9a602eb 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -16,6 +16,7 @@
16 */ 16 */
17#ifndef _LINUX_IP_H 17#ifndef _LINUX_IP_H
18#define _LINUX_IP_H 18#define _LINUX_IP_H
19#include <linux/types.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20 21
21#define IPTOS_TOS_MASK 0x1E 22#define IPTOS_TOS_MASK 0x1E
@@ -78,126 +79,6 @@
78#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 79#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
79#define IPOPT_TS_PRESPEC 3 /* specified modules only */ 80#define IPOPT_TS_PRESPEC 3 /* specified modules only */
80 81
81#ifdef __KERNEL__
82#include <linux/config.h>
83#include <linux/types.h>
84#include <net/request_sock.h>
85#include <net/sock.h>
86#include <linux/igmp.h>
87#include <net/flow.h>
88
89struct ip_options {
90 __u32 faddr; /* Saved first hop address */
91 unsigned char optlen;
92 unsigned char srr;
93 unsigned char rr;
94 unsigned char ts;
95 unsigned char is_setbyuser:1, /* Set by setsockopt? */
96 is_data:1, /* Options in __data, rather than skb */
97 is_strictroute:1, /* Strict source route */
98 srr_is_hit:1, /* Packet destination addr was our one */
99 is_changed:1, /* IP checksum more not valid */
100 rr_needaddr:1, /* Need to record addr of outgoing dev */
101 ts_needtime:1, /* Need to record timestamp */
102 ts_needaddr:1; /* Need to record addr of outgoing dev */
103 unsigned char router_alert;
104 unsigned char __pad1;
105 unsigned char __pad2;
106 unsigned char __data[0];
107};
108
109#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
110
111struct inet_request_sock {
112 struct request_sock req;
113 u32 loc_addr;
114 u32 rmt_addr;
115 u16 rmt_port;
116 u16 snd_wscale : 4,
117 rcv_wscale : 4,
118 tstamp_ok : 1,
119 sack_ok : 1,
120 wscale_ok : 1,
121 ecn_ok : 1,
122 acked : 1;
123 struct ip_options *opt;
124};
125
126static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
127{
128 return (struct inet_request_sock *)sk;
129}
130
131struct ipv6_pinfo;
132
133struct inet_sock {
134 /* sk and pinet6 has to be the first two members of inet_sock */
135 struct sock sk;
136#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
137 struct ipv6_pinfo *pinet6;
138#endif
139 /* Socket demultiplex comparisons on incoming packets. */
140 __u32 daddr; /* Foreign IPv4 addr */
141 __u32 rcv_saddr; /* Bound local IPv4 addr */
142 __u16 dport; /* Destination port */
143 __u16 num; /* Local port */
144 __u32 saddr; /* Sending source */
145 __s16 uc_ttl; /* Unicast TTL */
146 __u16 cmsg_flags;
147 struct ip_options *opt;
148 __u16 sport; /* Source port */
149 __u16 id; /* ID counter for DF pkts */
150 __u8 tos; /* TOS */
151 __u8 mc_ttl; /* Multicasting TTL */
152 __u8 pmtudisc;
153 unsigned recverr : 1,
154 freebind : 1,
155 hdrincl : 1,
156 mc_loop : 1;
157 int mc_index; /* Multicast device index */
158 __u32 mc_addr;
159 struct ip_mc_socklist *mc_list; /* Group array */
160 /*
161 * Following members are used to retain the infomation to build
162 * an ip header on each ip fragmentation while the socket is corked.
163 */
164 struct {
165 unsigned int flags;
166 unsigned int fragsize;
167 struct ip_options *opt;
168 struct rtable *rt;
169 int length; /* Total length of all frames */
170 u32 addr;
171 struct flowi fl;
172 } cork;
173};
174
175#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
176#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */
177
178static inline struct inet_sock *inet_sk(const struct sock *sk)
179{
180 return (struct inet_sock *)sk;
181}
182
183static inline void __inet_sk_copy_descendant(struct sock *sk_to,
184 const struct sock *sk_from,
185 const int ancestor_size)
186{
187 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
188 sk_from->sk_prot->obj_size - ancestor_size);
189}
190#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
191static inline void inet_sk_copy_descendant(struct sock *sk_to,
192 const struct sock *sk_from)
193{
194 __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock));
195}
196#endif
197#endif
198
199extern int inet_sk_rebuild_header(struct sock *sk);
200
201struct iphdr { 82struct iphdr {
202#if defined(__LITTLE_ENDIAN_BITFIELD) 83#if defined(__LITTLE_ENDIAN_BITFIELD)
203 __u8 ihl:4, 84 __u8 ihl:4,
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0b922785d98..93bbed5c6cf4 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -171,12 +171,13 @@ enum {
171}; 171};
172 172
173#ifdef __KERNEL__ 173#ifdef __KERNEL__
174#include <linux/in6.h> /* struct sockaddr_in6 */
175#include <linux/icmpv6.h> 174#include <linux/icmpv6.h>
176#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
177#include <linux/tcp.h> 175#include <linux/tcp.h>
178#include <linux/udp.h> 176#include <linux/udp.h>
179 177
178#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
179#include <net/inet_sock.h>
180
180/* 181/*
181 This structure contains results of exthdrs parsing 182 This structure contains results of exthdrs parsing
182 as offsets from skb->nh. 183 as offsets from skb->nh.
@@ -199,18 +200,17 @@ static inline int inet6_iif(const struct sk_buff *skb)
199 return IP6CB(skb)->iif; 200 return IP6CB(skb)->iif;
200} 201}
201 202
202struct tcp6_request_sock { 203struct inet6_request_sock {
203 struct tcp_request_sock req;
204 struct in6_addr loc_addr; 204 struct in6_addr loc_addr;
205 struct in6_addr rmt_addr; 205 struct in6_addr rmt_addr;
206 struct sk_buff *pktopts; 206 struct sk_buff *pktopts;
207 int iif; 207 int iif;
208}; 208};
209 209
210static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) 210struct tcp6_request_sock {
211{ 211 struct tcp_request_sock tcp6rsk_tcp;
212 return (struct tcp6_request_sock *)sk; 212 struct inet6_request_sock tcp6rsk_inet6;
213} 213};
214 214
215/** 215/**
216 * struct ipv6_pinfo - ipv6 private area 216 * struct ipv6_pinfo - ipv6 private area
@@ -298,12 +298,36 @@ struct tcp6_sock {
298 struct ipv6_pinfo inet6; 298 struct ipv6_pinfo inet6;
299}; 299};
300 300
301extern int inet6_sk_rebuild_header(struct sock *sk);
302
301#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 303#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
302static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 304static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
303{ 305{
304 return inet_sk(__sk)->pinet6; 306 return inet_sk(__sk)->pinet6;
305} 307}
306 308
309static inline struct inet6_request_sock *
310 inet6_rsk(const struct request_sock *rsk)
311{
312 return (struct inet6_request_sock *)(((u8 *)rsk) +
313 inet_rsk(rsk)->inet6_rsk_offset);
314}
315
316static inline u32 inet6_rsk_offset(struct request_sock *rsk)
317{
318 return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock);
319}
320
321static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
322{
323 struct request_sock *req = reqsk_alloc(ops);
324
325 if (req != NULL)
326 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
327
328 return req;
329}
330
307static inline struct raw6_sock *raw6_sk(const struct sock *sk) 331static inline struct raw6_sock *raw6_sk(const struct sock *sk)
308{ 332{
309 return (struct raw6_sock *)sk; 333 return (struct raw6_sock *)sk;
@@ -323,28 +347,37 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
323#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 347#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
324#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 348#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
325 349
326#include <linux/tcp.h> 350struct inet6_timewait_sock {
351 struct in6_addr tw_v6_daddr;
352 struct in6_addr tw_v6_rcv_saddr;
353};
327 354
328struct tcp6_timewait_sock { 355struct tcp6_timewait_sock {
329 struct tcp_timewait_sock tw_v6_sk; 356 struct tcp_timewait_sock tcp6tw_tcp;
330 struct in6_addr tw_v6_daddr; 357 struct inet6_timewait_sock tcp6tw_inet6;
331 struct in6_addr tw_v6_rcv_saddr;
332}; 358};
333 359
334static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) 360static inline u16 inet6_tw_offset(const struct proto *prot)
335{ 361{
336 return (struct tcp6_timewait_sock *)sk; 362 return prot->twsk_prot->twsk_obj_size -
363 sizeof(struct inet6_timewait_sock);
337} 364}
338 365
339static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) 366static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
367{
368 return (struct inet6_timewait_sock *)(((u8 *)sk) +
369 inet_twsk(sk)->tw_ipv6_offset);
370}
371
372static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk)
340{ 373{
341 return likely(sk->sk_state != TCP_TIME_WAIT) ? 374 return likely(sk->sk_state != TCP_TIME_WAIT) ?
342 &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; 375 &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr;
343} 376}
344 377
345static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) 378static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
346{ 379{
347 return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; 380 return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL;
348} 381}
349 382
350static inline int inet_v6_ipv6only(const struct sock *sk) 383static inline int inet_v6_ipv6only(const struct sock *sk)
@@ -361,13 +394,19 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
361 return NULL; 394 return NULL;
362} 395}
363 396
397static inline struct inet6_request_sock *
398 inet6_rsk(const struct request_sock *rsk)
399{
400 return NULL;
401}
402
364static inline struct raw6_sock *raw6_sk(const struct sock *sk) 403static inline struct raw6_sock *raw6_sk(const struct sock *sk)
365{ 404{
366 return NULL; 405 return NULL;
367} 406}
368 407
369#define __tcp_v6_rcv_saddr(__sk) NULL 408#define __inet6_rcv_saddr(__sk) NULL
370#define tcp_v6_rcv_saddr(__sk) NULL 409#define inet6_rcv_saddr(__sk) NULL
371#define tcp_twsk_ipv6only(__sk) 0 410#define tcp_twsk_ipv6only(__sk) 0
372#define inet_v6_ipv6only(__sk) 0 411#define inet_v6_ipv6only(__sk) 0
373#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 412#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 7f7403aa4a41..2a8d8da70961 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -23,14 +23,27 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/kref.h> 25#include <linux/kref.h>
26#include <linux/kobject_uevent.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <asm/atomic.h> 27#include <asm/atomic.h>
29 28
30#define KOBJ_NAME_LEN 20 29#define KOBJ_NAME_LEN 20
30#define UEVENT_HELPER_PATH_LEN 256
31 31
32/* counter to tag the hotplug event, read only except for the kobject core */ 32/* path to the userspace helper executed on an event */
33extern u64 hotplug_seqnum; 33extern char uevent_helper[];
34
35/* counter to tag the uevent, read only except for the kobject core */
36extern u64 uevent_seqnum;
37
38/* the actions here must match the proper string in lib/kobject_uevent.c */
39typedef int __bitwise kobject_action_t;
40enum kobject_action {
41 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */
42 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */
43 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */
44 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */
45 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */
46};
34 47
35struct kobject { 48struct kobject {
36 const char * k_name; 49 const char * k_name;
@@ -87,15 +100,14 @@ struct kobj_type {
87 * of object; multiple ksets can belong to one subsystem. All 100 * of object; multiple ksets can belong to one subsystem. All
88 * ksets of a subsystem share the subsystem's lock. 101 * ksets of a subsystem share the subsystem's lock.
89 * 102 *
90 * Each kset can support hotplugging; if it does, it will be given 103 * Each kset can support specific event variables; it can
91 * the opportunity to filter out specific kobjects from being 104 * supress the event generation or add subsystem specific
92 * reported, as well as to add its own "data" elements to the 105 * variables carried with the event.
93 * environment being passed to the hotplug helper.
94 */ 106 */
95struct kset_hotplug_ops { 107struct kset_uevent_ops {
96 int (*filter)(struct kset *kset, struct kobject *kobj); 108 int (*filter)(struct kset *kset, struct kobject *kobj);
97 const char *(*name)(struct kset *kset, struct kobject *kobj); 109 const char *(*name)(struct kset *kset, struct kobject *kobj);
98 int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, 110 int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,
99 int num_envp, char *buffer, int buffer_size); 111 int num_envp, char *buffer, int buffer_size);
100}; 112};
101 113
@@ -105,7 +117,7 @@ struct kset {
105 struct list_head list; 117 struct list_head list;
106 spinlock_t list_lock; 118 spinlock_t list_lock;
107 struct kobject kobj; 119 struct kobject kobj;
108 struct kset_hotplug_ops * hotplug_ops; 120 struct kset_uevent_ops * uevent_ops;
109}; 121};
110 122
111 123
@@ -153,20 +165,20 @@ struct subsystem {
153 struct rw_semaphore rwsem; 165 struct rw_semaphore rwsem;
154}; 166};
155 167
156#define decl_subsys(_name,_type,_hotplug_ops) \ 168#define decl_subsys(_name,_type,_uevent_ops) \
157struct subsystem _name##_subsys = { \ 169struct subsystem _name##_subsys = { \
158 .kset = { \ 170 .kset = { \
159 .kobj = { .name = __stringify(_name) }, \ 171 .kobj = { .name = __stringify(_name) }, \
160 .ktype = _type, \ 172 .ktype = _type, \
161 .hotplug_ops =_hotplug_ops, \ 173 .uevent_ops =_uevent_ops, \
162 } \ 174 } \
163} 175}
164#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \ 176#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
165struct subsystem _varname##_subsys = { \ 177struct subsystem _varname##_subsys = { \
166 .kset = { \ 178 .kset = { \
167 .kobj = { .name = __stringify(_name) }, \ 179 .kobj = { .name = __stringify(_name) }, \
168 .ktype = _type, \ 180 .ktype = _type, \
169 .hotplug_ops =_hotplug_ops, \ 181 .uevent_ops =_uevent_ops, \
170 } \ 182 } \
171} 183}
172 184
@@ -241,15 +253,17 @@ struct subsys_attribute {
241extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 253extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
242extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); 254extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
243 255
244#ifdef CONFIG_HOTPLUG 256#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET)
245void kobject_hotplug(struct kobject *kobj, enum kobject_action action); 257void kobject_uevent(struct kobject *kobj, enum kobject_action action);
246int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 258
259int add_uevent_var(char **envp, int num_envp, int *cur_index,
247 char *buffer, int buffer_size, int *cur_len, 260 char *buffer, int buffer_size, int *cur_len,
248 const char *format, ...) 261 const char *format, ...)
249 __attribute__((format (printf, 7, 8))); 262 __attribute__((format (printf, 7, 8)));
250#else 263#else
251static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } 264static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
252static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 265
266static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
253 char *buffer, int buffer_size, int *cur_len, 267 char *buffer, int buffer_size, int *cur_len,
254 const char *format, ...) 268 const char *format, ...)
255{ return 0; } 269{ return 0; }
diff --git a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
deleted file mode 100644
index aa664fe7e561..000000000000
--- a/include/linux/kobject_uevent.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * kobject_uevent.h - list of kobject user events that can be generated
3 *
4 * Copyright (C) 2004 IBM Corp.
5 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
6 *
7 * This file is released under the GPLv2.
8 *
9 */
10
11#ifndef _KOBJECT_EVENT_H_
12#define _KOBJECT_EVENT_H_
13
14#define HOTPLUG_PATH_LEN 256
15
16/* path to the hotplug userspace helper executed on an event */
17extern char hotplug_path[];
18
19/*
20 * If you add an action here, you must also add the proper string to the
21 * lib/kobject_uevent.c file.
22 */
23typedef int __bitwise kobject_action_t;
24enum kobject_action {
25 KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */
26 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */
27 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */
28 KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */
29 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */
30 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */
31 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */
32};
33
34
35#ifdef CONFIG_KOBJECT_UEVENT
36int kobject_uevent(struct kobject *kobj,
37 enum kobject_action action,
38 struct attribute *attr);
39int kobject_uevent_atomic(struct kobject *kobj,
40 enum kobject_action action,
41 struct attribute *attr);
42#else
43static inline int kobject_uevent(struct kobject *kobj,
44 enum kobject_action action,
45 struct attribute *attr)
46{
47 return 0;
48}
49static inline int kobject_uevent_atomic(struct kobject *kobj,
50 enum kobject_action action,
51 struct attribute *attr)
52{
53 return 0;
54}
55#endif
56
57#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 41ea7dbc1755..e828e172ccbf 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -136,6 +136,8 @@ enum {
136 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */ 136 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */
137 ATA_TMOUT_CDB = 30 * HZ, 137 ATA_TMOUT_CDB = 30 * HZ,
138 ATA_TMOUT_CDB_QUICK = 5 * HZ, 138 ATA_TMOUT_CDB_QUICK = 5 * HZ,
139 ATA_TMOUT_INTERNAL = 30 * HZ,
140 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
139 141
140 /* ATA bus states */ 142 /* ATA bus states */
141 BUS_UNKNOWN = 0, 143 BUS_UNKNOWN = 0,
@@ -195,7 +197,7 @@ struct ata_port;
195struct ata_queued_cmd; 197struct ata_queued_cmd;
196 198
197/* typedefs */ 199/* typedefs */
198typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask); 200typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
199 201
200struct ata_ioports { 202struct ata_ioports {
201 unsigned long cmd_addr; 203 unsigned long cmd_addr;
@@ -280,9 +282,9 @@ struct ata_queued_cmd {
280 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ 282 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */
281 struct scatterlist *__sg; 283 struct scatterlist *__sg;
282 284
283 ata_qc_cb_t complete_fn; 285 unsigned int err_mask;
284 286
285 struct completion *waiting; 287 ata_qc_cb_t complete_fn;
286 288
287 void *private_data; 289 void *private_data;
288}; 290};
@@ -331,8 +333,6 @@ struct ata_port {
331 333
332 u8 ctl; /* cache of ATA control register */ 334 u8 ctl; /* cache of ATA control register */
333 u8 last_ctl; /* Cache last written value */ 335 u8 last_ctl; /* Cache last written value */
334 unsigned int bus_state;
335 unsigned int port_state;
336 unsigned int pio_mask; 336 unsigned int pio_mask;
337 unsigned int mwdma_mask; 337 unsigned int mwdma_mask;
338 unsigned int udma_mask; 338 unsigned int udma_mask;
@@ -478,7 +478,7 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
478extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 478extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
479extern u8 ata_bmdma_status(struct ata_port *ap); 479extern u8 ata_bmdma_status(struct ata_port *ap);
480extern void ata_bmdma_irq_clear(struct ata_port *ap); 480extern void ata_bmdma_irq_clear(struct ata_port *ap);
481extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask); 481extern void ata_qc_complete(struct ata_queued_cmd *qc);
482extern void ata_eng_timeout(struct ata_port *ap); 482extern void ata_eng_timeout(struct ata_port *ap);
483extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, 483extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd,
484 void (*done)(struct scsi_cmnd *)); 484 void (*done)(struct scsi_cmnd *));
@@ -670,6 +670,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
670 qc->cursect = qc->cursg = qc->cursg_ofs = 0; 670 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
671 qc->nsect = 0; 671 qc->nsect = 0;
672 qc->nbytes = qc->curbytes = 0; 672 qc->nbytes = qc->curbytes = 0;
673 qc->err_mask = 0;
673 674
674 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 675 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
675} 676}
diff --git a/include/linux/net.h b/include/linux/net.h
index d6a41e6577f6..28195a2d8ff0 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -107,7 +107,7 @@ enum sock_type {
107struct socket { 107struct socket {
108 socket_state state; 108 socket_state state;
109 unsigned long flags; 109 unsigned long flags;
110 struct proto_ops *ops; 110 const struct proto_ops *ops;
111 struct fasync_struct *fasync_list; 111 struct fasync_struct *fasync_list;
112 struct file *file; 112 struct file *file;
113 struct sock *sk; 113 struct sock *sk;
@@ -260,7 +260,7 @@ SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct ms
260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ 260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \
261 (file, sock, vma)) \ 261 (file, sock, vma)) \
262 \ 262 \
263static struct proto_ops name##_ops = { \ 263static const struct proto_ops name##_ops = { \
264 .family = fam, \ 264 .family = fam, \
265 .owner = THIS_MODULE, \ 265 .owner = THIS_MODULE, \
266 .release = __lock_##name##_release, \ 266 .release = __lock_##name##_release, \
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 936f8b76114e..7fda03d338d1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -684,6 +684,7 @@ extern int netif_rx(struct sk_buff *skb);
684extern int netif_rx_ni(struct sk_buff *skb); 684extern int netif_rx_ni(struct sk_buff *skb);
685#define HAVE_NETIF_RECEIVE_SKB 1 685#define HAVE_NETIF_RECEIVE_SKB 1
686extern int netif_receive_skb(struct sk_buff *skb); 686extern int netif_receive_skb(struct sk_buff *skb);
687extern int dev_valid_name(const char *name);
687extern int dev_ioctl(unsigned int cmd, void __user *); 688extern int dev_ioctl(unsigned int cmd, void __user *);
688extern int dev_ethtool(struct ifreq *); 689extern int dev_ethtool(struct ifreq *);
689extern unsigned dev_get_flags(const struct net_device *); 690extern unsigned dev_get_flags(const struct net_device *);
@@ -801,12 +802,16 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
801 return (1 << debug_value) - 1; 802 return (1 << debug_value) - 1;
802} 803}
803 804
804/* Schedule rx intr now? */ 805/* Test if receive needs to be scheduled */
806static inline int __netif_rx_schedule_prep(struct net_device *dev)
807{
808 return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
809}
805 810
811/* Test if receive needs to be scheduled but only if up */
806static inline int netif_rx_schedule_prep(struct net_device *dev) 812static inline int netif_rx_schedule_prep(struct net_device *dev)
807{ 813{
808 return netif_running(dev) && 814 return netif_running(dev) && __netif_rx_schedule_prep(dev);
809 !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
810} 815}
811 816
812/* Add interface to tail of rx poll list. This assumes that _prep has 817/* Add interface to tail of rx poll list. This assumes that _prep has
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 4db67b3b05cc..4f01710485cd 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -15,6 +15,7 @@
15#define PCI_CLASS_STORAGE_FLOPPY 0x0102 15#define PCI_CLASS_STORAGE_FLOPPY 0x0102
16#define PCI_CLASS_STORAGE_IPI 0x0103 16#define PCI_CLASS_STORAGE_IPI 0x0103
17#define PCI_CLASS_STORAGE_RAID 0x0104 17#define PCI_CLASS_STORAGE_RAID 0x0104
18#define PCI_CLASS_STORAGE_SAS 0x0107
18#define PCI_CLASS_STORAGE_OTHER 0x0180 19#define PCI_CLASS_STORAGE_OTHER 0x0180
19 20
20#define PCI_BASE_CLASS_NETWORK 0x02 21#define PCI_BASE_CLASS_NETWORK 0x02
@@ -376,6 +377,10 @@
376#define PCI_DEVICE_ID_NS_87560_USB 0x0012 377#define PCI_DEVICE_ID_NS_87560_USB 0x0012
377#define PCI_DEVICE_ID_NS_83815 0x0020 378#define PCI_DEVICE_ID_NS_83815 0x0020
378#define PCI_DEVICE_ID_NS_83820 0x0022 379#define PCI_DEVICE_ID_NS_83820 0x0022
380#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
381#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
382#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
383#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030
379#define PCI_DEVICE_ID_NS_SATURN 0x0035 384#define PCI_DEVICE_ID_NS_SATURN 0x0035
380#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 385#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
381#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 386#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 724066778aff..6351c4055ace 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -216,6 +216,16 @@ struct sadb_x_nat_t_port {
216} __attribute__((packed)); 216} __attribute__((packed));
217/* sizeof(struct sadb_x_nat_t_port) == 8 */ 217/* sizeof(struct sadb_x_nat_t_port) == 8 */
218 218
219/* Generic LSM security context */
220struct sadb_x_sec_ctx {
221 uint16_t sadb_x_sec_len;
222 uint16_t sadb_x_sec_exttype;
223 uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */
224 uint8_t sadb_x_ctx_doi;
225 uint16_t sadb_x_ctx_len;
226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */
228
219/* Message types */ 229/* Message types */
220#define SADB_RESERVED 0 230#define SADB_RESERVED 0
221#define SADB_GETSPI 1 231#define SADB_GETSPI 1
@@ -325,7 +335,8 @@ struct sadb_x_nat_t_port {
325#define SADB_X_EXT_NAT_T_SPORT 21 335#define SADB_X_EXT_NAT_T_SPORT 21
326#define SADB_X_EXT_NAT_T_DPORT 22 336#define SADB_X_EXT_NAT_T_DPORT 22
327#define SADB_X_EXT_NAT_T_OA 23 337#define SADB_X_EXT_NAT_T_OA 23
328#define SADB_EXT_MAX 23 338#define SADB_X_EXT_SEC_CTX 24
339#define SADB_EXT_MAX 24
329 340
330/* Identity Extension values */ 341/* Identity Extension values */
331#define SADB_IDENTTYPE_RESERVED 0 342#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index e87b233615b3..d10f35338507 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -429,6 +429,7 @@ enum
429 TCA_NETEM_CORR, 429 TCA_NETEM_CORR,
430 TCA_NETEM_DELAY_DIST, 430 TCA_NETEM_DELAY_DIST,
431 TCA_NETEM_REORDER, 431 TCA_NETEM_REORDER,
432 TCA_NETEM_CORRUPT,
432 __TCA_NETEM_MAX, 433 __TCA_NETEM_MAX,
433}; 434};
434 435
@@ -457,6 +458,12 @@ struct tc_netem_reorder
457 __u32 correlation; 458 __u32 correlation;
458}; 459};
459 460
461struct tc_netem_corrupt
462{
463 __u32 probability;
464 __u32 correlation;
465};
466
460#define NETEM_DIST_SCALE 8192 467#define NETEM_DIST_SCALE 8192
461 468
462#endif 469#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 17e336f40b47..782090c68932 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -41,6 +41,7 @@ extern struct platform_device *platform_device_alloc(const char *name, unsigned
41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size); 42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);
43extern int platform_device_add(struct platform_device *pdev); 43extern int platform_device_add(struct platform_device *pdev);
44extern void platform_device_del(struct platform_device *pdev);
44extern void platform_device_put(struct platform_device *pdev); 45extern void platform_device_put(struct platform_device *pdev);
45 46
46struct platform_driver { 47struct platform_driver {
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 584d57cb393a..93b0959eb40f 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -162,6 +162,7 @@ struct pnp_card_link {
162 struct pnp_card * card; 162 struct pnp_card * card;
163 struct pnp_card_driver * driver; 163 struct pnp_card_driver * driver;
164 void * driver_data; 164 void * driver_data;
165 pm_message_t pm_state;
165}; 166};
166 167
167static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) 168static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard)
@@ -294,6 +295,8 @@ struct pnp_driver {
294 unsigned int flags; 295 unsigned int flags;
295 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 296 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
296 void (*remove) (struct pnp_dev *dev); 297 void (*remove) (struct pnp_dev *dev);
298 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
299 int (*resume) (struct pnp_dev *dev);
297 struct device_driver driver; 300 struct device_driver driver;
298}; 301};
299 302
@@ -306,6 +309,8 @@ struct pnp_card_driver {
306 unsigned int flags; 309 unsigned int flags;
307 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); 310 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id);
308 void (*remove) (struct pnp_card_link *card); 311 void (*remove) (struct pnp_card_link *card);
312 int (*suspend) (struct pnp_card_link *card, pm_message_t state);
313 int (*resume) (struct pnp_card_link *card);
309 struct pnp_driver link; 314 struct pnp_driver link;
310}; 315};
311 316
@@ -380,6 +385,8 @@ void pnp_init_resource_table(struct pnp_resource_table *table);
380int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); 385int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode);
381int pnp_auto_config_dev(struct pnp_dev *dev); 386int pnp_auto_config_dev(struct pnp_dev *dev);
382int pnp_validate_config(struct pnp_dev *dev); 387int pnp_validate_config(struct pnp_dev *dev);
388int pnp_start_dev(struct pnp_dev *dev);
389int pnp_stop_dev(struct pnp_dev *dev);
383int pnp_activate_dev(struct pnp_dev *dev); 390int pnp_activate_dev(struct pnp_dev *dev);
384int pnp_disable_dev(struct pnp_dev *dev); 391int pnp_disable_dev(struct pnp_dev *dev);
385void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); 392void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size);
@@ -423,6 +430,8 @@ static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
423static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } 430static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
424static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } 431static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
425static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } 432static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
433static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
434static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
426static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 435static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
427static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 436static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
428static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { } 437static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { }
diff --git a/include/linux/random.h b/include/linux/random.h
index 7b2adb3322d5..5d6456bcdeba 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -52,9 +52,9 @@ extern void get_random_bytes(void *buf, int nbytes);
52void generate_random_uuid(unsigned char uuid_out[16]); 52void generate_random_uuid(unsigned char uuid_out[16]);
53 53
54extern __u32 secure_ip_id(__u32 daddr); 54extern __u32 secure_ip_id(__u32 daddr);
55extern u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); 55extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport);
56extern u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, 56extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr,
57 __u16 dport); 57 __u16 dport);
58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, 58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
59 __u16 sport, __u16 dport); 59 __u16 sport, __u16 dport);
60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, 60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr,
diff --git a/include/linux/security.h b/include/linux/security.h
index f7e0ae018712..ef753654daa5 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -59,6 +59,12 @@ struct sk_buff;
59struct sock; 59struct sock;
60struct sockaddr; 60struct sockaddr;
61struct socket; 61struct socket;
62struct flowi;
63struct dst_entry;
64struct xfrm_selector;
65struct xfrm_policy;
66struct xfrm_state;
67struct xfrm_user_sec_ctx;
62 68
63extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
64extern int cap_netlink_recv(struct sk_buff *skb); 70extern int cap_netlink_recv(struct sk_buff *skb);
@@ -788,6 +794,52 @@ struct swap_info_struct;
788 * which is used to copy security attributes between local stream sockets. 794 * which is used to copy security attributes between local stream sockets.
789 * @sk_free_security: 795 * @sk_free_security:
790 * Deallocate security structure. 796 * Deallocate security structure.
797 * @sk_getsid:
798 * Retrieve the LSM-specific sid for the sock to enable caching of network
799 * authorizations.
800 *
801 * Security hooks for XFRM operations.
802 *
803 * @xfrm_policy_alloc_security:
804 * @xp contains the xfrm_policy being added to Security Policy Database
805 * used by the XFRM system.
806 * @sec_ctx contains the security context information being provided by
807 * the user-level policy update program (e.g., setkey).
808 * Allocate a security structure to the xp->selector.security field.
809 * The security field is initialized to NULL when the xfrm_policy is
810 * allocated.
811 * Return 0 if operation was successful (memory to allocate, legal context)
812 * @xfrm_policy_clone_security:
813 * @old contains an existing xfrm_policy in the SPD.
814 * @new contains a new xfrm_policy being cloned from old.
815 * Allocate a security structure to the new->selector.security field
816 * that contains the information from the old->selector.security field.
817 * Return 0 if operation was successful (memory to allocate).
818 * @xfrm_policy_free_security:
819 * @xp contains the xfrm_policy
820 * Deallocate xp->selector.security.
821 * @xfrm_state_alloc_security:
822 * @x contains the xfrm_state being added to the Security Association
823 * Database by the XFRM system.
824 * @sec_ctx contains the security context information being provided by
825 * the user-level SA generation program (e.g., setkey or racoon).
826 * Allocate a security structure to the x->sel.security field. The
827 * security field is initialized to NULL when the xfrm_state is
828 * allocated.
829 * Return 0 if operation was successful (memory to allocate, legal context).
830 * @xfrm_state_free_security:
831 * @x contains the xfrm_state.
832 * Deallocate x>sel.security.
833 * @xfrm_policy_lookup:
834 * @xp contains the xfrm_policy for which the access control is being
835 * checked.
836 * @sk_sid contains the sock security label that is used to authorize
837 * access to the policy xp.
838 * @dir contains the direction of the flow (input or output).
839 * Check permission when a sock selects a xfrm_policy for processing
840 * XFRMs on a packet. The hook is called when selecting either a
841 * per-socket policy or a generic xfrm policy.
842 * Return 0 if permission is granted.
791 * 843 *
792 * Security hooks affecting all Key Management operations 844 * Security hooks affecting all Key Management operations
793 * 845 *
@@ -1237,8 +1289,18 @@ struct security_operations {
1237 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1289 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1238 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1290 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1239 void (*sk_free_security) (struct sock *sk); 1291 void (*sk_free_security) (struct sock *sk);
1292 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
1240#endif /* CONFIG_SECURITY_NETWORK */ 1293#endif /* CONFIG_SECURITY_NETWORK */
1241 1294
1295#ifdef CONFIG_SECURITY_NETWORK_XFRM
1296 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
1297 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1298 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1299 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
1300 void (*xfrm_state_free_security) (struct xfrm_state *x);
1301 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
1302#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1303
1242 /* key management security hooks */ 1304 /* key management security hooks */
1243#ifdef CONFIG_KEYS 1305#ifdef CONFIG_KEYS
1244 int (*key_alloc)(struct key *key); 1306 int (*key_alloc)(struct key *key);
@@ -2679,6 +2741,11 @@ static inline void security_sk_free(struct sock *sk)
2679{ 2741{
2680 return security_ops->sk_free_security(sk); 2742 return security_ops->sk_free_security(sk);
2681} 2743}
2744
2745static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2746{
2747 return security_ops->sk_getsid(sk, fl, dir);
2748}
2682#else /* CONFIG_SECURITY_NETWORK */ 2749#else /* CONFIG_SECURITY_NETWORK */
2683static inline int security_unix_stream_connect(struct socket * sock, 2750static inline int security_unix_stream_connect(struct socket * sock,
2684 struct socket * other, 2751 struct socket * other,
@@ -2795,8 +2862,73 @@ static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2795static inline void security_sk_free(struct sock *sk) 2862static inline void security_sk_free(struct sock *sk)
2796{ 2863{
2797} 2864}
2865
2866static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2867{
2868 return 0;
2869}
2798#endif /* CONFIG_SECURITY_NETWORK */ 2870#endif /* CONFIG_SECURITY_NETWORK */
2799 2871
2872#ifdef CONFIG_SECURITY_NETWORK_XFRM
2873static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2874{
2875 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
2876}
2877
2878static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2879{
2880 return security_ops->xfrm_policy_clone_security(old, new);
2881}
2882
2883static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2884{
2885 security_ops->xfrm_policy_free_security(xp);
2886}
2887
2888static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2889{
2890 return security_ops->xfrm_state_alloc_security(x, sec_ctx);
2891}
2892
2893static inline void security_xfrm_state_free(struct xfrm_state *x)
2894{
2895 security_ops->xfrm_state_free_security(x);
2896}
2897
2898static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2899{
2900 return security_ops->xfrm_policy_lookup(xp, sk_sid, dir);
2901}
2902#else /* CONFIG_SECURITY_NETWORK_XFRM */
2903static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2904{
2905 return 0;
2906}
2907
2908static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2909{
2910 return 0;
2911}
2912
2913static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2914{
2915}
2916
2917static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2918{
2919 return 0;
2920}
2921
2922static inline void security_xfrm_state_free(struct xfrm_state *x)
2923{
2924}
2925
2926static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2927{
2928 return 0;
2929}
2930#endif /* CONFIG_SECURITY_NETWORK_XFRM */
2931
2800#ifdef CONFIG_KEYS 2932#ifdef CONFIG_KEYS
2801#ifdef CONFIG_SECURITY 2933#ifdef CONFIG_SECURITY
2802static inline int security_key_alloc(struct key *key) 2934static inline int security_key_alloc(struct key *key)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8c5d6001a923..483cfc47ec34 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -32,7 +32,6 @@
32 32
33#define HAVE_ALLOC_SKB /* For the drivers to know */ 33#define HAVE_ALLOC_SKB /* For the drivers to know */
34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
35#define SLAB_SKB /* Slabified skbuffs */
36 35
37#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
38#define CHECKSUM_HW 1 37#define CHECKSUM_HW 1
@@ -134,7 +133,7 @@ struct skb_frag_struct {
134 */ 133 */
135struct skb_shared_info { 134struct skb_shared_info {
136 atomic_t dataref; 135 atomic_t dataref;
137 unsigned int nr_frags; 136 unsigned short nr_frags;
138 unsigned short tso_size; 137 unsigned short tso_size;
139 unsigned short tso_segs; 138 unsigned short tso_segs;
140 unsigned short ufo_size; 139 unsigned short ufo_size;
@@ -1239,6 +1238,8 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1239 int hlen, 1238 int hlen,
1240 struct iovec *iov); 1239 struct iovec *iov);
1241extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1240extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1241extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1242 unsigned int flags);
1242extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, 1243extern unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1243 int len, unsigned int csum); 1244 int len, unsigned int csum);
1244extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1245extern int skb_copy_bits(const struct sk_buff *skb, int offset,
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 1739c2d5b95b..9f4019156fd8 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -27,7 +27,6 @@ struct __kernel_sockaddr_storage {
27#include <linux/compiler.h> /* __user */ 27#include <linux/compiler.h> /* __user */
28 28
29extern int sysctl_somaxconn; 29extern int sysctl_somaxconn;
30extern void sock_init(void);
31#ifdef CONFIG_PROC_FS 30#ifdef CONFIG_PROC_FS
32struct seq_file; 31struct seq_file;
33extern void socket_seq_show(struct seq_file *seq); 32extern void socket_seq_show(struct seq_file *seq);
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 0e9682c9def5..799be6747944 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -59,8 +59,7 @@
59/* 59/*
60 * Must define these before including other files, inline functions need them 60 * Must define these before including other files, inline functions need them
61 */ 61 */
62#define LOCK_SECTION_NAME \ 62#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
63 ".text.lock." __stringify(KBUILD_BASENAME)
64 63
65#define LOCK_SECTION_START(extra) \ 64#define LOCK_SECTION_START(extra) \
66 ".subsection 1\n\t" \ 65 ".subsection 1\n\t" \
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 4be34ef8c2f7..a9b80fc7f0f3 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -124,7 +124,7 @@ enum
124 KERN_OVERFLOWUID=46, /* int: overflow UID */ 124 KERN_OVERFLOWUID=46, /* int: overflow UID */
125 KERN_OVERFLOWGID=47, /* int: overflow GID */ 125 KERN_OVERFLOWGID=47, /* int: overflow GID */
126 KERN_SHMPATH=48, /* string: path to shm fs */ 126 KERN_SHMPATH=48, /* string: path to shm fs */
127 KERN_HOTPLUG=49, /* string: path to hotplug policy agent */ 127 KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */
128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ 128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ 129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ 130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
@@ -390,6 +390,7 @@ enum
390 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, 390 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
391 NET_TCP_CONG_CONTROL=110, 391 NET_TCP_CONG_CONTROL=110,
392 NET_TCP_ABC=111, 392 NET_TCP_ABC=111,
393 NET_IPV4_IPFRAG_MAX_DIST=112,
393}; 394};
394 395
395enum { 396enum {
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e1da6602e05..f2bb2396853f 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -55,22 +55,6 @@ struct tcphdr {
55 __u16 urg_ptr; 55 __u16 urg_ptr;
56}; 56};
57 57
58#define TCP_ACTION_FIN (1 << 7)
59
60enum {
61 TCPF_ESTABLISHED = (1 << 1),
62 TCPF_SYN_SENT = (1 << 2),
63 TCPF_SYN_RECV = (1 << 3),
64 TCPF_FIN_WAIT1 = (1 << 4),
65 TCPF_FIN_WAIT2 = (1 << 5),
66 TCPF_TIME_WAIT = (1 << 6),
67 TCPF_CLOSE = (1 << 7),
68 TCPF_CLOSE_WAIT = (1 << 8),
69 TCPF_LAST_ACK = (1 << 9),
70 TCPF_LISTEN = (1 << 10),
71 TCPF_CLOSING = (1 << 11)
72};
73
74/* 58/*
75 * The union cast uses a gcc extension to avoid aliasing problems 59 * The union cast uses a gcc extension to avoid aliasing problems
76 * (union is compatible to any of its members) 60 * (union is compatible to any of its members)
@@ -254,10 +238,9 @@ struct tcp_sock {
254 __u32 snd_wl1; /* Sequence for window update */ 238 __u32 snd_wl1; /* Sequence for window update */
255 __u32 snd_wnd; /* The window we expect to receive */ 239 __u32 snd_wnd; /* The window we expect to receive */
256 __u32 max_window; /* Maximal window ever seen from peer */ 240 __u32 max_window; /* Maximal window ever seen from peer */
257 __u32 pmtu_cookie; /* Last pmtu seen by socket */
258 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 241 __u32 mss_cache; /* Cached effective mss, not including SACKS */
259 __u16 xmit_size_goal; /* Goal for segmenting output packets */ 242 __u16 xmit_size_goal; /* Goal for segmenting output packets */
260 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ 243 /* XXX Two bytes hole, try to pack */
261 244
262 __u32 window_clamp; /* Maximal window to advertise */ 245 __u32 window_clamp; /* Maximal window to advertise */
263 __u32 rcv_ssthresh; /* Current window clamp */ 246 __u32 rcv_ssthresh; /* Current window clamp */
@@ -295,8 +278,6 @@ struct tcp_sock {
295 278
296 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 279 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
297 280
298 struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */
299
300 __u32 rcv_wnd; /* Current receiver window */ 281 __u32 rcv_wnd; /* Current receiver window */
301 __u32 rcv_wup; /* rcv_nxt on last window update sent */ 282 __u32 rcv_wup; /* rcv_nxt on last window update sent */
302 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 283 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
index 46e2bb945353..36c684e1b110 100644
--- a/include/linux/udf_fs.h
+++ b/include/linux/udf_fs.h
@@ -13,11 +13,6 @@
13 * http://www.osta.org/ * http://www.ecma.ch/ 13 * http://www.osta.org/ * http://www.ecma.ch/
14 * http://www.iso.org/ 14 * http://www.iso.org/
15 * 15 *
16 * CONTACTS
17 * E-mail regarding any portion of the Linux UDF file system should be
18 * directed to the development team mailing list (run by majordomo):
19 * linux_udf@hpesjro.fc.hp.com
20 *
21 * COPYRIGHT 16 * COPYRIGHT
22 * This file is distributed under the terms of the GNU General Public 17 * This file is distributed under the terms of the GNU General Public
23 * License (GPL). Copies of the GPL can be obtained from: 18 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 62b15a4214e6..1e7508420fcf 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This file is intended for the Linux kernel/module. 4 * This file is intended for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index 1966a6dbb4b6..b15ff2e99c91 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This include file is for the Linux kernel/module. 4 * This include file is for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udp.h b/include/linux/udp.h
index b60e0b4a25c4..85a55658831c 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -35,10 +35,10 @@ struct udphdr {
35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ 35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
38
39#include <linux/config.h> 38#include <linux/config.h>
40#include <net/sock.h> 39#include <linux/types.h>
41#include <linux/ip.h> 40
41#include <net/inet_sock.h>
42 42
43struct udp_sock { 43struct udp_sock {
44 /* inet_sock has to be the first member */ 44 /* inet_sock has to be the first member */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d81b050e5955..827cc6de5f5c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -225,7 +225,7 @@ struct usb_interface_cache {
225 * Device drivers should not attempt to activate configurations. The choice 225 * Device drivers should not attempt to activate configurations. The choice
226 * of which configuration to install is a policy decision based on such 226 * of which configuration to install is a policy decision based on such
227 * considerations as available power, functionality provided, and the user's 227 * considerations as available power, functionality provided, and the user's
228 * desires (expressed through hotplug scripts). However, drivers can call 228 * desires (expressed through userspace tools). However, drivers can call
229 * usb_reset_configuration() to reinitialize the current configuration and 229 * usb_reset_configuration() to reinitialize the current configuration and
230 * all its interfaces. 230 * all its interfaces.
231 */ 231 */
@@ -329,8 +329,6 @@ struct usb_device {
329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */ 329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */
330 int ttport; /* device port on that tt hub */ 330 int ttport; /* device port on that tt hub */
331 331
332 struct semaphore serialize;
333
334 unsigned int toggle[2]; /* one bit for each endpoint 332 unsigned int toggle[2]; /* one bit for each endpoint
335 * ([0] = IN, [1] = OUT) */ 333 * ([0] = IN, [1] = OUT) */
336 334
@@ -349,6 +347,9 @@ struct usb_device {
349 347
350 char **rawdescriptors; /* Raw descriptors for each config */ 348 char **rawdescriptors; /* Raw descriptors for each config */
351 349
350 unsigned short bus_mA; /* Current available from the bus */
351 u8 portnum; /* Parent port number (origin 1) */
352
352 int have_langid; /* whether string_langid is valid */ 353 int have_langid; /* whether string_langid is valid */
353 int string_langid; /* language ID for strings */ 354 int string_langid; /* language ID for strings */
354 355
@@ -377,11 +378,12 @@ struct usb_device {
377extern struct usb_device *usb_get_dev(struct usb_device *dev); 378extern struct usb_device *usb_get_dev(struct usb_device *dev);
378extern void usb_put_dev(struct usb_device *dev); 379extern void usb_put_dev(struct usb_device *dev);
379 380
380extern void usb_lock_device(struct usb_device *udev); 381/* USB device locking */
381extern int usb_trylock_device(struct usb_device *udev); 382#define usb_lock_device(udev) down(&(udev)->dev.sem)
383#define usb_unlock_device(udev) up(&(udev)->dev.sem)
384#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
382extern int usb_lock_device_for_reset(struct usb_device *udev, 385extern int usb_lock_device_for_reset(struct usb_device *udev,
383 struct usb_interface *iface); 386 struct usb_interface *iface);
384extern void usb_unlock_device(struct usb_device *udev);
385 387
386/* USB port reset for device reinitialization */ 388/* USB port reset for device reinitialization */
387extern int usb_reset_device(struct usb_device *dev); 389extern int usb_reset_device(struct usb_device *dev);
@@ -529,10 +531,13 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
529 531
530/* ----------------------------------------------------------------------- */ 532/* ----------------------------------------------------------------------- */
531 533
534struct usb_dynids {
535 spinlock_t lock;
536 struct list_head list;
537};
538
532/** 539/**
533 * struct usb_driver - identifies USB driver to usbcore 540 * struct usb_driver - identifies USB driver to usbcore
534 * @owner: Pointer to the module owner of this driver; initialize
535 * it using THIS_MODULE.
536 * @name: The driver name should be unique among USB drivers, 541 * @name: The driver name should be unique among USB drivers,
537 * and should normally be the same as the module name. 542 * and should normally be the same as the module name.
538 * @probe: Called to see if the driver is willing to manage a particular 543 * @probe: Called to see if the driver is willing to manage a particular
@@ -553,7 +558,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
553 * @id_table: USB drivers use ID table to support hotplugging. 558 * @id_table: USB drivers use ID table to support hotplugging.
554 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 559 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
555 * or your driver's probe function will never get called. 560 * or your driver's probe function will never get called.
561 * @dynids: used internally to hold the list of dynamically added device
562 * ids for this driver.
556 * @driver: the driver model core driver structure. 563 * @driver: the driver model core driver structure.
564 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
565 * added to this driver by preventing the sysfs file from being created.
557 * 566 *
558 * USB drivers must provide a name, probe() and disconnect() methods, 567 * USB drivers must provide a name, probe() and disconnect() methods,
559 * and an id_table. Other driver fields are optional. 568 * and an id_table. Other driver fields are optional.
@@ -571,8 +580,6 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
571 * them as necessary, and blocking until the unlinks complete). 580 * them as necessary, and blocking until the unlinks complete).
572 */ 581 */
573struct usb_driver { 582struct usb_driver {
574 struct module *owner;
575
576 const char *name; 583 const char *name;
577 584
578 int (*probe) (struct usb_interface *intf, 585 int (*probe) (struct usb_interface *intf,
@@ -588,7 +595,9 @@ struct usb_driver {
588 595
589 const struct usb_device_id *id_table; 596 const struct usb_device_id *id_table;
590 597
598 struct usb_dynids dynids;
591 struct device_driver driver; 599 struct device_driver driver;
600 unsigned int no_dynamic_id:1;
592}; 601};
593#define to_usb_driver(d) container_of(d, struct usb_driver, driver) 602#define to_usb_driver(d) container_of(d, struct usb_driver, driver)
594 603
@@ -614,7 +623,11 @@ struct usb_class_driver {
614 * use these in module_init()/module_exit() 623 * use these in module_init()/module_exit()
615 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 624 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
616 */ 625 */
617extern int usb_register(struct usb_driver *); 626int usb_register_driver(struct usb_driver *, struct module *);
627static inline int usb_register(struct usb_driver *driver)
628{
629 return usb_register_driver(driver, THIS_MODULE);
630}
618extern void usb_deregister(struct usb_driver *); 631extern void usb_deregister(struct usb_driver *);
619 632
620extern int usb_register_dev(struct usb_interface *intf, 633extern int usb_register_dev(struct usb_interface *intf,
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
new file mode 100644
index 000000000000..b2d08984a9f7
--- /dev/null
+++ b/include/linux/usb_usual.h
@@ -0,0 +1,126 @@
1/*
2 * Interface to the libusual.
3 *
4 * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com>
5 * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
6 * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com)
7 */
8
9#ifndef __LINUX_USB_USUAL_H
10#define __LINUX_USB_USUAL_H
11
12#include <linux/config.h>
13
14/* We should do this for cleanliness... But other usb_foo.h do not do this. */
15/* #include <linux/usb.h> */
16
17/*
18 * The flags field, which we store in usb_device_id.driver_info.
19 * It is compatible with the old usb-storage flags in lower 24 bits.
20 */
21
22/*
23 * Static flag definitions. We use this roundabout technique so that the
24 * proc_info() routine can automatically display a message for each flag.
25 */
26#define US_DO_ALL_FLAGS \
27 US_FLAG(SINGLE_LUN, 0x00000001) \
28 /* allow access to only LUN 0 */ \
29 US_FLAG(NEED_OVERRIDE, 0x00000002) \
30 /* unusual_devs entry is necessary */ \
31 US_FLAG(SCM_MULT_TARG, 0x00000004) \
32 /* supports multiple targets */ \
33 US_FLAG(FIX_INQUIRY, 0x00000008) \
34 /* INQUIRY response needs faking */ \
35 US_FLAG(FIX_CAPACITY, 0x00000010) \
36 /* READ CAPACITY response too big */ \
37 US_FLAG(IGNORE_RESIDUE, 0x00000020) \
38 /* reported residue is wrong */ \
39 US_FLAG(BULK32, 0x00000040) \
40 /* Uses 32-byte CBW length */ \
41 US_FLAG(NOT_LOCKABLE, 0x00000080) \
42 /* PREVENT/ALLOW not supported */ \
43 US_FLAG(GO_SLOW, 0x00000100) \
44 /* Need delay after Command phase */ \
45 US_FLAG(NO_WP_DETECT, 0x00000200) \
46 /* Don't check for write-protect */ \
47
48#define US_FLAG(name, value) US_FL_##name = value ,
49enum { US_DO_ALL_FLAGS };
50#undef US_FLAG
51
52/*
53 * The bias field for libusual and friends.
54 */
55#define USB_US_TYPE_NONE 0
56#define USB_US_TYPE_STOR 1 /* usb-storage */
57#define USB_US_TYPE_UB 2 /* ub */
58
59#define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
60#define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
61
62/*
63 * This is probably not the best place to keep these constants, conceptually.
64 * But it's the only header included into all places which need them.
65 */
66
67/* Sub Classes */
68
69#define US_SC_RBC 0x01 /* Typically, flash devices */
70#define US_SC_8020 0x02 /* CD-ROM */
71#define US_SC_QIC 0x03 /* QIC-157 Tapes */
72#define US_SC_UFI 0x04 /* Floppy */
73#define US_SC_8070 0x05 /* Removable media */
74#define US_SC_SCSI 0x06 /* Transparent */
75#define US_SC_ISD200 0x07 /* ISD200 ATA */
76#define US_SC_MIN US_SC_RBC
77#define US_SC_MAX US_SC_ISD200
78
79#define US_SC_DEVICE 0xff /* Use device's value */
80
81/* Protocols */
82
83#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
84#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
85#define US_PR_BULK 0x50 /* bulk only */
86#ifdef CONFIG_USB_STORAGE_USBAT
87#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
88#endif
89#ifdef CONFIG_USB_STORAGE_SDDR09
90#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
91#endif
92#ifdef CONFIG_USB_STORAGE_SDDR55
93#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
94#endif
95#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
96#ifdef CONFIG_USB_STORAGE_FREECOM
97#define US_PR_FREECOM 0xf1 /* Freecom */
98#endif
99#ifdef CONFIG_USB_STORAGE_DATAFAB
100#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
101#endif
102#ifdef CONFIG_USB_STORAGE_JUMPSHOT
103#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
104#endif
105#ifdef CONFIG_USB_STORAGE_ALAUDA
106#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
107#endif
108
109#define US_PR_DEVICE 0xff /* Use device's value */
110
111/*
112 */
113#ifdef CONFIG_USB_LIBUSUAL
114
115extern struct usb_device_id storage_usb_ids[];
116extern void usb_usual_set_present(int type);
117extern void usb_usual_clear_present(int type);
118extern int usb_usual_check_type(const struct usb_device_id *, int type);
119#else
120
121#define usb_usual_set_present(t) do { } while(0)
122#define usb_usual_clear_present(t) do { } while(0)
123#define usb_usual_check_type(id, t) (0)
124#endif /* CONFIG_USB_LIBUSUAL */
125
126#endif /* __LINUX_USB_USUAL_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 0fb077d68441..82fbb758e28f 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -27,6 +27,22 @@ struct xfrm_id
27 __u8 proto; 27 __u8 proto;
28}; 28};
29 29
30struct xfrm_sec_ctx {
31 __u8 ctx_doi;
32 __u8 ctx_alg;
33 __u16 ctx_len;
34 __u32 ctx_sid;
35 char ctx_str[0];
36};
37
38/* Security Context Domains of Interpretation */
39#define XFRM_SC_DOI_RESERVED 0
40#define XFRM_SC_DOI_LSM 1
41
42/* Security Context Algorithms */
43#define XFRM_SC_ALG_RESERVED 0
44#define XFRM_SC_ALG_SELINUX 1
45
30/* Selector, used as selector both on policy rules (SPD) and SAs. */ 46/* Selector, used as selector both on policy rules (SPD) and SAs. */
31 47
32struct xfrm_selector 48struct xfrm_selector
@@ -146,6 +162,18 @@ enum {
146 162
147#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) 163#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)
148 164
165/*
166 * Generic LSM security context for comunicating to user space
167 * NOTE: Same format as sadb_x_sec_ctx
168 */
169struct xfrm_user_sec_ctx {
170 __u16 len;
171 __u16 exttype;
172 __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */
173 __u8 ctx_doi;
174 __u16 ctx_len;
175};
176
149struct xfrm_user_tmpl { 177struct xfrm_user_tmpl {
150 struct xfrm_id id; 178 struct xfrm_id id;
151 __u16 family; 179 __u16 family;
@@ -176,6 +204,7 @@ enum xfrm_attr_type_t {
176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 204 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
177 XFRMA_SA, 205 XFRMA_SA,
178 XFRMA_POLICY, 206 XFRMA_POLICY,
207 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
179 __XFRMA_MAX 208 __XFRMA_MAX
180 209
181#define XFRMA_MAX (__XFRMA_MAX - 1) 210#define XFRMA_MAX (__XFRMA_MAX - 1)
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index b5d785ab4a0e..bfc1779fc753 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -13,7 +13,7 @@ extern void unix_gc(void);
13#define UNIX_HASH_SIZE 256 13#define UNIX_HASH_SIZE 256
14 14
15extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; 15extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
16extern rwlock_t unix_table_lock; 16extern spinlock_t unix_table_lock;
17 17
18extern atomic_t unix_tot_inflight; 18extern atomic_t unix_tot_inflight;
19 19
@@ -58,10 +58,10 @@ struct unix_skb_parms {
58#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 58#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
59#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 59#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
60 60
61#define unix_state_rlock(s) read_lock(&unix_sk(s)->lock) 61#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
62#define unix_state_runlock(s) read_unlock(&unix_sk(s)->lock) 62#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
63#define unix_state_wlock(s) write_lock(&unix_sk(s)->lock) 63#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock)
64#define unix_state_wunlock(s) write_unlock(&unix_sk(s)->lock) 64#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock)
65 65
66#ifdef __KERNEL__ 66#ifdef __KERNEL__
67/* The AF_UNIX socket */ 67/* The AF_UNIX socket */
@@ -76,7 +76,7 @@ struct unix_sock {
76 struct sock *other; 76 struct sock *other;
77 struct sock *gc_tree; 77 struct sock *gc_tree;
78 atomic_t inflight; 78 atomic_t inflight;
79 rwlock_t lock; 79 spinlock_t lock;
80 wait_queue_head_t peer_wait; 80 wait_queue_head_t peer_wait;
81}; 81};
82#define unix_sk(__sk) ((struct unix_sock *)__sk) 82#define unix_sk(__sk) ((struct unix_sock *)__sk)
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 47048b1d179a..90fcc98e676f 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -7,7 +7,6 @@
7#define _ATMCLIP_H 7#define _ATMCLIP_H
8 8
9#include <linux/netdevice.h> 9#include <linux/netdevice.h>
10#include <linux/skbuff.h>
11#include <linux/atm.h> 10#include <linux/atm.h>
12#include <linux/atmdev.h> 11#include <linux/atmdev.h>
13#include <linux/atmarp.h> 12#include <linux/atmarp.h>
@@ -18,6 +17,7 @@
18#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back)) 17#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back))
19#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key) 18#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key)
20 19
20struct sk_buff;
21 21
22struct clip_vcc { 22struct clip_vcc {
23 struct atm_vcc *vcc; /* VCC descriptor */ 23 struct atm_vcc *vcc; /* VCC descriptor */
diff --git a/include/net/dst.h b/include/net/dst.h
index 6c196a5baf24..bee8b84d329d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -9,6 +9,7 @@
9#define _NET_DST_H 9#define _NET_DST_H
10 10
11#include <linux/config.h> 11#include <linux/config.h>
12#include <linux/netdevice.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
14#include <linux/jiffies.h> 15#include <linux/jiffies.h>
diff --git a/include/net/flow.h b/include/net/flow.h
index 9a5c94b1a0ec..ec7eb86eb203 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -84,11 +84,12 @@ struct flowi {
84#define FLOW_DIR_OUT 1 84#define FLOW_DIR_OUT 1
85#define FLOW_DIR_FWD 2 85#define FLOW_DIR_FWD 2
86 86
87typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, 87struct sock;
88typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir,
88 void **objp, atomic_t **obj_refp); 89 void **objp, atomic_t **obj_refp);
89 90
90extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, 91extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir,
91 flow_resolve_t resolver); 92 flow_resolve_t resolver);
92extern void flow_cache_flush(void); 93extern void flow_cache_flush(void);
93extern atomic_t flow_cache_genid; 94extern atomic_t flow_cache_genid;
94 95
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 52d8b1a73d52..c5b96b2b8155 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -60,7 +60,7 @@ struct genl_info
60 */ 60 */
61struct genl_ops 61struct genl_ops
62{ 62{
63 unsigned int cmd; 63 u8 cmd;
64 unsigned int flags; 64 unsigned int flags;
65 struct nla_policy *policy; 65 struct nla_policy *policy;
66 int (*doit)(struct sk_buff *skb, 66 int (*doit)(struct sk_buff *skb,
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 6cdebeee5f96..e7c3f20fbafc 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -20,12 +20,9 @@
20 20
21#include <linux/config.h> 21#include <linux/config.h>
22#include <linux/icmp.h> 22#include <linux/icmp.h>
23#include <linux/skbuff.h>
24 23
25#include <net/sock.h> 24#include <net/inet_sock.h>
26#include <net/protocol.h>
27#include <net/snmp.h> 25#include <net/snmp.h>
28#include <linux/ip.h>
29 26
30struct icmp_err { 27struct icmp_err {
31 int errno; 28 int errno;
@@ -38,6 +35,10 @@ DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics);
38#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) 35#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field)
39#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) 36#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field)
40 37
38struct dst_entry;
39struct net_proto_family;
40struct sk_buff;
41
41extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info);
42extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
43extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); 44extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index 225fc751d464..03b766afdc39 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -23,12 +23,17 @@
23#ifndef IEEE80211_CRYPT_H 23#ifndef IEEE80211_CRYPT_H
24#define IEEE80211_CRYPT_H 24#define IEEE80211_CRYPT_H
25 25
26#include <linux/skbuff.h> 26#include <linux/types.h>
27#include <linux/list.h>
28#include <asm/atomic.h>
27 29
28enum { 30enum {
29 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), 31 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
30}; 32};
31 33
34struct sk_buff;
35struct module;
36
32struct ieee80211_crypto_ops { 37struct ieee80211_crypto_ops {
33 const char *name; 38 const char *name;
34 struct list_head list; 39 struct list_head list;
@@ -87,6 +92,8 @@ struct ieee80211_crypt_data {
87 atomic_t refcnt; 92 atomic_t refcnt;
88}; 93};
89 94
95struct ieee80211_device;
96
90int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 97int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
91int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 98int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
92struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); 99struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
new file mode 100644
index 000000000000..b33b438bffcc
--- /dev/null
+++ b/include/net/inet6_connection_sock.h
@@ -0,0 +1,42 @@
1/*
2 * NET Generic infrastructure for INET6 connection oriented protocols.
3 *
4 * Authors: Many people, see the TCPv6 sources
5 *
6 * From code originally in TCPv6
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef _INET6_CONNECTION_SOCK_H
14#define _INET6_CONNECTION_SOCK_H
15
16#include <linux/types.h>
17
18struct in6_addr;
19struct inet_bind_bucket;
20struct request_sock;
21struct sk_buff;
22struct sock;
23struct sockaddr;
24
25extern int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb);
27
28extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
29 struct request_sock ***prevp,
30 const __u16 rport,
31 const struct in6_addr *raddr,
32 const struct in6_addr *laddr,
33 const int iif);
34
35extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
36 struct request_sock *req,
37 const unsigned long timeout);
38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok);
42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 5a2beed5a770..25f708ff020e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -48,6 +48,32 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
48 return inet6_ehashfn(laddr, lport, faddr, fport); 48 return inet6_ehashfn(laddr, lport, faddr, fport);
49} 49}
50 50
51static inline void __inet6_hash(struct inet_hashinfo *hashinfo,
52 struct sock *sk)
53{
54 struct hlist_head *list;
55 rwlock_t *lock;
56
57 BUG_TRAP(sk_unhashed(sk));
58
59 if (sk->sk_state == TCP_LISTEN) {
60 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
61 lock = &hashinfo->lhash_lock;
62 inet_listen_wlock(hashinfo);
63 } else {
64 unsigned int hash;
65 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
66 hash &= (hashinfo->ehash_size - 1);
67 list = &hashinfo->ehash[hash].chain;
68 lock = &hashinfo->ehash[hash].lock;
69 write_lock(lock);
70 }
71
72 __sk_add_node(sk, list);
73 sock_prot_inc_use(sk->sk_prot);
74 write_unlock(lock);
75}
76
51/* 77/*
52 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 78 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
53 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM 79 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM
@@ -84,10 +110,10 @@ static inline struct sock *
84 110
85 if(*((__u32 *)&(tw->tw_dport)) == ports && 111 if(*((__u32 *)&(tw->tw_dport)) == ports &&
86 sk->sk_family == PF_INET6) { 112 sk->sk_family == PF_INET6) {
87 const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); 113 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
88 114
89 if (ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) && 115 if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
90 ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) && 116 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
91 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) 117 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
92 goto hit; 118 goto hit;
93 } 119 }
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index f943306ce5ff..227adcbdfec8 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -1,8 +1,8 @@
1#ifndef _INET_COMMON_H 1#ifndef _INET_COMMON_H
2#define _INET_COMMON_H 2#define _INET_COMMON_H
3 3
4extern struct proto_ops inet_stream_ops; 4extern const struct proto_ops inet_stream_ops;
5extern struct proto_ops inet_dgram_ops; 5extern const struct proto_ops inet_dgram_ops;
6 6
7/* 7/*
8 * INET4 prototypes used by INET6 8 * INET4 prototypes used by INET6
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b0c99060b78d..50234fa56a68 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -15,9 +15,11 @@
15#ifndef _INET_CONNECTION_SOCK_H 15#ifndef _INET_CONNECTION_SOCK_H
16#define _INET_CONNECTION_SOCK_H 16#define _INET_CONNECTION_SOCK_H
17 17
18#include <linux/ip.h> 18#include <linux/compiler.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/timer.h> 20#include <linux/timer.h>
21
22#include <net/inet_sock.h>
21#include <net/request_sock.h> 23#include <net/request_sock.h>
22 24
23#define INET_CSK_DEBUG 1 25#define INET_CSK_DEBUG 1
@@ -29,6 +31,29 @@ struct inet_bind_bucket;
29struct inet_hashinfo; 31struct inet_hashinfo;
30struct tcp_congestion_ops; 32struct tcp_congestion_ops;
31 33
34/*
35 * Pointers to address related TCP functions
36 * (i.e. things that depend on the address family)
37 */
38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok);
40 void (*send_check)(struct sock *sk, int len,
41 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk);
43 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
44 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
45 struct request_sock *req,
46 struct dst_entry *dst);
47 int (*remember_stamp)(struct sock *sk);
48 __u16 net_header_len;
49 int (*setsockopt)(struct sock *sk, int level, int optname,
50 char __user *optval, int optlen);
51 int (*getsockopt)(struct sock *sk, int level, int optname,
52 char __user *optval, int __user *optlen);
53 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
54 int sockaddr_len;
55};
56
32/** inet_connection_sock - INET connection oriented sock 57/** inet_connection_sock - INET connection oriented sock
33 * 58 *
34 * @icsk_accept_queue: FIFO of established children 59 * @icsk_accept_queue: FIFO of established children
@@ -36,13 +61,16 @@ struct tcp_congestion_ops;
36 * @icsk_timeout: Timeout 61 * @icsk_timeout: Timeout
37 * @icsk_retransmit_timer: Resend (no ack) 62 * @icsk_retransmit_timer: Resend (no ack)
38 * @icsk_rto: Retransmit timeout 63 * @icsk_rto: Retransmit timeout
64 * @icsk_pmtu_cookie Last pmtu seen by socket
39 * @icsk_ca_ops Pluggable congestion control hook 65 * @icsk_ca_ops Pluggable congestion control hook
66 * @icsk_af_ops Operations which are AF_INET{4,6} specific
40 * @icsk_ca_state: Congestion control state 67 * @icsk_ca_state: Congestion control state
41 * @icsk_retransmits: Number of unrecovered [RTO] timeouts 68 * @icsk_retransmits: Number of unrecovered [RTO] timeouts
42 * @icsk_pending: Scheduled timer event 69 * @icsk_pending: Scheduled timer event
43 * @icsk_backoff: Backoff 70 * @icsk_backoff: Backoff
44 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries 71 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries
45 * @icsk_probes_out: unanswered 0 window probes 72 * @icsk_probes_out: unanswered 0 window probes
73 * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options)
46 * @icsk_ack: Delayed ACK control data 74 * @icsk_ack: Delayed ACK control data
47 */ 75 */
48struct inet_connection_sock { 76struct inet_connection_sock {
@@ -54,14 +82,17 @@ struct inet_connection_sock {
54 struct timer_list icsk_retransmit_timer; 82 struct timer_list icsk_retransmit_timer;
55 struct timer_list icsk_delack_timer; 83 struct timer_list icsk_delack_timer;
56 __u32 icsk_rto; 84 __u32 icsk_rto;
85 __u32 icsk_pmtu_cookie;
57 struct tcp_congestion_ops *icsk_ca_ops; 86 struct tcp_congestion_ops *icsk_ca_ops;
87 struct inet_connection_sock_af_ops *icsk_af_ops;
88 unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
58 __u8 icsk_ca_state; 89 __u8 icsk_ca_state;
59 __u8 icsk_retransmits; 90 __u8 icsk_retransmits;
60 __u8 icsk_pending; 91 __u8 icsk_pending;
61 __u8 icsk_backoff; 92 __u8 icsk_backoff;
62 __u8 icsk_syn_retries; 93 __u8 icsk_syn_retries;
63 __u8 icsk_probes_out; 94 __u8 icsk_probes_out;
64 /* 2 BYTES HOLE, TRY TO PACK! */ 95 __u16 icsk_ext_hdr_len;
65 struct { 96 struct {
66 __u8 pending; /* ACK is pending */ 97 __u8 pending; /* ACK is pending */
67 __u8 quick; /* Scheduled number of quick acks */ 98 __u8 quick; /* Scheduled number of quick acks */
@@ -192,8 +223,12 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
192 const __u16 rport, 223 const __u16 rport,
193 const __u32 raddr, 224 const __u32 raddr,
194 const __u32 laddr); 225 const __u32 laddr);
226extern int inet_csk_bind_conflict(const struct sock *sk,
227 const struct inet_bind_bucket *tb);
195extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, 228extern int inet_csk_get_port(struct inet_hashinfo *hashinfo,
196 struct sock *sk, unsigned short snum); 229 struct sock *sk, unsigned short snum,
230 int (*bind_conflict)(const struct sock *sk,
231 const struct inet_bind_bucket *tb));
197 232
198extern struct dst_entry* inet_csk_route_req(struct sock *sk, 233extern struct dst_entry* inet_csk_route_req(struct sock *sk,
199 const struct request_sock *req); 234 const struct request_sock *req);
@@ -207,7 +242,7 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk,
207 242
208extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, 243extern void inet_csk_reqsk_queue_hash_add(struct sock *sk,
209 struct request_sock *req, 244 struct request_sock *req,
210 const unsigned timeout); 245 unsigned long timeout);
211 246
212static inline void inet_csk_reqsk_queue_removed(struct sock *sk, 247static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
213 struct request_sock *req) 248 struct request_sock *req)
@@ -273,4 +308,6 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
273extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); 308extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
274extern void inet_csk_listen_stop(struct sock *sk); 309extern void inet_csk_listen_stop(struct sock *sk);
275 310
311extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
312
276#endif /* _INET_CONNECTION_SOCK_H */ 313#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index b0c47e2eccf1..d599c6bfbb86 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/ip.h> 4#include <linux/ip.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6
7#include <net/inet_sock.h>
6#include <net/dsfield.h> 8#include <net/dsfield.h>
7 9
8enum { 10enum {
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 07840baa9341..135d80fd658e 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -26,6 +26,7 @@
26#include <linux/wait.h> 26#include <linux/wait.h>
27 27
28#include <net/inet_connection_sock.h> 28#include <net/inet_connection_sock.h>
29#include <net/inet_sock.h>
29#include <net/route.h> 30#include <net/route.h>
30#include <net/sock.h> 31#include <net/sock.h>
31#include <net/tcp_states.h> 32#include <net/tcp_states.h>
@@ -128,26 +129,6 @@ struct inet_hashinfo {
128 kmem_cache_t *bind_bucket_cachep; 129 kmem_cache_t *bind_bucket_cachep;
129}; 130};
130 131
131static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
132 const __u32 faddr, const __u16 fport)
133{
134 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
135 h ^= h >> 16;
136 h ^= h >> 8;
137 return h;
138}
139
140static inline int inet_sk_ehashfn(const struct sock *sk)
141{
142 const struct inet_sock *inet = inet_sk(sk);
143 const __u32 laddr = inet->rcv_saddr;
144 const __u16 lport = inet->num;
145 const __u32 faddr = inet->daddr;
146 const __u16 fport = inet->dport;
147
148 return inet_ehashfn(laddr, lport, faddr, fport);
149}
150
151static inline struct inet_ehash_bucket *inet_ehash_bucket( 132static inline struct inet_ehash_bucket *inet_ehash_bucket(
152 struct inet_hashinfo *hashinfo, 133 struct inet_hashinfo *hashinfo,
153 unsigned int hash) 134 unsigned int hash)
@@ -434,4 +415,7 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
434 415
435 return sk; 416 return sk;
436} 417}
418
419extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
420 struct sock *sk);
437#endif /* _INET_HASHTABLES_H */ 421#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
new file mode 100644
index 000000000000..883eb529ef8e
--- /dev/null
+++ b/include/net/inet_sock.h
@@ -0,0 +1,193 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for inet_sock
7 *
8 * Authors: Many, reorganised here by
9 * Arnaldo Carvalho de Melo <acme@mandriva.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#ifndef _INET_SOCK_H
17#define _INET_SOCK_H
18
19#include <linux/config.h>
20
21#include <linux/string.h>
22#include <linux/types.h>
23
24#include <net/flow.h>
25#include <net/sock.h>
26#include <net/request_sock.h>
27
28/** struct ip_options - IP Options
29 *
30 * @faddr - Saved first hop address
31 * @is_setbyuser - Set by setsockopt?
32 * @is_data - Options in __data, rather than skb
33 * @is_strictroute - Strict source route
34 * @srr_is_hit - Packet destination addr was our one
35 * @is_changed - IP checksum more not valid
36 * @rr_needaddr - Need to record addr of outgoing dev
37 * @ts_needtime - Need to record timestamp
38 * @ts_needaddr - Need to record addr of outgoing dev
39 */
40struct ip_options {
41 __u32 faddr;
42 unsigned char optlen;
43 unsigned char srr;
44 unsigned char rr;
45 unsigned char ts;
46 unsigned char is_setbyuser:1,
47 is_data:1,
48 is_strictroute:1,
49 srr_is_hit:1,
50 is_changed:1,
51 rr_needaddr:1,
52 ts_needtime:1,
53 ts_needaddr:1;
54 unsigned char router_alert;
55 unsigned char __pad1;
56 unsigned char __pad2;
57 unsigned char __data[0];
58};
59
60#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
61
62struct inet_request_sock {
63 struct request_sock req;
64#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
65 u16 inet6_rsk_offset;
66 /* 2 bytes hole, try to pack */
67#endif
68 u32 loc_addr;
69 u32 rmt_addr;
70 u16 rmt_port;
71 u16 snd_wscale : 4,
72 rcv_wscale : 4,
73 tstamp_ok : 1,
74 sack_ok : 1,
75 wscale_ok : 1,
76 ecn_ok : 1,
77 acked : 1;
78 struct ip_options *opt;
79};
80
81static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
82{
83 return (struct inet_request_sock *)sk;
84}
85
86struct ip_mc_socklist;
87struct ipv6_pinfo;
88struct rtable;
89
90/** struct inet_sock - representation of INET sockets
91 *
92 * @sk - ancestor class
93 * @pinet6 - pointer to IPv6 control block
94 * @daddr - Foreign IPv4 addr
95 * @rcv_saddr - Bound local IPv4 addr
96 * @dport - Destination port
97 * @num - Local port
98 * @saddr - Sending source
99 * @uc_ttl - Unicast TTL
100 * @sport - Source port
101 * @id - ID counter for DF pkts
102 * @tos - TOS
103 * @mc_ttl - Multicasting TTL
104 * @is_icsk - is this an inet_connection_sock?
105 * @mc_index - Multicast device index
106 * @mc_list - Group array
107 * @cork - info to build ip hdr on each ip frag while socket is corked
108 */
109struct inet_sock {
110 /* sk and pinet6 has to be the first two members of inet_sock */
111 struct sock sk;
112#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
113 struct ipv6_pinfo *pinet6;
114#endif
115 /* Socket demultiplex comparisons on incoming packets. */
116 __u32 daddr;
117 __u32 rcv_saddr;
118 __u16 dport;
119 __u16 num;
120 __u32 saddr;
121 __s16 uc_ttl;
122 __u16 cmsg_flags;
123 struct ip_options *opt;
124 __u16 sport;
125 __u16 id;
126 __u8 tos;
127 __u8 mc_ttl;
128 __u8 pmtudisc;
129 __u8 recverr:1,
130 is_icsk:1,
131 freebind:1,
132 hdrincl:1,
133 mc_loop:1;
134 int mc_index;
135 __u32 mc_addr;
136 struct ip_mc_socklist *mc_list;
137 struct {
138 unsigned int flags;
139 unsigned int fragsize;
140 struct ip_options *opt;
141 struct rtable *rt;
142 int length; /* Total length of all frames */
143 u32 addr;
144 struct flowi fl;
145 } cork;
146};
147
148#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
149#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */
150
151static inline struct inet_sock *inet_sk(const struct sock *sk)
152{
153 return (struct inet_sock *)sk;
154}
155
156static inline void __inet_sk_copy_descendant(struct sock *sk_to,
157 const struct sock *sk_from,
158 const int ancestor_size)
159{
160 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
161 sk_from->sk_prot->obj_size - ancestor_size);
162}
163#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
164static inline void inet_sk_copy_descendant(struct sock *sk_to,
165 const struct sock *sk_from)
166{
167 __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock));
168}
169#endif
170
171extern int inet_sk_rebuild_header(struct sock *sk);
172
173static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
174 const __u32 faddr, const __u16 fport)
175{
176 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
177 h ^= h >> 16;
178 h ^= h >> 8;
179 return h;
180}
181
182static inline int inet_sk_ehashfn(const struct sock *sk)
183{
184 const struct inet_sock *inet = inet_sk(sk);
185 const __u32 laddr = inet->rcv_saddr;
186 const __u16 lport = inet->num;
187 const __u32 faddr = inet->daddr;
188 const __u16 fport = inet->dport;
189
190 return inet_ehashfn(laddr, lport, faddr, fport);
191}
192
193#endif /* _INET_SOCK_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 28f7b2103505..1da294c47522 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -17,15 +17,16 @@
17 17
18#include <linux/config.h> 18#include <linux/config.h>
19 19
20#include <linux/ip.h>
21#include <linux/list.h> 20#include <linux/list.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/timer.h> 22#include <linux/timer.h>
24#include <linux/types.h> 23#include <linux/types.h>
25#include <linux/workqueue.h> 24#include <linux/workqueue.h>
26 25
26#include <net/inet_sock.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/tcp_states.h> 28#include <net/tcp_states.h>
29#include <net/timewait_sock.h>
29 30
30#include <asm/atomic.h> 31#include <asm/atomic.h>
31 32
@@ -127,7 +128,8 @@ struct inet_timewait_sock {
127 __u16 tw_num; 128 __u16 tw_num;
128 /* And these are ours. */ 129 /* And these are ours. */
129 __u8 tw_ipv6only:1; 130 __u8 tw_ipv6only:1;
130 /* 31 bits hole, try to pack */ 131 /* 15 bits hole, try to pack */
132 __u16 tw_ipv6_offset;
131 int tw_timeout; 133 int tw_timeout;
132 unsigned long tw_ttd; 134 unsigned long tw_ttd;
133 struct inet_bind_bucket *tw_tb; 135 struct inet_bind_bucket *tw_tb;
@@ -199,7 +201,7 @@ static inline void inet_twsk_put(struct inet_timewait_sock *tw)
199 printk(KERN_DEBUG "%s timewait_sock %p released\n", 201 printk(KERN_DEBUG "%s timewait_sock %p released\n",
200 tw->tw_prot->name, tw); 202 tw->tw_prot->name, tw);
201#endif 203#endif
202 kmem_cache_free(tw->tw_prot->twsk_slab, tw); 204 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
203 module_put(owner); 205 module_put(owner);
204 } 206 }
205} 207}
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 7fda471002b6..0965515f40cf 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -25,6 +25,7 @@ struct inet_peer
25 __u32 v4daddr; /* peer's address */ 25 __u32 v4daddr; /* peer's address */
26 __u16 avl_height; 26 __u16 avl_height;
27 __u16 ip_id_count; /* IP ID for the next packet */ 27 __u16 ip_id_count; /* IP ID for the next packet */
28 atomic_t rid; /* Frag reception counter */
28 __u32 tcp_ts; 29 __u32 tcp_ts;
29 unsigned long tcp_ts_stamp; 30 unsigned long tcp_ts_stamp;
30}; 31};
diff --git a/include/net/ip.h b/include/net/ip.h
index e4563bbee6ea..f7e7fd728b67 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -24,14 +24,10 @@
24 24
25#include <linux/config.h> 25#include <linux/config.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/socket.h>
28#include <linux/ip.h> 27#include <linux/ip.h>
29#include <linux/in.h> 28#include <linux/in.h>
30#include <linux/netdevice.h> 29
31#include <linux/inetdevice.h> 30#include <net/inet_sock.h>
32#include <linux/in_route.h>
33#include <net/route.h>
34#include <net/arp.h>
35#include <net/snmp.h> 31#include <net/snmp.h>
36 32
37struct sock; 33struct sock;
@@ -45,6 +41,7 @@ struct inet_skb_parm
45#define IPSKB_TRANSLATED 2 41#define IPSKB_TRANSLATED 2
46#define IPSKB_FORWARDED 4 42#define IPSKB_FORWARDED 4
47#define IPSKB_XFRM_TUNNEL_SIZE 8 43#define IPSKB_XFRM_TUNNEL_SIZE 8
44#define IPSKB_FRAG_COMPLETE 16
48}; 45};
49 46
50struct ipcm_cookie 47struct ipcm_cookie
@@ -74,6 +71,13 @@ extern rwlock_t ip_ra_lock;
74 71
75#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ 72#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */
76 73
74struct msghdr;
75struct net_device;
76struct packet_type;
77struct rtable;
78struct sk_buff;
79struct sockaddr;
80
77extern void ip_mc_dropsocket(struct sock *); 81extern void ip_mc_dropsocket(struct sock *);
78extern void ip_mc_dropdevice(struct net_device *dev); 82extern void ip_mc_dropdevice(struct net_device *dev);
79extern int igmp_mc_proc_init(void); 83extern int igmp_mc_proc_init(void);
@@ -168,6 +172,7 @@ extern int sysctl_ipfrag_high_thresh;
168extern int sysctl_ipfrag_low_thresh; 172extern int sysctl_ipfrag_low_thresh;
169extern int sysctl_ipfrag_time; 173extern int sysctl_ipfrag_time;
170extern int sysctl_ipfrag_secret_interval; 174extern int sysctl_ipfrag_secret_interval;
175extern int sysctl_ipfrag_max_dist;
171 176
172/* From inetpeer.c */ 177/* From inetpeer.c */
173extern int inet_peer_threshold; 178extern int inet_peer_threshold;
@@ -182,6 +187,8 @@ extern int sysctl_ip_dynaddr;
182extern void ipfrag_init(void); 187extern void ipfrag_init(void);
183 188
184#ifdef CONFIG_INET 189#ifdef CONFIG_INET
190#include <net/dst.h>
191
185/* The function in 2.2 was invalid, producing wrong result for 192/* The function in 2.2 was invalid, producing wrong result for
186 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ 193 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */
187static inline 194static inline
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 14de4ebd1211..e000fa2cd5f6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -238,6 +238,8 @@ extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif,
238 struct net_device *dev, u32 *spec_dst, u32 *itag); 238 struct net_device *dev, u32 *spec_dst, u32 *itag);
239extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 239extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
240 240
241struct rtentry;
242
241/* Exported by fib_semantics.c */ 243/* Exported by fib_semantics.c */
242extern int ip_fib_check_default(u32 gw, struct net_device *dev); 244extern int ip_fib_check_default(u32 gw, struct net_device *dev);
243extern int fib_sync_down(u32 local, struct net_device *dev, int force); 245extern int fib_sync_down(u32 local, struct net_device *dev, int force);
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 3b5559a023a4..7d2674fde19a 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -251,16 +251,15 @@ struct ip_vs_daemon_user {
251#include <linux/config.h> 251#include <linux/config.h>
252#include <linux/list.h> /* for struct list_head */ 252#include <linux/list.h> /* for struct list_head */
253#include <linux/spinlock.h> /* for struct rwlock_t */ 253#include <linux/spinlock.h> /* for struct rwlock_t */
254#include <linux/skbuff.h> /* for struct sk_buff */
255#include <linux/ip.h> /* for struct iphdr */
256#include <asm/atomic.h> /* for struct atomic_t */ 254#include <asm/atomic.h> /* for struct atomic_t */
257#include <linux/netdevice.h> /* for struct neighbour */
258#include <net/dst.h> /* for struct dst_entry */
259#include <net/udp.h>
260#include <linux/compiler.h> 255#include <linux/compiler.h>
256#include <linux/timer.h>
261 257
258#include <net/checksum.h>
262 259
263#ifdef CONFIG_IP_VS_DEBUG 260#ifdef CONFIG_IP_VS_DEBUG
261#include <linux/net.h>
262
264extern int ip_vs_get_debug_level(void); 263extern int ip_vs_get_debug_level(void);
265#define IP_VS_DBG(level, msg...) \ 264#define IP_VS_DBG(level, msg...) \
266 do { \ 265 do { \
@@ -429,8 +428,11 @@ struct ip_vs_stats
429 spinlock_t lock; /* spin lock */ 428 spinlock_t lock; /* spin lock */
430}; 429};
431 430
431struct dst_entry;
432struct iphdr;
432struct ip_vs_conn; 433struct ip_vs_conn;
433struct ip_vs_app; 434struct ip_vs_app;
435struct sk_buff;
434 436
435struct ip_vs_protocol { 437struct ip_vs_protocol {
436 struct ip_vs_protocol *next; 438 struct ip_vs_protocol *next;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 0a2ad51cff82..860bbac4c4ee 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -240,6 +240,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
241 struct ipv6_txoptions *opt); 241 struct ipv6_txoptions *opt);
242 242
243extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
244
243extern int ip6_frag_nqueues; 245extern int ip6_frag_nqueues;
244extern atomic_t ip6_frag_mem; 246extern atomic_t ip6_frag_mem;
245 247
@@ -525,6 +527,9 @@ extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
525extern int inet6_ioctl(struct socket *sock, unsigned int cmd, 527extern int inet6_ioctl(struct socket *sock, unsigned int cmd,
526 unsigned long arg); 528 unsigned long arg);
527 529
530extern int inet6_hash_connect(struct inet_timewait_death_row *death_row,
531 struct sock *sk);
532
528/* 533/*
529 * reassembly.c 534 * reassembly.c
530 */ 535 */
@@ -533,8 +538,11 @@ extern int sysctl_ip6frag_low_thresh;
533extern int sysctl_ip6frag_time; 538extern int sysctl_ip6frag_time;
534extern int sysctl_ip6frag_secret_interval; 539extern int sysctl_ip6frag_secret_interval;
535 540
536extern struct proto_ops inet6_stream_ops; 541extern const struct proto_ops inet6_stream_ops;
537extern struct proto_ops inet6_dgram_ops; 542extern const struct proto_ops inet6_dgram_ops;
543
544struct group_source_req;
545struct group_filter;
538 546
539extern int ip6_mc_source(int add, int omode, struct sock *sk, 547extern int ip6_mc_source(int add, int omode, struct sock *sk,
540 struct group_source_req *pgsr); 548 struct group_source_req *pgsr);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index f85d6e4b7442..bbac87eeb422 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -35,11 +35,20 @@ enum {
35 35
36#ifdef __KERNEL__ 36#ifdef __KERNEL__
37 37
38#include <linux/skbuff.h> 38#include <linux/config.h>
39#include <linux/netdevice.h> 39#include <linux/compiler.h>
40#include <linux/icmpv6.h> 40#include <linux/icmpv6.h>
41#include <linux/in6.h>
42#include <linux/types.h>
43
41#include <net/neighbour.h> 44#include <net/neighbour.h>
42#include <asm/atomic.h> 45
46struct ctl_table;
47struct file;
48struct inet6_dev;
49struct net_device;
50struct net_proto_family;
51struct sk_buff;
43 52
44extern struct neigh_table nd_tbl; 53extern struct neigh_table nd_tbl;
45 54
@@ -108,7 +117,7 @@ extern int igmp6_event_report(struct sk_buff *skb);
108extern void igmp6_cleanup(void); 117extern void igmp6_cleanup(void);
109 118
110#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
111extern int ndisc_ifinfo_sysctl_change(ctl_table *ctl, 120extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
112 int write, 121 int write,
113 struct file * filp, 122 struct file * filp,
114 void __user *buffer, 123 void __user *buffer,
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 34c07731933d..6fa9ae190741 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -49,8 +49,8 @@
49#ifdef __KERNEL__ 49#ifdef __KERNEL__
50 50
51#include <asm/atomic.h> 51#include <asm/atomic.h>
52#include <linux/skbuff.h>
53#include <linux/netdevice.h> 52#include <linux/netdevice.h>
53#include <linux/skbuff.h>
54#include <linux/rcupdate.h> 54#include <linux/rcupdate.h>
55#include <linux/seq_file.h> 55#include <linux/seq_file.h>
56 56
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h
index bd08964b72c0..b225d8472b7e 100644
--- a/include/net/pkt_act.h
+++ b/include/net/pkt_act.h
@@ -15,7 +15,6 @@
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/netdevice.h>
19#include <linux/skbuff.h> 18#include <linux/skbuff.h>
20#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
21#include <linux/module.h> 20#include <linux/module.h>
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 357691f6a45f..63f7db99c2a6 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -65,7 +65,7 @@ struct inet_protosw {
65 int protocol; /* This is the L4 protocol number. */ 65 int protocol; /* This is the L4 protocol number. */
66 66
67 struct proto *prot; 67 struct proto *prot;
68 struct proto_ops *ops; 68 const struct proto_ops *ops;
69 69
70 int capability; /* Which (if any) capability do 70 int capability; /* Which (if any) capability do
71 * we need to use this socket 71 * we need to use this socket
@@ -76,6 +76,7 @@ struct inet_protosw {
76}; 76};
77#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ 77#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
78#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ 78#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */
79#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
79 80
80extern struct net_protocol *inet_protocol_base; 81extern struct net_protocol *inet_protocol_base;
81extern struct net_protocol *inet_protos[MAX_INET_PROTOS]; 82extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
diff --git a/include/net/raw.h b/include/net/raw.h
index f47917469b12..e67b28a0248c 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -19,6 +19,8 @@
19 19
20#include <linux/config.h> 20#include <linux/config.h>
21 21
22#include <net/protocol.h>
23
22extern struct proto raw_prot; 24extern struct proto raw_prot;
23 25
24extern void raw_err(struct sock *, struct sk_buff *, u32 info); 26extern void raw_err(struct sock *, struct sk_buff *, u32 info);
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index b52cc52ffe39..11641c9384f7 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -244,7 +244,7 @@ static inline int reqsk_queue_is_full(const struct request_sock_queue *queue)
244 244
245static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, 245static inline void reqsk_queue_hash_req(struct request_sock_queue *queue,
246 u32 hash, struct request_sock *req, 246 u32 hash, struct request_sock *req,
247 unsigned timeout) 247 unsigned long timeout)
248{ 248{
249 struct listen_sock *lopt = queue->listen_opt; 249 struct listen_sock *lopt = queue->listen_opt;
250 250
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 8e7794ee27ff..f5c22d77feab 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -277,6 +277,24 @@ struct sctp_sock {
277 __u32 default_context; 277 __u32 default_context;
278 __u32 default_timetolive; 278 __u32 default_timetolive;
279 279
280 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
281 * the destination address every heartbeat interval. This value
282 * will be inherited by all new associations.
283 */
284 __u32 hbinterval;
285
286 /* This is the max_retrans value for new associations. */
287 __u16 pathmaxrxt;
288
289 /* The initial Path MTU to use for new associations. */
290 __u32 pathmtu;
291
292 /* The default SACK delay timeout for new associations. */
293 __u32 sackdelay;
294
295 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
296 __u32 param_flags;
297
280 struct sctp_initmsg initmsg; 298 struct sctp_initmsg initmsg;
281 struct sctp_rtoinfo rtoinfo; 299 struct sctp_rtoinfo rtoinfo;
282 struct sctp_paddrparams paddrparam; 300 struct sctp_paddrparams paddrparam;
@@ -845,9 +863,6 @@ struct sctp_transport {
845 /* Data that has been sent, but not acknowledged. */ 863 /* Data that has been sent, but not acknowledged. */
846 __u32 flight_size; 864 __u32 flight_size;
847 865
848 /* PMTU : The current known path MTU. */
849 __u32 pmtu;
850
851 /* Destination */ 866 /* Destination */
852 struct dst_entry *dst; 867 struct dst_entry *dst;
853 /* Source address. */ 868 /* Source address. */
@@ -862,7 +877,22 @@ struct sctp_transport {
862 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 877 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
863 * the destination address every heartbeat interval. 878 * the destination address every heartbeat interval.
864 */ 879 */
865 int hb_interval; 880 __u32 hbinterval;
881
882 /* This is the max_retrans value for the transport and will
883 * be initialized from the assocs value. This can be changed
884 * using SCTP_SET_PEER_ADDR_PARAMS socket option.
885 */
886 __u16 pathmaxrxt;
887
888 /* PMTU : The current known path MTU. */
889 __u32 pathmtu;
890
891 /* SACK delay timeout */
892 __u32 sackdelay;
893
894 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
895 __u32 param_flags;
866 896
867 /* When was the last time (in jiffies) that we heard from this 897 /* When was the last time (in jiffies) that we heard from this
868 * transport? We use this to pick new active and retran paths. 898 * transport? We use this to pick new active and retran paths.
@@ -882,22 +912,11 @@ struct sctp_transport {
882 */ 912 */
883 int state; 913 int state;
884 914
885 /* hb_allowed : The current heartbeat state of this destination,
886 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc.
887 */
888 int hb_allowed;
889
890 /* These are the error stats for this destination. */ 915 /* These are the error stats for this destination. */
891 916
892 /* Error count : The current error count for this destination. */ 917 /* Error count : The current error count for this destination. */
893 unsigned short error_count; 918 unsigned short error_count;
894 919
895 /* This is the max_retrans value for the transport and will
896 * be initialized to proto.max_retrans.path. This can be changed
897 * using SCTP_SET_PEER_ADDR_PARAMS socket option.
898 */
899 int max_retrans;
900
901 /* Per : A timer used by each destination. 920 /* Per : A timer used by each destination.
902 * Destination : 921 * Destination :
903 * Timer : 922 * Timer :
@@ -1502,6 +1521,28 @@ struct sctp_association {
1502 /* The largest timeout or RTO value to use in attempting an INIT */ 1521 /* The largest timeout or RTO value to use in attempting an INIT */
1503 __u16 max_init_timeo; 1522 __u16 max_init_timeo;
1504 1523
1524 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
1525 * the destination address every heartbeat interval. This value
1526 * will be inherited by all new transports.
1527 */
1528 __u32 hbinterval;
1529
1530 /* This is the max_retrans value for new transports in the
1531 * association.
1532 */
1533 __u16 pathmaxrxt;
1534
1535 /* Association : The smallest PMTU discovered for all of the
1536 * PMTU : peer's transport addresses.
1537 */
1538 __u32 pathmtu;
1539
1540 /* SACK delay timeout */
1541 __u32 sackdelay;
1542
1543 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
1544 __u32 param_flags;
1545
1505 int timeouts[SCTP_NUM_TIMEOUT_TYPES]; 1546 int timeouts[SCTP_NUM_TIMEOUT_TYPES];
1506 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; 1547 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
1507 1548
@@ -1571,11 +1612,6 @@ struct sctp_association {
1571 */ 1612 */
1572 wait_queue_head_t wait; 1613 wait_queue_head_t wait;
1573 1614
1574 /* Association : The smallest PMTU discovered for all of the
1575 * PMTU : peer's transport addresses.
1576 */
1577 __u32 pmtu;
1578
1579 /* The message size at which SCTP fragmentation will occur. */ 1615 /* The message size at which SCTP fragmentation will occur. */
1580 __u32 frag_point; 1616 __u32 frag_point;
1581 1617
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f1c3bc54526a..8a6bef6f91eb 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -93,6 +93,8 @@ enum sctp_optname {
93#define SCTP_STATUS SCTP_STATUS 93#define SCTP_STATUS SCTP_STATUS
94 SCTP_GET_PEER_ADDR_INFO, 94 SCTP_GET_PEER_ADDR_INFO,
95#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO 95#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
96 SCTP_DELAYED_ACK_TIME,
97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
96 98
97 /* Internal Socket Options. Some of the sctp library functions are 99 /* Internal Socket Options. Some of the sctp library functions are
98 * implemented using these socket options. 100 * implemented using these socket options.
@@ -503,13 +505,41 @@ struct sctp_setadaption {
503 * unreachable. The following structure is used to access and modify an 505 * unreachable. The following structure is used to access and modify an
504 * address's parameters: 506 * address's parameters:
505 */ 507 */
508enum sctp_spp_flags {
509 SPP_HB_ENABLE = 1, /*Enable heartbeats*/
510 SPP_HB_DISABLE = 2, /*Disable heartbeats*/
511 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
512 SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/
513 SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/
514 SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/
515 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
516 SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/
517 SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/
518 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
519};
520
506struct sctp_paddrparams { 521struct sctp_paddrparams {
507 sctp_assoc_t spp_assoc_id; 522 sctp_assoc_t spp_assoc_id;
508 struct sockaddr_storage spp_address; 523 struct sockaddr_storage spp_address;
509 __u32 spp_hbinterval; 524 __u32 spp_hbinterval;
510 __u16 spp_pathmaxrxt; 525 __u16 spp_pathmaxrxt;
526 __u32 spp_pathmtu;
527 __u32 spp_sackdelay;
528 __u32 spp_flags;
511} __attribute__((packed, aligned(4))); 529} __attribute__((packed, aligned(4)));
512 530
531/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
532 *
533 * This options will get or set the delayed ack timer. The time is set
534 * in milliseconds. If the assoc_id is 0, then this sets or gets the
535 * endpoints default delayed ack timer value. If the assoc_id field is
536 * non-zero, then the set or get effects the specified association.
537 */
538struct sctp_assoc_value {
539 sctp_assoc_t assoc_id;
540 uint32_t assoc_value;
541};
542
513/* 543/*
514 * 7.2.2 Peer Address Information 544 * 7.2.2 Peer Address Information
515 * 545 *
diff --git a/include/net/sock.h b/include/net/sock.h
index 982b4ecd187b..6961700ff3a0 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -493,6 +493,7 @@ extern void sk_stream_kill_queues(struct sock *sk);
493extern int sk_wait_data(struct sock *sk, long *timeo); 493extern int sk_wait_data(struct sock *sk, long *timeo);
494 494
495struct request_sock_ops; 495struct request_sock_ops;
496struct timewait_sock_ops;
496 497
497/* Networking protocol blocks we attach to sockets. 498/* Networking protocol blocks we attach to sockets.
498 * socket layer -> transport layer interface 499 * socket layer -> transport layer interface
@@ -557,11 +558,10 @@ struct proto {
557 kmem_cache_t *slab; 558 kmem_cache_t *slab;
558 unsigned int obj_size; 559 unsigned int obj_size;
559 560
560 kmem_cache_t *twsk_slab;
561 unsigned int twsk_obj_size;
562 atomic_t *orphan_count; 561 atomic_t *orphan_count;
563 562
564 struct request_sock_ops *rsk_prot; 563 struct request_sock_ops *rsk_prot;
564 struct timewait_sock_ops *twsk_prot;
565 565
566 struct module *owner; 566 struct module *owner;
567 567
@@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk)
926 sk_free(sk); 926 sk_free(sk);
927} 927}
928 928
929static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
930{
931 int rc = NET_RX_SUCCESS;
932
933 if (sk_filter(sk, skb, 0))
934 goto discard_and_relse;
935
936 skb->dev = NULL;
937
938 bh_lock_sock(sk);
939 if (!sock_owned_by_user(sk))
940 rc = sk->sk_backlog_rcv(sk, skb);
941 else
942 sk_add_backlog(sk, skb);
943 bh_unlock_sock(sk);
944out:
945 sock_put(sk);
946 return rc;
947discard_and_relse:
948 kfree_skb(skb);
949 goto out;
950}
951
929/* Detach socket from process context. 952/* Detach socket from process context.
930 * Announce socket dead, detach it from wait queue and inode. 953 * Announce socket dead, detach it from wait queue and inode.
931 * Note that parent inode held reference count on this struct sock, 954 * Note that parent inode held reference count on this struct sock,
@@ -1166,7 +1189,10 @@ static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
1166 1189
1167static inline int sock_error(struct sock *sk) 1190static inline int sock_error(struct sock *sk)
1168{ 1191{
1169 int err = xchg(&sk->sk_err, 0); 1192 int err;
1193 if (likely(!sk->sk_err))
1194 return 0;
1195 err = xchg(&sk->sk_err, 0);
1170 return -err; 1196 return -err;
1171} 1197}
1172 1198
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d78025f9fbea..77f21c65bbca 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -225,53 +225,6 @@ extern atomic_t tcp_sockets_allocated;
225extern int tcp_memory_pressure; 225extern int tcp_memory_pressure;
226 226
227/* 227/*
228 * Pointers to address related TCP functions
229 * (i.e. things that depend on the address family)
230 */
231
232struct tcp_func {
233 int (*queue_xmit) (struct sk_buff *skb,
234 int ipfragok);
235
236 void (*send_check) (struct sock *sk,
237 struct tcphdr *th,
238 int len,
239 struct sk_buff *skb);
240
241 int (*rebuild_header) (struct sock *sk);
242
243 int (*conn_request) (struct sock *sk,
244 struct sk_buff *skb);
245
246 struct sock * (*syn_recv_sock) (struct sock *sk,
247 struct sk_buff *skb,
248 struct request_sock *req,
249 struct dst_entry *dst);
250
251 int (*remember_stamp) (struct sock *sk);
252
253 __u16 net_header_len;
254
255 int (*setsockopt) (struct sock *sk,
256 int level,
257 int optname,
258 char __user *optval,
259 int optlen);
260
261 int (*getsockopt) (struct sock *sk,
262 int level,
263 int optname,
264 char __user *optval,
265 int __user *optlen);
266
267
268 void (*addr2sockaddr) (struct sock *sk,
269 struct sockaddr *);
270
271 int sockaddr_len;
272};
273
274/*
275 * The next routines deal with comparing 32 bit unsigned ints 228 * The next routines deal with comparing 32 bit unsigned ints
276 * and worry about wraparound (automatic with unsigned arithmetic). 229 * and worry about wraparound (automatic with unsigned arithmetic).
277 */ 230 */
@@ -334,6 +287,9 @@ extern int tcp_rcv_established(struct sock *sk,
334 287
335extern void tcp_rcv_space_adjust(struct sock *sk); 288extern void tcp_rcv_space_adjust(struct sock *sk);
336 289
290extern int tcp_twsk_unique(struct sock *sk,
291 struct sock *sktw, void *twp);
292
337static inline void tcp_dec_quickack_mode(struct sock *sk, 293static inline void tcp_dec_quickack_mode(struct sock *sk,
338 const unsigned int pkts) 294 const unsigned int pkts)
339{ 295{
@@ -405,8 +361,7 @@ extern void tcp_parse_options(struct sk_buff *skb,
405 * TCP v4 functions exported for the inet6 API 361 * TCP v4 functions exported for the inet6 API
406 */ 362 */
407 363
408extern void tcp_v4_send_check(struct sock *sk, 364extern void tcp_v4_send_check(struct sock *sk, int len,
409 struct tcphdr *th, int len,
410 struct sk_buff *skb); 365 struct sk_buff *skb);
411 366
412extern int tcp_v4_conn_request(struct sock *sk, 367extern int tcp_v4_conn_request(struct sock *sk,
@@ -490,34 +445,16 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
490extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, 445extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
491 sk_read_actor_t recv_actor); 446 sk_read_actor_t recv_actor);
492 447
493/* Initialize RCV_MSS value. 448extern void tcp_initialize_rcv_mss(struct sock *sk);
494 * RCV_MSS is an our guess about MSS used by the peer.
495 * We haven't any direct information about the MSS.
496 * It's better to underestimate the RCV_MSS rather than overestimate.
497 * Overestimations make us ACKing less frequently than needed.
498 * Underestimations are more easy to detect and fix by tcp_measure_rcv_mss().
499 */
500 449
501static inline void tcp_initialize_rcv_mss(struct sock *sk) 450static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
502{
503 struct tcp_sock *tp = tcp_sk(sk);
504 unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache);
505
506 hint = min(hint, tp->rcv_wnd/2);
507 hint = min(hint, TCP_MIN_RCVMSS);
508 hint = max(hint, TCP_MIN_MSS);
509
510 inet_csk(sk)->icsk_ack.rcv_mss = hint;
511}
512
513static __inline__ void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
514{ 451{
515 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 452 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
516 ntohl(TCP_FLAG_ACK) | 453 ntohl(TCP_FLAG_ACK) |
517 snd_wnd); 454 snd_wnd);
518} 455}
519 456
520static __inline__ void tcp_fast_path_on(struct tcp_sock *tp) 457static inline void tcp_fast_path_on(struct tcp_sock *tp)
521{ 458{
522 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); 459 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
523} 460}
@@ -535,7 +472,7 @@ static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
535 * Rcv_nxt can be after the window if our peer push more data 472 * Rcv_nxt can be after the window if our peer push more data
536 * than the offered window. 473 * than the offered window.
537 */ 474 */
538static __inline__ u32 tcp_receive_window(const struct tcp_sock *tp) 475static inline u32 tcp_receive_window(const struct tcp_sock *tp)
539{ 476{
540 s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt; 477 s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt;
541 478
@@ -707,6 +644,7 @@ extern void tcp_cleanup_congestion_control(struct sock *sk);
707extern int tcp_set_default_congestion_control(const char *name); 644extern int tcp_set_default_congestion_control(const char *name);
708extern void tcp_get_default_congestion_control(char *name); 645extern void tcp_get_default_congestion_control(char *name);
709extern int tcp_set_congestion_control(struct sock *sk, const char *name); 646extern int tcp_set_congestion_control(struct sock *sk, const char *name);
647extern void tcp_slow_start(struct tcp_sock *tp);
710 648
711extern struct tcp_congestion_ops tcp_init_congestion_ops; 649extern struct tcp_congestion_ops tcp_init_congestion_ops;
712extern u32 tcp_reno_ssthresh(struct sock *sk); 650extern u32 tcp_reno_ssthresh(struct sock *sk);
@@ -746,7 +684,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
746 * "Packets left network, but not honestly ACKed yet" PLUS 684 * "Packets left network, but not honestly ACKed yet" PLUS
747 * "Packets fast retransmitted" 685 * "Packets fast retransmitted"
748 */ 686 */
749static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) 687static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
750{ 688{
751 return (tp->packets_out - tp->left_out + tp->retrans_out); 689 return (tp->packets_out - tp->left_out + tp->retrans_out);
752} 690}
@@ -766,33 +704,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
766 (tp->snd_cwnd >> 2))); 704 (tp->snd_cwnd >> 2)));
767} 705}
768 706
769/*
770 * Linear increase during slow start
771 */
772static inline void tcp_slow_start(struct tcp_sock *tp)
773{
774 if (sysctl_tcp_abc) {
775 /* RFC3465: Slow Start
776 * TCP sender SHOULD increase cwnd by the number of
777 * previously unacknowledged bytes ACKed by each incoming
778 * acknowledgment, provided the increase is not more than L
779 */
780 if (tp->bytes_acked < tp->mss_cache)
781 return;
782
783 /* We MAY increase by 2 if discovered delayed ack */
784 if (sysctl_tcp_abc > 1 && tp->bytes_acked > 2*tp->mss_cache) {
785 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
786 tp->snd_cwnd++;
787 }
788 }
789 tp->bytes_acked = 0;
790
791 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
792 tp->snd_cwnd++;
793}
794
795
796static inline void tcp_sync_left_out(struct tcp_sock *tp) 707static inline void tcp_sync_left_out(struct tcp_sock *tp)
797{ 708{
798 if (tp->rx_opt.sack_ok && 709 if (tp->rx_opt.sack_ok &&
@@ -801,34 +712,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
801 tp->left_out = tp->sacked_out + tp->lost_out; 712 tp->left_out = tp->sacked_out + tp->lost_out;
802} 713}
803 714
804/* Set slow start threshold and cwnd not falling to slow start */ 715extern void tcp_enter_cwr(struct sock *sk);
805static inline void __tcp_enter_cwr(struct sock *sk)
806{
807 const struct inet_connection_sock *icsk = inet_csk(sk);
808 struct tcp_sock *tp = tcp_sk(sk);
809
810 tp->undo_marker = 0;
811 tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk);
812 tp->snd_cwnd = min(tp->snd_cwnd,
813 tcp_packets_in_flight(tp) + 1U);
814 tp->snd_cwnd_cnt = 0;
815 tp->high_seq = tp->snd_nxt;
816 tp->snd_cwnd_stamp = tcp_time_stamp;
817 TCP_ECN_queue_cwr(tp);
818}
819
820static inline void tcp_enter_cwr(struct sock *sk)
821{
822 struct tcp_sock *tp = tcp_sk(sk);
823
824 tp->prior_ssthresh = 0;
825 tp->bytes_acked = 0;
826 if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
827 __tcp_enter_cwr(sk);
828 tcp_set_ca_state(sk, TCP_CA_CWR);
829 }
830}
831
832extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 716extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
833 717
834/* Slow start with delack produces 3 packets of burst, so that 718/* Slow start with delack produces 3 packets of burst, so that
@@ -860,14 +744,14 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
860 return left <= tcp_max_burst(tp); 744 return left <= tcp_max_burst(tp);
861} 745}
862 746
863static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, 747static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
864 const struct sk_buff *skb) 748 const struct sk_buff *skb)
865{ 749{
866 if (skb->len < mss) 750 if (skb->len < mss)
867 tp->snd_sml = TCP_SKB_CB(skb)->end_seq; 751 tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
868} 752}
869 753
870static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 754static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
871{ 755{
872 const struct inet_connection_sock *icsk = inet_csk(sk); 756 const struct inet_connection_sock *icsk = inet_csk(sk);
873 if (!tp->packets_out && !icsk->icsk_pending) 757 if (!tp->packets_out && !icsk->icsk_pending)
@@ -875,18 +759,18 @@ static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *t
875 icsk->icsk_rto, TCP_RTO_MAX); 759 icsk->icsk_rto, TCP_RTO_MAX);
876} 760}
877 761
878static __inline__ void tcp_push_pending_frames(struct sock *sk, 762static inline void tcp_push_pending_frames(struct sock *sk,
879 struct tcp_sock *tp) 763 struct tcp_sock *tp)
880{ 764{
881 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); 765 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle);
882} 766}
883 767
884static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 768static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
885{ 769{
886 tp->snd_wl1 = seq; 770 tp->snd_wl1 = seq;
887} 771}
888 772
889static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) 773static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
890{ 774{
891 tp->snd_wl1 = seq; 775 tp->snd_wl1 = seq;
892} 776}
@@ -894,19 +778,19 @@ static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
894/* 778/*
895 * Calculate(/check) TCP checksum 779 * Calculate(/check) TCP checksum
896 */ 780 */
897static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len, 781static inline u16 tcp_v4_check(struct tcphdr *th, int len,
898 unsigned long saddr, unsigned long daddr, 782 unsigned long saddr, unsigned long daddr,
899 unsigned long base) 783 unsigned long base)
900{ 784{
901 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); 785 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
902} 786}
903 787
904static __inline__ int __tcp_checksum_complete(struct sk_buff *skb) 788static inline int __tcp_checksum_complete(struct sk_buff *skb)
905{ 789{
906 return __skb_checksum_complete(skb); 790 return __skb_checksum_complete(skb);
907} 791}
908 792
909static __inline__ int tcp_checksum_complete(struct sk_buff *skb) 793static inline int tcp_checksum_complete(struct sk_buff *skb)
910{ 794{
911 return skb->ip_summed != CHECKSUM_UNNECESSARY && 795 return skb->ip_summed != CHECKSUM_UNNECESSARY &&
912 __tcp_checksum_complete(skb); 796 __tcp_checksum_complete(skb);
@@ -914,7 +798,7 @@ static __inline__ int tcp_checksum_complete(struct sk_buff *skb)
914 798
915/* Prequeue for VJ style copy to user, combined with checksumming. */ 799/* Prequeue for VJ style copy to user, combined with checksumming. */
916 800
917static __inline__ void tcp_prequeue_init(struct tcp_sock *tp) 801static inline void tcp_prequeue_init(struct tcp_sock *tp)
918{ 802{
919 tp->ucopy.task = NULL; 803 tp->ucopy.task = NULL;
920 tp->ucopy.len = 0; 804 tp->ucopy.len = 0;
@@ -930,7 +814,7 @@ static __inline__ void tcp_prequeue_init(struct tcp_sock *tp)
930 * 814 *
931 * NOTE: is this not too big to inline? 815 * NOTE: is this not too big to inline?
932 */ 816 */
933static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb) 817static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
934{ 818{
935 struct tcp_sock *tp = tcp_sk(sk); 819 struct tcp_sock *tp = tcp_sk(sk);
936 820
@@ -971,7 +855,7 @@ static const char *statename[]={
971}; 855};
972#endif 856#endif
973 857
974static __inline__ void tcp_set_state(struct sock *sk, int state) 858static inline void tcp_set_state(struct sock *sk, int state)
975{ 859{
976 int oldstate = sk->sk_state; 860 int oldstate = sk->sk_state;
977 861
@@ -1005,7 +889,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
1005#endif 889#endif
1006} 890}
1007 891
1008static __inline__ void tcp_done(struct sock *sk) 892static inline void tcp_done(struct sock *sk)
1009{ 893{
1010 tcp_set_state(sk, TCP_CLOSE); 894 tcp_set_state(sk, TCP_CLOSE);
1011 tcp_clear_xmit_timers(sk); 895 tcp_clear_xmit_timers(sk);
@@ -1018,81 +902,13 @@ static __inline__ void tcp_done(struct sock *sk)
1018 inet_csk_destroy_sock(sk); 902 inet_csk_destroy_sock(sk);
1019} 903}
1020 904
1021static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt) 905static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1022{ 906{
1023 rx_opt->dsack = 0; 907 rx_opt->dsack = 0;
1024 rx_opt->eff_sacks = 0; 908 rx_opt->eff_sacks = 0;
1025 rx_opt->num_sacks = 0; 909 rx_opt->num_sacks = 0;
1026} 910}
1027 911
1028static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, __u32 tstamp)
1029{
1030 if (tp->rx_opt.tstamp_ok) {
1031 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
1032 (TCPOPT_NOP << 16) |
1033 (TCPOPT_TIMESTAMP << 8) |
1034 TCPOLEN_TIMESTAMP);
1035 *ptr++ = htonl(tstamp);
1036 *ptr++ = htonl(tp->rx_opt.ts_recent);
1037 }
1038 if (tp->rx_opt.eff_sacks) {
1039 struct tcp_sack_block *sp = tp->rx_opt.dsack ? tp->duplicate_sack : tp->selective_acks;
1040 int this_sack;
1041
1042 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
1043 (TCPOPT_NOP << 16) |
1044 (TCPOPT_SACK << 8) |
1045 (TCPOLEN_SACK_BASE +
1046 (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK)));
1047 for(this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) {
1048 *ptr++ = htonl(sp[this_sack].start_seq);
1049 *ptr++ = htonl(sp[this_sack].end_seq);
1050 }
1051 if (tp->rx_opt.dsack) {
1052 tp->rx_opt.dsack = 0;
1053 tp->rx_opt.eff_sacks--;
1054 }
1055 }
1056}
1057
1058/* Construct a tcp options header for a SYN or SYN_ACK packet.
1059 * If this is every changed make sure to change the definition of
1060 * MAX_SYN_SIZE to match the new maximum number of options that you
1061 * can generate.
1062 */
1063static inline void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack,
1064 int offer_wscale, int wscale, __u32 tstamp, __u32 ts_recent)
1065{
1066 /* We always get an MSS option.
1067 * The option bytes which will be seen in normal data
1068 * packets should timestamps be used, must be in the MSS
1069 * advertised. But we subtract them from tp->mss_cache so
1070 * that calculations in tcp_sendmsg are simpler etc.
1071 * So account for this fact here if necessary. If we
1072 * don't do this correctly, as a receiver we won't
1073 * recognize data packets as being full sized when we
1074 * should, and thus we won't abide by the delayed ACK
1075 * rules correctly.
1076 * SACKs don't matter, we never delay an ACK when we
1077 * have any of those going out.
1078 */
1079 *ptr++ = htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | mss);
1080 if (ts) {
1081 if(sack)
1082 *ptr++ = __constant_htonl((TCPOPT_SACK_PERM << 24) | (TCPOLEN_SACK_PERM << 16) |
1083 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
1084 else
1085 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1086 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
1087 *ptr++ = htonl(tstamp); /* TSVAL */
1088 *ptr++ = htonl(ts_recent); /* TSECR */
1089 } else if(sack)
1090 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1091 (TCPOPT_SACK_PERM << 8) | TCPOLEN_SACK_PERM);
1092 if (offer_wscale)
1093 *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_WINDOW << 16) | (TCPOLEN_WINDOW << 8) | (wscale));
1094}
1095
1096/* Determine a window scaling and initial window to offer. */ 912/* Determine a window scaling and initial window to offer. */
1097extern void tcp_select_initial_window(int __space, __u32 mss, 913extern void tcp_select_initial_window(int __space, __u32 mss,
1098 __u32 *rcv_wnd, __u32 *window_clamp, 914 __u32 *rcv_wnd, __u32 *window_clamp,
@@ -1117,9 +933,9 @@ static inline int tcp_full_space(const struct sock *sk)
1117 return tcp_win_from_space(sk->sk_rcvbuf); 933 return tcp_win_from_space(sk->sk_rcvbuf);
1118} 934}
1119 935
1120static __inline__ void tcp_openreq_init(struct request_sock *req, 936static inline void tcp_openreq_init(struct request_sock *req,
1121 struct tcp_options_received *rx_opt, 937 struct tcp_options_received *rx_opt,
1122 struct sk_buff *skb) 938 struct sk_buff *skb)
1123{ 939{
1124 struct inet_request_sock *ireq = inet_rsk(req); 940 struct inet_request_sock *ireq = inet_rsk(req);
1125 941
diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h
index b9d4176b2d15..b0b645988bd8 100644
--- a/include/net/tcp_states.h
+++ b/include/net/tcp_states.h
@@ -31,4 +31,20 @@ enum {
31 31
32#define TCP_STATE_MASK 0xF 32#define TCP_STATE_MASK 0xF
33 33
34#define TCP_ACTION_FIN (1 << 7)
35
36enum {
37 TCPF_ESTABLISHED = (1 << 1),
38 TCPF_SYN_SENT = (1 << 2),
39 TCPF_SYN_RECV = (1 << 3),
40 TCPF_FIN_WAIT1 = (1 << 4),
41 TCPF_FIN_WAIT2 = (1 << 5),
42 TCPF_TIME_WAIT = (1 << 6),
43 TCPF_CLOSE = (1 << 7),
44 TCPF_CLOSE_WAIT = (1 << 8),
45 TCPF_LAST_ACK = (1 << 9),
46 TCPF_LISTEN = (1 << 10),
47 TCPF_CLOSING = (1 << 11)
48};
49
34#endif /* _LINUX_TCP_STATES_H */ 50#endif /* _LINUX_TCP_STATES_H */
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
new file mode 100644
index 000000000000..2544281e1d5e
--- /dev/null
+++ b/include/net/timewait_sock.h
@@ -0,0 +1,31 @@
1/*
2 * NET Generic infrastructure for Network protocols.
3 *
4 * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _TIMEWAIT_SOCK_H
12#define _TIMEWAIT_SOCK_H
13
14#include <linux/slab.h>
15#include <net/sock.h>
16
17struct timewait_sock_ops {
18 kmem_cache_t *twsk_slab;
19 unsigned int twsk_obj_size;
20 int (*twsk_unique)(struct sock *sk,
21 struct sock *sktw, void *twp);
22};
23
24static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
25{
26 if (sk->sk_prot->twsk_prot->twsk_unique != NULL)
27 return sk->sk_prot->twsk_prot->twsk_unique(sk, sktw, twp);
28 return 0;
29}
30
31#endif /* _TIMEWAIT_SOCK_H */
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 4e86f2de6638..61f724c1036f 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -44,7 +44,7 @@ extern int datagram_send_ctl(struct msghdr *msg,
44/* 44/*
45 * address family specific functions 45 * address family specific functions
46 */ 46 */
47extern struct tcp_func ipv4_specific; 47extern struct inet_connection_sock_af_ops ipv4_specific;
48 48
49extern int inet6_destroy_sock(struct sock *sk); 49extern int inet6_destroy_sock(struct sock *sk);
50 50
diff --git a/include/net/udp.h b/include/net/udp.h
index 107b9d791a1f..766fba1369ce 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -22,9 +22,8 @@
22#ifndef _UDP_H 22#ifndef _UDP_H
23#define _UDP_H 23#define _UDP_H
24 24
25#include <linux/udp.h>
26#include <linux/ip.h>
27#include <linux/list.h> 25#include <linux/list.h>
26#include <net/inet_sock.h>
28#include <net/sock.h> 27#include <net/sock.h>
29#include <net/snmp.h> 28#include <net/snmp.h>
30#include <linux/seq_file.h> 29#include <linux/seq_file.h>
@@ -62,6 +61,7 @@ static inline int udp_lport_inuse(u16 num)
62 61
63extern struct proto udp_prot; 62extern struct proto udp_prot;
64 63
64struct sk_buff;
65 65
66extern void udp_err(struct sk_buff *, u32); 66extern void udp_err(struct sk_buff *, u32);
67 67
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 1cdb87912137..07d7b50cdd76 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -2,11 +2,12 @@
2#define _NET_XFRM_H 2#define _NET_XFRM_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/in.h>
5#include <linux/xfrm.h> 6#include <linux/xfrm.h>
6#include <linux/spinlock.h> 7#include <linux/spinlock.h>
7#include <linux/list.h> 8#include <linux/list.h>
8#include <linux/skbuff.h> 9#include <linux/skbuff.h>
9#include <linux/netdevice.h> 10#include <linux/socket.h>
10#include <linux/crypto.h> 11#include <linux/crypto.h>
11#include <linux/pfkeyv2.h> 12#include <linux/pfkeyv2.h>
12#include <linux/in6.h> 13#include <linux/in6.h>
@@ -144,6 +145,9 @@ struct xfrm_state
144 * transformer. */ 145 * transformer. */
145 struct xfrm_type *type; 146 struct xfrm_type *type;
146 147
148 /* Security context */
149 struct xfrm_sec_ctx *security;
150
147 /* Private data of this transformer, format is opaque, 151 /* Private data of this transformer, format is opaque,
148 * interpreted by xfrm_type methods. */ 152 * interpreted by xfrm_type methods. */
149 void *data; 153 void *data;
@@ -298,6 +302,7 @@ struct xfrm_policy
298 __u8 flags; 302 __u8 flags;
299 __u8 dead; 303 __u8 dead;
300 __u8 xfrm_nr; 304 __u8 xfrm_nr;
305 struct xfrm_sec_ctx *security;
301 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 306 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
302}; 307};
303 308
@@ -510,6 +515,25 @@ xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
510 return 0; 515 return 0;
511} 516}
512 517
518#ifdef CONFIG_SECURITY_NETWORK_XFRM
519/* If neither has a context --> match
520 * Otherwise, both must have a context and the sids, doi, alg must match
521 */
522static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
523{
524 return ((!s1 && !s2) ||
525 (s1 && s2 &&
526 (s1->ctx_sid == s2->ctx_sid) &&
527 (s1->ctx_doi == s2->ctx_doi) &&
528 (s1->ctx_alg == s2->ctx_alg)));
529}
530#else
531static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
532{
533 return 1;
534}
535#endif
536
513/* A struct encoding bundle of transformations to apply to some set of flow. 537/* A struct encoding bundle of transformations to apply to some set of flow.
514 * 538 *
515 * dst->child points to the next element of bundle. 539 * dst->child points to the next element of bundle.
@@ -878,8 +902,8 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig
878struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 902struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
879extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); 903extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *);
880int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 904int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
881struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, 905struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel,
882 int delete); 906 struct xfrm_sec_ctx *ctx, int delete);
883struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); 907struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete);
884void xfrm_policy_flush(void); 908void xfrm_policy_flush(void);
885u32 xfrm_get_acqseq(void); 909u32 xfrm_get_acqseq(void);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 20da282d4abb..41cfc29be899 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -151,6 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
151extern void scsi_put_command(struct scsi_cmnd *); 151extern void scsi_put_command(struct scsi_cmnd *);
152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); 152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int);
153extern void scsi_finish_command(struct scsi_cmnd *cmd); 153extern void scsi_finish_command(struct scsi_cmnd *cmd);
154extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries); 154extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd);
155 155
156#endif /* _SCSI_SCSI_CMND_H */ 156#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index b090a11d7e1c..4d69dee66d4d 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -16,7 +16,6 @@ extern void __scsi_print_sense(const char *name,
16extern void scsi_print_driverbyte(int); 16extern void scsi_print_driverbyte(int);
17extern void scsi_print_hostbyte(int); 17extern void scsi_print_hostbyte(int);
18extern void scsi_print_status(unsigned char); 18extern void scsi_print_status(unsigned char);
19extern int scsi_print_msg(const unsigned char *);
20extern const char *scsi_sense_key_string(unsigned char); 19extern const char *scsi_sense_key_string(unsigned char);
21extern const char *scsi_extd_sense_format(unsigned char, unsigned char); 20extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
22 21
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 85cfd88461c8..e94ca4d36035 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -79,9 +79,9 @@ struct scsi_device {
79 char inq_periph_qual; /* PQ from INQUIRY data */ 79 char inq_periph_qual; /* PQ from INQUIRY data */
80 unsigned char inquiry_len; /* valid bytes in 'inquiry' */ 80 unsigned char inquiry_len; /* valid bytes in 'inquiry' */
81 unsigned char * inquiry; /* INQUIRY response data */ 81 unsigned char * inquiry; /* INQUIRY response data */
82 char * vendor; /* [back_compat] point into 'inquiry' ... */ 82 const char * vendor; /* [back_compat] point into 'inquiry' ... */
83 char * model; /* ... after scan; point to static string */ 83 const char * model; /* ... after scan; point to static string */
84 char * rev; /* ... "nullnullnullnull" before scan */ 84 const char * rev; /* ... "nullnullnullnull" before scan */
85 unsigned char current_tag; /* current tag */ 85 unsigned char current_tag; /* current tag */
86 struct scsi_target *sdev_target; /* used only for single_lun */ 86 struct scsi_target *sdev_target; /* used only for single_lun */
87 87
@@ -274,6 +274,12 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
274extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, 274extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
275 int data_direction, void *buffer, unsigned bufflen, 275 int data_direction, void *buffer, unsigned bufflen,
276 struct scsi_sense_hdr *, int timeout, int retries); 276 struct scsi_sense_hdr *, int timeout, int retries);
277extern int scsi_execute_async(struct scsi_device *sdev,
278 const unsigned char *cmd, int data_direction,
279 void *buffer, unsigned bufflen, int use_sg,
280 int timeout, int retries, void *privdata,
281 void (*done)(void *, char *, int, int),
282 gfp_t gfp);
277 283
278static inline unsigned int sdev_channel(struct scsi_device *sdev) 284static inline unsigned int sdev_channel(struct scsi_device *sdev)
279{ 285{
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 6bdc4afb2483..54a89611e9c5 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -24,6 +24,9 @@
24#include <linux/transport_class.h> 24#include <linux/transport_class.h>
25 25
26struct scsi_transport_template; 26struct scsi_transport_template;
27struct scsi_target;
28struct scsi_device;
29struct Scsi_Host;
27 30
28struct spi_transport_attrs { 31struct spi_transport_attrs {
29 int period; /* value in the PPR/SDTR command */ 32 int period; /* value in the PPR/SDTR command */
@@ -143,5 +146,6 @@ void spi_release_transport(struct scsi_transport_template *);
143void spi_schedule_dv_device(struct scsi_device *); 146void spi_schedule_dv_device(struct scsi_device *);
144void spi_dv_device(struct scsi_device *); 147void spi_dv_device(struct scsi_device *);
145void spi_display_xfer_agreement(struct scsi_target *); 148void spi_display_xfer_agreement(struct scsi_target *);
149int spi_print_msg(const unsigned char *);
146 150
147#endif /* SCSI_TRANSPORT_SPI_H */ 151#endif /* SCSI_TRANSPORT_SPI_H */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 7f0ca79d6c98..b0b3ea7b365e 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -391,65 +391,35 @@
391 * 391 *
392 */ 392 */
393 393
394typedef struct _snd_ac97_bus ac97_bus_t; 394struct snd_ac97;
395typedef struct _snd_ac97_bus_ops ac97_bus_ops_t;
396typedef struct _snd_ac97_template ac97_template_t;
397typedef struct _snd_ac97 ac97_t;
398
399enum ac97_pcm_cfg {
400 AC97_PCM_CFG_FRONT = 2,
401 AC97_PCM_CFG_REAR = 10, /* alias surround */
402 AC97_PCM_CFG_LFE = 11, /* center + lfe */
403 AC97_PCM_CFG_40 = 4, /* front + rear */
404 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */
405 AC97_PCM_CFG_SPDIF = 20
406};
407
408/* PCM allocation */
409struct ac97_pcm {
410 ac97_bus_t *bus;
411 unsigned int stream: 1, /* stream type: 1 = capture */
412 exclusive: 1, /* exclusive mode, don't override with other pcms */
413 copy_flag: 1, /* lowlevel driver must fill all entries */
414 spdif: 1; /* spdif pcm */
415 unsigned short aslots; /* active slots */
416 unsigned int rates; /* available rates */
417 struct {
418 unsigned short slots; /* driver input: requested AC97 slot numbers */
419 unsigned short rslots[4]; /* allocated slots per codecs */
420 unsigned char rate_table[4];
421 ac97_t *codec[4]; /* allocated codecs */
422 } r[2]; /* 0 = standard rates, 1 = double rates */
423 unsigned long private_value; /* used by the hardware driver */
424};
425 395
426struct snd_ac97_build_ops { 396struct snd_ac97_build_ops {
427 int (*build_3d) (ac97_t *ac97); 397 int (*build_3d) (struct snd_ac97 *ac97);
428 int (*build_specific) (ac97_t *ac97); 398 int (*build_specific) (struct snd_ac97 *ac97);
429 int (*build_spdif) (ac97_t *ac97); 399 int (*build_spdif) (struct snd_ac97 *ac97);
430 int (*build_post_spdif) (ac97_t *ac97); 400 int (*build_post_spdif) (struct snd_ac97 *ac97);
431#ifdef CONFIG_PM 401#ifdef CONFIG_PM
432 void (*suspend) (ac97_t *ac97); 402 void (*suspend) (struct snd_ac97 *ac97);
433 void (*resume) (ac97_t *ac97); 403 void (*resume) (struct snd_ac97 *ac97);
434#endif 404#endif
435 void (*update_jacks) (ac97_t *ac97); /* for jack-sharing */ 405 void (*update_jacks) (struct snd_ac97 *ac97); /* for jack-sharing */
436}; 406};
437 407
438struct _snd_ac97_bus_ops { 408struct snd_ac97_bus_ops {
439 void (*reset) (ac97_t *ac97); 409 void (*reset) (struct snd_ac97 *ac97);
440 void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); 410 void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
441 unsigned short (*read) (ac97_t *ac97, unsigned short reg); 411 unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg);
442 void (*wait) (ac97_t *ac97); 412 void (*wait) (struct snd_ac97 *ac97);
443 void (*init) (ac97_t *ac97); 413 void (*init) (struct snd_ac97 *ac97);
444}; 414};
445 415
446struct _snd_ac97_bus { 416struct snd_ac97_bus {
447 /* -- lowlevel (hardware) driver specific -- */ 417 /* -- lowlevel (hardware) driver specific -- */
448 ac97_bus_ops_t *ops; 418 struct snd_ac97_bus_ops *ops;
449 void *private_data; 419 void *private_data;
450 void (*private_free) (ac97_bus_t *bus); 420 void (*private_free) (struct snd_ac97_bus *bus);
451 /* --- */ 421 /* --- */
452 snd_card_t *card; 422 struct snd_card *card;
453 unsigned short num; /* bus number */ 423 unsigned short num; /* bus number */
454 unsigned short no_vra: 1, /* bridge doesn't support VRA */ 424 unsigned short no_vra: 1, /* bridge doesn't support VRA */
455 dra: 1, /* bridge supports double rate */ 425 dra: 1, /* bridge supports double rate */
@@ -459,13 +429,13 @@ struct _snd_ac97_bus {
459 unsigned short used_slots[2][4]; /* actually used PCM slots */ 429 unsigned short used_slots[2][4]; /* actually used PCM slots */
460 unsigned short pcms_count; /* count of PCMs */ 430 unsigned short pcms_count; /* count of PCMs */
461 struct ac97_pcm *pcms; 431 struct ac97_pcm *pcms;
462 ac97_t *codec[4]; 432 struct snd_ac97 *codec[4];
463 snd_info_entry_t *proc; 433 struct snd_info_entry *proc;
464}; 434};
465 435
466struct _snd_ac97_template { 436struct snd_ac97_template {
467 void *private_data; 437 void *private_data;
468 void (*private_free) (ac97_t *ac97); 438 void (*private_free) (struct snd_ac97 *ac97);
469 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 439 struct pci_dev *pci; /* assigned PCI device - used for quirks */
470 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 440 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */
471 unsigned short addr; /* physical address of codec [0-3] */ 441 unsigned short addr; /* physical address of codec [0-3] */
@@ -474,16 +444,16 @@ struct _snd_ac97_template {
474 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ 444 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */
475}; 445};
476 446
477struct _snd_ac97 { 447struct snd_ac97 {
478 /* -- lowlevel (hardware) driver specific -- */ 448 /* -- lowlevel (hardware) driver specific -- */
479 struct snd_ac97_build_ops * build_ops; 449 struct snd_ac97_build_ops * build_ops;
480 void *private_data; 450 void *private_data;
481 void (*private_free) (ac97_t *ac97); 451 void (*private_free) (struct snd_ac97 *ac97);
482 /* --- */ 452 /* --- */
483 ac97_bus_t *bus; 453 struct snd_ac97_bus *bus;
484 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 454 struct pci_dev *pci; /* assigned PCI device - used for quirks */
485 snd_info_entry_t *proc; 455 struct snd_info_entry *proc;
486 snd_info_entry_t *proc_regs; 456 struct snd_info_entry *proc_regs;
487 unsigned short subsystem_vendor; 457 unsigned short subsystem_vendor;
488 unsigned short subsystem_device; 458 unsigned short subsystem_device;
489 struct semaphore reg_mutex; 459 struct semaphore reg_mutex;
@@ -517,43 +487,47 @@ struct _snd_ac97 {
517 struct device dev; 487 struct device dev;
518}; 488};
519 489
520#define to_ac97_t(d) container_of(d, struct _snd_ac97, dev) 490#define to_ac97_t(d) container_of(d, struct snd_ac97, dev)
521 491
522/* conditions */ 492/* conditions */
523static inline int ac97_is_audio(ac97_t * ac97) 493static inline int ac97_is_audio(struct snd_ac97 * ac97)
524{ 494{
525 return (ac97->scaps & AC97_SCAP_AUDIO); 495 return (ac97->scaps & AC97_SCAP_AUDIO);
526} 496}
527static inline int ac97_is_modem(ac97_t * ac97) 497static inline int ac97_is_modem(struct snd_ac97 * ac97)
528{ 498{
529 return (ac97->scaps & AC97_SCAP_MODEM); 499 return (ac97->scaps & AC97_SCAP_MODEM);
530} 500}
531static inline int ac97_is_rev22(ac97_t * ac97) 501static inline int ac97_is_rev22(struct snd_ac97 * ac97)
532{ 502{
533 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; 503 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22;
534} 504}
535static inline int ac97_can_amap(ac97_t * ac97) 505static inline int ac97_can_amap(struct snd_ac97 * ac97)
536{ 506{
537 return (ac97->ext_id & AC97_EI_AMAP) != 0; 507 return (ac97->ext_id & AC97_EI_AMAP) != 0;
538} 508}
539static inline int ac97_can_spdif(ac97_t * ac97) 509static inline int ac97_can_spdif(struct snd_ac97 * ac97)
540{ 510{
541 return (ac97->ext_id & AC97_EI_SPDIF) != 0; 511 return (ac97->ext_id & AC97_EI_SPDIF) != 0;
542} 512}
543 513
544/* functions */ 514/* functions */
545int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, void *private_data, ac97_bus_t **rbus); /* create new AC97 bus */ 515/* create new AC97 bus */
546int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97); /* create mixer controls */ 516int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
547const char *snd_ac97_get_short_name(ac97_t *ac97); 517 void *private_data, struct snd_ac97_bus **rbus);
548 518/* create mixer controls */
549void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); 519int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
550unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg); 520 struct snd_ac97 **rac97);
551void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value); 521const char *snd_ac97_get_short_name(struct snd_ac97 *ac97);
552int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value); 522
553int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value); 523void snd_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
524unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
525void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
526int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
527int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value);
554#ifdef CONFIG_PM 528#ifdef CONFIG_PM
555void snd_ac97_suspend(ac97_t *ac97); 529void snd_ac97_suspend(struct snd_ac97 *ac97);
556void snd_ac97_resume(ac97_t *ac97); 530void snd_ac97_resume(struct snd_ac97 *ac97);
557#endif 531#endif
558 532
559/* quirk types */ 533/* quirk types */
@@ -567,6 +541,7 @@ enum {
567 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ 541 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */
568 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ 542 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */
569 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */ 543 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */
544 AC97_TUNE_HP_MUTE_LED, /* EAPD bit works as mute LED, use headphone control as master */
570}; 545};
571 546
572struct ac97_quirk { 547struct ac97_quirk {
@@ -578,24 +553,46 @@ struct ac97_quirk {
578 int type; /* quirk type above */ 553 int type; /* quirk type above */
579}; 554};
580 555
581int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *override); 556int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override);
582int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned int rate); 557int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate);
558
559/*
560 * PCM allocation
561 */
562
563enum ac97_pcm_cfg {
564 AC97_PCM_CFG_FRONT = 2,
565 AC97_PCM_CFG_REAR = 10, /* alias surround */
566 AC97_PCM_CFG_LFE = 11, /* center + lfe */
567 AC97_PCM_CFG_40 = 4, /* front + rear */
568 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */
569 AC97_PCM_CFG_SPDIF = 20
570};
571
572struct ac97_pcm {
573 struct snd_ac97_bus *bus;
574 unsigned int stream: 1, /* stream type: 1 = capture */
575 exclusive: 1, /* exclusive mode, don't override with other pcms */
576 copy_flag: 1, /* lowlevel driver must fill all entries */
577 spdif: 1; /* spdif pcm */
578 unsigned short aslots; /* active slots */
579 unsigned int rates; /* available rates */
580 struct {
581 unsigned short slots; /* driver input: requested AC97 slot numbers */
582 unsigned short rslots[4]; /* allocated slots per codecs */
583 unsigned char rate_table[4];
584 struct snd_ac97 *codec[4]; /* allocated codecs */
585 } r[2]; /* 0 = standard rates, 1 = double rates */
586 unsigned long private_value; /* used by the hardware driver */
587};
583 588
584int snd_ac97_pcm_assign(ac97_bus_t *ac97, 589int snd_ac97_pcm_assign(struct snd_ac97_bus *ac97,
585 unsigned short pcms_count, 590 unsigned short pcms_count,
586 const struct ac97_pcm *pcms); 591 const struct ac97_pcm *pcms);
587int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, 592int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
588 enum ac97_pcm_cfg cfg, unsigned short slots); 593 enum ac97_pcm_cfg cfg, unsigned short slots);
589int snd_ac97_pcm_close(struct ac97_pcm *pcm); 594int snd_ac97_pcm_close(struct ac97_pcm *pcm);
590int snd_ac97_pcm_double_rate_rules(snd_pcm_runtime_t *runtime); 595int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);
591
592struct ac97_enum {
593 unsigned char reg;
594 unsigned char shift_l;
595 unsigned char shift_r;
596 unsigned short mask;
597 const char **texts;
598};
599 596
600/* ad hoc AC97 device driver access */ 597/* ad hoc AC97 device driver access */
601extern struct bus_type ac97_bus_type; 598extern struct bus_type ac97_bus_type;
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index ca2e0e4fa937..b3aa62ee3c8d 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -123,9 +123,7 @@
123#define AD1816A_CAPTURE_NOT_EQUAL 0x1000 123#define AD1816A_CAPTURE_NOT_EQUAL 0x1000
124#define AD1816A_WSS_ENABLE 0x8000 124#define AD1816A_WSS_ENABLE 0x8000
125 125
126typedef struct _snd_ad1816a ad1816a_t; 126struct snd_ad1816a {
127
128struct _snd_ad1816a {
129 unsigned long port; 127 unsigned long port;
130 struct resource *res_port; 128 struct resource *res_port;
131 int irq; 129 int irq;
@@ -140,15 +138,15 @@ struct _snd_ad1816a {
140 unsigned short mode; 138 unsigned short mode;
141 unsigned int clock_freq; 139 unsigned int clock_freq;
142 140
143 snd_card_t *card; 141 struct snd_card *card;
144 snd_pcm_t *pcm; 142 struct snd_pcm *pcm;
145 143
146 snd_pcm_substream_t *playback_substream; 144 struct snd_pcm_substream *playback_substream;
147 snd_pcm_substream_t *capture_substream; 145 struct snd_pcm_substream *capture_substream;
148 unsigned int p_dma_size; 146 unsigned int p_dma_size;
149 unsigned int c_dma_size; 147 unsigned int c_dma_size;
150 148
151 snd_timer_t *timer; 149 struct snd_timer *timer;
152}; 150};
153 151
154 152
@@ -165,11 +163,11 @@ struct _snd_ad1816a {
165 AD1816A_MODE_TIMER) 163 AD1816A_MODE_TIMER)
166 164
167 165
168extern int snd_ad1816a_create(snd_card_t *card, unsigned long port, 166extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
169 int irq, int dma1, int dma2, 167 int irq, int dma1, int dma2,
170 ad1816a_t **chip); 168 struct snd_ad1816a **chip);
171 169
172extern int snd_ad1816a_pcm(ad1816a_t *chip, int device, snd_pcm_t **rpcm); 170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
173extern int snd_ad1816a_mixer(ad1816a_t *chip); 171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
174 172
175#endif /* __SOUND_AD1816A_H */ 173#endif /* __SOUND_AD1816A_H */
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index 7e33b11037f2..1a2759f3a292 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -127,7 +127,7 @@
127#define AD1848_THINKPAD_CTL_PORT2 0x15e9 127#define AD1848_THINKPAD_CTL_PORT2 0x15e9
128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02 128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
129 129
130struct _snd_ad1848 { 130struct snd_ad1848 {
131 unsigned long port; /* i/o port */ 131 unsigned long port; /* i/o port */
132 struct resource *res_port; 132 struct resource *res_port;
133 int irq; /* IRQ line */ 133 int irq; /* IRQ line */
@@ -137,10 +137,10 @@ struct _snd_ad1848 {
137 unsigned short hardware; /* see to AD1848_HW_XXXX */ 137 unsigned short hardware; /* see to AD1848_HW_XXXX */
138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ 138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
139 139
140 snd_pcm_t *pcm; 140 struct snd_pcm *pcm;
141 snd_pcm_substream_t *playback_substream; 141 struct snd_pcm_substream *playback_substream;
142 snd_pcm_substream_t *capture_substream; 142 struct snd_pcm_substream *capture_substream;
143 snd_card_t *card; 143 struct snd_card *card;
144 144
145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */ 145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */
146 int mce_bit; 146 int mce_bit;
@@ -148,25 +148,28 @@ struct _snd_ad1848 {
148 int dma_size; 148 int dma_size;
149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */ 149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */
150 150
151#ifdef CONFIG_PM
152 void (*suspend)(struct snd_ad1848 *chip);
153 void (*resume)(struct snd_ad1848 *chip);
154#endif
155
151 spinlock_t reg_lock; 156 spinlock_t reg_lock;
152 struct semaphore open_mutex; 157 struct semaphore open_mutex;
153}; 158};
154 159
155typedef struct _snd_ad1848 ad1848_t;
156
157/* exported functions */ 160/* exported functions */
158 161
159void snd_ad1848_out(ad1848_t *chip, unsigned char reg, unsigned char value); 162void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value);
160 163
161int snd_ad1848_create(snd_card_t * card, 164int snd_ad1848_create(struct snd_card *card,
162 unsigned long port, 165 unsigned long port,
163 int irq, int dma, 166 int irq, int dma,
164 unsigned short hardware, 167 unsigned short hardware,
165 ad1848_t ** chip); 168 struct snd_ad1848 ** chip);
166 169
167int snd_ad1848_pcm(ad1848_t * chip, int device, snd_pcm_t **rpcm); 170int snd_ad1848_pcm(struct snd_ad1848 * chip, int device, struct snd_pcm **rpcm);
168const snd_pcm_ops_t *snd_ad1848_get_pcm_ops(int direction); 171const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction);
169int snd_ad1848_mixer(ad1848_t * chip); 172int snd_ad1848_mixer(struct snd_ad1848 * chip);
170 173
171/* exported mixer stuffs */ 174/* exported mixer stuffs */
172enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE }; 175enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
@@ -176,7 +179,7 @@ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
176#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ 179#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \
177 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) 180 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22))
178 181
179int snd_ad1848_add_ctl(ad1848_t *chip, const char *name, int index, int type, unsigned long value); 182int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value);
180 183
181/* for ease of use */ 184/* for ease of use */
182struct ad1848_mix_elem { 185struct ad1848_mix_elem {
@@ -198,7 +201,7 @@ struct ad1848_mix_elem {
198 .type = AD1848_MIX_DOUBLE, \ 201 .type = AD1848_MIX_DOUBLE, \
199 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } 202 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
200 203
201static inline int snd_ad1848_add_ctl_elem(ad1848_t *chip, const struct ad1848_mix_elem *c) 204static inline int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c)
202{ 205{
203 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value); 206 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value);
204} 207}
diff --git a/include/sound/ainstr_fm.h b/include/sound/ainstr_fm.h
index 0ec02953815a..c4afb1f121fe 100644
--- a/include/sound/ainstr_fm.h
+++ b/include/sound/ainstr_fm.h
@@ -39,13 +39,13 @@
39 * FM operator 39 * FM operator
40 */ 40 */
41 41
42typedef struct fm_operator { 42struct fm_operator {
43 unsigned char am_vib; 43 unsigned char am_vib;
44 unsigned char ksl_level; 44 unsigned char ksl_level;
45 unsigned char attack_decay; 45 unsigned char attack_decay;
46 unsigned char sustain_release; 46 unsigned char sustain_release;
47 unsigned char wave_select; 47 unsigned char wave_select;
48} fm_operator_t; 48};
49 49
50/* 50/*
51 * Instrument 51 * Instrument
@@ -54,11 +54,11 @@ typedef struct fm_operator {
54#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ 54#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
55#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ 55#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
56 56
57typedef struct { 57struct fm_instrument {
58 unsigned int share_id[4]; /* share id - zero = no sharing */ 58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned char type; /* instrument type */ 59 unsigned char type; /* instrument type */
60 60
61 fm_operator_t op[4]; 61 struct fm_operator op[4];
62 unsigned char feedback_connection[2]; 62 unsigned char feedback_connection[2];
63 63
64 unsigned char echo_delay; 64 unsigned char echo_delay;
@@ -68,7 +68,7 @@ typedef struct {
68 unsigned char fix_dur; 68 unsigned char fix_dur;
69 unsigned char modes; 69 unsigned char modes;
70 unsigned char fix_key; 70 unsigned char fix_key;
71} fm_instrument_t; 71};
72 72
73/* 73/*
74 * 74 *
@@ -88,25 +88,25 @@ typedef struct {
88 * FM operator 88 * FM operator
89 */ 89 */
90 90
91typedef struct fm_xoperator { 91struct fm_xoperator {
92 __u8 am_vib; 92 __u8 am_vib;
93 __u8 ksl_level; 93 __u8 ksl_level;
94 __u8 attack_decay; 94 __u8 attack_decay;
95 __u8 sustain_release; 95 __u8 sustain_release;
96 __u8 wave_select; 96 __u8 wave_select;
97} fm_xoperator_t; 97};
98 98
99/* 99/*
100 * Instrument 100 * Instrument
101 */ 101 */
102 102
103typedef struct fm_xinstrument { 103struct fm_xinstrument {
104 __u32 stype; /* structure type */ 104 __u32 stype; /* structure type */
105 105
106 __u32 share_id[4]; /* share id - zero = no sharing */ 106 __u32 share_id[4]; /* share id - zero = no sharing */
107 __u8 type; /* instrument type */ 107 __u8 type; /* instrument type */
108 108
109 fm_xoperator_t op[4]; /* fm operators */ 109 struct fm_xoperator op[4]; /* fm operators */
110 __u8 feedback_connection[2]; 110 __u8 feedback_connection[2];
111 111
112 __u8 echo_delay; 112 __u8 echo_delay;
@@ -116,15 +116,19 @@ typedef struct fm_xinstrument {
116 __u8 fix_dur; 116 __u8 fix_dur;
117 __u8 modes; 117 __u8 modes;
118 __u8 fix_key; 118 __u8 fix_key;
119} fm_xinstrument_t; 119};
120 120
121#ifdef __KERNEL__ 121#ifdef __KERNEL__
122 122
123#include "seq_instr.h" 123#include "seq_instr.h"
124 124
125int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops, 125int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops,
126 snd_seq_kinstr_ops_t * next); 126 struct snd_seq_kinstr_ops * next);
127 127
128#endif 128#endif
129 129
130/* typedefs for compatibility to user-space */
131typedef struct fm_xoperator fm_xoperator_t;
132typedef struct fm_xinstrument fm_xinstrument_t;
133
130#endif /* __SOUND_AINSTR_FM_H */ 134#endif /* __SOUND_AINSTR_FM_H */
diff --git a/include/sound/ainstr_gf1.h b/include/sound/ainstr_gf1.h
index ae2ddda63971..47726fe0f46d 100644
--- a/include/sound/ainstr_gf1.h
+++ b/include/sound/ainstr_gf1.h
@@ -52,7 +52,7 @@
52 * Wavetable definitions 52 * Wavetable definitions
53 */ 53 */
54 54
55typedef struct gf1_wave { 55struct gf1_wave {
56 unsigned int share_id[4]; /* share id - zero = no sharing */ 56 unsigned int share_id[4]; /* share id - zero = no sharing */
57 unsigned int format; /* wave format */ 57 unsigned int format; /* wave format */
58 58
@@ -88,7 +88,7 @@ typedef struct gf1_wave {
88 unsigned short scale_factor; /* 0-2048 or 0-2 */ 88 unsigned short scale_factor; /* 0-2048 or 0-2 */
89 89
90 struct gf1_wave *next; 90 struct gf1_wave *next;
91} gf1_wave_t; 91};
92 92
93/* 93/*
94 * Instrument 94 * Instrument
@@ -103,7 +103,7 @@ typedef struct gf1_wave {
103#define IWFFFF_EFFECT_CHORUS 2 103#define IWFFFF_EFFECT_CHORUS 2
104#define IWFFFF_EFFECT_ECHO 3 104#define IWFFFF_EFFECT_ECHO 3
105 105
106typedef struct { 106struct gf1_instrument {
107 unsigned short exclusion; 107 unsigned short exclusion;
108 unsigned short exclusion_group; /* 0 - none, 1-65535 */ 108 unsigned short exclusion_group; /* 0 - none, 1-65535 */
109 109
@@ -112,8 +112,8 @@ typedef struct {
112 unsigned char effect2; /* effect 2 */ 112 unsigned char effect2; /* effect 2 */
113 unsigned char effect2_depth; /* 0-127 */ 113 unsigned char effect2_depth; /* 0-127 */
114 114
115 gf1_wave_t *wave; /* first waveform */ 115 struct gf1_wave *wave; /* first waveform */
116} gf1_instrument_t; 116};
117 117
118/* 118/*
119 * 119 *
@@ -135,7 +135,7 @@ typedef struct {
135 * Wavetable definitions 135 * Wavetable definitions
136 */ 136 */
137 137
138typedef struct gf1_xwave { 138struct gf1_xwave {
139 __u32 stype; /* structure type */ 139 __u32 stype; /* structure type */
140 140
141 __u32 share_id[4]; /* share id - zero = no sharing */ 141 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -165,13 +165,13 @@ typedef struct gf1_xwave {
165 __u8 vibrato_depth; 165 __u8 vibrato_depth;
166 __u16 scale_frequency; 166 __u16 scale_frequency;
167 __u16 scale_factor; /* 0-2048 or 0-2 */ 167 __u16 scale_factor; /* 0-2048 or 0-2 */
168} gf1_xwave_t; 168};
169 169
170/* 170/*
171 * Instrument 171 * Instrument
172 */ 172 */
173 173
174typedef struct gf1_xinstrument { 174struct gf1_xinstrument {
175 __u32 stype; 175 __u32 stype;
176 176
177 __u16 exclusion; 177 __u16 exclusion;
@@ -181,7 +181,7 @@ typedef struct gf1_xinstrument {
181 __u8 effect1_depth; /* 0-127 */ 181 __u8 effect1_depth; /* 0-127 */
182 __u8 effect2; /* effect 2 */ 182 __u8 effect2; /* effect 2 */
183 __u8 effect2_depth; /* 0-127 */ 183 __u8 effect2_depth; /* 0-127 */
184} gf1_xinstrument_t; 184};
185 185
186/* 186/*
187 * Instrument info 187 * Instrument info
@@ -191,35 +191,39 @@ typedef struct gf1_xinstrument {
191#define GF1_INFO_TREMOLO (1<<1) 191#define GF1_INFO_TREMOLO (1<<1)
192#define GF1_INFO_VIBRATO (1<<2) 192#define GF1_INFO_VIBRATO (1<<2)
193 193
194typedef struct gf1_info { 194struct gf1_info {
195 unsigned char flags; /* supported wave flags */ 195 unsigned char flags; /* supported wave flags */
196 unsigned char pad[3]; 196 unsigned char pad[3];
197 unsigned int features; /* supported features */ 197 unsigned int features; /* supported features */
198 unsigned int max8_len; /* maximum 8-bit wave length */ 198 unsigned int max8_len; /* maximum 8-bit wave length */
199 unsigned int max16_len; /* maximum 16-bit wave length */ 199 unsigned int max16_len; /* maximum 16-bit wave length */
200} gf1_info_t; 200};
201 201
202#ifdef __KERNEL__ 202#ifdef __KERNEL__
203 203
204#include "seq_instr.h" 204#include "seq_instr.h"
205 205
206typedef struct { 206struct snd_gf1_ops {
207 void *private_data; 207 void *private_data;
208 int (*info)(void *private_data, gf1_info_t *info); 208 int (*info)(void *private_data, struct gf1_info *info);
209 int (*put_sample)(void *private_data, gf1_wave_t *wave, 209 int (*put_sample)(void *private_data, struct gf1_wave *wave,
210 char __user *data, long len, int atomic); 210 char __user *data, long len, int atomic);
211 int (*get_sample)(void *private_data, gf1_wave_t *wave, 211 int (*get_sample)(void *private_data, struct gf1_wave *wave,
212 char __user *data, long len, int atomic); 212 char __user *data, long len, int atomic);
213 int (*remove_sample)(void *private_data, gf1_wave_t *wave, 213 int (*remove_sample)(void *private_data, struct gf1_wave *wave,
214 int atomic); 214 int atomic);
215 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 215 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
216 snd_seq_kinstr_ops_t kops; 216 struct snd_seq_kinstr_ops kops;
217} snd_gf1_ops_t; 217};
218 218
219int snd_seq_gf1_init(snd_gf1_ops_t *ops, 219int snd_seq_gf1_init(struct snd_gf1_ops *ops,
220 void *private_data, 220 void *private_data,
221 snd_seq_kinstr_ops_t *next); 221 struct snd_seq_kinstr_ops *next);
222 222
223#endif 223#endif
224 224
225/* typedefs for compatibility to user-space */
226typedef struct gf1_xwave gf1_xwave_t;
227typedef struct gf1_xinstrument gf1_xinstrument_t;
228
225#endif /* __SOUND_AINSTR_GF1_H */ 229#endif /* __SOUND_AINSTR_GF1_H */
diff --git a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h
index 8adf744926ff..251feaf1b388 100644
--- a/include/sound/ainstr_iw.h
+++ b/include/sound/ainstr_iw.h
@@ -54,7 +54,7 @@
54 * Wavetable definitions 54 * Wavetable definitions
55 */ 55 */
56 56
57typedef struct iwffff_wave { 57struct iwffff_wave {
58 unsigned int share_id[4]; /* share id - zero = no sharing */ 58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned int format; /* wave format */ 59 unsigned int format; /* wave format */
60 60
@@ -76,7 +76,7 @@ typedef struct iwffff_wave {
76 unsigned char pad; 76 unsigned char pad;
77 77
78 struct iwffff_wave *next; 78 struct iwffff_wave *next;
79} iwffff_wave_t; 79};
80 80
81/* 81/*
82 * Layer 82 * Layer
@@ -85,13 +85,13 @@ typedef struct iwffff_wave {
85#define IWFFFF_LFO_SHAPE_TRIANGLE 0 85#define IWFFFF_LFO_SHAPE_TRIANGLE 0
86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1 86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
87 87
88typedef struct iwffff_lfo { 88struct iwffff_lfo {
89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */ 89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
90 signed short depth; /* volume +- (0-255) 0.48675dB/step */ 90 signed short depth; /* volume +- (0-255) 0.48675dB/step */
91 signed short sweep; /* 0 - 950 deciseconds */ 91 signed short sweep; /* 0 - 950 deciseconds */
92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */ 92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
93 unsigned char delay; /* 0 - 255 deciseconds */ 93 unsigned char delay; /* 0 - 255 deciseconds */
94} iwffff_lfo_t; 94};
95 95
96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */ 96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
97 97
@@ -102,12 +102,12 @@ typedef struct iwffff_lfo {
102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */ 102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */ 103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
104 104
105typedef struct iwffff_env_point { 105struct iwffff_env_point {
106 unsigned short offset; 106 unsigned short offset;
107 unsigned short rate; 107 unsigned short rate;
108} iwffff_env_point_t; 108};
109 109
110typedef struct iwffff_env_record { 110struct iwffff_env_record {
111 unsigned short nattack; 111 unsigned short nattack;
112 unsigned short nrelease; 112 unsigned short nrelease;
113 unsigned short sustain_offset; 113 unsigned short sustain_offset;
@@ -118,15 +118,15 @@ typedef struct iwffff_env_record {
118 struct iwffff_env_record *next; 118 struct iwffff_env_record *next;
119 /* points are stored here */ 119 /* points are stored here */
120 /* count of points = nattack + nrelease */ 120 /* count of points = nattack + nrelease */
121} iwffff_env_record_t; 121};
122 122
123typedef struct iwffff_env { 123struct iwffff_env {
124 unsigned char flags; 124 unsigned char flags;
125 unsigned char mode; 125 unsigned char mode;
126 unsigned char index; 126 unsigned char index;
127 unsigned char pad; 127 unsigned char pad;
128 struct iwffff_env_record *record; 128 struct iwffff_env_record *record;
129} iwffff_env_t; 129};
130 130
131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */ 131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
132 132
@@ -138,7 +138,7 @@ typedef struct iwffff_env {
138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */ 138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */ 139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
140 140
141typedef struct iwffff_layer { 141struct iwffff_layer {
142 unsigned char flags; 142 unsigned char flags;
143 unsigned char velocity_mode; 143 unsigned char velocity_mode;
144 unsigned char layer_event; 144 unsigned char layer_event;
@@ -147,17 +147,17 @@ typedef struct iwffff_layer {
147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */ 147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */ 148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */
149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */ 149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
150 iwffff_lfo_t tremolo; /* tremolo effect */ 150 struct iwffff_lfo tremolo; /* tremolo effect */
151 iwffff_lfo_t vibrato; /* vibrato effect */ 151 struct iwffff_lfo vibrato; /* vibrato effect */
152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ 152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
153 unsigned char freq_center; /* center for keyboard frequency scaling */ 153 unsigned char freq_center; /* center for keyboard frequency scaling */
154 unsigned char pad; 154 unsigned char pad;
155 iwffff_env_t penv; /* pitch envelope */ 155 struct iwffff_env penv; /* pitch envelope */
156 iwffff_env_t venv; /* volume envelope */ 156 struct iwffff_env venv; /* volume envelope */
157 157
158 iwffff_wave_t *wave; 158 struct iwffff_wave *wave;
159 struct iwffff_layer *next; 159 struct iwffff_layer *next;
160} iwffff_layer_t; 160};
161 161
162/* 162/*
163 * Instrument 163 * Instrument
@@ -177,7 +177,7 @@ typedef struct iwffff_layer {
177#define IWFFFF_EFFECT_CHORUS 2 177#define IWFFFF_EFFECT_CHORUS 2
178#define IWFFFF_EFFECT_ECHO 3 178#define IWFFFF_EFFECT_ECHO 3
179 179
180typedef struct { 180struct iwffff_instrument {
181 unsigned short exclusion; 181 unsigned short exclusion;
182 unsigned short layer_type; 182 unsigned short layer_type;
183 unsigned short exclusion_group; /* 0 - none, 1-65535 */ 183 unsigned short exclusion_group; /* 0 - none, 1-65535 */
@@ -187,8 +187,8 @@ typedef struct {
187 unsigned char effect2; /* effect 2 */ 187 unsigned char effect2; /* effect 2 */
188 unsigned char effect2_depth; /* 0-127 */ 188 unsigned char effect2_depth; /* 0-127 */
189 189
190 iwffff_layer_t *layer; /* first layer */ 190 struct iwffff_layer *layer; /* first layer */
191} iwffff_instrument_t; 191};
192 192
193/* 193/*
194 * 194 *
@@ -216,7 +216,7 @@ typedef struct {
216 * Wavetable definitions 216 * Wavetable definitions
217 */ 217 */
218 218
219typedef struct iwffff_xwave { 219struct iwffff_xwave {
220 __u32 stype; /* structure type */ 220 __u32 stype; /* structure type */
221 221
222 __u32 share_id[4]; /* share id - zero = no sharing */ 222 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -234,26 +234,26 @@ typedef struct iwffff_xwave {
234 __u8 low_note; /* lower frequency range for this waveform */ 234 __u8 low_note; /* lower frequency range for this waveform */
235 __u8 high_note; /* higher frequency range for this waveform */ 235 __u8 high_note; /* higher frequency range for this waveform */
236 __u8 pad; 236 __u8 pad;
237} iwffff_xwave_t; 237};
238 238
239/* 239/*
240 * Layer 240 * Layer
241 */ 241 */
242 242
243typedef struct iwffff_xlfo { 243struct iwffff_xlfo {
244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */ 244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */ 245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */
246 __s16 sweep; /* 0 - 950 deciseconds */ 246 __s16 sweep; /* 0 - 950 deciseconds */
247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */ 247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
248 __u8 delay; /* 0 - 255 deciseconds */ 248 __u8 delay; /* 0 - 255 deciseconds */
249} iwffff_xlfo_t; 249};
250 250
251typedef struct iwffff_xenv_point { 251struct iwffff_xenv_point {
252 __u16 offset; 252 __u16 offset;
253 __u16 rate; 253 __u16 rate;
254} iwffff_xenv_point_t; 254};
255 255
256typedef struct iwffff_xenv_record { 256struct iwffff_xenv_record {
257 __u32 stype; 257 __u32 stype;
258 __u16 nattack; 258 __u16 nattack;
259 __u16 nrelease; 259 __u16 nrelease;
@@ -264,16 +264,16 @@ typedef struct iwffff_xenv_record {
264 __u8 pad; 264 __u8 pad;
265 /* points are stored here.. */ 265 /* points are stored here.. */
266 /* count of points = nattack + nrelease */ 266 /* count of points = nattack + nrelease */
267} iwffff_xenv_record_t; 267};
268 268
269typedef struct iwffff_xenv { 269struct iwffff_xenv {
270 __u8 flags; 270 __u8 flags;
271 __u8 mode; 271 __u8 mode;
272 __u8 index; 272 __u8 index;
273 __u8 pad; 273 __u8 pad;
274} iwffff_xenv_t; 274};
275 275
276typedef struct iwffff_xlayer { 276struct iwffff_xlayer {
277 __u32 stype; 277 __u32 stype;
278 __u8 flags; 278 __u8 flags;
279 __u8 velocity_mode; 279 __u8 velocity_mode;
@@ -283,20 +283,20 @@ typedef struct iwffff_xlayer {
283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */ 283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
284 __u8 pan_freq_scale; /* position based on frequency (0-127) */ 284 __u8 pan_freq_scale; /* position based on frequency (0-127) */
285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */ 285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */
286 iwffff_xlfo_t tremolo; /* tremolo effect */ 286 struct iwffff_xlfo tremolo; /* tremolo effect */
287 iwffff_xlfo_t vibrato; /* vibrato effect */ 287 struct iwffff_xlfo vibrato; /* vibrato effect */
288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ 288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
289 __u8 freq_center; /* center for keyboard frequency scaling */ 289 __u8 freq_center; /* center for keyboard frequency scaling */
290 __u8 pad; 290 __u8 pad;
291 iwffff_xenv_t penv; /* pitch envelope */ 291 struct iwffff_xenv penv; /* pitch envelope */
292 iwffff_xenv_t venv; /* volume envelope */ 292 struct iwffff_xenv venv; /* volume envelope */
293} iwffff_xlayer_t; 293};
294 294
295/* 295/*
296 * Instrument 296 * Instrument
297 */ 297 */
298 298
299typedef struct iwffff_xinstrument { 299struct iwffff_xinstrument {
300 __u32 stype; 300 __u32 stype;
301 301
302 __u16 exclusion; 302 __u16 exclusion;
@@ -307,7 +307,7 @@ typedef struct iwffff_xinstrument {
307 __u8 effect1_depth; /* 0-127 */ 307 __u8 effect1_depth; /* 0-127 */
308 __u8 effect2; /* effect 2 */ 308 __u8 effect2; /* effect 2 */
309 __u8 effect2_depth; /* 0-127 */ 309 __u8 effect2_depth; /* 0-127 */
310} iwffff_xinstrument_t; 310};
311 311
312/* 312/*
313 * ROM support 313 * ROM support
@@ -316,7 +316,7 @@ typedef struct iwffff_xinstrument {
316 316
317#define IWFFFF_ROM_HDR_SIZE 512 317#define IWFFFF_ROM_HDR_SIZE 512
318 318
319typedef struct { 319struct iwffff_rom_header {
320 __u8 iwave[8]; 320 __u8 iwave[8];
321 __u8 revision; 321 __u8 revision;
322 __u8 series_number; 322 __u8 series_number;
@@ -328,7 +328,7 @@ typedef struct {
328 __u8 copyright[128]; 328 __u8 copyright[128];
329 __u8 vendor_name[64]; 329 __u8 vendor_name[64];
330 __u8 description[128]; 330 __u8 description[128];
331} iwffff_rom_header_t; 331};
332 332
333/* 333/*
334 * Instrument info 334 * Instrument info
@@ -339,35 +339,46 @@ typedef struct {
339#define IWFFFF_INFO_LFO_TREMOLO (1<<2) 339#define IWFFFF_INFO_LFO_TREMOLO (1<<2)
340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3) 340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
341 341
342typedef struct iwffff_info { 342struct iwffff_info {
343 unsigned int format; /* supported format bits */ 343 unsigned int format; /* supported format bits */
344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */ 344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
345 unsigned int lfos; /* LFO effects */ 345 unsigned int lfos; /* LFO effects */
346 unsigned int max8_len; /* maximum 8-bit wave length */ 346 unsigned int max8_len; /* maximum 8-bit wave length */
347 unsigned int max16_len; /* maximum 16-bit wave length */ 347 unsigned int max16_len; /* maximum 16-bit wave length */
348} iwffff_info_t; 348};
349 349
350#ifdef __KERNEL__ 350#ifdef __KERNEL__
351 351
352#include "seq_instr.h" 352#include "seq_instr.h"
353 353
354typedef struct { 354struct snd_iwffff_ops {
355 void *private_data; 355 void *private_data;
356 int (*info)(void *private_data, iwffff_info_t *info); 356 int (*info)(void *private_data, struct iwffff_info *info);
357 int (*put_sample)(void *private_data, iwffff_wave_t *wave, 357 int (*put_sample)(void *private_data, struct iwffff_wave *wave,
358 char __user *data, long len, int atomic); 358 char __user *data, long len, int atomic);
359 int (*get_sample)(void *private_data, iwffff_wave_t *wave, 359 int (*get_sample)(void *private_data, struct iwffff_wave *wave,
360 char __user *data, long len, int atomic); 360 char __user *data, long len, int atomic);
361 int (*remove_sample)(void *private_data, iwffff_wave_t *wave, 361 int (*remove_sample)(void *private_data, struct iwffff_wave *wave,
362 int atomic); 362 int atomic);
363 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 363 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
364 snd_seq_kinstr_ops_t kops; 364 struct snd_seq_kinstr_ops kops;
365} snd_iwffff_ops_t; 365};
366 366
367int snd_seq_iwffff_init(snd_iwffff_ops_t *ops, 367int snd_seq_iwffff_init(struct snd_iwffff_ops *ops,
368 void *private_data, 368 void *private_data,
369 snd_seq_kinstr_ops_t *next); 369 struct snd_seq_kinstr_ops *next);
370 370
371#endif 371#endif
372 372
373/* typedefs for compatibility to user-space */
374typedef struct iwffff_xwave iwffff_xwave_t;
375typedef struct iwffff_xlfo iwffff_xlfo_t;
376typedef struct iwffff_xenv_point iwffff_xenv_point_t;
377typedef struct iwffff_xenv_record iwffff_xenv_record_t;
378typedef struct iwffff_xenv iwffff_xenv_t;
379typedef struct iwffff_xlayer iwffff_xlayer_t;
380typedef struct iwffff_xinstrument iwffff_xinstrument_t;
381typedef struct iwffff_rom_header iwffff_rom_header_t;
382typedef struct iwffff_info iwffff_info_t;
383
373#endif /* __SOUND_AINSTR_IW_H */ 384#endif /* __SOUND_AINSTR_IW_H */
diff --git a/include/sound/ainstr_simple.h b/include/sound/ainstr_simple.h
index 40824b4ab23d..5eead12e58ae 100644
--- a/include/sound/ainstr_simple.h
+++ b/include/sound/ainstr_simple.h
@@ -61,18 +61,18 @@
61 * instrument info 61 * instrument info
62 */ 62 */
63 63
64typedef struct simple_instrument_info { 64struct simple_instrument_info {
65 unsigned int format; /* supported format bits */ 65 unsigned int format; /* supported format bits */
66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */ 66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
67 unsigned int max8_len; /* maximum 8-bit wave length */ 67 unsigned int max8_len; /* maximum 8-bit wave length */
68 unsigned int max16_len; /* maximum 16-bit wave length */ 68 unsigned int max16_len; /* maximum 16-bit wave length */
69} simple_instrument_info_t; 69};
70 70
71/* 71/*
72 * Instrument 72 * Instrument
73 */ 73 */
74 74
75typedef struct { 75struct simple_instrument {
76 unsigned int share_id[4]; /* share id - zero = no sharing */ 76 unsigned int share_id[4]; /* share id - zero = no sharing */
77 unsigned int format; /* wave format */ 77 unsigned int format; /* wave format */
78 78
@@ -92,7 +92,7 @@ typedef struct {
92 unsigned char effect1_depth; /* 0-127 */ 92 unsigned char effect1_depth; /* 0-127 */
93 unsigned char effect2; /* effect 2 */ 93 unsigned char effect2; /* effect 2 */
94 unsigned char effect2_depth; /* 0-127 */ 94 unsigned char effect2_depth; /* 0-127 */
95} simple_instrument_t; 95};
96 96
97/* 97/*
98 * 98 *
@@ -112,7 +112,7 @@ typedef struct {
112 * Instrument 112 * Instrument
113 */ 113 */
114 114
115typedef struct simple_xinstrument { 115struct simple_xinstrument {
116 __u32 stype; 116 __u32 stype;
117 117
118 __u32 share_id[4]; /* share id - zero = no sharing */ 118 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -128,29 +128,32 @@ typedef struct simple_xinstrument {
128 __u8 effect1_depth; /* 0-127 */ 128 __u8 effect1_depth; /* 0-127 */
129 __u8 effect2; /* effect 2 */ 129 __u8 effect2; /* effect 2 */
130 __u8 effect2_depth; /* 0-127 */ 130 __u8 effect2_depth; /* 0-127 */
131} simple_xinstrument_t; 131};
132 132
133#ifdef __KERNEL__ 133#ifdef __KERNEL__
134 134
135#include "seq_instr.h" 135#include "seq_instr.h"
136 136
137typedef struct { 137struct snd_simple_ops {
138 void *private_data; 138 void *private_data;
139 int (*info)(void *private_data, simple_instrument_info_t *info); 139 int (*info)(void *private_data, struct simple_instrument_info *info);
140 int (*put_sample)(void *private_data, simple_instrument_t *instr, 140 int (*put_sample)(void *private_data, struct simple_instrument *instr,
141 char __user *data, long len, int atomic); 141 char __user *data, long len, int atomic);
142 int (*get_sample)(void *private_data, simple_instrument_t *instr, 142 int (*get_sample)(void *private_data, struct simple_instrument *instr,
143 char __user *data, long len, int atomic); 143 char __user *data, long len, int atomic);
144 int (*remove_sample)(void *private_data, simple_instrument_t *instr, 144 int (*remove_sample)(void *private_data, struct simple_instrument *instr,
145 int atomic); 145 int atomic);
146 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 146 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
147 snd_seq_kinstr_ops_t kops; 147 struct snd_seq_kinstr_ops kops;
148} snd_simple_ops_t; 148};
149 149
150int snd_seq_simple_init(snd_simple_ops_t *ops, 150int snd_seq_simple_init(struct snd_simple_ops *ops,
151 void *private_data, 151 void *private_data,
152 snd_seq_kinstr_ops_t *next); 152 struct snd_seq_kinstr_ops *next);
153 153
154#endif 154#endif
155 155
156/* typedefs for compatibility to user-space */
157typedef struct simple_xinstrument simple_xinstrument_t;
158
156#endif /* __SOUND_AINSTR_SIMPLE_H */ 159#endif /* __SOUND_AINSTR_SIMPLE_H */
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
index f3f2c3e5ae51..11702aa0bea9 100644
--- a/include/sound/ak4114.h
+++ b/include/sound/ak4114.h
@@ -163,10 +163,8 @@
163typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data); 163typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data);
164typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr); 164typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr);
165 165
166typedef struct ak4114 ak4114_t;
167
168struct ak4114 { 166struct ak4114 {
169 snd_card_t * card; 167 struct snd_card *card;
170 ak4114_write_t * write; 168 ak4114_write_t * write;
171 ak4114_read_t * read; 169 ak4114_read_t * read;
172 void * private_data; 170 void * private_data;
@@ -174,9 +172,9 @@ struct ak4114 {
174 spinlock_t lock; 172 spinlock_t lock;
175 unsigned char regmap[7]; 173 unsigned char regmap[7];
176 unsigned char txcsb[5]; 174 unsigned char txcsb[5];
177 snd_kcontrol_t *kctls[AK4114_CONTROLS]; 175 struct snd_kcontrol *kctls[AK4114_CONTROLS];
178 snd_pcm_substream_t *playback_substream; 176 struct snd_pcm_substream *playback_substream;
179 snd_pcm_substream_t *capture_substream; 177 struct snd_pcm_substream *capture_substream;
180 unsigned long parity_errors; 178 unsigned long parity_errors;
181 unsigned long v_bit_errors; 179 unsigned long v_bit_errors;
182 unsigned long qcrc_errors; 180 unsigned long qcrc_errors;
@@ -186,20 +184,20 @@ struct ak4114 {
186 struct workqueue_struct *workqueue; 184 struct workqueue_struct *workqueue;
187 struct work_struct work; 185 struct work_struct work;
188 void *change_callback_private; 186 void *change_callback_private;
189 void (*change_callback)(ak4114_t *ak4114, unsigned char c0, unsigned char c1); 187 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1);
190}; 188};
191 189
192int snd_ak4114_create(snd_card_t *card, 190int snd_ak4114_create(struct snd_card *card,
193 ak4114_read_t *read, ak4114_write_t *write, 191 ak4114_read_t *read, ak4114_write_t *write,
194 unsigned char pgm[7], unsigned char txcsb[5], 192 unsigned char pgm[7], unsigned char txcsb[5],
195 void *private_data, ak4114_t **r_ak4114); 193 void *private_data, struct ak4114 **r_ak4114);
196void snd_ak4114_reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char mask, unsigned char val); 194void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val);
197void snd_ak4114_reinit(ak4114_t *ak4114); 195void snd_ak4114_reinit(struct ak4114 *ak4114);
198int snd_ak4114_build(ak4114_t *ak4114, 196int snd_ak4114_build(struct ak4114 *ak4114,
199 snd_pcm_substream_t *playback_substream, 197 struct snd_pcm_substream *playback_substream,
200 snd_pcm_substream_t *capture_substream); 198 struct snd_pcm_substream *capture_substream);
201int snd_ak4114_external_rate(ak4114_t *ak4114); 199int snd_ak4114_external_rate(struct ak4114 *ak4114);
202int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags); 200int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags);
203 201
204#endif /* __SOUND_AK4114_H */ 202#endif /* __SOUND_AK4114_H */
205 203
diff --git a/include/sound/ak4117.h b/include/sound/ak4117.h
index 9e1dab17c33e..2b96c32f06fd 100644
--- a/include/sound/ak4117.h
+++ b/include/sound/ak4117.h
@@ -155,18 +155,16 @@
155typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data); 155typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data);
156typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr); 156typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr);
157 157
158typedef struct ak4117 ak4117_t;
159
160struct ak4117 { 158struct ak4117 {
161 snd_card_t * card; 159 struct snd_card *card;
162 ak4117_write_t * write; 160 ak4117_write_t * write;
163 ak4117_read_t * read; 161 ak4117_read_t * read;
164 void * private_data; 162 void * private_data;
165 unsigned int init: 1; 163 unsigned int init: 1;
166 spinlock_t lock; 164 spinlock_t lock;
167 unsigned char regmap[5]; 165 unsigned char regmap[5];
168 snd_kcontrol_t *kctls[AK4117_CONTROLS]; 166 struct snd_kcontrol *kctls[AK4117_CONTROLS];
169 snd_pcm_substream_t *substream; 167 struct snd_pcm_substream *substream;
170 unsigned long parity_errors; 168 unsigned long parity_errors;
171 unsigned long v_bit_errors; 169 unsigned long v_bit_errors;
172 unsigned long qcrc_errors; 170 unsigned long qcrc_errors;
@@ -176,16 +174,16 @@ struct ak4117 {
176 unsigned char rcs2; 174 unsigned char rcs2;
177 struct timer_list timer; /* statistic timer */ 175 struct timer_list timer; /* statistic timer */
178 void *change_callback_private; 176 void *change_callback_private;
179 void (*change_callback)(ak4117_t *ak4117, unsigned char c0, unsigned char c1); 177 void (*change_callback)(struct ak4117 *ak4117, unsigned char c0, unsigned char c1);
180}; 178};
181 179
182int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *write, 180int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write,
183 unsigned char pgm[5], void *private_data, ak4117_t **r_ak4117); 181 unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117);
184void snd_ak4117_reg_write(ak4117_t *ak4117, unsigned char reg, unsigned char mask, unsigned char val); 182void snd_ak4117_reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char mask, unsigned char val);
185void snd_ak4117_reinit(ak4117_t *ak4117); 183void snd_ak4117_reinit(struct ak4117 *ak4117);
186int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *capture_substream); 184int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *capture_substream);
187int snd_ak4117_external_rate(ak4117_t *ak4117); 185int snd_ak4117_external_rate(struct ak4117 *ak4117);
188int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags); 186int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags);
189 187
190#endif /* __SOUND_AK4117_H */ 188#endif /* __SOUND_AK4117_H */
191 189
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index 8b18992376d5..edf04070ce7c 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -64,17 +64,22 @@
64#define AK4531_AD_IN 0x18 /* AD input select */ 64#define AK4531_AD_IN 0x18 /* AD input select */
65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */ 65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */
66 66
67typedef struct _snd_ak4531 ak4531_t; 67struct snd_ak4531 {
68 68 void (*write) (struct snd_ak4531 *ak4531, unsigned short reg,
69struct _snd_ak4531 { 69 unsigned short val);
70 void (*write) (ak4531_t *ak4531, unsigned short reg, unsigned short val);
71 void *private_data; 70 void *private_data;
72 void (*private_free) (ak4531_t *ak4531); 71 void (*private_free) (struct snd_ak4531 *ak4531);
73 /* --- */ 72 /* --- */
74 unsigned char regs[0x20]; 73 unsigned char regs[0x20];
75 struct semaphore reg_mutex; 74 struct semaphore reg_mutex;
76}; 75};
77 76
78int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531); 77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
78 struct snd_ak4531 **rak4531);
79
80#ifdef CONFIG_PM
81void snd_ak4531_suspend(struct snd_ak4531 *ak4531);
82void snd_ak4531_resume(struct snd_ak4531 *ak4531);
83#endif
79 84
80#endif /* __SOUND_AK4531_CODEC_H */ 85#endif /* __SOUND_AK4531_CODEC_H */
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index e94ac0282318..3bf5911fe827 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -27,20 +27,20 @@
27#define AK4XXX_MAX_CHIPS 4 27#define AK4XXX_MAX_CHIPS 4
28#endif 28#endif
29 29
30typedef struct snd_akm4xxx akm4xxx_t; 30struct snd_akm4xxx;
31 31
32struct snd_ak4xxx_ops { 32struct snd_ak4xxx_ops {
33 void (*lock)(akm4xxx_t *ak, int chip); 33 void (*lock)(struct snd_akm4xxx *ak, int chip);
34 void (*unlock)(akm4xxx_t *ak, int chip); 34 void (*unlock)(struct snd_akm4xxx *ak, int chip);
35 void (*write)(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); 35 void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val);
36 // unsigned char (*read)(akm4xxx_t *ak, int chip, unsigned char reg); 36 // unsigned char (*read)(struct snd_akm4xxx *ak, int chip, unsigned char reg);
37 void (*set_rate_val)(akm4xxx_t *ak, unsigned int rate); 37 void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
38}; 38};
39 39
40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ 40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */
41 41
42struct snd_akm4xxx { 42struct snd_akm4xxx {
43 snd_card_t *card; 43 struct snd_card *card;
44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ 44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */
45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */ 45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */
46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ 46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */
@@ -56,10 +56,10 @@ struct snd_akm4xxx {
56 struct snd_ak4xxx_ops ops; 56 struct snd_ak4xxx_ops ops;
57}; 57};
58 58
59void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); 59void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val);
60void snd_akm4xxx_reset(akm4xxx_t *ak, int state); 60void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state);
61void snd_akm4xxx_init(akm4xxx_t *ak); 61void snd_akm4xxx_init(struct snd_akm4xxx *ak);
62int snd_akm4xxx_build_controls(akm4xxx_t *ak); 62int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
63 63
64#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)] 64#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)]
65#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val)) 65#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val))
diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
index 728efd504262..6691e4aa4ea7 100644
--- a/include/sound/asequencer.h
+++ b/include/sound/asequencer.h
@@ -22,11 +22,10 @@
22#ifndef __SOUND_ASEQUENCER_H 22#ifndef __SOUND_ASEQUENCER_H
23#define __SOUND_ASEQUENCER_H 23#define __SOUND_ASEQUENCER_H
24 24
25#ifndef __KERNEL__ 25#ifdef __KERNEL__
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#endif
28
29#include <sound/asound.h> 27#include <sound/asound.h>
28#endif
30 29
31/** version of the sequencer */ 30/** version of the sequencer */
32#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) 31#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
@@ -36,13 +35,13 @@
36 */ 35 */
37 36
38/** system messages 37/** system messages
39 * event data type = #sndrv_seq_result_t 38 * event data type = #snd_seq_result
40 */ 39 */
41#define SNDRV_SEQ_EVENT_SYSTEM 0 40#define SNDRV_SEQ_EVENT_SYSTEM 0
42#define SNDRV_SEQ_EVENT_RESULT 1 41#define SNDRV_SEQ_EVENT_RESULT 1
43 42
44/** note messages (channel specific) 43/** note messages (channel specific)
45 * event data type = #sndrv_seq_ev_note 44 * event data type = #snd_seq_ev_note
46 */ 45 */
47#define SNDRV_SEQ_EVENT_NOTE 5 46#define SNDRV_SEQ_EVENT_NOTE 5
48#define SNDRV_SEQ_EVENT_NOTEON 6 47#define SNDRV_SEQ_EVENT_NOTEON 6
@@ -50,7 +49,7 @@
50#define SNDRV_SEQ_EVENT_KEYPRESS 8 49#define SNDRV_SEQ_EVENT_KEYPRESS 8
51 50
52/** control messages (channel specific) 51/** control messages (channel specific)
53 * event data type = #sndrv_seq_ev_ctrl 52 * event data type = #snd_seq_ev_ctrl
54 */ 53 */
55#define SNDRV_SEQ_EVENT_CONTROLLER 10 54#define SNDRV_SEQ_EVENT_CONTROLLER 10
56#define SNDRV_SEQ_EVENT_PGMCHANGE 11 55#define SNDRV_SEQ_EVENT_PGMCHANGE 11
@@ -61,7 +60,7 @@
61#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ 60#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
62 61
63/** synchronisation messages 62/** synchronisation messages
64 * event data type = #sndrv_seq_ev_ctrl 63 * event data type = #snd_seq_ev_ctrl
65 */ 64 */
66#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ 65#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
67#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ 66#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
@@ -70,7 +69,7 @@
70#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ 69#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
71 70
72/** timer messages 71/** timer messages
73 * event data type = sndrv_seq_ev_queue_control_t 72 * event data type = snd_seq_ev_queue_control
74 */ 73 */
75#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ 74#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
76#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ 75#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
@@ -96,7 +95,7 @@
96#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ 95#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
97 96
98/** system status messages (broadcast for subscribers) 97/** system status messages (broadcast for subscribers)
99 * event data type = sndrv_seq_addr_t 98 * event data type = snd_seq_addr
100 */ 99 */
101#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ 100#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
102#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ 101#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
@@ -106,13 +105,13 @@
106#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ 105#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
107 106
108/** port connection changes 107/** port connection changes
109 * event data type = sndrv_seq_connect_t 108 * event data type = snd_seq_connect
110 */ 109 */
111#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
112#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
113 112
114/** synthesizer events 113/** synthesizer events
115 * event data type = sndrv_seq_eve_sample_control_t 114 * event data type = snd_seq_eve_sample_control
116 */ 115 */
117#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */ 116#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
118#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */ 117#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
@@ -163,7 +162,7 @@
163/* 119-129: reserved */ 162/* 119-129: reserved */
164 163
165/* 130-139: variable length events 164/* 130-139: variable length events
166 * event data type = sndrv_seq_ev_ext 165 * event data type = snd_seq_ev_ext
167 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) 166 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
168 */ 167 */
169#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ 168#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
@@ -187,18 +186,18 @@
187#define SNDRV_SEQ_EVENT_NONE 255 186#define SNDRV_SEQ_EVENT_NONE 255
188 187
189 188
190typedef unsigned char sndrv_seq_event_type_t; 189typedef unsigned char snd_seq_event_type_t;
191 190
192/** event address */ 191/** event address */
193struct sndrv_seq_addr { 192struct snd_seq_addr {
194 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ 193 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
195 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ 194 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
196}; 195};
197 196
198/** port connection */ 197/** port connection */
199struct sndrv_seq_connect { 198struct snd_seq_connect {
200 struct sndrv_seq_addr sender; 199 struct snd_seq_addr sender;
201 struct sndrv_seq_addr dest; 200 struct snd_seq_addr dest;
202}; 201};
203 202
204 203
@@ -227,7 +226,7 @@ struct sndrv_seq_connect {
227 226
228 227
229 /* note event */ 228 /* note event */
230struct sndrv_seq_ev_note { 229struct snd_seq_ev_note {
231 unsigned char channel; 230 unsigned char channel;
232 unsigned char note; 231 unsigned char note;
233 unsigned char velocity; 232 unsigned char velocity;
@@ -236,7 +235,7 @@ struct sndrv_seq_ev_note {
236}; 235};
237 236
238 /* controller event */ 237 /* controller event */
239struct sndrv_seq_ev_ctrl { 238struct snd_seq_ev_ctrl {
240 unsigned char channel; 239 unsigned char channel;
241 unsigned char unused1, unused2, unused3; /* pad */ 240 unsigned char unused1, unused2, unused3; /* pad */
242 unsigned int param; 241 unsigned int param;
@@ -244,59 +243,59 @@ struct sndrv_seq_ev_ctrl {
244}; 243};
245 244
246 /* generic set of bytes (12x8 bit) */ 245 /* generic set of bytes (12x8 bit) */
247struct sndrv_seq_ev_raw8 { 246struct snd_seq_ev_raw8 {
248 unsigned char d[12]; /* 8 bit value */ 247 unsigned char d[12]; /* 8 bit value */
249}; 248};
250 249
251 /* generic set of integers (3x32 bit) */ 250 /* generic set of integers (3x32 bit) */
252struct sndrv_seq_ev_raw32 { 251struct snd_seq_ev_raw32 {
253 unsigned int d[3]; /* 32 bit value */ 252 unsigned int d[3]; /* 32 bit value */
254}; 253};
255 254
256 /* external stored data */ 255 /* external stored data */
257struct sndrv_seq_ev_ext { 256struct snd_seq_ev_ext {
258 unsigned int len; /* length of data */ 257 unsigned int len; /* length of data */
259 void *ptr; /* pointer to data (note: maybe 64-bit) */ 258 void *ptr; /* pointer to data (note: maybe 64-bit) */
260} __attribute__((packed)); 259} __attribute__((packed));
261 260
262/* Instrument cluster type */ 261/* Instrument cluster type */
263typedef unsigned int sndrv_seq_instr_cluster_t; 262typedef unsigned int snd_seq_instr_cluster_t;
264 263
265/* Instrument type */ 264/* Instrument type */
266struct sndrv_seq_instr { 265struct snd_seq_instr {
267 sndrv_seq_instr_cluster_t cluster; 266 snd_seq_instr_cluster_t cluster;
268 unsigned int std; /* the upper byte means a private instrument (owner - client #) */ 267 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
269 unsigned short bank; 268 unsigned short bank;
270 unsigned short prg; 269 unsigned short prg;
271}; 270};
272 271
273 /* sample number */ 272 /* sample number */
274struct sndrv_seq_ev_sample { 273struct snd_seq_ev_sample {
275 unsigned int std; 274 unsigned int std;
276 unsigned short bank; 275 unsigned short bank;
277 unsigned short prg; 276 unsigned short prg;
278}; 277};
279 278
280 /* sample cluster */ 279 /* sample cluster */
281struct sndrv_seq_ev_cluster { 280struct snd_seq_ev_cluster {
282 sndrv_seq_instr_cluster_t cluster; 281 snd_seq_instr_cluster_t cluster;
283}; 282};
284 283
285 /* sample position */ 284 /* sample position */
286typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */ 285typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
287 286
288 /* sample stop mode */ 287 /* sample stop mode */
289enum sndrv_seq_stop_mode { 288enum {
290 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */ 289 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
291 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */ 290 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
292 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */ 291 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
293}; 292};
294 293
295 /* sample frequency */ 294 /* sample frequency */
296typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */ 295typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
297 296
298 /* sample volume control; if any value is set to -1 == do not change */ 297 /* sample volume control; if any value is set to -1 == do not change */
299struct sndrv_seq_ev_volume { 298struct snd_seq_ev_volume {
300 signed short volume; /* range: 0-16383 */ 299 signed short volume; /* range: 0-16383 */
301 signed short lr; /* left-right balance; range: 0-16383 */ 300 signed short lr; /* left-right balance; range: 0-16383 */
302 signed short fr; /* front-rear balance; range: 0-16383 */ 301 signed short fr; /* front-rear balance; range: 0-16383 */
@@ -304,22 +303,22 @@ struct sndrv_seq_ev_volume {
304}; 303};
305 304
306 /* simple loop redefinition */ 305 /* simple loop redefinition */
307struct sndrv_seq_ev_loop { 306struct snd_seq_ev_loop {
308 unsigned int start; /* loop start (in samples) * 16 */ 307 unsigned int start; /* loop start (in samples) * 16 */
309 unsigned int end; /* loop end (in samples) * 16 */ 308 unsigned int end; /* loop end (in samples) * 16 */
310}; 309};
311 310
312struct sndrv_seq_ev_sample_control { 311struct snd_seq_ev_sample_control {
313 unsigned char channel; 312 unsigned char channel;
314 unsigned char unused1, unused2, unused3; /* pad */ 313 unsigned char unused1, unused2, unused3; /* pad */
315 union { 314 union {
316 struct sndrv_seq_ev_sample sample; 315 struct snd_seq_ev_sample sample;
317 struct sndrv_seq_ev_cluster cluster; 316 struct snd_seq_ev_cluster cluster;
318 sndrv_seq_position_t position; 317 snd_seq_position_t position;
319 enum sndrv_seq_stop_mode stop_mode; 318 int stop_mode;
320 sndrv_seq_frequency_t frequency; 319 snd_seq_frequency_t frequency;
321 struct sndrv_seq_ev_volume volume; 320 struct snd_seq_ev_volume volume;
322 struct sndrv_seq_ev_loop loop; 321 struct snd_seq_ev_loop loop;
323 unsigned char raw8[8]; 322 unsigned char raw8[8];
324 } param; 323 } param;
325}; 324};
@@ -327,82 +326,82 @@ struct sndrv_seq_ev_sample_control {
327 326
328 327
329/* INSTR_BEGIN event */ 328/* INSTR_BEGIN event */
330struct sndrv_seq_ev_instr_begin { 329struct snd_seq_ev_instr_begin {
331 int timeout; /* zero = forever, otherwise timeout in ms */ 330 int timeout; /* zero = forever, otherwise timeout in ms */
332}; 331};
333 332
334struct sndrv_seq_result { 333struct snd_seq_result {
335 int event; /* processed event type */ 334 int event; /* processed event type */
336 int result; 335 int result;
337}; 336};
338 337
339 338
340struct sndrv_seq_real_time { 339struct snd_seq_real_time {
341 unsigned int tv_sec; /* seconds */ 340 unsigned int tv_sec; /* seconds */
342 unsigned int tv_nsec; /* nanoseconds */ 341 unsigned int tv_nsec; /* nanoseconds */
343}; 342};
344 343
345typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */ 344typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
346 345
347union sndrv_seq_timestamp { 346union snd_seq_timestamp {
348 sndrv_seq_tick_time_t tick; 347 snd_seq_tick_time_t tick;
349 struct sndrv_seq_real_time time; 348 struct snd_seq_real_time time;
350}; 349};
351 350
352struct sndrv_seq_queue_skew { 351struct snd_seq_queue_skew {
353 unsigned int value; 352 unsigned int value;
354 unsigned int base; 353 unsigned int base;
355}; 354};
356 355
357 /* queue timer control */ 356 /* queue timer control */
358struct sndrv_seq_ev_queue_control { 357struct snd_seq_ev_queue_control {
359 unsigned char queue; /* affected queue */ 358 unsigned char queue; /* affected queue */
360 unsigned char pad[3]; /* reserved */ 359 unsigned char pad[3]; /* reserved */
361 union { 360 union {
362 signed int value; /* affected value (e.g. tempo) */ 361 signed int value; /* affected value (e.g. tempo) */
363 union sndrv_seq_timestamp time; /* time */ 362 union snd_seq_timestamp time; /* time */
364 unsigned int position; /* sync position */ 363 unsigned int position; /* sync position */
365 struct sndrv_seq_queue_skew skew; 364 struct snd_seq_queue_skew skew;
366 unsigned int d32[2]; 365 unsigned int d32[2];
367 unsigned char d8[8]; 366 unsigned char d8[8];
368 } param; 367 } param;
369}; 368};
370 369
371 /* quoted event - inside the kernel only */ 370 /* quoted event - inside the kernel only */
372struct sndrv_seq_ev_quote { 371struct snd_seq_ev_quote {
373 struct sndrv_seq_addr origin; /* original sender */ 372 struct snd_seq_addr origin; /* original sender */
374 unsigned short value; /* optional data */ 373 unsigned short value; /* optional data */
375 struct sndrv_seq_event *event; /* quoted event */ 374 struct snd_seq_event *event; /* quoted event */
376} __attribute__((packed)); 375} __attribute__((packed));
377 376
378 377
379 /* sequencer event */ 378 /* sequencer event */
380struct sndrv_seq_event { 379struct snd_seq_event {
381 sndrv_seq_event_type_t type; /* event type */ 380 snd_seq_event_type_t type; /* event type */
382 unsigned char flags; /* event flags */ 381 unsigned char flags; /* event flags */
383 char tag; 382 char tag;
384 383
385 unsigned char queue; /* schedule queue */ 384 unsigned char queue; /* schedule queue */
386 union sndrv_seq_timestamp time; /* schedule time */ 385 union snd_seq_timestamp time; /* schedule time */
387 386
388 387
389 struct sndrv_seq_addr source; /* source address */ 388 struct snd_seq_addr source; /* source address */
390 struct sndrv_seq_addr dest; /* destination address */ 389 struct snd_seq_addr dest; /* destination address */
391 390
392 union { /* event data... */ 391 union { /* event data... */
393 struct sndrv_seq_ev_note note; 392 struct snd_seq_ev_note note;
394 struct sndrv_seq_ev_ctrl control; 393 struct snd_seq_ev_ctrl control;
395 struct sndrv_seq_ev_raw8 raw8; 394 struct snd_seq_ev_raw8 raw8;
396 struct sndrv_seq_ev_raw32 raw32; 395 struct snd_seq_ev_raw32 raw32;
397 struct sndrv_seq_ev_ext ext; 396 struct snd_seq_ev_ext ext;
398 struct sndrv_seq_ev_queue_control queue; 397 struct snd_seq_ev_queue_control queue;
399 union sndrv_seq_timestamp time; 398 union snd_seq_timestamp time;
400 struct sndrv_seq_addr addr; 399 struct snd_seq_addr addr;
401 struct sndrv_seq_connect connect; 400 struct snd_seq_connect connect;
402 struct sndrv_seq_result result; 401 struct snd_seq_result result;
403 struct sndrv_seq_ev_instr_begin instr_begin; 402 struct snd_seq_ev_instr_begin instr_begin;
404 struct sndrv_seq_ev_sample_control sample; 403 struct snd_seq_ev_sample_control sample;
405 struct sndrv_seq_ev_quote quote; 404 struct snd_seq_ev_quote quote;
406 } data; 405 } data;
407}; 406};
408 407
@@ -410,72 +409,77 @@ struct sndrv_seq_event {
410/* 409/*
411 * bounce event - stored as variable size data 410 * bounce event - stored as variable size data
412 */ 411 */
413struct sndrv_seq_event_bounce { 412struct snd_seq_event_bounce {
414 int err; 413 int err;
415 struct sndrv_seq_event event; 414 struct snd_seq_event event;
416 /* external data follows here. */ 415 /* external data follows here. */
417}; 416};
418 417
419#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t))) 418#ifdef __KERNEL__
419
420/* helper macro */
421#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
420 422
421/* 423/*
422 * type check macros 424 * type check macros
423 */ 425 */
424/* result events: 0-4 */ 426/* result events: 0-4 */
425#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5) 427#define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
426/* channel specific events: 5-19 */ 428/* channel specific events: 5-19 */
427#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20) 429#define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
428/* note events: 5-9 */ 430/* note events: 5-9 */
429#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10) 431#define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
430/* control events: 10-19 */ 432/* control events: 10-19 */
431#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20) 433#define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
432/* queue control events: 30-39 */ 434/* queue control events: 30-39 */
433#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40) 435#define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
434/* system status messages */ 436/* system status messages */
435#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69) 437#define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
436/* sample messages */ 438/* sample messages */
437#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79) 439#define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
438/* user-defined messages */ 440/* user-defined messages */
439#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) 441#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
440/* fixed length events: 0-99 */ 442/* fixed length events: 0-99 */
441#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100) 443#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
442/* instrument layer events: 100-129 */ 444/* instrument layer events: 100-129 */
443#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) 445#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
444/* variable length events: 130-139 */ 446/* variable length events: 130-139 */
445#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) 447#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
446/* reserved for kernel */ 448/* reserved for kernel */
447#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150) 449#define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
448 450
449/* direct dispatched events */ 451/* direct dispatched events */
450#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT) 452#define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
451 453
452/* 454/*
453 * macros to check event flags 455 * macros to check event flags
454 */ 456 */
455/* prior events */ 457/* prior events */
456#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH) 458#define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
457 459
458/* event length type */ 460/* event length type */
459#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) 461#define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
460#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED) 462#define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
461#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) 463#define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
462#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR) 464#define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
463 465
464/* time-stamp type */ 466/* time-stamp type */
465#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK) 467#define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
466#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK) 468#define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
467#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL) 469#define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
468 470
469/* time-mode type */ 471/* time-mode type */
470#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK) 472#define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
471#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS) 473#define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
472#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL) 474#define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
473 475
474/* queue sync port */ 476/* queue sync port */
475#define sndrv_seq_queue_sync_port(q) ((q) + 16) 477#define snd_seq_queue_sync_port(q) ((q) + 16)
478
479#endif /* __KERNEL__ */
476 480
477 /* system information */ 481 /* system information */
478struct sndrv_seq_system_info { 482struct snd_seq_system_info {
479 int queues; /* maximum queues count */ 483 int queues; /* maximum queues count */
480 int clients; /* maximum clients count */ 484 int clients; /* maximum clients count */
481 int ports; /* maximum ports per client */ 485 int ports; /* maximum ports per client */
@@ -487,7 +491,7 @@ struct sndrv_seq_system_info {
487 491
488 492
489 /* system running information */ 493 /* system running information */
490struct sndrv_seq_running_info { 494struct snd_seq_running_info {
491 unsigned char client; /* client id */ 495 unsigned char client; /* client id */
492 unsigned char big_endian; /* 1 = big-endian */ 496 unsigned char big_endian; /* 1 = big-endian */
493 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ 497 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
@@ -498,16 +502,16 @@ struct sndrv_seq_running_info {
498 502
499 /* known client numbers */ 503 /* known client numbers */
500#define SNDRV_SEQ_CLIENT_SYSTEM 0 504#define SNDRV_SEQ_CLIENT_SYSTEM 0
501#define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */ 505 /* internal client numbers */
502#define SNDRV_SEQ_CLIENT_OSS 63 /* oss sequencer emulator */ 506#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
507#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
503 508
504 509
505 /* client types */ 510 /* client types */
506enum sndrv_seq_client_type { 511typedef int __bitwise snd_seq_client_type_t;
507 NO_CLIENT = 0, 512#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
508 USER_CLIENT = 1, 513#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
509 KERNEL_CLIENT = 2 514#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
510};
511 515
512 /* event filter flags */ 516 /* event filter flags */
513#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ 517#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
@@ -515,9 +519,9 @@ enum sndrv_seq_client_type {
515#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ 519#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
516#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ 520#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
517 521
518struct sndrv_seq_client_info { 522struct snd_seq_client_info {
519 int client; /* client number to inquire */ 523 int client; /* client number to inquire */
520 enum sndrv_seq_client_type type; /* client type */ 524 snd_seq_client_type_t type; /* client type */
521 char name[64]; /* client name */ 525 char name[64]; /* client name */
522 unsigned int filter; /* filter flags */ 526 unsigned int filter; /* filter flags */
523 unsigned char multicast_filter[8]; /* multicast filter bitmap */ 527 unsigned char multicast_filter[8]; /* multicast filter bitmap */
@@ -529,7 +533,7 @@ struct sndrv_seq_client_info {
529 533
530 534
531/* client pool size */ 535/* client pool size */
532struct sndrv_seq_client_pool { 536struct snd_seq_client_pool {
533 int client; /* client number to inquire */ 537 int client; /* client number to inquire */
534 int output_pool; /* outgoing (write) pool size */ 538 int output_pool; /* outgoing (write) pool size */
535 int input_pool; /* incoming (read) pool size */ 539 int input_pool; /* incoming (read) pool size */
@@ -553,13 +557,13 @@ struct sndrv_seq_client_pool {
553#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ 557#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
554#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ 558#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
555 559
556struct sndrv_seq_remove_events { 560struct snd_seq_remove_events {
557 unsigned int remove_mode; /* Flags that determine what gets removed */ 561 unsigned int remove_mode; /* Flags that determine what gets removed */
558 562
559 union sndrv_seq_timestamp time; 563 union snd_seq_timestamp time;
560 564
561 unsigned char queue; /* Queue for REMOVE_DEST */ 565 unsigned char queue; /* Queue for REMOVE_DEST */
562 struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */ 566 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
563 unsigned char channel; /* Channel for REMOVE_DEST */ 567 unsigned char channel; /* Channel for REMOVE_DEST */
564 568
565 int type; /* For REMOVE_EVENT_TYPE */ 569 int type; /* For REMOVE_EVENT_TYPE */
@@ -608,8 +612,8 @@ struct sndrv_seq_remove_events {
608#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) 612#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
609#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) 613#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
610 614
611struct sndrv_seq_port_info { 615struct snd_seq_port_info {
612 struct sndrv_seq_addr addr; /* client/port numbers */ 616 struct snd_seq_addr addr; /* client/port numbers */
613 char name[64]; /* port name */ 617 char name[64]; /* port name */
614 618
615 unsigned int capability; /* port capability bits */ 619 unsigned int capability; /* port capability bits */
@@ -632,7 +636,7 @@ struct sndrv_seq_port_info {
632#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ 636#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
633 637
634/* queue information */ 638/* queue information */
635struct sndrv_seq_queue_info { 639struct snd_seq_queue_info {
636 int queue; /* queue id */ 640 int queue; /* queue id */
637 641
638 /* 642 /*
@@ -648,11 +652,11 @@ struct sndrv_seq_queue_info {
648}; 652};
649 653
650/* queue info/status */ 654/* queue info/status */
651struct sndrv_seq_queue_status { 655struct snd_seq_queue_status {
652 int queue; /* queue id */ 656 int queue; /* queue id */
653 int events; /* read-only - queue size */ 657 int events; /* read-only - queue size */
654 sndrv_seq_tick_time_t tick; /* current tick */ 658 snd_seq_tick_time_t tick; /* current tick */
655 struct sndrv_seq_real_time time; /* current time */ 659 struct snd_seq_real_time time; /* current time */
656 int running; /* running state of queue */ 660 int running; /* running state of queue */
657 int flags; /* various flags */ 661 int flags; /* various flags */
658 char reserved[64]; /* for the future */ 662 char reserved[64]; /* for the future */
@@ -660,7 +664,7 @@ struct sndrv_seq_queue_status {
660 664
661 665
662/* queue tempo */ 666/* queue tempo */
663struct sndrv_seq_queue_tempo { 667struct snd_seq_queue_tempo {
664 int queue; /* sequencer queue */ 668 int queue; /* sequencer queue */
665 unsigned int tempo; /* current tempo, us/tick */ 669 unsigned int tempo; /* current tempo, us/tick */
666 int ppq; /* time resolution, ticks/quarter */ 670 int ppq; /* time resolution, ticks/quarter */
@@ -676,12 +680,12 @@ struct sndrv_seq_queue_tempo {
676#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ 680#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
677 681
678/* queue timer info */ 682/* queue timer info */
679struct sndrv_seq_queue_timer { 683struct snd_seq_queue_timer {
680 int queue; /* sequencer queue */ 684 int queue; /* sequencer queue */
681 int type; /* source timer type */ 685 int type; /* source timer type */
682 union { 686 union {
683 struct { 687 struct {
684 struct sndrv_timer_id id; /* ALSA's timer ID */ 688 struct snd_timer_id id; /* ALSA's timer ID */
685 unsigned int resolution; /* resolution in Hz */ 689 unsigned int resolution; /* resolution in Hz */
686 } alsa; 690 } alsa;
687 } u; 691 } u;
@@ -689,7 +693,7 @@ struct sndrv_seq_queue_timer {
689}; 693};
690 694
691 695
692struct sndrv_seq_queue_client { 696struct snd_seq_queue_client {
693 int queue; /* sequencer queue */ 697 int queue; /* sequencer queue */
694 int client; /* sequencer client */ 698 int client; /* sequencer client */
695 int used; /* queue is used with this client 699 int used; /* queue is used with this client
@@ -703,9 +707,9 @@ struct sndrv_seq_queue_client {
703#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) 707#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
704#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) 708#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
705 709
706struct sndrv_seq_port_subscribe { 710struct snd_seq_port_subscribe {
707 struct sndrv_seq_addr sender; /* sender address */ 711 struct snd_seq_addr sender; /* sender address */
708 struct sndrv_seq_addr dest; /* destination address */ 712 struct snd_seq_addr dest; /* destination address */
709 unsigned int voices; /* number of voices to be allocated (0 = don't care) */ 713 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
710 unsigned int flags; /* modes */ 714 unsigned int flags; /* modes */
711 unsigned char queue; /* input time-stamp queue (optional) */ 715 unsigned char queue; /* input time-stamp queue (optional) */
@@ -717,12 +721,12 @@ struct sndrv_seq_port_subscribe {
717#define SNDRV_SEQ_QUERY_SUBS_READ 0 721#define SNDRV_SEQ_QUERY_SUBS_READ 0
718#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 722#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
719 723
720struct sndrv_seq_query_subs { 724struct snd_seq_query_subs {
721 struct sndrv_seq_addr root; /* client/port id to be searched */ 725 struct snd_seq_addr root; /* client/port id to be searched */
722 int type; /* READ or WRITE */ 726 int type; /* READ or WRITE */
723 int index; /* 0..N-1 */ 727 int index; /* 0..N-1 */
724 int num_subs; /* R/O: number of subscriptions on this port */ 728 int num_subs; /* R/O: number of subscriptions on this port */
725 struct sndrv_seq_addr addr; /* R/O: result */ 729 struct snd_seq_addr addr; /* R/O: result */
726 unsigned char queue; /* R/O: result */ 730 unsigned char queue; /* R/O: result */
727 unsigned int flags; /* R/O: result */ 731 unsigned int flags; /* R/O: result */
728 char reserved[64]; /* for future use */ 732 char reserved[64]; /* for future use */
@@ -779,72 +783,72 @@ struct sndrv_seq_query_subs {
779#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3 783#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
780 784
781/* size of ROM/RAM */ 785/* size of ROM/RAM */
782typedef unsigned int sndrv_seq_instr_size_t; 786typedef unsigned int snd_seq_instr_size_t;
783 787
784/* INSTR_INFO */ 788/* INSTR_INFO */
785 789
786struct sndrv_seq_instr_info { 790struct snd_seq_instr_info {
787 int result; /* operation result */ 791 int result; /* operation result */
788 unsigned int formats[8]; /* bitmap of supported formats */ 792 unsigned int formats[8]; /* bitmap of supported formats */
789 int ram_count; /* count of RAM banks */ 793 int ram_count; /* count of RAM banks */
790 sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ 794 snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
791 int rom_count; /* count of ROM banks */ 795 int rom_count; /* count of ROM banks */
792 sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ 796 snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
793 char reserved[128]; 797 char reserved[128];
794}; 798};
795 799
796/* INSTR_STATUS */ 800/* INSTR_STATUS */
797 801
798struct sndrv_seq_instr_status { 802struct snd_seq_instr_status {
799 int result; /* operation result */ 803 int result; /* operation result */
800 sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */ 804 snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
801 int instrument_count; /* count of downloaded instruments */ 805 int instrument_count; /* count of downloaded instruments */
802 char reserved[128]; 806 char reserved[128];
803}; 807};
804 808
805/* INSTR_FORMAT_INFO */ 809/* INSTR_FORMAT_INFO */
806 810
807struct sndrv_seq_instr_format_info { 811struct snd_seq_instr_format_info {
808 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */ 812 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
809 unsigned int len; /* max data length (without this structure) */ 813 unsigned int len; /* max data length (without this structure) */
810}; 814};
811 815
812struct sndrv_seq_instr_format_info_result { 816struct snd_seq_instr_format_info_result {
813 int result; /* operation result */ 817 int result; /* operation result */
814 char format[16]; /* format identifier */ 818 char format[16]; /* format identifier */
815 unsigned int len; /* filled data length (without this structure) */ 819 unsigned int len; /* filled data length (without this structure) */
816}; 820};
817 821
818/* instrument data */ 822/* instrument data */
819struct sndrv_seq_instr_data { 823struct snd_seq_instr_data {
820 char name[32]; /* instrument name */ 824 char name[32]; /* instrument name */
821 char reserved[16]; /* for the future use */ 825 char reserved[16]; /* for the future use */
822 int type; /* instrument type */ 826 int type; /* instrument type */
823 union { 827 union {
824 char format[16]; /* format identifier */ 828 char format[16]; /* format identifier */
825 struct sndrv_seq_instr alias; 829 struct snd_seq_instr alias;
826 } data; 830 } data;
827}; 831};
828 832
829/* INSTR_PUT/GET, data are stored in one block (extended), header + data */ 833/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
830 834
831struct sndrv_seq_instr_header { 835struct snd_seq_instr_header {
832 union { 836 union {
833 struct sndrv_seq_instr instr; 837 struct snd_seq_instr instr;
834 sndrv_seq_instr_cluster_t cluster; 838 snd_seq_instr_cluster_t cluster;
835 } id; /* instrument identifier */ 839 } id; /* instrument identifier */
836 unsigned int cmd; /* get/put/free command */ 840 unsigned int cmd; /* get/put/free command */
837 unsigned int flags; /* query flags (only for get) */ 841 unsigned int flags; /* query flags (only for get) */
838 unsigned int len; /* real instrument data length (without header) */ 842 unsigned int len; /* real instrument data length (without header) */
839 int result; /* operation result */ 843 int result; /* operation result */
840 char reserved[16]; /* for the future */ 844 char reserved[16]; /* for the future */
841 struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */ 845 struct snd_seq_instr_data data; /* instrument data (for put/get result) */
842}; 846};
843 847
844/* INSTR_CLUSTER_SET */ 848/* INSTR_CLUSTER_SET */
845 849
846struct sndrv_seq_instr_cluster_set { 850struct snd_seq_instr_cluster_set {
847 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 851 snd_seq_instr_cluster_t cluster; /* cluster identifier */
848 char name[32]; /* cluster name */ 852 char name[32]; /* cluster name */
849 int priority; /* cluster priority */ 853 int priority; /* cluster priority */
850 char reserved[64]; /* for the future use */ 854 char reserved[64]; /* for the future use */
@@ -852,8 +856,8 @@ struct sndrv_seq_instr_cluster_set {
852 856
853/* INSTR_CLUSTER_GET */ 857/* INSTR_CLUSTER_GET */
854 858
855struct sndrv_seq_instr_cluster_get { 859struct snd_seq_instr_cluster_get {
856 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 860 snd_seq_instr_cluster_t cluster; /* cluster identifier */
857 char name[32]; /* cluster name */ 861 char name[32]; /* cluster name */
858 int priority; /* cluster priority */ 862 int priority; /* cluster priority */
859 char reserved[64]; /* for the future use */ 863 char reserved[64]; /* for the future use */
@@ -865,44 +869,44 @@ struct sndrv_seq_instr_cluster_get {
865 869
866#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) 870#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
867#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) 871#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
868#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info) 872#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
869#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info) 873#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
870 874
871#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info) 875#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
872#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info) 876#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
873 877
874#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info) 878#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
875#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info) 879#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
876#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info) 880#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
877#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info) 881#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
878 882
879#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe) 883#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
880#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe) 884#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
881 885
882#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info) 886#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
883#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info) 887#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
884#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info) 888#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
885#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info) 889#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
886#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info) 890#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
887#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status) 891#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
888#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo) 892#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
889#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo) 893#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
890#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner) 894#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
891#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner) 895#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
892#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer) 896#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
893#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer) 897#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
894/* XXX 898/* XXX
895#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync) 899#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
896#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync) 900#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
897*/ 901*/
898#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client) 902#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
899#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client) 903#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
900#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool) 904#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
901#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool) 905#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
902#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events) 906#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
903#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs) 907#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
904#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe) 908#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
905#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info) 909#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
906#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info) 910#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
907 911
908#endif /* __SOUND_ASEQUENCER_H */ 912#endif /* __SOUND_ASEQUENCER_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 8e552d627fa5..9cc021c7ee11 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -23,12 +23,8 @@
23#ifndef __SOUND_ASOUND_H 23#ifndef __SOUND_ASOUND_H
24#define __SOUND_ASOUND_H 24#define __SOUND_ASOUND_H
25 25
26#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
27
28#include <linux/ioctl.h>
29
30#ifdef __KERNEL__ 26#ifdef __KERNEL__
31 27#include <linux/ioctl.h>
32#include <linux/types.h> 28#include <linux/types.h>
33#include <linux/time.h> 29#include <linux/time.h>
34#include <asm/byteorder.h> 30#include <asm/byteorder.h>
@@ -43,25 +39,7 @@
43#endif 39#endif
44#endif 40#endif
45 41
46#else /* !__KERNEL__ */ 42#endif /* __KERNEL__ **/
47
48#include <endian.h>
49#if __BYTE_ORDER == __LITTLE_ENDIAN
50#define SNDRV_LITTLE_ENDIAN
51#elif __BYTE_ORDER == __BIG_ENDIAN
52#define SNDRV_BIG_ENDIAN
53#else
54#error "Unsupported endian..."
55#endif
56
57#endif /* __KERNEL **/
58
59#endif /* LINUX */
60
61#ifndef __KERNEL__
62#include <sys/time.h>
63#include <sys/types.h>
64#endif
65 43
66/* 44/*
67 * protocol version 45 * protocol version
@@ -82,7 +60,7 @@
82 * * 60 * *
83 ****************************************************************************/ 61 ****************************************************************************/
84 62
85struct sndrv_aes_iec958 { 63struct snd_aes_iec958 {
86 unsigned char status[24]; /* AES/IEC958 channel status bits */ 64 unsigned char status[24]; /* AES/IEC958 channel status bits */
87 unsigned char subcode[147]; /* AES/IEC958 subcode bits */ 65 unsigned char subcode[147]; /* AES/IEC958 subcode bits */
88 unsigned char pad; /* nothing */ 66 unsigned char pad; /* nothing */
@@ -97,7 +75,7 @@ struct sndrv_aes_iec958 {
97 75
98#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) 76#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
99 77
100enum sndrv_hwdep_iface { 78enum {
101 SNDRV_HWDEP_IFACE_OPL2 = 0, 79 SNDRV_HWDEP_IFACE_OPL2 = 0,
102 SNDRV_HWDEP_IFACE_OPL3, 80 SNDRV_HWDEP_IFACE_OPL3,
103 SNDRV_HWDEP_IFACE_OPL4, 81 SNDRV_HWDEP_IFACE_OPL4,
@@ -119,17 +97,17 @@ enum sndrv_hwdep_iface {
119 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC 97 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC
120}; 98};
121 99
122struct sndrv_hwdep_info { 100struct snd_hwdep_info {
123 unsigned int device; /* WR: device number */ 101 unsigned int device; /* WR: device number */
124 int card; /* R: card number */ 102 int card; /* R: card number */
125 unsigned char id[64]; /* ID (user selectable) */ 103 unsigned char id[64]; /* ID (user selectable) */
126 unsigned char name[80]; /* hwdep name */ 104 unsigned char name[80]; /* hwdep name */
127 enum sndrv_hwdep_iface iface; /* hwdep interface */ 105 int iface; /* hwdep interface */
128 unsigned char reserved[64]; /* reserved for future */ 106 unsigned char reserved[64]; /* reserved for future */
129}; 107};
130 108
131/* generic DSP loader */ 109/* generic DSP loader */
132struct sndrv_hwdep_dsp_status { 110struct snd_hwdep_dsp_status {
133 unsigned int version; /* R: driver-specific version */ 111 unsigned int version; /* R: driver-specific version */
134 unsigned char id[32]; /* R: driver-specific ID string */ 112 unsigned char id[32]; /* R: driver-specific ID string */
135 unsigned int num_dsps; /* R: number of DSP images to transfer */ 113 unsigned int num_dsps; /* R: number of DSP images to transfer */
@@ -138,7 +116,7 @@ struct sndrv_hwdep_dsp_status {
138 unsigned char reserved[16]; /* reserved for future use */ 116 unsigned char reserved[16]; /* reserved for future use */
139}; 117};
140 118
141struct sndrv_hwdep_dsp_image { 119struct snd_hwdep_dsp_image {
142 unsigned int index; /* W: DSP index */ 120 unsigned int index; /* W: DSP index */
143 unsigned char name[64]; /* W: ID (e.g. file name) */ 121 unsigned char name[64]; /* W: ID (e.g. file name) */
144 unsigned char __user *image; /* W: binary image */ 122 unsigned char __user *image; /* W: binary image */
@@ -148,9 +126,9 @@ struct sndrv_hwdep_dsp_image {
148 126
149enum { 127enum {
150 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), 128 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int),
151 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info), 129 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct snd_hwdep_info),
152 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status), 130 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct snd_hwdep_dsp_status),
153 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image) 131 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct snd_hwdep_dsp_image)
154}; 132};
155 133
156/***************************************************************************** 134/*****************************************************************************
@@ -161,10 +139,10 @@ enum {
161 139
162#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) 140#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
163 141
164typedef unsigned long sndrv_pcm_uframes_t; 142typedef unsigned long snd_pcm_uframes_t;
165typedef long sndrv_pcm_sframes_t; 143typedef signed long snd_pcm_sframes_t;
166 144
167enum sndrv_pcm_class { 145enum {
168 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ 146 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
169 SNDRV_PCM_CLASS_MULTI, /* multichannel device */ 147 SNDRV_PCM_CLASS_MULTI, /* multichannel device */
170 SNDRV_PCM_CLASS_MODEM, /* software modem class */ 148 SNDRV_PCM_CLASS_MODEM, /* software modem class */
@@ -173,97 +151,94 @@ enum sndrv_pcm_class {
173 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, 151 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
174}; 152};
175 153
176enum sndrv_pcm_subclass { 154enum {
177 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ 155 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
178 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ 156 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
179 /* Don't forget to change the following: */ 157 /* Don't forget to change the following: */
180 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, 158 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
181}; 159};
182 160
183enum sndrv_pcm_stream { 161enum {
184 SNDRV_PCM_STREAM_PLAYBACK = 0, 162 SNDRV_PCM_STREAM_PLAYBACK = 0,
185 SNDRV_PCM_STREAM_CAPTURE, 163 SNDRV_PCM_STREAM_CAPTURE,
186 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, 164 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
187}; 165};
188 166
189enum sndrv_pcm_access { 167typedef int __bitwise snd_pcm_access_t;
190 SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */ 168#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
191 SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */ 169#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
192 SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */ 170#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
193 SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */ 171#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
194 SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */ 172#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
195 SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, 173#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
196}; 174
197 175typedef int __bitwise snd_pcm_format_t;
198enum sndrv_pcm_format { 176#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
199 SNDRV_PCM_FORMAT_S8 = 0, 177#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
200 SNDRV_PCM_FORMAT_U8, 178#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
201 SNDRV_PCM_FORMAT_S16_LE, 179#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
202 SNDRV_PCM_FORMAT_S16_BE, 180#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
203 SNDRV_PCM_FORMAT_U16_LE, 181#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
204 SNDRV_PCM_FORMAT_U16_BE, 182#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
205 SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */ 183#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
206 SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */ 184#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
207 SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */ 185#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
208 SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */ 186#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
209 SNDRV_PCM_FORMAT_S32_LE, 187#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
210 SNDRV_PCM_FORMAT_S32_BE, 188#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
211 SNDRV_PCM_FORMAT_U32_LE, 189#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
212 SNDRV_PCM_FORMAT_U32_BE, 190#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
213 SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 191#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
214 SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 192#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
215 SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 193#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
216 SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 194#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
217 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */ 195#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
218 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */ 196#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
219 SNDRV_PCM_FORMAT_MU_LAW, 197#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
220 SNDRV_PCM_FORMAT_A_LAW, 198#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
221 SNDRV_PCM_FORMAT_IMA_ADPCM, 199#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
222 SNDRV_PCM_FORMAT_MPEG, 200#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
223 SNDRV_PCM_FORMAT_GSM, 201#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
224 SNDRV_PCM_FORMAT_SPECIAL = 31, 202#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
225 SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */ 203#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
226 SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */ 204#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
227 SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */ 205#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
228 SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */ 206#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
229 SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */ 207#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
230 SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */ 208#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
231 SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */ 209#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
232 SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */ 210#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
233 SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */ 211#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
234 SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */ 212#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
235 SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */ 213#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
236 SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */ 214#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE
237 SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE,
238 215
239#ifdef SNDRV_LITTLE_ENDIAN 216#ifdef SNDRV_LITTLE_ENDIAN
240 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE, 217#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
241 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE, 218#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
242 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE, 219#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
243 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE, 220#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
244 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE, 221#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
245 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE, 222#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
246 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE, 223#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
247 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE, 224#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
248 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, 225#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
249#endif 226#endif
250#ifdef SNDRV_BIG_ENDIAN 227#ifdef SNDRV_BIG_ENDIAN
251 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE, 228#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
252 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE, 229#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
253 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE, 230#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
254 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE, 231#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
255 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE, 232#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
256 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE, 233#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
257 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE, 234#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
258 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE, 235#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
259 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, 236#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
260#endif 237#endif
261};
262 238
263enum sndrv_pcm_subformat { 239typedef int __bitwise snd_pcm_subformat_t;
264 SNDRV_PCM_SUBFORMAT_STD = 0, 240#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
265 SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD, 241#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
266};
267 242
268#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ 243#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
269#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ 244#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
@@ -280,18 +255,17 @@ enum sndrv_pcm_subformat {
280#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 255#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
281#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 256#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
282 257
283enum sndrv_pcm_state { 258typedef int __bitwise snd_pcm_state_t;
284 SNDRV_PCM_STATE_OPEN = 0, /* stream is open */ 259#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
285 SNDRV_PCM_STATE_SETUP, /* stream has a setup */ 260#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
286 SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */ 261#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
287 SNDRV_PCM_STATE_RUNNING, /* stream is running */ 262#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
288 SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */ 263#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
289 SNDRV_PCM_STATE_DRAINING, /* stream is draining */ 264#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
290 SNDRV_PCM_STATE_PAUSED, /* stream is paused */ 265#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
291 SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */ 266#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
292 SNDRV_PCM_STATE_DISCONNECTED, /* hardware is disconnected */ 267#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
293 SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED, 268#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
294};
295 269
296enum { 270enum {
297 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, 271 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
@@ -299,55 +273,53 @@ enum {
299 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, 273 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
300}; 274};
301 275
302union sndrv_pcm_sync_id { 276union snd_pcm_sync_id {
303 unsigned char id[16]; 277 unsigned char id[16];
304 unsigned short id16[8]; 278 unsigned short id16[8];
305 unsigned int id32[4]; 279 unsigned int id32[4];
306}; 280};
307 281
308struct sndrv_pcm_info { 282struct snd_pcm_info {
309 unsigned int device; /* RO/WR (control): device number */ 283 unsigned int device; /* RO/WR (control): device number */
310 unsigned int subdevice; /* RO/WR (control): subdevice number */ 284 unsigned int subdevice; /* RO/WR (control): subdevice number */
311 enum sndrv_pcm_stream stream; /* RO/WR (control): stream number */ 285 int stream; /* RO/WR (control): stream direction */
312 int card; /* R: card number */ 286 int card; /* R: card number */
313 unsigned char id[64]; /* ID (user selectable) */ 287 unsigned char id[64]; /* ID (user selectable) */
314 unsigned char name[80]; /* name of this device */ 288 unsigned char name[80]; /* name of this device */
315 unsigned char subname[32]; /* subdevice name */ 289 unsigned char subname[32]; /* subdevice name */
316 enum sndrv_pcm_class dev_class; /* SNDRV_PCM_CLASS_* */ 290 int dev_class; /* SNDRV_PCM_CLASS_* */
317 enum sndrv_pcm_subclass dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ 291 int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
318 unsigned int subdevices_count; 292 unsigned int subdevices_count;
319 unsigned int subdevices_avail; 293 unsigned int subdevices_avail;
320 union sndrv_pcm_sync_id sync; /* hardware synchronization ID */ 294 union snd_pcm_sync_id sync; /* hardware synchronization ID */
321 unsigned char reserved[64]; /* reserved for future... */ 295 unsigned char reserved[64]; /* reserved for future... */
322}; 296};
323 297
324enum sndrv_pcm_hw_param { 298typedef int __bitwise snd_pcm_hw_param_t;
325 SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */ 299#define SNDRV_PCM_HW_PARAM_ACCESS ((__force snd_pcm_hw_param_t) 0) /* Access type */
326 SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS, 300#define SNDRV_PCM_HW_PARAM_FORMAT ((__force snd_pcm_hw_param_t) 1) /* Format */
327 SNDRV_PCM_HW_PARAM_FORMAT, /* Format */ 301#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */
328 SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */ 302#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
329 SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT, 303#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
330 304
331 SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */ 305#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */
332 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 306#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */
333 SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */ 307#define SNDRV_PCM_HW_PARAM_CHANNELS ((__force snd_pcm_hw_param_t) 10) /* Channels */
334 SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */ 308#define SNDRV_PCM_HW_PARAM_RATE ((__force snd_pcm_hw_param_t) 11) /* Approx rate */
335 SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */ 309#define SNDRV_PCM_HW_PARAM_PERIOD_TIME ((__force snd_pcm_hw_param_t) 12) /* Approx distance between interrupts in us */
336 SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts 310#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE ((__force snd_pcm_hw_param_t) 13) /* Approx frames between interrupts */
337 in us */ 311#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES ((__force snd_pcm_hw_param_t) 14) /* Approx bytes between interrupts */
338 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */ 312#define SNDRV_PCM_HW_PARAM_PERIODS ((__force snd_pcm_hw_param_t) 15) /* Approx interrupts per buffer */
339 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */ 313#define SNDRV_PCM_HW_PARAM_BUFFER_TIME ((__force snd_pcm_hw_param_t) 16) /* Approx duration of buffer in us */
340 SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */ 314#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE ((__force snd_pcm_hw_param_t) 17) /* Size of buffer in frames */
341 SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */ 315#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES ((__force snd_pcm_hw_param_t) 18) /* Size of buffer in bytes */
342 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */ 316#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */
343 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */ 317#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
344 SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */ 318#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
345 SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME
346};
347 319
348#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 320#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
349 321
350struct sndrv_interval { 322struct snd_interval {
351 unsigned int min, max; 323 unsigned int min, max;
352 unsigned int openmin:1, 324 unsigned int openmin:1,
353 openmax:1, 325 openmax:1,
@@ -357,137 +329,137 @@ struct sndrv_interval {
357 329
358#define SNDRV_MASK_MAX 256 330#define SNDRV_MASK_MAX 256
359 331
360struct sndrv_mask { 332struct snd_mask {
361 u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; 333 u_int32_t bits[(SNDRV_MASK_MAX+31)/32];
362}; 334};
363 335
364struct sndrv_pcm_hw_params { 336struct snd_pcm_hw_params {
365 unsigned int flags; 337 unsigned int flags;
366 struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 338 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
367 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 339 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
368 struct sndrv_mask mres[5]; /* reserved masks */ 340 struct snd_mask mres[5]; /* reserved masks */
369 struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 341 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
370 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 342 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
371 struct sndrv_interval ires[9]; /* reserved intervals */ 343 struct snd_interval ires[9]; /* reserved intervals */
372 unsigned int rmask; /* W: requested masks */ 344 unsigned int rmask; /* W: requested masks */
373 unsigned int cmask; /* R: changed masks */ 345 unsigned int cmask; /* R: changed masks */
374 unsigned int info; /* R: Info flags for returned setup */ 346 unsigned int info; /* R: Info flags for returned setup */
375 unsigned int msbits; /* R: used most significant bits */ 347 unsigned int msbits; /* R: used most significant bits */
376 unsigned int rate_num; /* R: rate numerator */ 348 unsigned int rate_num; /* R: rate numerator */
377 unsigned int rate_den; /* R: rate denominator */ 349 unsigned int rate_den; /* R: rate denominator */
378 sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ 350 snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
379 unsigned char reserved[64]; /* reserved for future */ 351 unsigned char reserved[64]; /* reserved for future */
380}; 352};
381 353
382enum sndrv_pcm_tstamp { 354enum {
383 SNDRV_PCM_TSTAMP_NONE = 0, 355 SNDRV_PCM_TSTAMP_NONE = 0,
384 SNDRV_PCM_TSTAMP_MMAP, 356 SNDRV_PCM_TSTAMP_MMAP,
385 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP, 357 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP,
386}; 358};
387 359
388struct sndrv_pcm_sw_params { 360struct snd_pcm_sw_params {
389 enum sndrv_pcm_tstamp tstamp_mode; /* timestamp mode */ 361 int tstamp_mode; /* timestamp mode */
390 unsigned int period_step; 362 unsigned int period_step;
391 unsigned int sleep_min; /* min ticks to sleep */ 363 unsigned int sleep_min; /* min ticks to sleep */
392 sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */ 364 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
393 sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 365 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
394 sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ 366 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
395 sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ 367 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
396 sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ 368 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
397 sndrv_pcm_uframes_t silence_size; /* silence block size */ 369 snd_pcm_uframes_t silence_size; /* silence block size */
398 sndrv_pcm_uframes_t boundary; /* pointers wrap point */ 370 snd_pcm_uframes_t boundary; /* pointers wrap point */
399 unsigned char reserved[64]; /* reserved for future */ 371 unsigned char reserved[64]; /* reserved for future */
400}; 372};
401 373
402struct sndrv_pcm_channel_info { 374struct snd_pcm_channel_info {
403 unsigned int channel; 375 unsigned int channel;
404 off_t offset; /* mmap offset */ 376 off_t offset; /* mmap offset */
405 unsigned int first; /* offset to first sample in bits */ 377 unsigned int first; /* offset to first sample in bits */
406 unsigned int step; /* samples distance in bits */ 378 unsigned int step; /* samples distance in bits */
407}; 379};
408 380
409struct sndrv_pcm_status { 381struct snd_pcm_status {
410 enum sndrv_pcm_state state; /* stream state */ 382 snd_pcm_state_t state; /* stream state */
411 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 383 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
412 struct timespec tstamp; /* reference timestamp */ 384 struct timespec tstamp; /* reference timestamp */
413 sndrv_pcm_uframes_t appl_ptr; /* appl ptr */ 385 snd_pcm_uframes_t appl_ptr; /* appl ptr */
414 sndrv_pcm_uframes_t hw_ptr; /* hw ptr */ 386 snd_pcm_uframes_t hw_ptr; /* hw ptr */
415 sndrv_pcm_sframes_t delay; /* current delay in frames */ 387 snd_pcm_sframes_t delay; /* current delay in frames */
416 sndrv_pcm_uframes_t avail; /* number of frames available */ 388 snd_pcm_uframes_t avail; /* number of frames available */
417 sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 389 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
418 sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 390 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
419 enum sndrv_pcm_state suspended_state; /* suspended stream state */ 391 snd_pcm_state_t suspended_state; /* suspended stream state */
420 unsigned char reserved[60]; /* must be filled with zero */ 392 unsigned char reserved[60]; /* must be filled with zero */
421}; 393};
422 394
423struct sndrv_pcm_mmap_status { 395struct snd_pcm_mmap_status {
424 enum sndrv_pcm_state state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 396 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
425 int pad1; /* Needed for 64 bit alignment */ 397 int pad1; /* Needed for 64 bit alignment */
426 sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 398 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
427 struct timespec tstamp; /* Timestamp */ 399 struct timespec tstamp; /* Timestamp */
428 enum sndrv_pcm_state suspended_state; /* RO: suspended stream state */ 400 snd_pcm_state_t suspended_state; /* RO: suspended stream state */
429}; 401};
430 402
431struct sndrv_pcm_mmap_control { 403struct snd_pcm_mmap_control {
432 sndrv_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ 404 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
433 sndrv_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ 405 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
434}; 406};
435 407
436#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ 408#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
437#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ 409#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
438#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ 410#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
439 411
440struct sndrv_pcm_sync_ptr { 412struct snd_pcm_sync_ptr {
441 unsigned int flags; 413 unsigned int flags;
442 union { 414 union {
443 struct sndrv_pcm_mmap_status status; 415 struct snd_pcm_mmap_status status;
444 unsigned char reserved[64]; 416 unsigned char reserved[64];
445 } s; 417 } s;
446 union { 418 union {
447 struct sndrv_pcm_mmap_control control; 419 struct snd_pcm_mmap_control control;
448 unsigned char reserved[64]; 420 unsigned char reserved[64];
449 } c; 421 } c;
450}; 422};
451 423
452struct sndrv_xferi { 424struct snd_xferi {
453 sndrv_pcm_sframes_t result; 425 snd_pcm_sframes_t result;
454 void __user *buf; 426 void __user *buf;
455 sndrv_pcm_uframes_t frames; 427 snd_pcm_uframes_t frames;
456}; 428};
457 429
458struct sndrv_xfern { 430struct snd_xfern {
459 sndrv_pcm_sframes_t result; 431 snd_pcm_sframes_t result;
460 void __user * __user *bufs; 432 void __user * __user *bufs;
461 sndrv_pcm_uframes_t frames; 433 snd_pcm_uframes_t frames;
462}; 434};
463 435
464enum { 436enum {
465 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), 437 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
466 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info), 438 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info),
467 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), 439 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
468 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params), 440 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params),
469 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params), 441 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params),
470 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), 442 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
471 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params), 443 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct snd_pcm_sw_params),
472 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status), 444 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct snd_pcm_status),
473 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t), 445 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, snd_pcm_sframes_t),
474 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), 446 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22),
475 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr), 447 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct snd_pcm_sync_ptr),
476 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info), 448 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct snd_pcm_channel_info),
477 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), 449 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
478 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), 450 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
479 SNDRV_PCM_IOCTL_START = _IO('A', 0x42), 451 SNDRV_PCM_IOCTL_START = _IO('A', 0x42),
480 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43), 452 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43),
481 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44), 453 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44),
482 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), 454 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int),
483 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t), 455 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, snd_pcm_uframes_t),
484 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), 456 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47),
485 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), 457 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48),
486 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t), 458 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, snd_pcm_uframes_t),
487 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi), 459 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct snd_xferi),
488 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi), 460 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct snd_xferi),
489 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern), 461 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct snd_xfern),
490 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern), 462 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct snd_xfern),
491 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int), 463 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int),
492 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61), 464 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
493}; 465};
@@ -507,7 +479,7 @@ enum {
507 479
508#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) 480#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
509 481
510enum sndrv_rawmidi_stream { 482enum {
511 SNDRV_RAWMIDI_STREAM_OUTPUT = 0, 483 SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
512 SNDRV_RAWMIDI_STREAM_INPUT, 484 SNDRV_RAWMIDI_STREAM_INPUT,
513 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, 485 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
@@ -517,10 +489,10 @@ enum sndrv_rawmidi_stream {
517#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 489#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
518#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 490#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
519 491
520struct sndrv_rawmidi_info { 492struct snd_rawmidi_info {
521 unsigned int device; /* RO/WR (control): device number */ 493 unsigned int device; /* RO/WR (control): device number */
522 unsigned int subdevice; /* RO/WR (control): subdevice number */ 494 unsigned int subdevice; /* RO/WR (control): subdevice number */
523 enum sndrv_rawmidi_stream stream; /* WR: stream */ 495 int stream; /* WR: stream */
524 int card; /* R: card number */ 496 int card; /* R: card number */
525 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 497 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
526 unsigned char id[64]; /* ID (user selectable) */ 498 unsigned char id[64]; /* ID (user selectable) */
@@ -531,16 +503,16 @@ struct sndrv_rawmidi_info {
531 unsigned char reserved[64]; /* reserved for future use */ 503 unsigned char reserved[64]; /* reserved for future use */
532}; 504};
533 505
534struct sndrv_rawmidi_params { 506struct snd_rawmidi_params {
535 enum sndrv_rawmidi_stream stream; 507 int stream;
536 size_t buffer_size; /* queue size in bytes */ 508 size_t buffer_size; /* queue size in bytes */
537 size_t avail_min; /* minimum avail bytes for wakeup */ 509 size_t avail_min; /* minimum avail bytes for wakeup */
538 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ 510 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
539 unsigned char reserved[16]; /* reserved for future use */ 511 unsigned char reserved[16]; /* reserved for future use */
540}; 512};
541 513
542struct sndrv_rawmidi_status { 514struct snd_rawmidi_status {
543 enum sndrv_rawmidi_stream stream; 515 int stream;
544 struct timespec tstamp; /* Timestamp */ 516 struct timespec tstamp; /* Timestamp */
545 size_t avail; /* available bytes */ 517 size_t avail; /* available bytes */
546 size_t xruns; /* count of overruns since last status (in bytes) */ 518 size_t xruns; /* count of overruns since last status (in bytes) */
@@ -549,9 +521,9 @@ struct sndrv_rawmidi_status {
549 521
550enum { 522enum {
551 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int), 523 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int),
552 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info), 524 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct snd_rawmidi_info),
553 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params), 525 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct snd_rawmidi_params),
554 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status), 526 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct snd_rawmidi_status),
555 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int), 527 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int),
556 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int), 528 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
557}; 529};
@@ -562,7 +534,7 @@ enum {
562 534
563#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) 535#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
564 536
565enum sndrv_timer_class { 537enum {
566 SNDRV_TIMER_CLASS_NONE = -1, 538 SNDRV_TIMER_CLASS_NONE = -1,
567 SNDRV_TIMER_CLASS_SLAVE = 0, 539 SNDRV_TIMER_CLASS_SLAVE = 0,
568 SNDRV_TIMER_CLASS_GLOBAL, 540 SNDRV_TIMER_CLASS_GLOBAL,
@@ -572,7 +544,7 @@ enum sndrv_timer_class {
572}; 544};
573 545
574/* slave timer classes */ 546/* slave timer classes */
575enum sndrv_timer_slave_class { 547enum {
576 SNDRV_TIMER_SCLASS_NONE = 0, 548 SNDRV_TIMER_SCLASS_NONE = 0,
577 SNDRV_TIMER_SCLASS_APPLICATION, 549 SNDRV_TIMER_SCLASS_APPLICATION,
578 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ 550 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
@@ -588,16 +560,16 @@ enum sndrv_timer_slave_class {
588/* info flags */ 560/* info flags */
589#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 561#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
590 562
591struct sndrv_timer_id { 563struct snd_timer_id {
592 enum sndrv_timer_class dev_class; 564 int dev_class;
593 enum sndrv_timer_slave_class dev_sclass; 565 int dev_sclass;
594 int card; 566 int card;
595 int device; 567 int device;
596 int subdevice; 568 int subdevice;
597}; 569};
598 570
599struct sndrv_timer_ginfo { 571struct snd_timer_ginfo {
600 struct sndrv_timer_id tid; /* requested timer ID */ 572 struct snd_timer_id tid; /* requested timer ID */
601 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 573 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
602 int card; /* card number */ 574 int card; /* card number */
603 unsigned char id[64]; /* timer identification */ 575 unsigned char id[64]; /* timer identification */
@@ -610,27 +582,27 @@ struct sndrv_timer_ginfo {
610 unsigned char reserved[32]; 582 unsigned char reserved[32];
611}; 583};
612 584
613struct sndrv_timer_gparams { 585struct snd_timer_gparams {
614 struct sndrv_timer_id tid; /* requested timer ID */ 586 struct snd_timer_id tid; /* requested timer ID */
615 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ 587 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
616 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ 588 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
617 unsigned char reserved[32]; 589 unsigned char reserved[32];
618}; 590};
619 591
620struct sndrv_timer_gstatus { 592struct snd_timer_gstatus {
621 struct sndrv_timer_id tid; /* requested timer ID */ 593 struct snd_timer_id tid; /* requested timer ID */
622 unsigned long resolution; /* current period resolution in ns */ 594 unsigned long resolution; /* current period resolution in ns */
623 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ 595 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
624 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ 596 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
625 unsigned char reserved[32]; 597 unsigned char reserved[32];
626}; 598};
627 599
628struct sndrv_timer_select { 600struct snd_timer_select {
629 struct sndrv_timer_id id; /* bind to timer ID */ 601 struct snd_timer_id id; /* bind to timer ID */
630 unsigned char reserved[32]; /* reserved */ 602 unsigned char reserved[32]; /* reserved */
631}; 603};
632 604
633struct sndrv_timer_info { 605struct snd_timer_info {
634 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 606 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
635 int card; /* card number */ 607 int card; /* card number */
636 unsigned char id[64]; /* timer identificator */ 608 unsigned char id[64]; /* timer identificator */
@@ -644,7 +616,7 @@ struct sndrv_timer_info {
644#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ 616#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
645#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ 617#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
646 618
647struct sndrv_timer_params { 619struct snd_timer_params {
648 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ 620 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
649 unsigned int ticks; /* requested resolution in ticks */ 621 unsigned int ticks; /* requested resolution in ticks */
650 unsigned int queue_size; /* total size of queue (32-1024) */ 622 unsigned int queue_size; /* total size of queue (32-1024) */
@@ -653,7 +625,7 @@ struct sndrv_timer_params {
653 unsigned char reserved[60]; /* reserved */ 625 unsigned char reserved[60]; /* reserved */
654}; 626};
655 627
656struct sndrv_timer_status { 628struct snd_timer_status {
657 struct timespec tstamp; /* Timestamp - last update */ 629 struct timespec tstamp; /* Timestamp - last update */
658 unsigned int resolution; /* current period resolution in ns */ 630 unsigned int resolution; /* current period resolution in ns */
659 unsigned int lost; /* counter of master tick lost */ 631 unsigned int lost; /* counter of master tick lost */
@@ -664,15 +636,15 @@ struct sndrv_timer_status {
664 636
665enum { 637enum {
666 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), 638 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
667 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id), 639 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct snd_timer_id),
668 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), 640 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int),
669 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo), 641 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct snd_timer_ginfo),
670 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams), 642 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct snd_timer_gparams),
671 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus), 643 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct snd_timer_gstatus),
672 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select), 644 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct snd_timer_select),
673 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), 645 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct snd_timer_info),
674 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), 646 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct snd_timer_params),
675 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), 647 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct snd_timer_status),
676 /* The following four ioctls are changed since 1.0.9 due to confliction */ 648 /* The following four ioctls are changed since 1.0.9 due to confliction */
677 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), 649 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0),
678 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), 650 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1),
@@ -680,12 +652,12 @@ enum {
680 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3), 652 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
681}; 653};
682 654
683struct sndrv_timer_read { 655struct snd_timer_read {
684 unsigned int resolution; 656 unsigned int resolution;
685 unsigned int ticks; 657 unsigned int ticks;
686}; 658};
687 659
688enum sndrv_timer_event { 660enum {
689 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ 661 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
690 SNDRV_TIMER_EVENT_TICK, /* val = ticks */ 662 SNDRV_TIMER_EVENT_TICK, /* val = ticks */
691 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ 663 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
@@ -704,8 +676,8 @@ enum sndrv_timer_event {
704 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, 676 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
705}; 677};
706 678
707struct sndrv_timer_tread { 679struct snd_timer_tread {
708 enum sndrv_timer_event event; 680 int event;
709 struct timespec tstamp; 681 struct timespec tstamp;
710 unsigned int val; 682 unsigned int val;
711}; 683};
@@ -718,7 +690,7 @@ struct sndrv_timer_tread {
718 690
719#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) 691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3)
720 692
721struct sndrv_ctl_card_info { 693struct snd_ctl_card_info {
722 int card; /* card number */ 694 int card; /* card number */
723 int pad; /* reserved for future (was type) */ 695 int pad; /* reserved for future (was type) */
724 unsigned char id[16]; /* ID of card (user selectable) */ 696 unsigned char id[16]; /* ID of card (user selectable) */
@@ -731,27 +703,25 @@ struct sndrv_ctl_card_info {
731 unsigned char reserved[48]; /* reserved for future */ 703 unsigned char reserved[48]; /* reserved for future */
732}; 704};
733 705
734enum sndrv_ctl_elem_type { 706typedef int __bitwise snd_ctl_elem_type_t;
735 SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */ 707#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
736 SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */ 708#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
737 SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */ 709#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
738 SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */ 710#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
739 SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */ 711#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
740 SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */ 712#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
741 SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */ 713#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
742 SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64, 714#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
743}; 715
744 716typedef int __bitwise snd_ctl_elem_iface_t;
745enum sndrv_ctl_elem_iface { 717#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
746 SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */ 718#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
747 SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */ 719#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
748 SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */ 720#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
749 SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */ 721#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
750 SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */ 722#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
751 SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */ 723#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
752 SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */ 724#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
753 SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
754};
755 725
756#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) 726#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
757#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 727#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
@@ -773,27 +743,27 @@ enum sndrv_ctl_elem_iface {
773#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ 743#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
774#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ 744#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
775 745
776struct sndrv_ctl_elem_id { 746struct snd_ctl_elem_id {
777 unsigned int numid; /* numeric identifier, zero = invalid */ 747 unsigned int numid; /* numeric identifier, zero = invalid */
778 enum sndrv_ctl_elem_iface iface; /* interface identifier */ 748 snd_ctl_elem_iface_t iface; /* interface identifier */
779 unsigned int device; /* device/client number */ 749 unsigned int device; /* device/client number */
780 unsigned int subdevice; /* subdevice (substream) number */ 750 unsigned int subdevice; /* subdevice (substream) number */
781 unsigned char name[44]; /* ASCII name of item */ 751 unsigned char name[44]; /* ASCII name of item */
782 unsigned int index; /* index of item */ 752 unsigned int index; /* index of item */
783}; 753};
784 754
785struct sndrv_ctl_elem_list { 755struct snd_ctl_elem_list {
786 unsigned int offset; /* W: first element ID to get */ 756 unsigned int offset; /* W: first element ID to get */
787 unsigned int space; /* W: count of element IDs to get */ 757 unsigned int space; /* W: count of element IDs to get */
788 unsigned int used; /* R: count of element IDs set */ 758 unsigned int used; /* R: count of element IDs set */
789 unsigned int count; /* R: count of all elements */ 759 unsigned int count; /* R: count of all elements */
790 struct sndrv_ctl_elem_id __user *pids; /* R: IDs */ 760 struct snd_ctl_elem_id __user *pids; /* R: IDs */
791 unsigned char reserved[50]; 761 unsigned char reserved[50];
792}; 762};
793 763
794struct sndrv_ctl_elem_info { 764struct snd_ctl_elem_info {
795 struct sndrv_ctl_elem_id id; /* W: element ID */ 765 struct snd_ctl_elem_id id; /* W: element ID */
796 enum sndrv_ctl_elem_type type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ 766 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
797 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ 767 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
798 unsigned int count; /* count of values */ 768 unsigned int count; /* count of values */
799 pid_t owner; /* owner's PID of this control */ 769 pid_t owner; /* owner's PID of this control */
@@ -822,8 +792,8 @@ struct sndrv_ctl_elem_info {
822 unsigned char reserved[64-4*sizeof(unsigned short)]; 792 unsigned char reserved[64-4*sizeof(unsigned short)];
823}; 793};
824 794
825struct sndrv_ctl_elem_value { 795struct snd_ctl_elem_value {
826 struct sndrv_ctl_elem_id id; /* W: element ID */ 796 struct snd_ctl_elem_id id; /* W: element ID */
827 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */ 797 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */
828 union { 798 union {
829 union { 799 union {
@@ -842,7 +812,7 @@ struct sndrv_ctl_elem_value {
842 unsigned char data[512]; 812 unsigned char data[512];
843 unsigned char *data_ptr; 813 unsigned char *data_ptr;
844 } bytes; 814 } bytes;
845 struct sndrv_aes_iec958 iec958; 815 struct snd_aes_iec958 iec958;
846 } value; /* RO */ 816 } value; /* RO */
847 struct timespec tstamp; 817 struct timespec tstamp;
848 unsigned char reserved[128-sizeof(struct timespec)]; 818 unsigned char reserved[128-sizeof(struct timespec)];
@@ -850,24 +820,24 @@ struct sndrv_ctl_elem_value {
850 820
851enum { 821enum {
852 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 822 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
853 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info), 823 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
854 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list), 824 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct snd_ctl_elem_list),
855 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info), 825 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct snd_ctl_elem_info),
856 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value), 826 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct snd_ctl_elem_value),
857 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value), 827 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct snd_ctl_elem_value),
858 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id), 828 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct snd_ctl_elem_id),
859 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id), 829 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct snd_ctl_elem_id),
860 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int), 830 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int),
861 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct sndrv_ctl_elem_info), 831 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info),
862 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct sndrv_ctl_elem_info), 832 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info),
863 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct sndrv_ctl_elem_id), 833 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id),
864 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 834 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
865 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info), 835 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info),
866 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 836 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
867 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info), 837 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct snd_pcm_info),
868 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int), 838 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int),
869 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int), 839 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int),
870 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info), 840 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct snd_rawmidi_info),
871 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int), 841 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
872 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int), 842 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
873 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int), 843 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
@@ -887,12 +857,12 @@ enum sndrv_ctl_event_type {
887#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ 857#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
888#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ 858#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
889 859
890struct sndrv_ctl_event { 860struct snd_ctl_event {
891 enum sndrv_ctl_event_type type; /* event type - SNDRV_CTL_EVENT_* */ 861 int type; /* event type - SNDRV_CTL_EVENT_* */
892 union { 862 union {
893 struct { 863 struct {
894 unsigned int mask; 864 unsigned int mask;
895 struct sndrv_ctl_elem_id id; 865 struct snd_ctl_elem_id id;
896 } elem; 866 } elem;
897 unsigned char data8[60]; 867 unsigned char data8[60];
898 } data; 868 } data;
@@ -920,14 +890,14 @@ struct sndrv_ctl_event {
920 * 890 *
921 */ 891 */
922 892
923struct sndrv_xferv { 893struct snd_xferv {
924 const struct iovec *vector; 894 const struct iovec *vector;
925 unsigned long count; 895 unsigned long count;
926}; 896};
927 897
928enum { 898enum {
929 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct sndrv_xferv), 899 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct snd_xferv),
930 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct sndrv_xferv), 900 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct snd_xferv),
931}; 901};
932 902
933#endif /* __SOUND_ASOUND_H */ 903#endif /* __SOUND_ASOUND_H */
diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h
index b0da677f8f75..956fdc23c595 100644
--- a/include/sound/asound_fm.h
+++ b/include/sound/asound_fm.h
@@ -29,16 +29,16 @@
29#define SNDRV_DM_FM_MODE_OPL2 0x00 29#define SNDRV_DM_FM_MODE_OPL2 0x00
30#define SNDRV_DM_FM_MODE_OPL3 0x01 30#define SNDRV_DM_FM_MODE_OPL3 0x01
31 31
32typedef struct snd_dm_fm_info { 32struct snd_dm_fm_info {
33 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 33 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
34 unsigned char rhythm; /* percussion mode flag */ 34 unsigned char rhythm; /* percussion mode flag */
35} snd_dm_fm_info_t; 35};
36 36
37/* 37/*
38 * Data structure composing an FM "note" or sound event. 38 * Data structure composing an FM "note" or sound event.
39 */ 39 */
40 40
41typedef struct snd_dm_fm_voice { 41struct snd_dm_fm_voice {
42 unsigned char op; /* operator cell (0 or 1) */ 42 unsigned char op; /* operator cell (0 or 1) */
43 unsigned char voice; /* FM voice (0 to 17) */ 43 unsigned char voice; /* FM voice (0 to 17) */
44 44
@@ -60,25 +60,25 @@ typedef struct snd_dm_fm_voice {
60 unsigned char left; /* stereo left */ 60 unsigned char left; /* stereo left */
61 unsigned char right; /* stereo right */ 61 unsigned char right; /* stereo right */
62 unsigned char waveform; /* 3 bits: waveform shape */ 62 unsigned char waveform; /* 3 bits: waveform shape */
63} snd_dm_fm_voice_t; 63};
64 64
65/* 65/*
66 * This describes an FM note by its voice, octave, frequency number (10bit) 66 * This describes an FM note by its voice, octave, frequency number (10bit)
67 * and key on/off. 67 * and key on/off.
68 */ 68 */
69 69
70typedef struct snd_dm_fm_note { 70struct snd_dm_fm_note {
71 unsigned char voice; /* 0-17 voice channel */ 71 unsigned char voice; /* 0-17 voice channel */
72 unsigned char octave; /* 3 bits: what octave to play */ 72 unsigned char octave; /* 3 bits: what octave to play */
73 unsigned int fnum; /* 10 bits: frequency number */ 73 unsigned int fnum; /* 10 bits: frequency number */
74 unsigned char key_on; /* set for active, clear for silent */ 74 unsigned char key_on; /* set for active, clear for silent */
75} snd_dm_fm_note_t; 75};
76 76
77/* 77/*
78 * FM parameters that apply globally to all voices, and thus are not "notes" 78 * FM parameters that apply globally to all voices, and thus are not "notes"
79 */ 79 */
80 80
81typedef struct snd_dm_fm_params { 81struct snd_dm_fm_params {
82 unsigned char am_depth; /* amplitude modulation depth (1=hi) */ 82 unsigned char am_depth; /* amplitude modulation depth (1=hi) */
83 unsigned char vib_depth; /* vibrato depth (1=hi) */ 83 unsigned char vib_depth; /* vibrato depth (1=hi) */
84 unsigned char kbd_split; /* keyboard split */ 84 unsigned char kbd_split; /* keyboard split */
@@ -90,17 +90,17 @@ typedef struct snd_dm_fm_params {
90 unsigned char tomtom; 90 unsigned char tomtom;
91 unsigned char cymbal; 91 unsigned char cymbal;
92 unsigned char hihat; 92 unsigned char hihat;
93} snd_dm_fm_params_t; 93};
94 94
95/* 95/*
96 * FM mode ioctl settings 96 * FM mode ioctl settings
97 */ 97 */
98 98
99#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t) 99#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
100#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) 100#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
101#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t) 101#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
102#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t) 102#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
103#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t) 103#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
105/* for OPL3 only */ 105/* for OPL3 only */
106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
diff --git a/include/sound/control.h b/include/sound/control.h
index ef7903c7a327..2489b1eb0110 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -24,24 +24,14 @@
24 24
25#include <sound/asound.h> 25#include <sound/asound.h>
26 26
27typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
28typedef struct sndrv_ctl_card_info snd_ctl_card_info_t;
29typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t;
30typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t;
31typedef struct sndrv_ctl_elem_id snd_ctl_elem_id_t;
32typedef struct sndrv_ctl_elem_list snd_ctl_elem_list_t;
33typedef struct sndrv_ctl_elem_info snd_ctl_elem_info_t;
34typedef struct sndrv_ctl_elem_value snd_ctl_elem_value_t;
35typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
36typedef struct sndrv_ctl_event snd_ctl_event_t;
37
38#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data) 27#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
39 28
40typedef int (snd_kcontrol_info_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo); 29struct snd_kcontrol;
41typedef int (snd_kcontrol_get_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
42typedef int (snd_kcontrol_put_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
43 33
44typedef struct _snd_kcontrol_new { 34struct snd_kcontrol_new {
45 snd_ctl_elem_iface_t iface; /* interface identifier */ 35 snd_ctl_elem_iface_t iface; /* interface identifier */
46 unsigned int device; /* device/client number */ 36 unsigned int device; /* device/client number */
47 unsigned int subdevice; /* subdevice (substream) number */ 37 unsigned int subdevice; /* subdevice (substream) number */
@@ -53,40 +43,40 @@ typedef struct _snd_kcontrol_new {
53 snd_kcontrol_get_t *get; 43 snd_kcontrol_get_t *get;
54 snd_kcontrol_put_t *put; 44 snd_kcontrol_put_t *put;
55 unsigned long private_value; 45 unsigned long private_value;
56} snd_kcontrol_new_t; 46};
57 47
58typedef struct _snd_kcontrol_volatile { 48struct snd_kcontrol_volatile {
59 snd_ctl_file_t *owner; /* locked */ 49 struct snd_ctl_file *owner; /* locked */
60 pid_t owner_pid; 50 pid_t owner_pid;
61 unsigned int access; /* access rights */ 51 unsigned int access; /* access rights */
62} snd_kcontrol_volatile_t; 52};
63 53
64struct _snd_kcontrol { 54struct snd_kcontrol {
65 struct list_head list; /* list of controls */ 55 struct list_head list; /* list of controls */
66 snd_ctl_elem_id_t id; 56 struct snd_ctl_elem_id id;
67 unsigned int count; /* count of same elements */ 57 unsigned int count; /* count of same elements */
68 snd_kcontrol_info_t *info; 58 snd_kcontrol_info_t *info;
69 snd_kcontrol_get_t *get; 59 snd_kcontrol_get_t *get;
70 snd_kcontrol_put_t *put; 60 snd_kcontrol_put_t *put;
71 unsigned long private_value; 61 unsigned long private_value;
72 void *private_data; 62 void *private_data;
73 void (*private_free)(snd_kcontrol_t *kcontrol); 63 void (*private_free)(struct snd_kcontrol *kcontrol);
74 snd_kcontrol_volatile_t vd[0]; /* volatile data */ 64 struct snd_kcontrol_volatile vd[0]; /* volatile data */
75}; 65};
76 66
77#define snd_kcontrol(n) list_entry(n, snd_kcontrol_t, list) 67#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
78 68
79typedef struct _snd_kctl_event { 69struct snd_kctl_event {
80 struct list_head list; /* list of events */ 70 struct list_head list; /* list of events */
81 snd_ctl_elem_id_t id; 71 struct snd_ctl_elem_id id;
82 unsigned int mask; 72 unsigned int mask;
83} snd_kctl_event_t; 73};
84 74
85#define snd_kctl_event(n) list_entry(n, snd_kctl_event_t, list) 75#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
86 76
87struct _snd_ctl_file { 77struct snd_ctl_file {
88 struct list_head list; /* list of all control files */ 78 struct list_head list; /* list of all control files */
89 snd_card_t *card; 79 struct snd_card *card;
90 pid_t pid; 80 pid_t pid;
91 int prefer_pcm_subdevice; 81 int prefer_pcm_subdevice;
92 int prefer_rawmidi_subdevice; 82 int prefer_rawmidi_subdevice;
@@ -97,25 +87,25 @@ struct _snd_ctl_file {
97 struct list_head events; /* waiting events for read */ 87 struct list_head events; /* waiting events for read */
98}; 88};
99 89
100#define snd_ctl_file(n) list_entry(n, snd_ctl_file_t, list) 90#define snd_ctl_file(n) list_entry(n, struct snd_ctl_file, list)
101 91
102typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card, 92typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
103 snd_ctl_file_t * control, 93 struct snd_ctl_file * control,
104 unsigned int cmd, unsigned long arg); 94 unsigned int cmd, unsigned long arg);
105 95
106void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id); 96void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
107 97
108snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access); 98struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol * kcontrol, unsigned int access);
109snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * kcontrolnew, void * private_data); 99struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data);
110void snd_ctl_free_one(snd_kcontrol_t * kcontrol); 100void snd_ctl_free_one(struct snd_kcontrol * kcontrol);
111int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol); 101int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
112int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol); 102int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
113int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id); 103int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
114int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id); 104int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
115snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid); 105struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
116snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id); 106struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);
117 107
118int snd_ctl_create(snd_card_t *card); 108int snd_ctl_create(struct snd_card *card);
119 109
120int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn); 110int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
121int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn); 111int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
@@ -127,20 +117,20 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
127#define snd_ctl_unregister_ioctl_compat(fcn) 117#define snd_ctl_unregister_ioctl_compat(fcn)
128#endif 118#endif
129 119
130int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control); 120int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control);
131int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control); 121int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_ctl_elem_value *control);
132 122
133static inline unsigned int snd_ctl_get_ioffnum(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 123static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
134{ 124{
135 return id->numid - kctl->id.numid; 125 return id->numid - kctl->id.numid;
136} 126}
137 127
138static inline unsigned int snd_ctl_get_ioffidx(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 128static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
139{ 129{
140 return id->index - kctl->id.index; 130 return id->index - kctl->id.index;
141} 131}
142 132
143static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 133static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
144{ 134{
145 if (id->numid) { 135 if (id->numid) {
146 return snd_ctl_get_ioffnum(kctl, id); 136 return snd_ctl_get_ioffnum(kctl, id);
@@ -149,8 +139,8 @@ static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_i
149 } 139 }
150} 140}
151 141
152static inline snd_ctl_elem_id_t *snd_ctl_build_ioff(snd_ctl_elem_id_t *dst_id, 142static inline struct snd_ctl_elem_id *snd_ctl_build_ioff(struct snd_ctl_elem_id *dst_id,
153 snd_kcontrol_t *src_kctl, 143 struct snd_kcontrol *src_kctl,
154 unsigned int offset) 144 unsigned int offset)
155{ 145{
156 *dst_id = src_kctl->id; 146 *dst_id = src_kctl->id;
diff --git a/include/sound/core.h b/include/sound/core.h
index 2be65ad2fd83..90ac6132ea3b 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -28,13 +28,6 @@
28#include <linux/workqueue.h> /* struct workqueue_struct */ 28#include <linux/workqueue.h> /* struct workqueue_struct */
29#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
30 30
31/* Typedef's */
32typedef struct sndrv_interval snd_interval_t;
33typedef enum sndrv_card_type snd_card_type;
34typedef struct sndrv_xferi snd_xferi_t;
35typedef struct sndrv_xfern snd_xfern_t;
36typedef struct sndrv_xferv snd_xferv_t;
37
38/* forward declarations */ 31/* forward declarations */
39#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
40struct pci_dev; 33struct pci_dev;
@@ -47,76 +40,50 @@ struct sbus_dev;
47 40
48#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 41#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000
49 42
50typedef enum { 43typedef int __bitwise snd_device_type_t;
51 SNDRV_DEV_TOPLEVEL = (0*SNDRV_DEV_TYPE_RANGE_SIZE), 44#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0)
52 SNDRV_DEV_CONTROL, 45#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1)
53 SNDRV_DEV_LOWLEVEL_PRE, 46#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2)
54 SNDRV_DEV_LOWLEVEL_NORMAL = (1*SNDRV_DEV_TYPE_RANGE_SIZE), 47#define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000)
55 SNDRV_DEV_PCM, 48#define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001)
56 SNDRV_DEV_RAWMIDI, 49#define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002)
57 SNDRV_DEV_TIMER, 50#define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003)
58 SNDRV_DEV_SEQUENCER, 51#define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004)
59 SNDRV_DEV_HWDEP, 52#define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005)
60 SNDRV_DEV_INFO, 53#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006)
61 SNDRV_DEV_BUS, 54#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
62 SNDRV_DEV_CODEC, 55#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
63 SNDRV_DEV_LOWLEVEL = (2*SNDRV_DEV_TYPE_RANGE_SIZE) 56#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
64} snd_device_type_t; 57
65 58typedef int __bitwise snd_device_state_t;
66typedef enum { 59#define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0)
67 SNDRV_DEV_BUILD, 60#define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1)
68 SNDRV_DEV_REGISTERED, 61#define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2)
69 SNDRV_DEV_DISCONNECTED 62
70} snd_device_state_t; 63typedef int __bitwise snd_device_cmd_t;
71 64#define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0)
72typedef enum { 65#define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1)
73 SNDRV_DEV_CMD_PRE = 0, 66#define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2)
74 SNDRV_DEV_CMD_NORMAL = 1, 67
75 SNDRV_DEV_CMD_POST = 2 68struct snd_device;
76} snd_device_cmd_t; 69
77 70struct snd_device_ops {
78typedef struct _snd_card snd_card_t; 71 int (*dev_free)(struct snd_device *dev);
79typedef struct _snd_device snd_device_t; 72 int (*dev_register)(struct snd_device *dev);
80 73 int (*dev_disconnect)(struct snd_device *dev);
81typedef int (snd_dev_free_t)(snd_device_t *device); 74 int (*dev_unregister)(struct snd_device *dev);
82typedef int (snd_dev_register_t)(snd_device_t *device); 75};
83typedef int (snd_dev_disconnect_t)(snd_device_t *device); 76
84typedef int (snd_dev_unregister_t)(snd_device_t *device); 77struct snd_device {
85
86typedef struct {
87 snd_dev_free_t *dev_free;
88 snd_dev_register_t *dev_register;
89 snd_dev_disconnect_t *dev_disconnect;
90 snd_dev_unregister_t *dev_unregister;
91} snd_device_ops_t;
92
93struct _snd_device {
94 struct list_head list; /* list of registered devices */ 78 struct list_head list; /* list of registered devices */
95 snd_card_t *card; /* card which holds this device */ 79 struct snd_card *card; /* card which holds this device */
96 snd_device_state_t state; /* state of the device */ 80 snd_device_state_t state; /* state of the device */
97 snd_device_type_t type; /* device type */ 81 snd_device_type_t type; /* device type */
98 void *device_data; /* device structure */ 82 void *device_data; /* device structure */
99 snd_device_ops_t *ops; /* operations */ 83 struct snd_device_ops *ops; /* operations */
100}; 84};
101 85
102#define snd_device(n) list_entry(n, snd_device_t, list) 86#define snd_device(n) list_entry(n, struct snd_device, list)
103
104/* various typedefs */
105
106typedef struct snd_info_entry snd_info_entry_t;
107typedef struct _snd_pcm snd_pcm_t;
108typedef struct _snd_pcm_str snd_pcm_str_t;
109typedef struct _snd_pcm_substream snd_pcm_substream_t;
110typedef struct _snd_mixer snd_kmixer_t;
111typedef struct _snd_rawmidi snd_rawmidi_t;
112typedef struct _snd_ctl_file snd_ctl_file_t;
113typedef struct _snd_kcontrol snd_kcontrol_t;
114typedef struct _snd_timer snd_timer_t;
115typedef struct _snd_timer_instance snd_timer_instance_t;
116typedef struct _snd_hwdep snd_hwdep_t;
117#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
118typedef struct _snd_oss_mixer snd_mixer_oss_t;
119#endif
120 87
121/* monitor files for graceful shutdown (hotplug) */ 88/* monitor files for graceful shutdown (hotplug) */
122 89
@@ -129,7 +96,7 @@ struct snd_shutdown_f_ops; /* define it later in init.c */
129 96
130/* main structure for soundcard */ 97/* main structure for soundcard */
131 98
132struct _snd_card { 99struct snd_card {
133 int number; /* number of soundcard (index to 100 int number; /* number of soundcard (index to
134 snd_cards) */ 101 snd_cards) */
135 102
@@ -143,7 +110,7 @@ struct _snd_card {
143 struct module *module; /* top-level module */ 110 struct module *module; /* top-level module */
144 111
145 void *private_data; /* private data for soundcard */ 112 void *private_data; /* private data for soundcard */
146 void (*private_free) (snd_card_t *card); /* callback for freeing of 113 void (*private_free) (struct snd_card *card); /* callback for freeing of
147 private data */ 114 private data */
148 struct list_head devices; /* devices */ 115 struct list_head devices; /* devices */
149 116
@@ -155,8 +122,8 @@ struct _snd_card {
155 struct list_head controls; /* all controls for this card */ 122 struct list_head controls; /* all controls for this card */
156 struct list_head ctl_files; /* active control files */ 123 struct list_head ctl_files; /* active control files */
157 124
158 snd_info_entry_t *proc_root; /* root for soundcard specific files */ 125 struct snd_info_entry *proc_root; /* root for soundcard specific files */
159 snd_info_entry_t *proc_id; /* the card id */ 126 struct snd_info_entry *proc_id; /* the card id */
160 struct proc_dir_entry *proc_root_link; /* number link to real id */ 127 struct proc_dir_entry *proc_root_link; /* number link to real id */
161 128
162 struct snd_monitor_file *files; /* all files associated to this card */ 129 struct snd_monitor_file *files; /* all files associated to this card */
@@ -167,92 +134,64 @@ struct _snd_card {
167 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
168 struct work_struct free_workq; /* for free in workqueue */ 135 struct work_struct free_workq; /* for free in workqueue */
169 struct device *dev; 136 struct device *dev;
170#ifdef CONFIG_SND_GENERIC_DRIVER
171 struct snd_generic_device *generic_dev;
172#endif
173 137
174#ifdef CONFIG_PM 138#ifdef CONFIG_PM
175 int (*pm_suspend)(snd_card_t *card, pm_message_t state);
176 int (*pm_resume)(snd_card_t *card);
177 void *pm_private_data;
178 unsigned int power_state; /* power state */ 139 unsigned int power_state; /* power state */
179 struct semaphore power_lock; /* power lock */ 140 struct semaphore power_lock; /* power lock */
180 wait_queue_head_t power_sleep; 141 wait_queue_head_t power_sleep;
181#endif 142#endif
182 143
183#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 144#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
184 snd_mixer_oss_t *mixer_oss; 145 struct snd_mixer_oss *mixer_oss;
185 int mixer_oss_change_count; 146 int mixer_oss_change_count;
186#endif 147#endif
187}; 148};
188 149
189#ifdef CONFIG_PM 150#ifdef CONFIG_PM
190static inline void snd_power_lock(snd_card_t *card) 151static inline void snd_power_lock(struct snd_card *card)
191{ 152{
192 down(&card->power_lock); 153 down(&card->power_lock);
193} 154}
194 155
195static inline void snd_power_unlock(snd_card_t *card) 156static inline void snd_power_unlock(struct snd_card *card)
196{ 157{
197 up(&card->power_lock); 158 up(&card->power_lock);
198} 159}
199 160
200static inline unsigned int snd_power_get_state(snd_card_t *card) 161static inline unsigned int snd_power_get_state(struct snd_card *card)
201{ 162{
202 return card->power_state; 163 return card->power_state;
203} 164}
204 165
205static inline void snd_power_change_state(snd_card_t *card, unsigned int state) 166static inline void snd_power_change_state(struct snd_card *card, unsigned int state)
206{ 167{
207 card->power_state = state; 168 card->power_state = state;
208 wake_up(&card->power_sleep); 169 wake_up(&card->power_sleep);
209} 170}
210 171
211/* init.c */ 172/* init.c */
212int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file); 173int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file);
213
214int snd_card_set_pm_callback(snd_card_t *card,
215 int (*suspend)(snd_card_t *, pm_message_t),
216 int (*resume)(snd_card_t *),
217 void *private_data);
218int snd_card_set_generic_pm_callback(snd_card_t *card,
219 int (*suspend)(snd_card_t *, pm_message_t),
220 int (*resume)(snd_card_t *),
221 void *private_data);
222#define snd_card_set_isa_pm_callback(card,suspend,resume,data) \
223 snd_card_set_generic_pm_callback(card, suspend, resume, data)
224struct pci_dev;
225int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state);
226int snd_card_pci_resume(struct pci_dev *dev);
227#define SND_PCI_PM_CALLBACKS \
228 .suspend = snd_card_pci_suspend, .resume = snd_card_pci_resume
229 174
230#else /* ! CONFIG_PM */ 175#else /* ! CONFIG_PM */
231 176
232#define snd_power_lock(card) do { (void)(card); } while (0) 177#define snd_power_lock(card) do { (void)(card); } while (0)
233#define snd_power_unlock(card) do { (void)(card); } while (0) 178#define snd_power_unlock(card) do { (void)(card); } while (0)
234static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct file *file) { return 0; } 179static inline int snd_power_wait(struct snd_card *card, unsigned int state, struct file *file) { return 0; }
235#define snd_power_get_state(card) SNDRV_CTL_POWER_D0 180#define snd_power_get_state(card) SNDRV_CTL_POWER_D0
236#define snd_power_change_state(card, state) do { (void)(card); } while (0) 181#define snd_power_change_state(card, state) do { (void)(card); } while (0)
237#define snd_card_set_pm_callback(card,suspend,resume,data)
238#define snd_card_set_generic_pm_callback(card,suspend,resume,data)
239#define snd_card_set_isa_pm_callback(card,suspend,resume,data)
240#define SND_PCI_PM_CALLBACKS
241 182
242#endif /* CONFIG_PM */ 183#endif /* CONFIG_PM */
243 184
244struct _snd_minor { 185struct snd_minor {
245 struct list_head list; /* list of all minors per card */ 186 int type; /* SNDRV_DEVICE_TYPE_XXX */
246 int number; /* minor number */ 187 int card; /* card number */
247 int device; /* device number */ 188 int device; /* device number */
248 const char *comment; /* for /proc/asound/devices */
249 struct file_operations *f_ops; /* file operations */ 189 struct file_operations *f_ops; /* file operations */
190 void *private_data; /* private data for f_ops->open */
250 char name[0]; /* device name (keep at the end of 191 char name[0]; /* device name (keep at the end of
251 structure) */ 192 structure) */
252}; 193};
253 194
254typedef struct _snd_minor snd_minor_t;
255
256/* sound.c */ 195/* sound.c */
257 196
258extern int snd_major; 197extern int snd_major;
@@ -260,12 +199,18 @@ extern int snd_ecards_limit;
260 199
261void snd_request_card(int card); 200void snd_request_card(int card);
262 201
263int snd_register_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); 202int snd_register_device(int type, struct snd_card *card, int dev,
264int snd_unregister_device(int type, snd_card_t *card, int dev); 203 struct file_operations *f_ops, void *private_data,
204 const char *name);
205int snd_unregister_device(int type, struct snd_card *card, int dev);
206void *snd_lookup_minor_data(unsigned int minor, int type);
265 207
266#ifdef CONFIG_SND_OSSEMUL 208#ifdef CONFIG_SND_OSSEMUL
267int snd_register_oss_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); 209int snd_register_oss_device(int type, struct snd_card *card, int dev,
268int snd_unregister_oss_device(int type, snd_card_t *card, int dev); 210 struct file_operations *f_ops, void *private_data,
211 const char *name);
212int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
213void *snd_lookup_oss_minor_data(unsigned int minor, int type);
269#endif 214#endif
270 215
271int snd_minor_info_init(void); 216int snd_minor_info_init(void);
@@ -276,11 +221,9 @@ int snd_minor_info_done(void);
276#ifdef CONFIG_SND_OSSEMUL 221#ifdef CONFIG_SND_OSSEMUL
277int snd_minor_info_oss_init(void); 222int snd_minor_info_oss_init(void);
278int snd_minor_info_oss_done(void); 223int snd_minor_info_oss_done(void);
279int snd_oss_init_module(void);
280#else 224#else
281#define snd_minor_info_oss_init() /*NOP*/ 225#define snd_minor_info_oss_init() /*NOP*/
282#define snd_minor_info_oss_done() /*NOP*/ 226#define snd_minor_info_oss_done() /*NOP*/
283#define snd_oss_init_module() 0
284#endif 227#endif
285 228
286/* memory.c */ 229/* memory.c */
@@ -291,43 +234,41 @@ int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size
291/* init.c */ 234/* init.c */
292 235
293extern unsigned int snd_cards_lock; 236extern unsigned int snd_cards_lock;
294extern snd_card_t *snd_cards[SNDRV_CARDS]; 237extern struct snd_card *snd_cards[SNDRV_CARDS];
295extern rwlock_t snd_card_rwlock; 238extern rwlock_t snd_card_rwlock;
296#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 239#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
297#define SND_MIXER_OSS_NOTIFY_REGISTER 0 240#define SND_MIXER_OSS_NOTIFY_REGISTER 0
298#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1 241#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1
299#define SND_MIXER_OSS_NOTIFY_FREE 2 242#define SND_MIXER_OSS_NOTIFY_FREE 2
300extern int (*snd_mixer_oss_notify_callback)(snd_card_t *card, int cmd); 243extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
301#endif 244#endif
302 245
303snd_card_t *snd_card_new(int idx, const char *id, 246struct snd_card *snd_card_new(int idx, const char *id,
304 struct module *module, int extra_size); 247 struct module *module, int extra_size);
305int snd_card_disconnect(snd_card_t *card); 248int snd_card_disconnect(struct snd_card *card);
306int snd_card_free(snd_card_t *card); 249int snd_card_free(struct snd_card *card);
307int snd_card_free_in_thread(snd_card_t *card); 250int snd_card_free_in_thread(struct snd_card *card);
308int snd_card_register(snd_card_t *card); 251int snd_card_register(struct snd_card *card);
309int snd_card_info_init(void); 252int snd_card_info_init(void);
310int snd_card_info_done(void); 253int snd_card_info_done(void);
311int snd_component_add(snd_card_t *card, const char *component); 254int snd_component_add(struct snd_card *card, const char *component);
312int snd_card_file_add(snd_card_t *card, struct file *file); 255int snd_card_file_add(struct snd_card *card, struct file *file);
313int snd_card_file_remove(snd_card_t *card, struct file *file); 256int snd_card_file_remove(struct snd_card *card, struct file *file);
314 257
315#ifndef snd_card_set_dev 258#ifndef snd_card_set_dev
316#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 259#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
317#endif 260#endif
318/* register a generic device (for ISA, etc) */
319int snd_card_set_generic_dev(snd_card_t *card);
320 261
321/* device.c */ 262/* device.c */
322 263
323int snd_device_new(snd_card_t *card, snd_device_type_t type, 264int snd_device_new(struct snd_card *card, snd_device_type_t type,
324 void *device_data, snd_device_ops_t *ops); 265 void *device_data, struct snd_device_ops *ops);
325int snd_device_register(snd_card_t *card, void *device_data); 266int snd_device_register(struct snd_card *card, void *device_data);
326int snd_device_register_all(snd_card_t *card); 267int snd_device_register_all(struct snd_card *card);
327int snd_device_disconnect(snd_card_t *card, void *device_data); 268int snd_device_disconnect(struct snd_card *card, void *device_data);
328int snd_device_disconnect_all(snd_card_t *card); 269int snd_device_disconnect_all(struct snd_card *card);
329int snd_device_free(snd_card_t *card, void *device_data); 270int snd_device_free(struct snd_card *card, void *device_data);
330int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd); 271int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd);
331 272
332/* isadma.c */ 273/* isadma.c */
333 274
@@ -443,4 +384,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
443#endif 384#endif
444#endif 385#endif
445 386
387#include "typedefs.h"
388
446#endif /* __SOUND_CORE_H */ 389#endif /* __SOUND_CORE_H */
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h
index d7f90823778a..ac6a5d882088 100644
--- a/include/sound/cs4231.h
+++ b/include/sound/cs4231.h
@@ -26,21 +26,6 @@
26#include "pcm.h" 26#include "pcm.h"
27#include "timer.h" 27#include "timer.h"
28 28
29#ifdef CONFIG_SBUS
30#define SBUS_SUPPORT
31#include <asm/sbus.h>
32#endif
33
34#if defined(CONFIG_PCI) && defined(CONFIG_SPARC64)
35#define EBUS_SUPPORT
36#include <linux/pci.h>
37#include <asm/ebus.h>
38#endif
39
40#if !defined(SBUS_SUPPORT) && !defined(EBUS_SUPPORT)
41#define LEGACY_SUPPORT
42#endif
43
44/* IO ports */ 29/* IO ports */
45 30
46#define CS4231P(x) (c_d_c_CS4231##x) 31#define CS4231P(x) (c_d_c_CS4231##x)
@@ -232,18 +217,14 @@
232#define CS4231_HWSHARE_DMA1 (1<<1) 217#define CS4231_HWSHARE_DMA1 (1<<1)
233#define CS4231_HWSHARE_DMA2 (1<<2) 218#define CS4231_HWSHARE_DMA2 (1<<2)
234 219
235typedef struct _snd_cs4231 cs4231_t; 220struct snd_cs4231 {
236
237struct _snd_cs4231 {
238 unsigned long port; /* base i/o port */ 221 unsigned long port; /* base i/o port */
239#ifdef LEGACY_SUPPORT
240 struct resource *res_port; 222 struct resource *res_port;
241 unsigned long cport; /* control base i/o port (CS4236) */ 223 unsigned long cport; /* control base i/o port (CS4236) */
242 struct resource *res_cport; 224 struct resource *res_cport;
243 int irq; /* IRQ line */ 225 int irq; /* IRQ line */
244 int dma1; /* playback DMA */ 226 int dma1; /* playback DMA */
245 int dma2; /* record DMA */ 227 int dma2; /* record DMA */
246#endif
247 unsigned short version; /* version of CODEC chip */ 228 unsigned short version; /* version of CODEC chip */
248 unsigned short mode; /* see to CS4231_MODE_XXXX */ 229 unsigned short mode; /* see to CS4231_MODE_XXXX */
249 unsigned short hardware; /* see to CS4231_HW_XXXX */ 230 unsigned short hardware; /* see to CS4231_HW_XXXX */
@@ -251,29 +232,11 @@ struct _snd_cs4231 {
251 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ 232 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
252 ebus_flag:1; /* SPARC: EBUS present */ 233 ebus_flag:1; /* SPARC: EBUS present */
253 234
254#ifdef EBUS_SUPPORT 235 struct snd_card *card;
255 struct ebus_dma_info eb2c; 236 struct snd_pcm *pcm;
256 struct ebus_dma_info eb2p; 237 struct snd_pcm_substream *playback_substream;
257#endif 238 struct snd_pcm_substream *capture_substream;
258 239 struct snd_timer *timer;
259#if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT)
260 union {
261#ifdef SBUS_SUPPORT
262 struct sbus_dev *sdev;
263#endif
264#ifdef EBUS_SUPPORT
265 struct pci_dev *pdev;
266#endif
267 } dev_u;
268 unsigned int p_periods_sent;
269 unsigned int c_periods_sent;
270#endif
271
272 snd_card_t *card;
273 snd_pcm_t *pcm;
274 snd_pcm_substream_t *playback_substream;
275 snd_pcm_substream_t *capture_substream;
276 snd_timer_t *timer;
277 240
278 unsigned char image[32]; /* registers image */ 241 unsigned char image[32]; /* registers image */
279 unsigned char eimage[32]; /* extended registers image */ 242 unsigned char eimage[32]; /* extended registers image */
@@ -281,63 +244,59 @@ struct _snd_cs4231 {
281 int mce_bit; 244 int mce_bit;
282 int calibrate_mute; 245 int calibrate_mute;
283 int sw_3d_bit; 246 int sw_3d_bit;
284#ifdef LEGACY_SUPPORT
285 unsigned int p_dma_size; 247 unsigned int p_dma_size;
286 unsigned int c_dma_size; 248 unsigned int c_dma_size;
287#endif
288 249
289 spinlock_t reg_lock; 250 spinlock_t reg_lock;
290 struct semaphore mce_mutex; 251 struct semaphore mce_mutex;
291 struct semaphore open_mutex; 252 struct semaphore open_mutex;
292 253
293 int (*rate_constraint) (snd_pcm_runtime_t *runtime); 254 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
294 void (*set_playback_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char pdfr); 255 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
295 void (*set_capture_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char cdfr); 256 void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr);
296 void (*trigger) (cs4231_t *chip, unsigned int what, int start); 257 void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start);
297#ifdef CONFIG_PM 258#ifdef CONFIG_PM
298 void (*suspend) (cs4231_t *chip); 259 void (*suspend) (struct snd_cs4231 *chip);
299 void (*resume) (cs4231_t *chip); 260 void (*resume) (struct snd_cs4231 *chip);
300#endif 261#endif
301 void *dma_private_data; 262 void *dma_private_data;
302#ifdef LEGACY_SUPPORT 263 int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
303 int (*claim_dma) (cs4231_t *chip, void *dma_private_data, int dma); 264 int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
304 int (*release_dma) (cs4231_t *chip, void *dma_private_data, int dma);
305#endif
306}; 265};
307 266
308/* exported functions */ 267/* exported functions */
309 268
310void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char val); 269void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
311unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg); 270unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg);
312void snd_cs4236_ext_out(cs4231_t *chip, unsigned char reg, unsigned char val); 271void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
313unsigned char snd_cs4236_ext_in(cs4231_t *chip, unsigned char reg); 272unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg);
314void snd_cs4231_mce_up(cs4231_t *chip); 273void snd_cs4231_mce_up(struct snd_cs4231 *chip);
315void snd_cs4231_mce_down(cs4231_t *chip); 274void snd_cs4231_mce_down(struct snd_cs4231 *chip);
316 275
317irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs); 276irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs);
318 277
319const char *snd_cs4231_chip_id(cs4231_t *chip); 278const char *snd_cs4231_chip_id(struct snd_cs4231 *chip);
320 279
321int snd_cs4231_create(snd_card_t * card, 280int snd_cs4231_create(struct snd_card *card,
322 unsigned long port, 281 unsigned long port,
323 unsigned long cport, 282 unsigned long cport,
324 int irq, int dma1, int dma2, 283 int irq, int dma1, int dma2,
325 unsigned short hardware, 284 unsigned short hardware,
326 unsigned short hwshare, 285 unsigned short hwshare,
327 cs4231_t ** rchip); 286 struct snd_cs4231 ** rchip);
328int snd_cs4231_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); 287int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
329int snd_cs4231_timer(cs4231_t * chip, int device, snd_timer_t **rtimer); 288int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer);
330int snd_cs4231_mixer(cs4231_t * chip); 289int snd_cs4231_mixer(struct snd_cs4231 * chip);
331 290
332int snd_cs4236_create(snd_card_t * card, 291int snd_cs4236_create(struct snd_card *card,
333 unsigned long port, 292 unsigned long port,
334 unsigned long cport, 293 unsigned long cport,
335 int irq, int dma1, int dma2, 294 int irq, int dma1, int dma2,
336 unsigned short hardware, 295 unsigned short hardware,
337 unsigned short hwshare, 296 unsigned short hwshare,
338 cs4231_t ** rchip); 297 struct snd_cs4231 ** rchip);
339int snd_cs4236_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); 298int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
340int snd_cs4236_mixer(cs4231_t * chip); 299int snd_cs4236_mixer(struct snd_cs4231 * chip);
341 300
342/* 301/*
343 * mixer library 302 * mixer library
@@ -349,9 +308,9 @@ int snd_cs4236_mixer(cs4231_t * chip);
349 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ 308 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \
350 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 309 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
351 310
352int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); 311int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
353int snd_cs4231_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 312int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
354int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 313int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
355 314
356#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 315#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
357{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 316{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
@@ -359,8 +318,8 @@ int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucon
359 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ 318 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
360 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 319 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
361 320
362int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); 321int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
363int snd_cs4231_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 322int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
364int snd_cs4231_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 323int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
365 324
366#endif /* __SOUND_CS4231_H */ 325#endif /* __SOUND_CS4231_H */
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index b0c0e192eb56..199b5098ff7e 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1631,42 +1631,41 @@
1631#define CS46XX_MIXER_SPDIF_INPUT_ELEMENT 1 1631#define CS46XX_MIXER_SPDIF_INPUT_ELEMENT 1
1632#define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT 2 1632#define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT 2
1633 1633
1634typedef struct _snd_cs46xx cs46xx_t;
1635 1634
1636typedef struct _snd_cs46xx_pcm_t { 1635struct snd_cs46xx_pcm {
1637 struct snd_dma_buffer hw_buf; 1636 struct snd_dma_buffer hw_buf;
1638 1637
1639 unsigned int ctl; 1638 unsigned int ctl;
1640 unsigned int shift; /* Shift count to trasform frames in bytes */ 1639 unsigned int shift; /* Shift count to trasform frames in bytes */
1641 snd_pcm_indirect_t pcm_rec; 1640 struct snd_pcm_indirect pcm_rec;
1642 snd_pcm_substream_t *substream; 1641 struct snd_pcm_substream *substream;
1643 1642
1644 pcm_channel_descriptor_t * pcm_channel; 1643 struct dsp_pcm_channel_descriptor * pcm_channel;
1645 1644
1646 int pcm_channel_id; /* Fron Rear, Center Lfe ... */ 1645 int pcm_channel_id; /* Fron Rear, Center Lfe ... */
1647} cs46xx_pcm_t; 1646};
1648 1647
1649typedef struct { 1648struct snd_cs46xx_region {
1650 char name[24]; 1649 char name[24];
1651 unsigned long base; 1650 unsigned long base;
1652 void __iomem *remap_addr; 1651 void __iomem *remap_addr;
1653 unsigned long size; 1652 unsigned long size;
1654 struct resource *resource; 1653 struct resource *resource;
1655} snd_cs46xx_region_t; 1654};
1656 1655
1657struct _snd_cs46xx { 1656struct snd_cs46xx {
1658 int irq; 1657 int irq;
1659 unsigned long ba0_addr; 1658 unsigned long ba0_addr;
1660 unsigned long ba1_addr; 1659 unsigned long ba1_addr;
1661 union { 1660 union {
1662 struct { 1661 struct {
1663 snd_cs46xx_region_t ba0; 1662 struct snd_cs46xx_region ba0;
1664 snd_cs46xx_region_t data0; 1663 struct snd_cs46xx_region data0;
1665 snd_cs46xx_region_t data1; 1664 struct snd_cs46xx_region data1;
1666 snd_cs46xx_region_t pmem; 1665 struct snd_cs46xx_region pmem;
1667 snd_cs46xx_region_t reg; 1666 struct snd_cs46xx_region reg;
1668 } name; 1667 } name;
1669 snd_cs46xx_region_t idx[5]; 1668 struct snd_cs46xx_region idx[5];
1670 } region; 1669 } region;
1671 1670
1672 unsigned int mode; 1671 unsigned int mode;
@@ -1676,34 +1675,34 @@ struct _snd_cs46xx {
1676 1675
1677 unsigned int ctl; 1676 unsigned int ctl;
1678 unsigned int shift; /* Shift count to trasform frames in bytes */ 1677 unsigned int shift; /* Shift count to trasform frames in bytes */
1679 snd_pcm_indirect_t pcm_rec; 1678 struct snd_pcm_indirect pcm_rec;
1680 snd_pcm_substream_t *substream; 1679 struct snd_pcm_substream *substream;
1681 } capt; 1680 } capt;
1682 1681
1683 1682
1684 int nr_ac97_codecs; 1683 int nr_ac97_codecs;
1685 ac97_bus_t *ac97_bus; 1684 struct snd_ac97_bus *ac97_bus;
1686 ac97_t *ac97[MAX_NR_AC97]; 1685 struct snd_ac97 *ac97[MAX_NR_AC97];
1687 1686
1688 struct pci_dev *pci; 1687 struct pci_dev *pci;
1689 snd_card_t *card; 1688 struct snd_card *card;
1690 snd_pcm_t *pcm; 1689 struct snd_pcm *pcm;
1691 1690
1692 snd_rawmidi_t *rmidi; 1691 struct snd_rawmidi *rmidi;
1693 snd_rawmidi_substream_t *midi_input; 1692 struct snd_rawmidi_substream *midi_input;
1694 snd_rawmidi_substream_t *midi_output; 1693 struct snd_rawmidi_substream *midi_output;
1695 1694
1696 spinlock_t reg_lock; 1695 spinlock_t reg_lock;
1697 unsigned int midcr; 1696 unsigned int midcr;
1698 unsigned int uartm; 1697 unsigned int uartm;
1699 1698
1700 int amplifier; 1699 int amplifier;
1701 void (*amplifier_ctrl)(cs46xx_t *, int); 1700 void (*amplifier_ctrl)(struct snd_cs46xx *, int);
1702 void (*active_ctrl)(cs46xx_t *, int); 1701 void (*active_ctrl)(struct snd_cs46xx *, int);
1703 void (*mixer_init)(cs46xx_t *); 1702 void (*mixer_init)(struct snd_cs46xx *);
1704 1703
1705 int acpi_port; 1704 int acpi_port;
1706 snd_kcontrol_t *eapd_switch; /* for amplifier hack */ 1705 struct snd_kcontrol *eapd_switch; /* for amplifier hack */
1707 int accept_valid; /* accept mmap valid (for OSS) */ 1706 int accept_valid; /* accept mmap valid (for OSS) */
1708 1707
1709 struct gameport *gameport; 1708 struct gameport *gameport;
@@ -1714,29 +1713,31 @@ struct _snd_cs46xx {
1714#ifdef CONFIG_SND_CS46XX_NEW_DSP 1713#ifdef CONFIG_SND_CS46XX_NEW_DSP
1715 struct semaphore spos_mutex; 1714 struct semaphore spos_mutex;
1716 1715
1717 dsp_spos_instance_t * dsp_spos_instance; 1716 struct dsp_spos_instance * dsp_spos_instance;
1718 1717
1719 snd_pcm_t *pcm_rear; 1718 struct snd_pcm *pcm_rear;
1720 snd_pcm_t *pcm_center_lfe; 1719 struct snd_pcm *pcm_center_lfe;
1721 snd_pcm_t *pcm_iec958; 1720 struct snd_pcm *pcm_iec958;
1722#else /* for compatibility */ 1721#else /* for compatibility */
1723 cs46xx_pcm_t *playback_pcm; 1722 struct snd_cs46xx_pcm *playback_pcm;
1724 unsigned int play_ctl; 1723 unsigned int play_ctl;
1725#endif 1724#endif
1726}; 1725};
1727 1726
1728int snd_cs46xx_create(snd_card_t *card, 1727int snd_cs46xx_create(struct snd_card *card,
1729 struct pci_dev *pci, 1728 struct pci_dev *pci,
1730 int external_amp, int thinkpad, 1729 int external_amp, int thinkpad,
1731 cs46xx_t **rcodec); 1730 struct snd_cs46xx **rcodec);
1732 1731int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state);
1733int snd_cs46xx_pcm(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1732int snd_cs46xx_resume(struct pci_dev *pci);
1734int snd_cs46xx_pcm_rear(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1733
1735int snd_cs46xx_pcm_iec958(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1734int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1736int snd_cs46xx_pcm_center_lfe(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1735int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1737int snd_cs46xx_mixer(cs46xx_t *chip, int spdif_device); 1736int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1738int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi); 1737int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1739int snd_cs46xx_start_dsp(cs46xx_t *chip); 1738int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device);
1740int snd_cs46xx_gameport(cs46xx_t *chip); 1739int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi);
1740int snd_cs46xx_start_dsp(struct snd_cs46xx *chip);
1741int snd_cs46xx_gameport(struct snd_cs46xx *chip);
1741 1742
1742#endif /* __SOUND_CS46XX_H */ 1743#endif /* __SOUND_CS46XX_H */
diff --git a/include/sound/cs46xx_dsp_scb_types.h b/include/sound/cs46xx_dsp_scb_types.h
index 3f990a3a6903..9cb6c7d09567 100644
--- a/include/sound/cs46xx_dsp_scb_types.h
+++ b/include/sound/cs46xx_dsp_scb_types.h
@@ -41,7 +41,7 @@
41 41
42/* This structs are used internally by the SP */ 42/* This structs are used internally by the SP */
43 43
44typedef struct _basic_dma_req_t { 44struct dsp_basic_dma_req {
45 /* DMA Requestor Word 0 (DCW) fields: 45 /* DMA Requestor Word 0 (DCW) fields:
46 46
47 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0] 47 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0]
@@ -53,9 +53,9 @@ typedef struct _basic_dma_req_t {
53 u32 dmw; /* DMA Mode Word */ 53 u32 dmw; /* DMA Mode Word */
54 u32 saw; /* Source Address Word */ 54 u32 saw; /* Source Address Word */
55 u32 daw; /* Destination Address Word */ 55 u32 daw; /* Destination Address Word */
56} basic_dma_req_t; 56};
57 57
58typedef struct _scatter_gather_ext_t { 58struct dsp_scatter_gather_ext {
59 u32 npaw; /* Next-Page Address Word */ 59 u32 npaw; /* Next-Page Address Word */
60 60
61 /* DMA Requestor Word 5 (NPCW) fields: 61 /* DMA Requestor Word 5 (NPCW) fields:
@@ -69,9 +69,9 @@ typedef struct _scatter_gather_ext_t {
69 u32 lbaw; /* Loop-Begin Address Word */ 69 u32 lbaw; /* Loop-Begin Address Word */
70 u32 nplbaw; /* Next-Page after Loop-Begin Address Word */ 70 u32 nplbaw; /* Next-Page after Loop-Begin Address Word */
71 u32 sgaw; /* Scatter/Gather Address Word */ 71 u32 sgaw; /* Scatter/Gather Address Word */
72} scatter_gather_ext_t; 72};
73 73
74typedef struct _volume_control_t { 74struct dsp_volume_control {
75 ___DSP_DUAL_16BIT_ALLOC( 75 ___DSP_DUAL_16BIT_ALLOC(
76 rightTarg, /* Target volume for left & right channels */ 76 rightTarg, /* Target volume for left & right channels */
77 leftTarg 77 leftTarg
@@ -80,10 +80,10 @@ typedef struct _volume_control_t {
80 rightVol, /* Current left & right channel volumes */ 80 rightVol, /* Current left & right channel volumes */
81 leftVol 81 leftVol
82 ) 82 )
83} volume_control_t; 83};
84 84
85/* Generic stream control block (SCB) structure definition */ 85/* Generic stream control block (SCB) structure definition */
86typedef struct _generic_scb_t { 86struct dsp_generic_scb {
87 /* For streaming I/O, the DSP should never alter any words in the DMA 87 /* For streaming I/O, the DSP should never alter any words in the DMA
88 requestor or the scatter/gather extension. Only ad hoc DMA request 88 requestor or the scatter/gather extension. Only ad hoc DMA request
89 streams are free to alter the requestor (currently only occur in the 89 streams are free to alter the requestor (currently only occur in the
@@ -99,13 +99,13 @@ typedef struct _generic_scb_t {
99 99
100 /* Initialized by the host, only modified by DMA 100 /* Initialized by the host, only modified by DMA
101 R/O for the DSP task */ 101 R/O for the DSP task */
102 basic_dma_req_t basic_req; /* Optional */ 102 struct dsp_basic_dma_req basic_req; /* Optional */
103 103
104 /* Scatter/gather DMA requestor extension (5 ints) 104 /* Scatter/gather DMA requestor extension (5 ints)
105 Initialized by the host, only modified by DMA 105 Initialized by the host, only modified by DMA
106 DSP task never needs to even read these. 106 DSP task never needs to even read these.
107 */ 107 */
108 scatter_gather_ext_t sg_ext; /* Optional */ 108 struct dsp_scatter_gather_ext sg_ext; /* Optional */
109 109
110 /* Sublist pointer & next stream control block (SCB) link. 110 /* Sublist pointer & next stream control block (SCB) link.
111 Initialized & modified by the host R/O for the DSP task 111 Initialized & modified by the host R/O for the DSP task
@@ -179,11 +179,11 @@ typedef struct _generic_scb_t {
179 179
180 These two 32-bit words are redefined for wavetable & 3-D voices. 180 These two 32-bit words are redefined for wavetable & 3-D voices.
181 */ 181 */
182 volume_control_t vol_ctrl_t; /* Optional */ 182 struct dsp_volume_control vol_ctrl_t; /* Optional */
183} generic_scb_t; 183};
184 184
185 185
186typedef struct _spos_control_block_t { 186struct dsp_spos_control_block {
187 /* WARNING: Certain items in this structure are modified by the host 187 /* WARNING: Certain items in this structure are modified by the host
188 Any dword that can be modified by the host, must not be 188 Any dword that can be modified by the host, must not be
189 modified by the SP as the host can only do atomic dword 189 modified by the SP as the host can only do atomic dword
@@ -273,10 +273,10 @@ typedef struct _spos_control_block_t {
273 u32 r32_save_for_spurious_int; 273 u32 r32_save_for_spurious_int;
274 u32 r32_save_for_trap; 274 u32 r32_save_for_trap;
275 u32 r32_save_for_HFG; 275 u32 r32_save_for_HFG;
276} spos_control_block_t; 276};
277 277
278/* SPB for MIX_TO_OSTREAM algorithm family */ 278/* SPB for MIX_TO_OSTREAM algorithm family */
279typedef struct _mix2_ostream_spb_t 279struct dsp_mix2_ostream_spb
280{ 280{
281 /* 16b.16b integer.frac approximation to the 281 /* 16b.16b integer.frac approximation to the
282 number of 3 sample triplets to output each 282 number of 3 sample triplets to output each
@@ -290,13 +290,13 @@ typedef struct _mix2_ostream_spb_t
290 output triplets since the start of group 290 output triplets since the start of group
291 */ 291 */
292 u32 accumOutTriplets; 292 u32 accumOutTriplets;
293} mix2_ostream_spb_t; 293};
294 294
295/* SCB for Timing master algorithm */ 295/* SCB for Timing master algorithm */
296typedef struct _timing_master_scb_t { 296struct dsp_timing_master_scb {
297 /* First 12 dwords from generic_scb_t */ 297 /* First 12 dwords from generic_scb_t */
298 basic_dma_req_t basic_req; /* Optional */ 298 struct dsp_basic_dma_req basic_req; /* Optional */
299 scatter_gather_ext_t sg_ext; /* Optional */ 299 struct dsp_scatter_gather_ext sg_ext; /* Optional */
300 ___DSP_DUAL_16BIT_ALLOC( 300 ___DSP_DUAL_16BIT_ALLOC(
301 next_scb, /* REQUIRED */ 301 next_scb, /* REQUIRED */
302 sub_list_ptr /* REQUIRED */ 302 sub_list_ptr /* REQUIRED */
@@ -358,13 +358,13 @@ typedef struct _timing_master_scb_t {
358 number of samples to output each frame. 358 number of samples to output each frame.
359 (approximation must be floor, to insure */ 359 (approximation must be floor, to insure */
360 u32 nsamp_per_frm_q15; 360 u32 nsamp_per_frm_q15;
361} timing_master_scb_t; 361};
362 362
363/* SCB for CODEC output algorithm */ 363/* SCB for CODEC output algorithm */
364typedef struct _codec_output_scb_t { 364struct dsp_codec_output_scb {
365 /* First 13 dwords from generic_scb_t */ 365 /* First 13 dwords from generic_scb_t */
366 basic_dma_req_t basic_req; /* Optional */ 366 struct dsp_basic_dma_req basic_req; /* Optional */
367 scatter_gather_ext_t sg_ext; /* Optional */ 367 struct dsp_scatter_gather_ext sg_ext; /* Optional */
368 ___DSP_DUAL_16BIT_ALLOC( 368 ___DSP_DUAL_16BIT_ALLOC(
369 next_scb, /* REQUIRED */ 369 next_scb, /* REQUIRED */
370 sub_list_ptr /* REQUIRED */ 370 sub_list_ptr /* REQUIRED */
@@ -422,13 +422,13 @@ typedef struct _codec_output_scb_t {
422 reserved, 422 reserved,
423 last_sub_ptr 423 last_sub_ptr
424 ) 424 )
425} codec_output_scb_t; 425};
426 426
427/* SCB for CODEC input algorithm */ 427/* SCB for CODEC input algorithm */
428typedef struct _codec_input_scb_t { 428struct dsp_codec_input_scb {
429 /* First 13 dwords from generic_scb_t */ 429 /* First 13 dwords from generic_scb_t */
430 basic_dma_req_t basic_req; /* Optional */ 430 struct dsp_basic_dma_req basic_req; /* Optional */
431 scatter_gather_ext_t sg_ext; /* Optional */ 431 struct dsp_scatter_gather_ext sg_ext; /* Optional */
432 ___DSP_DUAL_16BIT_ALLOC( 432 ___DSP_DUAL_16BIT_ALLOC(
433 next_scb, /* REQUIRED */ 433 next_scb, /* REQUIRED */
434 sub_list_ptr /* REQUIRED */ 434 sub_list_ptr /* REQUIRED */
@@ -479,13 +479,13 @@ typedef struct _codec_input_scb_t {
479 ) 479 )
480 480
481 u32 reserved2; 481 u32 reserved2;
482} codec_input_scb_t; 482};
483 483
484 484
485typedef struct _pcm_serial_input_scb_t { 485struct dsp_pcm_serial_input_scb {
486 /* First 13 dwords from generic_scb_t */ 486 /* First 13 dwords from generic_scb_t */
487 basic_dma_req_t basic_req; /* Optional */ 487 struct dsp_basic_dma_req basic_req; /* Optional */
488 scatter_gather_ext_t sg_ext; /* Optional */ 488 struct dsp_scatter_gather_ext sg_ext; /* Optional */
489 ___DSP_DUAL_16BIT_ALLOC( 489 ___DSP_DUAL_16BIT_ALLOC(
490 next_scb, /* REQUIRED */ 490 next_scb, /* REQUIRED */
491 sub_list_ptr /* REQUIRED */ 491 sub_list_ptr /* REQUIRED */
@@ -512,11 +512,11 @@ typedef struct _pcm_serial_input_scb_t {
512 ) 512 )
513 513
514 /* Initialized by the host (host updates target volumes) */ 514 /* Initialized by the host (host updates target volumes) */
515 volume_control_t psi_vol_ctrl; 515 struct dsp_volume_control psi_vol_ctrl;
516 516
517} pcm_serial_input_scb_t; 517};
518 518
519typedef struct _src_task_scb_t { 519struct dsp_src_task_scb {
520 ___DSP_DUAL_16BIT_ALLOC( 520 ___DSP_DUAL_16BIT_ALLOC(
521 frames_left_in_gof, 521 frames_left_in_gof,
522 gofs_left_in_sec 522 gofs_left_in_sec
@@ -571,10 +571,10 @@ typedef struct _src_task_scb_t {
571 571
572 u32 phiIncr6int_26frac; 572 u32 phiIncr6int_26frac;
573 573
574 volume_control_t src_vol_ctrl; 574 struct dsp_volume_control src_vol_ctrl;
575} src_task_scb_t; 575};
576 576
577typedef struct _decimate_by_pow2_scb_t { 577struct dsp_decimate_by_pow2_scb {
578 /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory 578 /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory
579 when compared to cascading decimators) 579 when compared to cascading decimators)
580 */ 580 */
@@ -648,10 +648,10 @@ typedef struct _decimate_by_pow2_scb_t {
648 648
649 u32 dec2_reserved4; 649 u32 dec2_reserved4;
650 650
651 volume_control_t dec2_vol_ctrl; /* Not used! */ 651 struct dsp_volume_control dec2_vol_ctrl; /* Not used! */
652} decimate_by_pow2_scb_t; 652};
653 653
654typedef struct _vari_decimate_scb_t { 654struct dsp_vari_decimate_scb {
655 ___DSP_DUAL_16BIT_ALLOC( 655 ___DSP_DUAL_16BIT_ALLOC(
656 vdec_frames_left_in_gof, 656 vdec_frames_left_in_gof,
657 vdec_gofs_left_in_sec 657 vdec_gofs_left_in_sec
@@ -711,15 +711,15 @@ typedef struct _vari_decimate_scb_t {
711 711
712 u32 vdec_phi_incr_6int_26frac; 712 u32 vdec_phi_incr_6int_26frac;
713 713
714 volume_control_t vdec_vol_ctrl; 714 struct dsp_volume_control vdec_vol_ctrl;
715} vari_decimate_scb_t; 715};
716 716
717 717
718/* SCB for MIX_TO_OSTREAM algorithm family */ 718/* SCB for MIX_TO_OSTREAM algorithm family */
719typedef struct _mix2_ostream_scb_t { 719struct dsp_mix2_ostream_scb {
720 /* First 13 dwords from generic_scb_t */ 720 /* First 13 dwords from generic_scb_t */
721 basic_dma_req_t basic_req; /* Optional */ 721 struct dsp_basic_dma_req basic_req; /* Optional */
722 scatter_gather_ext_t sg_ext; /* Optional */ 722 struct dsp_scatter_gather_ext sg_ext; /* Optional */
723 ___DSP_DUAL_16BIT_ALLOC( 723 ___DSP_DUAL_16BIT_ALLOC(
724 next_scb, /* REQUIRED */ 724 next_scb, /* REQUIRED */
725 sub_list_ptr /* REQUIRED */ 725 sub_list_ptr /* REQUIRED */
@@ -758,14 +758,14 @@ typedef struct _mix2_ostream_scb_t {
758 const_FFFF, 758 const_FFFF,
759 const_zero 759 const_zero
760 ) 760 )
761} mix2_ostream_scb_t; 761};
762 762
763 763
764/* SCB for S16_MIX algorithm */ 764/* SCB for S16_MIX algorithm */
765typedef struct _mix_only_scb_t { 765struct dsp_mix_only_scb {
766 /* First 13 dwords from generic_scb_t */ 766 /* First 13 dwords from generic_scb_t */
767 basic_dma_req_t basic_req; /* Optional */ 767 struct dsp_basic_dma_req basic_req; /* Optional */
768 scatter_gather_ext_t sg_ext; /* Optional */ 768 struct dsp_scatter_gather_ext sg_ext; /* Optional */
769 ___DSP_DUAL_16BIT_ALLOC( 769 ___DSP_DUAL_16BIT_ALLOC(
770 next_scb, /* REQUIRED */ 770 next_scb, /* REQUIRED */
771 sub_list_ptr /* REQUIRED */ 771 sub_list_ptr /* REQUIRED */
@@ -780,11 +780,11 @@ typedef struct _mix_only_scb_t {
780 u32 strm_buf_ptr; /* REQUIRED */ 780 u32 strm_buf_ptr; /* REQUIRED */
781 781
782 u32 reserved; 782 u32 reserved;
783 volume_control_t vol_ctrl; 783 struct dsp_volume_control vol_ctrl;
784} mix_only_scb_t; 784};
785 785
786/* SCB for the async. CODEC input algorithm */ 786/* SCB for the async. CODEC input algorithm */
787typedef struct _async_codec_input_scb_t { 787struct dsp_async_codec_input_scb {
788 u32 io_free2; 788 u32 io_free2;
789 789
790 u32 io_current_total; 790 u32 io_current_total;
@@ -837,11 +837,11 @@ typedef struct _async_codec_input_scb_t {
837 ) 837 )
838 838
839 u32 i_free; 839 u32 i_free;
840} async_codec_input_scb_t; 840};
841 841
842 842
843/* SCB for the SP/DIF CODEC input and output */ 843/* SCB for the SP/DIF CODEC input and output */
844typedef struct _spdifiscb_t { 844struct dsp_spdifiscb {
845 ___DSP_DUAL_16BIT_ALLOC( 845 ___DSP_DUAL_16BIT_ALLOC(
846 status_ptr, 846 status_ptr,
847 status_start_ptr 847 status_start_ptr
@@ -895,12 +895,11 @@ typedef struct _spdifiscb_t {
895 ) 895 )
896 896
897 u32 free1; 897 u32 free1;
898} spdifiscb_t; 898};
899 899
900 900
901/* SCB for the SP/DIF CODEC input and output */ 901/* SCB for the SP/DIF CODEC input and output */
902typedef struct _spdifoscb_t { 902struct dsp_spdifoscb {
903
904 903
905 u32 free2; 904 u32 free2;
906 905
@@ -941,11 +940,10 @@ typedef struct _spdifoscb_t {
941 ) 940 )
942 941
943 u32 free1; 942 u32 free1;
944} spdifoscb_t; 943};
945
946 944
947 945
948typedef struct _asynch_fg_rx_scb_t { 946struct dsp_asynch_fg_rx_scb {
949 ___DSP_DUAL_16BIT_ALLOC( 947 ___DSP_DUAL_16BIT_ALLOC(
950 bot_buf_mask, 948 bot_buf_mask,
951 buf_Mask 949 buf_Mask
@@ -993,11 +991,10 @@ typedef struct _asynch_fg_rx_scb_t {
993 right_vol, 991 right_vol,
994 left_vol 992 left_vol
995 ) 993 )
996} asynch_fg_rx_scb_t; 994};
997
998 995
999 996
1000typedef struct _asynch_fg_tx_scb_t { 997struct dsp_asynch_fg_tx_scb {
1001 ___DSP_DUAL_16BIT_ALLOC( 998 ___DSP_DUAL_16BIT_ALLOC(
1002 not_buf_mask, 999 not_buf_mask,
1003 buf_mask 1000 buf_mask
@@ -1052,13 +1049,13 @@ typedef struct _asynch_fg_tx_scb_t {
1052 unused_right_vol, 1049 unused_right_vol,
1053 unused_left_vol 1050 unused_left_vol
1054 ) 1051 )
1055} asynch_fg_tx_scb_t; 1052};
1056 1053
1057 1054
1058typedef struct _output_snoop_scb_t { 1055struct dsp_output_snoop_scb {
1059 /* First 13 dwords from generic_scb_t */ 1056 /* First 13 dwords from generic_scb_t */
1060 basic_dma_req_t basic_req; /* Optional */ 1057 struct dsp_basic_dma_req basic_req; /* Optional */
1061 scatter_gather_ext_t sg_ext; /* Optional */ 1058 struct dsp_scatter_gather_ext sg_ext; /* Optional */
1062 ___DSP_DUAL_16BIT_ALLOC( 1059 ___DSP_DUAL_16BIT_ALLOC(
1063 next_scb, /* REQUIRED */ 1060 next_scb, /* REQUIRED */
1064 sub_list_ptr /* REQUIRED */ 1061 sub_list_ptr /* REQUIRED */
@@ -1083,9 +1080,9 @@ typedef struct _output_snoop_scb_t {
1083 reserved, 1080 reserved,
1084 input_scb 1081 input_scb
1085 ) 1082 )
1086} output_snoop_scb_t; 1083};
1087 1084
1088typedef struct _spio_write_scb_t { 1085struct dsp_spio_write_scb {
1089 ___DSP_DUAL_16BIT_ALLOC( 1086 ___DSP_DUAL_16BIT_ALLOC(
1090 address1, 1087 address1,
1091 address2 1088 address2
@@ -1122,9 +1119,9 @@ typedef struct _spio_write_scb_t {
1122 ) 1119 )
1123 1120
1124 u32 unused3[5]; 1121 u32 unused3[5];
1125} spio_write_scb_t; 1122};
1126 1123
1127typedef struct _magic_snoop_task_t { 1124struct dsp_magic_snoop_task {
1128 u32 i0; 1125 u32 i0;
1129 u32 i1; 1126 u32 i1;
1130 1127
@@ -1155,11 +1152,11 @@ typedef struct _magic_snoop_task_t {
1155 1152
1156 u32 i8; 1153 u32 i8;
1157 1154
1158 volume_control_t vdec_vol_ctrl; 1155 struct dsp_volume_control vdec_vol_ctrl;
1159} magic_snoop_task_t; 1156};
1160 1157
1161 1158
1162typedef struct _filter_scb_t { 1159struct dsp_filter_scb {
1163 ___DSP_DUAL_16BIT_ALLOC( 1160 ___DSP_DUAL_16BIT_ALLOC(
1164 a0_right, /* 0x00 */ 1161 a0_right, /* 0x00 */
1165 a0_left 1162 a0_left
@@ -1212,5 +1209,5 @@ typedef struct _filter_scb_t {
1212 b2_right, /* 0x0F */ 1209 b2_right, /* 0x0F */
1213 b2_left 1210 b2_left
1214 ) 1211 )
1215} filter_scb_t; 1212};
1216#endif /* __DSP_SCB_TYPES_H__ */ 1213#endif /* __DSP_SCB_TYPES_H__ */
diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h
index 10014cb62423..da934def31e9 100644
--- a/include/sound/cs46xx_dsp_spos.h
+++ b/include/sound/cs46xx_dsp_spos.h
@@ -65,133 +65,130 @@
65#define DSP_SPDIF_STATUS_HW_ENABLED 4 65#define DSP_SPDIF_STATUS_HW_ENABLED 4
66#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8 66#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8
67 67
68struct _dsp_module_desc_t; 68struct dsp_symbol_entry {
69
70typedef struct _symbol_entry_t {
71 u32 address; 69 u32 address;
72 char symbol_name[DSP_MAX_SYMBOL_NAME]; 70 char symbol_name[DSP_MAX_SYMBOL_NAME];
73 int symbol_type; 71 int symbol_type;
74 72
75 /* initialized by driver */ 73 /* initialized by driver */
76 struct _dsp_module_desc_t * module; 74 struct dsp_module_desc * module;
77 int deleted; 75 int deleted;
78} symbol_entry_t; 76};
79 77
80typedef struct _symbol_desc_t { 78struct dsp_symbol_desc {
81 int nsymbols; 79 int nsymbols;
82 80
83 symbol_entry_t * symbols; 81 struct dsp_symbol_entry *symbols;
84 82
85 /* initialized by driver */ 83 /* initialized by driver */
86 int highest_frag_index; 84 int highest_frag_index;
87} symbol_desc_t; 85};
88
89 86
90typedef struct _segment_desc_t { 87struct dsp_segment_desc {
91 int segment_type; 88 int segment_type;
92 u32 offset; 89 u32 offset;
93 u32 size; 90 u32 size;
94 u32 * data; 91 u32 * data;
95} segment_desc_t; 92};
96 93
97typedef struct _dsp_module_desc_t { 94struct dsp_module_desc {
98 char * module_name; 95 char * module_name;
99 symbol_desc_t symbol_table; 96 struct dsp_symbol_desc symbol_table;
100 int nsegments; 97 int nsegments;
101 segment_desc_t * segments; 98 struct dsp_segment_desc * segments;
102 99
103 /* initialized by driver */ 100 /* initialized by driver */
104 u32 overlay_begin_address; 101 u32 overlay_begin_address;
105 u32 load_address; 102 u32 load_address;
106 int nfixups; 103 int nfixups;
107} dsp_module_desc_t; 104};
108 105
109typedef struct _dsp_scb_descriptor_t { 106struct dsp_scb_descriptor {
110 char scb_name[DSP_MAX_SCB_NAME]; 107 char scb_name[DSP_MAX_SCB_NAME];
111 u32 address; 108 u32 address;
112 int index; 109 int index;
113 110
114 struct _dsp_scb_descriptor_t * sub_list_ptr; 111 struct dsp_scb_descriptor * sub_list_ptr;
115 struct _dsp_scb_descriptor_t * next_scb_ptr; 112 struct dsp_scb_descriptor * next_scb_ptr;
116 struct _dsp_scb_descriptor_t * parent_scb_ptr; 113 struct dsp_scb_descriptor * parent_scb_ptr;
117 114
118 symbol_entry_t * task_entry; 115 struct dsp_symbol_entry * task_entry;
119 symbol_entry_t * scb_symbol; 116 struct dsp_symbol_entry * scb_symbol;
120 117
121 snd_info_entry_t *proc_info; 118 struct snd_info_entry *proc_info;
122 int ref_count; 119 int ref_count;
123 spinlock_t lock; 120 spinlock_t lock;
124 121
125 int deleted; 122 int deleted;
126} dsp_scb_descriptor_t; 123};
127 124
128typedef struct _dsp_task_descriptor_t { 125struct dsp_task_descriptor {
129 char task_name[DSP_MAX_TASK_NAME]; 126 char task_name[DSP_MAX_TASK_NAME];
130 int size; 127 int size;
131 u32 address; 128 u32 address;
132 int index; 129 int index;
133} dsp_task_descriptor_t; 130};
134 131
135typedef struct _pcm_channel_descriptor_t { 132struct dsp_pcm_channel_descriptor {
136 int active; 133 int active;
137 int src_slot; 134 int src_slot;
138 int pcm_slot; 135 int pcm_slot;
139 u32 sample_rate; 136 u32 sample_rate;
140 u32 unlinked; 137 u32 unlinked;
141 dsp_scb_descriptor_t * pcm_reader_scb; 138 struct dsp_scb_descriptor * pcm_reader_scb;
142 dsp_scb_descriptor_t * src_scb; 139 struct dsp_scb_descriptor * src_scb;
143 dsp_scb_descriptor_t * mixer_scb; 140 struct dsp_scb_descriptor * mixer_scb;
144 141
145 void * private_data; 142 void * private_data;
146} pcm_channel_descriptor_t; 143};
147 144
148typedef struct _dsp_spos_instance_t { 145struct dsp_spos_instance {
149 symbol_desc_t symbol_table; /* currently availble loaded symbols in SP */ 146 struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */
150 147
151 int nmodules; 148 int nmodules;
152 dsp_module_desc_t * modules; /* modules loaded into SP */ 149 struct dsp_module_desc * modules; /* modules loaded into SP */
153 150
154 segment_desc_t code; 151 struct dsp_segment_desc code;
155 152
156 /* Main PCM playback mixer */ 153 /* Main PCM playback mixer */
157 dsp_scb_descriptor_t * master_mix_scb; 154 struct dsp_scb_descriptor * master_mix_scb;
158 u16 dac_volume_right; 155 u16 dac_volume_right;
159 u16 dac_volume_left; 156 u16 dac_volume_left;
160 157
161 /* Rear/surround PCM playback mixer */ 158 /* Rear/surround PCM playback mixer */
162 dsp_scb_descriptor_t * rear_mix_scb; 159 struct dsp_scb_descriptor * rear_mix_scb;
163 160
164 /* Center/LFE mixer */ 161 /* Center/LFE mixer */
165 dsp_scb_descriptor_t * center_lfe_mix_scb; 162 struct dsp_scb_descriptor * center_lfe_mix_scb;
166 163
167 int npcm_channels; 164 int npcm_channels;
168 int nsrc_scb; 165 int nsrc_scb;
169 pcm_channel_descriptor_t pcm_channels[DSP_MAX_PCM_CHANNELS]; 166 struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
170 int src_scb_slots[DSP_MAX_SRC_NR]; 167 int src_scb_slots[DSP_MAX_SRC_NR];
171 168
172 /* cache this symbols */ 169 /* cache this symbols */
173 symbol_entry_t * null_algorithm; /* used by PCMreaderSCB's */ 170 struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
174 symbol_entry_t * s16_up; /* used by SRCtaskSCB's */ 171 struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */
175 172
176 /* proc fs */ 173 /* proc fs */
177 snd_card_t * snd_card; 174 struct snd_card *snd_card;
178 snd_info_entry_t * proc_dsp_dir; 175 struct snd_info_entry * proc_dsp_dir;
179 snd_info_entry_t * proc_sym_info_entry; 176 struct snd_info_entry * proc_sym_info_entry;
180 snd_info_entry_t * proc_modules_info_entry; 177 struct snd_info_entry * proc_modules_info_entry;
181 snd_info_entry_t * proc_parameter_dump_info_entry; 178 struct snd_info_entry * proc_parameter_dump_info_entry;
182 snd_info_entry_t * proc_sample_dump_info_entry; 179 struct snd_info_entry * proc_sample_dump_info_entry;
183 180
184 /* SCB's descriptors */ 181 /* SCB's descriptors */
185 int nscb; 182 int nscb;
186 int scb_highest_frag_index; 183 int scb_highest_frag_index;
187 dsp_scb_descriptor_t scbs[DSP_MAX_SCB_DESC]; 184 struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
188 snd_info_entry_t * proc_scb_info_entry; 185 struct snd_info_entry * proc_scb_info_entry;
189 dsp_scb_descriptor_t * the_null_scb; 186 struct dsp_scb_descriptor * the_null_scb;
190 187
191 /* Task's descriptors */ 188 /* Task's descriptors */
192 int ntask; 189 int ntask;
193 dsp_task_descriptor_t tasks[DSP_MAX_TASK_DESC]; 190 struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
194 snd_info_entry_t * proc_task_info_entry; 191 struct snd_info_entry * proc_task_info_entry;
195 192
196 /* SPDIF status */ 193 /* SPDIF status */
197 int spdif_status_out; 194 int spdif_status_out;
@@ -204,30 +201,30 @@ typedef struct _dsp_spos_instance_t {
204 unsigned int spdif_csuv_stream; 201 unsigned int spdif_csuv_stream;
205 202
206 /* SPDIF input sample rate converter */ 203 /* SPDIF input sample rate converter */
207 dsp_scb_descriptor_t * spdif_in_src; 204 struct dsp_scb_descriptor * spdif_in_src;
208 /* SPDIF input asynch. receiver */ 205 /* SPDIF input asynch. receiver */
209 dsp_scb_descriptor_t * asynch_rx_scb; 206 struct dsp_scb_descriptor * asynch_rx_scb;
210 207
211 /* Capture record mixer SCB */ 208 /* Capture record mixer SCB */
212 dsp_scb_descriptor_t * record_mixer_scb; 209 struct dsp_scb_descriptor * record_mixer_scb;
213 210
214 /* CODEC input SCB */ 211 /* CODEC input SCB */
215 dsp_scb_descriptor_t * codec_in_scb; 212 struct dsp_scb_descriptor * codec_in_scb;
216 213
217 /* reference snooper */ 214 /* reference snooper */
218 dsp_scb_descriptor_t * ref_snoop_scb; 215 struct dsp_scb_descriptor * ref_snoop_scb;
219 216
220 /* SPDIF output PCM reference */ 217 /* SPDIF output PCM reference */
221 dsp_scb_descriptor_t * spdif_pcm_input_scb; 218 struct dsp_scb_descriptor * spdif_pcm_input_scb;
222 219
223 /* asynch TX task */ 220 /* asynch TX task */
224 dsp_scb_descriptor_t * asynch_tx_scb; 221 struct dsp_scb_descriptor * asynch_tx_scb;
225 222
226 /* record sources */ 223 /* record sources */
227 dsp_scb_descriptor_t * pcm_input; 224 struct dsp_scb_descriptor * pcm_input;
228 dsp_scb_descriptor_t * adc_input; 225 struct dsp_scb_descriptor * adc_input;
229 226
230 int spdif_in_sample_rate; 227 int spdif_in_sample_rate;
231} dsp_spos_instance_t; 228};
232 229
233#endif /* __DSP_SPOS_H__ */ 230#endif /* __DSP_SPOS_H__ */
diff --git a/include/sound/cs46xx_dsp_task_types.h b/include/sound/cs46xx_dsp_task_types.h
index 5dd3bf69cb03..b3076c487de6 100644
--- a/include/sound/cs46xx_dsp_task_types.h
+++ b/include/sound/cs46xx_dsp_task_types.h
@@ -71,7 +71,7 @@ Ptr____Call (c)
71 at the end of BG */ 71 at the end of BG */
72 72
73/* Minimal context save area for Hyper Forground */ 73/* Minimal context save area for Hyper Forground */
74typedef struct _hf_save_area_t { 74struct dsp_hf_save_area {
75 u32 r10_save; 75 u32 r10_save;
76 u32 r54_save; 76 u32 r54_save;
77 u32 r98_save; 77 u32 r98_save;
@@ -96,11 +96,11 @@ typedef struct _hf_save_area_t {
96 rsa2Save 96 rsa2Save
97 ) 97 )
98 /* saved as part of HFG context */ 98 /* saved as part of HFG context */
99} hf_save_area_t; 99};
100 100
101 101
102/* Task link data structure */ 102/* Task link data structure */
103typedef struct _tree_link_t { 103struct dsp_tree_link {
104 ___DSP_DUAL_16BIT_ALLOC( 104 ___DSP_DUAL_16BIT_ALLOC(
105 /* Pointer to sibling task control block */ 105 /* Pointer to sibling task control block */
106 next_scb, 106 next_scb,
@@ -114,10 +114,10 @@ typedef struct _tree_link_t {
114 /* Pointer to local data */ 114 /* Pointer to local data */
115 this_spb 115 this_spb
116 ) 116 )
117} tree_link_t; 117};
118 118
119 119
120typedef struct _task_tree_data_t { 120struct dsp_task_tree_data {
121 ___DSP_DUAL_16BIT_ALLOC( 121 ___DSP_DUAL_16BIT_ALLOC(
122 /* Initial tock count; controls task tree execution rate */ 122 /* Initial tock count; controls task tree execution rate */
123 tock_count_limit, 123 tock_count_limit,
@@ -155,11 +155,10 @@ typedef struct _task_tree_data_t {
155 data_stack_base_ptr 155 data_stack_base_ptr
156 ) 156 )
157 157
158} task_tree_data_t; 158};
159 159
160 160
161 161struct dsp_interval_timer_data
162typedef struct _interval_timer_data_t
163{ 162{
164 /* These data items have the same relative locations to those */ 163 /* These data items have the same relative locations to those */
165 ___DSP_DUAL_16BIT_ALLOC( 164 ___DSP_DUAL_16BIT_ALLOC(
@@ -172,12 +171,12 @@ typedef struct _interval_timer_data_t
172 num_FG_ticks_this_interval, 171 num_FG_ticks_this_interval,
173 num_intervals 172 num_intervals
174 ) 173 )
175} interval_timer_data_t; 174};
176 175
177 176
178/* This structure contains extra storage for the task tree 177/* This structure contains extra storage for the task tree
179 Currently, this additional data is related only to a full context save */ 178 Currently, this additional data is related only to a full context save */
180typedef struct _task_tree_context_block_t { 179struct dsp_task_tree_context_block {
181 /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for 180 /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for
182 The access to the context switch (call or interrupt), and 1 spare that 181 The access to the context switch (call or interrupt), and 1 spare that
183 users should never use. This last may be required by the system */ 182 users should never use. This last may be required by the system */
@@ -238,16 +237,16 @@ typedef struct _task_tree_context_block_t {
238 u32 saveaux2xaux3x; 237 u32 saveaux2xaux3x;
239 u32 savershouthl; 238 u32 savershouthl;
240 u32 savershoutxmacmode; 239 u32 savershoutxmacmode;
241} task_tree_context_block_t; 240};
242 241
243 242
244typedef struct _task_tree_control_block_t { 243struct dsp_task_tree_control_block {
245 hf_save_area_t context; 244 struct dsp_hf_save_area context;
246 tree_link_t links; 245 struct dsp_tree_link links;
247 task_tree_data_t data; 246 struct dsp_task_tree_data data;
248 task_tree_context_block_t context_blk; 247 struct dsp_task_tree_context_block context_blk;
249 interval_timer_data_t int_timer; 248 struct dsp_interval_timer_data int_timer;
250} task_tree_control_block_t; 249};
251 250
252 251
253#endif /* __DSP_TASK_TYPES_H__ */ 252#endif /* __DSP_TASK_TYPES_H__ */
diff --git a/include/sound/cs8403.h b/include/sound/cs8403.h
index 0b7d216e24f1..c6c3f9f0da78 100644
--- a/include/sound/cs8403.h
+++ b/include/sound/cs8403.h
@@ -36,7 +36,7 @@
36#endif 36#endif
37 37
38 38
39SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bits) 39SND_CS8403_DECL void SND_CS8403_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
40{ 40{
41 if (bits & 0x01) { /* consumer */ 41 if (bits & 0x01) { /* consumer */
42 if (!(bits & 0x02)) 42 if (!(bits & 0x02))
@@ -79,7 +79,7 @@ SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bit
79 } 79 }
80} 80}
81 81
82SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) 82SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(struct snd_aes_iec958 *diga)
83{ 83{
84 unsigned char bits; 84 unsigned char bits;
85 85
@@ -166,7 +166,7 @@ SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga)
166#endif 166#endif
167 167
168 168
169SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bits) 169SND_CS8404_DECL void SND_CS8404_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
170{ 170{
171 if (bits & 0x10) { /* consumer */ 171 if (bits & 0x10) { /* consumer */
172 if (!(bits & 0x20)) 172 if (!(bits & 0x20))
@@ -205,7 +205,7 @@ SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bit
205 } 205 }
206} 206}
207 207
208SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(snd_aes_iec958_t *diga) 208SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(struct snd_aes_iec958 *diga)
209{ 209{
210 unsigned char bits; 210 unsigned char bits;
211 211
diff --git a/include/sound/cs8427.h b/include/sound/cs8427.h
index e725b7049a53..97fd9acf8028 100644
--- a/include/sound/cs8427.h
+++ b/include/sound/cs8427.h
@@ -186,11 +186,16 @@
186#define CS8427_VERSHIFT 0 186#define CS8427_VERSHIFT 0
187#define CS8427_VER8427A 0x71 187#define CS8427_VER8427A 0x71
188 188
189int snd_cs8427_create(snd_i2c_bus_t *bus, unsigned char addr, 189struct snd_pcm_substream;
190 unsigned int reset_timeout, snd_i2c_device_t **r_cs8427); 190
191int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val); 191int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr,
192int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, snd_pcm_substream_t *playback_substream, snd_pcm_substream_t *capture_substream); 192 unsigned int reset_timeout, struct snd_i2c_device **r_cs8427);
193int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active); 193int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
194int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate); 194 unsigned char val);
195int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
196 struct snd_pcm_substream *playback_substream,
197 struct snd_pcm_substream *capture_substream);
198int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active);
199int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate);
195 200
196#endif /* __SOUND_CS8427_H */ 201#endif /* __SOUND_CS8427_H */
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 3f0416ac24d9..89c6a73f3920 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -28,7 +28,12 @@
28 28
29#include <linux/config.h> 29#include <linux/config.h>
30 30
31#define SNDRV_CARDS 8 /* number of supported soundcards - don't change - minor numbers */ 31/* number of supported soundcards */
32#ifdef CONFIG_SND_DYNAMIC_MINORS
33#define SNDRV_CARDS 32
34#else
35#define SNDRV_CARDS 8 /* don't change - minor numbers */
36#endif
32 37
33#ifndef CONFIG_SND_MAJOR /* standard configuration */ 38#ifndef CONFIG_SND_MAJOR /* standard configuration */
34#define CONFIG_SND_MAJOR 116 39#define CONFIG_SND_MAJOR 116
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 8411c7ef6f11..951e40d720d9 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -887,47 +887,45 @@
887 887
888/* ------------------- STRUCTURES -------------------- */ 888/* ------------------- STRUCTURES -------------------- */
889 889
890typedef struct _snd_emu10k1 emu10k1_t; 890enum {
891typedef struct _snd_emu10k1_voice emu10k1_voice_t;
892typedef struct _snd_emu10k1_pcm emu10k1_pcm_t;
893
894typedef enum {
895 EMU10K1_EFX, 891 EMU10K1_EFX,
896 EMU10K1_PCM, 892 EMU10K1_PCM,
897 EMU10K1_SYNTH, 893 EMU10K1_SYNTH,
898 EMU10K1_MIDI 894 EMU10K1_MIDI
899} emu10k1_voice_type_t; 895};
896
897struct snd_emu10k1;
900 898
901struct _snd_emu10k1_voice { 899struct snd_emu10k1_voice {
902 emu10k1_t *emu; 900 struct snd_emu10k1 *emu;
903 int number; 901 int number;
904 unsigned int use: 1, 902 unsigned int use: 1,
905 pcm: 1, 903 pcm: 1,
906 efx: 1, 904 efx: 1,
907 synth: 1, 905 synth: 1,
908 midi: 1; 906 midi: 1;
909 void (*interrupt)(emu10k1_t *emu, emu10k1_voice_t *pvoice); 907 void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
910 908
911 emu10k1_pcm_t *epcm; 909 struct snd_emu10k1_pcm *epcm;
912}; 910};
913 911
914typedef enum { 912enum {
915 PLAYBACK_EMUVOICE, 913 PLAYBACK_EMUVOICE,
916 PLAYBACK_EFX, 914 PLAYBACK_EFX,
917 CAPTURE_AC97ADC, 915 CAPTURE_AC97ADC,
918 CAPTURE_AC97MIC, 916 CAPTURE_AC97MIC,
919 CAPTURE_EFX 917 CAPTURE_EFX
920} snd_emu10k1_pcm_type_t; 918};
921 919
922struct _snd_emu10k1_pcm { 920struct snd_emu10k1_pcm {
923 emu10k1_t *emu; 921 struct snd_emu10k1 *emu;
924 snd_emu10k1_pcm_type_t type; 922 int type;
925 snd_pcm_substream_t *substream; 923 struct snd_pcm_substream *substream;
926 emu10k1_voice_t *voices[NUM_EFX_PLAYBACK]; 924 struct snd_emu10k1_voice *voices[NUM_EFX_PLAYBACK];
927 emu10k1_voice_t *extra; 925 struct snd_emu10k1_voice *extra;
928 unsigned short running; 926 unsigned short running;
929 unsigned short first_ptr; 927 unsigned short first_ptr;
930 snd_util_memblk_t *memblk; 928 struct snd_util_memblk *memblk;
931 unsigned int start_addr; 929 unsigned int start_addr;
932 unsigned int ccca_start_addr; 930 unsigned int ccca_start_addr;
933 unsigned int capture_ipr; /* interrupt acknowledge mask */ 931 unsigned int capture_ipr; /* interrupt acknowledge mask */
@@ -941,13 +939,13 @@ struct _snd_emu10k1_pcm {
941 unsigned int capture_bufsize; /* buffer size in bytes */ 939 unsigned int capture_bufsize; /* buffer size in bytes */
942}; 940};
943 941
944typedef struct { 942struct snd_emu10k1_pcm_mixer {
945 /* mono, left, right x 8 sends (4 on emu10k1) */ 943 /* mono, left, right x 8 sends (4 on emu10k1) */
946 unsigned char send_routing[3][8]; 944 unsigned char send_routing[3][8];
947 unsigned char send_volume[3][8]; 945 unsigned char send_volume[3][8];
948 unsigned short attn[3]; 946 unsigned short attn[3];
949 emu10k1_pcm_t *epcm; 947 struct snd_emu10k1_pcm *epcm;
950} emu10k1_pcm_mixer_t; 948};
951 949
952#define snd_emu10k1_compose_send_routing(route) \ 950#define snd_emu10k1_compose_send_routing(route) \
953((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16) 951((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16)
@@ -958,20 +956,20 @@ typedef struct {
958#define snd_emu10k1_compose_audigy_fxrt2(route) \ 956#define snd_emu10k1_compose_audigy_fxrt2(route) \
959((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24)) 957((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24))
960 958
961typedef struct snd_emu10k1_memblk { 959struct snd_emu10k1_memblk {
962 snd_util_memblk_t mem; 960 struct snd_util_memblk mem;
963 /* private part */ 961 /* private part */
964 int first_page, last_page, pages, mapped_page; 962 int first_page, last_page, pages, mapped_page;
965 unsigned int map_locked; 963 unsigned int map_locked;
966 struct list_head mapped_link; 964 struct list_head mapped_link;
967 struct list_head mapped_order_link; 965 struct list_head mapped_order_link;
968} emu10k1_memblk_t; 966};
969 967
970#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1))) 968#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1)))
971 969
972#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16 970#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16
973 971
974typedef struct { 972struct snd_emu10k1_fx8010_ctl {
975 struct list_head list; /* list link container */ 973 struct list_head list; /* list link container */
976 unsigned int vcount; 974 unsigned int vcount;
977 unsigned int count; /* count of GPR (1..16) */ 975 unsigned int count; /* count of GPR (1..16) */
@@ -980,19 +978,19 @@ typedef struct {
980 unsigned int min; /* minimum range */ 978 unsigned int min; /* minimum range */
981 unsigned int max; /* maximum range */ 979 unsigned int max; /* maximum range */
982 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 980 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
983 snd_kcontrol_t *kcontrol; 981 struct snd_kcontrol *kcontrol;
984} snd_emu10k1_fx8010_ctl_t; 982};
985 983
986typedef void (snd_fx8010_irq_handler_t)(emu10k1_t *emu, void *private_data); 984typedef void (snd_fx8010_irq_handler_t)(struct snd_emu10k1 *emu, void *private_data);
987 985
988typedef struct _snd_emu10k1_fx8010_irq { 986struct snd_emu10k1_fx8010_irq {
989 struct _snd_emu10k1_fx8010_irq *next; 987 struct snd_emu10k1_fx8010_irq *next;
990 snd_fx8010_irq_handler_t *handler; 988 snd_fx8010_irq_handler_t *handler;
991 unsigned short gpr_running; 989 unsigned short gpr_running;
992 void *private_data; 990 void *private_data;
993} snd_emu10k1_fx8010_irq_t; 991};
994 992
995typedef struct { 993struct snd_emu10k1_fx8010_pcm {
996 unsigned int valid: 1, 994 unsigned int valid: 1,
997 opened: 1, 995 opened: 1,
998 active: 1; 996 active: 1;
@@ -1006,13 +1004,13 @@ typedef struct {
1006 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ 1004 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
1007 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ 1005 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
1008 unsigned char etram[32]; /* external TRAM address & data */ 1006 unsigned char etram[32]; /* external TRAM address & data */
1009 snd_pcm_indirect_t pcm_rec; 1007 struct snd_pcm_indirect pcm_rec;
1010 unsigned int tram_pos; 1008 unsigned int tram_pos;
1011 unsigned int tram_shift; 1009 unsigned int tram_shift;
1012 snd_emu10k1_fx8010_irq_t *irq; 1010 struct snd_emu10k1_fx8010_irq *irq;
1013} snd_emu10k1_fx8010_pcm_t; 1011};
1014 1012
1015typedef struct { 1013struct snd_emu10k1_fx8010 {
1016 unsigned short fxbus_mask; /* used FX buses (bitmask) */ 1014 unsigned short fxbus_mask; /* used FX buses (bitmask) */
1017 unsigned short extin_mask; /* used external inputs (bitmask) */ 1015 unsigned short extin_mask; /* used external inputs (bitmask) */
1018 unsigned short extout_mask; /* used external outputs (bitmask) */ 1016 unsigned short extout_mask; /* used external outputs (bitmask) */
@@ -1025,18 +1023,18 @@ typedef struct {
1025 int gpr_count; /* count of used kcontrols */ 1023 int gpr_count; /* count of used kcontrols */
1026 struct list_head gpr_ctl; /* GPR controls */ 1024 struct list_head gpr_ctl; /* GPR controls */
1027 struct semaphore lock; 1025 struct semaphore lock;
1028 snd_emu10k1_fx8010_pcm_t pcm[8]; 1026 struct snd_emu10k1_fx8010_pcm pcm[8];
1029 spinlock_t irq_lock; 1027 spinlock_t irq_lock;
1030 snd_emu10k1_fx8010_irq_t *irq_handlers; 1028 struct snd_emu10k1_fx8010_irq *irq_handlers;
1031} snd_emu10k1_fx8010_t; 1029};
1032 1030
1033#define emu10k1_gpr_ctl(n) list_entry(n, snd_emu10k1_fx8010_ctl_t, list) 1031#define emu10k1_gpr_ctl(n) list_entry(n, struct snd_emu10k1_fx8010_ctl, list)
1034 1032
1035typedef struct { 1033struct snd_emu10k1_midi {
1036 struct _snd_emu10k1 *emu; 1034 struct snd_emu10k1 *emu;
1037 snd_rawmidi_t *rmidi; 1035 struct snd_rawmidi *rmidi;
1038 snd_rawmidi_substream_t *substream_input; 1036 struct snd_rawmidi_substream *substream_input;
1039 snd_rawmidi_substream_t *substream_output; 1037 struct snd_rawmidi_substream *substream_output;
1040 unsigned int midi_mode; 1038 unsigned int midi_mode;
1041 spinlock_t input_lock; 1039 spinlock_t input_lock;
1042 spinlock_t output_lock; 1040 spinlock_t output_lock;
@@ -1044,10 +1042,10 @@ typedef struct {
1044 int tx_enable, rx_enable; 1042 int tx_enable, rx_enable;
1045 int port; 1043 int port;
1046 int ipr_tx, ipr_rx; 1044 int ipr_tx, ipr_rx;
1047 void (*interrupt)(emu10k1_t *emu, unsigned int status); 1045 void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1048} emu10k1_midi_t; 1046};
1049 1047
1050typedef struct { 1048struct snd_emu_chip_details {
1051 u32 vendor; 1049 u32 vendor;
1052 u32 device; 1050 u32 device;
1053 u32 subsystem; 1051 u32 subsystem;
@@ -1063,18 +1061,23 @@ typedef struct {
1063 unsigned char spdif_bug; /* Has Spdif phasing bug */ 1061 unsigned char spdif_bug; /* Has Spdif phasing bug */
1064 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ 1062 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */
1065 unsigned char ecard; /* APS EEPROM */ 1063 unsigned char ecard; /* APS EEPROM */
1064 unsigned char emu1212m; /* EMU 1212m card */
1065 unsigned char spi_dac; /* SPI interface for DAC */
1066 unsigned char i2c_adc; /* I2C interface for ADC */
1066 const char *driver; 1067 const char *driver;
1067 const char *name; 1068 const char *name;
1068 const char *id; /* for backward compatibility - can be NULL if not needed */ 1069 const char *id; /* for backward compatibility - can be NULL if not needed */
1069} emu_chip_details_t; 1070};
1070 1071
1071struct _snd_emu10k1 { 1072struct snd_emu10k1 {
1072 int irq; 1073 int irq;
1073 1074
1074 unsigned long port; /* I/O port number */ 1075 unsigned long port; /* I/O port number */
1075 unsigned int tos_link: 1, /* tos link detected */ 1076 unsigned int tos_link: 1, /* tos link detected */
1076 rear_ac97: 1; /* rear channels are on AC'97 */ 1077 rear_ac97: 1, /* rear channels are on AC'97 */
1077 const emu_chip_details_t *card_capabilities; /* Contains profile of card capabilities */ 1078 enable_ir: 1;
1079 /* Contains profile of card capabilities */
1080 const struct snd_emu_chip_details *card_capabilities;
1078 unsigned int audigy; /* is Audigy? */ 1081 unsigned int audigy; /* is Audigy? */
1079 unsigned int revision; /* chip revision */ 1082 unsigned int revision; /* chip revision */
1080 unsigned int serial; /* serial number */ 1083 unsigned int serial; /* serial number */
@@ -1088,8 +1091,8 @@ struct _snd_emu10k1 {
1088 struct snd_dma_device p16v_dma_dev; 1091 struct snd_dma_device p16v_dma_dev;
1089 struct snd_dma_buffer p16v_buffer; 1092 struct snd_dma_buffer p16v_buffer;
1090 1093
1091 snd_util_memhdr_t *memhdr; /* page allocation list */ 1094 struct snd_util_memhdr *memhdr; /* page allocation list */
1092 emu10k1_memblk_t *reserved_page; /* reserved page */ 1095 struct snd_emu10k1_memblk *reserved_page; /* reserved page */
1093 1096
1094 struct list_head mapped_link_head; 1097 struct list_head mapped_link_head;
1095 struct list_head mapped_order_link_head; 1098 struct list_head mapped_order_link_head;
@@ -1099,142 +1102,169 @@ struct _snd_emu10k1 {
1099 1102
1100 unsigned int spdif_bits[3]; /* s/pdif out setup */ 1103 unsigned int spdif_bits[3]; /* s/pdif out setup */
1101 1104
1102 snd_emu10k1_fx8010_t fx8010; /* FX8010 info */ 1105 struct snd_emu10k1_fx8010 fx8010; /* FX8010 info */
1103 int gpr_base; 1106 int gpr_base;
1104 1107
1105 ac97_t *ac97; 1108 struct snd_ac97 *ac97;
1106 1109
1107 struct pci_dev *pci; 1110 struct pci_dev *pci;
1108 snd_card_t *card; 1111 struct snd_card *card;
1109 snd_pcm_t *pcm; 1112 struct snd_pcm *pcm;
1110 snd_pcm_t *pcm_mic; 1113 struct snd_pcm *pcm_mic;
1111 snd_pcm_t *pcm_efx; 1114 struct snd_pcm *pcm_efx;
1112 snd_pcm_t *pcm_p16v; 1115 struct snd_pcm *pcm_multi;
1116 struct snd_pcm *pcm_p16v;
1113 1117
1114 spinlock_t synth_lock; 1118 spinlock_t synth_lock;
1115 void *synth; 1119 void *synth;
1116 int (*get_synth_voice)(emu10k1_t *emu); 1120 int (*get_synth_voice)(struct snd_emu10k1 *emu);
1117 1121
1118 spinlock_t reg_lock; 1122 spinlock_t reg_lock;
1119 spinlock_t emu_lock; 1123 spinlock_t emu_lock;
1120 spinlock_t voice_lock; 1124 spinlock_t voice_lock;
1121 struct semaphore ptb_lock; 1125 struct semaphore ptb_lock;
1122 1126
1123 emu10k1_voice_t voices[NUM_G]; 1127 struct snd_emu10k1_voice voices[NUM_G];
1124 emu10k1_voice_t p16v_voices[4]; 1128 struct snd_emu10k1_voice p16v_voices[4];
1125 emu10k1_voice_t p16v_capture_voice; 1129 struct snd_emu10k1_voice p16v_capture_voice;
1126 int p16v_device_offset; 1130 int p16v_device_offset;
1127 u32 p16v_capture_source; 1131 u32 p16v_capture_source;
1128 u32 p16v_capture_channel; 1132 u32 p16v_capture_channel;
1129 emu10k1_pcm_mixer_t pcm_mixer[32]; 1133 struct snd_emu10k1_pcm_mixer pcm_mixer[32];
1130 emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK]; 1134 struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK];
1131 snd_kcontrol_t *ctl_send_routing; 1135 struct snd_kcontrol *ctl_send_routing;
1132 snd_kcontrol_t *ctl_send_volume; 1136 struct snd_kcontrol *ctl_send_volume;
1133 snd_kcontrol_t *ctl_attn; 1137 struct snd_kcontrol *ctl_attn;
1134 snd_kcontrol_t *ctl_efx_send_routing; 1138 struct snd_kcontrol *ctl_efx_send_routing;
1135 snd_kcontrol_t *ctl_efx_send_volume; 1139 struct snd_kcontrol *ctl_efx_send_volume;
1136 snd_kcontrol_t *ctl_efx_attn; 1140 struct snd_kcontrol *ctl_efx_attn;
1137 1141
1138 void (*hwvol_interrupt)(emu10k1_t *emu, unsigned int status); 1142 void (*hwvol_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1139 void (*capture_interrupt)(emu10k1_t *emu, unsigned int status); 1143 void (*capture_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1140 void (*capture_mic_interrupt)(emu10k1_t *emu, unsigned int status); 1144 void (*capture_mic_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1141 void (*capture_efx_interrupt)(emu10k1_t *emu, unsigned int status); 1145 void (*capture_efx_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1142 void (*spdif_interrupt)(emu10k1_t *emu, unsigned int status); 1146 void (*spdif_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1143 void (*dsp_interrupt)(emu10k1_t *emu); 1147 void (*dsp_interrupt)(struct snd_emu10k1 *emu);
1144 1148
1145 snd_pcm_substream_t *pcm_capture_substream; 1149 struct snd_pcm_substream *pcm_capture_substream;
1146 snd_pcm_substream_t *pcm_capture_mic_substream; 1150 struct snd_pcm_substream *pcm_capture_mic_substream;
1147 snd_pcm_substream_t *pcm_capture_efx_substream; 1151 struct snd_pcm_substream *pcm_capture_efx_substream;
1148 snd_pcm_substream_t *pcm_playback_efx_substream; 1152 struct snd_pcm_substream *pcm_playback_efx_substream;
1149 1153
1150 snd_timer_t *timer; 1154 struct snd_timer *timer;
1151 1155
1152 emu10k1_midi_t midi; 1156 struct snd_emu10k1_midi midi;
1153 emu10k1_midi_t midi2; /* for audigy */ 1157 struct snd_emu10k1_midi midi2; /* for audigy */
1154 1158
1155 unsigned int efx_voices_mask[2]; 1159 unsigned int efx_voices_mask[2];
1156 unsigned int next_free_voice; 1160 unsigned int next_free_voice;
1161
1162#ifdef CONFIG_PM
1163 unsigned int *saved_ptr;
1164 unsigned int *saved_gpr;
1165 unsigned int *tram_val_saved;
1166 unsigned int *tram_addr_saved;
1167 unsigned int *saved_icode;
1168 unsigned int *p16v_saved;
1169 unsigned int saved_a_iocfg, saved_hcfg;
1170#endif
1171
1157}; 1172};
1158 1173
1159int snd_emu10k1_create(snd_card_t * card, 1174int snd_emu10k1_create(struct snd_card *card,
1160 struct pci_dev *pci, 1175 struct pci_dev *pci,
1161 unsigned short extin_mask, 1176 unsigned short extin_mask,
1162 unsigned short extout_mask, 1177 unsigned short extout_mask,
1163 long max_cache_bytes, 1178 long max_cache_bytes,
1164 int enable_ir, 1179 int enable_ir,
1165 uint subsystem, 1180 uint subsystem,
1166 emu10k1_t ** remu); 1181 struct snd_emu10k1 ** remu);
1167 1182
1168int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1183int snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1169int snd_emu10k1_pcm_mic(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1184int snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1170int snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1185int snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1171int snd_p16v_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1186int snd_p16v_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1172int snd_p16v_free(emu10k1_t * emu); 1187int snd_p16v_free(struct snd_emu10k1 * emu);
1173int snd_p16v_mixer(emu10k1_t * emu); 1188int snd_p16v_mixer(struct snd_emu10k1 * emu);
1174int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1189int snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1175int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1190int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1176int snd_emu10k1_mixer(emu10k1_t * emu, int pcm_device, int multi_device); 1191int snd_emu10k1_mixer(struct snd_emu10k1 * emu, int pcm_device, int multi_device);
1177int snd_emu10k1_timer(emu10k1_t * emu, int device); 1192int snd_emu10k1_timer(struct snd_emu10k1 * emu, int device);
1178int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep); 1193int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep);
1179 1194
1180irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs); 1195irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs);
1181 1196
1182/* initialization */ 1197void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int voice);
1183void snd_emu10k1_voice_init(emu10k1_t * emu, int voice); 1198int snd_emu10k1_init_efx(struct snd_emu10k1 *emu);
1184int snd_emu10k1_init_efx(emu10k1_t *emu); 1199void snd_emu10k1_free_efx(struct snd_emu10k1 *emu);
1185void snd_emu10k1_free_efx(emu10k1_t *emu); 1200int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size);
1186int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size); 1201int snd_emu10k1_done(struct snd_emu10k1 * emu);
1187 1202
1188/* I/O functions */ 1203/* I/O functions */
1189unsigned int snd_emu10k1_ptr_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1204unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1190void snd_emu10k1_ptr_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1205void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1191unsigned int snd_emu10k1_ptr20_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1206unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1192void snd_emu10k1_ptr20_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1207void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1193unsigned int snd_emu10k1_efx_read(emu10k1_t *emu, unsigned int pc); 1208int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data);
1194void snd_emu10k1_intr_enable(emu10k1_t *emu, unsigned int intrenb); 1209unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc);
1195void snd_emu10k1_intr_disable(emu10k1_t *emu, unsigned int intrenb); 1210void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb);
1196void snd_emu10k1_voice_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1211void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb);
1197void snd_emu10k1_voice_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1212void snd_emu10k1_voice_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1198void snd_emu10k1_voice_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1213void snd_emu10k1_voice_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1199void snd_emu10k1_voice_half_loop_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1214void snd_emu10k1_voice_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1200void snd_emu10k1_voice_half_loop_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1215void snd_emu10k1_voice_half_loop_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1201void snd_emu10k1_voice_half_loop_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1216void snd_emu10k1_voice_half_loop_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1202void snd_emu10k1_voice_set_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1217void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1203void snd_emu10k1_voice_clear_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1218void snd_emu10k1_voice_set_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1204void snd_emu10k1_wait(emu10k1_t *emu, unsigned int wait); 1219void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1205static inline unsigned int snd_emu10k1_wc(emu10k1_t *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; } 1220void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait);
1206unsigned short snd_emu10k1_ac97_read(ac97_t *ac97, unsigned short reg); 1221static inline unsigned int snd_emu10k1_wc(struct snd_emu10k1 *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; }
1207void snd_emu10k1_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short data); 1222unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
1223void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
1208unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); 1224unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
1209 1225
1226#ifdef CONFIG_PM
1227void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu);
1228void snd_emu10k1_resume_init(struct snd_emu10k1 *emu);
1229void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu);
1230int snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu);
1231void snd_emu10k1_efx_free_pm_buffer(struct snd_emu10k1 *emu);
1232void snd_emu10k1_efx_suspend(struct snd_emu10k1 *emu);
1233void snd_emu10k1_efx_resume(struct snd_emu10k1 *emu);
1234int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu);
1235void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu);
1236void snd_p16v_suspend(struct snd_emu10k1 *emu);
1237void snd_p16v_resume(struct snd_emu10k1 *emu);
1238#endif
1239
1210/* memory allocation */ 1240/* memory allocation */
1211snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, snd_pcm_substream_t *substream); 1241struct snd_util_memblk *snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream);
1212int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk); 1242int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1213snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size); 1243struct snd_util_memblk *snd_emu10k1_synth_alloc(struct snd_emu10k1 *emu, unsigned int size);
1214int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk); 1244int snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1215int snd_emu10k1_synth_bzero(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, int size); 1245int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, int size);
1216int snd_emu10k1_synth_copy_from_user(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, const char __user *data, int size); 1246int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, const char __user *data, int size);
1217int snd_emu10k1_memblk_map(emu10k1_t *emu, emu10k1_memblk_t *blk); 1247int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk);
1218 1248
1219/* voice allocation */ 1249/* voice allocation */
1220int snd_emu10k1_voice_alloc(emu10k1_t *emu, emu10k1_voice_type_t type, int pair, emu10k1_voice_t **rvoice); 1250int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int pair, struct snd_emu10k1_voice **rvoice);
1221int snd_emu10k1_voice_free(emu10k1_t *emu, emu10k1_voice_t *pvoice); 1251int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
1222 1252
1223/* MIDI uart */ 1253/* MIDI uart */
1224int snd_emu10k1_midi(emu10k1_t * emu); 1254int snd_emu10k1_midi(struct snd_emu10k1 * emu);
1225int snd_emu10k1_audigy_midi(emu10k1_t * emu); 1255int snd_emu10k1_audigy_midi(struct snd_emu10k1 * emu);
1226 1256
1227/* proc interface */ 1257/* proc interface */
1228int snd_emu10k1_proc_init(emu10k1_t * emu); 1258int snd_emu10k1_proc_init(struct snd_emu10k1 * emu);
1229 1259
1230/* fx8010 irq handler */ 1260/* fx8010 irq handler */
1231int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, 1261int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
1232 snd_fx8010_irq_handler_t *handler, 1262 snd_fx8010_irq_handler_t *handler,
1233 unsigned char gpr_running, 1263 unsigned char gpr_running,
1234 void *private_data, 1264 void *private_data,
1235 snd_emu10k1_fx8010_irq_t **r_irq); 1265 struct snd_emu10k1_fx8010_irq **r_irq);
1236int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, 1266int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
1237 snd_emu10k1_fx8010_irq_t *irq); 1267 struct snd_emu10k1_fx8010_irq *irq);
1238 1268
1239#endif /* __KERNEL__ */ 1269#endif /* __KERNEL__ */
1240 1270
@@ -1469,14 +1499,14 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu,
1469#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ 1499#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
1470#endif 1500#endif
1471 1501
1472typedef struct { 1502struct snd_emu10k1_fx8010_info {
1473 unsigned int internal_tram_size; /* in samples */ 1503 unsigned int internal_tram_size; /* in samples */
1474 unsigned int external_tram_size; /* in samples */ 1504 unsigned int external_tram_size; /* in samples */
1475 char fxbus_names[16][32]; /* names of FXBUSes */ 1505 char fxbus_names[16][32]; /* names of FXBUSes */
1476 char extin_names[16][32]; /* names of external inputs */ 1506 char extin_names[16][32]; /* names of external inputs */
1477 char extout_names[32][32]; /* names of external outputs */ 1507 char extout_names[32][32]; /* names of external outputs */
1478 unsigned int gpr_controls; /* count of GPR controls */ 1508 unsigned int gpr_controls; /* count of GPR controls */
1479} emu10k1_fx8010_info_t; 1509};
1480 1510
1481#define EMU10K1_GPR_TRANSLATION_NONE 0 1511#define EMU10K1_GPR_TRANSLATION_NONE 0
1482#define EMU10K1_GPR_TRANSLATION_TABLE100 1 1512#define EMU10K1_GPR_TRANSLATION_TABLE100 1
@@ -1484,8 +1514,8 @@ typedef struct {
1484#define EMU10K1_GPR_TRANSLATION_TREBLE 3 1514#define EMU10K1_GPR_TRANSLATION_TREBLE 3
1485#define EMU10K1_GPR_TRANSLATION_ONOFF 4 1515#define EMU10K1_GPR_TRANSLATION_ONOFF 4
1486 1516
1487typedef struct { 1517struct snd_emu10k1_fx8010_control_gpr {
1488 snd_ctl_elem_id_t id; /* full control ID definition */ 1518 struct snd_ctl_elem_id id; /* full control ID definition */
1489 unsigned int vcount; /* visible count */ 1519 unsigned int vcount; /* visible count */
1490 unsigned int count; /* count of GPR (1..16) */ 1520 unsigned int count; /* count of GPR (1..16) */
1491 unsigned short gpr[32]; /* GPR number(s) */ 1521 unsigned short gpr[32]; /* GPR number(s) */
@@ -1493,23 +1523,23 @@ typedef struct {
1493 unsigned int min; /* minimum range */ 1523 unsigned int min; /* minimum range */
1494 unsigned int max; /* maximum range */ 1524 unsigned int max; /* maximum range */
1495 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 1525 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
1496} emu10k1_fx8010_control_gpr_t; 1526};
1497 1527
1498typedef struct { 1528struct snd_emu10k1_fx8010_code {
1499 char name[128]; 1529 char name[128];
1500 1530
1501 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ 1531 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
1502 u_int32_t __user *gpr_map; /* initializers */ 1532 u_int32_t __user *gpr_map; /* initializers */
1503 1533
1504 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ 1534 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
1505 emu10k1_fx8010_control_gpr_t __user *gpr_add_controls; /* GPR controls to add/replace */ 1535 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
1506 1536
1507 unsigned int gpr_del_control_count; /* count of GPR controls to remove */ 1537 unsigned int gpr_del_control_count; /* count of GPR controls to remove */
1508 snd_ctl_elem_id_t __user *gpr_del_controls; /* IDs of GPR controls to remove */ 1538 struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
1509 1539
1510 unsigned int gpr_list_control_count; /* count of GPR controls to list */ 1540 unsigned int gpr_list_control_count; /* count of GPR controls to list */
1511 unsigned int gpr_list_control_total; /* total count of GPR controls */ 1541 unsigned int gpr_list_control_total; /* total count of GPR controls */
1512 emu10k1_fx8010_control_gpr_t __user *gpr_list_controls; /* listed GPR controls */ 1542 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
1513 1543
1514 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ 1544 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
1515 u_int32_t __user *tram_data_map; /* data initializers */ 1545 u_int32_t __user *tram_data_map; /* data initializers */
@@ -1517,16 +1547,16 @@ typedef struct {
1517 1547
1518 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ 1548 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
1519 u_int32_t __user *code; /* one instruction - 64 bits */ 1549 u_int32_t __user *code; /* one instruction - 64 bits */
1520} emu10k1_fx8010_code_t; 1550};
1521 1551
1522typedef struct { 1552struct snd_emu10k1_fx8010_tram {
1523 unsigned int address; /* 31.bit == 1 -> external TRAM */ 1553 unsigned int address; /* 31.bit == 1 -> external TRAM */
1524 unsigned int size; /* size in samples (4 bytes) */ 1554 unsigned int size; /* size in samples (4 bytes) */
1525 unsigned int *samples; /* pointer to samples (20-bit) */ 1555 unsigned int *samples; /* pointer to samples (20-bit) */
1526 /* NULL->clear memory */ 1556 /* NULL->clear memory */
1527} emu10k1_fx8010_tram_t; 1557};
1528 1558
1529typedef struct { 1559struct snd_emu10k1_fx8010_pcm_rec {
1530 unsigned int substream; /* substream number */ 1560 unsigned int substream; /* substream number */
1531 unsigned int res1; /* reserved */ 1561 unsigned int res1; /* reserved */
1532 unsigned int channels; /* 16-bit channels count, zero = remove this substream */ 1562 unsigned int channels; /* 16-bit channels count, zero = remove this substream */
@@ -1541,20 +1571,27 @@ typedef struct {
1541 unsigned char pad; /* reserved */ 1571 unsigned char pad; /* reserved */
1542 unsigned char etram[32]; /* external TRAM address & data (one per channel) */ 1572 unsigned char etram[32]; /* external TRAM address & data (one per channel) */
1543 unsigned int res2; /* reserved */ 1573 unsigned int res2; /* reserved */
1544} emu10k1_fx8010_pcm_t; 1574};
1545 1575
1546#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t) 1576#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
1547#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t) 1577#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
1548#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t) 1578#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
1549#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) 1579#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
1550#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t) 1580#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
1551#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t) 1581#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
1552#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t) 1582#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
1553#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t) 1583#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
1554#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) 1584#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
1555#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) 1585#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
1556#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) 1586#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
1557#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) 1587#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
1558#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) 1588#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
1559 1589
1590/* typedefs for compatibility to user-space */
1591typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
1592typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
1593typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
1594typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
1595typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
1596
1560#endif /* __SOUND_EMU10K1_H */ 1597#endif /* __SOUND_EMU10K1_H */
diff --git a/include/sound/emu10k1_synth.h b/include/sound/emu10k1_synth.h
index df0df1d09552..6ef61c420935 100644
--- a/include/sound/emu10k1_synth.h
+++ b/include/sound/emu10k1_synth.h
@@ -27,12 +27,12 @@
27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth" 27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth"
28 28
29/* argument for snd_seq_device_new */ 29/* argument for snd_seq_device_new */
30typedef struct snd_emu10k1_synth_arg { 30struct snd_emu10k1_synth_arg {
31 emu10k1_t *hwptr; /* chip */ 31 struct snd_emu10k1 *hwptr; /* chip */
32 int index; /* sequencer client index */ 32 int index; /* sequencer client index */
33 int seq_ports; /* number of sequencer ports to be created */ 33 int seq_ports; /* number of sequencer ports to be created */
34 int max_voices; /* maximum number of voices for wavetable */ 34 int max_voices; /* maximum number of voices for wavetable */
35} snd_emu10k1_synth_arg_t; 35};
36 36
37#define EMU10K1_MAX_MEMSIZE (32 * 1024 * 1024) /* 32MB */ 37#define EMU10K1_MAX_MEMSIZE (32 * 1024 * 1024) /* 32MB */
38 38
diff --git a/include/sound/emu8000.h b/include/sound/emu8000.h
index 4362c54e09d0..c8f66bde6d95 100644
--- a/include/sound/emu8000.h
+++ b/include/sound/emu8000.h
@@ -56,9 +56,9 @@ enum {
56 * some of the channels may be used for other things so max_channels is 56 * some of the channels may be used for other things so max_channels is
57 * the number in use for wave voices. 57 * the number in use for wave voices.
58 */ 58 */
59typedef struct snd_emu8000 { 59struct snd_emu8000 {
60 60
61 snd_emux_t *emu; 61 struct snd_emux *emu;
62 62
63 int index; /* sequencer client index */ 63 int index; /* sequencer client index */
64 int seq_ports; /* number of sequencer ports */ 64 int seq_ports; /* number of sequencer ports */
@@ -77,44 +77,45 @@ typedef struct snd_emu8000 {
77 77
78 int dram_checked; 78 int dram_checked;
79 79
80 snd_card_t *card; /* The card that this belongs to */ 80 struct snd_card *card; /* The card that this belongs to */
81 81
82 int chorus_mode; 82 int chorus_mode;
83 int reverb_mode; 83 int reverb_mode;
84 int bass_level; 84 int bass_level;
85 int treble_level; 85 int treble_level;
86 86
87 snd_util_memhdr_t *memhdr; 87 struct snd_util_memhdr *memhdr;
88 88
89 spinlock_t control_lock; 89 spinlock_t control_lock;
90 snd_kcontrol_t *controls[EMU8000_NUM_CONTROLS]; 90 struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
91 91
92 snd_pcm_t *pcm; /* pcm on emu8000 wavetable */ 92 struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
93 93
94} emu8000_t; 94};
95 95
96/* sequencer device id */ 96/* sequencer device id */
97#define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth" 97#define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth"
98 98
99 99
100/* exported functions */ 100/* exported functions */
101int snd_emu8000_new(snd_card_t *card, int device, long port, int seq_ports, snd_seq_device_t **ret); 101int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
102void snd_emu8000_poke(emu8000_t *emu, unsigned int port, unsigned int reg, 102 struct snd_seq_device **ret);
103void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
103 unsigned int val); 104 unsigned int val);
104unsigned short snd_emu8000_peek(emu8000_t *emu, unsigned int port, 105unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
105 unsigned int reg); 106 unsigned int reg);
106void snd_emu8000_poke_dw(emu8000_t *emu, unsigned int port, unsigned int reg, 107void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
107 unsigned int val); 108 unsigned int val);
108unsigned int snd_emu8000_peek_dw(emu8000_t *emu, unsigned int port, 109unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
109 unsigned int reg); 110 unsigned int reg);
110void snd_emu8000_dma_chan(emu8000_t *emu, int ch, int mode); 111void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
111 112
112void snd_emu8000_init_fm(emu8000_t *emu); 113void snd_emu8000_init_fm(struct snd_emu8000 *emu);
113 114
114void snd_emu8000_update_chorus_mode(emu8000_t *emu); 115void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
115void snd_emu8000_update_reverb_mode(emu8000_t *emu); 116void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
116void snd_emu8000_update_equalizer(emu8000_t *emu); 117void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
117int snd_emu8000_load_chorus_fx(emu8000_t *emu, int mode, const void __user *buf, long len); 118int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
118int snd_emu8000_load_reverb_fx(emu8000_t *emu, int mode, const void __user *buf, long len); 119int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
119 120
120#endif /* __SOUND_EMU8000_H */ 121#endif /* __SOUND_EMU8000_H */
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index c6970aac9bdc..b2d6b2acc7c7 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -36,39 +36,40 @@
36 */ 36 */
37#define SNDRV_EMUX_USE_RAW_EFFECT 37#define SNDRV_EMUX_USE_RAW_EFFECT
38 38
39 39struct snd_emux;
40/* 40struct snd_emux_port;
41 * typedefs 41struct snd_emux_voice;
42 */ 42struct snd_emux_effect_table;
43typedef struct snd_emux_effect_table snd_emux_effect_table_t;
44typedef struct snd_emux_port snd_emux_port_t;
45typedef struct snd_emux_voice snd_emux_voice_t;
46typedef struct snd_emux snd_emux_t;
47
48 43
49/* 44/*
50 * operators 45 * operators
51 */ 46 */
52typedef struct snd_emux_operators { 47struct snd_emux_operators {
53 struct module *owner; 48 struct module *owner;
54 snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); 49 struct snd_emux_voice *(*get_voice)(struct snd_emux *emu,
55 int (*prepare)(snd_emux_voice_t *vp); 50 struct snd_emux_port *port);
56 void (*trigger)(snd_emux_voice_t *vp); 51 int (*prepare)(struct snd_emux_voice *vp);
57 void (*release)(snd_emux_voice_t *vp); 52 void (*trigger)(struct snd_emux_voice *vp);
58 void (*update)(snd_emux_voice_t *vp, int update); 53 void (*release)(struct snd_emux_voice *vp);
59 void (*terminate)(snd_emux_voice_t *vp); 54 void (*update)(struct snd_emux_voice *vp, int update);
60 void (*free_voice)(snd_emux_voice_t *vp); 55 void (*terminate)(struct snd_emux_voice *vp);
61 void (*reset)(snd_emux_t *emu, int ch); 56 void (*free_voice)(struct snd_emux_voice *vp);
62 /* the first parameters are snd_emux_t */ 57 void (*reset)(struct snd_emux *emu, int ch);
63 int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); 58 /* the first parameters are struct snd_emux */
64 int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); 59 int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp,
65 void (*sample_reset)(snd_emux_t *emu); 60 struct snd_util_memhdr *hdr,
66 int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); 61 const void __user *data, long count);
67 void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 62 int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp,
63 struct snd_util_memhdr *hdr);
64 void (*sample_reset)(struct snd_emux *emu);
65 int (*load_fx)(struct snd_emux *emu, int type, int arg,
66 const void __user *data, long count);
67 void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
68 struct snd_midi_channel_set *chset);
68#ifdef CONFIG_SND_SEQUENCER_OSS 69#ifdef CONFIG_SND_SEQUENCER_OSS
69 int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); 70 int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
70#endif 71#endif
71} snd_emux_operators_t; 72};
72 73
73 74
74/* 75/*
@@ -90,46 +91,46 @@ typedef struct snd_emux_operators {
90 */ 91 */
91struct snd_emux { 92struct snd_emux {
92 93
93 snd_card_t *card; /* assigned card */ 94 struct snd_card *card; /* assigned card */
94 95
95 /* following should be initialized before registration */ 96 /* following should be initialized before registration */
96 int max_voices; /* Number of voices */ 97 int max_voices; /* Number of voices */
97 int mem_size; /* memory size (in byte) */ 98 int mem_size; /* memory size (in byte) */
98 int num_ports; /* number of ports to be created */ 99 int num_ports; /* number of ports to be created */
99 int pitch_shift; /* pitch shift value (for Emu10k1) */ 100 int pitch_shift; /* pitch shift value (for Emu10k1) */
100 snd_emux_operators_t ops; /* operators */ 101 struct snd_emux_operators ops; /* operators */
101 void *hw; /* hardware */ 102 void *hw; /* hardware */
102 unsigned long flags; /* other conditions */ 103 unsigned long flags; /* other conditions */
103 int midi_ports; /* number of virtual midi devices */ 104 int midi_ports; /* number of virtual midi devices */
104 int midi_devidx; /* device offset of virtual midi */ 105 int midi_devidx; /* device offset of virtual midi */
105 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ 106 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */
106 int hwdep_idx; /* hwdep device index */ 107 int hwdep_idx; /* hwdep device index */
107 snd_hwdep_t *hwdep; /* hwdep device */ 108 struct snd_hwdep *hwdep; /* hwdep device */
108 109
109 /* private */ 110 /* private */
110 int num_voices; /* current number of voices */ 111 int num_voices; /* current number of voices */
111 snd_sf_list_t *sflist; /* root of SoundFont list */ 112 struct snd_sf_list *sflist; /* root of SoundFont list */
112 snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ 113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */
113 int use_time; /* allocation counter */ 114 int use_time; /* allocation counter */
114 spinlock_t voice_lock; /* Lock for voice access */ 115 spinlock_t voice_lock; /* Lock for voice access */
115 struct semaphore register_mutex; 116 struct semaphore register_mutex;
116 int client; /* For the sequencer client */ 117 int client; /* For the sequencer client */
117 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ 118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
118 snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; 119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
119 int used; /* use counter */ 120 int used; /* use counter */
120 char *name; /* name of the device (internal) */ 121 char *name; /* name of the device (internal) */
121 snd_rawmidi_t **vmidi; 122 struct snd_rawmidi **vmidi;
122 struct timer_list tlist; /* for pending note-offs */ 123 struct timer_list tlist; /* for pending note-offs */
123 int timer_active; 124 int timer_active;
124 125
125 snd_util_memhdr_t *memhdr; /* memory chunk information */ 126 struct snd_util_memhdr *memhdr; /* memory chunk information */
126 127
127#ifdef CONFIG_PROC_FS 128#ifdef CONFIG_PROC_FS
128 snd_info_entry_t *proc; 129 struct snd_info_entry *proc;
129#endif 130#endif
130 131
131#ifdef CONFIG_SND_SEQUENCER_OSS 132#ifdef CONFIG_SND_SEQUENCER_OSS
132 snd_seq_device_t *oss_synth; 133 struct snd_seq_device *oss_synth;
133#endif 134#endif
134}; 135};
135 136
@@ -139,18 +140,18 @@ struct snd_emux {
139 */ 140 */
140struct snd_emux_port { 141struct snd_emux_port {
141 142
142 snd_midi_channel_set_t chset; 143 struct snd_midi_channel_set chset;
143 snd_emux_t *emu; 144 struct snd_emux *emu;
144 145
145 char port_mode; /* operation mode */ 146 char port_mode; /* operation mode */
146 int volume_atten; /* emuX raw attenuation */ 147 int volume_atten; /* emuX raw attenuation */
147 unsigned long drum_flags; /* drum bitmaps */ 148 unsigned long drum_flags; /* drum bitmaps */
148 int ctrls[EMUX_MD_END]; /* control parameters */ 149 int ctrls[EMUX_MD_END]; /* control parameters */
149#ifdef SNDRV_EMUX_USE_RAW_EFFECT 150#ifdef SNDRV_EMUX_USE_RAW_EFFECT
150 snd_emux_effect_table_t *effect; 151 struct snd_emux_effect_table *effect;
151#endif 152#endif
152#ifdef CONFIG_SND_SEQUENCER_OSS 153#ifdef CONFIG_SND_SEQUENCER_OSS
153 snd_seq_oss_arg_t *oss_arg; 154 struct snd_seq_oss_arg *oss_arg;
154#endif 155#endif
155}; 156};
156 157
@@ -179,16 +180,16 @@ struct snd_emux_voice {
179 unsigned char key; 180 unsigned char key;
180 unsigned char velocity; /* Velocity of current note */ 181 unsigned char velocity; /* Velocity of current note */
181 182
182 snd_sf_zone_t *zone; /* Zone assigned to this note */ 183 struct snd_sf_zone *zone; /* Zone assigned to this note */
183 void *block; /* sample block pointer (optional) */ 184 void *block; /* sample block pointer (optional) */
184 snd_midi_channel_t *chan; /* Midi channel for this note */ 185 struct snd_midi_channel *chan; /* Midi channel for this note */
185 snd_emux_port_t *port; /* associated port */ 186 struct snd_emux_port *port; /* associated port */
186 snd_emux_t *emu; /* assigned root info */ 187 struct snd_emux *emu; /* assigned root info */
187 void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ 188 void *hw; /* hardware pointer (emu8000 or emu10k1) */
188 unsigned long ontime; /* jiffies at note triggered */ 189 unsigned long ontime; /* jiffies at note triggered */
189 190
190 /* Emu8k/Emu10k1 registers */ 191 /* Emu8k/Emu10k1 registers */
191 soundfont_voice_info_t reg; 192 struct soundfont_voice_info reg;
192 193
193 /* additional registers */ 194 /* additional registers */
194 int avol; /* volume attenuation */ 195 int avol; /* volume attenuation */
@@ -229,15 +230,15 @@ struct snd_emux_effect_table {
229/* 230/*
230 * prototypes - interface to Emu10k1 and Emu8k routines 231 * prototypes - interface to Emu10k1 and Emu8k routines
231 */ 232 */
232int snd_emux_new(snd_emux_t **remu); 233int snd_emux_new(struct snd_emux **remu);
233int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); 234int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name);
234int snd_emux_free(snd_emux_t *emu); 235int snd_emux_free(struct snd_emux *emu);
235 236
236/* 237/*
237 * exported functions 238 * exported functions
238 */ 239 */
239void snd_emux_terminate_all(snd_emux_t *emu); 240void snd_emux_terminate_all(struct snd_emux *emu);
240void snd_emux_lock_voice(snd_emux_t *emu, int voice); 241void snd_emux_lock_voice(struct snd_emux *emu, int voice);
241void snd_emux_unlock_voice(snd_emux_t *emu, int voice); 242void snd_emux_unlock_voice(struct snd_emux *emu, int voice);
242 243
243#endif /* __SOUND_EMUX_SYNTH_H */ 244#endif /* __SOUND_EMUX_SYNTH_H */
diff --git a/include/sound/es1688.h b/include/sound/es1688.h
index 604f495bc8b1..fc1c47dae3da 100644
--- a/include/sound/es1688.h
+++ b/include/sound/es1688.h
@@ -30,7 +30,7 @@
30#define ES1688_HW_688 0x0001 30#define ES1688_HW_688 0x0001
31#define ES1688_HW_1688 0x0002 31#define ES1688_HW_1688 0x0002
32 32
33struct _snd_es1688 { 33struct snd_es1688 {
34 unsigned long port; /* port of ESS chip */ 34 unsigned long port; /* port of ESS chip */
35 struct resource *res_port; 35 struct resource *res_port;
36 unsigned long mpu_port; /* MPU-401 port of ESS chip */ 36 unsigned long mpu_port; /* MPU-401 port of ESS chip */
@@ -44,17 +44,15 @@ struct _snd_es1688 {
44 unsigned char pad; 44 unsigned char pad;
45 unsigned int dma_size; 45 unsigned int dma_size;
46 46
47 snd_card_t *card; 47 struct snd_card *card;
48 snd_pcm_t *pcm; 48 struct snd_pcm *pcm;
49 snd_pcm_substream_t *playback_substream; 49 struct snd_pcm_substream *playback_substream;
50 snd_pcm_substream_t *capture_substream; 50 struct snd_pcm_substream *capture_substream;
51 51
52 spinlock_t reg_lock; 52 spinlock_t reg_lock;
53 spinlock_t mixer_lock; 53 spinlock_t mixer_lock;
54}; 54};
55 55
56typedef struct _snd_es1688 es1688_t;
57
58/* I/O ports */ 56/* I/O ports */
59 57
60#define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x) 58#define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x)
@@ -107,17 +105,17 @@ typedef struct _snd_es1688 es1688_t;
107 105
108 */ 106 */
109 107
110void snd_es1688_mixer_write(es1688_t *chip, unsigned char reg, unsigned char data); 108void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data);
111 109
112int snd_es1688_create(snd_card_t * card, 110int snd_es1688_create(struct snd_card *card,
113 unsigned long port, 111 unsigned long port,
114 unsigned long mpu_port, 112 unsigned long mpu_port,
115 int irq, 113 int irq,
116 int mpu_irq, 114 int mpu_irq,
117 int dma8, 115 int dma8,
118 unsigned short hardware, 116 unsigned short hardware,
119 es1688_t ** rchip); 117 struct snd_es1688 ** rchip);
120int snd_es1688_pcm(es1688_t *chip, int device, snd_pcm_t ** rpcm); 118int snd_es1688_pcm(struct snd_es1688 *chip, int device, struct snd_pcm ** rpcm);
121int snd_es1688_mixer(es1688_t *chip); 119int snd_es1688_mixer(struct snd_es1688 *chip);
122 120
123#endif /* __SOUND_ES1688_H */ 121#endif /* __SOUND_ES1688_H */
diff --git a/include/sound/gus.h b/include/sound/gus.h
index 7000d9d9199d..63da50fae773 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -49,32 +49,32 @@
49#define SNDRV_g_u_s_IRQSTAT (0x226-0x220) 49#define SNDRV_g_u_s_IRQSTAT (0x226-0x220)
50#define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220) 50#define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220)
51#define SNDRV_g_u_s_TIMERDATA (0x229-0x220) 51#define SNDRV_g_u_s_TIMERDATA (0x229-0x220)
52#define SNDRV_g_u_s_DRAM (0x327-0x220) 52#define SNDRV_g_u_s_DRAM (0x327-0x220)
53#define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220) 53#define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220)
54#define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220) 54#define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220)
55#define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220) 55#define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220)
56#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220) 56#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220)
57#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220) 57#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220)
58#define SNDRV_g_u_s_IVER (0x325-0x220) 58#define SNDRV_g_u_s_IVER (0x325-0x220)
59#define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220) 59#define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220)
60#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220) 60#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220)
61 61
62/* GF1 registers */ 62/* GF1 registers */
63 63
64/* global registers */ 64/* global registers */
65#define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e 65#define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e
66#define SNDRV_GF1_GB_VOICES_IRQ 0x0f 66#define SNDRV_GF1_GB_VOICES_IRQ 0x0f
67#define SNDRV_GF1_GB_GLOBAL_MODE 0x19 67#define SNDRV_GF1_GB_GLOBAL_MODE 0x19
68#define SNDRV_GF1_GW_LFO_BASE 0x1a 68#define SNDRV_GF1_GW_LFO_BASE 0x1a
69#define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f 69#define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f
70#define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41 70#define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41
71#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42 71#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42
72#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43 72#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43
73#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44 73#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44
74#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45 74#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45
75#define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46 75#define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46
76#define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47 76#define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47
77#define SNDRV_GF1_GB_RECORD_RATE 0x48 77#define SNDRV_GF1_GB_RECORD_RATE 0x48
78#define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49 78#define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49
79#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b 79#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b
80#define SNDRV_GF1_GB_RESET 0x4c 80#define SNDRV_GF1_GB_RESET 0x4c
@@ -83,7 +83,7 @@
83#define SNDRV_GF1_GW_MEMORY_CONFIG 0x52 83#define SNDRV_GF1_GW_MEMORY_CONFIG 0x52
84#define SNDRV_GF1_GB_MEMORY_CONTROL 0x53 84#define SNDRV_GF1_GB_MEMORY_CONTROL 0x53
85#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54 85#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54
86#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55 86#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55
87#define SNDRV_GF1_GW_FIFO_SIZE 0x56 87#define SNDRV_GF1_GW_FIFO_SIZE 0x56
88#define SNDRV_GF1_GW_INTERLEAVE 0x57 88#define SNDRV_GF1_GW_INTERLEAVE 0x57
89#define SNDRV_GF1_GB_COMPATIBILITY 0x59 89#define SNDRV_GF1_GB_COMPATIBILITY 0x59
@@ -100,39 +100,39 @@
100#define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH 100#define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH
101#define SNDRV_GF1_VW_END_HIGH 0x04 101#define SNDRV_GF1_VW_END_HIGH 0x04
102#define SNDRV_GF1_VW_END_LOW 0x05 102#define SNDRV_GF1_VW_END_LOW 0x05
103#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH 103#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH
104#define SNDRV_GF1_VB_VOLUME_RATE 0x06 104#define SNDRV_GF1_VB_VOLUME_RATE 0x06
105#define SNDRV_GF1_VB_VOLUME_START 0x07 105#define SNDRV_GF1_VB_VOLUME_START 0x07
106#define SNDRV_GF1_VB_VOLUME_END 0x08 106#define SNDRV_GF1_VB_VOLUME_END 0x08
107#define SNDRV_GF1_VW_VOLUME 0x09 107#define SNDRV_GF1_VW_VOLUME 0x09
108#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a 108#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a
109#define SNDRV_GF1_VW_CURRENT_LOW 0x0b 109#define SNDRV_GF1_VW_CURRENT_LOW 0x0b
110#define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH 110#define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH
111#define SNDRV_GF1_VB_PAN 0x0c 111#define SNDRV_GF1_VB_PAN 0x0c
112#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c 112#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c
113#define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d 113#define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d
114#define SNDRV_GF1_VB_UPPER_ADDRESS 0x10 114#define SNDRV_GF1_VB_UPPER_ADDRESS 0x10
115#define SNDRV_GF1_VW_EFFECT_HIGH 0x11 115#define SNDRV_GF1_VW_EFFECT_HIGH 0x11
116#define SNDRV_GF1_VW_EFFECT_LOW 0x12 116#define SNDRV_GF1_VW_EFFECT_LOW 0x12
117#define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH 117#define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH
118#define SNDRV_GF1_VW_OFFSET_LEFT 0x13 118#define SNDRV_GF1_VW_OFFSET_LEFT 0x13
119#define SNDRV_GF1_VB_ACCUMULATOR 0x14 119#define SNDRV_GF1_VB_ACCUMULATOR 0x14
120#define SNDRV_GF1_VB_MODE 0x15 120#define SNDRV_GF1_VB_MODE 0x15
121#define SNDRV_GF1_VW_EFFECT_VOLUME 0x16 121#define SNDRV_GF1_VW_EFFECT_VOLUME 0x16
122#define SNDRV_GF1_VB_FREQUENCY_LFO 0x17 122#define SNDRV_GF1_VB_FREQUENCY_LFO 0x17
123#define SNDRV_GF1_VB_VOLUME_LFO 0x18 123#define SNDRV_GF1_VB_VOLUME_LFO 0x18
124#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b 124#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b
125#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c 125#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c
126#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d 126#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d
127 127
128/* ICS registers */ 128/* ICS registers */
129 129
130#define SNDRV_ICS_MIC_DEV 0 130#define SNDRV_ICS_MIC_DEV 0
131#define SNDRV_ICS_LINE_DEV 1 131#define SNDRV_ICS_LINE_DEV 1
132#define SNDRV_ICS_CD_DEV 2 132#define SNDRV_ICS_CD_DEV 2
133#define SNDRV_ICS_GF1_DEV 3 133#define SNDRV_ICS_GF1_DEV 3
134#define SNDRV_ICS_NONE_DEV 4 134#define SNDRV_ICS_NONE_DEV 4
135#define SNDRV_ICS_MASTER_DEV 5 135#define SNDRV_ICS_MASTER_DEV 5
136 136
137/* LFO */ 137/* LFO */
138 138
@@ -143,7 +143,7 @@
143 143
144#define SNDRV_GF1_DMA_UNSIGNED 0x80 144#define SNDRV_GF1_DMA_UNSIGNED 0x80
145#define SNDRV_GF1_DMA_16BIT 0x40 145#define SNDRV_GF1_DMA_16BIT 0x40
146#define SNDRV_GF1_DMA_IRQ 0x20 146#define SNDRV_GF1_DMA_IRQ 0x20
147#define SNDRV_GF1_DMA_WIDTH16 0x04 147#define SNDRV_GF1_DMA_WIDTH16 0x04
148#define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */ 148#define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */
149#define SNDRV_GF1_DMA_ENABLE 0x01 149#define SNDRV_GF1_DMA_ENABLE 0x01
@@ -159,7 +159,7 @@
159 159
160/* defines for memory manager */ 160/* defines for memory manager */
161 161
162#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001 162#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001
163 163
164#define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001 164#define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001
165#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002 165#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002
@@ -169,9 +169,9 @@
169/* constants for interrupt handlers */ 169/* constants for interrupt handlers */
170 170
171#define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000 171#define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000
172#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000 172#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000
173#define SNDRV_GF1_HANDLER_TIMER1 0x00040000 173#define SNDRV_GF1_HANDLER_TIMER1 0x00040000
174#define SNDRV_GF1_HANDLER_TIMER2 0x00080000 174#define SNDRV_GF1_HANDLER_TIMER2 0x00080000
175#define SNDRV_GF1_HANDLER_VOICE 0x00100000 175#define SNDRV_GF1_HANDLER_VOICE 0x00100000
176#define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000 176#define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000
177#define SNDRV_GF1_HANDLER_DMA_READ 0x00400000 177#define SNDRV_GF1_HANDLER_DMA_READ 0x00400000
@@ -183,17 +183,16 @@
183 183
184/* --- */ 184/* --- */
185 185
186struct _snd_gus_card; 186struct snd_gus_card;
187typedef struct _snd_gus_card snd_gus_card_t;
188 187
189/* GF1 specific structure */ 188/* GF1 specific structure */
190 189
191typedef struct _snd_gf1_bank_info { 190struct snd_gf1_bank_info {
192 unsigned int address; 191 unsigned int address;
193 unsigned int size; 192 unsigned int size;
194} snd_gf1_bank_info_t; 193};
195 194
196typedef struct _snd_gf1_mem_block { 195struct snd_gf1_mem_block {
197 unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */ 196 unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */
198 unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */ 197 unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */
199 unsigned int share; /* share count */ 198 unsigned int share; /* share count */
@@ -201,68 +200,68 @@ typedef struct _snd_gf1_mem_block {
201 unsigned int ptr; 200 unsigned int ptr;
202 unsigned int size; 201 unsigned int size;
203 char *name; 202 char *name;
204 struct _snd_gf1_mem_block *next; 203 struct snd_gf1_mem_block *next;
205 struct _snd_gf1_mem_block *prev; 204 struct snd_gf1_mem_block *prev;
206} snd_gf1_mem_block_t; 205};
207 206
208typedef struct _snd_gf1_mem { 207struct snd_gf1_mem {
209 snd_gf1_bank_info_t banks_8[4]; 208 struct snd_gf1_bank_info banks_8[4];
210 snd_gf1_bank_info_t banks_16[4]; 209 struct snd_gf1_bank_info banks_16[4];
211 snd_gf1_mem_block_t *first; 210 struct snd_gf1_mem_block *first;
212 snd_gf1_mem_block_t *last; 211 struct snd_gf1_mem_block *last;
213 struct semaphore memory_mutex; 212 struct semaphore memory_mutex;
214} snd_gf1_mem_t; 213};
215 214
216typedef struct snd_gf1_dma_block { 215struct snd_gf1_dma_block {
217 void *buffer; /* buffer in computer's RAM */ 216 void *buffer; /* buffer in computer's RAM */
218 unsigned long buf_addr; /* buffer address */ 217 unsigned long buf_addr; /* buffer address */
219 unsigned int addr; /* address in onboard memory */ 218 unsigned int addr; /* address in onboard memory */
220 unsigned int count; /* count in bytes */ 219 unsigned int count; /* count in bytes */
221 unsigned int cmd; /* DMA command (format) */ 220 unsigned int cmd; /* DMA command (format) */
222 void (*ack)(snd_gus_card_t * gus, void *private_data); 221 void (*ack)(struct snd_gus_card * gus, void *private_data);
223 void *private_data; 222 void *private_data;
224 struct snd_gf1_dma_block *next; 223 struct snd_gf1_dma_block *next;
225} snd_gf1_dma_block_t; 224};
226 225
227typedef struct { 226struct snd_gus_port {
228 snd_midi_channel_set_t * chset; 227 struct snd_midi_channel_set * chset;
229 snd_gus_card_t * gus; 228 struct snd_gus_card * gus;
230 int mode; /* operation mode */ 229 int mode; /* operation mode */
231 int client; /* sequencer client number */ 230 int client; /* sequencer client number */
232 int port; /* sequencer port number */ 231 int port; /* sequencer port number */
233 unsigned int midi_has_voices: 1; 232 unsigned int midi_has_voices: 1;
234} snd_gus_port_t; 233};
235 234
236typedef struct _snd_gus_voice snd_gus_voice_t; 235struct snd_gus_voice;
237 236
238typedef struct { 237struct snd_gus_sample_ops {
239 void (*sample_start)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position); 238 void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position);
240 void (*sample_stop)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_stop_mode_t mode); 239 void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode);
241 void (*sample_freq)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_frequency_t freq); 240 void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq);
242 void (*sample_volume)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_volume_t *volume); 241 void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume);
243 void (*sample_loop)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_ev_loop_t *loop); 242 void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop);
244 void (*sample_pos)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_position_t position); 243 void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position);
245 void (*sample_private1)(snd_gus_card_t *card, snd_gus_voice_t *voice, unsigned char *data); 244 void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data);
246} snd_gus_sample_ops_t; 245};
247 246
248#define SNDRV_GF1_VOICE_TYPE_PCM 0 247#define SNDRV_GF1_VOICE_TYPE_PCM 0
249#define SNDRV_GF1_VOICE_TYPE_SYNTH 1 248#define SNDRV_GF1_VOICE_TYPE_SYNTH 1
250#define SNDRV_GF1_VOICE_TYPE_MIDI 2 249#define SNDRV_GF1_VOICE_TYPE_MIDI 2
251 250
252#define SNDRV_GF1_VFLG_RUNNING (1<<0) 251#define SNDRV_GF1_VFLG_RUNNING (1<<0)
253#define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1) 252#define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1)
254#define SNDRV_GF1_VFLG_PAN (1<<2) 253#define SNDRV_GF1_VFLG_PAN (1<<2)
255 254
256typedef enum { 255enum snd_gus_volume_state {
257 VENV_BEFORE, 256 VENV_BEFORE,
258 VENV_ATTACK, 257 VENV_ATTACK,
259 VENV_SUSTAIN, 258 VENV_SUSTAIN,
260 VENV_RELEASE, 259 VENV_RELEASE,
261 VENV_DONE, 260 VENV_DONE,
262 VENV_VOLUME 261 VENV_VOLUME
263} snd_gus_volume_state_t; 262};
264 263
265struct _snd_gus_voice { 264struct snd_gus_voice {
266 int number; 265 int number;
267 unsigned int use: 1, 266 unsigned int use: 1,
268 pcm: 1, 267 pcm: 1,
@@ -278,18 +277,18 @@ struct _snd_gus_voice {
278 unsigned int interrupt_stat_wave; 277 unsigned int interrupt_stat_wave;
279 unsigned int interrupt_stat_volume; 278 unsigned int interrupt_stat_volume;
280#endif 279#endif
281 void (*handler_wave) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 280 void (*handler_wave) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
282 void (*handler_volume) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 281 void (*handler_volume) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
283 void (*handler_effect) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 282 void (*handler_effect) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
284 void (*volume_change) (snd_gus_card_t * gus); 283 void (*volume_change) (struct snd_gus_card * gus);
285 284
286 snd_gus_sample_ops_t *sample_ops; 285 struct snd_gus_sample_ops *sample_ops;
287 286
288 snd_seq_instr_t instr; 287 struct snd_seq_instr instr;
289 288
290 /* running status / registers */ 289 /* running status / registers */
291 290
292 snd_seq_ev_volume_t sample_volume; 291 struct snd_seq_ev_volume sample_volume;
293 292
294 unsigned short fc_register; 293 unsigned short fc_register;
295 unsigned short fc_lfo; 294 unsigned short fc_lfo;
@@ -300,8 +299,8 @@ struct _snd_gus_voice {
300 unsigned char effect_accumulator; 299 unsigned char effect_accumulator;
301 unsigned char volume_control; 300 unsigned char volume_control;
302 unsigned char venv_value_next; 301 unsigned char venv_value_next;
303 snd_gus_volume_state_t venv_state; 302 enum snd_gus_volume_state venv_state;
304 snd_gus_volume_state_t venv_state_prev; 303 enum snd_gus_volume_state venv_state_prev;
305 unsigned short vlo; 304 unsigned short vlo;
306 unsigned short vro; 305 unsigned short vro;
307 unsigned short gf1_effect_volume; 306 unsigned short gf1_effect_volume;
@@ -309,10 +308,10 @@ struct _snd_gus_voice {
309 /* --- */ 308 /* --- */
310 309
311 void *private_data; 310 void *private_data;
312 void (*private_free)(snd_gus_voice_t *voice); 311 void (*private_free)(struct snd_gus_voice *voice);
313}; 312};
314 313
315struct _snd_gf1 { 314struct snd_gf1 {
316 315
317 unsigned int enh_mode:1, /* enhanced mode (GFA1) */ 316 unsigned int enh_mode:1, /* enhanced mode (GFA1) */
318 hw_lfo:1, /* use hardware LFO */ 317 hw_lfo:1, /* use hardware LFO */
@@ -330,7 +329,7 @@ struct _snd_gf1 {
330 unsigned int rom_present; /* bitmask */ 329 unsigned int rom_present; /* bitmask */
331 unsigned int rom_banks; /* GUS's ROM banks */ 330 unsigned int rom_banks; /* GUS's ROM banks */
332 331
333 snd_gf1_mem_t mem_alloc; 332 struct snd_gf1_mem mem_alloc;
334 333
335 /* registers */ 334 /* registers */
336 unsigned short reg_page; 335 unsigned short reg_page;
@@ -347,7 +346,7 @@ struct _snd_gf1 {
347 unsigned char active_voices; /* active voices */ 346 unsigned char active_voices; /* active voices */
348 unsigned char active_voice; /* selected voice (GF1PAGE register) */ 347 unsigned char active_voice; /* selected voice (GF1PAGE register) */
349 348
350 snd_gus_voice_t voices[32]; /* GF1 voices */ 349 struct snd_gus_voice voices[32]; /* GF1 voices */
351 350
352 unsigned int default_voice_address; 351 unsigned int default_voice_address;
353 352
@@ -362,12 +361,12 @@ struct _snd_gf1 {
362 361
363 /* interrupt handlers */ 362 /* interrupt handlers */
364 363
365 void (*interrupt_handler_midi_out) (snd_gus_card_t * gus); 364 void (*interrupt_handler_midi_out) (struct snd_gus_card * gus);
366 void (*interrupt_handler_midi_in) (snd_gus_card_t * gus); 365 void (*interrupt_handler_midi_in) (struct snd_gus_card * gus);
367 void (*interrupt_handler_timer1) (snd_gus_card_t * gus); 366 void (*interrupt_handler_timer1) (struct snd_gus_card * gus);
368 void (*interrupt_handler_timer2) (snd_gus_card_t * gus); 367 void (*interrupt_handler_timer2) (struct snd_gus_card * gus);
369 void (*interrupt_handler_dma_write) (snd_gus_card_t * gus); 368 void (*interrupt_handler_dma_write) (struct snd_gus_card * gus);
370 void (*interrupt_handler_dma_read) (snd_gus_card_t * gus); 369 void (*interrupt_handler_dma_read) (struct snd_gus_card * gus);
371 370
372#ifdef CONFIG_SND_DEBUG 371#ifdef CONFIG_SND_DEBUG
373 unsigned int interrupt_stat_midi_out; 372 unsigned int interrupt_stat_midi_out;
@@ -382,17 +381,17 @@ struct _snd_gf1 {
382 /* synthesizer */ 381 /* synthesizer */
383 382
384 int seq_client; 383 int seq_client;
385 snd_gus_port_t seq_ports[4]; 384 struct snd_gus_port seq_ports[4];
386 snd_seq_kinstr_list_t *ilist; 385 struct snd_seq_kinstr_list *ilist;
387 snd_iwffff_ops_t iwffff_ops; 386 struct snd_iwffff_ops iwffff_ops;
388 snd_gf1_ops_t gf1_ops; 387 struct snd_gf1_ops gf1_ops;
389 snd_simple_ops_t simple_ops; 388 struct snd_simple_ops simple_ops;
390 389
391 /* timer */ 390 /* timer */
392 391
393 unsigned short timer_enabled; 392 unsigned short timer_enabled;
394 snd_timer_t *timer1; 393 struct snd_timer *timer1;
395 snd_timer_t *timer2; 394 struct snd_timer *timer2;
396 395
397 /* midi */ 396 /* midi */
398 397
@@ -404,11 +403,11 @@ struct _snd_gf1 {
404 403
405 unsigned int dma_flags; 404 unsigned int dma_flags;
406 unsigned int dma_shared; 405 unsigned int dma_shared;
407 snd_gf1_dma_block_t *dma_data_pcm; 406 struct snd_gf1_dma_block *dma_data_pcm;
408 snd_gf1_dma_block_t *dma_data_pcm_last; 407 struct snd_gf1_dma_block *dma_data_pcm_last;
409 snd_gf1_dma_block_t *dma_data_synth; 408 struct snd_gf1_dma_block *dma_data_synth;
410 snd_gf1_dma_block_t *dma_data_synth_last; 409 struct snd_gf1_dma_block *dma_data_synth_last;
411 void (*dma_ack)(snd_gus_card_t * gus, void *private_data); 410 void (*dma_ack)(struct snd_gus_card * gus, void *private_data);
412 void *dma_private_data; 411 void *dma_private_data;
413 412
414 /* pcm */ 413 /* pcm */
@@ -425,8 +424,8 @@ struct _snd_gf1 {
425 424
426/* main structure for GUS card */ 425/* main structure for GUS card */
427 426
428struct _snd_gus_card { 427struct snd_gus_card {
429 snd_card_t *card; 428 struct snd_card *card;
430 429
431 unsigned int 430 unsigned int
432 initialized: 1, /* resources were initialized */ 431 initialized: 1, /* resources were initialized */
@@ -448,18 +447,18 @@ struct _snd_gus_card {
448 unsigned short joystick_dac; /* joystick DAC level */ 447 unsigned short joystick_dac; /* joystick DAC level */
449 int timer_dev; /* timer device */ 448 int timer_dev; /* timer device */
450 449
451 struct _snd_gf1 gf1; /* gf1 specific variables */ 450 struct snd_gf1 gf1; /* gf1 specific variables */
452 snd_pcm_t *pcm; 451 struct snd_pcm *pcm;
453 snd_pcm_substream_t *pcm_cap_substream; 452 struct snd_pcm_substream *pcm_cap_substream;
454 unsigned int c_dma_size; 453 unsigned int c_dma_size;
455 unsigned int c_period_size; 454 unsigned int c_period_size;
456 unsigned int c_pos; 455 unsigned int c_pos;
457 456
458 snd_rawmidi_t *midi_uart; 457 struct snd_rawmidi *midi_uart;
459 snd_rawmidi_substream_t *midi_substream_output; 458 struct snd_rawmidi_substream *midi_substream_output;
460 snd_rawmidi_substream_t *midi_substream_input; 459 struct snd_rawmidi_substream *midi_substream_input;
461 460
462 snd_seq_device_t *seq_dev; 461 struct snd_seq_device *seq_dev;
463 462
464 spinlock_t reg_lock; 463 spinlock_t reg_lock;
465 spinlock_t voice_alloc; 464 spinlock_t voice_alloc;
@@ -474,7 +473,7 @@ struct _snd_gus_card {
474 473
475/* I/O functions for GF1/InterWave chip - gus_io.c */ 474/* I/O functions for GF1/InterWave chip - gus_io.c */
476 475
477static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice) 476static inline void snd_gf1_select_voice(struct snd_gus_card * gus, int voice)
478{ 477{
479 unsigned long flags; 478 unsigned long flags;
480 479
@@ -486,63 +485,63 @@ static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice)
486 spin_unlock_irqrestore(&gus->active_voice_lock, flags); 485 spin_unlock_irqrestore(&gus->active_voice_lock, flags);
487} 486}
488 487
489static inline void snd_gf1_uart_cmd(snd_gus_card_t * gus, unsigned char b) 488static inline void snd_gf1_uart_cmd(struct snd_gus_card * gus, unsigned char b)
490{ 489{
491 outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL)); 490 outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL));
492} 491}
493 492
494static inline unsigned char snd_gf1_uart_stat(snd_gus_card_t * gus) 493static inline unsigned char snd_gf1_uart_stat(struct snd_gus_card * gus)
495{ 494{
496 return inb(GUSP(gus, MIDISTAT)); 495 return inb(GUSP(gus, MIDISTAT));
497} 496}
498 497
499static inline void snd_gf1_uart_put(snd_gus_card_t * gus, unsigned char b) 498static inline void snd_gf1_uart_put(struct snd_gus_card * gus, unsigned char b)
500{ 499{
501 outb(b, GUSP(gus, MIDIDATA)); 500 outb(b, GUSP(gus, MIDIDATA));
502} 501}
503 502
504static inline unsigned char snd_gf1_uart_get(snd_gus_card_t * gus) 503static inline unsigned char snd_gf1_uart_get(struct snd_gus_card * gus)
505{ 504{
506 return inb(GUSP(gus, MIDIDATA)); 505 return inb(GUSP(gus, MIDIDATA));
507} 506}
508 507
509extern void snd_gf1_delay(snd_gus_card_t * gus); 508extern void snd_gf1_delay(struct snd_gus_card * gus);
510 509
511extern void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); 510extern void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
512 511
513extern void snd_gf1_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 512extern void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
514extern unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg); 513extern unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg);
515static inline unsigned char snd_gf1_read8(snd_gus_card_t * gus, unsigned char reg) 514static inline unsigned char snd_gf1_read8(struct snd_gus_card * gus, unsigned char reg)
516{ 515{
517 return snd_gf1_look8(gus, reg | 0x80); 516 return snd_gf1_look8(gus, reg | 0x80);
518} 517}
519extern void snd_gf1_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 518extern void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
520extern unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg); 519extern unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg);
521static inline unsigned short snd_gf1_read16(snd_gus_card_t * gus, unsigned char reg) 520static inline unsigned short snd_gf1_read16(struct snd_gus_card * gus, unsigned char reg)
522{ 521{
523 return snd_gf1_look16(gus, reg | 0x80); 522 return snd_gf1_look16(gus, reg | 0x80);
524} 523}
525extern void snd_gf1_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 524extern void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
526extern void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr); 525extern void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr);
527extern void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data); 526extern void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data);
528extern unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr); 527extern unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr);
529extern void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit); 528extern void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit);
530extern unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit); 529extern unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit);
531extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); 530extern void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
532extern void snd_gf1_i_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 531extern void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
533extern unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg); 532extern unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg);
534extern void snd_gf1_i_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 533extern void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
535static inline unsigned char snd_gf1_i_read8(snd_gus_card_t * gus, unsigned char reg) 534static inline unsigned char snd_gf1_i_read8(struct snd_gus_card * gus, unsigned char reg)
536{ 535{
537 return snd_gf1_i_look8(gus, reg | 0x80); 536 return snd_gf1_i_look8(gus, reg | 0x80);
538} 537}
539extern unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg); 538extern unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg);
540static inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned char reg) 539static inline unsigned short snd_gf1_i_read16(struct snd_gus_card * gus, unsigned char reg)
541{ 540{
542 return snd_gf1_i_look16(gus, reg | 0x80); 541 return snd_gf1_i_look16(gus, reg | 0x80);
543} 542}
544 543
545extern void snd_gf1_select_active_voices(snd_gus_card_t * gus); 544extern void snd_gf1_select_active_voices(struct snd_gus_card * gus);
546 545
547/* gus_lfo.c */ 546/* gus_lfo.c */
548 547
@@ -555,98 +554,98 @@ struct _SND_IW_LFO_PROGRAM {
555}; 554};
556 555
557#if 0 556#if 0
558extern irqreturn_t snd_gf1_lfo_effect_interrupt(snd_gus_card_t * gus, snd_gf1_voice_t * voice); 557extern irqreturn_t snd_gf1_lfo_effect_interrupt(struct snd_gus_card * gus, snd_gf1_voice_t * voice);
559#endif 558#endif
560extern void snd_gf1_lfo_init(snd_gus_card_t * gus); 559extern void snd_gf1_lfo_init(struct snd_gus_card * gus);
561extern void snd_gf1_lfo_done(snd_gus_card_t * gus); 560extern void snd_gf1_lfo_done(struct snd_gus_card * gus);
562extern void snd_gf1_lfo_program(snd_gus_card_t * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program); 561extern void snd_gf1_lfo_program(struct snd_gus_card * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program);
563extern void snd_gf1_lfo_enable(snd_gus_card_t * gus, int voice, int lfo_type); 562extern void snd_gf1_lfo_enable(struct snd_gus_card * gus, int voice, int lfo_type);
564extern void snd_gf1_lfo_disable(snd_gus_card_t * gus, int voice, int lfo_type); 563extern void snd_gf1_lfo_disable(struct snd_gus_card * gus, int voice, int lfo_type);
565extern void snd_gf1_lfo_change_freq(snd_gus_card_t * gus, int voice, int lfo_type, int freq); 564extern void snd_gf1_lfo_change_freq(struct snd_gus_card * gus, int voice, int lfo_type, int freq);
566extern void snd_gf1_lfo_change_depth(snd_gus_card_t * gus, int voice, int lfo_type, int depth); 565extern void snd_gf1_lfo_change_depth(struct snd_gus_card * gus, int voice, int lfo_type, int depth);
567extern void snd_gf1_lfo_setup(snd_gus_card_t * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape); 566extern void snd_gf1_lfo_setup(struct snd_gus_card * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape);
568extern void snd_gf1_lfo_shutdown(snd_gus_card_t * gus, int voice, int lfo_type); 567extern void snd_gf1_lfo_shutdown(struct snd_gus_card * gus, int voice, int lfo_type);
569#if 0 568#if 0
570extern void snd_gf1_lfo_command(snd_gus_card_t * gus, int voice, unsigned char *command); 569extern void snd_gf1_lfo_command(struct snd_gus_card * gus, int voice, unsigned char *command);
571#endif 570#endif
572 571
573/* gus_mem.c */ 572/* gus_mem.c */
574 573
575void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup); 574void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup);
576int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block); 575int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block);
577snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, 576struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner,
578 char *name, int size, int w_16, 577 char *name, int size, int w_16,
579 int align, unsigned int *share_id); 578 int align, unsigned int *share_id);
580int snd_gf1_mem_free(snd_gf1_mem_t * alloc, unsigned int address); 579int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address);
581int snd_gf1_mem_free_owner(snd_gf1_mem_t * alloc, int owner); 580int snd_gf1_mem_free_owner(struct snd_gf1_mem * alloc, int owner);
582int snd_gf1_mem_init(snd_gus_card_t * gus); 581int snd_gf1_mem_init(struct snd_gus_card * gus);
583int snd_gf1_mem_done(snd_gus_card_t * gus); 582int snd_gf1_mem_done(struct snd_gus_card * gus);
584 583
585/* gus_mem_proc.c */ 584/* gus_mem_proc.c */
586 585
587int snd_gf1_mem_proc_init(snd_gus_card_t * gus); 586int snd_gf1_mem_proc_init(struct snd_gus_card * gus);
588 587
589/* gus_dma.c */ 588/* gus_dma.c */
590 589
591int snd_gf1_dma_init(snd_gus_card_t * gus); 590int snd_gf1_dma_init(struct snd_gus_card * gus);
592int snd_gf1_dma_done(snd_gus_card_t * gus); 591int snd_gf1_dma_done(struct snd_gus_card * gus);
593int snd_gf1_dma_transfer_block(snd_gus_card_t * gus, 592int snd_gf1_dma_transfer_block(struct snd_gus_card * gus,
594 snd_gf1_dma_block_t * block, 593 struct snd_gf1_dma_block * block,
595 int atomic, 594 int atomic,
596 int synth); 595 int synth);
597 596
598/* gus_volume.c */ 597/* gus_volume.c */
599 598
600unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol); 599unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);
601unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq2); 600unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq2);
602 601
603/* gus_reset.c */ 602/* gus_reset.c */
604 603
605void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what); 604void snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what);
606void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice); 605void snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice);
607void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice); 606void snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice);
608void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max); 607void snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max);
609snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port); 608struct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port);
610void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice); 609void snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice);
611int snd_gf1_start(snd_gus_card_t * gus); 610int snd_gf1_start(struct snd_gus_card * gus);
612int snd_gf1_stop(snd_gus_card_t * gus); 611int snd_gf1_stop(struct snd_gus_card * gus);
613 612
614/* gus_mixer.c */ 613/* gus_mixer.c */
615 614
616int snd_gf1_new_mixer(snd_gus_card_t * gus); 615int snd_gf1_new_mixer(struct snd_gus_card * gus);
617 616
618/* gus_pcm.c */ 617/* gus_pcm.c */
619 618
620int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pcm_t ** rpcm); 619int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm);
621 620
622#ifdef CONFIG_SND_DEBUG 621#ifdef CONFIG_SND_DEBUG
623extern void snd_gf1_print_voice_registers(snd_gus_card_t * gus); 622extern void snd_gf1_print_voice_registers(struct snd_gus_card * gus);
624#endif 623#endif
625 624
626/* gus.c */ 625/* gus.c */
627 626
628int snd_gus_use_inc(snd_gus_card_t * gus); 627int snd_gus_use_inc(struct snd_gus_card * gus);
629void snd_gus_use_dec(snd_gus_card_t * gus); 628void snd_gus_use_dec(struct snd_gus_card * gus);
630int snd_gus_create(snd_card_t * card, 629int snd_gus_create(struct snd_card *card,
631 unsigned long port, 630 unsigned long port,
632 int irq, int dma1, int dma2, 631 int irq, int dma1, int dma2,
633 int timer_dev, 632 int timer_dev,
634 int voices, 633 int voices,
635 int pcm_channels, 634 int pcm_channels,
636 int effect, 635 int effect,
637 snd_gus_card_t ** rgus); 636 struct snd_gus_card ** rgus);
638int snd_gus_initialize(snd_gus_card_t * gus); 637int snd_gus_initialize(struct snd_gus_card * gus);
639 638
640/* gus_irq.c */ 639/* gus_irq.c */
641 640
642irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs); 641irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs);
643#ifdef CONFIG_SND_DEBUG 642#ifdef CONFIG_SND_DEBUG
644void snd_gus_irq_profile_init(snd_gus_card_t *gus); 643void snd_gus_irq_profile_init(struct snd_gus_card *gus);
645#endif 644#endif
646 645
647/* gus_uart.c */ 646/* gus_uart.c */
648 647
649int snd_gf1_rawmidi_new(snd_gus_card_t * gus, int device, snd_rawmidi_t **rrawmidi); 648int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);
650 649
651#if 0 650#if 0
652extern void snd_engine_instrument_register(unsigned short mode, 651extern void snd_engine_instrument_register(unsigned short mode,
@@ -657,37 +656,37 @@ extern int snd_engine_instrument_register_ask(unsigned short mode);
657#endif 656#endif
658 657
659/* gus_dram.c */ 658/* gus_dram.c */
660int snd_gus_dram_write(snd_gus_card_t *gus, char __user *ptr, 659int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
661 unsigned int addr, unsigned int size); 660 unsigned int addr, unsigned int size);
662int snd_gus_dram_read(snd_gus_card_t *gus, char __user *ptr, 661int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr,
663 unsigned int addr, unsigned int size, int rom); 662 unsigned int addr, unsigned int size, int rom);
664 663
665#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 664#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
666 665
667/* gus_sample.c */ 666/* gus_sample.c */
668void snd_gus_sample_event(snd_seq_event_t *ev, snd_gus_port_t *p); 667void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p);
669 668
670/* gus_simple.c */ 669/* gus_simple.c */
671void snd_gf1_simple_init(snd_gus_voice_t *voice); 670void snd_gf1_simple_init(struct snd_gus_voice *voice);
672 671
673/* gus_instr.c */ 672/* gus_instr.c */
674int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, 673int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave,
675 char __user *data, long len, int atomic); 674 char __user *data, long len, int atomic);
676int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, 675int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave,
677 char __user *data, long len, int atomic); 676 char __user *data, long len, int atomic);
678int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, 677int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave,
679 int atomic); 678 int atomic);
680int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, 679int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave,
681 char __user *data, long len, int atomic); 680 char __user *data, long len, int atomic);
682int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, 681int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave,
683 char __user *data, long len, int atomic); 682 char __user *data, long len, int atomic);
684int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, 683int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave,
685 int atomic); 684 int atomic);
686int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, 685int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr,
687 char __user *data, long len, int atomic); 686 char __user *data, long len, int atomic);
688int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, 687int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr,
689 char __user *data, long len, int atomic); 688 char __user *data, long len, int atomic);
690int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr, 689int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr,
691 int atomic); 690 int atomic);
692 691
693#endif /* CONFIG_SND_SEQUENCER */ 692#endif /* CONFIG_SND_SEQUENCER */
diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h
index 7ce3aa67e5d6..25e1951a9955 100644
--- a/include/sound/hdsp.h
+++ b/include/sound/hdsp.h
@@ -21,17 +21,15 @@
21 21
22#define HDSP_MATRIX_MIXER_SIZE 2048 22#define HDSP_MATRIX_MIXER_SIZE 2048
23 23
24typedef enum { 24enum HDSP_IO_Type {
25 Digiface, 25 Digiface,
26 Multiface, 26 Multiface,
27 H9652, 27 H9652,
28 H9632, 28 H9632,
29 Undefined, 29 Undefined,
30} HDSP_IO_Type; 30};
31
32typedef struct _snd_hdsp_peak_rms hdsp_peak_rms_t;
33 31
34struct _snd_hdsp_peak_rms { 32struct hdsp_peak_rms {
35 u32 input_peaks[26]; 33 u32 input_peaks[26];
36 u32 playback_peaks[26]; 34 u32 playback_peaks[26];
37 u32 output_peaks[28]; 35 u32 output_peaks[28];
@@ -41,11 +39,9 @@ struct _snd_hdsp_peak_rms {
41 u64 output_rms[26]; 39 u64 output_rms[26];
42}; 40};
43 41
44#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, hdsp_peak_rms_t) 42#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms)
45 43
46typedef struct _snd_hdsp_config_info hdsp_config_info_t; 44struct hdsp_config_info {
47
48struct _snd_hdsp_config_info {
49 unsigned char pref_sync_ref; 45 unsigned char pref_sync_ref;
50 unsigned char wordclock_sync_check; 46 unsigned char wordclock_sync_check;
51 unsigned char spdif_sync_check; 47 unsigned char spdif_sync_check;
@@ -71,40 +67,41 @@ struct _snd_hdsp_config_info {
71 unsigned char analog_extension_board; 67 unsigned char analog_extension_board;
72}; 68};
73 69
74#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdsp_config_info_t) 70#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
75
76typedef struct _snd_hdsp_firmware hdsp_firmware_t;
77 71
78struct _snd_hdsp_firmware { 72struct hdsp_firmware {
79 void __user *firmware_data; /* 24413 x 4 bytes */ 73 void __user *firmware_data; /* 24413 x 4 bytes */
80}; 74};
81 75
82#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t) 76#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
83 77
84typedef struct _snd_hdsp_version hdsp_version_t; 78struct hdsp_version {
85 79 enum HDSP_IO_Type io_type;
86struct _snd_hdsp_version {
87 HDSP_IO_Type io_type;
88 unsigned short firmware_rev; 80 unsigned short firmware_rev;
89}; 81};
90 82
91#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, hdsp_version_t) 83#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version)
92
93typedef struct _snd_hdsp_mixer hdsp_mixer_t;
94 84
95struct _snd_hdsp_mixer { 85struct hdsp_mixer {
96 unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; 86 unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
97}; 87};
98 88
99#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, hdsp_mixer_t) 89#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer)
100 90
101typedef struct _snd_hdsp_9632_aeb hdsp_9632_aeb_t; 91struct hdsp_9632_aeb {
102
103struct _snd_hdsp_9632_aeb {
104 int aebi; 92 int aebi;
105 int aebo; 93 int aebo;
106}; 94};
107 95
108#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, hdsp_9632_aeb_t) 96#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
97
98/* typedefs for compatibility to user-space */
99typedef enum HDSP_IO_Type HDSP_IO_Type;
100typedef struct hdsp_peak_rms hdsp_peak_rms_t;
101typedef struct hdsp_config_info hdsp_config_info_t;
102typedef struct hdsp_firmware hdsp_firmware_t;
103typedef struct hdsp_version hdsp_version_t;
104typedef struct hdsp_mixer hdsp_mixer_t;
105typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
109 106
110#endif /* __SOUND_HDSP_H */ 107#endif /* __SOUND_HDSP_H */
diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h
index c34427ccd0b3..c3c854d99c28 100644
--- a/include/sound/hdspm.h
+++ b/include/sound/hdspm.h
@@ -25,8 +25,6 @@
25 25
26/* -------------------- IOCTL Peak/RMS Meters -------------------- */ 26/* -------------------- IOCTL Peak/RMS Meters -------------------- */
27 27
28typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t;
29
30/* peam rms level structure like we get from hardware 28/* peam rms level structure like we get from hardware
31 29
32 maybe in future we can memory map it so I just copy it 30 maybe in future we can memory map it so I just copy it
@@ -36,7 +34,7 @@ typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t;
36 (i asume so from the code) 34 (i asume so from the code)
37*/ 35*/
38 36
39struct _snd_hdspm_peak_rms { 37struct hdspm_peak_rms {
40 38
41 unsigned int level_offset[1024]; 39 unsigned int level_offset[1024];
42 40
@@ -58,18 +56,16 @@ struct _snd_hdspm_peak_rms {
58 unsigned int xxx_rms_h[64]; /* not used */ 56 unsigned int xxx_rms_h[64]; /* not used */
59}; 57};
60 58
61struct sndrv_hdspm_peak_rms_ioctl { 59struct hdspm_peak_rms_ioctl {
62 hdspm_peak_rms_t *peak; 60 struct hdspm_peak_rms *peak;
63}; 61};
64 62
65/* use indirect access due to the limit of ioctl bit size */ 63/* use indirect access due to the limit of ioctl bit size */
66#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct sndrv_hdspm_peak_rms_ioctl) 64#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdspm_peak_rms_ioctl)
67 65
68/* ------------ CONFIG block IOCTL ---------------------- */ 66/* ------------ CONFIG block IOCTL ---------------------- */
69 67
70typedef struct _snd_hdspm_config_info hdspm_config_info_t; 68struct hdspm_config_info {
71
72struct _snd_hdspm_config_info {
73 unsigned char pref_sync_ref; 69 unsigned char pref_sync_ref;
74 unsigned char wordclock_sync_check; 70 unsigned char wordclock_sync_check;
75 unsigned char madi_sync_check; 71 unsigned char madi_sync_check;
@@ -83,18 +79,16 @@ struct _snd_hdspm_config_info {
83 unsigned int analog_out; 79 unsigned int analog_out;
84}; 80};
85 81
86#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdspm_config_info_t) 82#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdspm_config_info)
87 83
88 84
89/* get Soundcard Version */ 85/* get Soundcard Version */
90 86
91typedef struct _snd_hdspm_version hdspm_version_t; 87struct hdspm_version {
92
93struct _snd_hdspm_version {
94 unsigned short firmware_rev; 88 unsigned short firmware_rev;
95}; 89};
96 90
97#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, hdspm_version_t) 91#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version)
98 92
99 93
100/* ------------- get Matrix Mixer IOCTL --------------- */ 94/* ------------- get Matrix Mixer IOCTL --------------- */
@@ -108,24 +102,27 @@ struct _snd_hdspm_version {
108 102
109#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS 103#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
110 104
111typedef struct _snd_hdspm_channelfader snd_hdspm_channelfader_t; 105struct hdspm_channelfader {
112
113struct _snd_hdspm_channelfader {
114 unsigned int in[HDSPM_MIXER_CHANNELS]; 106 unsigned int in[HDSPM_MIXER_CHANNELS];
115 unsigned int pb[HDSPM_MIXER_CHANNELS]; 107 unsigned int pb[HDSPM_MIXER_CHANNELS];
116}; 108};
117 109
118typedef struct _snd_hdspm_mixer hdspm_mixer_t; 110struct hdspm_mixer {
119 111 struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
120struct _snd_hdspm_mixer {
121 snd_hdspm_channelfader_t ch[HDSPM_MIXER_CHANNELS];
122}; 112};
123 113
124struct sndrv_hdspm_mixer_ioctl { 114struct hdspm_mixer_ioctl {
125 hdspm_mixer_t *mixer; 115 struct hdspm_mixer *mixer;
126}; 116};
127 117
128/* use indirect access due to the limit of ioctl bit size */ 118/* use indirect access due to the limit of ioctl bit size */
129#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct sndrv_hdspm_mixer_ioctl) 119#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
120
121/* typedefs for compatibility to user-space */
122typedef struct hdspm_peak_rms hdspm_peak_rms_t;
123typedef struct hdspm_config_info hdspm_config_info_t;
124typedef struct hdspm_version hdspm_version_t;
125typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
126typedef struct hdspm_mixer hdspm_mixer_t;
130 127
131#endif /* __SOUND_HDSPM_H */ 128#endif /* __SOUND_HDSPM_H */
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index 043876348fa1..c679e5b31111 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -25,27 +25,25 @@
25#include <sound/asound.h> 25#include <sound/asound.h>
26#include <linux/poll.h> 26#include <linux/poll.h>
27 27
28typedef enum sndrv_hwdep_iface snd_hwdep_iface_t; 28struct snd_hwdep;
29typedef struct sndrv_hwdep_info snd_hwdep_info_t;
30typedef struct sndrv_hwdep_dsp_status snd_hwdep_dsp_status_t;
31typedef struct sndrv_hwdep_dsp_image snd_hwdep_dsp_image_t;
32 29
33typedef struct _snd_hwdep_ops { 30struct snd_hwdep_ops {
34 long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig); 31 long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig);
35 long (*read) (snd_hwdep_t * hw, char __user *buf, long count, loff_t *offset); 32 long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset);
36 long (*write) (snd_hwdep_t * hw, const char __user *buf, long count, loff_t *offset); 33 long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset);
37 int (*open) (snd_hwdep_t * hw, struct file * file); 34 int (*open) (struct snd_hwdep * hw, struct file * file);
38 int (*release) (snd_hwdep_t * hw, struct file * file); 35 int (*release) (struct snd_hwdep *hw, struct file * file);
39 unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait); 36 unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait);
40 int (*ioctl) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); 37 int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
41 int (*ioctl_compat) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); 38 int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
42 int (*mmap) (snd_hwdep_t * hw, struct file * file, struct vm_area_struct * vma); 39 int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma);
43 int (*dsp_status) (snd_hwdep_t * hw, snd_hwdep_dsp_status_t * status); 40 int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status);
44 int (*dsp_load) (snd_hwdep_t * hw, snd_hwdep_dsp_image_t * image); 41 int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image);
45} snd_hwdep_ops_t; 42};
46 43
47struct _snd_hwdep { 44struct snd_hwdep {
48 snd_card_t *card; 45 struct snd_card *card;
46 struct list_head list;
49 int device; 47 int device;
50 char id[32]; 48 char id[32];
51 char name[80]; 49 char name[80];
@@ -57,10 +55,10 @@ struct _snd_hwdep {
57 int ossreg; 55 int ossreg;
58#endif 56#endif
59 57
60 snd_hwdep_ops_t ops; 58 struct snd_hwdep_ops ops;
61 wait_queue_head_t open_wait; 59 wait_queue_head_t open_wait;
62 void *private_data; 60 void *private_data;
63 void (*private_free) (snd_hwdep_t *hwdep); 61 void (*private_free) (struct snd_hwdep *hwdep);
64 62
65 struct semaphore open_mutex; 63 struct semaphore open_mutex;
66 int used; 64 int used;
@@ -68,6 +66,7 @@ struct _snd_hwdep {
68 unsigned int exclusive: 1; 66 unsigned int exclusive: 1;
69}; 67};
70 68
71extern int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep); 69extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
70 struct snd_hwdep **rhwdep);
72 71
73#endif /* __SOUND_HWDEP_H */ 72#endif /* __SOUND_HWDEP_H */
diff --git a/include/sound/i2c.h b/include/sound/i2c.h
index a665ddf9c146..81eb23ed761f 100644
--- a/include/sound/i2c.h
+++ b/include/sound/i2c.h
@@ -21,82 +21,84 @@
21 * 21 *
22 */ 22 */
23 23
24typedef struct _snd_i2c_device snd_i2c_device_t;
25typedef struct _snd_i2c_bus snd_i2c_bus_t;
26
27#define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */ 24#define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */
28 25
29struct _snd_i2c_device { 26struct snd_i2c_device {
30 struct list_head list; 27 struct list_head list;
31 snd_i2c_bus_t *bus; /* I2C bus */ 28 struct snd_i2c_bus *bus; /* I2C bus */
32 char name[32]; /* some useful device name */ 29 char name[32]; /* some useful device name */
33 unsigned short flags; /* device flags */ 30 unsigned short flags; /* device flags */
34 unsigned short addr; /* device address (might be 10-bit) */ 31 unsigned short addr; /* device address (might be 10-bit) */
35 unsigned long private_value; 32 unsigned long private_value;
36 void *private_data; 33 void *private_data;
37 void (*private_free)(snd_i2c_device_t *device); 34 void (*private_free)(struct snd_i2c_device *device);
35};
36
37#define snd_i2c_device(n) list_entry(n, struct snd_i2c_device, list)
38
39struct snd_i2c_bit_ops {
40 void (*start)(struct snd_i2c_bus *bus); /* transfer start */
41 void (*stop)(struct snd_i2c_bus *bus); /* transfer stop */
42 void (*direction)(struct snd_i2c_bus *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */
43 void (*setlines)(struct snd_i2c_bus *bus, int clock, int data);
44 int (*getclock)(struct snd_i2c_bus *bus);
45 int (*getdata)(struct snd_i2c_bus *bus, int ack);
38}; 46};
39 47
40#define snd_i2c_device(n) list_entry(n, snd_i2c_device_t, list) 48struct snd_i2c_ops {
41 49 int (*sendbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
42typedef struct _snd_i2c_bit_ops { 50 int (*readbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
43 void (*start)(snd_i2c_bus_t *bus); /* transfer start */ 51 int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr);
44 void (*stop)(snd_i2c_bus_t *bus); /* transfer stop */ 52};
45 void (*direction)(snd_i2c_bus_t *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ 53
46 void (*setlines)(snd_i2c_bus_t *bus, int clock, int data); 54struct snd_i2c_bus {
47 int (*getclock)(snd_i2c_bus_t *bus); 55 struct snd_card *card; /* card which I2C belongs to */
48 int (*getdata)(snd_i2c_bus_t *bus, int ack);
49} snd_i2c_bit_ops_t;
50
51typedef struct _snd_i2c_ops {
52 int (*sendbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
53 int (*readbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
54 int (*probeaddr)(snd_i2c_bus_t *bus, unsigned short addr);
55} snd_i2c_ops_t;
56
57struct _snd_i2c_bus {
58 snd_card_t *card; /* card which I2C belongs to */
59 char name[32]; /* some useful label */ 56 char name[32]; /* some useful label */
60 57
61 struct semaphore lock_mutex; 58 struct semaphore lock_mutex;
62 59
63 snd_i2c_bus_t *master; /* master bus when SCK/SCL is shared */ 60 struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */
64 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ 61 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
65 62
66 struct list_head devices; /* attached devices to this bus */ 63 struct list_head devices; /* attached devices to this bus */
67 64
68 union { 65 union {
69 snd_i2c_bit_ops_t *bit; 66 struct snd_i2c_bit_ops *bit;
70 void *ops; 67 void *ops;
71 } hw_ops; /* lowlevel operations */ 68 } hw_ops; /* lowlevel operations */
72 snd_i2c_ops_t *ops; /* midlevel operations */ 69 struct snd_i2c_ops *ops; /* midlevel operations */
73 70
74 unsigned long private_value; 71 unsigned long private_value;
75 void *private_data; 72 void *private_data;
76 void (*private_free)(snd_i2c_bus_t *bus); 73 void (*private_free)(struct snd_i2c_bus *bus);
77}; 74};
78 75
79#define snd_i2c_slave_bus(n) list_entry(n, snd_i2c_bus_t, buses) 76#define snd_i2c_slave_bus(n) list_entry(n, struct snd_i2c_bus, buses)
80 77
81int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c); 78int snd_i2c_bus_create(struct snd_card *card, const char *name,
82int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice); 79 struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c);
83int snd_i2c_device_free(snd_i2c_device_t *device); 80int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
81 unsigned char addr, struct snd_i2c_device **rdevice);
82int snd_i2c_device_free(struct snd_i2c_device *device);
84 83
85static inline void snd_i2c_lock(snd_i2c_bus_t *bus) { 84static inline void snd_i2c_lock(struct snd_i2c_bus *bus)
85{
86 if (bus->master) 86 if (bus->master)
87 down(&bus->master->lock_mutex); 87 down(&bus->master->lock_mutex);
88 else 88 else
89 down(&bus->lock_mutex); 89 down(&bus->lock_mutex);
90} 90}
91static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) { 91
92static inline void snd_i2c_unlock(struct snd_i2c_bus *bus)
93{
92 if (bus->master) 94 if (bus->master)
93 up(&bus->master->lock_mutex); 95 up(&bus->master->lock_mutex);
94 else 96 else
95 up(&bus->lock_mutex); 97 up(&bus->lock_mutex);
96} 98}
97 99
98int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 100int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
99int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 101int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
100int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); 102int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr);
101 103
102#endif /* __SOUND_I2C_H */ 104#endif /* __SOUND_I2C_H */
diff --git a/include/sound/info.h b/include/sound/info.h
index 1d76bf3cb05e..8ea5c7497c03 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -34,8 +34,6 @@ struct snd_info_buffer {
34 int error; /* error code */ 34 int error; /* error code */
35}; 35};
36 36
37typedef struct snd_info_buffer snd_info_buffer_t;
38
39#define SNDRV_INFO_CONTENT_TEXT 0 37#define SNDRV_INFO_CONTENT_TEXT 0
40#define SNDRV_INFO_CONTENT_DATA 1 38#define SNDRV_INFO_CONTENT_DATA 1
41 39
@@ -44,28 +42,28 @@ struct snd_info_entry;
44struct snd_info_entry_text { 42struct snd_info_entry_text {
45 unsigned long read_size; 43 unsigned long read_size;
46 unsigned long write_size; 44 unsigned long write_size;
47 void (*read) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); 45 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
48 void (*write) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); 46 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
49}; 47};
50 48
51struct snd_info_entry_ops { 49struct snd_info_entry_ops {
52 int (*open) (snd_info_entry_t *entry, 50 int (*open) (struct snd_info_entry *entry,
53 unsigned short mode, void **file_private_data); 51 unsigned short mode, void **file_private_data);
54 int (*release) (snd_info_entry_t * entry, 52 int (*release) (struct snd_info_entry * entry,
55 unsigned short mode, void *file_private_data); 53 unsigned short mode, void *file_private_data);
56 long (*read) (snd_info_entry_t *entry, void *file_private_data, 54 long (*read) (struct snd_info_entry *entry, void *file_private_data,
57 struct file * file, char __user *buf, 55 struct file * file, char __user *buf,
58 unsigned long count, unsigned long pos); 56 unsigned long count, unsigned long pos);
59 long (*write) (snd_info_entry_t *entry, void *file_private_data, 57 long (*write) (struct snd_info_entry *entry, void *file_private_data,
60 struct file * file, const char __user *buf, 58 struct file * file, const char __user *buf,
61 unsigned long count, unsigned long pos); 59 unsigned long count, unsigned long pos);
62 long long (*llseek) (snd_info_entry_t *entry, void *file_private_data, 60 long long (*llseek) (struct snd_info_entry *entry, void *file_private_data,
63 struct file * file, long long offset, int orig); 61 struct file * file, long long offset, int orig);
64 unsigned int (*poll) (snd_info_entry_t *entry, void *file_private_data, 62 unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data,
65 struct file * file, poll_table * wait); 63 struct file * file, poll_table * wait);
66 int (*ioctl) (snd_info_entry_t *entry, void *file_private_data, 64 int (*ioctl) (struct snd_info_entry *entry, void *file_private_data,
67 struct file * file, unsigned int cmd, unsigned long arg); 65 struct file * file, unsigned int cmd, unsigned long arg);
68 int (*mmap) (snd_info_entry_t *entry, void *file_private_data, 66 int (*mmap) (struct snd_info_entry *entry, void *file_private_data,
69 struct inode * inode, struct file * file, 67 struct inode * inode, struct file * file,
70 struct vm_area_struct * vma); 68 struct vm_area_struct * vma);
71}; 69};
@@ -80,20 +78,18 @@ struct snd_info_entry {
80 struct snd_info_entry_text text; 78 struct snd_info_entry_text text;
81 struct snd_info_entry_ops *ops; 79 struct snd_info_entry_ops *ops;
82 } c; 80 } c;
83 snd_info_entry_t *parent; 81 struct snd_info_entry *parent;
84 snd_card_t *card; 82 struct snd_card *card;
85 struct module *module; 83 struct module *module;
86 void *private_data; 84 void *private_data;
87 void (*private_free)(snd_info_entry_t *entry); 85 void (*private_free)(struct snd_info_entry *entry);
88 struct proc_dir_entry *p; 86 struct proc_dir_entry *p;
89 struct semaphore access; 87 struct semaphore access;
90}; 88};
91 89
92extern int snd_info_check_reserved_words(const char *str);
93
94#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) 90#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
95extern int snd_info_minor_register(void); 91int snd_info_minor_register(void);
96extern int snd_info_minor_unregister(void); 92int snd_info_minor_unregister(void);
97#else 93#else
98#define snd_info_minor_register() /* NOP */ 94#define snd_info_minor_register() /* NOP */
99#define snd_info_minor_unregister() /* NOP */ 95#define snd_info_minor_unregister() /* NOP */
@@ -102,72 +98,79 @@ extern int snd_info_minor_unregister(void);
102 98
103#ifdef CONFIG_PROC_FS 99#ifdef CONFIG_PROC_FS
104 100
105extern snd_info_entry_t *snd_seq_root; 101extern struct snd_info_entry *snd_seq_root;
106#ifdef CONFIG_SND_OSSEMUL 102#ifdef CONFIG_SND_OSSEMUL
107extern snd_info_entry_t *snd_oss_root; 103extern struct snd_info_entry *snd_oss_root;
108#else 104#else
109#define snd_oss_root NULL 105#define snd_oss_root NULL
110#endif 106#endif
111 107
112int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); 108int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3)));
113int snd_info_init(void); 109int snd_info_init(void);
114int snd_info_done(void); 110int snd_info_done(void);
115 111
116int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len); 112int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len);
117char *snd_info_get_str(char *dest, char *src, int len); 113char *snd_info_get_str(char *dest, char *src, int len);
118snd_info_entry_t *snd_info_create_module_entry(struct module * module, 114struct snd_info_entry *snd_info_create_module_entry(struct module * module,
119 const char *name, 115 const char *name,
120 snd_info_entry_t * parent); 116 struct snd_info_entry * parent);
121snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, 117struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card,
122 const char *name, 118 const char *name,
123 snd_info_entry_t * parent); 119 struct snd_info_entry * parent);
124void snd_info_free_entry(snd_info_entry_t * entry); 120void snd_info_free_entry(struct snd_info_entry * entry);
125int snd_info_store_text(snd_info_entry_t * entry); 121int snd_info_store_text(struct snd_info_entry * entry);
126int snd_info_restore_text(snd_info_entry_t * entry); 122int snd_info_restore_text(struct snd_info_entry * entry);
127 123
128int snd_info_card_create(snd_card_t * card); 124int snd_info_card_create(struct snd_card * card);
129int snd_info_card_register(snd_card_t * card); 125int snd_info_card_register(struct snd_card * card);
130int snd_info_card_free(snd_card_t * card); 126int snd_info_card_free(struct snd_card * card);
131int snd_info_register(snd_info_entry_t * entry); 127int snd_info_register(struct snd_info_entry * entry);
132int snd_info_unregister(snd_info_entry_t * entry); 128int snd_info_unregister(struct snd_info_entry * entry);
133 129
134/* for card drivers */ 130/* for card drivers */
135int snd_card_proc_new(snd_card_t *card, const char *name, snd_info_entry_t **entryp); 131int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
136 132
137static inline void snd_info_set_text_ops(snd_info_entry_t *entry, 133static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
138 void *private_data, 134 void *private_data,
139 long read_size, 135 long read_size,
140 void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) 136 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
141{ 137{
142 entry->private_data = private_data; 138 entry->private_data = private_data;
143 entry->c.text.read_size = read_size; 139 entry->c.text.read_size = read_size;
144 entry->c.text.read = read; 140 entry->c.text.read = read;
145} 141}
146 142
143int snd_info_check_reserved_words(const char *str);
147 144
148#else 145#else
149 146
150#define snd_seq_root NULL 147#define snd_seq_root NULL
151#define snd_oss_root NULL 148#define snd_oss_root NULL
152 149
153static inline int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) { return 0; } 150static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; }
154static inline int snd_info_init(void) { return 0; } 151static inline int snd_info_init(void) { return 0; }
155static inline int snd_info_done(void) { return 0; } 152static inline int snd_info_done(void) { return 0; }
156 153
157static inline int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len) { return 0; } 154static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; }
158static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; } 155static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
159static inline snd_info_entry_t *snd_info_create_module_entry(struct module * module, const char *name, snd_info_entry_t * parent) { return NULL; } 156static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; }
160static inline snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, const char *name, snd_info_entry_t * parent) { return NULL; } 157static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; }
161static inline void snd_info_free_entry(snd_info_entry_t * entry) { ; } 158static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
162 159
163static inline int snd_info_card_create(snd_card_t * card) { return 0; } 160static inline int snd_info_card_create(struct snd_card * card) { return 0; }
164static inline int snd_info_card_register(snd_card_t * card) { return 0; } 161static inline int snd_info_card_register(struct snd_card * card) { return 0; }
165static inline int snd_info_card_free(snd_card_t * card) { return 0; } 162static inline int snd_info_card_free(struct snd_card * card) { return 0; }
166static inline int snd_info_register(snd_info_entry_t * entry) { return 0; } 163static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
167static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; } 164static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; }
165
166static inline int snd_card_proc_new(struct snd_card *card, const char *name,
167 struct snd_info_entry **entryp) { return -EINVAL; }
168static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
169 void *private_data,
170 long read_size,
171 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
168 172
169#define snd_card_proc_new(card,name,entryp) 0 /* always success */ 173static inline int snd_info_check_reserved_words(const char *str) { return 1; }
170#define snd_info_set_text_ops(entry,private_data,read_size,read) /*NOP*/
171 174
172#endif 175#endif
173 176
@@ -185,7 +188,7 @@ static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; }
185 188
186#define SNDRV_OSS_INFO_DEV_COUNT 6 189#define SNDRV_OSS_INFO_DEV_COUNT 6
187 190
188extern int snd_oss_info_register(int dev, int num, char *string); 191int snd_oss_info_register(int dev, int num, char *string);
189#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL) 192#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL)
190 193
191#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */ 194#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */
diff --git a/include/sound/initval.h b/include/sound/initval.h
index 2bf1508825a4..d29e3d31d149 100644
--- a/include/sound/initval.h
+++ b/include/sound/initval.h
@@ -50,20 +50,6 @@
50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } 50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR 51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
52 52
53#ifdef SNDRV_LEGACY_AUTO_PROBE
54static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port))
55{
56 int result = 0; /* number of detected cards */
57
58 while ((signed long)*ports != -1) {
59 if (probe(*ports) >= 0)
60 result++;
61 ports++;
62 }
63 return result;
64}
65#endif
66
67#ifdef SNDRV_LEGACY_FIND_FREE_IRQ 53#ifdef SNDRV_LEGACY_FIND_FREE_IRQ
68#include <linux/interrupt.h> 54#include <linux/interrupt.h>
69 55
diff --git a/include/sound/minors.h b/include/sound/minors.h
index a17b5c9961bb..46bcd2023ed8 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -26,18 +26,20 @@
26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f) 26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f)
27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev)) 27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev))
28 28
29#define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */ 29/* these minors can still be used for autoloading devices (/dev/aload*) */
30#define SNDRV_MINOR_CONTROL 0 /* 0 */
30#define SNDRV_MINOR_GLOBAL 1 /* 1 */ 31#define SNDRV_MINOR_GLOBAL 1 /* 1 */
31#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32) 32#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32)
32#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32) 33#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32)
34
35#ifndef CONFIG_SND_DYNAMIC_MINORS
36 /* 2 - 3 (reserved) */
33#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 37#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */
34#define SNDRV_MINOR_HWDEPS 4
35#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ 38#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */
36#define SNDRV_MINOR_RAWMIDIS 8
37#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */ 39#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */
38#define SNDRV_MINOR_PCM_CAPTURE 24 /* 24 - 31 */ 40#define SNDRV_MINOR_PCM_CAPTURE 24 /* 24 - 31 */
39#define SNDRV_MINOR_PCMS 8
40 41
42/* same as first respective minor number to make minor allocation easier */
41#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL 43#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL
42#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP 44#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP
43#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI 45#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI
@@ -46,6 +48,25 @@
46#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 48#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER
47#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 49#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER
48 50
51#else /* CONFIG_SND_DYNAMIC_MINORS */
52
53enum {
54 SNDRV_DEVICE_TYPE_CONTROL,
55 SNDRV_DEVICE_TYPE_SEQUENCER,
56 SNDRV_DEVICE_TYPE_TIMER,
57 SNDRV_DEVICE_TYPE_HWDEP,
58 SNDRV_DEVICE_TYPE_RAWMIDI,
59 SNDRV_DEVICE_TYPE_PCM_PLAYBACK,
60 SNDRV_DEVICE_TYPE_PCM_CAPTURE,
61};
62
63#endif /* CONFIG_SND_DYNAMIC_MINORS */
64
65#define SNDRV_MINOR_HWDEPS 4
66#define SNDRV_MINOR_RAWMIDIS 8
67#define SNDRV_MINOR_PCMS 8
68
69
49#ifdef CONFIG_SND_OSSEMUL 70#ifdef CONFIG_SND_OSSEMUL
50 71
51#define SNDRV_MINOR_OSS_DEVICES 16 72#define SNDRV_MINOR_OSS_DEVICES 16
diff --git a/include/sound/mixer_oss.h b/include/sound/mixer_oss.h
index ed75b2fb00ab..ca5b4822b62c 100644
--- a/include/sound/mixer_oss.h
+++ b/include/sound/mixer_oss.h
@@ -24,51 +24,53 @@
24 24
25#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 25#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
26 26
27typedef struct _snd_oss_mixer_slot snd_mixer_oss_slot_t;
28typedef struct _snd_oss_file snd_mixer_oss_file_t;
29
30typedef int (*snd_mixer_oss_get_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *left, int *right);
31typedef int (*snd_mixer_oss_put_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int left, int right);
32typedef int (*snd_mixer_oss_get_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *active);
33typedef int (*snd_mixer_oss_put_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int active);
34typedef int (*snd_mixer_oss_get_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int *active_index);
35typedef int (*snd_mixer_oss_put_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int active_index);
36
37#define SNDRV_OSS_MAX_MIXERS 32 27#define SNDRV_OSS_MAX_MIXERS 32
38 28
39struct _snd_oss_mixer_slot { 29struct snd_mixer_oss_file;
30
31struct snd_mixer_oss_slot {
40 int number; 32 int number;
41 unsigned int stereo: 1; 33 unsigned int stereo: 1;
42 snd_mixer_oss_get_volume_t get_volume; 34 int (*get_volume)(struct snd_mixer_oss_file *fmixer,
43 snd_mixer_oss_put_volume_t put_volume; 35 struct snd_mixer_oss_slot *chn,
44 snd_mixer_oss_get_recsrc_t get_recsrc; 36 int *left, int *right);
45 snd_mixer_oss_put_recsrc_t put_recsrc; 37 int (*put_volume)(struct snd_mixer_oss_file *fmixer,
38 struct snd_mixer_oss_slot *chn,
39 int left, int right);
40 int (*get_recsrc)(struct snd_mixer_oss_file *fmixer,
41 struct snd_mixer_oss_slot *chn,
42 int *active);
43 int (*put_recsrc)(struct snd_mixer_oss_file *fmixer,
44 struct snd_mixer_oss_slot *chn,
45 int active);
46 unsigned long private_value; 46 unsigned long private_value;
47 void *private_data; 47 void *private_data;
48 void (*private_free)(snd_mixer_oss_slot_t *slot); 48 void (*private_free)(struct snd_mixer_oss_slot *slot);
49 int volume[2]; 49 int volume[2];
50}; 50};
51 51
52struct _snd_oss_mixer { 52struct snd_mixer_oss {
53 snd_card_t *card; 53 struct snd_card *card;
54 char id[16]; 54 char id[16];
55 char name[32]; 55 char name[32];
56 snd_mixer_oss_slot_t slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */ 56 struct snd_mixer_oss_slot slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */
57 unsigned int mask_recsrc; /* exclusive recsrc mask */ 57 unsigned int mask_recsrc; /* exclusive recsrc mask */
58 snd_mixer_oss_get_recsrce_t get_recsrc; 58 int (*get_recsrc)(struct snd_mixer_oss_file *fmixer,
59 snd_mixer_oss_put_recsrce_t put_recsrc; 59 unsigned int *active_index);
60 int (*put_recsrc)(struct snd_mixer_oss_file *fmixer,
61 unsigned int active_index);
60 void *private_data_recsrc; 62 void *private_data_recsrc;
61 void (*private_free_recsrc)(snd_mixer_oss_t *mixer); 63 void (*private_free_recsrc)(struct snd_mixer_oss *mixer);
62 struct semaphore reg_mutex; 64 struct semaphore reg_mutex;
63 snd_info_entry_t *proc_entry; 65 struct snd_info_entry *proc_entry;
64 int oss_dev_alloc; 66 int oss_dev_alloc;
65 /* --- */ 67 /* --- */
66 int oss_recsrc; 68 int oss_recsrc;
67}; 69};
68 70
69struct _snd_oss_file { 71struct snd_mixer_oss_file {
70 snd_card_t *card; 72 struct snd_card *card;
71 snd_mixer_oss_t *mixer; 73 struct snd_mixer_oss *mixer;
72}; 74};
73 75
74#endif /* CONFIG_SND_MIXER_OSS */ 76#endif /* CONFIG_SND_MIXER_OSS */
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index ae39e38bf996..8e97ace78f16 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -58,10 +58,8 @@
58#define MPU401_MODE_INPUT_TIMER (1<<0) 58#define MPU401_MODE_INPUT_TIMER (1<<0)
59#define MPU401_MODE_OUTPUT_TIMER (1<<1) 59#define MPU401_MODE_OUTPUT_TIMER (1<<1)
60 60
61typedef struct _snd_mpu401 mpu401_t; 61struct snd_mpu401 {
62 62 struct snd_rawmidi *rmidi;
63struct _snd_mpu401 {
64 snd_rawmidi_t *rmidi;
65 63
66 unsigned short hardware; /* MPU401_HW_XXXX */ 64 unsigned short hardware; /* MPU401_HW_XXXX */
67 unsigned long port; /* base port of MPU-401 chip */ 65 unsigned long port; /* base port of MPU-401 chip */
@@ -73,14 +71,14 @@ struct _snd_mpu401 {
73 unsigned long mode; /* MPU401_MODE_XXXX */ 71 unsigned long mode; /* MPU401_MODE_XXXX */
74 int timer_invoked; 72 int timer_invoked;
75 73
76 int (*open_input) (mpu401_t * mpu); 74 int (*open_input) (struct snd_mpu401 * mpu);
77 void (*close_input) (mpu401_t * mpu); 75 void (*close_input) (struct snd_mpu401 * mpu);
78 int (*open_output) (mpu401_t * mpu); 76 int (*open_output) (struct snd_mpu401 * mpu);
79 void (*close_output) (mpu401_t * mpu); 77 void (*close_output) (struct snd_mpu401 * mpu);
80 void *private_data; 78 void *private_data;
81 79
82 snd_rawmidi_substream_t *substream_input; 80 struct snd_rawmidi_substream *substream_input;
83 snd_rawmidi_substream_t *substream_output; 81 struct snd_rawmidi_substream *substream_output;
84 82
85 spinlock_t input_lock; 83 spinlock_t input_lock;
86 spinlock_t output_lock; 84 spinlock_t output_lock;
@@ -88,8 +86,8 @@ struct _snd_mpu401 {
88 86
89 struct timer_list timer; 87 struct timer_list timer;
90 88
91 void (*write) (mpu401_t * mpu, unsigned char data, unsigned long addr); 89 void (*write) (struct snd_mpu401 * mpu, unsigned char data, unsigned long addr);
92 unsigned char (*read) (mpu401_t * mpu, unsigned long addr); 90 unsigned char (*read) (struct snd_mpu401 *mpu, unsigned long addr);
93}; 91};
94 92
95/* I/O ports */ 93/* I/O ports */
@@ -103,13 +101,13 @@ struct _snd_mpu401 {
103 101
104irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs); 102irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 103
106int snd_mpu401_uart_new(snd_card_t * card, 104int snd_mpu401_uart_new(struct snd_card *card,
107 int device, 105 int device,
108 unsigned short hardware, 106 unsigned short hardware,
109 unsigned long port, 107 unsigned long port,
110 int integrated, 108 int integrated,
111 int irq, 109 int irq,
112 int irq_flags, 110 int irq_flags,
113 snd_rawmidi_t ** rrawmidi); 111 struct snd_rawmidi ** rrawmidi);
114 112
115#endif /* __SOUND_MPU401_H */ 113#endif /* __SOUND_MPU401_H */
diff --git a/include/sound/opl3.h b/include/sound/opl3.h
index 19f657d4fc06..83392641cb47 100644
--- a/include/sound/opl3.h
+++ b/include/sound/opl3.h
@@ -237,12 +237,12 @@
237#define MAX_OPL2_VOICES 9 237#define MAX_OPL2_VOICES 9
238#define MAX_OPL3_VOICES 18 238#define MAX_OPL3_VOICES 18
239 239
240typedef struct snd_opl3 opl3_t; 240struct snd_opl3;
241 241
242/* 242/*
243 * A structure to keep track of each hardware voice 243 * A structure to keep track of each hardware voice
244 */ 244 */
245typedef struct snd_opl3_voice { 245struct snd_opl3_voice {
246 int state; /* status */ 246 int state; /* status */
247#define SNDRV_OPL3_ST_OFF 0 /* Not playing */ 247#define SNDRV_OPL3_ST_OFF 0 /* Not playing */
248#define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */ 248#define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */
@@ -257,8 +257,8 @@ typedef struct snd_opl3_voice {
257 257
258 unsigned char keyon_reg; /* KON register shadow */ 258 unsigned char keyon_reg; /* KON register shadow */
259 259
260 snd_midi_channel_t *chan; /* Midi channel for this note */ 260 struct snd_midi_channel *chan; /* Midi channel for this note */
261} snd_opl3_voice_t; 261};
262 262
263struct snd_opl3 { 263struct snd_opl3 {
264 unsigned long l_port; 264 unsigned long l_port;
@@ -267,18 +267,18 @@ struct snd_opl3 {
267 struct resource *res_r_port; 267 struct resource *res_r_port;
268 unsigned short hardware; 268 unsigned short hardware;
269 /* hardware access */ 269 /* hardware access */
270 void (*command) (opl3_t * opl3, unsigned short cmd, unsigned char val); 270 void (*command) (struct snd_opl3 * opl3, unsigned short cmd, unsigned char val);
271 unsigned short timer_enable; 271 unsigned short timer_enable;
272 int seq_dev_num; /* sequencer device number */ 272 int seq_dev_num; /* sequencer device number */
273 snd_timer_t *timer1; 273 struct snd_timer *timer1;
274 snd_timer_t *timer2; 274 struct snd_timer *timer2;
275 spinlock_t timer_lock; 275 spinlock_t timer_lock;
276 276
277 void *private_data; 277 void *private_data;
278 void (*private_free)(opl3_t *); 278 void (*private_free)(struct snd_opl3 *);
279 279
280 spinlock_t reg_lock; 280 spinlock_t reg_lock;
281 snd_card_t *card; /* The card that this belongs to */ 281 struct snd_card *card; /* The card that this belongs to */
282 int used; /* usage flag - exclusive */ 282 int used; /* usage flag - exclusive */
283 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 283 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
284 unsigned char rhythm; /* percussion mode flag */ 284 unsigned char rhythm; /* percussion mode flag */
@@ -289,18 +289,18 @@ struct snd_opl3 {
289 int synth_mode; /* synth mode */ 289 int synth_mode; /* synth mode */
290 int seq_client; 290 int seq_client;
291 291
292 snd_seq_device_t *seq_dev; /* sequencer device */ 292 struct snd_seq_device *seq_dev; /* sequencer device */
293 snd_midi_channel_set_t * chset; 293 struct snd_midi_channel_set * chset;
294 294
295#ifdef CONFIG_SND_SEQUENCER_OSS 295#ifdef CONFIG_SND_SEQUENCER_OSS
296 snd_seq_device_t *oss_seq_dev; /* OSS sequencer device */ 296 struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */
297 snd_midi_channel_set_t * oss_chset; 297 struct snd_midi_channel_set * oss_chset;
298#endif 298#endif
299 299
300 snd_seq_kinstr_ops_t fm_ops; 300 struct snd_seq_kinstr_ops fm_ops;
301 snd_seq_kinstr_list_t *ilist; 301 struct snd_seq_kinstr_list *ilist;
302 302
303 snd_opl3_voice_t voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ 303 struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */
304 int use_time; /* allocation counter */ 304 int use_time; /* allocation counter */
305 305
306 unsigned short connection_reg; /* connection reg shadow */ 306 unsigned short connection_reg; /* connection reg shadow */
@@ -316,24 +316,25 @@ struct snd_opl3 {
316}; 316};
317 317
318/* opl3.c */ 318/* opl3.c */
319void snd_opl3_interrupt(snd_hwdep_t * hw); 319void snd_opl3_interrupt(struct snd_hwdep * hw);
320int snd_opl3_new(snd_card_t *card, unsigned short hardware, opl3_t **ropl3); 320int snd_opl3_new(struct snd_card *card, unsigned short hardware,
321int snd_opl3_init(opl3_t *opl3); 321 struct snd_opl3 **ropl3);
322int snd_opl3_create(snd_card_t * card, 322int snd_opl3_init(struct snd_opl3 *opl3);
323int snd_opl3_create(struct snd_card *card,
323 unsigned long l_port, unsigned long r_port, 324 unsigned long l_port, unsigned long r_port,
324 unsigned short hardware, 325 unsigned short hardware,
325 int integrated, 326 int integrated,
326 opl3_t ** opl3); 327 struct snd_opl3 ** opl3);
327int snd_opl3_timer_new(opl3_t * opl3, int timer1_dev, int timer2_dev); 328int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev);
328int snd_opl3_hwdep_new(opl3_t * opl3, int device, int seq_device, 329int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device,
329 snd_hwdep_t ** rhwdep); 330 struct snd_hwdep ** rhwdep);
330 331
331/* opl3_synth */ 332/* opl3_synth */
332int snd_opl3_open(snd_hwdep_t * hw, struct file *file); 333int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
333int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, 334int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
334 unsigned int cmd, unsigned long arg); 335 unsigned int cmd, unsigned long arg);
335int snd_opl3_release(snd_hwdep_t * hw, struct file *file); 336int snd_opl3_release(struct snd_hwdep * hw, struct file *file);
336 337
337void snd_opl3_reset(opl3_t * opl3); 338void snd_opl3_reset(struct snd_opl3 * opl3);
338 339
339#endif /* __SOUND_OPL3_H */ 340#endif /* __SOUND_OPL3_H */
diff --git a/include/sound/opl4.h b/include/sound/opl4.h
index 20c04428b139..60ae8454b3ce 100644
--- a/include/sound/opl4.h
+++ b/include/sound/opl4.h
@@ -22,11 +22,11 @@
22 22
23#include <sound/opl3.h> 23#include <sound/opl3.h>
24 24
25typedef struct opl4 opl4_t; 25struct snd_opl4;
26 26
27extern int snd_opl4_create(snd_card_t *card, 27extern int snd_opl4_create(struct snd_card *card,
28 unsigned long fm_port, unsigned long pcm_port, 28 unsigned long fm_port, unsigned long pcm_port,
29 int seq_device, 29 int seq_device,
30 opl3_t **opl3, opl4_t **opl4); 30 struct snd_opl3 **opl3, struct snd_opl4 **opl4);
31 31
32#endif /* __SOUND_OPL4_H */ 32#endif /* __SOUND_OPL4_H */
diff --git a/include/sound/pcm-indirect.h b/include/sound/pcm-indirect.h
index 31fa7a54508a..7003d7702e26 100644
--- a/include/sound/pcm-indirect.h
+++ b/include/sound/pcm-indirect.h
@@ -24,7 +24,7 @@
24 24
25#include <sound/pcm.h> 25#include <sound/pcm.h>
26 26
27typedef struct sndrv_pcm_indirect { 27struct snd_pcm_indirect {
28 unsigned int hw_buffer_size; /* Byte size of hardware buffer */ 28 unsigned int hw_buffer_size; /* Byte size of hardware buffer */
29 unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */ 29 unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */
30 unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */ 30 unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */
@@ -35,20 +35,20 @@ typedef struct sndrv_pcm_indirect {
35 unsigned int sw_io; /* Current software pointer in bytes */ 35 unsigned int sw_io; /* Current software pointer in bytes */
36 int sw_ready; /* Bytes ready to be transferred to/from hw */ 36 int sw_ready; /* Bytes ready to be transferred to/from hw */
37 snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */ 37 snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */
38} snd_pcm_indirect_t; 38};
39 39
40typedef void (*snd_pcm_indirect_copy_t)(snd_pcm_substream_t *substream, 40typedef void (*snd_pcm_indirect_copy_t)(struct snd_pcm_substream *substream,
41 snd_pcm_indirect_t *rec, size_t bytes); 41 struct snd_pcm_indirect *rec, size_t bytes);
42 42
43/* 43/*
44 * helper function for playback ack callback 44 * helper function for playback ack callback
45 */ 45 */
46static inline void 46static inline void
47snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream, 47snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream,
48 snd_pcm_indirect_t *rec, 48 struct snd_pcm_indirect *rec,
49 snd_pcm_indirect_copy_t copy) 49 snd_pcm_indirect_copy_t copy)
50{ 50{
51 snd_pcm_runtime_t *runtime = substream->runtime; 51 struct snd_pcm_runtime *runtime = substream->runtime;
52 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; 52 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
53 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; 53 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
54 int qsize; 54 int qsize;
@@ -89,8 +89,8 @@ snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream,
89 * ptr = current byte pointer 89 * ptr = current byte pointer
90 */ 90 */
91static inline snd_pcm_uframes_t 91static inline snd_pcm_uframes_t
92snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream, 92snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream,
93 snd_pcm_indirect_t *rec, unsigned int ptr) 93 struct snd_pcm_indirect *rec, unsigned int ptr)
94{ 94{
95 int bytes = ptr - rec->hw_io; 95 int bytes = ptr - rec->hw_io;
96 if (bytes < 0) 96 if (bytes < 0)
@@ -110,11 +110,11 @@ snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
110 * helper function for capture ack callback 110 * helper function for capture ack callback
111 */ 111 */
112static inline void 112static inline void
113snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream, 113snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream,
114 snd_pcm_indirect_t *rec, 114 struct snd_pcm_indirect *rec,
115 snd_pcm_indirect_copy_t copy) 115 snd_pcm_indirect_copy_t copy)
116{ 116{
117 snd_pcm_runtime_t *runtime = substream->runtime; 117 struct snd_pcm_runtime *runtime = substream->runtime;
118 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; 118 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
119 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; 119 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
120 120
@@ -154,8 +154,8 @@ snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream,
154 * ptr = current byte pointer 154 * ptr = current byte pointer
155 */ 155 */
156static inline snd_pcm_uframes_t 156static inline snd_pcm_uframes_t
157snd_pcm_indirect_capture_pointer(snd_pcm_substream_t *substream, 157snd_pcm_indirect_capture_pointer(struct snd_pcm_substream *substream,
158 snd_pcm_indirect_t *rec, unsigned int ptr) 158 struct snd_pcm_indirect *rec, unsigned int ptr)
159{ 159{
160 int qsize; 160 int qsize;
161 int bytes = ptr - rec->hw_io; 161 int bytes = ptr - rec->hw_io;
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index acc4fa9d5abe..314268a11048 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -28,36 +28,9 @@
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30 30
31typedef sndrv_pcm_uframes_t snd_pcm_uframes_t;
32typedef sndrv_pcm_sframes_t snd_pcm_sframes_t;
33typedef enum sndrv_pcm_class snd_pcm_class_t;
34typedef enum sndrv_pcm_subclass snd_pcm_subclass_t;
35typedef enum sndrv_pcm_stream snd_pcm_stream_t;
36typedef enum sndrv_pcm_access snd_pcm_access_t;
37typedef enum sndrv_pcm_format snd_pcm_format_t;
38typedef enum sndrv_pcm_subformat snd_pcm_subformat_t;
39typedef enum sndrv_pcm_state snd_pcm_state_t;
40typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t;
41typedef struct sndrv_pcm_info snd_pcm_info_t;
42typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
43typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
44typedef enum sndrv_pcm_start snd_pcm_start_t;
45typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;
46typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
47typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
48typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t;
49typedef struct sndrv_pcm_status snd_pcm_status_t;
50typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t;
51typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t;
52typedef struct sndrv_mask snd_mask_t;
53typedef struct snd_sg_buf snd_pcm_sgbuf_t;
54
55#define snd_pcm_substream_chip(substream) ((substream)->private_data) 31#define snd_pcm_substream_chip(substream) ((substream)->private_data)
56#define snd_pcm_chip(pcm) ((pcm)->private_data) 32#define snd_pcm_chip(pcm) ((pcm)->private_data)
57 33
58typedef struct _snd_pcm_file snd_pcm_file_t;
59typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
60
61#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 34#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
62#include "pcm_oss.h" 35#include "pcm_oss.h"
63#endif 36#endif
@@ -66,7 +39,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
66 * Hardware (lowlevel) section 39 * Hardware (lowlevel) section
67 */ 40 */
68 41
69typedef struct _snd_pcm_hardware { 42struct snd_pcm_hardware {
70 unsigned int info; /* SNDRV_PCM_INFO_* */ 43 unsigned int info; /* SNDRV_PCM_INFO_* */
71 u64 formats; /* SNDRV_PCM_FMTBIT_* */ 44 u64 formats; /* SNDRV_PCM_FMTBIT_* */
72 unsigned int rates; /* SNDRV_PCM_RATE_* */ 45 unsigned int rates; /* SNDRV_PCM_RATE_* */
@@ -80,26 +53,29 @@ typedef struct _snd_pcm_hardware {
80 unsigned int periods_min; /* min # of periods */ 53 unsigned int periods_min; /* min # of periods */
81 unsigned int periods_max; /* max # of periods */ 54 unsigned int periods_max; /* max # of periods */
82 size_t fifo_size; /* fifo size in bytes */ 55 size_t fifo_size; /* fifo size in bytes */
83} snd_pcm_hardware_t; 56};
84 57
85typedef struct _snd_pcm_ops { 58struct snd_pcm_ops {
86 int (*open)(snd_pcm_substream_t *substream); 59 int (*open)(struct snd_pcm_substream *substream);
87 int (*close)(snd_pcm_substream_t *substream); 60 int (*close)(struct snd_pcm_substream *substream);
88 int (*ioctl)(snd_pcm_substream_t * substream, 61 int (*ioctl)(struct snd_pcm_substream * substream,
89 unsigned int cmd, void *arg); 62 unsigned int cmd, void *arg);
90 int (*hw_params)(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * params); 63 int (*hw_params)(struct snd_pcm_substream *substream,
91 int (*hw_free)(snd_pcm_substream_t *substream); 64 struct snd_pcm_hw_params *params);
92 int (*prepare)(snd_pcm_substream_t * substream); 65 int (*hw_free)(struct snd_pcm_substream *substream);
93 int (*trigger)(snd_pcm_substream_t * substream, int cmd); 66 int (*prepare)(struct snd_pcm_substream *substream);
94 snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream); 67 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
95 int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, 68 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
69 int (*copy)(struct snd_pcm_substream *substream, int channel,
70 snd_pcm_uframes_t pos,
96 void __user *buf, snd_pcm_uframes_t count); 71 void __user *buf, snd_pcm_uframes_t count);
97 int (*silence)(snd_pcm_substream_t *substream, int channel, 72 int (*silence)(struct snd_pcm_substream *substream, int channel,
98 snd_pcm_uframes_t pos, snd_pcm_uframes_t count); 73 snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
99 struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset); 74 struct page *(*page)(struct snd_pcm_substream *substream,
100 int (*mmap)(snd_pcm_substream_t *substream, struct vm_area_struct *vma); 75 unsigned long offset);
101 int (*ack)(snd_pcm_substream_t *substream); 76 int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
102} snd_pcm_ops_t; 77 int (*ack)(struct snd_pcm_substream *substream);
78};
103 79
104/* 80/*
105 * 81 *
@@ -212,17 +188,16 @@ typedef struct _snd_pcm_ops {
212#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE 188#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE
213#endif 189#endif
214 190
215struct _snd_pcm_file { 191struct snd_pcm_file {
216 snd_pcm_substream_t * substream; 192 struct snd_pcm_substream *substream;
217 struct _snd_pcm_file * next; 193 struct snd_pcm_file *next;
218}; 194};
219 195
220typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t; 196struct snd_pcm_hw_rule;
197typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params,
198 struct snd_pcm_hw_rule *rule);
221 199
222typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params, 200struct snd_pcm_hw_rule {
223 snd_pcm_hw_rule_t *rule);
224
225struct _snd_pcm_hw_rule {
226 unsigned int cond; 201 unsigned int cond;
227 snd_pcm_hw_rule_func_t func; 202 snd_pcm_hw_rule_func_t func;
228 int var; 203 int var;
@@ -230,57 +205,57 @@ struct _snd_pcm_hw_rule {
230 void *private; 205 void *private;
231}; 206};
232 207
233typedef struct _snd_pcm_hw_constraints { 208struct snd_pcm_hw_constraints {
234 snd_mask_t masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 209 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
235 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 210 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
236 snd_interval_t intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 211 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
237 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 212 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
238 unsigned int rules_num; 213 unsigned int rules_num;
239 unsigned int rules_all; 214 unsigned int rules_all;
240 snd_pcm_hw_rule_t *rules; 215 struct snd_pcm_hw_rule *rules;
241} snd_pcm_hw_constraints_t; 216};
242 217
243static inline snd_mask_t *constrs_mask(snd_pcm_hw_constraints_t *constrs, 218static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
244 snd_pcm_hw_param_t var) 219 snd_pcm_hw_param_t var)
245{ 220{
246 return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; 221 return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
247} 222}
248 223
249static inline snd_interval_t *constrs_interval(snd_pcm_hw_constraints_t *constrs, 224static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
250 snd_pcm_hw_param_t var) 225 snd_pcm_hw_param_t var)
251{ 226{
252 return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 227 return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
253} 228}
254 229
255typedef struct { 230struct snd_ratnum {
256 unsigned int num; 231 unsigned int num;
257 unsigned int den_min, den_max, den_step; 232 unsigned int den_min, den_max, den_step;
258} ratnum_t; 233};
259 234
260typedef struct { 235struct snd_ratden {
261 unsigned int num_min, num_max, num_step; 236 unsigned int num_min, num_max, num_step;
262 unsigned int den; 237 unsigned int den;
263} ratden_t; 238};
264 239
265typedef struct { 240struct snd_pcm_hw_constraint_ratnums {
266 int nrats; 241 int nrats;
267 ratnum_t *rats; 242 struct snd_ratnum *rats;
268} snd_pcm_hw_constraint_ratnums_t; 243};
269 244
270typedef struct { 245struct snd_pcm_hw_constraint_ratdens {
271 int nrats; 246 int nrats;
272 ratden_t *rats; 247 struct snd_ratden *rats;
273} snd_pcm_hw_constraint_ratdens_t; 248};
274 249
275typedef struct { 250struct snd_pcm_hw_constraint_list {
276 unsigned int count; 251 unsigned int count;
277 unsigned int *list; 252 unsigned int *list;
278 unsigned int mask; 253 unsigned int mask;
279} snd_pcm_hw_constraint_list_t; 254};
280 255
281struct _snd_pcm_runtime { 256struct snd_pcm_runtime {
282 /* -- Status -- */ 257 /* -- Status -- */
283 snd_pcm_substream_t *trigger_master; 258 struct snd_pcm_substream *trigger_master;
284 struct timespec trigger_tstamp; /* trigger timestamp */ 259 struct timespec trigger_tstamp; /* trigger timestamp */
285 int overrange; 260 int overrange;
286 snd_pcm_uframes_t avail_max; 261 snd_pcm_uframes_t avail_max;
@@ -306,7 +281,7 @@ struct _snd_pcm_runtime {
306 unsigned int rate_den; 281 unsigned int rate_den;
307 282
308 /* -- SW params -- */ 283 /* -- SW params -- */
309 snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ 284 int tstamp_mode; /* mmap timestamp is updated */
310 unsigned int period_step; 285 unsigned int period_step;
311 unsigned int sleep_min; /* min ticks to sleep */ 286 unsigned int sleep_min; /* min ticks to sleep */
312 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 287 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
@@ -320,11 +295,11 @@ struct _snd_pcm_runtime {
320 snd_pcm_uframes_t silence_start; /* starting pointer to silence area */ 295 snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
321 snd_pcm_uframes_t silence_filled; /* size filled with silence */ 296 snd_pcm_uframes_t silence_filled; /* size filled with silence */
322 297
323 snd_pcm_sync_id_t sync; /* hardware synchronization ID */ 298 union snd_pcm_sync_id sync; /* hardware synchronization ID */
324 299
325 /* -- mmap -- */ 300 /* -- mmap -- */
326 volatile snd_pcm_mmap_status_t *status; 301 volatile struct snd_pcm_mmap_status *status;
327 volatile snd_pcm_mmap_control_t *control; 302 volatile struct snd_pcm_mmap_control *control;
328 atomic_t mmap_count; 303 atomic_t mmap_count;
329 304
330 /* -- locking / scheduling -- */ 305 /* -- locking / scheduling -- */
@@ -334,15 +309,15 @@ struct _snd_pcm_runtime {
334 309
335 /* -- private section -- */ 310 /* -- private section -- */
336 void *private_data; 311 void *private_data;
337 void (*private_free)(snd_pcm_runtime_t *runtime); 312 void (*private_free)(struct snd_pcm_runtime *runtime);
338 313
339 /* -- hardware description -- */ 314 /* -- hardware description -- */
340 snd_pcm_hardware_t hw; 315 struct snd_pcm_hardware hw;
341 snd_pcm_hw_constraints_t hw_constraints; 316 struct snd_pcm_hw_constraints hw_constraints;
342 317
343 /* -- interrupt callbacks -- */ 318 /* -- interrupt callbacks -- */
344 void (*transfer_ack_begin)(snd_pcm_substream_t *substream); 319 void (*transfer_ack_begin)(struct snd_pcm_substream *substream);
345 void (*transfer_ack_end)(snd_pcm_substream_t *substream); 320 void (*transfer_ack_end)(struct snd_pcm_substream *substream);
346 321
347 /* -- timer -- */ 322 /* -- timer -- */
348 unsigned int timer_resolution; /* timer resolution */ 323 unsigned int timer_resolution; /* timer resolution */
@@ -356,19 +331,19 @@ struct _snd_pcm_runtime {
356 331
357#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 332#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
358 /* -- OSS things -- */ 333 /* -- OSS things -- */
359 snd_pcm_oss_runtime_t oss; 334 struct snd_pcm_oss_runtime oss;
360#endif 335#endif
361}; 336};
362 337
363typedef struct _snd_pcm_group { /* keep linked substreams */ 338struct snd_pcm_group { /* keep linked substreams */
364 spinlock_t lock; 339 spinlock_t lock;
365 struct list_head substreams; 340 struct list_head substreams;
366 int count; 341 int count;
367} snd_pcm_group_t; 342};
368 343
369struct _snd_pcm_substream { 344struct snd_pcm_substream {
370 snd_pcm_t *pcm; 345 struct snd_pcm *pcm;
371 snd_pcm_str_t *pstr; 346 struct snd_pcm_str *pstr;
372 void *private_data; /* copied from pcm->private_data */ 347 void *private_data; /* copied from pcm->private_data */
373 int number; 348 int number;
374 char name[32]; /* substream name */ 349 char name[32]; /* substream name */
@@ -378,32 +353,32 @@ struct _snd_pcm_substream {
378 unsigned int dma_buf_id; 353 unsigned int dma_buf_id;
379 size_t dma_max; 354 size_t dma_max;
380 /* -- hardware operations -- */ 355 /* -- hardware operations -- */
381 snd_pcm_ops_t *ops; 356 struct snd_pcm_ops *ops;
382 /* -- runtime information -- */ 357 /* -- runtime information -- */
383 snd_pcm_runtime_t *runtime; 358 struct snd_pcm_runtime *runtime;
384 /* -- timer section -- */ 359 /* -- timer section -- */
385 snd_timer_t *timer; /* timer */ 360 struct snd_timer *timer; /* timer */
386 unsigned timer_running: 1; /* time is running */ 361 unsigned timer_running: 1; /* time is running */
387 spinlock_t timer_lock; 362 spinlock_t timer_lock;
388 /* -- next substream -- */ 363 /* -- next substream -- */
389 snd_pcm_substream_t *next; 364 struct snd_pcm_substream *next;
390 /* -- linked substreams -- */ 365 /* -- linked substreams -- */
391 struct list_head link_list; /* linked list member */ 366 struct list_head link_list; /* linked list member */
392 snd_pcm_group_t self_group; /* fake group for non linked substream (with substream lock inside) */ 367 struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
393 snd_pcm_group_t *group; /* pointer to current group */ 368 struct snd_pcm_group *group; /* pointer to current group */
394 /* -- assigned files -- */ 369 /* -- assigned files -- */
395 snd_pcm_file_t *file; 370 struct snd_pcm_file *file;
396 struct file *ffile; 371 struct file *ffile;
397#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 372#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
398 /* -- OSS things -- */ 373 /* -- OSS things -- */
399 snd_pcm_oss_substream_t oss; 374 struct snd_pcm_oss_substream oss;
400#endif 375#endif
401 snd_info_entry_t *proc_root; 376 struct snd_info_entry *proc_root;
402 snd_info_entry_t *proc_info_entry; 377 struct snd_info_entry *proc_info_entry;
403 snd_info_entry_t *proc_hw_params_entry; 378 struct snd_info_entry *proc_hw_params_entry;
404 snd_info_entry_t *proc_sw_params_entry; 379 struct snd_info_entry *proc_sw_params_entry;
405 snd_info_entry_t *proc_status_entry; 380 struct snd_info_entry *proc_status_entry;
406 snd_info_entry_t *proc_prealloc_entry; 381 struct snd_info_entry *proc_prealloc_entry;
407 /* misc flags */ 382 /* misc flags */
408 unsigned int no_mmap_ctrl: 1; 383 unsigned int no_mmap_ctrl: 1;
409}; 384};
@@ -415,65 +390,64 @@ struct _snd_pcm_substream {
415#endif 390#endif
416 391
417 392
418struct _snd_pcm_str { 393struct snd_pcm_str {
419 int stream; /* stream (direction) */ 394 int stream; /* stream (direction) */
420 snd_pcm_t *pcm; 395 struct snd_pcm *pcm;
421 /* -- substreams -- */ 396 /* -- substreams -- */
422 unsigned int substream_count; 397 unsigned int substream_count;
423 unsigned int substream_opened; 398 unsigned int substream_opened;
424 snd_pcm_substream_t *substream; 399 struct snd_pcm_substream *substream;
425#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 400#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
426 /* -- OSS things -- */ 401 /* -- OSS things -- */
427 snd_pcm_oss_stream_t oss; 402 struct snd_pcm_oss_stream oss;
428#endif 403#endif
429 snd_pcm_file_t *files; 404 struct snd_pcm_file *files;
430 snd_minor_t *reg; 405 struct snd_info_entry *proc_root;
431 snd_info_entry_t *proc_root; 406 struct snd_info_entry *proc_info_entry;
432 snd_info_entry_t *proc_info_entry;
433#ifdef CONFIG_SND_DEBUG 407#ifdef CONFIG_SND_DEBUG
434 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ 408 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */
435 snd_info_entry_t *proc_xrun_debug_entry; 409 struct snd_info_entry *proc_xrun_debug_entry;
436#endif 410#endif
437}; 411};
438 412
439struct _snd_pcm { 413struct snd_pcm {
440 snd_card_t *card; 414 struct snd_card *card;
415 struct list_head list;
441 unsigned int device; /* device number */ 416 unsigned int device; /* device number */
442 unsigned int info_flags; 417 unsigned int info_flags;
443 unsigned short dev_class; 418 unsigned short dev_class;
444 unsigned short dev_subclass; 419 unsigned short dev_subclass;
445 char id[64]; 420 char id[64];
446 char name[80]; 421 char name[80];
447 snd_pcm_str_t streams[2]; 422 struct snd_pcm_str streams[2];
448 struct semaphore open_mutex; 423 struct semaphore open_mutex;
449 wait_queue_head_t open_wait; 424 wait_queue_head_t open_wait;
450 void *private_data; 425 void *private_data;
451 void (*private_free) (snd_pcm_t *pcm); 426 void (*private_free) (struct snd_pcm *pcm);
452#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 427#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
453 snd_pcm_oss_t oss; 428 struct snd_pcm_oss oss;
454#endif 429#endif
455}; 430};
456 431
457typedef struct _snd_pcm_notify { 432struct snd_pcm_notify {
458 int (*n_register) (snd_pcm_t * pcm); 433 int (*n_register) (struct snd_pcm * pcm);
459 int (*n_disconnect) (snd_pcm_t * pcm); 434 int (*n_disconnect) (struct snd_pcm * pcm);
460 int (*n_unregister) (snd_pcm_t * pcm); 435 int (*n_unregister) (struct snd_pcm * pcm);
461 struct list_head list; 436 struct list_head list;
462} snd_pcm_notify_t; 437};
463 438
464/* 439/*
465 * Registering 440 * Registering
466 */ 441 */
467 442
468extern snd_pcm_t *snd_pcm_devices[]; 443extern struct file_operations snd_pcm_f_ops[2];
469extern snd_minor_t snd_pcm_reg[2];
470 444
471int snd_pcm_new(snd_card_t * card, char *id, int device, 445int snd_pcm_new(struct snd_card *card, char *id, int device,
472 int playback_count, int capture_count, 446 int playback_count, int capture_count,
473 snd_pcm_t **rpcm); 447 struct snd_pcm **rpcm);
474int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count); 448int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
475 449
476int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree); 450int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
477 451
478/* 452/*
479 * Native I/O 453 * Native I/O
@@ -481,24 +455,26 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree);
481 455
482extern rwlock_t snd_pcm_link_rwlock; 456extern rwlock_t snd_pcm_link_rwlock;
483 457
484int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info); 458int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
485int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info); 459int snd_pcm_info_user(struct snd_pcm_substream *substream,
486int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status); 460 struct snd_pcm_info __user *info);
487int snd_pcm_prepare(snd_pcm_substream_t *substream); 461int snd_pcm_status(struct snd_pcm_substream *substream,
488int snd_pcm_start(snd_pcm_substream_t *substream); 462 struct snd_pcm_status *status);
489int snd_pcm_stop(snd_pcm_substream_t *substream, int status); 463int snd_pcm_prepare(struct snd_pcm_substream *substream);
490int snd_pcm_drain_done(snd_pcm_substream_t *substream); 464int snd_pcm_start(struct snd_pcm_substream *substream);
465int snd_pcm_stop(struct snd_pcm_substream *substream, int status);
466int snd_pcm_drain_done(struct snd_pcm_substream *substream);
491#ifdef CONFIG_PM 467#ifdef CONFIG_PM
492int snd_pcm_suspend(snd_pcm_substream_t *substream); 468int snd_pcm_suspend(struct snd_pcm_substream *substream);
493int snd_pcm_suspend_all(snd_pcm_t *pcm); 469int snd_pcm_suspend_all(struct snd_pcm *pcm);
494#endif 470#endif
495int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 471int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
496int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 472int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
497int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 473int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
498int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, snd_pcm_substream_t **rsubstream); 474int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream);
499void snd_pcm_release_substream(snd_pcm_substream_t *substream); 475void snd_pcm_release_substream(struct snd_pcm_substream *substream);
500void snd_pcm_vma_notify_data(void *client, void *data); 476void snd_pcm_vma_notify_data(void *client, void *data);
501int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, struct vm_area_struct *area); 477int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
502 478
503#if BITS_PER_LONG >= 64 479#if BITS_PER_LONG >= 64
504 480
@@ -578,30 +554,30 @@ static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
578 * PCM library 554 * PCM library
579 */ 555 */
580 556
581static inline int snd_pcm_stream_linked(snd_pcm_substream_t *substream) 557static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
582{ 558{
583 return substream->group != &substream->self_group; 559 return substream->group != &substream->self_group;
584} 560}
585 561
586static inline void snd_pcm_stream_lock(snd_pcm_substream_t *substream) 562static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
587{ 563{
588 read_lock(&snd_pcm_link_rwlock); 564 read_lock(&snd_pcm_link_rwlock);
589 spin_lock(&substream->self_group.lock); 565 spin_lock(&substream->self_group.lock);
590} 566}
591 567
592static inline void snd_pcm_stream_unlock(snd_pcm_substream_t *substream) 568static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream)
593{ 569{
594 spin_unlock(&substream->self_group.lock); 570 spin_unlock(&substream->self_group.lock);
595 read_unlock(&snd_pcm_link_rwlock); 571 read_unlock(&snd_pcm_link_rwlock);
596} 572}
597 573
598static inline void snd_pcm_stream_lock_irq(snd_pcm_substream_t *substream) 574static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
599{ 575{
600 read_lock_irq(&snd_pcm_link_rwlock); 576 read_lock_irq(&snd_pcm_link_rwlock);
601 spin_lock(&substream->self_group.lock); 577 spin_lock(&substream->self_group.lock);
602} 578}
603 579
604static inline void snd_pcm_stream_unlock_irq(snd_pcm_substream_t *substream) 580static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
605{ 581{
606 spin_unlock(&substream->self_group.lock); 582 spin_unlock(&substream->self_group.lock);
607 read_unlock_irq(&snd_pcm_link_rwlock); 583 read_unlock_irq(&snd_pcm_link_rwlock);
@@ -623,56 +599,56 @@ do { \
623 list_for_each(pos, &substream->group->substreams) 599 list_for_each(pos, &substream->group->substreams)
624 600
625#define snd_pcm_group_substream_entry(pos) \ 601#define snd_pcm_group_substream_entry(pos) \
626 list_entry(pos, snd_pcm_substream_t, link_list) 602 list_entry(pos, struct snd_pcm_substream, link_list)
627 603
628static inline int snd_pcm_running(snd_pcm_substream_t *substream) 604static inline int snd_pcm_running(struct snd_pcm_substream *substream)
629{ 605{
630 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || 606 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
631 (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING && 607 (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
632 substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); 608 substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
633} 609}
634 610
635static inline ssize_t bytes_to_samples(snd_pcm_runtime_t *runtime, ssize_t size) 611static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
636{ 612{
637 return size * 8 / runtime->sample_bits; 613 return size * 8 / runtime->sample_bits;
638} 614}
639 615
640static inline snd_pcm_sframes_t bytes_to_frames(snd_pcm_runtime_t *runtime, ssize_t size) 616static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
641{ 617{
642 return size * 8 / runtime->frame_bits; 618 return size * 8 / runtime->frame_bits;
643} 619}
644 620
645static inline ssize_t samples_to_bytes(snd_pcm_runtime_t *runtime, ssize_t size) 621static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
646{ 622{
647 return size * runtime->sample_bits / 8; 623 return size * runtime->sample_bits / 8;
648} 624}
649 625
650static inline ssize_t frames_to_bytes(snd_pcm_runtime_t *runtime, snd_pcm_sframes_t size) 626static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
651{ 627{
652 return size * runtime->frame_bits / 8; 628 return size * runtime->frame_bits / 8;
653} 629}
654 630
655static inline int frame_aligned(snd_pcm_runtime_t *runtime, ssize_t bytes) 631static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
656{ 632{
657 return bytes % runtime->byte_align == 0; 633 return bytes % runtime->byte_align == 0;
658} 634}
659 635
660static inline size_t snd_pcm_lib_buffer_bytes(snd_pcm_substream_t *substream) 636static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
661{ 637{
662 snd_pcm_runtime_t *runtime = substream->runtime; 638 struct snd_pcm_runtime *runtime = substream->runtime;
663 return frames_to_bytes(runtime, runtime->buffer_size); 639 return frames_to_bytes(runtime, runtime->buffer_size);
664} 640}
665 641
666static inline size_t snd_pcm_lib_period_bytes(snd_pcm_substream_t *substream) 642static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
667{ 643{
668 snd_pcm_runtime_t *runtime = substream->runtime; 644 struct snd_pcm_runtime *runtime = substream->runtime;
669 return frames_to_bytes(runtime, runtime->period_size); 645 return frames_to_bytes(runtime, runtime->period_size);
670} 646}
671 647
672/* 648/*
673 * result is: 0 ... (boundary - 1) 649 * result is: 0 ... (boundary - 1)
674 */ 650 */
675static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtime) 651static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
676{ 652{
677 snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; 653 snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
678 if (avail < 0) 654 if (avail < 0)
@@ -685,7 +661,7 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtim
685/* 661/*
686 * result is: 0 ... (boundary - 1) 662 * result is: 0 ... (boundary - 1)
687 */ 663 */
688static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime) 664static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
689{ 665{
690 snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; 666 snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr;
691 if (avail < 0) 667 if (avail < 0)
@@ -693,12 +669,12 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime
693 return avail; 669 return avail;
694} 670}
695 671
696static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(snd_pcm_runtime_t *runtime) 672static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
697{ 673{
698 return runtime->buffer_size - snd_pcm_playback_avail(runtime); 674 return runtime->buffer_size - snd_pcm_playback_avail(runtime);
699} 675}
700 676
701static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runtime) 677static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
702{ 678{
703 return runtime->buffer_size - snd_pcm_capture_avail(runtime); 679 return runtime->buffer_size - snd_pcm_capture_avail(runtime);
704} 680}
@@ -711,9 +687,9 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runt
711 * 687 *
712 * Returns non-zero if available, or zero if not. 688 * Returns non-zero if available, or zero if not.
713 */ 689 */
714static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream) 690static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
715{ 691{
716 snd_pcm_runtime_t *runtime = substream->runtime; 692 struct snd_pcm_runtime *runtime = substream->runtime;
717 return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min; 693 return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min;
718} 694}
719 695
@@ -725,9 +701,9 @@ static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream)
725 * 701 *
726 * Returns non-zero if available, or zero if not. 702 * Returns non-zero if available, or zero if not.
727 */ 703 */
728static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream) 704static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
729{ 705{
730 snd_pcm_runtime_t *runtime = substream->runtime; 706 struct snd_pcm_runtime *runtime = substream->runtime;
731 return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min; 707 return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min;
732} 708}
733 709
@@ -740,9 +716,9 @@ static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream)
740 * 716 *
741 * Returns non-zero if exists, or zero if not. 717 * Returns non-zero if exists, or zero if not.
742 */ 718 */
743static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream) 719static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
744{ 720{
745 snd_pcm_runtime_t *runtime = substream->runtime; 721 struct snd_pcm_runtime *runtime = substream->runtime;
746 722
747 if (runtime->stop_threshold >= runtime->boundary) 723 if (runtime->stop_threshold >= runtime->boundary)
748 return 1; 724 return 1;
@@ -757,9 +733,9 @@ static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream)
757 * 733 *
758 * Returns non-zero if empty, or zero if not. 734 * Returns non-zero if empty, or zero if not.
759 */ 735 */
760static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream) 736static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
761{ 737{
762 snd_pcm_runtime_t *runtime = substream->runtime; 738 struct snd_pcm_runtime *runtime = substream->runtime;
763 return snd_pcm_playback_avail(runtime) >= runtime->buffer_size; 739 return snd_pcm_playback_avail(runtime) >= runtime->buffer_size;
764} 740}
765 741
@@ -771,14 +747,14 @@ static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream)
771 * 747 *
772 * Returns non-zero if empty, or zero if not. 748 * Returns non-zero if empty, or zero if not.
773 */ 749 */
774static inline int snd_pcm_capture_empty(snd_pcm_substream_t *substream) 750static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
775{ 751{
776 snd_pcm_runtime_t *runtime = substream->runtime; 752 struct snd_pcm_runtime *runtime = substream->runtime;
777 return snd_pcm_capture_avail(runtime) == 0; 753 return snd_pcm_capture_avail(runtime) == 0;
778} 754}
779 755
780static inline void snd_pcm_trigger_done(snd_pcm_substream_t *substream, 756static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
781 snd_pcm_substream_t *master) 757 struct snd_pcm_substream *master)
782{ 758{
783 substream->runtime->trigger_master = master; 759 substream->runtime->trigger_master = master;
784} 760}
@@ -795,28 +771,28 @@ static inline int hw_is_interval(int var)
795 var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; 771 var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
796} 772}
797 773
798static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params, 774static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
799 snd_pcm_hw_param_t var) 775 snd_pcm_hw_param_t var)
800{ 776{
801 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; 777 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
802} 778}
803 779
804static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params, 780static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
805 snd_pcm_hw_param_t var) 781 snd_pcm_hw_param_t var)
806{ 782{
807 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 783 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
808} 784}
809 785
810static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params, 786static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
811 snd_pcm_hw_param_t var) 787 snd_pcm_hw_param_t var)
812{ 788{
813 return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var); 789 return (const struct snd_mask *)hw_param_mask((struct snd_pcm_hw_params*) params, var);
814} 790}
815 791
816static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params, 792static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
817 snd_pcm_hw_param_t var) 793 snd_pcm_hw_param_t var)
818{ 794{
819 return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var); 795 return (const struct snd_interval *)hw_param_interval((struct snd_pcm_hw_params*) params, var);
820} 796}
821 797
822#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) 798#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))
@@ -832,66 +808,66 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_
832#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min 808#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min
833 809
834 810
835int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v); 811int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
836void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 812void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
837void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 813void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
838void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, 814void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
839 unsigned int k, snd_interval_t *c); 815 unsigned int k, struct snd_interval *c);
840void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, 816void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
841 const snd_interval_t *b, snd_interval_t *c); 817 const struct snd_interval *b, struct snd_interval *c);
842int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, unsigned int mask); 818int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask);
843int snd_interval_ratnum(snd_interval_t *i, 819int snd_interval_ratnum(struct snd_interval *i,
844 unsigned int rats_count, ratnum_t *rats, 820 unsigned int rats_count, struct snd_ratnum *rats,
845 unsigned int *nump, unsigned int *denp); 821 unsigned int *nump, unsigned int *denp);
846 822
847void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params); 823void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
848void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); 824void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
849int snd_pcm_hw_param_near(snd_pcm_substream_t *substream, 825int snd_pcm_hw_param_near(struct snd_pcm_substream *substream,
850 snd_pcm_hw_params_t *params, 826 struct snd_pcm_hw_params *params,
851 snd_pcm_hw_param_t var, 827 snd_pcm_hw_param_t var,
852 unsigned int val, int *dir); 828 unsigned int val, int *dir);
853int snd_pcm_hw_param_set(snd_pcm_substream_t *pcm, 829int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm,
854 snd_pcm_hw_params_t *params, 830 struct snd_pcm_hw_params *params,
855 snd_pcm_hw_param_t var, 831 snd_pcm_hw_param_t var,
856 unsigned int val, int dir); 832 unsigned int val, int dir);
857int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); 833int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
858 834
859int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); 835int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
860 836
861int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); 837int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);
862int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); 838int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);
863 839
864int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 840int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
865 u_int32_t mask); 841 u_int32_t mask);
866int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 842int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
867 u_int64_t mask); 843 u_int64_t mask);
868int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 844int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
869 unsigned int min, unsigned int max); 845 unsigned int min, unsigned int max);
870int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var); 846int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var);
871int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, 847int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
872 unsigned int cond, 848 unsigned int cond,
873 snd_pcm_hw_param_t var, 849 snd_pcm_hw_param_t var,
874 snd_pcm_hw_constraint_list_t *l); 850 struct snd_pcm_hw_constraint_list *l);
875int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, 851int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
876 unsigned int cond, 852 unsigned int cond,
877 snd_pcm_hw_param_t var, 853 snd_pcm_hw_param_t var,
878 snd_pcm_hw_constraint_ratnums_t *r); 854 struct snd_pcm_hw_constraint_ratnums *r);
879int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, 855int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
880 unsigned int cond, 856 unsigned int cond,
881 snd_pcm_hw_param_t var, 857 snd_pcm_hw_param_t var,
882 snd_pcm_hw_constraint_ratdens_t *r); 858 struct snd_pcm_hw_constraint_ratdens *r);
883int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, 859int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
884 unsigned int cond, 860 unsigned int cond,
885 unsigned int width, 861 unsigned int width,
886 unsigned int msbits); 862 unsigned int msbits);
887int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, 863int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
888 unsigned int cond, 864 unsigned int cond,
889 snd_pcm_hw_param_t var, 865 snd_pcm_hw_param_t var,
890 unsigned long step); 866 unsigned long step);
891int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, 867int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
892 unsigned int cond, 868 unsigned int cond,
893 snd_pcm_hw_param_t var); 869 snd_pcm_hw_param_t var);
894int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, 870int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,
895 unsigned int cond, 871 unsigned int cond,
896 int var, 872 int var,
897 snd_pcm_hw_rule_func_t func, void *private, 873 snd_pcm_hw_rule_func_t func, void *private,
@@ -925,37 +901,37 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int
925snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); 901snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian);
926const char *snd_pcm_format_name(snd_pcm_format_t format); 902const char *snd_pcm_format_name(snd_pcm_format_t format);
927 903
928void snd_pcm_set_ops(snd_pcm_t * pcm, int direction, snd_pcm_ops_t *ops); 904void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);
929void snd_pcm_set_sync(snd_pcm_substream_t * substream); 905void snd_pcm_set_sync(struct snd_pcm_substream *substream);
930int snd_pcm_lib_interleave_len(snd_pcm_substream_t *substream); 906int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
931int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream, 907int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
932 unsigned int cmd, void *arg); 908 unsigned int cmd, void *arg);
933int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream); 909int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
934int snd_pcm_playback_xrun_check(snd_pcm_substream_t *substream); 910int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
935int snd_pcm_capture_xrun_check(snd_pcm_substream_t *substream); 911int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
936int snd_pcm_playback_xrun_asap(snd_pcm_substream_t *substream); 912int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);
937int snd_pcm_capture_xrun_asap(snd_pcm_substream_t *substream); 913int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);
938void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t new_hw_ptr); 914void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
939void snd_pcm_tick_prepare(snd_pcm_substream_t *substream); 915void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);
940void snd_pcm_tick_set(snd_pcm_substream_t *substream, unsigned long ticks); 916void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);
941void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream); 917void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);
942void snd_pcm_period_elapsed(snd_pcm_substream_t *substream); 918void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
943snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, 919snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
944 const void __user *buf, 920 const void __user *buf,
945 snd_pcm_uframes_t frames); 921 snd_pcm_uframes_t frames);
946snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, 922snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream,
947 void __user *buf, snd_pcm_uframes_t frames); 923 void __user *buf, snd_pcm_uframes_t frames);
948snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, 924snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
949 void __user **bufs, snd_pcm_uframes_t frames); 925 void __user **bufs, snd_pcm_uframes_t frames);
950snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, 926snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
951 void __user **bufs, snd_pcm_uframes_t frames); 927 void __user **bufs, snd_pcm_uframes_t frames);
952 928
953int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime); 929int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
954 930
955static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream, 931static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,
956 struct snd_dma_buffer *bufp) 932 struct snd_dma_buffer *bufp)
957{ 933{
958 snd_pcm_runtime_t *runtime = substream->runtime; 934 struct snd_pcm_runtime *runtime = substream->runtime;
959 if (bufp) { 935 if (bufp) {
960 runtime->dma_buffer_p = bufp; 936 runtime->dma_buffer_p = bufp;
961 runtime->dma_area = bufp->area; 937 runtime->dma_area = bufp->area;
@@ -973,47 +949,47 @@ static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream,
973 * Timer interface 949 * Timer interface
974 */ 950 */
975 951
976void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream); 952void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
977void snd_pcm_timer_init(snd_pcm_substream_t * substream); 953void snd_pcm_timer_init(struct snd_pcm_substream *substream);
978void snd_pcm_timer_done(snd_pcm_substream_t * substream); 954void snd_pcm_timer_done(struct snd_pcm_substream *substream);
979 955
980/* 956/*
981 * Memory 957 * Memory
982 */ 958 */
983 959
984int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream); 960int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);
985int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm); 961int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);
986int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, 962int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
987 int type, struct device *data, 963 int type, struct device *data,
988 size_t size, size_t max); 964 size_t size, size_t max);
989int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, 965int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
990 int type, void *data, 966 int type, void *data,
991 size_t size, size_t max); 967 size_t size, size_t max);
992int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size); 968int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
993int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream); 969int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
994 970
995#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data) 971#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data)
996#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) 972#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)
997#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) 973#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)
998struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); 974struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);
999 975
1000/* handle mmap counter - PCM mmap callback should handle this counter properly */ 976/* handle mmap counter - PCM mmap callback should handle this counter properly */
1001static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 977static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
1002{ 978{
1003 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 979 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1004 atomic_inc(&substream->runtime->mmap_count); 980 atomic_inc(&substream->runtime->mmap_count);
1005} 981}
1006 982
1007static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) 983static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
1008{ 984{
1009 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 985 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1010 atomic_dec(&substream->runtime->mmap_count); 986 atomic_dec(&substream->runtime->mmap_count);
1011} 987}
1012 988
1013/* mmap for io-memory area */ 989/* mmap for io-memory area */
1014#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) 990#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
1015#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP 991#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP
1016int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area); 992int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area);
1017#else 993#else
1018#define SNDRV_PCM_INFO_MMAP_IOMEM 0 994#define SNDRV_PCM_INFO_MMAP_IOMEM 0
1019#define snd_pcm_lib_mmap_iomem NULL 995#define snd_pcm_lib_mmap_iomem NULL
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index 0b67c9d105af..fddaddde47b4 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -22,10 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25typedef struct _snd_pcm_plugin snd_pcm_plugin_t; 25struct snd_pcm_oss_setup {
26typedef struct _snd_pcm_oss_setup snd_pcm_oss_setup_t;
27
28struct _snd_pcm_oss_setup {
29 char *task_name; 26 char *task_name;
30 unsigned int disable:1, 27 unsigned int disable:1,
31 direct:1, 28 direct:1,
@@ -36,10 +33,10 @@ struct _snd_pcm_oss_setup {
36 buggyptr:1; 33 buggyptr:1;
37 unsigned int periods; 34 unsigned int periods;
38 unsigned int period_size; 35 unsigned int period_size;
39 snd_pcm_oss_setup_t *next; 36 struct snd_pcm_oss_setup *next;
40}; 37};
41 38
42typedef struct _snd_pcm_oss_runtime { 39struct snd_pcm_oss_runtime {
43 unsigned params: 1, /* format/parameter change */ 40 unsigned params: 1, /* format/parameter change */
44 prepare: 1, /* need to prepare the operation */ 41 prepare: 1, /* need to prepare the operation */
45 trigger: 1, /* trigger flag */ 42 trigger: 1, /* trigger flag */
@@ -59,30 +56,30 @@ typedef struct _snd_pcm_oss_runtime {
59 size_t mmap_bytes; 56 size_t mmap_bytes;
60 char *buffer; /* vmallocated period */ 57 char *buffer; /* vmallocated period */
61 size_t buffer_used; /* used length from period buffer */ 58 size_t buffer_used; /* used length from period buffer */
62 snd_pcm_plugin_t *plugin_first; 59 struct snd_pcm_plugin *plugin_first;
63 snd_pcm_plugin_t *plugin_last; 60 struct snd_pcm_plugin *plugin_last;
64 unsigned int prev_hw_ptr_interrupt; 61 unsigned int prev_hw_ptr_interrupt;
65} snd_pcm_oss_runtime_t; 62};
66 63
67typedef struct _snd_pcm_oss_file { 64struct snd_pcm_oss_file {
68 snd_pcm_substream_t *streams[2]; 65 struct snd_pcm_substream *streams[2];
69} snd_pcm_oss_file_t; 66};
70 67
71typedef struct _snd_pcm_oss_substream { 68struct snd_pcm_oss_substream {
72 unsigned oss: 1; /* oss mode */ 69 unsigned oss: 1; /* oss mode */
73 snd_pcm_oss_setup_t *setup; /* active setup */ 70 struct snd_pcm_oss_setup *setup; /* active setup */
74 snd_pcm_oss_file_t *file; 71 struct snd_pcm_oss_file *file;
75} snd_pcm_oss_substream_t; 72};
76 73
77typedef struct _snd_pcm_oss_stream { 74struct snd_pcm_oss_stream {
78 snd_pcm_oss_setup_t *setup_list; /* setup list */ 75 struct snd_pcm_oss_setup *setup_list; /* setup list */
79 struct semaphore setup_mutex; 76 struct semaphore setup_mutex;
80 snd_info_entry_t *proc_entry; 77 struct snd_info_entry *proc_entry;
81} snd_pcm_oss_stream_t; 78};
82 79
83typedef struct _snd_pcm_oss { 80struct snd_pcm_oss {
84 int reg; 81 int reg;
85 unsigned int reg_mask; 82 unsigned int reg_mask;
86} snd_pcm_oss_t; 83};
87 84
88#endif /* __SOUND_PCM_OSS_H */ 85#endif /* __SOUND_PCM_OSS_H */
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 60b0e92e26f3..fb18aef77341 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -22,17 +22,17 @@
22 * 22 *
23 */ 23 */
24 24
25extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params, 25extern int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
26 snd_pcm_hw_param_t var, const snd_mask_t *val); 26 snd_pcm_hw_param_t var, const struct snd_mask *val);
27extern unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, 27extern unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params,
28 snd_pcm_hw_param_t var, int *dir); 28 snd_pcm_hw_param_t var, int *dir);
29extern unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, 29extern unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
30 snd_pcm_hw_param_t var, int *dir); 30 snd_pcm_hw_param_t var, int *dir);
31extern int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, 31extern int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params,
32 snd_pcm_hw_param_t var, unsigned int val, int dir); 32 snd_pcm_hw_param_t var, unsigned int val, int dir);
33extern int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, 33extern int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params,
34 snd_pcm_hw_param_t var); 34 snd_pcm_hw_param_t var);
35extern int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, 35extern int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params,
36 snd_pcm_hw_param_t var, unsigned int val, int dir); 36 snd_pcm_hw_param_t var, unsigned int val, int dir);
37 37
38/* To share the same code we have alsa-lib */ 38/* To share the same code we have alsa-lib */
@@ -71,20 +71,20 @@ INLINE unsigned int ld2(u_int32_t v)
71 71
72INLINE size_t snd_mask_sizeof(void) 72INLINE size_t snd_mask_sizeof(void)
73{ 73{
74 return sizeof(snd_mask_t); 74 return sizeof(struct snd_mask);
75} 75}
76 76
77INLINE void snd_mask_none(snd_mask_t *mask) 77INLINE void snd_mask_none(struct snd_mask *mask)
78{ 78{
79 memset(mask, 0, sizeof(*mask)); 79 memset(mask, 0, sizeof(*mask));
80} 80}
81 81
82INLINE void snd_mask_any(snd_mask_t *mask) 82INLINE void snd_mask_any(struct snd_mask *mask)
83{ 83{
84 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 84 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t));
85} 85}
86 86
87INLINE int snd_mask_empty(const snd_mask_t *mask) 87INLINE int snd_mask_empty(const struct snd_mask *mask)
88{ 88{
89 int i; 89 int i;
90 for (i = 0; i < SNDRV_MASK_SIZE; i++) 90 for (i = 0; i < SNDRV_MASK_SIZE; i++)
@@ -93,7 +93,7 @@ INLINE int snd_mask_empty(const snd_mask_t *mask)
93 return 1; 93 return 1;
94} 94}
95 95
96INLINE unsigned int snd_mask_min(const snd_mask_t *mask) 96INLINE unsigned int snd_mask_min(const struct snd_mask *mask)
97{ 97{
98 int i; 98 int i;
99 assert(!snd_mask_empty(mask)); 99 assert(!snd_mask_empty(mask));
@@ -104,7 +104,7 @@ INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
104 return 0; 104 return 0;
105} 105}
106 106
107INLINE unsigned int snd_mask_max(const snd_mask_t *mask) 107INLINE unsigned int snd_mask_max(const struct snd_mask *mask)
108{ 108{
109 int i; 109 int i;
110 assert(!snd_mask_empty(mask)); 110 assert(!snd_mask_empty(mask));
@@ -115,19 +115,19 @@ INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
115 return 0; 115 return 0;
116} 116}
117 117
118INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val) 118INLINE void snd_mask_set(struct snd_mask *mask, unsigned int val)
119{ 119{
120 assert(val <= SNDRV_MASK_BITS); 120 assert(val <= SNDRV_MASK_BITS);
121 mask->bits[MASK_OFS(val)] |= MASK_BIT(val); 121 mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
122} 122}
123 123
124INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val) 124INLINE void snd_mask_reset(struct snd_mask *mask, unsigned int val)
125{ 125{
126 assert(val <= SNDRV_MASK_BITS); 126 assert(val <= SNDRV_MASK_BITS);
127 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); 127 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
128} 128}
129 129
130INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to) 130INLINE void snd_mask_set_range(struct snd_mask *mask, unsigned int from, unsigned int to)
131{ 131{
132 unsigned int i; 132 unsigned int i;
133 assert(to <= SNDRV_MASK_BITS && from <= to); 133 assert(to <= SNDRV_MASK_BITS && from <= to);
@@ -135,7 +135,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int
135 mask->bits[MASK_OFS(i)] |= MASK_BIT(i); 135 mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
136} 136}
137 137
138INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to) 138INLINE void snd_mask_reset_range(struct snd_mask *mask, unsigned int from, unsigned int to)
139{ 139{
140 unsigned int i; 140 unsigned int i;
141 assert(to <= SNDRV_MASK_BITS && from <= to); 141 assert(to <= SNDRV_MASK_BITS && from <= to);
@@ -143,7 +143,7 @@ INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned i
143 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); 143 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
144} 144}
145 145
146INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) 146INLINE void snd_mask_leave(struct snd_mask *mask, unsigned int val)
147{ 147{
148 unsigned int v; 148 unsigned int v;
149 assert(val <= SNDRV_MASK_BITS); 149 assert(val <= SNDRV_MASK_BITS);
@@ -152,30 +152,30 @@ INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
152 mask->bits[MASK_OFS(val)] = v; 152 mask->bits[MASK_OFS(val)] = v;
153} 153}
154 154
155INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v) 155INLINE void snd_mask_intersect(struct snd_mask *mask, const struct snd_mask *v)
156{ 156{
157 int i; 157 int i;
158 for (i = 0; i < SNDRV_MASK_SIZE; i++) 158 for (i = 0; i < SNDRV_MASK_SIZE; i++)
159 mask->bits[i] &= v->bits[i]; 159 mask->bits[i] &= v->bits[i];
160} 160}
161 161
162INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v) 162INLINE int snd_mask_eq(const struct snd_mask *mask, const struct snd_mask *v)
163{ 163{
164 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 164 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t));
165} 165}
166 166
167INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v) 167INLINE void snd_mask_copy(struct snd_mask *mask, const struct snd_mask *v)
168{ 168{
169 *mask = *v; 169 *mask = *v;
170} 170}
171 171
172INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val) 172INLINE int snd_mask_test(const struct snd_mask *mask, unsigned int val)
173{ 173{
174 assert(val <= SNDRV_MASK_BITS); 174 assert(val <= SNDRV_MASK_BITS);
175 return mask->bits[MASK_OFS(val)] & MASK_BIT(val); 175 return mask->bits[MASK_OFS(val)] & MASK_BIT(val);
176} 176}
177 177
178INLINE int snd_mask_single(const snd_mask_t *mask) 178INLINE int snd_mask_single(const struct snd_mask *mask)
179{ 179{
180 int i, c = 0; 180 int i, c = 0;
181 assert(!snd_mask_empty(mask)); 181 assert(!snd_mask_empty(mask));
@@ -191,9 +191,9 @@ INLINE int snd_mask_single(const snd_mask_t *mask)
191 return 1; 191 return 1;
192} 192}
193 193
194INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) 194INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v)
195{ 195{
196 snd_mask_t old; 196 struct snd_mask old;
197 assert(!snd_mask_empty(mask)); 197 assert(!snd_mask_empty(mask));
198 snd_mask_copy(&old, mask); 198 snd_mask_copy(&old, mask);
199 snd_mask_intersect(mask, v); 199 snd_mask_intersect(mask, v);
@@ -202,7 +202,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
202 return !snd_mask_eq(mask, &old); 202 return !snd_mask_eq(mask, &old);
203} 203}
204 204
205INLINE int snd_mask_refine_first(snd_mask_t *mask) 205INLINE int snd_mask_refine_first(struct snd_mask *mask)
206{ 206{
207 assert(!snd_mask_empty(mask)); 207 assert(!snd_mask_empty(mask));
208 if (snd_mask_single(mask)) 208 if (snd_mask_single(mask))
@@ -211,7 +211,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask)
211 return 1; 211 return 1;
212} 212}
213 213
214INLINE int snd_mask_refine_last(snd_mask_t *mask) 214INLINE int snd_mask_refine_last(struct snd_mask *mask)
215{ 215{
216 assert(!snd_mask_empty(mask)); 216 assert(!snd_mask_empty(mask));
217 if (snd_mask_single(mask)) 217 if (snd_mask_single(mask))
@@ -220,7 +220,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask)
220 return 1; 220 return 1;
221} 221}
222 222
223INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val) 223INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val)
224{ 224{
225 assert(!snd_mask_empty(mask)); 225 assert(!snd_mask_empty(mask));
226 if (snd_mask_min(mask) >= val) 226 if (snd_mask_min(mask) >= val)
@@ -231,7 +231,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
231 return 1; 231 return 1;
232} 232}
233 233
234INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) 234INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val)
235{ 235{
236 assert(!snd_mask_empty(mask)); 236 assert(!snd_mask_empty(mask));
237 if (snd_mask_max(mask) <= val) 237 if (snd_mask_max(mask) <= val)
@@ -242,7 +242,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
242 return 1; 242 return 1;
243} 243}
244 244
245INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val) 245INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val)
246{ 246{
247 int changed; 247 int changed;
248 assert(!snd_mask_empty(mask)); 248 assert(!snd_mask_empty(mask));
@@ -253,13 +253,13 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
253 return changed; 253 return changed;
254} 254}
255 255
256INLINE int snd_mask_value(const snd_mask_t *mask) 256INLINE int snd_mask_value(const struct snd_mask *mask)
257{ 257{
258 assert(!snd_mask_empty(mask)); 258 assert(!snd_mask_empty(mask));
259 return snd_mask_min(mask); 259 return snd_mask_min(mask);
260} 260}
261 261
262INLINE void snd_interval_any(snd_interval_t *i) 262INLINE void snd_interval_any(struct snd_interval *i)
263{ 263{
264 i->min = 0; 264 i->min = 0;
265 i->openmin = 0; 265 i->openmin = 0;
@@ -269,42 +269,42 @@ INLINE void snd_interval_any(snd_interval_t *i)
269 i->empty = 0; 269 i->empty = 0;
270} 270}
271 271
272INLINE void snd_interval_none(snd_interval_t *i) 272INLINE void snd_interval_none(struct snd_interval *i)
273{ 273{
274 i->empty = 1; 274 i->empty = 1;
275} 275}
276 276
277INLINE int snd_interval_checkempty(const snd_interval_t *i) 277INLINE int snd_interval_checkempty(const struct snd_interval *i)
278{ 278{
279 return (i->min > i->max || 279 return (i->min > i->max ||
280 (i->min == i->max && (i->openmin || i->openmax))); 280 (i->min == i->max && (i->openmin || i->openmax)));
281} 281}
282 282
283INLINE int snd_interval_empty(const snd_interval_t *i) 283INLINE int snd_interval_empty(const struct snd_interval *i)
284{ 284{
285 return i->empty; 285 return i->empty;
286} 286}
287 287
288INLINE int snd_interval_single(const snd_interval_t *i) 288INLINE int snd_interval_single(const struct snd_interval *i)
289{ 289{
290 assert(!snd_interval_empty(i)); 290 assert(!snd_interval_empty(i));
291 return (i->min == i->max || 291 return (i->min == i->max ||
292 (i->min + 1 == i->max && i->openmax)); 292 (i->min + 1 == i->max && i->openmax));
293} 293}
294 294
295INLINE int snd_interval_value(const snd_interval_t *i) 295INLINE int snd_interval_value(const struct snd_interval *i)
296{ 296{
297 assert(snd_interval_single(i)); 297 assert(snd_interval_single(i));
298 return i->min; 298 return i->min;
299} 299}
300 300
301INLINE int snd_interval_min(const snd_interval_t *i) 301INLINE int snd_interval_min(const struct snd_interval *i)
302{ 302{
303 assert(!snd_interval_empty(i)); 303 assert(!snd_interval_empty(i));
304 return i->min; 304 return i->min;
305} 305}
306 306
307INLINE int snd_interval_max(const snd_interval_t *i) 307INLINE int snd_interval_max(const struct snd_interval *i)
308{ 308{
309 unsigned int v; 309 unsigned int v;
310 assert(!snd_interval_empty(i)); 310 assert(!snd_interval_empty(i));
@@ -314,18 +314,18 @@ INLINE int snd_interval_max(const snd_interval_t *i)
314 return v; 314 return v;
315} 315}
316 316
317INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val) 317INLINE int snd_interval_test(const struct snd_interval *i, unsigned int val)
318{ 318{
319 return !((i->min > val || (i->min == val && i->openmin) || 319 return !((i->min > val || (i->min == val && i->openmin) ||
320 i->max < val || (i->max == val && i->openmax))); 320 i->max < val || (i->max == val && i->openmax)));
321} 321}
322 322
323INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s) 323INLINE void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s)
324{ 324{
325 *d = *s; 325 *d = *s;
326} 326}
327 327
328INLINE int snd_interval_setinteger(snd_interval_t *i) 328INLINE int snd_interval_setinteger(struct snd_interval *i)
329{ 329{
330 if (i->integer) 330 if (i->integer)
331 return 0; 331 return 0;
@@ -335,7 +335,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i)
335 return 1; 335 return 1;
336} 336}
337 337
338INLINE int snd_interval_eq(const snd_interval_t *i1, const snd_interval_t *i2) 338INLINE int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2)
339{ 339{
340 if (i1->empty) 340 if (i1->empty)
341 return i2->empty; 341 return i2->empty;
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 3f9db510dee3..d19bddfbf995 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -36,11 +36,6 @@
36 * Raw MIDI interface 36 * Raw MIDI interface
37 */ 37 */
38 38
39typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
40typedef struct sndrv_rawmidi_info snd_rawmidi_info_t;
41typedef struct sndrv_rawmidi_params snd_rawmidi_params_t;
42typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
43
44#define SNDRV_RAWMIDI_DEVICES 8 39#define SNDRV_RAWMIDI_DEVICES 8
45 40
46#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) 41#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0)
@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
49#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) 44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
50#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) 45#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
51 46
52typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; 47struct snd_rawmidi;
53typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; 48struct snd_rawmidi_substream;
54typedef struct _snd_rawmidi_str snd_rawmidi_str_t;
55 49
56typedef struct _snd_rawmidi_ops { 50struct snd_rawmidi_ops {
57 int (*open) (snd_rawmidi_substream_t * substream); 51 int (*open) (struct snd_rawmidi_substream * substream);
58 int (*close) (snd_rawmidi_substream_t * substream); 52 int (*close) (struct snd_rawmidi_substream * substream);
59 void (*trigger) (snd_rawmidi_substream_t * substream, int up); 53 void (*trigger) (struct snd_rawmidi_substream * substream, int up);
60 void (*drain) (snd_rawmidi_substream_t * substream); 54 void (*drain) (struct snd_rawmidi_substream * substream);
61} snd_rawmidi_ops_t; 55};
62 56
63typedef struct _snd_rawmidi_global_ops { 57struct snd_rawmidi_global_ops {
64 int (*dev_register) (snd_rawmidi_t * rmidi); 58 int (*dev_register) (struct snd_rawmidi * rmidi);
65 int (*dev_unregister) (snd_rawmidi_t * rmidi); 59 int (*dev_unregister) (struct snd_rawmidi * rmidi);
66} snd_rawmidi_global_ops_t; 60};
67 61
68struct _snd_rawmidi_runtime { 62struct snd_rawmidi_runtime {
69 unsigned int drain: 1, /* drain stage */ 63 unsigned int drain: 1, /* drain stage */
70 oss: 1; /* OSS compatible mode */ 64 oss: 1; /* OSS compatible mode */
71 /* midi stream buffer */ 65 /* midi stream buffer */
@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime {
80 spinlock_t lock; 74 spinlock_t lock;
81 wait_queue_head_t sleep; 75 wait_queue_head_t sleep;
82 /* event handler (new bytes, input only) */ 76 /* event handler (new bytes, input only) */
83 void (*event)(snd_rawmidi_substream_t *substream); 77 void (*event)(struct snd_rawmidi_substream *substream);
84 /* defers calls to event [input] or ops->trigger [output] */ 78 /* defers calls to event [input] or ops->trigger [output] */
85 struct tasklet_struct tasklet; 79 struct tasklet_struct tasklet;
86 /* private data */ 80 /* private data */
87 void *private_data; 81 void *private_data;
88 void (*private_free)(snd_rawmidi_substream_t *substream); 82 void (*private_free)(struct snd_rawmidi_substream *substream);
89}; 83};
90 84
91struct _snd_rawmidi_substream { 85struct snd_rawmidi_substream {
92 struct list_head list; /* list of all substream for given stream */ 86 struct list_head list; /* list of all substream for given stream */
93 int stream; /* direction */ 87 int stream; /* direction */
94 int number; /* substream number */ 88 int number; /* substream number */
@@ -97,29 +91,29 @@ struct _snd_rawmidi_substream {
97 active_sensing: 1; /* send active sensing when close */ 91 active_sensing: 1; /* send active sensing when close */
98 int use_count; /* use counter (for output) */ 92 int use_count; /* use counter (for output) */
99 size_t bytes; 93 size_t bytes;
100 snd_rawmidi_t *rmidi; 94 struct snd_rawmidi *rmidi;
101 snd_rawmidi_str_t *pstr; 95 struct snd_rawmidi_str *pstr;
102 char name[32]; 96 char name[32];
103 snd_rawmidi_runtime_t *runtime; 97 struct snd_rawmidi_runtime *runtime;
104 /* hardware layer */ 98 /* hardware layer */
105 snd_rawmidi_ops_t *ops; 99 struct snd_rawmidi_ops *ops;
106}; 100};
107 101
108typedef struct _snd_rawmidi_file { 102struct snd_rawmidi_file {
109 snd_rawmidi_t *rmidi; 103 struct snd_rawmidi *rmidi;
110 snd_rawmidi_substream_t *input; 104 struct snd_rawmidi_substream *input;
111 snd_rawmidi_substream_t *output; 105 struct snd_rawmidi_substream *output;
112} snd_rawmidi_file_t; 106};
113 107
114struct _snd_rawmidi_str { 108struct snd_rawmidi_str {
115 unsigned int substream_count; 109 unsigned int substream_count;
116 unsigned int substream_opened; 110 unsigned int substream_opened;
117 struct list_head substreams; 111 struct list_head substreams;
118}; 112};
119 113
120struct _snd_rawmidi { 114struct snd_rawmidi {
121 snd_card_t *card; 115 struct snd_card *card;
122 116 struct list_head list;
123 unsigned int device; /* device number */ 117 unsigned int device; /* device number */
124 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 118 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */
125 char id[64]; 119 char id[64];
@@ -129,52 +123,61 @@ struct _snd_rawmidi {
129 int ossreg; 123 int ossreg;
130#endif 124#endif
131 125
132 snd_rawmidi_global_ops_t *ops; 126 struct snd_rawmidi_global_ops *ops;
133 127
134 snd_rawmidi_str_t streams[2]; 128 struct snd_rawmidi_str streams[2];
135 129
136 void *private_data; 130 void *private_data;
137 void (*private_free) (snd_rawmidi_t *rmidi); 131 void (*private_free) (struct snd_rawmidi *rmidi);
138 132
139 struct semaphore open_mutex; 133 struct semaphore open_mutex;
140 wait_queue_head_t open_wait; 134 wait_queue_head_t open_wait;
141 135
142 snd_info_entry_t *dev; 136 struct snd_info_entry *dev;
143 snd_info_entry_t *proc_entry; 137 struct snd_info_entry *proc_entry;
144 138
145#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 139#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
146 snd_seq_device_t *seq_dev; 140 struct snd_seq_device *seq_dev;
147#endif 141#endif
148}; 142};
149 143
150/* main rawmidi functions */ 144/* main rawmidi functions */
151 145
152int snd_rawmidi_new(snd_card_t * card, char *id, int device, 146int snd_rawmidi_new(struct snd_card *card, char *id, int device,
153 int output_count, int input_count, 147 int output_count, int input_count,
154 snd_rawmidi_t ** rmidi); 148 struct snd_rawmidi **rmidi);
155void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops); 149void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
150 struct snd_rawmidi_ops *ops);
156 151
157/* callbacks */ 152/* callbacks */
158 153
159void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream); 154void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
160int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count); 155int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
161void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream); 156 const unsigned char *buffer, int count);
162int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream); 157void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
163int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 158int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
164int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count); 159int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
165int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 160 unsigned char *buffer, int count);
161int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count);
162int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
163 unsigned char *buffer, int count);
166 164
167/* main midi functions */ 165/* main midi functions */
168 166
169int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info); 167int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info);
170int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile); 168int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice,
171int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile); 169 int mode, struct snd_rawmidi_file *rfile);
172int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 170int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile);
173int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 171int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
174int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream); 172 struct snd_rawmidi_params *params);
175int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream); 173int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
176int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream); 174 struct snd_rawmidi_params *params);
177long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count); 175int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count); 176int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream);
177int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
179 unsigned char *buf, long count);
180long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
181 const unsigned char *buf, long count);
179 182
180#endif /* __SOUND_RAWMIDI_H */ 183#endif /* __SOUND_RAWMIDI_H */
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 7960452445e6..431d06675e36 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -60,7 +60,7 @@ enum sb_hw_type {
60 60
61#define SB_MPU_INPUT 1 61#define SB_MPU_INPUT 1
62 62
63struct _snd_sb { 63struct snd_sb {
64 unsigned long port; /* base port of DSP chip */ 64 unsigned long port; /* base port of DSP chip */
65 struct resource *res_port; 65 struct resource *res_port;
66 unsigned long mpu_port; /* MPU port for SB DSP 4.0+ */ 66 unsigned long mpu_port; /* MPU port for SB DSP 4.0+ */
@@ -92,24 +92,26 @@ struct _snd_sb {
92 92
93 void *csp; /* used only when CONFIG_SND_SB16_CSP is set */ 93 void *csp; /* used only when CONFIG_SND_SB16_CSP is set */
94 94
95 snd_card_t *card; 95 struct snd_card *card;
96 snd_pcm_t *pcm; 96 struct snd_pcm *pcm;
97 snd_pcm_substream_t *playback_substream; 97 struct snd_pcm_substream *playback_substream;
98 snd_pcm_substream_t *capture_substream; 98 struct snd_pcm_substream *capture_substream;
99 99
100 snd_rawmidi_t *rmidi; 100 struct snd_rawmidi *rmidi;
101 snd_rawmidi_substream_t *midi_substream_input; 101 struct snd_rawmidi_substream *midi_substream_input;
102 snd_rawmidi_substream_t *midi_substream_output; 102 struct snd_rawmidi_substream *midi_substream_output;
103 irqreturn_t (*rmidi_callback)(int irq, void *dev_id, struct pt_regs *regs); 103 irqreturn_t (*rmidi_callback)(int irq, void *dev_id, struct pt_regs *regs);
104 104
105 spinlock_t reg_lock; 105 spinlock_t reg_lock;
106 spinlock_t open_lock; 106 spinlock_t open_lock;
107 spinlock_t midi_input_lock; 107 spinlock_t midi_input_lock;
108 108
109 snd_info_entry_t *proc_entry; 109 struct snd_info_entry *proc_entry;
110};
111 110
112typedef struct _snd_sb sb_t; 111#ifdef CONFIG_PM
112 unsigned char saved_regs[0x20];
113#endif
114};
113 115
114/* I/O ports */ 116/* I/O ports */
115 117
@@ -267,48 +269,52 @@ typedef struct _snd_sb sb_t;
267 * 269 *
268 */ 270 */
269 271
270static inline void snd_sb_ack_8bit(sb_t *chip) 272static inline void snd_sb_ack_8bit(struct snd_sb *chip)
271{ 273{
272 inb(SBP(chip, DATA_AVAIL)); 274 inb(SBP(chip, DATA_AVAIL));
273} 275}
274 276
275static inline void snd_sb_ack_16bit(sb_t *chip) 277static inline void snd_sb_ack_16bit(struct snd_sb *chip)
276{ 278{
277 inb(SBP(chip, DATA_AVAIL_16)); 279 inb(SBP(chip, DATA_AVAIL_16));
278} 280}
279 281
280/* sb_common.c */ 282/* sb_common.c */
281int snd_sbdsp_command(sb_t *chip, unsigned char val); 283int snd_sbdsp_command(struct snd_sb *chip, unsigned char val);
282int snd_sbdsp_get_byte(sb_t *chip); 284int snd_sbdsp_get_byte(struct snd_sb *chip);
283int snd_sbdsp_reset(sb_t *chip); 285int snd_sbdsp_reset(struct snd_sb *chip);
284int snd_sbdsp_create(snd_card_t *card, 286int snd_sbdsp_create(struct snd_card *card,
285 unsigned long port, 287 unsigned long port,
286 int irq, 288 int irq,
287 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *), 289 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *),
288 int dma8, int dma16, 290 int dma8, int dma16,
289 unsigned short hardware, 291 unsigned short hardware,
290 sb_t **r_chip); 292 struct snd_sb **r_chip);
291/* sb_mixer.c */ 293/* sb_mixer.c */
292void snd_sbmixer_write(sb_t *chip, unsigned char reg, unsigned char data); 294void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char data);
293unsigned char snd_sbmixer_read(sb_t *chip, unsigned char reg); 295unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg);
294int snd_sbmixer_new(sb_t *chip); 296int snd_sbmixer_new(struct snd_sb *chip);
297#ifdef CONFIG_PM
298void snd_sbmixer_suspend(struct snd_sb *chip);
299void snd_sbmixer_resume(struct snd_sb *chip);
300#endif
295 301
296/* sb8_init.c */ 302/* sb8_init.c */
297int snd_sb8dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); 303int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
298/* sb8.c */ 304/* sb8.c */
299irqreturn_t snd_sb8dsp_interrupt(sb_t *chip); 305irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip);
300int snd_sb8_playback_open(snd_pcm_substream_t *substream); 306int snd_sb8_playback_open(struct snd_pcm_substream *substream);
301int snd_sb8_capture_open(snd_pcm_substream_t *substream); 307int snd_sb8_capture_open(struct snd_pcm_substream *substream);
302int snd_sb8_playback_close(snd_pcm_substream_t *substream); 308int snd_sb8_playback_close(struct snd_pcm_substream *substream);
303int snd_sb8_capture_close(snd_pcm_substream_t *substream); 309int snd_sb8_capture_close(struct snd_pcm_substream *substream);
304/* midi8.c */ 310/* midi8.c */
305irqreturn_t snd_sb8dsp_midi_interrupt(sb_t *chip); 311irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
306int snd_sb8dsp_midi(sb_t *chip, int device, snd_rawmidi_t ** rrawmidi); 312int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawmidi);
307 313
308/* sb16_init.c */ 314/* sb16_init.c */
309int snd_sb16dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); 315int snd_sb16dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
310const snd_pcm_ops_t *snd_sb16dsp_get_pcm_ops(int direction); 316const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
311int snd_sb16dsp_configure(sb_t *chip); 317int snd_sb16dsp_configure(struct snd_sb *chip);
312/* sb16.c */ 318/* sb16.c */
313irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs); 319irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs);
314 320
@@ -328,7 +334,7 @@ enum {
328#define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \ 334#define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \
329 ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24)) 335 ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24))
330 336
331int snd_sbmixer_add_ctl(sb_t *chip, const char *name, int index, int type, unsigned long value); 337int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value);
332 338
333/* for ease of use */ 339/* for ease of use */
334struct sbmix_elem { 340struct sbmix_elem {
@@ -352,7 +358,7 @@ struct sbmix_elem {
352 .type = SB_MIX_INPUT_SW, \ 358 .type = SB_MIX_INPUT_SW, \
353 .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) } 359 .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) }
354 360
355static inline int snd_sbmixer_add_ctl_elem(sb_t *chip, const struct sbmix_elem *c) 361static inline int snd_sbmixer_add_ctl_elem(struct snd_sb *chip, const struct sbmix_elem *c)
356{ 362{
357 return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value); 363 return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value);
358} 364}
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index eb8368b56b16..3b44d4b370f5 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -63,25 +63,25 @@
63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
64 64
65/* microcode header */ 65/* microcode header */
66typedef struct snd_sb_csp_mc_header { 66struct snd_sb_csp_mc_header {
67 char codec_name[16]; /* id name of codec */ 67 char codec_name[16]; /* id name of codec */
68 unsigned short func_req; /* requested function */ 68 unsigned short func_req; /* requested function */
69} snd_sb_csp_mc_header_t; 69};
70 70
71/* microcode to be loaded */ 71/* microcode to be loaded */
72typedef struct snd_sb_csp_microcode { 72struct snd_sb_csp_microcode {
73 snd_sb_csp_mc_header_t info; 73 struct snd_sb_csp_mc_header info;
74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; 74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
75} snd_sb_csp_microcode_t; 75};
76 76
77/* start CSP with sample_width in mono/stereo */ 77/* start CSP with sample_width in mono/stereo */
78typedef struct snd_sb_csp_start { 78struct snd_sb_csp_start {
79 int sample_width; /* sample width, look above */ 79 int sample_width; /* sample width, look above */
80 int channels; /* channels, look above */ 80 int channels; /* channels, look above */
81} snd_sb_csp_start_t; 81};
82 82
83/* CSP information */ 83/* CSP information */
84typedef struct snd_sb_csp_info { 84struct snd_sb_csp_info {
85 char codec_name[16]; /* id name of codec */ 85 char codec_name[16]; /* id name of codec */
86 unsigned short func_nr; /* function number */ 86 unsigned short func_nr; /* function number */
87 unsigned int acc_format; /* accepted PCM formats */ 87 unsigned int acc_format; /* accepted PCM formats */
@@ -93,17 +93,17 @@ typedef struct snd_sb_csp_info {
93 unsigned short run_width; /* current sample width */ 93 unsigned short run_width; /* current sample width */
94 unsigned short version; /* version id: 0x10 - 0x1f */ 94 unsigned short version; /* version id: 0x10 - 0x1f */
95 unsigned short state; /* state bits */ 95 unsigned short state; /* state bits */
96} snd_sb_csp_info_t; 96};
97 97
98/* HWDEP controls */ 98/* HWDEP controls */
99/* get CSP information */ 99/* get CSP information */
100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, snd_sb_csp_info_t) 100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
101/* load microcode to CSP */ 101/* load microcode to CSP */
102#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, snd_sb_csp_microcode_t) 102#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, struct snd_sb_csp_microcode)
103/* unload microcode from CSP */ 103/* unload microcode from CSP */
104#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) 104#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
105/* start CSP */ 105/* start CSP */
106#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, snd_sb_csp_start_t) 106#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
107/* stop CSP */ 107/* stop CSP */
108#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) 108#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
109/* pause CSP and DMA transfer */ 109/* pause CSP and DMA transfer */
@@ -115,25 +115,25 @@ typedef struct snd_sb_csp_info {
115#include "sb.h" 115#include "sb.h"
116#include "hwdep.h" 116#include "hwdep.h"
117 117
118typedef struct snd_sb_csp snd_sb_csp_t; 118struct snd_sb_csp;
119 119
120/* 120/*
121 * CSP operators 121 * CSP operators
122 */ 122 */
123typedef struct { 123struct snd_sb_csp_ops {
124 int (*csp_use) (snd_sb_csp_t * p); 124 int (*csp_use) (struct snd_sb_csp * p);
125 int (*csp_unuse) (snd_sb_csp_t * p); 125 int (*csp_unuse) (struct snd_sb_csp * p);
126 int (*csp_autoload) (snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode); 126 int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);
127 int (*csp_start) (snd_sb_csp_t * p, int sample_width, int channels); 127 int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
128 int (*csp_stop) (snd_sb_csp_t * p); 128 int (*csp_stop) (struct snd_sb_csp * p);
129 int (*csp_qsound_transfer) (snd_sb_csp_t * p); 129 int (*csp_qsound_transfer) (struct snd_sb_csp * p);
130} snd_sb_csp_ops_t; 130};
131 131
132/* 132/*
133 * CSP private data 133 * CSP private data
134 */ 134 */
135struct snd_sb_csp { 135struct snd_sb_csp {
136 sb_t *chip; /* SB16 DSP */ 136 struct snd_sb *chip; /* SB16 DSP */
137 int used; /* usage flag - exclusive */ 137 int used; /* usage flag - exclusive */
138 char codec_name[16]; /* name of codec */ 138 char codec_name[16]; /* name of codec */
139 unsigned short func_nr; /* function number */ 139 unsigned short func_nr; /* function number */
@@ -147,7 +147,7 @@ struct snd_sb_csp {
147 int version; /* CSP version (0x10 - 0x1f) */ 147 int version; /* CSP version (0x10 - 0x1f) */
148 int running; /* running state */ 148 int running; /* running state */
149 149
150 snd_sb_csp_ops_t ops; /* operators */ 150 struct snd_sb_csp_ops ops; /* operators */
151 151
152 spinlock_t q_lock; /* locking */ 152 spinlock_t q_lock; /* locking */
153 int q_enabled; /* enabled flag */ 153 int q_enabled; /* enabled flag */
@@ -155,13 +155,13 @@ struct snd_sb_csp {
155 int qpos_right; /* right position */ 155 int qpos_right; /* right position */
156 int qpos_changed; /* position changed flag */ 156 int qpos_changed; /* position changed flag */
157 157
158 snd_kcontrol_t *qsound_switch; 158 struct snd_kcontrol *qsound_switch;
159 snd_kcontrol_t *qsound_space; 159 struct snd_kcontrol *qsound_space;
160 160
161 struct semaphore access_mutex; /* locking */ 161 struct semaphore access_mutex; /* locking */
162}; 162};
163 163
164int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep); 164int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
165#endif 165#endif
166 166
167#endif /* __SOUND_SB16_CSP */ 167#endif /* __SOUND_SB16_CSP */
diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h
index 204ca540c28e..2b5f24cc7548 100644
--- a/include/sound/seq_device.h
+++ b/include/sound/seq_device.h
@@ -21,9 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24typedef struct snd_seq_device snd_seq_device_t;
25typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
26
27/* 24/*
28 * registered device information 25 * registered device information
29 */ 26 */
@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
36 33
37struct snd_seq_device { 34struct snd_seq_device {
38 /* device info */ 35 /* device info */
39 snd_card_t *card; /* sound card */ 36 struct snd_card *card; /* sound card */
40 int device; /* device number */ 37 int device; /* device number */
41 char id[ID_LEN]; /* driver id */ 38 char id[ID_LEN]; /* driver id */
42 char name[80]; /* device name */ 39 char name[80]; /* device name */
@@ -44,7 +41,7 @@ struct snd_seq_device {
44 void *driver_data; /* private data for driver */ 41 void *driver_data; /* private data for driver */
45 int status; /* flag - read only */ 42 int status; /* flag - read only */
46 void *private_data; /* private data for the caller */ 43 void *private_data; /* private data for the caller */
47 void (*private_free)(snd_seq_device_t *device); 44 void (*private_free)(struct snd_seq_device *device);
48 struct list_head list; /* link to next device */ 45 struct list_head list; /* link to next device */
49}; 46};
50 47
@@ -63,19 +60,19 @@ struct snd_seq_device {
63 * Typically, call snd_device_free(dev->card, dev->driver_data) 60 * Typically, call snd_device_free(dev->card, dev->driver_data)
64 */ 61 */
65struct snd_seq_dev_ops { 62struct snd_seq_dev_ops {
66 int (*init_device)(snd_seq_device_t *dev); 63 int (*init_device)(struct snd_seq_device *dev);
67 int (*free_device)(snd_seq_device_t *dev); 64 int (*free_device)(struct snd_seq_device *dev);
68}; 65};
69 66
70/* 67/*
71 * prototypes 68 * prototypes
72 */ 69 */
73void snd_seq_device_load_drivers(void); 70void snd_seq_device_load_drivers(void);
74int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result); 71int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
75int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize); 72int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
76int snd_seq_device_unregister_driver(char *id); 73int snd_seq_device_unregister_driver(char *id);
77 74
78#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t)) 75#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
79 76
80 77
81/* 78/*
@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id);
84#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" 81#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
85#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" 82#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
86 83
87
88#endif /* __SOUND_SEQ_DEVICE_H */ 84#endif /* __SOUND_SEQ_DEVICE_H */
diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h
index 1a654df4aa97..db764f09efb7 100644
--- a/include/sound/seq_instr.h
+++ b/include/sound/seq_instr.h
@@ -24,29 +24,27 @@
24#include "seq_kernel.h" 24#include "seq_kernel.h"
25 25
26/* Instrument cluster */ 26/* Instrument cluster */
27typedef struct _snd_seq_kcluster { 27struct snd_seq_kcluster {
28 snd_seq_instr_cluster_t cluster; 28 snd_seq_instr_cluster_t cluster;
29 char name[32]; 29 char name[32];
30 int priority; 30 int priority;
31 struct _snd_seq_kcluster *next; 31 struct snd_seq_kcluster *next;
32} snd_seq_kcluster_t; 32};
33 33
34/* return pointer to private data */ 34/* return pointer to private data */
35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) 35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
36
37typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
38 36
39/* Instrument structure */ 37/* Instrument structure */
40typedef struct _snd_seq_kinstr { 38struct snd_seq_kinstr {
41 snd_seq_instr_t instr; 39 struct snd_seq_instr instr;
42 char name[32]; 40 char name[32];
43 int type; /* instrument type */ 41 int type; /* instrument type */
44 int use; /* use count */ 42 int use; /* use count */
45 int busy; /* not useable */ 43 int busy; /* not useable */
46 int add_len; /* additional length */ 44 int add_len; /* additional length */
47 snd_seq_kinstr_ops_t *ops; /* operations */ 45 struct snd_seq_kinstr_ops *ops; /* operations */
48 struct _snd_seq_kinstr *next; 46 struct snd_seq_kinstr *next;
49} snd_seq_kinstr_t; 47};
50 48
51#define SNDRV_SEQ_INSTR_HASH_SIZE 32 49#define SNDRV_SEQ_INSTR_HASH_SIZE 32
52 50
@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr {
54#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ 52#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
55 53
56/* List of all instruments */ 54/* List of all instruments */
57typedef struct { 55struct snd_seq_kinstr_list {
58 snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; 56 struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
59 int count; /* count of all instruments */ 57 int count; /* count of all instruments */
60 58
61 snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; 59 struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
62 int ccount; /* count of all clusters */ 60 int ccount; /* count of all clusters */
63 61
64 int owner; /* current owner of the instrument list */ 62 int owner; /* current owner of the instrument list */
@@ -68,7 +66,7 @@ typedef struct {
68 spinlock_t ops_lock; 66 spinlock_t ops_lock;
69 struct semaphore ops_mutex; 67 struct semaphore ops_mutex;
70 unsigned long ops_flags; 68 unsigned long ops_flags;
71} snd_seq_kinstr_list_t; 69};
72 70
73#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 71#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
74#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 72#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops {
78 long add_len; /* additional length */ 76 long add_len; /* additional length */
79 char *instr_type; 77 char *instr_type;
80 int (*info)(void *private_data, char *info_data, long len); 78 int (*info)(void *private_data, char *info_data, long len);
81 int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, 79 int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
82 char __user *instr_data, long len, int atomic, int cmd); 80 char __user *instr_data, long len, int atomic, int cmd);
83 int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, 81 int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
84 char __user *instr_data, long len, int atomic, int cmd); 82 char __user *instr_data, long len, int atomic, int cmd);
85 int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); 83 int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
86 int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); 84 int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
87 void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); 85 void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
88 struct snd_seq_kinstr_ops *next; 86 struct snd_seq_kinstr_ops *next;
89}; 87};
90 88
91 89
92/* instrument operations */ 90/* instrument operations */
93snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); 91struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
94void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); 92void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
95int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, 93int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
96 snd_seq_instr_header_t *ifree, 94 struct snd_seq_instr_header *ifree,
97 int client, 95 int client,
98 int atomic); 96 int atomic);
99snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, 97struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
100 snd_seq_instr_t *instr, 98 struct snd_seq_instr *instr,
101 int exact, 99 int exact,
102 int follow_alias); 100 int follow_alias);
103void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, 101void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
104 snd_seq_kinstr_t *instr); 102 struct snd_seq_kinstr *instr);
105int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, 103int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
106 snd_seq_kinstr_list_t *list, 104 struct snd_seq_kinstr_list *list,
107 snd_seq_event_t *ev, 105 struct snd_seq_event *ev,
108 int client, 106 int client,
109 int atomic, 107 int atomic,
110 int hop); 108 int hop);
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 4beca1952c76..f023c1b97f8c 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -24,62 +24,8 @@
24#include <linux/time.h> 24#include <linux/time.h>
25#include "asequencer.h" 25#include "asequencer.h"
26 26
27typedef sndrv_seq_tick_time_t snd_seq_tick_time_t; 27typedef struct snd_seq_real_time snd_seq_real_time_t;
28typedef sndrv_seq_position_t snd_seq_position_t; 28typedef union snd_seq_timestamp snd_seq_timestamp_t;
29typedef sndrv_seq_frequency_t snd_seq_frequency_t;
30typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t;
31typedef enum sndrv_seq_client_type snd_seq_client_type_t;
32typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
33typedef struct sndrv_seq_port_info snd_seq_port_info_t;
34typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t;
35typedef struct sndrv_seq_event snd_seq_event_t;
36typedef struct sndrv_seq_addr snd_seq_addr_t;
37typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t;
38typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t;
39typedef struct sndrv_seq_remove_events snd_seq_remove_events_t;
40typedef struct sndrv_seq_query_subs snd_seq_query_subs_t;
41typedef struct sndrv_seq_real_time snd_seq_real_time_t;
42typedef struct sndrv_seq_system_info snd_seq_system_info_t;
43typedef struct sndrv_seq_client_info snd_seq_client_info_t;
44typedef struct sndrv_seq_queue_info snd_seq_queue_info_t;
45typedef struct sndrv_seq_queue_status snd_seq_queue_status_t;
46typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t;
47typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t;
48typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t;
49typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
50typedef struct sndrv_seq_client_pool snd_seq_client_pool_t;
51typedef struct sndrv_seq_instr snd_seq_instr_t;
52typedef struct sndrv_seq_instr_data snd_seq_instr_data_t;
53typedef struct sndrv_seq_instr_header snd_seq_instr_header_t;
54typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
55
56#define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data
57#define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type
58#define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type
59#define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type
60#define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type
61#define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type
62#define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type
63#define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type
64#define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type
65#define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type
66#define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type
67#define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type
68#define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved
69#define snd_seq_ev_is_direct sndrv_seq_ev_is_direct
70#define snd_seq_ev_is_prior sndrv_seq_ev_is_prior
71#define snd_seq_ev_length_type sndrv_seq_ev_length_type
72#define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed
73#define snd_seq_ev_is_variable sndrv_seq_ev_is_variable
74#define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr
75#define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type
76#define snd_seq_ev_is_tick sndrv_seq_ev_is_tick
77#define snd_seq_ev_is_real sndrv_seq_ev_is_real
78#define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type
79#define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime
80#define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime
81#define snd_seq_queue_sync_port sndrv_seq_queue_sync_port
82#define snd_seq_queue_owner sndrv_seq_queue_owner
83 29
84/* maximum number of events dequeued per schedule interval */ 30/* maximum number of events dequeued per schedule interval */
85#define SNDRV_SEQ_MAX_DEQUEUE 50 31#define SNDRV_SEQ_MAX_DEQUEUE 50
@@ -114,69 +60,48 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
114/* max size of event size */ 60/* max size of event size */
115#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff 61#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
116 62
117/* typedefs */
118struct _snd_seq_user_client;
119struct _snd_seq_kernel_client;
120struct _snd_seq_client;
121struct _snd_seq_queue;
122
123typedef struct _snd_seq_user_client user_client_t;
124typedef struct _snd_seq_kernel_client kernel_client_t;
125typedef struct _snd_seq_client client_t;
126typedef struct _snd_seq_queue queue_t;
127
128/* call-backs for kernel client */
129
130typedef struct {
131 void *private_data;
132 unsigned allow_input: 1,
133 allow_output: 1;
134 /*...*/
135} snd_seq_client_callback_t;
136
137/* call-backs for kernel port */ 63/* call-backs for kernel port */
138typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info); 64struct snd_seq_port_callback {
139typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info);
140typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop);
141typedef void (snd_seq_kernel_port_private_free_t)(void *private_data);
142
143typedef struct {
144 struct module *owner; 65 struct module *owner;
145 void *private_data; 66 void *private_data;
146 snd_seq_kernel_port_open_t *subscribe; 67 int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
147 snd_seq_kernel_port_close_t *unsubscribe; 68 int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
148 snd_seq_kernel_port_open_t *use; 69 int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
149 snd_seq_kernel_port_close_t *unuse; 70 int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
150 snd_seq_kernel_port_input_t *event_input; 71 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
151 snd_seq_kernel_port_private_free_t *private_free; 72 void (*private_free)(void *private_data);
152 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */ 73 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */
153 /*...*/ 74 /*...*/
154} snd_seq_port_callback_t; 75};
155 76
156/* interface for kernel client */ 77/* interface for kernel client */
157extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback); 78int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
158extern int snd_seq_delete_kernel_client(int client); 79 const char *name_fmt, ...)
159extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); 80 __attribute__ ((format (printf, 3, 4)));
160extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); 81int snd_seq_delete_kernel_client(int client);
161extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); 82int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
83int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
84int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
162 85
163#define SNDRV_SEQ_EXT_MASK 0xc0000000 86#define SNDRV_SEQ_EXT_MASK 0xc0000000
164#define SNDRV_SEQ_EXT_USRPTR 0x80000000 87#define SNDRV_SEQ_EXT_USRPTR 0x80000000
165#define SNDRV_SEQ_EXT_CHAINED 0x40000000 88#define SNDRV_SEQ_EXT_CHAINED 0x40000000
166 89
167typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); 90typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
168int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned); 91int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
169int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data); 92 int in_kernel, int size_aligned);
93int snd_seq_dump_var_event(const struct snd_seq_event *event,
94 snd_seq_dump_func_t func, void *private_data);
170 95
171/* interface for OSS emulation */ 96/* interface for OSS emulation */
172int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo); 97int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
173 98
174/* port callback routines */ 99/* port callback routines */
175void snd_port_init_callback(snd_seq_port_callback_t *p); 100void snd_port_init_callback(struct snd_seq_port_callback *p);
176snd_seq_port_callback_t *snd_port_alloc_callback(void); 101struct snd_seq_port_callback *snd_port_alloc_callback(void);
177 102
178/* port attach/detach */ 103/* port attach/detach */
179int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, 104int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
180 int cap, int type, int midi_channels, int midi_voices, char *portname); 105 int cap, int type, int midi_channels, int midi_voices, char *portname);
181int snd_seq_event_port_detach(int client, int port); 106int snd_seq_event_port_detach(int client, int port);
182 107
diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h
index e58ca45bc73b..d6c4615901b9 100644
--- a/include/sound/seq_midi_emul.h
+++ b/include/sound/seq_midi_emul.h
@@ -29,7 +29,7 @@
29 * channel. All drivers for hardware that does not understand midi 29 * channel. All drivers for hardware that does not understand midi
30 * directly will probably need to use this structure. 30 * directly will probably need to use this structure.
31 */ 31 */
32typedef struct snd_midi_channel { 32struct snd_midi_channel {
33 void *private; /* A back pointer to driver data */ 33 void *private; /* A back pointer to driver data */
34 int number; /* The channel number */ 34 int number; /* The channel number */
35 int client; /* The client associated with this channel */ 35 int client; /* The client associated with this channel */
@@ -53,41 +53,43 @@ typedef struct snd_midi_channel {
53 short gm_rpn_fine_tuning; /* Master fine tuning */ 53 short gm_rpn_fine_tuning; /* Master fine tuning */
54 short gm_rpn_coarse_tuning; /* Master coarse tuning */ 54 short gm_rpn_coarse_tuning; /* Master coarse tuning */
55 55
56} snd_midi_channel_t; 56};
57 57
58/* 58/*
59 * A structure that represets a set of channels bound to a port. There 59 * A structure that represets a set of channels bound to a port. There
60 * would usually be 16 channels per port. But fewer could be used for 60 * would usually be 16 channels per port. But fewer could be used for
61 * particular cases. 61 * particular cases.
62 * The channel set consists of information describing the client and 62 * The channel set consists of information describing the client and
63 * port for this midi synth and an array of snd_midi_channel_t structures. 63 * port for this midi synth and an array of snd_midi_channel structures.
64 * A driver that had no need for snd_midi_channel_t could still use the 64 * A driver that had no need for snd_midi_channel could still use the
65 * channel set type if it wished with the channel array null. 65 * channel set type if it wished with the channel array null.
66 */ 66 */
67typedef struct snd_midi_channel_set { 67struct snd_midi_channel_set {
68 void *private_data; /* Driver data */ 68 void *private_data; /* Driver data */
69 int client; /* Client for this port */ 69 int client; /* Client for this port */
70 int port; /* The port number */ 70 int port; /* The port number */
71 71
72 int max_channels; /* Size of the channels array */ 72 int max_channels; /* Size of the channels array */
73 snd_midi_channel_t *channels; 73 struct snd_midi_channel *channels;
74 74
75 unsigned char midi_mode; /* MIDI operating mode */ 75 unsigned char midi_mode; /* MIDI operating mode */
76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */ 76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
77 unsigned char gs_chorus_mode; 77 unsigned char gs_chorus_mode;
78 unsigned char gs_reverb_mode; 78 unsigned char gs_reverb_mode;
79 79
80} snd_midi_channel_set_t; 80};
81 81
82typedef struct snd_seq_midi_op { 82struct snd_midi_op {
83 void (*note_on)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 83 void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
84 void (*note_off)(void *private_data,int note, int vel, snd_midi_channel_t *chan); /* release note */ 84 void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */
85 void (*key_press)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 85 void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
86 void (*note_terminate)(void *private_data, int note, snd_midi_channel_t *chan); /* terminate note immediately */ 86 void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */
87 void (*control)(void *private_data, int type, snd_midi_channel_t *chan); 87 void (*control)(void *private_data, int type, struct snd_midi_channel *chan);
88 void (*nrpn)(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 88 void (*nrpn)(void *private_data, struct snd_midi_channel *chan,
89 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 89 struct snd_midi_channel_set *chset);
90} snd_midi_op_t; 90 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed,
91 struct snd_midi_channel_set *chset);
92};
91 93
92/* 94/*
93 * These defines are used so that pitchbend, aftertouch etc, can be 95 * These defines are used so that pitchbend, aftertouch etc, can be
@@ -186,10 +188,10 @@ enum {
186}; 188};
187 189
188/* Prototypes for midi_process.c */ 190/* Prototypes for midi_process.c */
189void snd_midi_process_event(snd_midi_op_t *ops, snd_seq_event_t *ev, 191void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev,
190 snd_midi_channel_set_t *chanset); 192 struct snd_midi_channel_set *chanset);
191void snd_midi_channel_set_clear(snd_midi_channel_set_t *chset); 193void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset);
192snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n); 194struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
193void snd_midi_channel_free_set(snd_midi_channel_set_t *chset); 195void snd_midi_channel_free_set(struct snd_midi_channel_set *chset);
194 196
195#endif /* __SOUND_SEQ_MIDI_EMUL_H */ 197#endif /* __SOUND_SEQ_MIDI_EMUL_H */
diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h
index 8857e2bd31a5..dd789e7cdb20 100644
--- a/include/sound/seq_midi_event.h
+++ b/include/sound/seq_midi_event.h
@@ -26,10 +26,8 @@
26 26
27#define MAX_MIDI_EVENT_BUF 256 27#define MAX_MIDI_EVENT_BUF 256
28 28
29typedef struct snd_midi_event_t snd_midi_event_t;
30
31/* midi status */ 29/* midi status */
32struct snd_midi_event_t { 30struct snd_midi_event {
33 int qlen; /* queue length */ 31 int qlen; /* queue length */
34 int read; /* chars read */ 32 int read; /* chars read */
35 int type; /* current event type */ 33 int type; /* current event type */
@@ -40,15 +38,17 @@ struct snd_midi_event_t {
40 spinlock_t lock; 38 spinlock_t lock;
41}; 39};
42 40
43int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); 41int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
44void snd_midi_event_free(snd_midi_event_t *dev); 42void snd_midi_event_free(struct snd_midi_event *dev);
45void snd_midi_event_reset_encode(snd_midi_event_t *dev); 43void snd_midi_event_reset_encode(struct snd_midi_event *dev);
46void snd_midi_event_reset_decode(snd_midi_event_t *dev); 44void snd_midi_event_reset_decode(struct snd_midi_event *dev);
47void snd_midi_event_no_status(snd_midi_event_t *dev, int on); 45void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
48/* encode from byte stream - return number of written bytes if success */ 46/* encode from byte stream - return number of written bytes if success */
49long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 47long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
50int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev); 48 struct snd_seq_event *ev);
49int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
51/* decode from event to bytes - return number of written bytes if success */ 50/* decode from event to bytes - return number of written bytes if success */
52long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 51long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
52 struct snd_seq_event *ev);
53 53
54#endif /* __SOUND_SEQ_MIDI_EVENT_H */ 54#endif /* __SOUND_SEQ_MIDI_EVENT_H */
diff --git a/include/sound/seq_oss.h b/include/sound/seq_oss.h
index bd7e57322ab6..9b060bbd6e02 100644
--- a/include/sound/seq_oss.h
+++ b/include/sound/seq_oss.h
@@ -25,22 +25,16 @@
25#include "seq_kernel.h" 25#include "seq_kernel.h"
26 26
27/* 27/*
28 * type definitions
29 */
30typedef struct snd_seq_oss_arg_t snd_seq_oss_arg_t;
31typedef struct snd_seq_oss_callback_t snd_seq_oss_callback_t;
32
33/*
34 * argument structure for synthesizer operations 28 * argument structure for synthesizer operations
35 */ 29 */
36struct snd_seq_oss_arg_t { 30struct snd_seq_oss_arg {
37 /* given by OSS sequencer */ 31 /* given by OSS sequencer */
38 int app_index; /* application unique index */ 32 int app_index; /* application unique index */
39 int file_mode; /* file mode - see below */ 33 int file_mode; /* file mode - see below */
40 int seq_mode; /* sequencer mode - see below */ 34 int seq_mode; /* sequencer mode - see below */
41 35
42 /* following must be initialized in open callback */ 36 /* following must be initialized in open callback */
43 snd_seq_addr_t addr; /* opened port address */ 37 struct snd_seq_addr addr; /* opened port address */
44 void *private_data; /* private data for lowlevel drivers */ 38 void *private_data; /* private data for lowlevel drivers */
45 39
46 /* note-on event passing mode: initially given by OSS seq, 40 /* note-on event passing mode: initially given by OSS seq,
@@ -53,14 +47,14 @@ struct snd_seq_oss_arg_t {
53/* 47/*
54 * synthesizer operation callbacks 48 * synthesizer operation callbacks
55 */ 49 */
56struct snd_seq_oss_callback_t { 50struct snd_seq_oss_callback {
57 struct module *owner; 51 struct module *owner;
58 int (*open)(snd_seq_oss_arg_t *p, void *closure); 52 int (*open)(struct snd_seq_oss_arg *p, void *closure);
59 int (*close)(snd_seq_oss_arg_t *p); 53 int (*close)(struct snd_seq_oss_arg *p);
60 int (*ioctl)(snd_seq_oss_arg_t *p, unsigned int cmd, unsigned long arg); 54 int (*ioctl)(struct snd_seq_oss_arg *p, unsigned int cmd, unsigned long arg);
61 int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char __user *buf, int offs, int count); 55 int (*load_patch)(struct snd_seq_oss_arg *p, int format, const char __user *buf, int offs, int count);
62 int (*reset)(snd_seq_oss_arg_t *p); 56 int (*reset)(struct snd_seq_oss_arg *p);
63 int (*raw_event)(snd_seq_oss_arg_t *p, unsigned char *data); 57 int (*raw_event)(struct snd_seq_oss_arg *p, unsigned char *data);
64}; 58};
65 59
66/* flag: file_mode */ 60/* flag: file_mode */
@@ -88,13 +82,13 @@ struct snd_seq_oss_callback_t {
88/* 82/*
89 * data pointer to snd_seq_register_device 83 * data pointer to snd_seq_register_device
90 */ 84 */
91typedef struct snd_seq_oss_reg { 85struct snd_seq_oss_reg {
92 int type; 86 int type;
93 int subtype; 87 int subtype;
94 int nvoices; 88 int nvoices;
95 snd_seq_oss_callback_t oper; 89 struct snd_seq_oss_callback oper;
96 void *private_data; 90 void *private_data;
97} snd_seq_oss_reg_t; 91};
98 92
99/* device id */ 93/* device id */
100#define SNDRV_SEQ_DEV_ID_OSS "seq-oss" 94#define SNDRV_SEQ_DEV_ID_OSS "seq-oss"
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h
index 1ad27e859af3..8d5aea76d7c3 100644
--- a/include/sound/seq_virmidi.h
+++ b/include/sound/seq_virmidi.h
@@ -25,25 +25,23 @@
25#include "rawmidi.h" 25#include "rawmidi.h"
26#include "seq_midi_event.h" 26#include "seq_midi_event.h"
27 27
28typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
29
30/* 28/*
31 * device file instance: 29 * device file instance:
32 * This instance is created at each time the midi device file is 30 * This instance is created at each time the midi device file is
33 * opened. Each instance has its own input buffer and MIDI parser 31 * opened. Each instance has its own input buffer and MIDI parser
34 * (buffer), and is associated with the device instance. 32 * (buffer), and is associated with the device instance.
35 */ 33 */
36typedef struct _snd_virmidi { 34struct snd_virmidi {
37 struct list_head list; 35 struct list_head list;
38 int seq_mode; 36 int seq_mode;
39 int client; 37 int client;
40 int port; 38 int port;
41 unsigned int trigger: 1; 39 unsigned int trigger: 1;
42 snd_midi_event_t *parser; 40 struct snd_midi_event *parser;
43 snd_seq_event_t event; 41 struct snd_seq_event event;
44 snd_virmidi_dev_t *rdev; 42 struct snd_virmidi_dev *rdev;
45 snd_rawmidi_substream_t *substream; 43 struct snd_rawmidi_substream *substream;
46} snd_virmidi_t; 44};
47 45
48#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) 46#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
49#define SNDRV_VIRMIDI_USE (1<<1) 47#define SNDRV_VIRMIDI_USE (1<<1)
@@ -53,9 +51,9 @@ typedef struct _snd_virmidi {
53 * Each virtual midi device has one device instance. It contains 51 * Each virtual midi device has one device instance. It contains
54 * common information and the linked-list of opened files, 52 * common information and the linked-list of opened files,
55 */ 53 */
56struct _snd_virmidi_dev { 54struct snd_virmidi_dev {
57 snd_card_t *card; /* associated card */ 55 struct snd_card *card; /* associated card */
58 snd_rawmidi_t *rmidi; /* rawmidi device */ 56 struct snd_rawmidi *rmidi; /* rawmidi device */
59 int seq_mode; /* SNDRV_VIRMIDI_XXX */ 57 int seq_mode; /* SNDRV_VIRMIDI_XXX */
60 int device; /* sequencer device */ 58 int device; /* sequencer device */
61 int client; /* created/attached client */ 59 int client; /* created/attached client */
@@ -78,6 +76,6 @@ struct _snd_virmidi_dev {
78#define SNDRV_VIRMIDI_SEQ_ATTACH 1 76#define SNDRV_VIRMIDI_SEQ_ATTACH 1
79#define SNDRV_VIRMIDI_SEQ_DISPATCH 2 77#define SNDRV_VIRMIDI_SEQ_DISPATCH 2
80 78
81int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); 79int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
82 80
83#endif /* __SOUND_SEQ_VIRMIDI */ 81#endif /* __SOUND_SEQ_VIRMIDI */
diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h
index 674585f88a31..5d1ab9c4950f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/sound/sfnt_info.h
@@ -35,7 +35,7 @@
35#endif 35#endif
36 36
37/* patch interface header: 16 bytes */ 37/* patch interface header: 16 bytes */
38typedef struct soundfont_patch_info_t { 38struct soundfont_patch_info {
39 unsigned short key; /* use the key below */ 39 unsigned short key; /* use the key below */
40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) 40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07)
41 41
@@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t {
59 short reserved; /* word alignment data */ 59 short reserved; /* word alignment data */
60 60
61 /* the actual patch data begins after this */ 61 /* the actual patch data begins after this */
62} soundfont_patch_info_t; 62};
63 63
64 64
65/* 65/*
@@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t {
68 68
69#define SNDRV_SFNT_PATCH_NAME_LEN 32 69#define SNDRV_SFNT_PATCH_NAME_LEN 32
70 70
71typedef struct soundfont_open_parm_t { 71struct soundfont_open_parm {
72 unsigned short type; /* sample type */ 72 unsigned short type; /* sample type */
73#define SNDRV_SFNT_PAT_TYPE_MISC 0 73#define SNDRV_SFNT_PAT_TYPE_MISC 0
74#define SNDRV_SFNT_PAT_TYPE_GUS 6 74#define SNDRV_SFNT_PAT_TYPE_GUS 6
@@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t {
78 78
79 short reserved; 79 short reserved;
80 char name[SNDRV_SFNT_PATCH_NAME_LEN]; 80 char name[SNDRV_SFNT_PATCH_NAME_LEN];
81} soundfont_open_parm_t; 81};
82 82
83 83
84/* 84/*
@@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t {
86 */ 86 */
87 87
88/* wave table envelope & effect parameters to control EMU8000 */ 88/* wave table envelope & effect parameters to control EMU8000 */
89typedef struct soundfont_voice_parm_t { 89struct soundfont_voice_parm {
90 unsigned short moddelay; /* modulation delay (0x8000) */ 90 unsigned short moddelay; /* modulation delay (0x8000) */
91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ 91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ 92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
@@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t {
108 unsigned char chorus; /* chorus send (0x00) */ 108 unsigned char chorus; /* chorus send (0x00) */
109 unsigned char reverb; /* reverb send (0x00) */ 109 unsigned char reverb; /* reverb send (0x00) */
110 unsigned short reserved[4]; /* not used */ 110 unsigned short reserved[4]; /* not used */
111} soundfont_voice_parm_t; 111};
112 112
113 113
114/* wave table parameters: 92 bytes */ 114/* wave table parameters: 92 bytes */
115typedef struct soundfont_voice_info_t { 115struct soundfont_voice_info {
116 unsigned short sf_id; /* file id (should be zero) */ 116 unsigned short sf_id; /* file id (should be zero) */
117 unsigned short sample; /* sample id */ 117 unsigned short sample; /* sample id */
118 int start, end; /* sample offset correction */ 118 int start, end; /* sample offset correction */
@@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t {
135 unsigned char amplitude; /* sample volume (127 max) */ 135 unsigned char amplitude; /* sample volume (127 max) */
136 unsigned char attenuation; /* attenuation (0.375dB) */ 136 unsigned char attenuation; /* attenuation (0.375dB) */
137 short scaleTuning; /* pitch scale tuning(%), normally 100 */ 137 short scaleTuning; /* pitch scale tuning(%), normally 100 */
138 soundfont_voice_parm_t parm; /* voice envelope parameters */ 138 struct soundfont_voice_parm parm; /* voice envelope parameters */
139 unsigned short sample_mode; /* sample mode_flag (set by driver) */ 139 unsigned short sample_mode; /* sample mode_flag (set by driver) */
140} soundfont_voice_info_t; 140};
141 141
142 142
143/* instrument info header: 4 bytes */ 143/* instrument info header: 4 bytes */
144typedef struct soundfont_voice_rec_hdr_t { 144struct soundfont_voice_rec_hdr {
145 unsigned char bank; /* midi bank number */ 145 unsigned char bank; /* midi bank number */
146 unsigned char instr; /* midi preset number */ 146 unsigned char instr; /* midi preset number */
147 char nvoices; /* number of voices */ 147 char nvoices; /* number of voices */
@@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t {
149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ 149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */
150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ 150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */
151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ 151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */
152} soundfont_voice_rec_hdr_t; 152};
153 153
154 154
155/* 155/*
@@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t {
157 */ 157 */
158 158
159/* wave table sample header: 32 bytes */ 159/* wave table sample header: 32 bytes */
160typedef struct soundfont_sample_info_t { 160struct soundfont_sample_info {
161 unsigned short sf_id; /* file id (should be zero) */ 161 unsigned short sf_id; /* file id (should be zero) */
162 unsigned short sample; /* sample id */ 162 unsigned short sample; /* sample id */
163 int start, end; /* start & end offset */ 163 int start, end; /* start & end offset */
@@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t {
174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ 174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ 175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
176 unsigned int truesize; /* used memory size (set by driver) */ 176 unsigned int truesize; /* used memory size (set by driver) */
177} soundfont_sample_info_t; 177};
178 178
179 179
180/* 180/*
181 * voice preset mapping (aliasing) 181 * voice preset mapping (aliasing)
182 */ 182 */
183 183
184typedef struct soundfont_voice_map_t { 184struct soundfont_voice_map {
185 int map_bank, map_instr, map_key; /* key = -1 means all keys */ 185 int map_bank, map_instr, map_key; /* key = -1 means all keys */
186 int src_bank, src_instr, src_key; 186 int src_bank, src_instr, src_key;
187} soundfont_voice_map_t; 187};
188 188
189 189
190/* 190/*
@@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t {
195 195
196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ 196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */
197 197
198struct sndrv_emux_misc_mode { 198struct snd_emux_misc_mode {
199 int port; /* -1 = all */ 199 int port; /* -1 = all */
200 int mode; 200 int mode;
201 int value; 201 int value;
@@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode {
204 204
205enum { 205enum {
206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), 206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int),
207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), 207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info),
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), 208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82),
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), 209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83),
210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), 210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int),
211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), 211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
212}; 212};
213 213
214#endif /* __SOUND_SFNT_INFO_H */ 214#endif /* __SOUND_SFNT_INFO_H */
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index 4b0b2b9370b9..0b9e5de94ff1 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -26,8 +26,8 @@ struct _snd_wavefront_midi {
26 snd_wavefront_mpu_id output_mpu; /* most-recently-used */ 26 snd_wavefront_mpu_id output_mpu; /* most-recently-used */
27 snd_wavefront_mpu_id input_mpu; /* most-recently-used */ 27 snd_wavefront_mpu_id input_mpu; /* most-recently-used */
28 unsigned int mode[2]; /* MPU401_MODE_XXX */ 28 unsigned int mode[2]; /* MPU401_MODE_XXX */
29 snd_rawmidi_substream_t *substream_output[2]; 29 struct snd_rawmidi_substream *substream_output[2];
30 snd_rawmidi_substream_t *substream_input[2]; 30 struct snd_rawmidi_substream *substream_input[2];
31 struct timer_list timer; 31 struct timer_list timer;
32 spinlock_t open; 32 spinlock_t open;
33 spinlock_t virtual; /* protects isvirtual */ 33 spinlock_t virtual; /* protects isvirtual */
@@ -38,8 +38,8 @@ struct _snd_wavefront_midi {
38#define MPU_ACK 0xFE 38#define MPU_ACK 0xFE
39#define UART_MODE_ON 0x3F 39#define UART_MODE_ON 0x3F
40 40
41extern snd_rawmidi_ops_t snd_wavefront_midi_output; 41extern struct snd_rawmidi_ops snd_wavefront_midi_output;
42extern snd_rawmidi_ops_t snd_wavefront_midi_input; 42extern struct snd_rawmidi_ops snd_wavefront_midi_input;
43 43
44extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *); 44extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *);
45extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *); 45extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *);
@@ -116,23 +116,23 @@ extern int snd_wavefront_config_midi (snd_wavefront_t *dev) ;
116extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *, 116extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *,
117 unsigned char *); 117 unsigned char *);
118 118
119extern int snd_wavefront_synth_ioctl (snd_hwdep_t *, 119extern int snd_wavefront_synth_ioctl (struct snd_hwdep *,
120 struct file *, 120 struct file *,
121 unsigned int cmd, 121 unsigned int cmd,
122 unsigned long arg); 122 unsigned long arg);
123extern int snd_wavefront_synth_open (snd_hwdep_t *, struct file *); 123extern int snd_wavefront_synth_open (struct snd_hwdep *, struct file *);
124extern int snd_wavefront_synth_release (snd_hwdep_t *, struct file *); 124extern int snd_wavefront_synth_release (struct snd_hwdep *, struct file *);
125 125
126/* FX processor - see also yss225.[ch] */ 126/* FX processor - see also yss225.[ch] */
127 127
128extern int snd_wavefront_fx_start (snd_wavefront_t *); 128extern int snd_wavefront_fx_start (snd_wavefront_t *);
129extern int snd_wavefront_fx_detect (snd_wavefront_t *); 129extern int snd_wavefront_fx_detect (snd_wavefront_t *);
130extern int snd_wavefront_fx_ioctl (snd_hwdep_t *, 130extern int snd_wavefront_fx_ioctl (struct snd_hwdep *,
131 struct file *, 131 struct file *,
132 unsigned int cmd, 132 unsigned int cmd,
133 unsigned long arg); 133 unsigned long arg);
134extern int snd_wavefront_fx_open (snd_hwdep_t *, struct file *); 134extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *);
135extern int snd_wavefront_fx_release (snd_hwdep_t *, struct file *); 135extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *);
136 136
137/* prefix in all snd_printk() delivered messages */ 137/* prefix in all snd_printk() delivered messages */
138 138
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index c992958f5e3c..61a010c65d02 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -29,94 +29,93 @@
29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ 29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */
30#define SF_IS_DRUM_BANK(z) ((z) == 128) 30#define SF_IS_DRUM_BANK(z) ((z) == 128)
31 31
32typedef struct snd_sf_zone { 32struct snd_sf_zone {
33 struct snd_sf_zone *next; /* Link to next */ 33 struct snd_sf_zone *next; /* Link to next */
34 unsigned char bank; /* Midi bank for this zone */ 34 unsigned char bank; /* Midi bank for this zone */
35 unsigned char instr; /* Midi program for this zone */ 35 unsigned char instr; /* Midi program for this zone */
36 unsigned char mapped; /* True if mapped to something else */ 36 unsigned char mapped; /* True if mapped to something else */
37 37
38 soundfont_voice_info_t v; /* All the soundfont parameters */ 38 struct soundfont_voice_info v; /* All the soundfont parameters */
39 int counter; 39 int counter;
40 struct snd_sf_sample *sample; /* Link to sample */ 40 struct snd_sf_sample *sample; /* Link to sample */
41 41
42 /* The following deals with preset numbers (programs) */ 42 /* The following deals with preset numbers (programs) */
43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */ 43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */
44 struct snd_sf_zone *next_zone; /* Next zone in play list */ 44 struct snd_sf_zone *next_zone; /* Next zone in play list */
45} snd_sf_zone_t; 45};
46 46
47typedef struct snd_sf_sample { 47struct snd_sf_sample {
48 soundfont_sample_info_t v; 48 struct soundfont_sample_info v;
49 int counter; 49 int counter;
50 snd_util_memblk_t *block; /* allocated data block */ 50 struct snd_util_memblk *block; /* allocated data block */
51 struct snd_sf_sample *next; 51 struct snd_sf_sample *next;
52} snd_sf_sample_t; 52};
53 53
54/* 54/*
55 * This represents all the information relating to a soundfont. 55 * This represents all the information relating to a soundfont.
56 */ 56 */
57typedef struct snd_soundfont { 57struct snd_soundfont {
58 struct snd_soundfont *next; /* Link to next */ 58 struct snd_soundfont *next; /* Link to next */
59 /*struct snd_soundfont *prev;*/ /* Link to previous */ 59 /*struct snd_soundfont *prev;*/ /* Link to previous */
60 short id; /* file id */ 60 short id; /* file id */
61 short type; /* font type */ 61 short type; /* font type */
62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ 62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */
63 snd_sf_zone_t *zones; /* Font information */ 63 struct snd_sf_zone *zones; /* Font information */
64 snd_sf_sample_t *samples; /* The sample headers */ 64 struct snd_sf_sample *samples; /* The sample headers */
65} snd_soundfont_t; 65};
66 66
67/* 67/*
68 * Type of the sample access callback 68 * Type of the sample access callback
69 */ 69 */
70typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, 70struct snd_sf_callback {
71 snd_util_memhdr_t *hdr, const void __user *buf, long count);
72typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp,
73 snd_util_memhdr_t *hdr);
74typedef void (*snd_sf_sample_reset_t)(void *private);
75
76typedef struct snd_sf_callback {
77 void *private_data; 71 void *private_data;
78 snd_sf_sample_new_t sample_new; 72 int (*sample_new)(void *private_data, struct snd_sf_sample *sp,
79 snd_sf_sample_free_t sample_free; 73 struct snd_util_memhdr *hdr,
80 snd_sf_sample_reset_t sample_reset; 74 const void __user *buf, long count);
81} snd_sf_callback_t; 75 int (*sample_free)(void *private_data, struct snd_sf_sample *sp,
76 struct snd_util_memhdr *hdr);
77 void (*sample_reset)(void *private);
78};
82 79
83/* 80/*
84 * List of soundfonts. 81 * List of soundfonts.
85 */ 82 */
86typedef struct snd_sf_list { 83struct snd_sf_list {
87 snd_soundfont_t *currsf; /* The currently open soundfont */ 84 struct snd_soundfont *currsf; /* The currently open soundfont */
88 int open_client; /* client pointer for lock */ 85 int open_client; /* client pointer for lock */
89 int mem_used; /* used memory size */ 86 int mem_used; /* used memory size */
90 snd_sf_zone_t *presets[SF_MAX_PRESETS]; 87 struct snd_sf_zone *presets[SF_MAX_PRESETS];
91 snd_soundfont_t *fonts; /* The list of soundfonts */ 88 struct snd_soundfont *fonts; /* The list of soundfonts */
92 int fonts_size; /* number of fonts allocated */ 89 int fonts_size; /* number of fonts allocated */
93 int zone_counter; /* last allocated time for zone */ 90 int zone_counter; /* last allocated time for zone */
94 int sample_counter; /* last allocated time for sample */ 91 int sample_counter; /* last allocated time for sample */
95 int zone_locked; /* locked time for zone */ 92 int zone_locked; /* locked time for zone */
96 int sample_locked; /* locked time for sample */ 93 int sample_locked; /* locked time for sample */
97 snd_sf_callback_t callback; /* callback functions */ 94 struct snd_sf_callback callback; /* callback functions */
98 int presets_locked; 95 int presets_locked;
99 struct semaphore presets_mutex; 96 struct semaphore presets_mutex;
100 spinlock_t lock; 97 spinlock_t lock;
101 snd_util_memhdr_t *memhdr; 98 struct snd_util_memhdr *memhdr;
102} snd_sf_list_t; 99};
103 100
104/* Prototypes for soundfont.c */ 101/* Prototypes for soundfont.c */
105int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); 102int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
106int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, 103 long count, int client);
104int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
107 long count, int client); 105 long count, int client);
108int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); 106int snd_soundfont_close_check(struct snd_sf_list *sflist, int client);
109 107
110snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); 108struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback,
111void snd_sf_free(snd_sf_list_t *sflist); 109 struct snd_util_memhdr *hdr);
110void snd_sf_free(struct snd_sf_list *sflist);
112 111
113int snd_soundfont_remove_samples(snd_sf_list_t *sflist); 112int snd_soundfont_remove_samples(struct snd_sf_list *sflist);
114int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); 113int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist);
115 114
116int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, 115int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
117 int preset, int bank, 116 int preset, int bank,
118 int def_preset, int def_bank, 117 int def_preset, int def_bank,
119 snd_sf_zone_t **table, int max_layers); 118 struct snd_sf_zone **table, int max_layers);
120 119
121/* Parameter conversions */ 120/* Parameter conversions */
122int snd_sf_calc_parm_hold(int msec); 121int snd_sf_calc_parm_hold(int msec);
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index b82e408e758f..a4f554520197 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -24,15 +24,15 @@
24 24
25#include <linux/videodev.h> 25#include <linux/videodev.h>
26 26
27typedef struct snd_tea575x tea575x_t; 27struct snd_tea575x;
28 28
29struct snd_tea575x_ops { 29struct snd_tea575x_ops {
30 void (*write)(tea575x_t *tea, unsigned int val); 30 void (*write)(struct snd_tea575x *tea, unsigned int val);
31 unsigned int (*read)(tea575x_t *tea); 31 unsigned int (*read)(struct snd_tea575x *tea);
32}; 32};
33 33
34struct snd_tea575x { 34struct snd_tea575x {
35 snd_card_t *card; 35 struct snd_card *card;
36 struct video_device vd; /* video device */ 36 struct video_device vd; /* video device */
37 struct file_operations fops; 37 struct file_operations fops;
38 int dev_nr; /* requested device number + 1 */ 38 int dev_nr; /* requested device number + 1 */
@@ -45,7 +45,7 @@ struct snd_tea575x {
45 void *private_data; 45 void *private_data;
46}; 46};
47 47
48void snd_tea575x_init(tea575x_t *tea); 48void snd_tea575x_init(struct snd_tea575x *tea);
49void snd_tea575x_exit(tea575x_t *tea); 49void snd_tea575x_exit(struct snd_tea575x *tea);
50 50
51#endif /* __SOUND_TEA575X_TUNER_H */ 51#endif /* __SOUND_TEA575X_TUNER_H */
diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h
index 3896c0a50907..51b282b76896 100644
--- a/include/sound/tea6330t.h
+++ b/include/sound/tea6330t.h
@@ -22,21 +22,10 @@
22 * 22 *
23 */ 23 */
24 24
25#include "control.h"
26#include "i2c.h" /* generic i2c support */ 25#include "i2c.h" /* generic i2c support */
27 26
28typedef struct { 27int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer);
29 snd_i2c_device_t *device; 28int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus,
30 snd_i2c_bus_t *bus; 29 int equalizer, int fader);
31 int equalizer;
32 int fader;
33 unsigned char regs[8];
34 unsigned char mleft, mright;
35 unsigned char bass, treble;
36 unsigned char max_bass, max_treble;
37} tea6330t_t;
38
39extern int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer);
40extern int snd_tea6330t_update_mixer(snd_card_t * card, snd_i2c_bus_t * bus, int equalizer, int fader);
41 30
42#endif /* __SOUND_TEA6330T_H */ 31#endif /* __SOUND_TEA6330T_H */
diff --git a/include/sound/timer.h b/include/sound/timer.h
index b55f38ae56e1..5ece2bf541dc 100644
--- a/include/sound/timer.h
+++ b/include/sound/timer.h
@@ -26,20 +26,6 @@
26#include <sound/asound.h> 26#include <sound/asound.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28 28
29typedef enum sndrv_timer_class snd_timer_class_t;
30typedef enum sndrv_timer_slave_class snd_timer_slave_class_t;
31typedef enum sndrv_timer_global snd_timer_global_t;
32typedef struct sndrv_timer_id snd_timer_id_t;
33typedef struct sndrv_timer_ginfo snd_timer_ginfo_t;
34typedef struct sndrv_timer_gparams snd_timer_gparams_t;
35typedef struct sndrv_timer_gstatus snd_timer_gstatus_t;
36typedef struct sndrv_timer_select snd_timer_select_t;
37typedef struct sndrv_timer_info snd_timer_info_t;
38typedef struct sndrv_timer_params snd_timer_params_t;
39typedef struct sndrv_timer_status snd_timer_status_t;
40typedef struct sndrv_timer_read snd_timer_read_t;
41typedef struct sndrv_timer_tread snd_timer_tread_t;
42
43#define snd_timer_chip(timer) ((timer)->private_data) 29#define snd_timer_chip(timer) ((timer)->private_data)
44 30
45#define SNDRV_TIMER_DEVICES 16 31#define SNDRV_TIMER_DEVICES 16
@@ -64,11 +50,9 @@ typedef struct sndrv_timer_tread snd_timer_tread_t;
64#define SNDRV_TIMER_FLG_CHANGE 0x00000001 50#define SNDRV_TIMER_FLG_CHANGE 0x00000001
65#define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */ 51#define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */
66 52
67typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution); 53struct snd_timer;
68typedef void (*snd_timer_ccallback_t) (snd_timer_instance_t * timeri, enum sndrv_timer_event event,
69 struct timespec * tstamp, unsigned long resolution);
70 54
71struct _snd_timer_hardware { 55struct snd_timer_hardware {
72 /* -- must be filled with low-level driver */ 56 /* -- must be filled with low-level driver */
73 unsigned int flags; /* various flags */ 57 unsigned int flags; /* various flags */
74 unsigned long resolution; /* average timer resolution for one tick in nsec */ 58 unsigned long resolution; /* average timer resolution for one tick in nsec */
@@ -76,18 +60,18 @@ struct _snd_timer_hardware {
76 unsigned long resolution_max; /* maximal resolution */ 60 unsigned long resolution_max; /* maximal resolution */
77 unsigned long ticks; /* max timer ticks per interrupt */ 61 unsigned long ticks; /* max timer ticks per interrupt */
78 /* -- low-level functions -- */ 62 /* -- low-level functions -- */
79 int (*open) (snd_timer_t * timer); 63 int (*open) (struct snd_timer * timer);
80 int (*close) (snd_timer_t * timer); 64 int (*close) (struct snd_timer * timer);
81 unsigned long (*c_resolution) (snd_timer_t * timer); 65 unsigned long (*c_resolution) (struct snd_timer * timer);
82 int (*start) (snd_timer_t * timer); 66 int (*start) (struct snd_timer * timer);
83 int (*stop) (snd_timer_t * timer); 67 int (*stop) (struct snd_timer * timer);
84 int (*set_period) (snd_timer_t * timer, unsigned long period_num, unsigned long period_den); 68 int (*set_period) (struct snd_timer * timer, unsigned long period_num, unsigned long period_den);
85 int (*precise_resolution) (snd_timer_t * timer, unsigned long *num, unsigned long *den); 69 int (*precise_resolution) (struct snd_timer * timer, unsigned long *num, unsigned long *den);
86}; 70};
87 71
88struct _snd_timer { 72struct snd_timer {
89 snd_timer_class_t tmr_class; 73 int tmr_class;
90 snd_card_t *card; 74 struct snd_card *card;
91 struct module *module; 75 struct module *module;
92 int tmr_device; 76 int tmr_device;
93 int tmr_subdevice; 77 int tmr_subdevice;
@@ -97,8 +81,8 @@ struct _snd_timer {
97 int running; /* running instances */ 81 int running; /* running instances */
98 unsigned long sticks; /* schedule ticks */ 82 unsigned long sticks; /* schedule ticks */
99 void *private_data; 83 void *private_data;
100 void (*private_free) (snd_timer_t *timer); 84 void (*private_free) (struct snd_timer *timer);
101 struct _snd_timer_hardware hw; 85 struct snd_timer_hardware hw;
102 spinlock_t lock; 86 spinlock_t lock;
103 struct list_head device_list; 87 struct list_head device_list;
104 struct list_head open_list_head; 88 struct list_head open_list_head;
@@ -108,49 +92,53 @@ struct _snd_timer {
108 struct tasklet_struct task_queue; 92 struct tasklet_struct task_queue;
109}; 93};
110 94
111struct _snd_timer_instance { 95struct snd_timer_instance {
112 snd_timer_t * timer; 96 struct snd_timer *timer;
113 char *owner; 97 char *owner;
114 unsigned int flags; 98 unsigned int flags;
115 void *private_data; 99 void *private_data;
116 void (*private_free) (snd_timer_instance_t *ti); 100 void (*private_free) (struct snd_timer_instance *ti);
117 snd_timer_callback_t callback; 101 void (*callback) (struct snd_timer_instance *timeri,
118 snd_timer_ccallback_t ccallback; 102 unsigned long ticks, unsigned long resolution);
103 void (*ccallback) (struct snd_timer_instance * timeri,
104 int event,
105 struct timespec * tstamp,
106 unsigned long resolution);
119 void *callback_data; 107 void *callback_data;
120 unsigned long ticks; /* auto-load ticks when expired */ 108 unsigned long ticks; /* auto-load ticks when expired */
121 unsigned long cticks; /* current ticks */ 109 unsigned long cticks; /* current ticks */
122 unsigned long pticks; /* accumulated ticks for callback */ 110 unsigned long pticks; /* accumulated ticks for callback */
123 unsigned long resolution; /* current resolution for tasklet */ 111 unsigned long resolution; /* current resolution for tasklet */
124 unsigned long lost; /* lost ticks */ 112 unsigned long lost; /* lost ticks */
125 snd_timer_slave_class_t slave_class; 113 int slave_class;
126 unsigned int slave_id; 114 unsigned int slave_id;
127 struct list_head open_list; 115 struct list_head open_list;
128 struct list_head active_list; 116 struct list_head active_list;
129 struct list_head ack_list; 117 struct list_head ack_list;
130 struct list_head slave_list_head; 118 struct list_head slave_list_head;
131 struct list_head slave_active_head; 119 struct list_head slave_active_head;
132 snd_timer_instance_t *master; 120 struct snd_timer_instance *master;
133}; 121};
134 122
135/* 123/*
136 * Registering 124 * Registering
137 */ 125 */
138 126
139extern int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t ** rtimer); 127int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, struct snd_timer **rtimer);
140extern void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct timespec *tstamp); 128void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp);
141extern int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer); 129int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer);
142extern int snd_timer_global_free(snd_timer_t *timer); 130int snd_timer_global_free(struct snd_timer *timer);
143extern int snd_timer_global_register(snd_timer_t *timer); 131int snd_timer_global_register(struct snd_timer *timer);
144extern int snd_timer_global_unregister(snd_timer_t *timer); 132int snd_timer_global_unregister(struct snd_timer *timer);
145 133
146extern int snd_timer_open(snd_timer_instance_t ** ti, char *owner, snd_timer_id_t *tid, unsigned int slave_id); 134int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id);
147extern int snd_timer_close(snd_timer_instance_t * timeri); 135int snd_timer_close(struct snd_timer_instance *timeri);
148extern unsigned long snd_timer_resolution(snd_timer_instance_t * timeri); 136unsigned long snd_timer_resolution(struct snd_timer_instance *timeri);
149extern int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks); 137int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks);
150extern int snd_timer_stop(snd_timer_instance_t * timeri); 138int snd_timer_stop(struct snd_timer_instance *timeri);
151extern int snd_timer_continue(snd_timer_instance_t * timeri); 139int snd_timer_continue(struct snd_timer_instance *timeri);
152extern int snd_timer_pause(snd_timer_instance_t * timeri); 140int snd_timer_pause(struct snd_timer_instance *timeri);
153 141
154extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); 142void snd_timer_interrupt(struct snd_timer *timer, unsigned long ticks_left);
155 143
156#endif /* __SOUND_TIMER_H */ 144#endif /* __SOUND_TIMER_H */
diff --git a/include/sound/trident.h b/include/sound/trident.h
index a408d3925050..9752243241e5 100644
--- a/include/sound/trident.h
+++ b/include/sound/trident.h
@@ -253,43 +253,43 @@ enum serial_intf_ctrl_bits {
253#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */ 253#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */
254#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */ 254#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */
255 255
256typedef struct _snd_trident trident_t; 256struct snd_trident;
257typedef struct _snd_trident_voice snd_trident_voice_t; 257struct snd_trident_voice;
258typedef struct _snd_trident_pcm_mixer snd_trident_pcm_mixer_t; 258struct snd_trident_pcm_mixer;
259 259
260typedef struct { 260struct snd_trident_sample_ops {
261 void (*sample_start)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_position_t position); 261 void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position);
262 void (*sample_stop)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_stop_mode_t mode); 262 void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode);
263 void (*sample_freq)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_frequency_t freq); 263 void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq);
264 void (*sample_volume)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_ev_volume_t *volume); 264 void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume);
265 void (*sample_loop)(trident_t *card, snd_trident_voice_t *voice, snd_seq_ev_loop_t *loop); 265 void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop);
266 void (*sample_pos)(trident_t *card, snd_trident_voice_t *voice, snd_seq_position_t position); 266 void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position);
267 void (*sample_private1)(trident_t *card, snd_trident_voice_t *voice, unsigned char *data); 267 void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data);
268} snd_trident_sample_ops_t; 268};
269 269
270typedef struct { 270struct snd_trident_port {
271 snd_midi_channel_set_t * chset; 271 struct snd_midi_channel_set * chset;
272 trident_t * trident; 272 struct snd_trident * trident;
273 int mode; /* operation mode */ 273 int mode; /* operation mode */
274 int client; /* sequencer client number */ 274 int client; /* sequencer client number */
275 int port; /* sequencer port number */ 275 int port; /* sequencer port number */
276 unsigned int midi_has_voices: 1; 276 unsigned int midi_has_voices: 1;
277} snd_trident_port_t; 277};
278 278
279typedef struct snd_trident_memblk_arg { 279struct snd_trident_memblk_arg {
280 short first_page, last_page; 280 short first_page, last_page;
281} snd_trident_memblk_arg_t; 281};
282 282
283typedef struct { 283struct snd_trident_tlb {
284 unsigned int * entries; /* 16k-aligned TLB table */ 284 unsigned int * entries; /* 16k-aligned TLB table */
285 dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */ 285 dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */
286 unsigned long * shadow_entries; /* shadow entries with virtual addresses */ 286 unsigned long * shadow_entries; /* shadow entries with virtual addresses */
287 struct snd_dma_buffer buffer; 287 struct snd_dma_buffer buffer;
288 snd_util_memhdr_t * memhdr; /* page allocation list */ 288 struct snd_util_memhdr * memhdr; /* page allocation list */
289 struct snd_dma_buffer silent_page; 289 struct snd_dma_buffer silent_page;
290} snd_trident_tlb_t; 290};
291 291
292struct _snd_trident_voice { 292struct snd_trident_voice {
293 unsigned int number; 293 unsigned int number;
294 unsigned int use: 1, 294 unsigned int use: 1,
295 pcm: 1, 295 pcm: 1,
@@ -300,8 +300,8 @@ struct _snd_trident_voice {
300 unsigned char port; 300 unsigned char port;
301 unsigned char index; 301 unsigned char index;
302 302
303 snd_seq_instr_t instr; 303 struct snd_seq_instr instr;
304 snd_trident_sample_ops_t *sample_ops; 304 struct snd_trident_sample_ops *sample_ops;
305 305
306 /* channel parameters */ 306 /* channel parameters */
307 unsigned int CSO; /* 24 bits (16 on DX) */ 307 unsigned int CSO; /* 24 bits (16 on DX) */
@@ -323,13 +323,13 @@ struct _snd_trident_voice {
323 323
324 unsigned int negCSO; /* nonzero - use negative CSO */ 324 unsigned int negCSO; /* nonzero - use negative CSO */
325 325
326 snd_util_memblk_t *memblk; /* memory block if TLB enabled */ 326 struct snd_util_memblk *memblk; /* memory block if TLB enabled */
327 327
328 /* PCM data */ 328 /* PCM data */
329 329
330 trident_t *trident; 330 struct snd_trident *trident;
331 snd_pcm_substream_t *substream; 331 struct snd_pcm_substream *substream;
332 snd_trident_voice_t *extra; /* extra PCM voice (acts as interrupt generator) */ 332 struct snd_trident_voice *extra; /* extra PCM voice (acts as interrupt generator) */
333 unsigned int running: 1, 333 unsigned int running: 1,
334 capture: 1, 334 capture: 1,
335 spdif: 1, 335 spdif: 1,
@@ -347,25 +347,25 @@ struct _snd_trident_voice {
347 /* --- */ 347 /* --- */
348 348
349 void *private_data; 349 void *private_data;
350 void (*private_free)(snd_trident_voice_t *voice); 350 void (*private_free)(struct snd_trident_voice *voice);
351}; 351};
352 352
353struct _snd_4dwave { 353struct snd_4dwave {
354 int seq_client; 354 int seq_client;
355 355
356 snd_trident_port_t seq_ports[4]; 356 struct snd_trident_port seq_ports[4];
357 snd_simple_ops_t simple_ops; 357 struct snd_simple_ops simple_ops;
358 snd_seq_kinstr_list_t *ilist; 358 struct snd_seq_kinstr_list *ilist;
359 359
360 snd_trident_voice_t voices[64]; 360 struct snd_trident_voice voices[64];
361 361
362 int ChanSynthCount; /* number of allocated synth channels */ 362 int ChanSynthCount; /* number of allocated synth channels */
363 int max_size; /* maximum synth memory size in bytes */ 363 int max_size; /* maximum synth memory size in bytes */
364 int current_size; /* current allocated synth mem in bytes */ 364 int current_size; /* current allocated synth mem in bytes */
365}; 365};
366 366
367struct _snd_trident_pcm_mixer { 367struct snd_trident_pcm_mixer {
368 snd_trident_voice_t *voice; /* active voice */ 368 struct snd_trident_voice *voice; /* active voice */
369 unsigned short vol; /* front volume */ 369 unsigned short vol; /* front volume */
370 unsigned char pan; /* pan control */ 370 unsigned char pan; /* pan control */
371 unsigned char rvol; /* rear volume */ 371 unsigned char rvol; /* rear volume */
@@ -373,7 +373,7 @@ struct _snd_trident_pcm_mixer {
373 unsigned char pad; 373 unsigned char pad;
374}; 374};
375 375
376struct _snd_trident { 376struct snd_trident {
377 int irq; 377 int irq;
378 378
379 unsigned int device; /* device ID */ 379 unsigned int device; /* device ID */
@@ -386,13 +386,13 @@ struct _snd_trident {
386 unsigned int spurious_irq_count; 386 unsigned int spurious_irq_count;
387 unsigned int spurious_irq_max_delta; 387 unsigned int spurious_irq_max_delta;
388 388
389 snd_trident_tlb_t tlb; /* TLB entries for NX cards */ 389 struct snd_trident_tlb tlb; /* TLB entries for NX cards */
390 390
391 unsigned char spdif_ctrl; 391 unsigned char spdif_ctrl;
392 unsigned char spdif_pcm_ctrl; 392 unsigned char spdif_pcm_ctrl;
393 unsigned int spdif_bits; 393 unsigned int spdif_bits;
394 unsigned int spdif_pcm_bits; 394 unsigned int spdif_pcm_bits;
395 snd_kcontrol_t *spdif_pcm_ctl; /* S/PDIF settings */ 395 struct snd_kcontrol *spdif_pcm_ctl; /* S/PDIF settings */
396 unsigned int ac97_ctrl; 396 unsigned int ac97_ctrl;
397 397
398 unsigned int ChanMap[2]; /* allocation map for hardware channels */ 398 unsigned int ChanMap[2]; /* allocation map for hardware channels */
@@ -403,7 +403,7 @@ struct _snd_trident {
403 unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */ 403 unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */
404 unsigned int in_suspend: 1; /* 1 during suspend/resume */ 404 unsigned int in_suspend: 1; /* 1 during suspend/resume */
405 405
406 struct _snd_4dwave synth; /* synth specific variables */ 406 struct snd_4dwave synth; /* synth specific variables */
407 407
408 spinlock_t event_lock; 408 spinlock_t event_lock;
409 spinlock_t voice_alloc; 409 spinlock_t voice_alloc;
@@ -411,52 +411,57 @@ struct _snd_trident {
411 struct snd_dma_device dma_dev; 411 struct snd_dma_device dma_dev;
412 412
413 struct pci_dev *pci; 413 struct pci_dev *pci;
414 snd_card_t *card; 414 struct snd_card *card;
415 snd_pcm_t *pcm; /* ADC/DAC PCM */ 415 struct snd_pcm *pcm; /* ADC/DAC PCM */
416 snd_pcm_t *foldback; /* Foldback PCM */ 416 struct snd_pcm *foldback; /* Foldback PCM */
417 snd_pcm_t *spdif; /* SPDIF PCM */ 417 struct snd_pcm *spdif; /* SPDIF PCM */
418 snd_rawmidi_t *rmidi; 418 struct snd_rawmidi *rmidi;
419 snd_seq_device_t *seq_dev; 419 struct snd_seq_device *seq_dev;
420 420
421 ac97_bus_t *ac97_bus; 421 struct snd_ac97_bus *ac97_bus;
422 ac97_t *ac97; 422 struct snd_ac97 *ac97;
423 ac97_t *ac97_sec; 423 struct snd_ac97 *ac97_sec;
424 424
425 unsigned int musicvol_wavevol; 425 unsigned int musicvol_wavevol;
426 snd_trident_pcm_mixer_t pcm_mixer[32]; 426 struct snd_trident_pcm_mixer pcm_mixer[32];
427 snd_kcontrol_t *ctl_vol; /* front volume */ 427 struct snd_kcontrol *ctl_vol; /* front volume */
428 snd_kcontrol_t *ctl_pan; /* pan */ 428 struct snd_kcontrol *ctl_pan; /* pan */
429 snd_kcontrol_t *ctl_rvol; /* rear volume */ 429 struct snd_kcontrol *ctl_rvol; /* rear volume */
430 snd_kcontrol_t *ctl_cvol; /* center volume */ 430 struct snd_kcontrol *ctl_cvol; /* center volume */
431 431
432 spinlock_t reg_lock; 432 spinlock_t reg_lock;
433 433
434 struct gameport *gameport; 434 struct gameport *gameport;
435}; 435};
436 436
437int snd_trident_create(snd_card_t * card, 437int snd_trident_create(struct snd_card *card,
438 struct pci_dev *pci, 438 struct pci_dev *pci,
439 int pcm_streams, 439 int pcm_streams,
440 int pcm_spdif_device, 440 int pcm_spdif_device,
441 int max_wavetable_size, 441 int max_wavetable_size,
442 trident_t ** rtrident); 442 struct snd_trident ** rtrident);
443int snd_trident_create_gameport(trident_t *trident); 443int snd_trident_create_gameport(struct snd_trident *trident);
444 444
445int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 445int snd_trident_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
446int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 446int snd_trident_foldback_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
447int snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 447int snd_trident_spdif_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
448int snd_trident_attach_synthesizer(trident_t * trident); 448int snd_trident_attach_synthesizer(struct snd_trident * trident);
449snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port); 449struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type,
450void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice); 450 int client, int port);
451void snd_trident_start_voice(trident_t * trident, unsigned int voice); 451void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice);
452void snd_trident_stop_voice(trident_t * trident, unsigned int voice); 452void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice);
453void snd_trident_write_voice_regs(trident_t * trident, snd_trident_voice_t *voice); 453void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice);
454void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice);
455int snd_trident_suspend(struct pci_dev *pci, pm_message_t state);
456int snd_trident_resume(struct pci_dev *pci);
454 457
455/* TLB memory allocation */ 458/* TLB memory allocation */
456snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream); 459struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident,
457int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk); 460 struct snd_pcm_substream *substream);
458snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size); 461int snd_trident_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk);
459int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk); 462struct snd_util_memblk *snd_trident_synth_alloc(struct snd_trident *trident, unsigned int size);
460int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size); 463int snd_trident_synth_free(struct snd_trident *trident, struct snd_util_memblk *blk);
464int snd_trident_synth_copy_from_user(struct snd_trident *trident, struct snd_util_memblk *blk,
465 int offset, const char __user *data, int size);
461 466
462#endif /* __SOUND_TRIDENT_H */ 467#endif /* __SOUND_TRIDENT_H */
diff --git a/include/sound/typedefs.h b/include/sound/typedefs.h
new file mode 100644
index 000000000000..f454b0206b93
--- /dev/null
+++ b/include/sound/typedefs.h
@@ -0,0 +1,173 @@
1/*
2 * Typedef's for backward compatibility (for out-of-kernel drivers)
3 *
4 * This file will be removed soon in future
5 */
6
7/* core stuff */
8typedef struct snd_card snd_card_t;
9typedef struct snd_device snd_device_t;
10typedef struct snd_device_ops snd_device_ops_t;
11typedef enum snd_card_type snd_card_type_t;
12typedef struct snd_minor snd_minor_t;
13
14/* info */
15typedef struct snd_info_entry snd_info_entry_t;
16typedef struct snd_info_buffer snd_info_buffer_t;
17
18/* control */
19typedef struct snd_ctl_file snd_ctl_file_t;
20typedef struct snd_kcontrol snd_kcontrol_t;
21typedef struct snd_kcontrol_new snd_kcontrol_new_t;
22typedef struct snd_kcontrol_volatile snd_kcontrol_volatile_t;
23typedef struct snd_kctl_event snd_kctl_event_t;
24typedef struct snd_aes_iec958 snd_aes_iec958_t;
25typedef struct snd_ctl_card_info snd_ctl_card_info_t;
26typedef struct snd_ctl_elem_id snd_ctl_elem_id_t;
27typedef struct snd_ctl_elem_list snd_ctl_elem_list_t;
28typedef struct snd_ctl_elem_info snd_ctl_elem_info_t;
29typedef struct snd_ctl_elem_value snd_ctl_elem_value_t;
30typedef struct snd_ctl_event snd_ctl_event_t;
31#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
32typedef struct snd_mixer_oss snd_mixer_oss_t;
33#endif
34
35/* timer */
36typedef struct snd_timer snd_timer_t;
37typedef struct snd_timer_instance snd_timer_instance_t;
38typedef struct snd_timer_id snd_timer_id_t;
39typedef struct snd_timer_ginfo snd_timer_ginfo_t;
40typedef struct snd_timer_gparams snd_timer_gparams_t;
41typedef struct snd_timer_gstatus snd_timer_gstatus_t;
42typedef struct snd_timer_select snd_timer_select_t;
43typedef struct snd_timer_info snd_timer_info_t;
44typedef struct snd_timer_params snd_timer_params_t;
45typedef struct snd_timer_status snd_timer_status_t;
46typedef struct snd_timer_read snd_timer_read_t;
47typedef struct snd_timer_tread snd_timer_tread_t;
48
49/* PCM */
50typedef struct snd_pcm snd_pcm_t;
51typedef struct snd_pcm_str snd_pcm_str_t;
52typedef struct snd_pcm_substream snd_pcm_substream_t;
53typedef struct snd_pcm_info snd_pcm_info_t;
54typedef struct snd_pcm_hw_params snd_pcm_hw_params_t;
55typedef struct snd_pcm_sw_params snd_pcm_sw_params_t;
56typedef struct snd_pcm_channel_info snd_pcm_channel_info_t;
57typedef struct snd_pcm_status snd_pcm_status_t;
58typedef struct snd_pcm_mmap_status snd_pcm_mmap_status_t;
59typedef struct snd_pcm_mmap_control snd_pcm_mmap_control_t;
60typedef struct snd_mask snd_mask_t;
61typedef struct snd_sg_buf snd_pcm_sgbuf_t;
62
63typedef struct snd_interval snd_interval_t;
64typedef struct snd_xferi snd_xferi_t;
65typedef struct snd_xfern snd_xfern_t;
66typedef struct snd_xferv snd_xferv_t;
67
68typedef struct snd_pcm_file snd_pcm_file_t;
69typedef struct snd_pcm_runtime snd_pcm_runtime_t;
70typedef struct snd_pcm_hardware snd_pcm_hardware_t;
71typedef struct snd_pcm_ops snd_pcm_ops_t;
72typedef struct snd_pcm_hw_rule snd_pcm_hw_rule_t;
73typedef struct snd_pcm_hw_constraints snd_pcm_hw_constraints_t;
74typedef struct snd_ratnum ratnum_t;
75typedef struct snd_ratden ratden_t;
76typedef struct snd_pcm_hw_constraint_ratnums snd_pcm_hw_constraint_ratnums_t;
77typedef struct snd_pcm_hw_constraint_ratdens snd_pcm_hw_constraint_ratdens_t;
78typedef struct snd_pcm_hw_constraint_list snd_pcm_hw_constraint_list_t;
79typedef struct snd_pcm_group snd_pcm_group_t;
80typedef struct snd_pcm_notify snd_pcm_notify_t;
81
82/* rawmidi */
83typedef struct snd_rawmidi snd_rawmidi_t;
84typedef struct snd_rawmidi_info snd_rawmidi_info_t;
85typedef struct snd_rawmidi_params snd_rawmidi_params_t;
86typedef struct snd_rawmidi_status snd_rawmidi_status_t;
87typedef struct snd_rawmidi_runtime snd_rawmidi_runtime_t;
88typedef struct snd_rawmidi_substream snd_rawmidi_substream_t;
89typedef struct snd_rawmidi_str snd_rawmidi_str_t;
90typedef struct snd_rawmidi_ops snd_rawmidi_ops_t;
91typedef struct snd_rawmidi_global_ops snd_rawmidi_global_ops_t;
92typedef struct snd_rawmidi_file snd_rawmidi_file_t;
93
94/* hwdep */
95typedef struct snd_hwdep snd_hwdep_t;
96typedef struct snd_hwdep_info snd_hwdep_info_t;
97typedef struct snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
98typedef struct snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
99typedef struct snd_hwdep_ops snd_hwdep_ops_t;
100
101/* sequencer */
102typedef struct snd_seq_port_info snd_seq_port_info_t;
103typedef struct snd_seq_port_subscribe snd_seq_port_subscribe_t;
104typedef struct snd_seq_event snd_seq_event_t;
105typedef struct snd_seq_addr snd_seq_addr_t;
106typedef struct snd_seq_ev_volume snd_seq_ev_volume_t;
107typedef struct snd_seq_ev_loop snd_seq_ev_loop_t;
108typedef struct snd_seq_remove_events snd_seq_remove_events_t;
109typedef struct snd_seq_query_subs snd_seq_query_subs_t;
110typedef struct snd_seq_system_info snd_seq_system_info_t;
111typedef struct snd_seq_client_info snd_seq_client_info_t;
112typedef struct snd_seq_queue_info snd_seq_queue_info_t;
113typedef struct snd_seq_queue_status snd_seq_queue_status_t;
114typedef struct snd_seq_queue_tempo snd_seq_queue_tempo_t;
115typedef struct snd_seq_queue_owner snd_seq_queue_owner_t;
116typedef struct snd_seq_queue_timer snd_seq_queue_timer_t;
117typedef struct snd_seq_queue_client snd_seq_queue_client_t;
118typedef struct snd_seq_client_pool snd_seq_client_pool_t;
119typedef struct snd_seq_instr snd_seq_instr_t;
120typedef struct snd_seq_instr_data snd_seq_instr_data_t;
121typedef struct snd_seq_instr_header snd_seq_instr_header_t;
122
123typedef struct snd_seq_user_client user_client_t;
124typedef struct snd_seq_kernel_client kernel_client_t;
125typedef struct snd_seq_client client_t;
126typedef struct snd_seq_queue queue_t;
127
128/* seq_device */
129typedef struct snd_seq_device snd_seq_device_t;
130typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
131
132/* seq_midi */
133typedef struct snd_midi_event snd_midi_event_t;
134
135/* seq_midi_emul */
136typedef struct snd_midi_channel snd_midi_channel_t;
137typedef struct snd_midi_channel_set snd_midi_channel_set_t;
138typedef struct snd_midi_op snd_midi_op_t;
139
140/* seq_oss */
141typedef struct snd_seq_oss_arg snd_seq_oss_arg_t;
142typedef struct snd_seq_oss_callback snd_seq_oss_callback_t;
143typedef struct snd_seq_oss_reg snd_seq_oss_reg_t;
144
145/* virmidi */
146typedef struct snd_virmidi_dev snd_virmidi_dev_t;
147typedef struct snd_virmidi snd_virmidi_t;
148
149/* seq_instr */
150typedef struct snd_seq_kcluster snd_seq_kcluster_t;
151typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
152typedef struct snd_seq_kinstr snd_seq_kinstr_t;
153typedef struct snd_seq_kinstr_list snd_seq_kinstr_list_t;
154
155/* ac97 */
156typedef struct snd_ac97_bus ac97_bus_t;
157typedef struct snd_ac97_bus_ops ac97_bus_ops_t;
158typedef struct snd_ac97_template ac97_template_t;
159typedef struct snd_ac97 ac97_t;
160
161/* opl3/4 */
162typedef struct snd_opl3 opl3_t;
163typedef struct snd_opl4 opl4_t;
164
165/* mpu401 */
166typedef struct snd_mpu401 mpu401_t;
167
168/* i2c */
169typedef struct snd_i2c_device snd_i2c_device_t;
170typedef struct snd_i2c_bus snd_i2c_bus_t;
171
172typedef struct snd_ak4531 ak4531_t;
173
diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h
index 61ff65a628bc..2e564bfb37fe 100644
--- a/include/sound/uda1341.h
+++ b/include/sound/uda1341.h
@@ -15,7 +15,7 @@
15 * features support 15 * features support
16 */ 16 */
17 17
18/* $Id: uda1341.h,v 1.6 2004/05/03 17:36:50 tiwai Exp $ */ 18/* $Id: uda1341.h,v 1.8 2005/11/17 14:17:21 tiwai Exp $ */
19 19
20#define UDA1341_ALSA_NAME "snd-uda1341" 20#define UDA1341_ALSA_NAME "snd-uda1341"
21 21
@@ -37,11 +37,6 @@ enum uda1341_onoff {
37 ON, 37 ON,
38}; 38};
39 39
40const char *onoff_names[] = {
41 "Off",
42 "On",
43};
44
45enum uda1341_format { 40enum uda1341_format {
46 I2S=0, 41 I2S=0,
47 LSB16, 42 LSB16,
@@ -53,17 +48,6 @@ enum uda1341_format {
53 LSB20MSB, 48 LSB20MSB,
54}; 49};
55 50
56const char *format_names[] = {
57 "I2S-bus",
58 "LSB 16bits",
59 "LSB 18bits",
60 "LSB 20bits",
61 "MSB",
62 "in LSB 16bits/out MSB",
63 "in LSB 18bits/out MSB",
64 "in LSB 20bits/out MSB",
65};
66
67enum uda1341_fs { 51enum uda1341_fs {
68 F512=0, 52 F512=0,
69 F384, 53 F384,
@@ -71,23 +55,11 @@ enum uda1341_fs {
71 Funused, 55 Funused,
72}; 56};
73 57
74const char *fs_names[] = {
75 "512*fs",
76 "384*fs",
77 "256*fs",
78 "Unused - bad value!",
79};
80
81enum uda1341_peak { 58enum uda1341_peak {
82 BEFORE=0, 59 BEFORE=0,
83 AFTER, 60 AFTER,
84}; 61};
85 62
86const char *peak_names[] = {
87 "before",
88 "after",
89};
90
91enum uda1341_filter { 63enum uda1341_filter {
92 FLAT=0, 64 FLAT=0,
93 MIN, 65 MIN,
@@ -95,24 +67,6 @@ enum uda1341_filter {
95 MAX, 67 MAX,
96}; 68};
97 69
98const char *filter_names[] = {
99 "flat",
100 "min",
101 "min",
102 "max",
103};
104
105const char*bass_values[][16] = {
106 {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB",
107 "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat
108 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
109 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
110 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
111 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
112 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB",
113 "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max
114};
115
116enum uda1341_mixer { 70enum uda1341_mixer {
117 DOUBLE, 71 DOUBLE,
118 LINE, 72 LINE,
@@ -120,13 +74,6 @@ enum uda1341_mixer {
120 MIXER, 74 MIXER,
121}; 75};
122 76
123const char *mixer_names[] = {
124 "double differential",
125 "input channel 1 (line in)",
126 "input channel 2 (microphone)",
127 "digital mixer",
128};
129
130enum uda1341_deemp { 77enum uda1341_deemp {
131 NONE, 78 NONE,
132 D32, 79 D32,
@@ -134,58 +81,6 @@ enum uda1341_deemp {
134 D48, 81 D48,
135}; 82};
136 83
137const char *deemp_names[] = {
138 "none",
139 "32 kHz",
140 "44.1 kHz",
141 "48 kHz",
142};
143
144const char *mic_sens_value[] = {
145 "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used",
146};
147
148const unsigned short AGC_atime[] = {
149 11, 16, 11, 16, 21, 11, 16, 21,
150};
151
152const unsigned short AGC_dtime[] = {
153 100, 100, 200, 200, 200, 400, 400, 400,
154};
155
156const char *AGC_level[] = {
157 "-9.0", "-11.5", "-15.0", "-17.5",
158};
159
160const char *ig_small_value[] = {
161 "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5",
162};
163
164/*
165 * this was computed as peak_value[i] = pow((63-i)*1.42,1.013)
166 *
167 * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2
168 * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29
169 * [61]=-2.78, [62] = -1.48, [63] = 0.0
170 * I tried to compute it, but using but even using logarithm with base either 10 or 2
171 * i was'n able to get values in the table from the formula. So I constructed another
172 * formula (see above) to interpolate the values as good as possible. If there is some
173 * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks.
174 * UDA1341TS datasheet is available at:
175 * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf
176 */
177const char *peak_value[] = {
178 "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB",
179 "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB",
180 "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB",
181 "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB",
182 "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB",
183 "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB",
184 "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB",
185 "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB",
186 "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB",
187};
188
189enum uda1341_config { 84enum uda1341_config {
190 CMD_READ_REG = 0, 85 CMD_READ_REG = 0,
191 CMD_RESET, 86 CMD_RESET,
@@ -224,7 +119,7 @@ enum write_through {
224 FLUSH, 119 FLUSH,
225}; 120};
226 121
227int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt); 122int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt);
228 123
229/* 124/*
230 * Local variables: 125 * Local variables:
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 9d2cdfa0c42a..69944bbb5445 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -20,29 +20,25 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23typedef struct snd_util_memblk snd_util_memblk_t;
24typedef struct snd_util_memhdr snd_util_memhdr_t;
25typedef unsigned int snd_util_unit_t;
26
27/* 23/*
28 * memory block 24 * memory block
29 */ 25 */
30struct snd_util_memblk { 26struct snd_util_memblk {
31 snd_util_unit_t size; /* size of this block */ 27 unsigned int size; /* size of this block */
32 snd_util_unit_t offset; /* zero-offset of this block */ 28 unsigned int offset; /* zero-offset of this block */
33 struct list_head list; /* link */ 29 struct list_head list; /* link */
34}; 30};
35 31
36#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) 32#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk))
37 33
38/* 34/*
39 * memory management information 35 * memory management information
40 */ 36 */
41struct snd_util_memhdr { 37struct snd_util_memhdr {
42 snd_util_unit_t size; /* size of whole data */ 38 unsigned int size; /* size of whole data */
43 struct list_head block; /* block linked-list header */ 39 struct list_head block; /* block linked-list header */
44 int nblocks; /* # of allocated blocks */ 40 int nblocks; /* # of allocated blocks */
45 snd_util_unit_t used; /* used memory size */ 41 unsigned int used; /* used memory size */
46 int block_extra_size; /* extra data size of chunk */ 42 int block_extra_size; /* extra data size of chunk */
47 struct semaphore block_mutex; /* lock */ 43 struct semaphore block_mutex; /* lock */
48}; 44};
@@ -50,15 +46,17 @@ struct snd_util_memhdr {
50/* 46/*
51 * prototypes 47 * prototypes
52 */ 48 */
53snd_util_memhdr_t *snd_util_memhdr_new(int memsize); 49struct snd_util_memhdr *snd_util_memhdr_new(int memsize);
54void snd_util_memhdr_free(snd_util_memhdr_t *hdr); 50void snd_util_memhdr_free(struct snd_util_memhdr *hdr);
55snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 51struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
56int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 52int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
57int snd_util_mem_avail(snd_util_memhdr_t *hdr); 53int snd_util_mem_avail(struct snd_util_memhdr *hdr);
58 54
59/* functions without mutex */ 55/* functions without mutex */
60snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 56struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
61void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 57void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
62snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); 58struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr,
59 unsigned int units,
60 struct list_head *prev);
63 61
64#endif /* __SOUND_UTIL_MEM_H */ 62#endif /* __SOUND_UTIL_MEM_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index d1bd3b723967..919da0dd001c 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.10rc3" 2#define CONFIG_SND_VERSION "1.0.11rc2"
3#define CONFIG_SND_DATE " (Mon Nov 07 13:30:21 2005 UTC)" 3#define CONFIG_SND_DATE " (Wed Jan 04 08:57:20 2006 UTC)"
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 7a60a3888667..5fd6f3305e0d 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -36,9 +36,6 @@
36struct firmware; 36struct firmware;
37struct device; 37struct device;
38 38
39typedef struct snd_vx_core vx_core_t;
40typedef struct vx_pipe vx_pipe_t;
41
42#define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */ 39#define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */
43 40
44/* 41/*
@@ -76,7 +73,7 @@ struct vx_pipe {
76 int channels; 73 int channels;
77 unsigned int differed_type; 74 unsigned int differed_type;
78 pcx_time_t pcx_time; 75 pcx_time_t pcx_time;
79 snd_pcm_substream_t *substream; 76 struct snd_pcm_substream *substream;
80 77
81 int hbuf_size; /* H-buffer size in bytes */ 78 int hbuf_size; /* H-buffer size in bytes */
82 int buffer_bytes; /* the ALSA pcm buffer size in bytes */ 79 int buffer_bytes; /* the ALSA pcm buffer size in bytes */
@@ -88,36 +85,38 @@ struct vx_pipe {
88 u64 cur_count; /* current sample position (for playback) */ 85 u64 cur_count; /* current sample position (for playback) */
89 86
90 unsigned int references; /* an output pipe may be used for monitoring and/or playback */ 87 unsigned int references; /* an output pipe may be used for monitoring and/or playback */
91 vx_pipe_t *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ 88 struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/
92 89
93 struct tasklet_struct start_tq; 90 struct tasklet_struct start_tq;
94}; 91};
95 92
93struct vx_core;
94
96struct snd_vx_ops { 95struct snd_vx_ops {
97 /* low-level i/o */ 96 /* low-level i/o */
98 unsigned char (*in8)(vx_core_t *chip, int reg); 97 unsigned char (*in8)(struct vx_core *chip, int reg);
99 unsigned int (*in32)(vx_core_t *chip, int reg); 98 unsigned int (*in32)(struct vx_core *chip, int reg);
100 void (*out8)(vx_core_t *chip, int reg, unsigned char val); 99 void (*out8)(struct vx_core *chip, int reg, unsigned char val);
101 void (*out32)(vx_core_t *chip, int reg, unsigned int val); 100 void (*out32)(struct vx_core *chip, int reg, unsigned int val);
102 /* irq */ 101 /* irq */
103 int (*test_and_ack)(vx_core_t *chip); 102 int (*test_and_ack)(struct vx_core *chip);
104 void (*validate_irq)(vx_core_t *chip, int enable); 103 void (*validate_irq)(struct vx_core *chip, int enable);
105 /* codec */ 104 /* codec */
106 void (*write_codec)(vx_core_t *chip, int codec, unsigned int data); 105 void (*write_codec)(struct vx_core *chip, int codec, unsigned int data);
107 void (*akm_write)(vx_core_t *chip, int reg, unsigned int data); 106 void (*akm_write)(struct vx_core *chip, int reg, unsigned int data);
108 void (*reset_codec)(vx_core_t *chip); 107 void (*reset_codec)(struct vx_core *chip);
109 void (*change_audio_source)(vx_core_t *chip, int src); 108 void (*change_audio_source)(struct vx_core *chip, int src);
110 void (*set_clock_source)(vx_core_t *chp, int src); 109 void (*set_clock_source)(struct vx_core *chp, int src);
111 /* chip init */ 110 /* chip init */
112 int (*load_dsp)(vx_core_t *chip, int idx, const struct firmware *fw); 111 int (*load_dsp)(struct vx_core *chip, int idx, const struct firmware *fw);
113 void (*reset_dsp)(vx_core_t *chip); 112 void (*reset_dsp)(struct vx_core *chip);
114 void (*reset_board)(vx_core_t *chip, int cold_reset); 113 void (*reset_board)(struct vx_core *chip, int cold_reset);
115 int (*add_controls)(vx_core_t *chip); 114 int (*add_controls)(struct vx_core *chip);
116 /* pcm */ 115 /* pcm */
117 void (*dma_write)(vx_core_t *chip, snd_pcm_runtime_t *runtime, 116 void (*dma_write)(struct vx_core *chip, struct snd_pcm_runtime *runtime,
118 vx_pipe_t *pipe, int count); 117 struct vx_pipe *pipe, int count);
119 void (*dma_read)(vx_core_t *chip, snd_pcm_runtime_t *runtime, 118 void (*dma_read)(struct vx_core *chip, struct snd_pcm_runtime *runtime,
120 vx_pipe_t *pipe, int count); 119 struct vx_pipe *pipe, int count);
121}; 120};
122 121
123struct snd_vx_hardware { 122struct snd_vx_hardware {
@@ -158,10 +157,10 @@ enum {
158/* min/max values for analog output for old codecs */ 157/* min/max values for analog output for old codecs */
159#define VX_ANALOG_OUT_LEVEL_MAX 0xe3 158#define VX_ANALOG_OUT_LEVEL_MAX 0xe3
160 159
161struct snd_vx_core { 160struct vx_core {
162 /* ALSA stuff */ 161 /* ALSA stuff */
163 snd_card_t *card; 162 struct snd_card *card;
164 snd_pcm_t *pcm[VX_MAX_CODECS]; 163 struct snd_pcm *pcm[VX_MAX_CODECS];
165 int type; /* VX_TYPE_XXX */ 164 int type; /* VX_TYPE_XXX */
166 165
167 int irq; 166 int irq;
@@ -179,7 +178,7 @@ struct snd_vx_core {
179 unsigned int pcm_running; 178 unsigned int pcm_running;
180 179
181 struct device *dev; 180 struct device *dev;
182 snd_hwdep_t *hwdep; 181 struct snd_hwdep *hwdep;
183 182
184 struct vx_rmh irq_rmh; /* RMH used in interrupts */ 183 struct vx_rmh irq_rmh; /* RMH used in interrupts */
185 184
@@ -216,14 +215,14 @@ struct snd_vx_core {
216/* 215/*
217 * constructor 216 * constructor
218 */ 217 */
219vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, 218struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
220 struct snd_vx_ops *ops, int extra_size); 219 struct snd_vx_ops *ops, int extra_size);
221int snd_vx_setup_firmware(vx_core_t *chip); 220int snd_vx_setup_firmware(struct vx_core *chip);
222int snd_vx_load_boot_image(vx_core_t *chip, const struct firmware *dsp); 221int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *dsp);
223int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *dsp); 222int snd_vx_dsp_boot(struct vx_core *chip, const struct firmware *dsp);
224int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp); 223int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp);
225 224
226void snd_vx_free_firmware(vx_core_t *chip); 225void snd_vx_free_firmware(struct vx_core *chip);
227 226
228/* 227/*
229 * interrupt handler; exported for pcmcia 228 * interrupt handler; exported for pcmcia
@@ -233,37 +232,37 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs);
233/* 232/*
234 * lowlevel functions 233 * lowlevel functions
235 */ 234 */
236static inline int vx_test_and_ack(vx_core_t *chip) 235static inline int vx_test_and_ack(struct vx_core *chip)
237{ 236{
238 snd_assert(chip->ops->test_and_ack, return -ENXIO); 237 snd_assert(chip->ops->test_and_ack, return -ENXIO);
239 return chip->ops->test_and_ack(chip); 238 return chip->ops->test_and_ack(chip);
240} 239}
241 240
242static inline void vx_validate_irq(vx_core_t *chip, int enable) 241static inline void vx_validate_irq(struct vx_core *chip, int enable)
243{ 242{
244 snd_assert(chip->ops->validate_irq, return); 243 snd_assert(chip->ops->validate_irq, return);
245 chip->ops->validate_irq(chip, enable); 244 chip->ops->validate_irq(chip, enable);
246} 245}
247 246
248static inline unsigned char snd_vx_inb(vx_core_t *chip, int reg) 247static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg)
249{ 248{
250 snd_assert(chip->ops->in8, return 0); 249 snd_assert(chip->ops->in8, return 0);
251 return chip->ops->in8(chip, reg); 250 return chip->ops->in8(chip, reg);
252} 251}
253 252
254static inline unsigned int snd_vx_inl(vx_core_t *chip, int reg) 253static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg)
255{ 254{
256 snd_assert(chip->ops->in32, return 0); 255 snd_assert(chip->ops->in32, return 0);
257 return chip->ops->in32(chip, reg); 256 return chip->ops->in32(chip, reg);
258} 257}
259 258
260static inline void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val) 259static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val)
261{ 260{
262 snd_assert(chip->ops->out8, return); 261 snd_assert(chip->ops->out8, return);
263 chip->ops->out8(chip, reg, val); 262 chip->ops->out8(chip, reg, val);
264} 263}
265 264
266static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) 265static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val)
267{ 266{
268 snd_assert(chip->ops->out32, return); 267 snd_assert(chip->ops->out32, return);
269 chip->ops->out32(chip, reg, val); 268 chip->ops->out32(chip, reg, val);
@@ -274,27 +273,25 @@ static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val)
274#define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg) 273#define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg)
275#define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val) 274#define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val)
276 275
277void snd_vx_delay(vx_core_t *chip, int msec); 276static inline void vx_reset_dsp(struct vx_core *chip)
278
279static inline void vx_reset_dsp(vx_core_t *chip)
280{ 277{
281 snd_assert(chip->ops->reset_dsp, return); 278 snd_assert(chip->ops->reset_dsp, return);
282 chip->ops->reset_dsp(chip); 279 chip->ops->reset_dsp(chip);
283} 280}
284 281
285int vx_send_msg(vx_core_t *chip, struct vx_rmh *rmh); 282int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh);
286int vx_send_msg_nolock(vx_core_t *chip, struct vx_rmh *rmh); 283int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh);
287int vx_send_rih(vx_core_t *chip, int cmd); 284int vx_send_rih(struct vx_core *chip, int cmd);
288int vx_send_rih_nolock(vx_core_t *chip, int cmd); 285int vx_send_rih_nolock(struct vx_core *chip, int cmd);
289 286
290void vx_reset_codec(vx_core_t *chip, int cold_reset); 287void vx_reset_codec(struct vx_core *chip, int cold_reset);
291 288
292/* 289/*
293 * check the bit on the specified register 290 * check the bit on the specified register
294 * returns zero if a bit matches, or a negative error code. 291 * returns zero if a bit matches, or a negative error code.
295 * exported for vxpocket driver 292 * exported for vxpocket driver
296 */ 293 */
297int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time); 294int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time);
298#define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time) 295#define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time)
299#define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200) 296#define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200)
300#define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL) 297#define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL)
@@ -303,15 +300,15 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time);
303/* 300/*
304 * pseudo-DMA transfer 301 * pseudo-DMA transfer
305 */ 302 */
306static inline void vx_pseudo_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime, 303static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
307 vx_pipe_t *pipe, int count) 304 struct vx_pipe *pipe, int count)
308{ 305{
309 snd_assert(chip->ops->dma_write, return); 306 snd_assert(chip->ops->dma_write, return);
310 chip->ops->dma_write(chip, runtime, pipe, count); 307 chip->ops->dma_write(chip, runtime, pipe, count);
311} 308}
312 309
313static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime, 310static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
314 vx_pipe_t *pipe, int count) 311 struct vx_pipe *pipe, int count)
315{ 312{
316 snd_assert(chip->ops->dma_read, return); 313 snd_assert(chip->ops->dma_read, return);
317 chip->ops->dma_read(chip, runtime, pipe, count); 314 chip->ops->dma_read(chip, runtime, pipe, count);
@@ -329,27 +326,33 @@ static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtim
329/* 326/*
330 * pcm stuff 327 * pcm stuff
331 */ 328 */
332int snd_vx_pcm_new(vx_core_t *chip); 329int snd_vx_pcm_new(struct vx_core *chip);
333void vx_pcm_update_intr(vx_core_t *chip, unsigned int events); 330void vx_pcm_update_intr(struct vx_core *chip, unsigned int events);
334 331
335/* 332/*
336 * mixer stuff 333 * mixer stuff
337 */ 334 */
338int snd_vx_mixer_new(vx_core_t *chip); 335int snd_vx_mixer_new(struct vx_core *chip);
339void vx_toggle_dac_mute(vx_core_t *chip, int mute); 336void vx_toggle_dac_mute(struct vx_core *chip, int mute);
340int vx_sync_audio_source(vx_core_t *chip); 337int vx_sync_audio_source(struct vx_core *chip);
341int vx_set_monitor_level(vx_core_t *chip, int audio, int level, int active); 338int vx_set_monitor_level(struct vx_core *chip, int audio, int level, int active);
342 339
343/* 340/*
344 * IEC958 & clock stuff 341 * IEC958 & clock stuff
345 */ 342 */
346void vx_set_iec958_status(vx_core_t *chip, unsigned int bits); 343void vx_set_iec958_status(struct vx_core *chip, unsigned int bits);
347int vx_set_clock(vx_core_t *chip, unsigned int freq); 344int vx_set_clock(struct vx_core *chip, unsigned int freq);
348void vx_set_internal_clock(vx_core_t *chip, unsigned int freq); 345void vx_set_internal_clock(struct vx_core *chip, unsigned int freq);
349int vx_change_frequency(vx_core_t *chip); 346int vx_change_frequency(struct vx_core *chip);
350 347
351 348
352/* 349/*
350 * PM
351 */
352int snd_vx_suspend(struct vx_core *card, pm_message_t state);
353int snd_vx_resume(struct vx_core *card);
354
355/*
353 * hardware constants 356 * hardware constants
354 */ 357 */
355 358
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index c3bccbfd8d4c..d567bfdbf513 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -184,7 +184,7 @@
184 * 184 *
185 */ 185 */
186 186
187typedef struct _snd_ymfpci_playback_bank { 187struct snd_ymfpci_playback_bank {
188 u32 format; 188 u32 format;
189 u32 loop_default; 189 u32 loop_default;
190 u32 base; /* 32-bit address */ 190 u32 base; /* 32-bit address */
@@ -215,46 +215,45 @@ typedef struct _snd_ymfpci_playback_bank {
215 u32 eff3_gain; 215 u32 eff3_gain;
216 u32 lpfD1; 216 u32 lpfD1;
217 u32 lpfD2; 217 u32 lpfD2;
218} snd_ymfpci_playback_bank_t; 218 };
219 219
220typedef struct _snd_ymfpci_capture_bank { 220struct snd_ymfpci_capture_bank {
221 u32 base; /* 32-bit address */ 221 u32 base; /* 32-bit address */
222 u32 loop_end; /* 32-bit offset */ 222 u32 loop_end; /* 32-bit offset */
223 u32 start; /* 32-bit offset */ 223 u32 start; /* 32-bit offset */
224 u32 num_of_loops; /* counter */ 224 u32 num_of_loops; /* counter */
225} snd_ymfpci_capture_bank_t; 225};
226 226
227typedef struct _snd_ymfpci_effect_bank { 227struct snd_ymfpci_effect_bank {
228 u32 base; /* 32-bit address */ 228 u32 base; /* 32-bit address */
229 u32 loop_end; /* 32-bit offset */ 229 u32 loop_end; /* 32-bit offset */
230 u32 start; /* 32-bit offset */ 230 u32 start; /* 32-bit offset */
231 u32 temp; 231 u32 temp;
232} snd_ymfpci_effect_bank_t; 232};
233 233
234typedef struct _snd_ymfpci_voice ymfpci_voice_t; 234struct snd_ymfpci_pcm;
235typedef struct _snd_ymfpci_pcm ymfpci_pcm_t; 235struct snd_ymfpci;
236typedef struct _snd_ymfpci ymfpci_t;
237 236
238typedef enum { 237enum snd_ymfpci_voice_type {
239 YMFPCI_PCM, 238 YMFPCI_PCM,
240 YMFPCI_SYNTH, 239 YMFPCI_SYNTH,
241 YMFPCI_MIDI 240 YMFPCI_MIDI
242} ymfpci_voice_type_t; 241};
243 242
244struct _snd_ymfpci_voice { 243struct snd_ymfpci_voice {
245 ymfpci_t *chip; 244 struct snd_ymfpci *chip;
246 int number; 245 int number;
247 unsigned int use: 1, 246 unsigned int use: 1,
248 pcm: 1, 247 pcm: 1,
249 synth: 1, 248 synth: 1,
250 midi: 1; 249 midi: 1;
251 snd_ymfpci_playback_bank_t *bank; 250 struct snd_ymfpci_playback_bank *bank;
252 dma_addr_t bank_addr; 251 dma_addr_t bank_addr;
253 void (*interrupt)(ymfpci_t *chip, ymfpci_voice_t *voice); 252 void (*interrupt)(struct snd_ymfpci *chip, struct snd_ymfpci_voice *voice);
254 ymfpci_pcm_t *ypcm; 253 struct snd_ymfpci_pcm *ypcm;
255}; 254};
256 255
257typedef enum { 256enum snd_ymfpci_pcm_type {
258 PLAYBACK_VOICE, 257 PLAYBACK_VOICE,
259 CAPTURE_REC, 258 CAPTURE_REC,
260 CAPTURE_AC97, 259 CAPTURE_AC97,
@@ -263,13 +262,13 @@ typedef enum {
263 EFFECT_EFF1, 262 EFFECT_EFF1,
264 EFFECT_EFF2, 263 EFFECT_EFF2,
265 EFFECT_EFF3 264 EFFECT_EFF3
266} snd_ymfpci_pcm_type_t; 265};
267 266
268struct _snd_ymfpci_pcm { 267struct snd_ymfpci_pcm {
269 ymfpci_t *chip; 268 struct snd_ymfpci *chip;
270 snd_ymfpci_pcm_type_t type; 269 enum snd_ymfpci_pcm_type type;
271 snd_pcm_substream_t *substream; 270 struct snd_pcm_substream *substream;
272 ymfpci_voice_t *voices[2]; /* playback only */ 271 struct snd_ymfpci_voice *voices[2]; /* playback only */
273 unsigned int running: 1; 272 unsigned int running: 1;
274 unsigned int output_front: 1; 273 unsigned int output_front: 1;
275 unsigned int output_rear: 1; 274 unsigned int output_rear: 1;
@@ -282,7 +281,7 @@ struct _snd_ymfpci_pcm {
282 u32 shift; 281 u32 shift;
283}; 282};
284 283
285struct _snd_ymfpci { 284struct snd_ymfpci {
286 int irq; 285 int irq;
287 286
288 unsigned int device_id; /* PCI device ID */ 287 unsigned int device_id; /* PCI device ID */
@@ -316,47 +315,47 @@ struct _snd_ymfpci {
316 struct snd_dma_buffer ac3_tmp_base; 315 struct snd_dma_buffer ac3_tmp_base;
317 316
318 u32 *ctrl_playback; 317 u32 *ctrl_playback;
319 snd_ymfpci_playback_bank_t *bank_playback[YDSXG_PLAYBACK_VOICES][2]; 318 struct snd_ymfpci_playback_bank *bank_playback[YDSXG_PLAYBACK_VOICES][2];
320 snd_ymfpci_capture_bank_t *bank_capture[YDSXG_CAPTURE_VOICES][2]; 319 struct snd_ymfpci_capture_bank *bank_capture[YDSXG_CAPTURE_VOICES][2];
321 snd_ymfpci_effect_bank_t *bank_effect[YDSXG_EFFECT_VOICES][2]; 320 struct snd_ymfpci_effect_bank *bank_effect[YDSXG_EFFECT_VOICES][2];
322 321
323 int start_count; 322 int start_count;
324 323
325 u32 active_bank; 324 u32 active_bank;
326 ymfpci_voice_t voices[64]; 325 struct snd_ymfpci_voice voices[64];
327 326
328 ac97_bus_t *ac97_bus; 327 struct snd_ac97_bus *ac97_bus;
329 ac97_t *ac97; 328 struct snd_ac97 *ac97;
330 snd_rawmidi_t *rawmidi; 329 struct snd_rawmidi *rawmidi;
331 snd_timer_t *timer; 330 struct snd_timer *timer;
332 331
333 struct pci_dev *pci; 332 struct pci_dev *pci;
334 snd_card_t *card; 333 struct snd_card *card;
335 snd_pcm_t *pcm; 334 struct snd_pcm *pcm;
336 snd_pcm_t *pcm2; 335 struct snd_pcm *pcm2;
337 snd_pcm_t *pcm_spdif; 336 struct snd_pcm *pcm_spdif;
338 snd_pcm_t *pcm_4ch; 337 struct snd_pcm *pcm_4ch;
339 snd_pcm_substream_t *capture_substream[YDSXG_CAPTURE_VOICES]; 338 struct snd_pcm_substream *capture_substream[YDSXG_CAPTURE_VOICES];
340 snd_pcm_substream_t *effect_substream[YDSXG_EFFECT_VOICES]; 339 struct snd_pcm_substream *effect_substream[YDSXG_EFFECT_VOICES];
341 snd_kcontrol_t *ctl_vol_recsrc; 340 struct snd_kcontrol *ctl_vol_recsrc;
342 snd_kcontrol_t *ctl_vol_adcrec; 341 struct snd_kcontrol *ctl_vol_adcrec;
343 snd_kcontrol_t *ctl_vol_spdifrec; 342 struct snd_kcontrol *ctl_vol_spdifrec;
344 unsigned short spdif_bits, spdif_pcm_bits; 343 unsigned short spdif_bits, spdif_pcm_bits;
345 snd_kcontrol_t *spdif_pcm_ctl; 344 struct snd_kcontrol *spdif_pcm_ctl;
346 int mode_dup4ch; 345 int mode_dup4ch;
347 int rear_opened; 346 int rear_opened;
348 int spdif_opened; 347 int spdif_opened;
349 struct { 348 struct {
350 u16 left; 349 u16 left;
351 u16 right; 350 u16 right;
352 snd_kcontrol_t *ctl; 351 struct snd_kcontrol *ctl;
353 } pcm_mixer[32]; 352 } pcm_mixer[32];
354 353
355 spinlock_t reg_lock; 354 spinlock_t reg_lock;
356 spinlock_t voice_lock; 355 spinlock_t voice_lock;
357 wait_queue_head_t interrupt_sleep; 356 wait_queue_head_t interrupt_sleep;
358 atomic_t interrupt_sleep_count; 357 atomic_t interrupt_sleep_count;
359 snd_info_entry_t *proc_entry; 358 struct snd_info_entry *proc_entry;
360 359
361#ifdef CONFIG_PM 360#ifdef CONFIG_PM
362 u32 *saved_regs; 361 u32 *saved_regs;
@@ -364,17 +363,20 @@ struct _snd_ymfpci {
364#endif 363#endif
365}; 364};
366 365
367int snd_ymfpci_create(snd_card_t * card, 366int snd_ymfpci_create(struct snd_card *card,
368 struct pci_dev *pci, 367 struct pci_dev *pci,
369 unsigned short old_legacy_ctrl, 368 unsigned short old_legacy_ctrl,
370 ymfpci_t ** rcodec); 369 struct snd_ymfpci ** rcodec);
371void snd_ymfpci_free_gameport(ymfpci_t *chip); 370void snd_ymfpci_free_gameport(struct snd_ymfpci *chip);
372 371
373int snd_ymfpci_pcm(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 372int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state);
374int snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 373int snd_ymfpci_resume(struct pci_dev *pci);
375int snd_ymfpci_pcm_spdif(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 374
376int snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 375int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
377int snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch); 376int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_timer(ymfpci_t *chip, int device); 377int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
379int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch);
380int snd_ymfpci_timer(struct snd_ymfpci *chip, int device);
379 381
380#endif /* __SOUND_YMFPCI_H */ 382#endif /* __SOUND_YMFPCI_H */