Changeset 441 for GPL/trunk/alsa-kernel/include/sound/config.h
- Timestamp:
- Jun 6, 2009, 4:22:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/alsa-kernel/include/sound/config.h
r438 r441 27 27 #include <linux/fs.h> 28 28 #include <linux/err.h> 29 #include <linux/gfp.h> 30 #include <linux/workqueue.h> 29 31 #include <linux/byteorder/little_endian.h> 32 #include <linux/lockdep.h> 33 #include <linux/string.h> 30 34 #include <asm/ioctl.h> 31 35 #include <asm/hardirq.h> … … 35 39 #include <limits.h> 36 40 #include <sys/cdefs.h> 37 38 #ifndef __iomem 39 #define __iomem 40 #endif 41 42 #ifndef __deprecated 43 # define __deprecated /* unimplemented */ 44 #endif 41 #include <stdio.h> 45 42 46 43 typedef unsigned int fmode_t; 47 48 #ifndef cond_resched49 #define cond_resched() \50 do { \51 if (1) { \52 set_current_state(TASK_RUNNING); \53 schedule(); \54 } \55 } while (0)56 #endif57 44 58 45 /* … … 68 55 #include <linux/version.h> 69 56 70 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 3)71 #error "This driver requires Linux 2.2.3 and higher."72 #endif73 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 2, 0)74 57 #define LINUX_2_2 75 #endif76 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 1)77 #define LINUX_2_378 #endif79 #if defined(LINUX_2_3) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)80 #error "This code requires Linux 2.4.0-test1 and higher."81 #endif82 58 83 59 #ifdef ALSA_BUILD … … 86 62 #include <linux/modversions.h> 87 63 #include "sndversions.h" 88 #endif89 #ifdef SNDRV_NO_MODVERS90 #undef MODVERSIONS91 #undef _set_ver92 64 #endif 93 65 #endif /* ALSA_BUILD */ … … 122 94 #include <linux/poll.h> 123 95 #include <linux/reboot.h> 124 125 #ifdef LINUX_2_2126 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 2, 18)127 96 #include <linux/init.h> 128 #endif129 97 #include "compat_22.h" 130 #endif131 #ifdef LINUX_2_3132 #include <linux/init.h>133 #include <linux/pm.h>134 #define PCI_GET_DRIVER_DATA(pci) pci->driver_data135 #define PCI_SET_DRIVER_DATA(pci, data) pci->driver_data = data136 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3)137 //#define pci_set_dma_mask(pci, mask) pci->dma_mask = mask138 #endif139 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 7)140 #define PCI_NEW_SUSPEND141 #endif142 #ifndef virt_to_page143 #define virt_to_page(x) (&mem_map[MAP_NR(x)])144 #endif145 #define snd_request_region request_region146 #ifndef rwlock_init147 #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)148 #endif149 #define snd_kill_fasync(fp, sig, band) kill_fasync(fp, sig, band)150 #if defined(__i386__) || defined(__ppc__)151 /*152 * Here a dirty hack for 2.4 kernels.. See kernel/memory.c.153 */154 #define HACK_PCI_ALLOC_CONSISTENT155 void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size,156 dma_addr_t *dma_handle);157 #undef pci_alloc_consistent158 #define pci_alloc_consistent snd_pci_hack_alloc_consistent159 #endif /* i386 or ppc */160 #endif161 98 162 99 #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) … … 172 109 #endif 173 110 174 #ifndef PCI_D0175 #define PCI_D0 0176 #define PCI_D1 1177 #define PCI_D2 2178 #define PCI_D3hot 3179 #define PCI_D3cold 4180 #define pci_choose_state(pci,state) ((state) ? PCI_D3hot : PCI_D0)181 #endif182 183 184 111 #include <sound/asound.h> 185 112 #include <sound/asoundef.h> 186 113 187 /* wrapper for getnstimeofday() 188 * it's needed for recent 2.6 kernels, too, due to lack of EXPORT_SYMBOL 189 */ 190 #define getnstimeofday(x) do { \ 191 struct timeval __x; \ 192 do_gettimeofday(&__x); \ 193 (x)->tv_sec = __x.tv_sec; \ 194 (x)->tv_nsec = __x.tv_usec * 1000; \ 195 } while (0) 196 197 struct work_struct { 198 unsigned long pending; 199 struct list_head entry; 200 void (*func)(void *); 201 void *data; 202 void *wq_data; 203 struct timer_list timer; 204 }; 205 206 struct delayed_work { 207 struct work_struct work; 208 }; 209 210 #define INIT_WORK(_work, _func, _data) \ 211 do { \ 212 (_work)->func = _func; \ 213 (_work)->data = _data; \ 214 init_timer(&(_work)->timer); \ 215 } while (0) 216 #define __WORK_INITIALIZER(n, f, d) { \ 217 .func = (f), \ 218 .data = (d), \ 219 } 220 #define DECLARE_WORK(n, f, d) \ 221 struct work_struct n = __WORK_INITIALIZER(n, f, d) 114 222 115 int snd_compat_schedule_work(struct work_struct *work); 223 116 #define schedule_work(w) snd_compat_schedule_work(w) … … 227 120 /* Name change */ 228 121 typedef struct timeval snd_timestamp_t; 229 #ifndef TARGET_OS2230 typedef enum sndrv_card_type snd_card_type;231 #endif232 122 typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t; 233 #ifndef TARGET_OS2234 typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;235 #endif236 #ifdef TARGET_OS2237 //typedef struct snd_pcm_volume snd_pcm_volume_t;238 #else239 typedef enum sndrv_timer_global snd_timer_global_t;240 #endif241 242 /* redefine INIT_WORK() */243 static inline void snd_INIT_WORK(struct work_struct *w, void (*f)(struct work_struct *))244 {245 INIT_WORK(w, (void(*)(void*))(f), w);246 }247 #undef INIT_WORK248 #define INIT_WORK(w,f) snd_INIT_WORK(w,f)249 123 250 124 #ifdef CONFIG_SND_DEBUG_MEMORY … … 257 131 void snd_wrapper_vfree(void *); 258 132 #undef vfree 259 #endif260 261 #if defined(__alpha__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 14)262 #undef writeb263 #define writeb(v, a) do { __writeb((v),(a)); mb(); } while(0)264 #undef writew265 #define writew(v, a) do {__writew((v),(a)); mb(); } while(0)266 #undef writel267 #define writel(v, a) do {__writel((v),(a)); mb(); } while(0)268 #undef writeq269 #define writeq(v, a) do {__writeq((v),(a)); mb(); } while(0)270 #endif271 272 /* do we have virt_to_bus? */273 #if defined(CONFIG_SPARC64)274 #undef HAVE_VIRT_TO_BUS275 #else276 #define HAVE_VIRT_TO_BUS 1277 133 #endif 278 134 … … 314 170 #undef interrupt 315 171 316 #define fops_get(x) (x)317 #define fops_put(x) do { ; } while (0)318 172 #define __builtin_return_address(a) 0 319 #define SetPageReserved(a) a 320 #define ClearPageReserved(a) a 321 #define set_current_state(a) 322 #define try_inc_mod_count(x) ++(*(unsigned long *)x) 323 #define try_module_get(x) try_inc_mod_count(x) 324 static inline void module_put(struct module *module) 325 { 326 if (module) 327 do {} while(0); 328 } 329 330 #define rwlock_init(x) *(x) = RW_LOCK_UNLOCKED; 331 332 #define suser() 1 333 334 #define snd_kill_fasync(fp, sig, band) kill_fasync(*(fp), sig, band) 335 336 337 //what's this?? 338 #define capable(a) 1 339 #define CAP_SYS_ADMIN 0 340 341 #define BITS_PER_LONG 32 342 343 #ifndef bitmap_member 344 #define bitmap_member(name,bits) \ 345 unsigned long name[((bits)+BITS_PER_LONG-1)/BITS_PER_LONG] 346 #endif 347 348 #ifndef snd_card_set_dev 349 #define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 350 #endif 351 352 /* for easier backward-porting */ 353 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) 354 #ifndef gameport_set_dev_parent 355 #define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev)) 356 #define gameport_set_port_data(gp,r) ((gp)->port_data = (r)) 357 #define gameport_get_port_data(gp) (gp)->port_data 358 #endif 359 #endif 360 361 /* misc.c */ 362 struct resource; 363 void release_and_free_resource(struct resource *res); 364 365 #include "typedefs.h" 366 #define container_of(ptr, type, member) \ 367 ( (type *)( (char *)ptr - offsetof(type,member) ) ) 368 _WCRTLINK extern int snprintf( char *__buf, size_t __bufsize, 369 const char *__fmt, ... ); 370 #define offsetof(__typ,__id) ((size_t)&(((__typ*)0)->__id)) 371 #define list_for_each_entry(itemptr, headptr, struct_listmember_name, container_type) \ 372 for (itemptr=(container_type *) \ 373 (((char *)((headptr)->next))-offsetof(container_type, struct_listmember_name)); \ 374 &(itemptr->struct_listmember_name)!=(headptr); \ 375 itemptr=(container_type *) \ 376 (((char *)(itemptr->struct_listmember_name.next))-offsetof(container_type, struct_listmember_name))) 377 378 #define list_for_each_entry_safe(itemptr, n, headptr, struct_listmember_name, container_type) \ 379 for (itemptr=(container_type *) \ 380 (((char *)((headptr)->next))-offsetof(container_type, struct_listmember_name)), \ 381 n=(container_type *) \ 382 (((char *)(itemptr->struct_listmember_name.next))-offsetof(container_type, struct_listmember_name)); \ 383 &(itemptr->struct_listmember_name)!=(headptr); \ 384 itemptr=n, \ 385 n=(container_type *) \ 386 (((char *)(n->struct_listmember_name.next))-offsetof(container_type, struct_listmember_name))) 387 #define flush_scheduled_work() 388 389 /* schedule_timeout_[un]interruptible() wrappers */ 390 #include <linux/sched.h> 391 #define schedule_timeout_interruptible(x) \ 392 set_current_state(TASK_INTERRUPTIBLE); \ 393 schedule_timeout(x); 394 395 #define schedule_timeout_uninterruptible(x) \ 396 set_current_state(TASK_UNINTERRUPTIBLE); \ 397 schedule_timeout(x); 398 399 400 /* pm_message_t type */ 401 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11) 402 #include <linux/pm.h> 403 #ifndef PMSG_FREEZE 404 typedef u32 pm_message_t; 405 #define PMSG_FREEZE 3 406 #define PMSG_SUSPEND 3 407 #define PMSG_ON 0 408 #endif 409 #endif 410 411 #ifndef imajor 412 #define imajor(x) major((x)->i_rdev) 413 #endif 414 415 #ifndef __nocast 416 #define __nocast 417 #endif 418 419 typedef unsigned __nocast gfp_t; 173 #define __builtin_expect(x, expected_value) (x) 174 420 175 421 176 #ifndef CONFIG_HAVE_KZALLOC 422 177 void *snd_compat_kzalloc(size_t n, gfp_t gfp_flags); 423 178 #define kzalloc(s,f) snd_compat_kzalloc(s,f) 424 425 #endif 426 427 static inline struct proc_dir_entry *PDE(const struct inode *inode) 428 { 429 return (struct proc_dir_entry *) inode->u.generic_ip; 430 } 179 #endif 431 180 432 181 #ifndef CONFIG_HAVE_KSTRDUP … … 450 199 #define BUG_ON(x) /* nothing */ 451 200 #endif 452 #define MODULE_ALIAS_CHARDEV_MAJOR(x) 453 typedef unsigned gfp_t; 454 455 #ifndef __devexit_p 456 #define __devexit_p(x) x 457 #endif 458 459 #define printk_ratelimit() 1 460 #define __builtin_expect(x, expected_value) (x) 461 #define likely(x) __builtin_expect((x),1) 462 #define unlikely(x) __builtin_expect((x),0) 463 464 #define smp_mb__after_clear_bit() 201 465 202 int snd_compat_devfs_mk_dir(const char *dir, ...); 466 203 #define devfs_mk_dir snd_compat_devfs_mk_dir … … 471 208 #define SINGLE_DEPTH_NESTING 1 472 209 473 struct iovec {474 char *iov_base; /* Base address. */475 #ifdef __32BIT__476 size_t iov_len; /* Length. */477 #else478 long iov_len; /* Length. */479 #endif480 };481 #define SEEK_SET 0482 #define SEEK_CUR 1483 #define SEEK_END 2484 485 #ifndef IRQF_SHARED486 #include <linux/signal.h>487 #define IRQF_SHARED SA_SHIRQ488 #define IRQF_DISABLED SA_INTERRUPT489 #define IRQF_SAMPLE_RANDOM SA_SAMPLE_RANDOM490 #define IRQF_PERCPU SA_PERCPU491 #ifdef SA_PROBEIRQ492 #define IRQF_PROBE_SHARED SA_PROBEIRQ493 #else494 #define IRQF_PROBE_SHARED 0 /* dummy */495 #endif496 #endif /* IRQ_SHARED */497 498 #ifndef MODULE_FIRMWARE499 #define MODULE_FIRMWARE(x)500 #endif501 502 typedef irqreturn_t (*snd_irq_handler_t)(int, void *);503 #define irq_handler_t snd_irq_handler_t504 #undef irq_handler_t505 #define irq_handler_t snd_irq_handler_t506 int request_irq(unsigned int, irq_handler_t handler,507 unsigned long, const char *, void *);508 509 #ifndef MODULE_ALIAS510 #define MODULE_ALIAS(x)511 #define MODULE_ALIAS_CHARDEV_MAJOR(x)512 #endif513 514 #ifndef cpu_relax515 #define cpu_relax()516 #endif517 518 210 #ifndef roundup 519 211 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 520 212 #endif 521 213 522 /*523 * lockdep macros524 */525 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17)526 #define lockdep_set_class(lock, key) do { (void)(key); } while (0)527 #define down_read_nested(sem, subclass) down_read(sem)528 #define down_write_nested(sem, subclass) down_write(sem)529 #define down_read_non_owner(sem) down_read(sem)530 #define up_read_non_owner(sem) up_read(sem)531 #define spin_lock_nested(lock, x) spin_lock(lock)532 #define spin_lock_irqsave_nested(lock, f, x) spin_lock_irqsave(lock, f)533 #endif534 214 535 215 /* msleep */ … … 539 219 #endif 540 220 541 #define do_posix_clock_monotonic_gettime getnstimeofday542 543 static inline unsigned char snd_pci_revision(struct pci_dev *pci)544 {545 unsigned char rev;546 pci_read_config_byte(pci, PCI_REVISION_ID, &rev);547 return rev;548 }549 550 #ifndef ALIGN551 #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))552 #endif553 554 /* pci_intx() wrapper */555 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)556 #ifdef CONFIG_PCI557 #undef pci_intx558 #define pci_intx(pci,x)559 #endif560 #endif561 562 /* MSI */563 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 8)564 static inline int snd_pci_enable_msi(struct pci_dev *dev) { return -1; }565 #undef pci_enable_msi566 #define pci_enable_msi(dev) snd_pci_enable_msi(dev)567 #undef pci_disable_msi568 #define pci_disable_msi(dev)569 #endif570 571 /**572 * list_move_tail - delete from one list and add as another's tail573 * @list: the entry to move574 * @head: the head that will follow our entry575 */576 static inline void list_move_tail(struct list_head *list,577 struct list_head *head)578 {579 __list_del(list->prev, list->next);580 list_add_tail(list, head);581 }582 583 221 #define assert(a) 584 585 #ifndef fastcall586 #define fastcall587 #endif588 589 /* dump_stack hack */590 #ifndef CONFIG_HAVE_DUMP_STACK591 #undef dump_stack592 #define dump_stack()593 #endif594 595 #define pci_dev_present(x) snd_pci_dev_present(x)596 597 /* definitions for functions in pci_iomap_compat.c */598 #ifndef fastcall599 #define fastcall600 #endif601 602 unsigned int fastcall ioread8(void __iomem *addr);603 unsigned int fastcall ioread16(void __iomem *addr);604 unsigned int fastcall ioread32(void __iomem *addr);605 void fastcall iowrite8(u8 val, void __iomem *addr);606 void fastcall iowrite16(u16 val, void __iomem *addr);607 void fastcall iowrite32(u32 val, void __iomem *addr);608 void __iomem *ioport_map(unsigned long port, unsigned int nr);609 void ioport_unmap(void __iomem *addr);610 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen);611 void pci_iounmap(struct pci_dev *dev, void __iomem * addr);612 613 #ifndef upper_32_bits614 #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))615 #endif616 617 #ifdef __SMP__618 #define smp_mb() mb()619 #define smp_rmb() rmb()620 #define smp_wmb() wmb()621 #else622 #define smp_mb() barrier()623 #define smp_rmb() barrier()624 #define smp_wmb() barrier()625 #endif626 627 #define GFP_DMA32 0 /* driver must check for 32-bit address */628 #define __GFP_COMP 0629 #define __GFP_NOWARN 0630 #define __GFP_NORETRY 0631 632 #define page_to_pfn(page) (page_to_phys(page) >> PAGE_SHIFT)633 typedef __u32 __le32;634 635 /*636 * pci_ioremap_bar() wrapper637 */638 #ifdef CONFIG_PCI639 #ifndef CONFIG_HAVE_PCI_IOREMAP_BAR640 extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);641 #include <linux/pci.h>642 static inline void *pci_ioremap_bar(struct pci_dev *pdev, int bar)643 {644 #if 0645 return ioremap_nocache(pci_resource_start(pdev, bar),646 pci_resource_len(pdev, bar));647 #else648 return __ioremap(pci_resource_start(pdev, bar),649 pci_resource_len(pdev, bar),0x010);650 #endif651 }652 #endif653 #endif654 655 #ifndef DMA_BIT_MASK656 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))657 #endif658 222 659 223 /* memdup_user() wrapper */ … … 674 238 #endif 675 239 676 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 6)677 #include <linux/workqueue.h>678 #ifndef create_singlethread_workqueue679 #define create_singlethread_workqueue(name) create_workqueue(name)680 #endif681 #endif682 683 240 #endif //__ALSA_CONFIG_H__ 241
Note:
See TracChangeset
for help on using the changeset viewer.