*/
#include <linux/sched.h> /* wake_up() */
-#include <linux/mutex.h> /* struct mutex */
+#include <asm/semaphore.h> /* struct semaphore */
#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/workqueue.h> /* struct workqueue_struct */
#include <linux/pm.h> /* pm_message_t */
#ifdef CONFIG_PM
unsigned int power_state; /* power state */
- struct mutex power_lock; /* power lock */
+ struct semaphore power_lock; /* power lock */
wait_queue_head_t power_sleep;
#endif
#ifdef CONFIG_PM
static inline void snd_power_lock(struct snd_card *card)
{
- mutex_lock(&card->power_lock);
+ down(&card->power_lock);
}
static inline void snd_power_unlock(struct snd_card *card)
{
- mutex_unlock(&card->power_lock);
+ up(&card->power_lock);
}
static inline unsigned int snd_power_get_state(struct snd_card *card)
}
/* init.c */
-int snd_power_wait(struct snd_card *card, unsigned int power_state);
+int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file);
#else /* ! CONFIG_PM */
#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(struct snd_card *card, unsigned int state) { return 0; }
+static inline int snd_power_wait(struct snd_card *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)
int type; /* SNDRV_DEVICE_TYPE_XXX */
int card; /* card number */
int device; /* device number */
- const struct file_operations *f_ops; /* file operations */
+ struct file_operations *f_ops; /* file operations */
void *private_data; /* private data for f_ops->open */
+ char name[0]; /* device name (keep at the end of
+ structure) */
};
/* sound.c */
void snd_request_card(int card);
int snd_register_device(int type, struct snd_card *card, int dev,
- const struct file_operations *f_ops, void *private_data,
+ struct file_operations *f_ops, void *private_data,
const char *name);
int snd_unregister_device(int type, struct snd_card *card, int dev);
void *snd_lookup_minor_data(unsigned int minor, int type);
#ifdef CONFIG_SND_OSSEMUL
int snd_register_oss_device(int type, struct snd_card *card, int dev,
- const struct file_operations *f_ops, void *private_data,
+ struct file_operations *f_ops, void *private_data,
const char *name);
int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
void *snd_lookup_oss_minor_data(unsigned int minor, int type);
/* init.c */
+extern unsigned int snd_cards_lock;
extern struct snd_card *snd_cards[SNDRV_CARDS];
-int snd_card_locked(int card);
+extern rwlock_t snd_card_rwlock;
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
#define SND_MIXER_OSS_NOTIFY_REGISTER 0
#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1