Commit 48c9d417 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: Raw MIDI

Modules: RawMidi Midlevel

Remove xxx_t typedefs from the core raw MIDI codes.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 53d2f744
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
* Raw MIDI interface * 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_DEVICES 8
#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) #define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0)
...@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t; ...@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) #define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) #define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; struct snd_rawmidi;
typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; struct snd_rawmidi_substream;
typedef struct _snd_rawmidi_str snd_rawmidi_str_t;
typedef struct _snd_rawmidi_ops { struct snd_rawmidi_ops {
int (*open) (snd_rawmidi_substream_t * substream); int (*open) (struct snd_rawmidi_substream * substream);
int (*close) (snd_rawmidi_substream_t * substream); int (*close) (struct snd_rawmidi_substream * substream);
void (*trigger) (snd_rawmidi_substream_t * substream, int up); void (*trigger) (struct snd_rawmidi_substream * substream, int up);
void (*drain) (snd_rawmidi_substream_t * substream); void (*drain) (struct snd_rawmidi_substream * substream);
} snd_rawmidi_ops_t; };
typedef struct _snd_rawmidi_global_ops { struct snd_rawmidi_global_ops {
int (*dev_register) (snd_rawmidi_t * rmidi); int (*dev_register) (struct snd_rawmidi * rmidi);
int (*dev_unregister) (snd_rawmidi_t * rmidi); int (*dev_unregister) (struct snd_rawmidi * rmidi);
} snd_rawmidi_global_ops_t; };
struct _snd_rawmidi_runtime { struct snd_rawmidi_runtime {
unsigned int drain: 1, /* drain stage */ unsigned int drain: 1, /* drain stage */
oss: 1; /* OSS compatible mode */ oss: 1; /* OSS compatible mode */
/* midi stream buffer */ /* midi stream buffer */
...@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime { ...@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime {
spinlock_t lock; spinlock_t lock;
wait_queue_head_t sleep; wait_queue_head_t sleep;
/* event handler (new bytes, input only) */ /* 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] */ /* defers calls to event [input] or ops->trigger [output] */
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
/* private data */ /* private data */
void *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 */ struct list_head list; /* list of all substream for given stream */
int stream; /* direction */ int stream; /* direction */
int number; /* substream number */ int number; /* substream number */
...@@ -97,28 +91,28 @@ struct _snd_rawmidi_substream { ...@@ -97,28 +91,28 @@ struct _snd_rawmidi_substream {
active_sensing: 1; /* send active sensing when close */ active_sensing: 1; /* send active sensing when close */
int use_count; /* use counter (for output) */ int use_count; /* use counter (for output) */
size_t bytes; size_t bytes;
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
snd_rawmidi_str_t *pstr; struct snd_rawmidi_str *pstr;
char name[32]; char name[32];
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
/* hardware layer */ /* hardware layer */
snd_rawmidi_ops_t *ops; struct snd_rawmidi_ops *ops;
}; };
typedef struct _snd_rawmidi_file { struct snd_rawmidi_file {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
snd_rawmidi_substream_t *input; struct snd_rawmidi_substream *input;
snd_rawmidi_substream_t *output; struct snd_rawmidi_substream *output;
} snd_rawmidi_file_t; };
struct _snd_rawmidi_str { struct snd_rawmidi_str {
unsigned int substream_count; unsigned int substream_count;
unsigned int substream_opened; unsigned int substream_opened;
struct list_head substreams; struct list_head substreams;
}; };
struct _snd_rawmidi { struct snd_rawmidi {
snd_card_t *card; struct snd_card *card;
unsigned int device; /* device number */ unsigned int device; /* device number */
unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */
...@@ -129,52 +123,61 @@ struct _snd_rawmidi { ...@@ -129,52 +123,61 @@ struct _snd_rawmidi {
int ossreg; int ossreg;
#endif #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_data;
void (*private_free) (snd_rawmidi_t *rmidi); void (*private_free) (struct snd_rawmidi *rmidi);
struct semaphore open_mutex; struct semaphore open_mutex;
wait_queue_head_t open_wait; wait_queue_head_t open_wait;
snd_info_entry_t *dev; struct snd_info_entry *dev;
snd_info_entry_t *proc_entry; struct snd_info_entry *proc_entry;
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
snd_seq_device_t *seq_dev; struct snd_seq_device *seq_dev;
#endif #endif
}; };
/* main rawmidi functions */ /* 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, int output_count, int input_count,
snd_rawmidi_t ** rmidi); struct snd_rawmidi **rmidi);
void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops); void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
struct snd_rawmidi_ops *ops);
/* callbacks */ /* callbacks */
void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream); void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count); int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream); const unsigned char *buffer, int count);
int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream); void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count); int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 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 */ /* main midi functions */
int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info); int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info);
int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile); int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode,
int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile); struct snd_rawmidi_file *rfile);
int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile);
int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream); struct snd_rawmidi_params *params);
int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream); int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream); struct snd_rawmidi_params *params);
long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count); int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream);
long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count); 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 */ #endif /* __SOUND_RAWMIDI_H */
...@@ -50,13 +50,13 @@ module_param_array(amidi_map, int, NULL, 0444); ...@@ -50,13 +50,13 @@ module_param_array(amidi_map, int, NULL, 0444);
MODULE_PARM_DESC(amidi_map, "Raw MIDI device number assigned to 2nd OSS device."); MODULE_PARM_DESC(amidi_map, "Raw MIDI device number assigned to 2nd OSS device.");
#endif /* CONFIG_SND_OSSEMUL */ #endif /* CONFIG_SND_OSSEMUL */
static int snd_rawmidi_free(snd_rawmidi_t *rawmidi); static int snd_rawmidi_free(struct snd_rawmidi *rawmidi);
static int snd_rawmidi_dev_free(snd_device_t *device); static int snd_rawmidi_dev_free(struct snd_device *device);
static int snd_rawmidi_dev_register(snd_device_t *device); static int snd_rawmidi_dev_register(struct snd_device *device);
static int snd_rawmidi_dev_disconnect(snd_device_t *device); static int snd_rawmidi_dev_disconnect(struct snd_device *device);
static int snd_rawmidi_dev_unregister(snd_device_t *device); static int snd_rawmidi_dev_unregister(struct snd_device *device);
static snd_rawmidi_t *snd_rawmidi_devices[SNDRV_CARDS * SNDRV_RAWMIDI_DEVICES]; static struct snd_rawmidi *snd_rawmidi_devices[SNDRV_CARDS * SNDRV_RAWMIDI_DEVICES];
static DECLARE_MUTEX(register_mutex); static DECLARE_MUTEX(register_mutex);
...@@ -72,34 +72,35 @@ static inline unsigned short snd_rawmidi_file_flags(struct file *file) ...@@ -72,34 +72,35 @@ static inline unsigned short snd_rawmidi_file_flags(struct file *file)
} }
} }
static inline int snd_rawmidi_ready(snd_rawmidi_substream_t * substream) static inline int snd_rawmidi_ready(struct snd_rawmidi_substream *substream)
{ {
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
return runtime->avail >= runtime->avail_min; return runtime->avail >= runtime->avail_min;
} }
static inline int snd_rawmidi_ready_append(snd_rawmidi_substream_t * substream, size_t count) static inline int snd_rawmidi_ready_append(struct snd_rawmidi_substream *substream,
size_t count)
{ {
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
return runtime->avail >= runtime->avail_min && return runtime->avail >= runtime->avail_min &&
(!substream->append || runtime->avail >= count); (!substream->append || runtime->avail >= count);
} }
static void snd_rawmidi_input_event_tasklet(unsigned long data) static void snd_rawmidi_input_event_tasklet(unsigned long data)
{ {
snd_rawmidi_substream_t *substream = (snd_rawmidi_substream_t *)data; struct snd_rawmidi_substream *substream = (struct snd_rawmidi_substream *)data;
substream->runtime->event(substream); substream->runtime->event(substream);
} }
static void snd_rawmidi_output_trigger_tasklet(unsigned long data) static void snd_rawmidi_output_trigger_tasklet(unsigned long data)
{ {
snd_rawmidi_substream_t *substream = (snd_rawmidi_substream_t *)data; struct snd_rawmidi_substream *substream = (struct snd_rawmidi_substream *)data;
substream->ops->trigger(substream, 1); substream->ops->trigger(substream, 1);
} }
static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream) static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream)
{ {
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL) if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -129,9 +130,9 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream) ...@@ -129,9 +130,9 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream)
return 0; return 0;
} }
static int snd_rawmidi_runtime_free(snd_rawmidi_substream_t * substream) static int snd_rawmidi_runtime_free(struct snd_rawmidi_substream *substream)
{ {
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
kfree(runtime->buffer); kfree(runtime->buffer);
kfree(runtime); kfree(runtime);
...@@ -139,7 +140,7 @@ static int snd_rawmidi_runtime_free(snd_rawmidi_substream_t * substream) ...@@ -139,7 +140,7 @@ static int snd_rawmidi_runtime_free(snd_rawmidi_substream_t * substream)
return 0; return 0;
} }
static inline void snd_rawmidi_output_trigger(snd_rawmidi_substream_t * substream, int up) static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *substream,int up)
{ {
if (up) { if (up) {
tasklet_hi_schedule(&substream->runtime->tasklet); tasklet_hi_schedule(&substream->runtime->tasklet);
...@@ -149,17 +150,17 @@ static inline void snd_rawmidi_output_trigger(snd_rawmidi_substream_t * substrea ...@@ -149,17 +150,17 @@ static inline void snd_rawmidi_output_trigger(snd_rawmidi_substream_t * substrea
} }
} }
static void snd_rawmidi_input_trigger(snd_rawmidi_substream_t * substream, int up) static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
{ {
substream->ops->trigger(substream, up); substream->ops->trigger(substream, up);
if (!up && substream->runtime->event) if (!up && substream->runtime->event)
tasklet_kill(&substream->runtime->tasklet); tasklet_kill(&substream->runtime->tasklet);
} }
int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream) int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream)
{ {
unsigned long flags; unsigned long flags;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
snd_rawmidi_output_trigger(substream, 0); snd_rawmidi_output_trigger(substream, 0);
runtime->drain = 0; runtime->drain = 0;
...@@ -170,11 +171,11 @@ int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream) ...@@ -170,11 +171,11 @@ int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream)
return 0; return 0;
} }
int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream) int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
{ {
int err; int err;
long timeout; long timeout;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
err = 0; err = 0;
runtime->drain = 1; runtime->drain = 1;
...@@ -199,10 +200,10 @@ int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream) ...@@ -199,10 +200,10 @@ int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream)
return err; return err;
} }
int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream) int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream)
{ {
unsigned long flags; unsigned long flags;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
snd_rawmidi_input_trigger(substream, 0); snd_rawmidi_input_trigger(substream, 0);
runtime->drain = 0; runtime->drain = 0;
...@@ -214,12 +215,12 @@ int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream) ...@@ -214,12 +215,12 @@ int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream)
} }
int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
int mode, snd_rawmidi_file_t * rfile) int mode, struct snd_rawmidi_file * rfile)
{ {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
struct list_head *list1, *list2; struct list_head *list1, *list2;
snd_rawmidi_substream_t *sinput = NULL, *soutput = NULL; struct snd_rawmidi_substream *sinput = NULL, *soutput = NULL;
snd_rawmidi_runtime_t *input = NULL, *output = NULL; struct snd_rawmidi_runtime *input = NULL, *output = NULL;
int err; int err;
if (rfile) if (rfile)
...@@ -275,7 +276,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, ...@@ -275,7 +276,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
} }
break; break;
} }
sinput = list_entry(list1, snd_rawmidi_substream_t, list); sinput = list_entry(list1, struct snd_rawmidi_substream, list);
if ((mode & SNDRV_RAWMIDI_LFLG_INPUT) && sinput->opened) if ((mode & SNDRV_RAWMIDI_LFLG_INPUT) && sinput->opened)
goto __nexti; goto __nexti;
if (subdevice < 0 || (subdevice >= 0 && subdevice == sinput->number)) if (subdevice < 0 || (subdevice >= 0 && subdevice == sinput->number))
...@@ -293,7 +294,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, ...@@ -293,7 +294,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
} }
break; break;
} }
soutput = list_entry(list2, snd_rawmidi_substream_t, list); soutput = list_entry(list2, struct snd_rawmidi_substream, list);
if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) {
if (mode & SNDRV_RAWMIDI_LFLG_APPEND) { if (mode & SNDRV_RAWMIDI_LFLG_APPEND) {
if (soutput->opened && !soutput->append) if (soutput->opened && !soutput->append)
...@@ -368,15 +369,15 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -368,15 +369,15 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
{ {
int maj = imajor(inode); int maj = imajor(inode);
int cardnum; int cardnum;
snd_card_t *card; struct snd_card *card;
int device, subdevice; int device, subdevice;
unsigned short fflags; unsigned short fflags;
int err; int err;
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
snd_rawmidi_file_t *rawmidi_file; struct snd_rawmidi_file *rawmidi_file;
wait_queue_t wait; wait_queue_t wait;
struct list_head *list; struct list_head *list;
snd_ctl_file_t *kctl; struct snd_ctl_file *kctl;
if (maj == snd_major) { if (maj == snd_major) {
cardnum = SNDRV_MINOR_CARD(iminor(inode)); cardnum = SNDRV_MINOR_CARD(iminor(inode));
...@@ -465,11 +466,11 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -465,11 +466,11 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
return err; return err;
} }
int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile) int snd_rawmidi_kernel_release(struct snd_rawmidi_file * rfile)
{ {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
snd_assert(rfile != NULL, return -ENXIO); snd_assert(rfile != NULL, return -ENXIO);
snd_assert(rfile->input != NULL || rfile->output != NULL, return -ENXIO); snd_assert(rfile->input != NULL || rfile->output != NULL, return -ENXIO);
...@@ -515,8 +516,8 @@ int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile) ...@@ -515,8 +516,8 @@ int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile)
static int snd_rawmidi_release(struct inode *inode, struct file *file) static int snd_rawmidi_release(struct inode *inode, struct file *file)
{ {
snd_rawmidi_file_t *rfile; struct snd_rawmidi_file *rfile;
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
int err; int err;
rfile = file->private_data; rfile = file->private_data;
...@@ -528,9 +529,10 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file) ...@@ -528,9 +529,10 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file)
return err; return err;
} }
int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *info) int snd_rawmidi_info(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_info *info)
{ {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
if (substream == NULL) if (substream == NULL)
return -ENODEV; return -ENODEV;
...@@ -550,22 +552,23 @@ int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *inf ...@@ -550,22 +552,23 @@ int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *inf
return 0; return 0;
} }
static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t __user * _info) static int snd_rawmidi_info_user(struct snd_rawmidi_substream *substream,
struct snd_rawmidi_info __user * _info)
{ {
snd_rawmidi_info_t info; struct snd_rawmidi_info info;
int err; int err;
if ((err = snd_rawmidi_info(substream, &info)) < 0) if ((err = snd_rawmidi_info(substream, &info)) < 0)
return err; return err;
if (copy_to_user(_info, &info, sizeof(snd_rawmidi_info_t))) if (copy_to_user(_info, &info, sizeof(struct snd_rawmidi_info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info) int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info)
{ {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
snd_rawmidi_str_t *pstr; struct snd_rawmidi_str *pstr;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
struct list_head *list; struct list_head *list;
if (info->device >= SNDRV_RAWMIDI_DEVICES) if (info->device >= SNDRV_RAWMIDI_DEVICES)
return -ENXIO; return -ENXIO;
...@@ -578,18 +581,18 @@ int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info) ...@@ -578,18 +581,18 @@ int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info)
if (info->subdevice >= pstr->substream_count) if (info->subdevice >= pstr->substream_count)
return -ENXIO; return -ENXIO;
list_for_each(list, &pstr->substreams) { list_for_each(list, &pstr->substreams) {
substream = list_entry(list, snd_rawmidi_substream_t, list); substream = list_entry(list, struct snd_rawmidi_substream, list);
if ((unsigned int)substream->number == info->subdevice) if ((unsigned int)substream->number == info->subdevice)
return snd_rawmidi_info(substream, info); return snd_rawmidi_info(substream, info);
} }
return -ENXIO; return -ENXIO;
} }
static int snd_rawmidi_info_select_user(snd_card_t *card, static int snd_rawmidi_info_select_user(struct snd_card *card,
snd_rawmidi_info_t __user *_info) struct snd_rawmidi_info __user *_info)
{ {
int err; int err;
snd_rawmidi_info_t info; struct snd_rawmidi_info info;
if (get_user(info.device, &_info->device)) if (get_user(info.device, &_info->device))
return -EFAULT; return -EFAULT;
if (get_user(info.stream, &_info->stream)) if (get_user(info.stream, &_info->stream))
...@@ -598,16 +601,16 @@ static int snd_rawmidi_info_select_user(snd_card_t *card, ...@@ -598,16 +601,16 @@ static int snd_rawmidi_info_select_user(snd_card_t *card,
return -EFAULT; return -EFAULT;
if ((err = snd_rawmidi_info_select(card, &info)) < 0) if ((err = snd_rawmidi_info_select(card, &info)) < 0)
return err; return err;
if (copy_to_user(_info, &info, sizeof(snd_rawmidi_info_t))) if (copy_to_user(_info, &info, sizeof(struct snd_rawmidi_info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
snd_rawmidi_params_t * params) struct snd_rawmidi_params * params)
{ {
char *newbuf; char *newbuf;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
if (substream->append && substream->use_count > 1) if (substream->append && substream->use_count > 1)
return -EBUSY; return -EBUSY;
...@@ -630,11 +633,11 @@ int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, ...@@ -630,11 +633,11 @@ int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream,
return 0; return 0;
} }
int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
snd_rawmidi_params_t * params) struct snd_rawmidi_params * params)
{ {
char *newbuf; char *newbuf;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
snd_rawmidi_drain_input(substream); snd_rawmidi_drain_input(substream);
if (params->buffer_size < 32 || params->buffer_size > 1024L * 1024L) { if (params->buffer_size < 32 || params->buffer_size > 1024L * 1024L) {
...@@ -654,10 +657,10 @@ int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, ...@@ -654,10 +657,10 @@ int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream,
return 0; return 0;
} }
static int snd_rawmidi_output_status(snd_rawmidi_substream_t * substream, static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream,
snd_rawmidi_status_t * status) struct snd_rawmidi_status * status)
{ {
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
memset(status, 0, sizeof(*status)); memset(status, 0, sizeof(*status));
status->stream = SNDRV_RAWMIDI_STREAM_OUTPUT; status->stream = SNDRV_RAWMIDI_STREAM_OUTPUT;
...@@ -667,10 +670,10 @@ static int snd_rawmidi_output_status(snd_rawmidi_substream_t * substream, ...@@ -667,10 +670,10 @@ static int snd_rawmidi_output_status(snd_rawmidi_substream_t * substream,
return 0; return 0;
} }
static int snd_rawmidi_input_status(snd_rawmidi_substream_t * substream, static int snd_rawmidi_input_status(struct snd_rawmidi_substream *substream,
snd_rawmidi_status_t * status) struct snd_rawmidi_status * status)
{ {
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
memset(status, 0, sizeof(*status)); memset(status, 0, sizeof(*status));
status->stream = SNDRV_RAWMIDI_STREAM_INPUT; status->stream = SNDRV_RAWMIDI_STREAM_INPUT;
...@@ -684,7 +687,7 @@ static int snd_rawmidi_input_status(snd_rawmidi_substream_t * substream, ...@@ -684,7 +687,7 @@ static int snd_rawmidi_input_status(snd_rawmidi_substream_t * substream,
static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
snd_rawmidi_file_t *rfile; struct snd_rawmidi_file *rfile;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
rfile = file->private_data; rfile = file->private_data;
...@@ -695,8 +698,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long ...@@ -695,8 +698,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0; return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0;
case SNDRV_RAWMIDI_IOCTL_INFO: case SNDRV_RAWMIDI_IOCTL_INFO:
{ {
snd_rawmidi_stream_t stream; int stream;
snd_rawmidi_info_t __user *info = argp; struct snd_rawmidi_info __user *info = argp;
if (get_user(stream, &info->stream)) if (get_user(stream, &info->stream))
return -EFAULT; return -EFAULT;
switch (stream) { switch (stream) {
...@@ -710,8 +713,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long ...@@ -710,8 +713,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
} }
case SNDRV_RAWMIDI_IOCTL_PARAMS: case SNDRV_RAWMIDI_IOCTL_PARAMS:
{ {
snd_rawmidi_params_t params; struct snd_rawmidi_params params;
if (copy_from_user(&params, argp, sizeof(snd_rawmidi_params_t))) if (copy_from_user(&params, argp, sizeof(struct snd_rawmidi_params)))
return -EFAULT; return -EFAULT;
switch (params.stream) { switch (params.stream) {
case SNDRV_RAWMIDI_STREAM_OUTPUT: case SNDRV_RAWMIDI_STREAM_OUTPUT:
...@@ -729,8 +732,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long ...@@ -729,8 +732,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
case SNDRV_RAWMIDI_IOCTL_STATUS: case SNDRV_RAWMIDI_IOCTL_STATUS:
{ {
int err = 0; int err = 0;
snd_rawmidi_status_t status; struct snd_rawmidi_status status;
if (copy_from_user(&status, argp, sizeof(snd_rawmidi_status_t))) if (copy_from_user(&status, argp, sizeof(struct snd_rawmidi_status)))
return -EFAULT; return -EFAULT;
switch (status.stream) { switch (status.stream) {
case SNDRV_RAWMIDI_STREAM_OUTPUT: case SNDRV_RAWMIDI_STREAM_OUTPUT:
...@@ -748,7 +751,7 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long ...@@ -748,7 +751,7 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
} }
if (err < 0) if (err < 0)
return err; return err;
if (copy_to_user(argp, &status, sizeof(snd_rawmidi_status_t))) if (copy_to_user(argp, &status, sizeof(struct snd_rawmidi_status)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -792,8 +795,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long ...@@ -792,8 +795,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
return -ENOTTY; return -ENOTTY;
} }
static int snd_rawmidi_control_ioctl(snd_card_t * card, static int snd_rawmidi_control_ioctl(struct snd_card *card,
snd_ctl_file_t * control, struct snd_ctl_file *control,
unsigned int cmd, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
...@@ -845,11 +848,12 @@ static int snd_rawmidi_control_ioctl(snd_card_t * card, ...@@ -845,11 +848,12 @@ static int snd_rawmidi_control_ioctl(snd_card_t * card,
* *
* Returns the size of read data, or a negative error code on failure. * Returns the size of read data, or a negative error code on failure.
*/ */
int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count) int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
const unsigned char *buffer, int count)
{ {
unsigned long flags; unsigned long flags;
int result = 0, count1; int result = 0, count1;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
if (runtime->buffer == NULL) { if (runtime->buffer == NULL) {
snd_printd("snd_rawmidi_receive: input is not active!!!\n"); snd_printd("snd_rawmidi_receive: input is not active!!!\n");
...@@ -904,12 +908,12 @@ int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char ...@@ -904,12 +908,12 @@ int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char
return result; return result;
} }
static long snd_rawmidi_kernel_read1(snd_rawmidi_substream_t *substream, static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
unsigned char *buf, long count, int kernel) unsigned char *buf, long count, int kernel)
{ {
unsigned long flags; unsigned long flags;
long result = 0, count1; long result = 0, count1;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
while (count > 0 && runtime->avail) { while (count > 0 && runtime->avail) {
count1 = runtime->buffer_size - runtime->appl_ptr; count1 = runtime->buffer_size - runtime->appl_ptr;
...@@ -938,19 +942,21 @@ static long snd_rawmidi_kernel_read1(snd_rawmidi_substream_t *substream, ...@@ -938,19 +942,21 @@ static long snd_rawmidi_kernel_read1(snd_rawmidi_substream_t *substream,
return result; return result;
} }
long snd_rawmidi_kernel_read(snd_rawmidi_substream_t *substream, unsigned char *buf, long count) long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
unsigned char *buf, long count)
{ {
snd_rawmidi_input_trigger(substream, 1); snd_rawmidi_input_trigger(substream, 1);
return snd_rawmidi_kernel_read1(substream, buf, count, 1); return snd_rawmidi_kernel_read1(substream, buf, count, 1);
} }
static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, loff_t *offset) static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count,
loff_t *offset)
{ {
long result; long result;
int count1; int count1;
snd_rawmidi_file_t *rfile; struct snd_rawmidi_file *rfile;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
rfile = file->private_data; rfile = file->private_data;
substream = rfile->input; substream = rfile->input;
...@@ -998,9 +1004,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun ...@@ -998,9 +1004,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
* *
* Returns 1 if the internal output buffer is empty, 0 if not. * Returns 1 if the internal output buffer is empty, 0 if not.
*/ */
int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream) int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
{ {
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
int result; int result;
unsigned long flags; unsigned long flags;
...@@ -1028,11 +1034,12 @@ int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream) ...@@ -1028,11 +1034,12 @@ int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream)
* *
* Returns the size of copied data, or a negative error code on failure. * Returns the size of copied data, or a negative error code on failure.
*/ */
int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count) int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
unsigned char *buffer, int count)
{ {
unsigned long flags; unsigned long flags;
int result, count1; int result, count1;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
if (runtime->buffer == NULL) { if (runtime->buffer == NULL) {
snd_printd("snd_rawmidi_transmit_peek: output is not active!!!\n"); snd_printd("snd_rawmidi_transmit_peek: output is not active!!!\n");
...@@ -1079,10 +1086,10 @@ int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char ...@@ -1079,10 +1086,10 @@ int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char
* *
* Returns the advanced size if successful, or a negative error code on failure. * Returns the advanced size if successful, or a negative error code on failure.
*/ */
int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count) int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count)
{ {
unsigned long flags; unsigned long flags;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
if (runtime->buffer == NULL) { if (runtime->buffer == NULL) {
snd_printd("snd_rawmidi_transmit_ack: output is not active!!!\n"); snd_printd("snd_rawmidi_transmit_ack: output is not active!!!\n");
...@@ -1112,7 +1119,8 @@ int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count) ...@@ -1112,7 +1119,8 @@ int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count)
* *
* Returns the copied size if successful, or a negative error code on failure. * Returns the copied size if successful, or a negative error code on failure.
*/ */
int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count) int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
unsigned char *buffer, int count)
{ {
count = snd_rawmidi_transmit_peek(substream, buffer, count); count = snd_rawmidi_transmit_peek(substream, buffer, count);
if (count < 0) if (count < 0)
...@@ -1120,11 +1128,12 @@ int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buf ...@@ -1120,11 +1128,12 @@ int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buf
return snd_rawmidi_transmit_ack(substream, count); return snd_rawmidi_transmit_ack(substream, count);
} }
static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count, int kernel) static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
const unsigned char *buf, long count, int kernel)
{ {
unsigned long flags; unsigned long flags;
long count1, result; long count1, result;
snd_rawmidi_runtime_t *runtime = substream->runtime; struct snd_rawmidi_runtime *runtime = substream->runtime;
snd_assert(buf != NULL, return -EINVAL); snd_assert(buf != NULL, return -EINVAL);
snd_assert(runtime->buffer != NULL, return -EINVAL); snd_assert(runtime->buffer != NULL, return -EINVAL);
...@@ -1170,18 +1179,20 @@ static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const ...@@ -1170,18 +1179,20 @@ static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const
return result; return result;
} }
long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count) long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
const unsigned char *buf, long count)
{ {
return snd_rawmidi_kernel_write1(substream, buf, count, 1); return snd_rawmidi_kernel_write1(substream, buf, count, 1);
} }
static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf,
size_t count, loff_t *offset)
{ {
long result, timeout; long result, timeout;
int count1; int count1;
snd_rawmidi_file_t *rfile; struct snd_rawmidi_file *rfile;
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
rfile = file->private_data; rfile = file->private_data;
substream = rfile->output; substream = rfile->output;
...@@ -1246,8 +1257,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size ...@@ -1246,8 +1257,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size
static unsigned int snd_rawmidi_poll(struct file *file, poll_table * wait) static unsigned int snd_rawmidi_poll(struct file *file, poll_table * wait)
{ {
snd_rawmidi_file_t *rfile; struct snd_rawmidi_file *rfile;
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
unsigned int mask; unsigned int mask;
rfile = file->private_data; rfile = file->private_data;
...@@ -1284,12 +1295,12 @@ static unsigned int snd_rawmidi_poll(struct file *file, poll_table * wait) ...@@ -1284,12 +1295,12 @@ static unsigned int snd_rawmidi_poll(struct file *file, poll_table * wait)
*/ */
static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry, static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
snd_info_buffer_t * buffer) struct snd_info_buffer *buffer)
{ {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
struct list_head *list; struct list_head *list;
rmidi = entry->private_data; rmidi = entry->private_data;
...@@ -1297,7 +1308,7 @@ static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry, ...@@ -1297,7 +1308,7 @@ static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry,
down(&rmidi->open_mutex); down(&rmidi->open_mutex);
if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) { if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {
list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) {
substream = list_entry(list, snd_rawmidi_substream_t, list); substream = list_entry(list, struct snd_rawmidi_substream, list);
snd_iprintf(buffer, snd_iprintf(buffer,
"Output %d\n" "Output %d\n"
" Tx bytes : %lu\n", " Tx bytes : %lu\n",
...@@ -1317,7 +1328,7 @@ static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry, ...@@ -1317,7 +1328,7 @@ static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry,
} }
if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) { if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) {
list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) {
substream = list_entry(list, snd_rawmidi_substream_t, list); substream = list_entry(list, struct snd_rawmidi_substream, list);
snd_iprintf(buffer, snd_iprintf(buffer,
"Input %d\n" "Input %d\n"
" Rx bytes : %lu\n", " Rx bytes : %lu\n",
...@@ -1354,18 +1365,18 @@ static struct file_operations snd_rawmidi_f_ops = ...@@ -1354,18 +1365,18 @@ static struct file_operations snd_rawmidi_f_ops =
.compat_ioctl = snd_rawmidi_ioctl_compat, .compat_ioctl = snd_rawmidi_ioctl_compat,
}; };
static snd_minor_t snd_rawmidi_reg = static struct snd_minor snd_rawmidi_reg =
{ {
.comment = "raw midi", .comment = "raw midi",
.f_ops = &snd_rawmidi_f_ops, .f_ops = &snd_rawmidi_f_ops,
}; };
static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi, static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
snd_rawmidi_str_t *stream, struct snd_rawmidi_str *stream,
int direction, int direction,
int count) int count)
{ {
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
int idx; int idx;
INIT_LIST_HEAD(&stream->substreams); INIT_LIST_HEAD(&stream->substreams);
...@@ -1397,13 +1408,13 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi, ...@@ -1397,13 +1408,13 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi,
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
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, int output_count, int input_count,
snd_rawmidi_t ** rrawmidi) struct snd_rawmidi ** rrawmidi)
{ {
snd_rawmidi_t *rmidi; struct snd_rawmidi *rmidi;
int err; int err;
static snd_device_ops_t ops = { static struct snd_device_ops ops = {
.dev_free = snd_rawmidi_dev_free, .dev_free = snd_rawmidi_dev_free,
.dev_register = snd_rawmidi_dev_register, .dev_register = snd_rawmidi_dev_register,
.dev_disconnect = snd_rawmidi_dev_disconnect, .dev_disconnect = snd_rawmidi_dev_disconnect,
...@@ -1438,18 +1449,18 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device, ...@@ -1438,18 +1449,18 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device,
return 0; return 0;
} }
static void snd_rawmidi_free_substreams(snd_rawmidi_str_t *stream) static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream)
{ {
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
while (!list_empty(&stream->substreams)) { while (!list_empty(&stream->substreams)) {
substream = list_entry(stream->substreams.next, snd_rawmidi_substream_t, list); substream = list_entry(stream->substreams.next, struct snd_rawmidi_substream, list);
list_del(&substream->list); list_del(&substream->list);
kfree(substream); kfree(substream);
} }
} }
static int snd_rawmidi_free(snd_rawmidi_t *rmidi) static int snd_rawmidi_free(struct snd_rawmidi *rmidi)
{ {
snd_assert(rmidi != NULL, return -ENXIO); snd_assert(rmidi != NULL, return -ENXIO);
snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]);
...@@ -1460,26 +1471,26 @@ static int snd_rawmidi_free(snd_rawmidi_t *rmidi) ...@@ -1460,26 +1471,26 @@ static int snd_rawmidi_free(snd_rawmidi_t *rmidi)
return 0; return 0;
} }
static int snd_rawmidi_dev_free(snd_device_t *device) static int snd_rawmidi_dev_free(struct snd_device *device)
{ {
snd_rawmidi_t *rmidi = device->device_data; struct snd_rawmidi *rmidi = device->device_data;
return snd_rawmidi_free(rmidi); return snd_rawmidi_free(rmidi);
} }
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
static void snd_rawmidi_dev_seq_free(snd_seq_device_t *device) static void snd_rawmidi_dev_seq_free(struct snd_seq_device *device)
{ {
snd_rawmidi_t *rmidi = device->private_data; struct snd_rawmidi *rmidi = device->private_data;
rmidi->seq_dev = NULL; rmidi->seq_dev = NULL;
} }
#endif #endif
static int snd_rawmidi_dev_register(snd_device_t *device) static int snd_rawmidi_dev_register(struct snd_device *device)
{ {
int idx, err; int idx, err;
snd_info_entry_t *entry; struct snd_info_entry *entry;
char name[16]; char name[16];
snd_rawmidi_t *rmidi = device->device_data; struct snd_rawmidi *rmidi = device->device_data;
if (rmidi->device >= SNDRV_RAWMIDI_DEVICES) if (rmidi->device >= SNDRV_RAWMIDI_DEVICES)
return -ENOMEM; return -ENOMEM;
...@@ -1554,9 +1565,9 @@ static int snd_rawmidi_dev_register(snd_device_t *device) ...@@ -1554,9 +1565,9 @@ static int snd_rawmidi_dev_register(snd_device_t *device)
return 0; return 0;
} }
static int snd_rawmidi_dev_disconnect(snd_device_t *device) static int snd_rawmidi_dev_disconnect(struct snd_device *device)
{ {
snd_rawmidi_t *rmidi = device->device_data; struct snd_rawmidi *rmidi = device->device_data;
int idx; int idx;
down(&register_mutex); down(&register_mutex);
...@@ -1566,10 +1577,10 @@ static int snd_rawmidi_dev_disconnect(snd_device_t *device) ...@@ -1566,10 +1577,10 @@ static int snd_rawmidi_dev_disconnect(snd_device_t *device)
return 0; return 0;
} }
static int snd_rawmidi_dev_unregister(snd_device_t *device) static int snd_rawmidi_dev_unregister(struct snd_device *device)
{ {
int idx; int idx;
snd_rawmidi_t *rmidi = device->device_data; struct snd_rawmidi *rmidi = device->device_data;
snd_assert(rmidi != NULL, return -ENXIO); snd_assert(rmidi != NULL, return -ENXIO);
down(&register_mutex); down(&register_mutex);
...@@ -1613,13 +1624,14 @@ static int snd_rawmidi_dev_unregister(snd_device_t *device) ...@@ -1613,13 +1624,14 @@ static int snd_rawmidi_dev_unregister(snd_device_t *device)
* *
* Sets the rawmidi operators for the given stream direction. * Sets the rawmidi operators for the given stream direction.
*/ */
void snd_rawmidi_set_ops(snd_rawmidi_t *rmidi, int stream, snd_rawmidi_ops_t *ops) void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
struct snd_rawmidi_ops *ops)
{ {
struct list_head *list; struct list_head *list;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
list_for_each(list, &rmidi->streams[stream].substreams) { list_for_each(list, &rmidi->streams[stream].substreams) {
substream = list_entry(list, snd_rawmidi_substream_t, list); substream = list_entry(list, struct snd_rawmidi_substream, list);
substream->ops = ops; substream->ops = ops;
} }
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <linux/compat.h> #include <linux/compat.h>
struct sndrv_rawmidi_params32 { struct snd_rawmidi_params32 {
s32 stream; s32 stream;
u32 buffer_size; u32 buffer_size;
u32 avail_min; u32 avail_min;
...@@ -30,10 +30,10 @@ struct sndrv_rawmidi_params32 { ...@@ -30,10 +30,10 @@ struct sndrv_rawmidi_params32 {
unsigned char reserved[16]; unsigned char reserved[16];
} __attribute__((packed)); } __attribute__((packed));
static int snd_rawmidi_ioctl_params_compat(snd_rawmidi_file_t *rfile, static int snd_rawmidi_ioctl_params_compat(struct snd_rawmidi_file *rfile,
struct sndrv_rawmidi_params32 __user *src) struct snd_rawmidi_params32 __user *src)
{ {
snd_rawmidi_params_t params; struct snd_rawmidi_params params;
unsigned int val; unsigned int val;
if (rfile->output == NULL) if (rfile->output == NULL)
...@@ -53,7 +53,7 @@ static int snd_rawmidi_ioctl_params_compat(snd_rawmidi_file_t *rfile, ...@@ -53,7 +53,7 @@ static int snd_rawmidi_ioctl_params_compat(snd_rawmidi_file_t *rfile,
return -EINVAL; return -EINVAL;
} }
struct sndrv_rawmidi_status32 { struct snd_rawmidi_status32 {
s32 stream; s32 stream;
struct compat_timespec tstamp; struct compat_timespec tstamp;
u32 avail; u32 avail;
...@@ -61,11 +61,11 @@ struct sndrv_rawmidi_status32 { ...@@ -61,11 +61,11 @@ struct sndrv_rawmidi_status32 {
unsigned char reserved[16]; unsigned char reserved[16];
} __attribute__((packed)); } __attribute__((packed));
static int snd_rawmidi_ioctl_status_compat(snd_rawmidi_file_t *rfile, static int snd_rawmidi_ioctl_status_compat(struct snd_rawmidi_file *rfile,
struct sndrv_rawmidi_status32 __user *src) struct snd_rawmidi_status32 __user *src)
{ {
int err; int err;
snd_rawmidi_status_t status; struct snd_rawmidi_status status;
if (rfile->output == NULL) if (rfile->output == NULL)
return -EINVAL; return -EINVAL;
...@@ -95,13 +95,13 @@ static int snd_rawmidi_ioctl_status_compat(snd_rawmidi_file_t *rfile, ...@@ -95,13 +95,13 @@ static int snd_rawmidi_ioctl_status_compat(snd_rawmidi_file_t *rfile,
} }
enum { enum {
SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct sndrv_rawmidi_params32), SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct snd_rawmidi_params32),
SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct sndrv_rawmidi_status32), SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct snd_rawmidi_status32),
}; };
static long snd_rawmidi_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) static long snd_rawmidi_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{ {
snd_rawmidi_file_t *rfile; struct snd_rawmidi_file *rfile;
void __user *argp = compat_ptr(arg); void __user *argp = compat_ptr(arg);
rfile = file->private_data; rfile = file->private_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment