X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fsound%2Fcore.h;h=846852299306e8623114a2cdf6b958561bf1c811;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=c6434a8cd63a2de5e4fd77d1270446340ebe7a19;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/include/sound/core.h b/include/sound/core.h index c6434a8cd..846852299 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -163,8 +163,10 @@ struct _snd_card { struct device *dev; #ifdef CONFIG_PM - int (*set_power_state) (snd_card_t *card, unsigned int state); - void *power_state_private_data; + int (*pm_suspend)(snd_card_t *card, unsigned int state); + int (*pm_resume)(snd_card_t *card, unsigned int state); + struct pm_dev *pm_dev; /* for ISA */ + void *pm_private_data; unsigned int power_state; /* power state */ struct semaphore power_lock; /* power lock */ wait_queue_head_t power_sleep; @@ -199,12 +201,36 @@ static inline void snd_power_change_state(snd_card_t *card, unsigned int state) card->power_state = state; wake_up(&card->power_sleep); } +int snd_card_set_pm_callback(snd_card_t *card, + int (*suspend)(snd_card_t *, unsigned int), + int (*resume)(snd_card_t *, unsigned int), + void *private_data); +int snd_card_set_dev_pm_callback(snd_card_t *card, int type, + int (*suspend)(snd_card_t *, unsigned int), + int (*resume)(snd_card_t *, unsigned int), + void *private_data); +#define snd_card_set_isa_pm_callback(card,suspend,resume,data) \ + snd_card_set_dev_pm_callback(card, PM_ISA_DEV, suspend, resume, data) +#ifdef CONFIG_PCI +#ifndef SND_PCI_PM_CALLBACKS +int snd_card_pci_suspend(struct pci_dev *dev, u32 state); +int snd_card_pci_resume(struct pci_dev *dev); +#define SND_PCI_PM_CALLBACKS \ + .suspend = snd_card_pci_suspend, .resume = snd_card_pci_resume +#endif +#endif #else #define snd_power_lock(card) do { (void)(card); } while (0) #define snd_power_unlock(card) do { (void)(card); } while (0) static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct file *file) { return 0; } #define snd_power_get_state(card) SNDRV_CTL_POWER_D0 #define snd_power_change_state(card, state) do { (void)(card); } while (0) +#define snd_card_set_pm_callback(card,suspend,resume,data) +#define snd_card_set_dev_pm_callback(card,suspend,resume,data) +#define snd_card_set_isa_pm_callback(card,suspend,resume,data) +#ifdef CONFIG_PCI +#define SND_PCI_PM_CALLBACKS +#endif #endif /* device.c */ @@ -246,7 +272,7 @@ int snd_oss_init_module(void); #else #define snd_minor_info_oss_init() /*NOP*/ #define snd_minor_info_oss_done() /*NOP*/ -#define snd_oss_init_module() /*NOP*/ +#define snd_oss_init_module() 0 #endif /* memory.c */ @@ -257,10 +283,12 @@ void snd_memory_done(void); int snd_memory_info_init(void); int snd_memory_info_done(void); void *snd_hidden_kmalloc(size_t size, int flags); +void *snd_hidden_kcalloc(size_t n, size_t size, int flags); void snd_hidden_kfree(const void *obj); void *snd_hidden_vmalloc(unsigned long size); void snd_hidden_vfree(void *obj); #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) +#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) #define kfree(obj) snd_hidden_kfree(obj) #define vmalloc(size) snd_hidden_vmalloc(size) #define vfree(obj) snd_hidden_vfree(obj) @@ -278,10 +306,9 @@ void snd_hidden_vfree(void *obj); #define kfree_nocheck(obj) kfree(obj) #define vfree_nocheck(obj) vfree(obj) #endif -void *snd_kcalloc(size_t size, int flags); char *snd_kmalloc_strdup(const char *string, int flags); -int copy_to_user_fromio(void *dst, unsigned long src, size_t count); -int copy_from_user_toio(unsigned long dst, const void *src, size_t count); +int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count); +int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count); /* init.c */ @@ -389,7 +416,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) * not checked. */ #define snd_assert(expr, args...) do {\ - if (!(expr)) {\ + if (unlikely(!(expr))) { \ snd_printk("BUG? (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ args;\ }\ @@ -405,7 +432,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) * CONFIG_SND_DEBUG is not set but without any error messages. */ #define snd_runtime_check(expr, args...) do {\ - if (!(expr)) {\ + if (unlikely(!(expr))) { \ snd_printk("ERROR (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ args;\ }\