Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / sound / rawmidi.h
index 3f9db51..584e73d 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 #include <linux/wait.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
 
 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
 #include "seq_device.h"
  *  Raw MIDI interface
  */
 
-typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
-typedef struct sndrv_rawmidi_info snd_rawmidi_info_t;
-typedef struct sndrv_rawmidi_params snd_rawmidi_params_t;
-typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
-
 #define SNDRV_RAWMIDI_DEVICES          8
 
 #define SNDRV_RAWMIDI_LFLG_OUTPUT      (1<<0)
@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
 #define SNDRV_RAWMIDI_LFLG_APPEND      (1<<2)
 #define        SNDRV_RAWMIDI_LFLG_NOOPENLOCK   (1<<3)
 
-typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t;
-typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t;
-typedef struct _snd_rawmidi_str snd_rawmidi_str_t;
+struct snd_rawmidi;
+struct snd_rawmidi_substream;
 
-typedef struct _snd_rawmidi_ops {
-       int (*open) (snd_rawmidi_substream_t * substream);
-       int (*close) (snd_rawmidi_substream_t * substream);
-       void (*trigger) (snd_rawmidi_substream_t * substream, int up);
-       void (*drain) (snd_rawmidi_substream_t * substream);
-} snd_rawmidi_ops_t;
+struct snd_rawmidi_ops {
+       int (*open) (struct snd_rawmidi_substream * substream);
+       int (*close) (struct snd_rawmidi_substream * substream);
+       void (*trigger) (struct snd_rawmidi_substream * substream, int up);
+       void (*drain) (struct snd_rawmidi_substream * substream);
+};
 
-typedef struct _snd_rawmidi_global_ops {
-       int (*dev_register) (snd_rawmidi_t * rmidi);
-       int (*dev_unregister) (snd_rawmidi_t * rmidi);
-} snd_rawmidi_global_ops_t;
+struct snd_rawmidi_global_ops {
+       int (*dev_register) (struct snd_rawmidi * rmidi);
+       int (*dev_unregister) (struct snd_rawmidi * rmidi);
+};
 
-struct _snd_rawmidi_runtime {
+struct snd_rawmidi_runtime {
        unsigned int drain: 1,  /* drain stage */
                     oss: 1;    /* OSS compatible mode */
        /* midi stream buffer */
@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime {
        spinlock_t lock;
        wait_queue_head_t sleep;
        /* event handler (new bytes, input only) */
-       void (*event)(snd_rawmidi_substream_t *substream);
+       void (*event)(struct snd_rawmidi_substream *substream);
        /* defers calls to event [input] or ops->trigger [output] */
        struct tasklet_struct tasklet;
        /* private data */
        void *private_data;
-       void (*private_free)(snd_rawmidi_substream_t *substream);
+       void (*private_free)(struct snd_rawmidi_substream *substream);
 };
 
-struct _snd_rawmidi_substream {
+struct snd_rawmidi_substream {
        struct list_head list;          /* list of all substream for given stream */
        int stream;                     /* direction */
        int number;                     /* substream number */
@@ -97,29 +91,29 @@ struct _snd_rawmidi_substream {
                     active_sensing: 1; /* send active sensing when close */
        int use_count;                  /* use counter (for output) */
        size_t bytes;
-       snd_rawmidi_t *rmidi;
-       snd_rawmidi_str_t *pstr;
+       struct snd_rawmidi *rmidi;
+       struct snd_rawmidi_str *pstr;
        char name[32];
-       snd_rawmidi_runtime_t *runtime;
+       struct snd_rawmidi_runtime *runtime;
        /* hardware layer */
-       snd_rawmidi_ops_t *ops;
+       struct snd_rawmidi_ops *ops;
 };
 
-typedef struct _snd_rawmidi_file {
-       snd_rawmidi_t *rmidi;
-       snd_rawmidi_substream_t *input;
-       snd_rawmidi_substream_t *output;
-} snd_rawmidi_file_t;
+struct snd_rawmidi_file {
+       struct snd_rawmidi *rmidi;
+       struct snd_rawmidi_substream *input;
+       struct snd_rawmidi_substream *output;
+};
 
-struct _snd_rawmidi_str {
+struct snd_rawmidi_str {
        unsigned int substream_count;
        unsigned int substream_opened;
        struct list_head substreams;
 };
 
-struct _snd_rawmidi {
-       snd_card_t *card;
-
+struct snd_rawmidi {
+       struct snd_card *card;
+       struct list_head list;
        unsigned int device;            /* device number */
        unsigned int info_flags;        /* SNDRV_RAWMIDI_INFO_XXXX */
        char id[64];
@@ -129,52 +123,61 @@ struct _snd_rawmidi {
        int ossreg;
 #endif
 
-       snd_rawmidi_global_ops_t *ops;
+       struct snd_rawmidi_global_ops *ops;
 
-       snd_rawmidi_str_t streams[2];
+       struct snd_rawmidi_str streams[2];
 
        void *private_data;
-       void (*private_free) (snd_rawmidi_t *rmidi);
+       void (*private_free) (struct snd_rawmidi *rmidi);
 
-       struct semaphore open_mutex;
+       struct mutex open_mutex;
        wait_queue_head_t open_wait;
 
-       snd_info_entry_t *dev;
-       snd_info_entry_t *proc_entry;
+       struct snd_info_entry *dev;
+       struct snd_info_entry *proc_entry;
 
 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
-       snd_seq_device_t *seq_dev;
+       struct snd_seq_device *seq_dev;
 #endif
 };
 
 /* main rawmidi functions */
 
-int snd_rawmidi_new(snd_card_t * card, char *id, int device,
+int snd_rawmidi_new(struct snd_card *card, char *id, int device,
                    int output_count, int input_count,
-                   snd_rawmidi_t ** rmidi);
-void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops);
+                   struct snd_rawmidi **rmidi);
+void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
+                        struct snd_rawmidi_ops *ops);
 
 /* callbacks */
 
-void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream);
-int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count);
-void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream);
-int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream);
-int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count);
-int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count);
-int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count);
+void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
+int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
+                       const unsigned char *buffer, int count);
+void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
+int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
+int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
+                             unsigned char *buffer, int count);
+int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count);
+int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
+                        unsigned char *buffer, int count);
 
 /* main midi functions */
 
-int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info);
-int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile);
-int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile);
-int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params);
-int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params);
-int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream);
-int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream);
-int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream);
-long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count);
-long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count);
+int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info);
+int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice,
+                           int mode, struct snd_rawmidi_file *rfile);
+int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile);
+int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
+                             struct snd_rawmidi_params *params);
+int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
+                            struct snd_rawmidi_params *params);
+int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream);
+int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream);
+int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream);
+long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
+                            unsigned char *buf, long count);
+long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
+                             const unsigned char *buf, long count);
 
 #endif /* __SOUND_RAWMIDI_H */