aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq/midi.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-03-03 14:46:21 -0500
committerTakashi Iwai <tiwai@suse.de>2013-03-04 03:57:17 -0500
commit1c8470ce311c6b2b49a71a02961c360d04ed28b2 (patch)
tree34aca4afee14e143a0e3f6150888f3af4655fe22 /sound/usb/caiaq/midi.c
parent6dbe51c251a327e012439c4772097a13df43c5b8 (diff)
ALSA: snd-usb-caiaq: rename 'dev' to 'cdev'
This is needed in order to make the device namespace cleaner, and will help when moving this driver over to dev_*() logging. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/caiaq/midi.c')
-rw-r--r--sound/usb/caiaq/midi.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c
index a1a47088fd0c..63c5a2caa0ad 100644
--- a/sound/usb/caiaq/midi.c
+++ b/sound/usb/caiaq/midi.c
@@ -37,12 +37,12 @@ static int snd_usb_caiaq_midi_input_close(struct snd_rawmidi_substream *substrea
37 37
38static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) 38static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
39{ 39{
40 struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; 40 struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data;
41 41
42 if (!dev) 42 if (!cdev)
43 return; 43 return;
44 44
45 dev->midi_receive_substream = up ? substream : NULL; 45 cdev->midi_receive_substream = up ? substream : NULL;
46} 46}
47 47
48 48
@@ -53,49 +53,49 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea
53 53
54static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) 54static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream)
55{ 55{
56 struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; 56 struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data;
57 if (dev->midi_out_active) { 57 if (cdev->midi_out_active) {
58 usb_kill_urb(&dev->midi_out_urb); 58 usb_kill_urb(&cdev->midi_out_urb);
59 dev->midi_out_active = 0; 59 cdev->midi_out_active = 0;
60 } 60 }
61 return 0; 61 return 0;
62} 62}
63 63
64static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, 64static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *cdev,
65 struct snd_rawmidi_substream *substream) 65 struct snd_rawmidi_substream *substream)
66{ 66{
67 int len, ret; 67 int len, ret;
68 68
69 dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; 69 cdev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE;
70 dev->midi_out_buf[1] = 0; /* port */ 70 cdev->midi_out_buf[1] = 0; /* port */
71 len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3, 71 len = snd_rawmidi_transmit(substream, cdev->midi_out_buf + 3,
72 EP1_BUFSIZE - 3); 72 EP1_BUFSIZE - 3);
73 73
74 if (len <= 0) 74 if (len <= 0)
75 return; 75 return;
76 76
77 dev->midi_out_buf[2] = len; 77 cdev->midi_out_buf[2] = len;
78 dev->midi_out_urb.transfer_buffer_length = len+3; 78 cdev->midi_out_urb.transfer_buffer_length = len+3;
79 79
80 ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); 80 ret = usb_submit_urb(&cdev->midi_out_urb, GFP_ATOMIC);
81 if (ret < 0) 81 if (ret < 0)
82 log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," 82 log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed,"
83 "ret=%d, len=%d\n", 83 "ret=%d, len=%d\n",
84 substream, ret, len); 84 substream, ret, len);
85 else 85 else
86 dev->midi_out_active = 1; 86 cdev->midi_out_active = 1;
87} 87}
88 88
89static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) 89static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
90{ 90{
91 struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; 91 struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data;
92 92
93 if (up) { 93 if (up) {
94 dev->midi_out_substream = substream; 94 cdev->midi_out_substream = substream;
95 if (!dev->midi_out_active) 95 if (!cdev->midi_out_active)
96 snd_usb_caiaq_midi_send(dev, substream); 96 snd_usb_caiaq_midi_send(cdev, substream);
97 } else { 97 } else {
98 dev->midi_out_substream = NULL; 98 cdev->midi_out_substream = NULL;
99 } 99 }
100} 100}
101 101
@@ -114,13 +114,13 @@ static struct snd_rawmidi_ops snd_usb_caiaq_midi_input =
114 .trigger = snd_usb_caiaq_midi_input_trigger, 114 .trigger = snd_usb_caiaq_midi_input_trigger,
115}; 115};
116 116
117void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, 117void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *cdev,
118 int port, const char *buf, int len) 118 int port, const char *buf, int len)
119{ 119{
120 if (!dev->midi_receive_substream) 120 if (!cdev->midi_receive_substream)
121 return; 121 return;
122 122
123 snd_rawmidi_receive(dev->midi_receive_substream, buf, len); 123 snd_rawmidi_receive(cdev->midi_receive_substream, buf, len);
124} 124}
125 125
126int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) 126int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
@@ -160,15 +160,15 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
160 160
161void snd_usb_caiaq_midi_output_done(struct urb* urb) 161void snd_usb_caiaq_midi_output_done(struct urb* urb)
162{ 162{
163 struct snd_usb_caiaqdev *dev = urb->context; 163 struct snd_usb_caiaqdev *cdev = urb->context;
164 164
165 dev->midi_out_active = 0; 165 cdev->midi_out_active = 0;
166 if (urb->status != 0) 166 if (urb->status != 0)
167 return; 167 return;
168 168
169 if (!dev->midi_out_substream) 169 if (!cdev->midi_out_substream)
170 return; 170 return;
171 171
172 snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); 172 snd_usb_caiaq_midi_send(cdev, cdev->midi_out_substream);
173} 173}
174 174