aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/rawmidi.h123
-rw-r--r--sound/core/rawmidi.c280
-rw-r--r--sound/core/rawmidi_compat.c22
3 files changed, 220 insertions, 205 deletions
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 3f9db510dee3..9492a32c1026 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -36,11 +36,6 @@
36 * Raw MIDI interface 36 * Raw MIDI interface
37 */ 37 */
38 38
39typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
40typedef struct sndrv_rawmidi_info snd_rawmidi_info_t;
41typedef struct sndrv_rawmidi_params snd_rawmidi_params_t;
42typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
43
44#define SNDRV_RAWMIDI_DEVICES 8 39#define SNDRV_RAWMIDI_DEVICES 8
45 40
46#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) 41#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0)
@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
49#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) 44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
50#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) 45#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
51 46
52typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; 47struct snd_rawmidi;
53typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; 48struct snd_rawmidi_substream;
54typedef struct _snd_rawmidi_str snd_rawmidi_str_t;
55 49
56typedef struct _snd_rawmidi_ops { 50struct snd_rawmidi_ops {
57 int (*open) (snd_rawmidi_substream_t * substream); 51 int (*open) (struct snd_rawmidi_substream * substream);
58 int (*close) (snd_rawmidi_substream_t * substream); 52 int (*close) (struct snd_rawmidi_substream * substream);
59 void (*trigger) (snd_rawmidi_substream_t * substream, int up); 53 void (*trigger) (struct snd_rawmidi_substream * substream, int up);
60 void (*drain) (snd_rawmidi_substream_t * substream); 54 void (*drain) (struct snd_rawmidi_substream * substream);
61} snd_rawmidi_ops_t; 55};
62 56
63typedef struct _snd_rawmidi_global_ops { 57struct snd_rawmidi_global_ops {
64 int (*dev_register) (snd_rawmidi_t * rmidi); 58 int (*dev_register) (struct snd_rawmidi * rmidi);
65 int (*dev_unregister) (snd_rawmidi_t * rmidi); 59 int (*dev_unregister) (struct snd_rawmidi * rmidi);
66} snd_rawmidi_global_ops_t; 60};
67 61
68struct _snd_rawmidi_runtime { 62struct snd_rawmidi_runtime {
69 unsigned int drain: 1, /* drain stage */ 63 unsigned int drain: 1, /* drain stage */
70 oss: 1; /* OSS compatible mode */ 64 oss: 1; /* OSS compatible mode */
71 /* midi stream buffer */ 65 /* midi stream buffer */
@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime {
80 spinlock_t lock; 74 spinlock_t lock;
81 wait_queue_head_t sleep; 75 wait_queue_head_t sleep;
82 /* event handler (new bytes, input only) */ 76 /* event handler (new bytes, input only) */
83 void (*event)(snd_rawmidi_substream_t *substream); 77 void (*event)(struct snd_rawmidi_substream *substream);
84 /* defers calls to event [input] or ops->trigger [output] */ 78 /* defers calls to event [input] or ops->trigger [output] */
85 struct tasklet_struct tasklet; 79 struct tasklet_struct tasklet;
86 /* private data */ 80 /* private data */
87 void *private_data; 81 void *private_data;
88 void (*private_free)(snd_rawmidi_substream_t *substream); 82 void (*private_free)(struct snd_rawmidi_substream *substream);
89}; 83};
90 84
91struct _snd_rawmidi_substream { 85struct snd_rawmidi_substream {
92 struct list_head list; /* list of all substream for given stream */ 86 struct list_head list; /* list of all substream for given stream */
93 int stream; /* direction */ 87 int stream; /* direction */
94 int number; /* substream number */ 88 int number; /* substream number */
@@ -97,28 +91,28 @@ struct _snd_rawmidi_substream {
97 active_sensing: 1; /* send active sensing when close */ 91 active_sensing: 1; /* send active sensing when close */
98 int use_count; /* use counter (for output) */ 92 int use_count; /* use counter (for output) */
99 size_t bytes; 93 size_t bytes;
100 snd_rawmidi_t *rmidi; 94 struct snd_rawmidi *rmidi;
101 snd_rawmidi_str_t *pstr; 95 struct snd_rawmidi_str *pstr;
102 char name[32]; 96 char name[32];
103 snd_rawmidi_runtime_t *runtime; 97 struct snd_rawmidi_runtime *runtime;
104 /* hardware layer */ 98 /* hardware layer */
105 snd_rawmidi_ops_t *ops; 99 struct snd_rawmidi_ops *ops;
106}; 100};
107 101
108typedef struct _snd_rawmidi_file { 102struct snd_rawmidi_file {
109 snd_rawmidi_t *rmidi; 103 struct snd_rawmidi *rmidi;
110 snd_rawmidi_substream_t *input; 104 struct snd_rawmidi_substream *input;
111 snd_rawmidi_substream_t *output; 105 struct snd_rawmidi_substream *output;
112} snd_rawmidi_file_t; 106};
113 107
114struct _snd_rawmidi_str { 108struct snd_rawmidi_str {
115 unsigned int substream_count; 109 unsigned int substream_count;
116 unsigned int substream_opened; 110 unsigned int substream_opened;
117 struct list_head substreams; 111 struct list_head substreams;
118}; 112};
119 113
120struct _snd_rawmidi { 114struct snd_rawmidi {
121 snd_card_t *card; 115 struct snd_card *card;
122 116
123 unsigned int device; /* device number */ 117 unsigned int device; /* device number */
124 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 118 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */
@@ -129,52 +123,61 @@ struct _snd_rawmidi {
129 int ossreg; 123 int ossreg;
130#endif 124#endif
131 125
132 snd_rawmidi_global_ops_t *ops; 126 struct snd_rawmidi_global_ops *ops;
133 127
134 snd_rawmidi_str_t streams[2]; 128 struct snd_rawmidi_str streams[2];
135 129
136 void *private_data; 130 void *private_data;
137 void (*private_free) (snd_rawmidi_t *rmidi); 131 void (*private_free) (struct snd_rawmidi *rmidi);
138 132
139 struct semaphore open_mutex; 133 struct semaphore open_mutex;
140 wait_queue_head_t open_wait; 134 wait_queue_head_t open_wait;
141 135
142 snd_info_entry_t *dev; 136 struct snd_info_entry *dev;
143 snd_info_entry_t *proc_entry; 137 struct snd_info_entry *proc_entry;
144 138
145#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 139#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
146 snd_seq_device_t *seq_dev; 140 struct snd_seq_device *seq_dev;
147#endif 141#endif
148}; 142};
149 143
150/* main rawmidi functions */ 144/* main rawmidi functions */
151 145
152int snd_rawmidi_new(snd_card_t * card, char *id, int device, 146int snd_rawmidi_new(struct snd_card *card, char *id, int device,
153 int output_count, int input_count, 147 int output_count, int input_count,
154 snd_rawmidi_t ** rmidi); 148 struct snd_rawmidi **rmidi);
155void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops); 149void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
150 struct snd_rawmidi_ops *ops);
156 151
157/* callbacks */ 152/* callbacks */
158 153
159void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream); 154void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
160int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count); 155int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
161void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream); 156 const unsigned char *buffer, int count);
162int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream); 157void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
163int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 158int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
164int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count); 159int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
165int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 160 unsigned char *buffer, int count);
161int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count);
162int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
163 unsigned char *buffer, int count);
166 164
167/* main midi functions */ 165/* main midi functions */
168 166
169int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info); 167int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info);
170int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile); 168int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode,
171int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile); 169 struct snd_rawmidi_file *rfile);
172int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 170int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile);
173int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 171int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
174int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream); 172 struct snd_rawmidi_params *params);
175int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream); 173int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
176int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream); 174 struct snd_rawmidi_params *params);
177long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count); 175int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count); 176int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream);
177int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
179 unsigned char *buf, long count);
180long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
181 const unsigned char *buf, long count);
179 182
180#endif /* __SOUND_RAWMIDI_H */ 183#endif /* __SOUND_RAWMIDI_H */
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index d033e61c05c7..ede0a6083d29 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -50,13 +50,13 @@ module_param_array(amidi_map, int, NULL, 0444);
50MODULE_PARM_DESC(amidi_map, "Raw MIDI device number assigned to 2nd OSS device."); 50MODULE_PARM_DESC(amidi_map, "Raw MIDI device number assigned to 2nd OSS device.");
51#endif /* CONFIG_SND_OSSEMUL */ 51#endif /* CONFIG_SND_OSSEMUL */
52 52
53static int snd_rawmidi_free(snd_rawmidi_t *rawmidi); 53static int snd_rawmidi_free(struct snd_rawmidi *rawmidi);
54static int snd_rawmidi_dev_free(snd_device_t *device); 54static int snd_rawmidi_dev_free(struct snd_device *device);
55static int snd_rawmidi_dev_register(snd_device_t *device); 55static int snd_rawmidi_dev_register(struct snd_device *device);
56static int snd_rawmidi_dev_disconnect(snd_device_t *device); 56static int snd_rawmidi_dev_disconnect(struct snd_device *device);
57static int snd_rawmidi_dev_unregister(snd_device_t *device); 57static int snd_rawmidi_dev_unregister(struct snd_device *device);
58 58
59static snd_rawmidi_t *snd_rawmidi_devices[SNDRV_CARDS * SNDRV_RAWMIDI_DEVICES]; 59static struct snd_rawmidi *snd_rawmidi_devices[SNDRV_CARDS * SNDRV_RAWMIDI_DEVICES];
60 60
61static DECLARE_MUTEX(register_mutex); 61static DECLARE_MUTEX(register_mutex);
62 62
@@ -72,34 +72,35 @@ static inline unsigned short snd_rawmidi_file_flags(struct file *file)
72 } 72 }
73} 73}
74 74
75static inline int snd_rawmidi_ready(snd_rawmidi_substream_t * substream) 75static inline int snd_rawmidi_ready(struct snd_rawmidi_substream *substream)
76{ 76{
77 snd_rawmidi_runtime_t *runtime = substream->runtime; 77 struct snd_rawmidi_runtime *runtime = substream->runtime;
78 return runtime->avail >= runtime->avail_min; 78 return runtime->avail >= runtime->avail_min;
79} 79}
80 80
81static inline int snd_rawmidi_ready_append(snd_rawmidi_substream_t * substream, size_t count) 81static inline int snd_rawmidi_ready_append(struct snd_rawmidi_substream *substream,
82 size_t count)
82{ 83{
83 snd_rawmidi_runtime_t *runtime = substream->runtime; 84 struct snd_rawmidi_runtime *runtime = substream->runtime;
84 return runtime->avail >= runtime->avail_min && 85 return runtime->avail >= runtime->avail_min &&
85 (!substream->append || runtime->avail >= count); 86 (!substream->append || runtime->avail >= count);
86} 87}
87 88
88static void snd_rawmidi_input_event_tasklet(unsigned long data) 89static void snd_rawmidi_input_event_tasklet(unsigned long data)
89{ 90{
90 snd_rawmidi_substream_t *substream = (snd_rawmidi_substream_t *)data; 91 struct snd_rawmidi_substream *substream = (struct snd_rawmidi_substream *)data;
91 substream->runtime->event(substream); 92 substream->runtime->event(substream);
92} 93}
93 94
94static void snd_rawmidi_output_trigger_tasklet(unsigned long data) 95static void snd_rawmidi_output_trigger_tasklet(unsigned long data)
95{ 96{
96 snd_rawmidi_substream_t *substream = (snd_rawmidi_substream_t *)data; 97 struct snd_rawmidi_substream *substream = (struct snd_rawmidi_substream *)data;
97 substream->ops->trigger(substream, 1); 98 substream->ops->trigger(substream, 1);
98} 99}
99 100
100static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream) 101static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream)
101{ 102{
102 snd_rawmidi_runtime_t *runtime; 103 struct snd_rawmidi_runtime *runtime;
103 104
104 if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL) 105 if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL)
105 return -ENOMEM; 106 return -ENOMEM;
@@ -129,9 +130,9 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream)
129 return 0; 130 return 0;
130} 131}
131 132
132static int snd_rawmidi_runtime_free(snd_rawmidi_substream_t * substream) 133static int snd_rawmidi_runtime_free(struct snd_rawmidi_substream *substream)
133{ 134{
134 snd_rawmidi_runtime_t *runtime = substream->runtime; 135 struct snd_rawmidi_runtime *runtime = substream->runtime;
135 136
136 kfree(runtime->buffer); 137 kfree(runtime->buffer);
137 kfree(runtime); 138 kfree(runtime);
@@ -139,7 +140,7 @@ static int snd_rawmidi_runtime_free(snd_rawmidi_substream_t * substream)
139 return 0; 140 return 0;
140} 141}
141 142
142static inline void snd_rawmidi_output_trigger(snd_rawmidi_substream_t * substream, int up) 143static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *substream,int up)
143{ 144{
144 if (up) { 145 if (up) {
145 tasklet_hi_schedule(&substream->runtime->tasklet); 146 tasklet_hi_schedule(&substream->runtime->tasklet);
@@ -149,17 +150,17 @@ static inline void snd_rawmidi_output_trigger(snd_rawmidi_substream_t * substrea
149 } 150 }
150} 151}
151 152
152static void snd_rawmidi_input_trigger(snd_rawmidi_substream_t * substream, int up) 153static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
153{ 154{
154 substream->ops->trigger(substream, up); 155 substream->ops->trigger(substream, up);
155 if (!up && substream->runtime->event) 156 if (!up && substream->runtime->event)
156 tasklet_kill(&substream->runtime->tasklet); 157 tasklet_kill(&substream->runtime->tasklet);
157} 158}
158 159
159int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream) 160int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream)
160{ 161{
161 unsigned long flags; 162 unsigned long flags;
162 snd_rawmidi_runtime_t *runtime = substream->runtime; 163 struct snd_rawmidi_runtime *runtime = substream->runtime;
163 164
164 snd_rawmidi_output_trigger(substream, 0); 165 snd_rawmidi_output_trigger(substream, 0);
165 runtime->drain = 0; 166 runtime->drain = 0;
@@ -170,11 +171,11 @@ int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream)
170 return 0; 171 return 0;
171} 172}
172 173
173int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream) 174int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
174{ 175{
175 int err; 176 int err;
176 long timeout; 177 long timeout;
177 snd_rawmidi_runtime_t *runtime = substream->runtime; 178 struct snd_rawmidi_runtime *runtime = substream->runtime;
178 179
179 err = 0; 180 err = 0;
180 runtime->drain = 1; 181 runtime->drain = 1;
@@ -199,10 +200,10 @@ int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream)
199 return err; 200 return err;
200} 201}
201 202
202int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream) 203int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream)
203{ 204{
204 unsigned long flags; 205 unsigned long flags;
205 snd_rawmidi_runtime_t *runtime = substream->runtime; 206 struct snd_rawmidi_runtime *runtime = substream->runtime;
206 207
207 snd_rawmidi_input_trigger(substream, 0); 208 snd_rawmidi_input_trigger(substream, 0);
208 runtime->drain = 0; 209 runtime->drain = 0;
@@ -214,12 +215,12 @@ int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream)
214} 215}
215 216
216int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, 217int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
217 int mode, snd_rawmidi_file_t * rfile) 218 int mode, struct snd_rawmidi_file * rfile)
218{ 219{
219 snd_rawmidi_t *rmidi; 220 struct snd_rawmidi *rmidi;
220 struct list_head *list1, *list2; 221 struct list_head *list1, *list2;
221 snd_rawmidi_substream_t *sinput = NULL, *soutput = NULL; 222 struct snd_rawmidi_substream *sinput = NULL, *soutput = NULL;
222 snd_rawmidi_runtime_t *input = NULL, *output = NULL; 223 struct snd_rawmidi_runtime *input = NULL, *output = NULL;
223 int err; 224 int err;
224 225
225 if (rfile) 226 if (rfile)
@@ -275,7 +276,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
275 } 276 }
276 break; 277 break;
277 } 278 }
278 sinput = list_entry(list1, snd_rawmidi_substream_t, list); 279 sinput = list_entry(list1, struct snd_rawmidi_substream, list);
279 if ((mode & SNDRV_RAWMIDI_LFLG_INPUT) && sinput->opened) 280 if ((mode & SNDRV_RAWMIDI_LFLG_INPUT) && sinput->opened)
280 goto __nexti; 281 goto __nexti;
281 if (subdevice < 0 || (subdevice >= 0 && subdevice == sinput->number)) 282 if (subdevice < 0 || (subdevice >= 0 && subdevice == sinput->number))
@@ -293,7 +294,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
293 } 294 }
294 break; 295 break;
295 } 296 }
296 soutput = list_entry(list2, snd_rawmidi_substream_t, list); 297 soutput = list_entry(list2, struct snd_rawmidi_substream, list);
297 if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { 298 if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) {
298 if (mode & SNDRV_RAWMIDI_LFLG_APPEND) { 299 if (mode & SNDRV_RAWMIDI_LFLG_APPEND) {
299 if (soutput->opened && !soutput->append) 300 if (soutput->opened && !soutput->append)
@@ -368,15 +369,15 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
368{ 369{
369 int maj = imajor(inode); 370 int maj = imajor(inode);
370 int cardnum; 371 int cardnum;
371 snd_card_t *card; 372 struct snd_card *card;
372 int device, subdevice; 373 int device, subdevice;
373 unsigned short fflags; 374 unsigned short fflags;
374 int err; 375 int err;
375 snd_rawmidi_t *rmidi; 376 struct snd_rawmidi *rmidi;
376 snd_rawmidi_file_t *rawmidi_file; 377 struct snd_rawmidi_file *rawmidi_file;
377 wait_queue_t wait; 378 wait_queue_t wait;
378 struct list_head *list; 379 struct list_head *list;
379 snd_ctl_file_t *kctl; 380 struct snd_ctl_file *kctl;
380 381
381 if (maj == snd_major) { 382 if (maj == snd_major) {
382 cardnum = SNDRV_MINOR_CARD(iminor(inode)); 383 cardnum = SNDRV_MINOR_CARD(iminor(inode));
@@ -465,11 +466,11 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
465 return err; 466 return err;
466} 467}
467 468
468int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile) 469int snd_rawmidi_kernel_release(struct snd_rawmidi_file * rfile)
469{ 470{
470 snd_rawmidi_t *rmidi; 471 struct snd_rawmidi *rmidi;
471 snd_rawmidi_substream_t *substream; 472 struct snd_rawmidi_substream *substream;
472 snd_rawmidi_runtime_t *runtime; 473 struct snd_rawmidi_runtime *runtime;
473 474
474 snd_assert(rfile != NULL, return -ENXIO); 475 snd_assert(rfile != NULL, return -ENXIO);
475 snd_assert(rfile->input != NULL || rfile->output != NULL, return -ENXIO); 476 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 516
516static int snd_rawmidi_release(struct inode *inode, struct file *file) 517static int snd_rawmidi_release(struct inode *inode, struct file *file)
517{ 518{
518 snd_rawmidi_file_t *rfile; 519 struct snd_rawmidi_file *rfile;
519 snd_rawmidi_t *rmidi; 520 struct snd_rawmidi *rmidi;
520 int err; 521 int err;
521 522
522 rfile = file->private_data; 523 rfile = file->private_data;
@@ -528,9 +529,10 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file)
528 return err; 529 return err;
529} 530}
530 531
531int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *info) 532int snd_rawmidi_info(struct snd_rawmidi_substream *substream,
533 struct snd_rawmidi_info *info)
532{ 534{
533 snd_rawmidi_t *rmidi; 535 struct snd_rawmidi *rmidi;
534 536
535 if (substream == NULL) 537 if (substream == NULL)
536 return -ENODEV; 538 return -ENODEV;
@@ -550,22 +552,23 @@ int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *inf
550 return 0; 552 return 0;
551} 553}
552 554
553static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t __user * _info) 555static int snd_rawmidi_info_user(struct snd_rawmidi_substream *substream,
556 struct snd_rawmidi_info __user * _info)
554{ 557{
555 snd_rawmidi_info_t info; 558 struct snd_rawmidi_info info;
556 int err; 559 int err;
557 if ((err = snd_rawmidi_info(substream, &info)) < 0) 560 if ((err = snd_rawmidi_info(substream, &info)) < 0)
558 return err; 561 return err;
559 if (copy_to_user(_info, &info, sizeof(snd_rawmidi_info_t))) 562 if (copy_to_user(_info, &info, sizeof(struct snd_rawmidi_info)))
560 return -EFAULT; 563 return -EFAULT;
561 return 0; 564 return 0;
562} 565}
563 566
564int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info) 567int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info)
565{ 568{
566 snd_rawmidi_t *rmidi; 569 struct snd_rawmidi *rmidi;
567 snd_rawmidi_str_t *pstr; 570 struct snd_rawmidi_str *pstr;
568 snd_rawmidi_substream_t *substream; 571 struct snd_rawmidi_substream *substream;
569 struct list_head *list; 572 struct list_head *list;
570 if (info->device >= SNDRV_RAWMIDI_DEVICES) 573 if (info->device >= SNDRV_RAWMIDI_DEVICES)
571 return -ENXIO; 574 return -ENXIO;
@@ -578,18 +581,18 @@ int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info)
578 if (info->subdevice >= pstr->substream_count) 581 if (info->subdevice >= pstr->substream_count)
579 return -ENXIO; 582 return -ENXIO;
580 list_for_each(list, &pstr->substreams) { 583 list_for_each(list, &pstr->substreams) {
581 substream = list_entry(list, snd_rawmidi_substream_t, list); 584 substream = list_entry(list, struct snd_rawmidi_substream, list);
582 if ((unsigned int)substream->number == info->subdevice) 585 if ((unsigned int)substream->number == info->subdevice)
583 return snd_rawmidi_info(substream, info); 586 return snd_rawmidi_info(substream, info);
584 } 587 }
585 return -ENXIO; 588 return -ENXIO;
586} 589}
587 590
588static int snd_rawmidi_info_select_user(snd_card_t *card, 591static int snd_rawmidi_info_select_user(struct snd_card *card,
589 snd_rawmidi_info_t __user *_info) 592 struct snd_rawmidi_info __user *_info)
590{ 593{
591 int err; 594 int err;
592 snd_rawmidi_info_t info; 595 struct snd_rawmidi_info info;
593 if (get_user(info.device, &_info->device)) 596 if (get_user(info.device, &_info->device))
594 return -EFAULT; 597 return -EFAULT;
595 if (get_user(info.stream, &_info->stream)) 598 if (get_user(info.stream, &_info->stream))
@@ -598,16 +601,16 @@ static int snd_rawmidi_info_select_user(snd_card_t *card,
598 return -EFAULT; 601 return -EFAULT;
599 if ((err = snd_rawmidi_info_select(card, &info)) < 0) 602 if ((err = snd_rawmidi_info_select(card, &info)) < 0)
600 return err; 603 return err;
601 if (copy_to_user(_info, &info, sizeof(snd_rawmidi_info_t))) 604 if (copy_to_user(_info, &info, sizeof(struct snd_rawmidi_info)))
602 return -EFAULT; 605 return -EFAULT;
603 return 0; 606 return 0;
604} 607}
605 608
606int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, 609int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
607 snd_rawmidi_params_t * params) 610 struct snd_rawmidi_params * params)
608{ 611{
609 char *newbuf; 612 char *newbuf;
610 snd_rawmidi_runtime_t *runtime = substream->runtime; 613 struct snd_rawmidi_runtime *runtime = substream->runtime;
611 614
612 if (substream->append && substream->use_count > 1) 615 if (substream->append && substream->use_count > 1)
613 return -EBUSY; 616 return -EBUSY;
@@ -630,11 +633,11 @@ int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream,
630 return 0; 633 return 0;
631} 634}
632 635
633int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, 636int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
634 snd_rawmidi_params_t * params) 637 struct snd_rawmidi_params * params)
635{ 638{
636 char *newbuf; 639 char *newbuf;
637 snd_rawmidi_runtime_t *runtime = substream->runtime; 640 struct snd_rawmidi_runtime *runtime = substream->runtime;
638 641
639 snd_rawmidi_drain_input(substream); 642 snd_rawmidi_drain_input(substream);
640 if (params->buffer_size < 32 || params->buffer_size > 1024L * 1024L) { 643 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 return 0; 657 return 0;
655} 658}
656 659
657static int snd_rawmidi_output_status(snd_rawmidi_substream_t * substream, 660static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream,
658 snd_rawmidi_status_t * status) 661 struct snd_rawmidi_status * status)
659{ 662{
660 snd_rawmidi_runtime_t *runtime = substream->runtime; 663 struct snd_rawmidi_runtime *runtime = substream->runtime;
661 664
662 memset(status, 0, sizeof(*status)); 665 memset(status, 0, sizeof(*status));
663 status->stream = SNDRV_RAWMIDI_STREAM_OUTPUT; 666 status->stream = SNDRV_RAWMIDI_STREAM_OUTPUT;
@@ -667,10 +670,10 @@ static int snd_rawmidi_output_status(snd_rawmidi_substream_t * substream,
667 return 0; 670 return 0;
668} 671}
669 672
670static int snd_rawmidi_input_status(snd_rawmidi_substream_t * substream, 673static int snd_rawmidi_input_status(struct snd_rawmidi_substream *substream,
671 snd_rawmidi_status_t * status) 674 struct snd_rawmidi_status * status)
672{ 675{
673 snd_rawmidi_runtime_t *runtime = substream->runtime; 676 struct snd_rawmidi_runtime *runtime = substream->runtime;
674 677
675 memset(status, 0, sizeof(*status)); 678 memset(status, 0, sizeof(*status));
676 status->stream = SNDRV_RAWMIDI_STREAM_INPUT; 679 status->stream = SNDRV_RAWMIDI_STREAM_INPUT;
@@ -684,7 +687,7 @@ static int snd_rawmidi_input_status(snd_rawmidi_substream_t * substream,
684 687
685static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 688static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
686{ 689{
687 snd_rawmidi_file_t *rfile; 690 struct snd_rawmidi_file *rfile;
688 void __user *argp = (void __user *)arg; 691 void __user *argp = (void __user *)arg;
689 692
690 rfile = file->private_data; 693 rfile = file->private_data;
@@ -695,8 +698,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
695 return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0; 698 return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0;
696 case SNDRV_RAWMIDI_IOCTL_INFO: 699 case SNDRV_RAWMIDI_IOCTL_INFO:
697 { 700 {
698 snd_rawmidi_stream_t stream; 701 int stream;
699 snd_rawmidi_info_t __user *info = argp; 702 struct snd_rawmidi_info __user *info = argp;
700 if (get_user(stream, &info->stream)) 703 if (get_user(stream, &info->stream))
701 return -EFAULT; 704 return -EFAULT;
702 switch (stream) { 705 switch (stream) {
@@ -710,8 +713,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
710 } 713 }
711 case SNDRV_RAWMIDI_IOCTL_PARAMS: 714 case SNDRV_RAWMIDI_IOCTL_PARAMS:
712 { 715 {
713 snd_rawmidi_params_t params; 716 struct snd_rawmidi_params params;
714 if (copy_from_user(&params, argp, sizeof(snd_rawmidi_params_t))) 717 if (copy_from_user(&params, argp, sizeof(struct snd_rawmidi_params)))
715 return -EFAULT; 718 return -EFAULT;
716 switch (params.stream) { 719 switch (params.stream) {
717 case SNDRV_RAWMIDI_STREAM_OUTPUT: 720 case SNDRV_RAWMIDI_STREAM_OUTPUT:
@@ -729,8 +732,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
729 case SNDRV_RAWMIDI_IOCTL_STATUS: 732 case SNDRV_RAWMIDI_IOCTL_STATUS:
730 { 733 {
731 int err = 0; 734 int err = 0;
732 snd_rawmidi_status_t status; 735 struct snd_rawmidi_status status;
733 if (copy_from_user(&status, argp, sizeof(snd_rawmidi_status_t))) 736 if (copy_from_user(&status, argp, sizeof(struct snd_rawmidi_status)))
734 return -EFAULT; 737 return -EFAULT;
735 switch (status.stream) { 738 switch (status.stream) {
736 case SNDRV_RAWMIDI_STREAM_OUTPUT: 739 case SNDRV_RAWMIDI_STREAM_OUTPUT:
@@ -748,7 +751,7 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
748 } 751 }
749 if (err < 0) 752 if (err < 0)
750 return err; 753 return err;
751 if (copy_to_user(argp, &status, sizeof(snd_rawmidi_status_t))) 754 if (copy_to_user(argp, &status, sizeof(struct snd_rawmidi_status)))
752 return -EFAULT; 755 return -EFAULT;
753 return 0; 756 return 0;
754 } 757 }
@@ -792,8 +795,8 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
792 return -ENOTTY; 795 return -ENOTTY;
793} 796}
794 797
795static int snd_rawmidi_control_ioctl(snd_card_t * card, 798static int snd_rawmidi_control_ioctl(struct snd_card *card,
796 snd_ctl_file_t * control, 799 struct snd_ctl_file *control,
797 unsigned int cmd, 800 unsigned int cmd,
798 unsigned long arg) 801 unsigned long arg)
799{ 802{
@@ -845,11 +848,12 @@ static int snd_rawmidi_control_ioctl(snd_card_t * card,
845 * 848 *
846 * Returns the size of read data, or a negative error code on failure. 849 * Returns the size of read data, or a negative error code on failure.
847 */ 850 */
848int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count) 851int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
852 const unsigned char *buffer, int count)
849{ 853{
850 unsigned long flags; 854 unsigned long flags;
851 int result = 0, count1; 855 int result = 0, count1;
852 snd_rawmidi_runtime_t *runtime = substream->runtime; 856 struct snd_rawmidi_runtime *runtime = substream->runtime;
853 857
854 if (runtime->buffer == NULL) { 858 if (runtime->buffer == NULL) {
855 snd_printd("snd_rawmidi_receive: input is not active!!!\n"); 859 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 return result; 908 return result;
905} 909}
906 910
907static long snd_rawmidi_kernel_read1(snd_rawmidi_substream_t *substream, 911static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
908 unsigned char *buf, long count, int kernel) 912 unsigned char *buf, long count, int kernel)
909{ 913{
910 unsigned long flags; 914 unsigned long flags;
911 long result = 0, count1; 915 long result = 0, count1;
912 snd_rawmidi_runtime_t *runtime = substream->runtime; 916 struct snd_rawmidi_runtime *runtime = substream->runtime;
913 917
914 while (count > 0 && runtime->avail) { 918 while (count > 0 && runtime->avail) {
915 count1 = runtime->buffer_size - runtime->appl_ptr; 919 count1 = runtime->buffer_size - runtime->appl_ptr;
@@ -938,19 +942,21 @@ static long snd_rawmidi_kernel_read1(snd_rawmidi_substream_t *substream,
938 return result; 942 return result;
939} 943}
940 944
941long snd_rawmidi_kernel_read(snd_rawmidi_substream_t *substream, unsigned char *buf, long count) 945long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
946 unsigned char *buf, long count)
942{ 947{
943 snd_rawmidi_input_trigger(substream, 1); 948 snd_rawmidi_input_trigger(substream, 1);
944 return snd_rawmidi_kernel_read1(substream, buf, count, 1); 949 return snd_rawmidi_kernel_read1(substream, buf, count, 1);
945} 950}
946 951
947static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, loff_t *offset) 952static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count,
953 loff_t *offset)
948{ 954{
949 long result; 955 long result;
950 int count1; 956 int count1;
951 snd_rawmidi_file_t *rfile; 957 struct snd_rawmidi_file *rfile;
952 snd_rawmidi_substream_t *substream; 958 struct snd_rawmidi_substream *substream;
953 snd_rawmidi_runtime_t *runtime; 959 struct snd_rawmidi_runtime *runtime;
954 960
955 rfile = file->private_data; 961 rfile = file->private_data;
956 substream = rfile->input; 962 substream = rfile->input;
@@ -998,9 +1004,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
998 * 1004 *
999 * Returns 1 if the internal output buffer is empty, 0 if not. 1005 * Returns 1 if the internal output buffer is empty, 0 if not.
1000 */ 1006 */
1001int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream) 1007int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
1002{ 1008{
1003 snd_rawmidi_runtime_t *runtime = substream->runtime; 1009 struct snd_rawmidi_runtime *runtime = substream->runtime;
1004 int result; 1010 int result;
1005 unsigned long flags; 1011 unsigned long flags;
1006 1012
@@ -1028,11 +1034,12 @@ int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream)
1028 * 1034 *
1029 * Returns the size of copied data, or a negative error code on failure. 1035 * Returns the size of copied data, or a negative error code on failure.
1030 */ 1036 */
1031int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count) 1037int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
1038 unsigned char *buffer, int count)
1032{ 1039{
1033 unsigned long flags; 1040 unsigned long flags;
1034 int result, count1; 1041 int result, count1;
1035 snd_rawmidi_runtime_t *runtime = substream->runtime; 1042 struct snd_rawmidi_runtime *runtime = substream->runtime;
1036 1043
1037 if (runtime->buffer == NULL) { 1044 if (runtime->buffer == NULL) {
1038 snd_printd("snd_rawmidi_transmit_peek: output is not active!!!\n"); 1045 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 * 1086 *
1080 * Returns the advanced size if successful, or a negative error code on failure. 1087 * Returns the advanced size if successful, or a negative error code on failure.
1081 */ 1088 */
1082int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count) 1089int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count)
1083{ 1090{
1084 unsigned long flags; 1091 unsigned long flags;
1085 snd_rawmidi_runtime_t *runtime = substream->runtime; 1092 struct snd_rawmidi_runtime *runtime = substream->runtime;
1086 1093
1087 if (runtime->buffer == NULL) { 1094 if (runtime->buffer == NULL) {
1088 snd_printd("snd_rawmidi_transmit_ack: output is not active!!!\n"); 1095 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 * 1119 *
1113 * Returns the copied size if successful, or a negative error code on failure. 1120 * Returns the copied size if successful, or a negative error code on failure.
1114 */ 1121 */
1115int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count) 1122int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
1123 unsigned char *buffer, int count)
1116{ 1124{
1117 count = snd_rawmidi_transmit_peek(substream, buffer, count); 1125 count = snd_rawmidi_transmit_peek(substream, buffer, count);
1118 if (count < 0) 1126 if (count < 0)
@@ -1120,11 +1128,12 @@ int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buf
1120 return snd_rawmidi_transmit_ack(substream, count); 1128 return snd_rawmidi_transmit_ack(substream, count);
1121} 1129}
1122 1130
1123static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count, int kernel) 1131static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
1132 const unsigned char *buf, long count, int kernel)
1124{ 1133{
1125 unsigned long flags; 1134 unsigned long flags;
1126 long count1, result; 1135 long count1, result;
1127 snd_rawmidi_runtime_t *runtime = substream->runtime; 1136 struct snd_rawmidi_runtime *runtime = substream->runtime;
1128 1137
1129 snd_assert(buf != NULL, return -EINVAL); 1138 snd_assert(buf != NULL, return -EINVAL);
1130 snd_assert(runtime->buffer != NULL, return -EINVAL); 1139 snd_assert(runtime->buffer != NULL, return -EINVAL);
@@ -1170,18 +1179,20 @@ static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const
1170 return result; 1179 return result;
1171} 1180}
1172 1181
1173long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count) 1182long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
1183 const unsigned char *buf, long count)
1174{ 1184{
1175 return snd_rawmidi_kernel_write1(substream, buf, count, 1); 1185 return snd_rawmidi_kernel_write1(substream, buf, count, 1);
1176} 1186}
1177 1187
1178static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) 1188static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf,
1189 size_t count, loff_t *offset)
1179{ 1190{
1180 long result, timeout; 1191 long result, timeout;
1181 int count1; 1192 int count1;
1182 snd_rawmidi_file_t *rfile; 1193 struct snd_rawmidi_file *rfile;
1183 snd_rawmidi_runtime_t *runtime; 1194 struct snd_rawmidi_runtime *runtime;
1184 snd_rawmidi_substream_t *substream; 1195 struct snd_rawmidi_substream *substream;
1185 1196
1186 rfile = file->private_data; 1197 rfile = file->private_data;
1187 substream = rfile->output; 1198 substream = rfile->output;
@@ -1246,8 +1257,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size
1246 1257
1247static unsigned int snd_rawmidi_poll(struct file *file, poll_table * wait) 1258static unsigned int snd_rawmidi_poll(struct file *file, poll_table * wait)
1248{ 1259{
1249 snd_rawmidi_file_t *rfile; 1260 struct snd_rawmidi_file *rfile;
1250 snd_rawmidi_runtime_t *runtime; 1261 struct snd_rawmidi_runtime *runtime;
1251 unsigned int mask; 1262 unsigned int mask;
1252 1263
1253 rfile = file->private_data; 1264 rfile = file->private_data;
@@ -1284,12 +1295,12 @@ static unsigned int snd_rawmidi_poll(struct file *file, poll_table * wait)
1284 1295
1285 */ 1296 */
1286 1297
1287static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry, 1298static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
1288 snd_info_buffer_t * buffer) 1299 struct snd_info_buffer *buffer)
1289{ 1300{
1290 snd_rawmidi_t *rmidi; 1301 struct snd_rawmidi *rmidi;
1291 snd_rawmidi_substream_t *substream; 1302 struct snd_rawmidi_substream *substream;
1292 snd_rawmidi_runtime_t *runtime; 1303 struct snd_rawmidi_runtime *runtime;
1293 struct list_head *list; 1304 struct list_head *list;
1294 1305
1295 rmidi = entry->private_data; 1306 rmidi = entry->private_data;
@@ -1297,7 +1308,7 @@ static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry,
1297 down(&rmidi->open_mutex); 1308 down(&rmidi->open_mutex);
1298 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) { 1309 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {
1299 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { 1310 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) {
1300 substream = list_entry(list, snd_rawmidi_substream_t, list); 1311 substream = list_entry(list, struct snd_rawmidi_substream, list);
1301 snd_iprintf(buffer, 1312 snd_iprintf(buffer,
1302 "Output %d\n" 1313 "Output %d\n"
1303 " Tx bytes : %lu\n", 1314 " Tx bytes : %lu\n",
@@ -1317,7 +1328,7 @@ static void snd_rawmidi_proc_info_read(snd_info_entry_t *entry,
1317 } 1328 }
1318 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) { 1329 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) {
1319 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { 1330 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) {
1320 substream = list_entry(list, snd_rawmidi_substream_t, list); 1331 substream = list_entry(list, struct snd_rawmidi_substream, list);
1321 snd_iprintf(buffer, 1332 snd_iprintf(buffer,
1322 "Input %d\n" 1333 "Input %d\n"
1323 " Rx bytes : %lu\n", 1334 " Rx bytes : %lu\n",
@@ -1354,18 +1365,18 @@ static struct file_operations snd_rawmidi_f_ops =
1354 .compat_ioctl = snd_rawmidi_ioctl_compat, 1365 .compat_ioctl = snd_rawmidi_ioctl_compat,
1355}; 1366};
1356 1367
1357static snd_minor_t snd_rawmidi_reg = 1368static struct snd_minor snd_rawmidi_reg =
1358{ 1369{
1359 .comment = "raw midi", 1370 .comment = "raw midi",
1360 .f_ops = &snd_rawmidi_f_ops, 1371 .f_ops = &snd_rawmidi_f_ops,
1361}; 1372};
1362 1373
1363static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi, 1374static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
1364 snd_rawmidi_str_t *stream, 1375 struct snd_rawmidi_str *stream,
1365 int direction, 1376 int direction,
1366 int count) 1377 int count)
1367{ 1378{
1368 snd_rawmidi_substream_t *substream; 1379 struct snd_rawmidi_substream *substream;
1369 int idx; 1380 int idx;
1370 1381
1371 INIT_LIST_HEAD(&stream->substreams); 1382 INIT_LIST_HEAD(&stream->substreams);
@@ -1397,13 +1408,13 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi,
1397 * 1408 *
1398 * Returns zero if successful, or a negative error code on failure. 1409 * Returns zero if successful, or a negative error code on failure.
1399 */ 1410 */
1400int snd_rawmidi_new(snd_card_t * card, char *id, int device, 1411int snd_rawmidi_new(struct snd_card *card, char *id, int device,
1401 int output_count, int input_count, 1412 int output_count, int input_count,
1402 snd_rawmidi_t ** rrawmidi) 1413 struct snd_rawmidi ** rrawmidi)
1403{ 1414{
1404 snd_rawmidi_t *rmidi; 1415 struct snd_rawmidi *rmidi;
1405 int err; 1416 int err;
1406 static snd_device_ops_t ops = { 1417 static struct snd_device_ops ops = {
1407 .dev_free = snd_rawmidi_dev_free, 1418 .dev_free = snd_rawmidi_dev_free,
1408 .dev_register = snd_rawmidi_dev_register, 1419 .dev_register = snd_rawmidi_dev_register,
1409 .dev_disconnect = snd_rawmidi_dev_disconnect, 1420 .dev_disconnect = snd_rawmidi_dev_disconnect,
@@ -1438,18 +1449,18 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device,
1438 return 0; 1449 return 0;
1439} 1450}
1440 1451
1441static void snd_rawmidi_free_substreams(snd_rawmidi_str_t *stream) 1452static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream)
1442{ 1453{
1443 snd_rawmidi_substream_t *substream; 1454 struct snd_rawmidi_substream *substream;
1444 1455
1445 while (!list_empty(&stream->substreams)) { 1456 while (!list_empty(&stream->substreams)) {
1446 substream = list_entry(stream->substreams.next, snd_rawmidi_substream_t, list); 1457 substream = list_entry(stream->substreams.next, struct snd_rawmidi_substream, list);
1447 list_del(&substream->list); 1458 list_del(&substream->list);
1448 kfree(substream); 1459 kfree(substream);
1449 } 1460 }
1450} 1461}
1451 1462
1452static int snd_rawmidi_free(snd_rawmidi_t *rmidi) 1463static int snd_rawmidi_free(struct snd_rawmidi *rmidi)
1453{ 1464{
1454 snd_assert(rmidi != NULL, return -ENXIO); 1465 snd_assert(rmidi != NULL, return -ENXIO);
1455 snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); 1466 snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]);
@@ -1460,26 +1471,26 @@ static int snd_rawmidi_free(snd_rawmidi_t *rmidi)
1460 return 0; 1471 return 0;
1461} 1472}
1462 1473
1463static int snd_rawmidi_dev_free(snd_device_t *device) 1474static int snd_rawmidi_dev_free(struct snd_device *device)
1464{ 1475{
1465 snd_rawmidi_t *rmidi = device->device_data; 1476 struct snd_rawmidi *rmidi = device->device_data;
1466 return snd_rawmidi_free(rmidi); 1477 return snd_rawmidi_free(rmidi);
1467} 1478}
1468 1479
1469#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1480#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
1470static void snd_rawmidi_dev_seq_free(snd_seq_device_t *device) 1481static void snd_rawmidi_dev_seq_free(struct snd_seq_device *device)
1471{ 1482{
1472 snd_rawmidi_t *rmidi = device->private_data; 1483 struct snd_rawmidi *rmidi = device->private_data;
1473 rmidi->seq_dev = NULL; 1484 rmidi->seq_dev = NULL;
1474} 1485}
1475#endif 1486#endif
1476 1487
1477static int snd_rawmidi_dev_register(snd_device_t *device) 1488static int snd_rawmidi_dev_register(struct snd_device *device)
1478{ 1489{
1479 int idx, err; 1490 int idx, err;
1480 snd_info_entry_t *entry; 1491 struct snd_info_entry *entry;
1481 char name[16]; 1492 char name[16];
1482 snd_rawmidi_t *rmidi = device->device_data; 1493 struct snd_rawmidi *rmidi = device->device_data;
1483 1494
1484 if (rmidi->device >= SNDRV_RAWMIDI_DEVICES) 1495 if (rmidi->device >= SNDRV_RAWMIDI_DEVICES)
1485 return -ENOMEM; 1496 return -ENOMEM;
@@ -1554,9 +1565,9 @@ static int snd_rawmidi_dev_register(snd_device_t *device)
1554 return 0; 1565 return 0;
1555} 1566}
1556 1567
1557static int snd_rawmidi_dev_disconnect(snd_device_t *device) 1568static int snd_rawmidi_dev_disconnect(struct snd_device *device)
1558{ 1569{
1559 snd_rawmidi_t *rmidi = device->device_data; 1570 struct snd_rawmidi *rmidi = device->device_data;
1560 int idx; 1571 int idx;
1561 1572
1562 down(&register_mutex); 1573 down(&register_mutex);
@@ -1566,10 +1577,10 @@ static int snd_rawmidi_dev_disconnect(snd_device_t *device)
1566 return 0; 1577 return 0;
1567} 1578}
1568 1579
1569static int snd_rawmidi_dev_unregister(snd_device_t *device) 1580static int snd_rawmidi_dev_unregister(struct snd_device *device)
1570{ 1581{
1571 int idx; 1582 int idx;
1572 snd_rawmidi_t *rmidi = device->device_data; 1583 struct snd_rawmidi *rmidi = device->device_data;
1573 1584
1574 snd_assert(rmidi != NULL, return -ENXIO); 1585 snd_assert(rmidi != NULL, return -ENXIO);
1575 down(&register_mutex); 1586 down(&register_mutex);
@@ -1613,13 +1624,14 @@ static int snd_rawmidi_dev_unregister(snd_device_t *device)
1613 * 1624 *
1614 * Sets the rawmidi operators for the given stream direction. 1625 * Sets the rawmidi operators for the given stream direction.
1615 */ 1626 */
1616void snd_rawmidi_set_ops(snd_rawmidi_t *rmidi, int stream, snd_rawmidi_ops_t *ops) 1627void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
1628 struct snd_rawmidi_ops *ops)
1617{ 1629{
1618 struct list_head *list; 1630 struct list_head *list;
1619 snd_rawmidi_substream_t *substream; 1631 struct snd_rawmidi_substream *substream;
1620 1632
1621 list_for_each(list, &rmidi->streams[stream].substreams) { 1633 list_for_each(list, &rmidi->streams[stream].substreams) {
1622 substream = list_entry(list, snd_rawmidi_substream_t, list); 1634 substream = list_entry(list, struct snd_rawmidi_substream, list);
1623 substream->ops = ops; 1635 substream->ops = ops;
1624 } 1636 }
1625} 1637}
diff --git a/sound/core/rawmidi_compat.c b/sound/core/rawmidi_compat.c
index d97631c3f3ad..5268c1f58c25 100644
--- a/sound/core/rawmidi_compat.c
+++ b/sound/core/rawmidi_compat.c
@@ -22,7 +22,7 @@
22 22
23#include <linux/compat.h> 23#include <linux/compat.h>
24 24
25struct sndrv_rawmidi_params32 { 25struct snd_rawmidi_params32 {
26 s32 stream; 26 s32 stream;
27 u32 buffer_size; 27 u32 buffer_size;
28 u32 avail_min; 28 u32 avail_min;
@@ -30,10 +30,10 @@ struct sndrv_rawmidi_params32 {
30 unsigned char reserved[16]; 30 unsigned char reserved[16];
31} __attribute__((packed)); 31} __attribute__((packed));
32 32
33static int snd_rawmidi_ioctl_params_compat(snd_rawmidi_file_t *rfile, 33static int snd_rawmidi_ioctl_params_compat(struct snd_rawmidi_file *rfile,
34 struct sndrv_rawmidi_params32 __user *src) 34 struct snd_rawmidi_params32 __user *src)
35{ 35{
36 snd_rawmidi_params_t params; 36 struct snd_rawmidi_params params;
37 unsigned int val; 37 unsigned int val;
38 38
39 if (rfile->output == NULL) 39 if (rfile->output == NULL)
@@ -53,7 +53,7 @@ static int snd_rawmidi_ioctl_params_compat(snd_rawmidi_file_t *rfile,
53 return -EINVAL; 53 return -EINVAL;
54} 54}
55 55
56struct sndrv_rawmidi_status32 { 56struct snd_rawmidi_status32 {
57 s32 stream; 57 s32 stream;
58 struct compat_timespec tstamp; 58 struct compat_timespec tstamp;
59 u32 avail; 59 u32 avail;
@@ -61,11 +61,11 @@ struct sndrv_rawmidi_status32 {
61 unsigned char reserved[16]; 61 unsigned char reserved[16];
62} __attribute__((packed)); 62} __attribute__((packed));
63 63
64static int snd_rawmidi_ioctl_status_compat(snd_rawmidi_file_t *rfile, 64static int snd_rawmidi_ioctl_status_compat(struct snd_rawmidi_file *rfile,
65 struct sndrv_rawmidi_status32 __user *src) 65 struct snd_rawmidi_status32 __user *src)
66{ 66{
67 int err; 67 int err;
68 snd_rawmidi_status_t status; 68 struct snd_rawmidi_status status;
69 69
70 if (rfile->output == NULL) 70 if (rfile->output == NULL)
71 return -EINVAL; 71 return -EINVAL;
@@ -95,13 +95,13 @@ static int snd_rawmidi_ioctl_status_compat(snd_rawmidi_file_t *rfile,
95} 95}
96 96
97enum { 97enum {
98 SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct sndrv_rawmidi_params32), 98 SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct snd_rawmidi_params32),
99 SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct sndrv_rawmidi_status32), 99 SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct snd_rawmidi_status32),
100}; 100};
101 101
102static long snd_rawmidi_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) 102static long snd_rawmidi_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
103{ 103{
104 snd_rawmidi_file_t *rfile; 104 struct snd_rawmidi_file *rfile;
105 void __user *argp = compat_ptr(arg); 105 void __user *argp = compat_ptr(arg);
106 106
107 rfile = file->private_data; 107 rfile = file->private_data;