summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Goode <agoode@google.com>2014-08-05 12:44:51 -0400
committerTakashi Iwai <tiwai@suse.de>2014-08-05 20:08:00 +0200
commita509574e5ea7b617268943526773ebf7e2d20a9b (patch)
treeb899708c4f1c53f124d7aef5fc7364d4ebf8deba
parentf7881e5e8ef305e62084bf3d31b5b0d827fdf511 (diff)
ALSA: usb-audio: Whitespace cleanups for sound/usb/midi.*
Signed-off-by: Adam Goode <agoode@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/usb/midi.c373
-rw-r--r--sound/usb/midi.h4
2 files changed, 211 insertions, 166 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 9a4e82cf4ef..7b166c2be0f 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -102,8 +102,8 @@ struct usb_protocol_ops {
void (*input)(struct snd_usb_midi_in_endpoint*, uint8_t*, int);
void (*output)(struct snd_usb_midi_out_endpoint *ep, struct urb *urb);
void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t);
- void (*init_out_endpoint)(struct snd_usb_midi_out_endpoint*);
- void (*finish_out_endpoint)(struct snd_usb_midi_out_endpoint*);
+ void (*init_out_endpoint)(struct snd_usb_midi_out_endpoint *);
+ void (*finish_out_endpoint)(struct snd_usb_midi_out_endpoint *);
};
struct snd_usb_midi {
@@ -112,7 +112,7 @@ struct snd_usb_midi {
struct usb_interface *iface;
const struct snd_usb_audio_quirk *quirk;
struct snd_rawmidi *rmidi;
- struct usb_protocol_ops* usb_protocol_ops;
+ struct usb_protocol_ops *usb_protocol_ops;
struct list_head list;
struct timer_list error_timer;
spinlock_t disc_lock;
@@ -134,7 +134,7 @@ struct snd_usb_midi {
};
struct snd_usb_midi_out_endpoint {
- struct snd_usb_midi* umidi;
+ struct snd_usb_midi *umidi;
struct out_urb_context {
struct urb *urb;
struct snd_usb_midi_out_endpoint *ep;
@@ -147,7 +147,7 @@ struct snd_usb_midi_out_endpoint {
spinlock_t buffer_lock;
struct usbmidi_out_port {
- struct snd_usb_midi_out_endpoint* ep;
+ struct snd_usb_midi_out_endpoint *ep;
struct snd_rawmidi_substream *substream;
int active;
uint8_t cable; /* cable number << 4 */
@@ -167,8 +167,8 @@ struct snd_usb_midi_out_endpoint {
};
struct snd_usb_midi_in_endpoint {
- struct snd_usb_midi* umidi;
- struct urb* urbs[INPUT_URBS];
+ struct snd_usb_midi *umidi;
+ struct urb *urbs[INPUT_URBS];
struct usbmidi_in_port {
struct snd_rawmidi_substream *substream;
u8 running_status_length;
@@ -178,7 +178,7 @@ struct snd_usb_midi_in_endpoint {
int current_port;
};
-static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep);
+static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep);
static const uint8_t snd_usbmidi_cin_length[] = {
0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1
@@ -187,7 +187,7 @@ static const uint8_t snd_usbmidi_cin_length[] = {
/*
* Submits the URB, with error handling.
*/
-static int snd_usbmidi_submit_urb(struct urb* urb, gfp_t flags)
+static int snd_usbmidi_submit_urb(struct urb *urb, gfp_t flags)
{
int err = usb_submit_urb(urb, flags);
if (err < 0 && err != -ENODEV)
@@ -221,10 +221,10 @@ static int snd_usbmidi_urb_error(const struct urb *urb)
/*
* Receives a chunk of MIDI data.
*/
-static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint* ep, int portidx,
- uint8_t* data, int length)
+static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint *ep,
+ int portidx, uint8_t *data, int length)
{
- struct usbmidi_in_port* port = &ep->ports[portidx];
+ struct usbmidi_in_port *port = &ep->ports[portidx];
if (!port->substream) {
dev_dbg(&ep->umidi->dev->dev, "unexpected port %d!\n", portidx);
@@ -250,9 +250,9 @@ static void dump_urb(const char *type, const u8 *data, int length)
/*
* Processes the data read from the device.
*/
-static void snd_usbmidi_in_urb_complete(struct urb* urb)
+static void snd_usbmidi_in_urb_complete(struct urb *urb)
{
- struct snd_usb_midi_in_endpoint* ep = urb->context;
+ struct snd_usb_midi_in_endpoint *ep = urb->context;
if (urb->status == 0) {
dump_urb("received", urb->transfer_buffer, urb->actual_length);
@@ -274,10 +274,10 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb)
snd_usbmidi_submit_urb(urb, GFP_ATOMIC);
}
-static void snd_usbmidi_out_urb_complete(struct urb* urb)
+static void snd_usbmidi_out_urb_complete(struct urb *urb)
{
struct out_urb_context *context = urb->context;
- struct snd_usb_midi_out_endpoint* ep = context->ep;
+ struct snd_usb_midi_out_endpoint *ep = context->ep;
unsigned int urb_index;
spin_lock(&ep->buffer_lock);
@@ -304,10 +304,10 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb)
* This is called when some data should be transferred to the device
* (from one or more substreams).
*/
-static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep)
+static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep)
{
unsigned int urb_index;
- struct urb* urb;
+ struct urb *urb;
unsigned long flags;
spin_lock_irqsave(&ep->buffer_lock, flags);
@@ -343,7 +343,8 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep)
static void snd_usbmidi_out_tasklet(unsigned long data)
{
- struct snd_usb_midi_out_endpoint* ep = (struct snd_usb_midi_out_endpoint *) data;
+ struct snd_usb_midi_out_endpoint *ep =
+ (struct snd_usb_midi_out_endpoint *) data;
snd_usbmidi_do_output(ep);
}
@@ -375,7 +376,7 @@ static void snd_usbmidi_error_timer(unsigned long data)
}
/* helper function to send static data that may not DMA-able */
-static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep,
+static int send_bulk_static_data(struct snd_usb_midi_out_endpoint *ep,
const void *data, int len)
{
int err = 0;
@@ -396,8 +397,8 @@ static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep,
* fourth byte in each packet, and uses length instead of CIN.
*/
-static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint* ep,
- uint8_t* buffer, int buffer_length)
+static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint *ep,
+ uint8_t *buffer, int buffer_length)
{
int i;
@@ -405,12 +406,13 @@ static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint* ep,
if (buffer[i] != 0) {
int cable = buffer[i] >> 4;
int length = snd_usbmidi_cin_length[buffer[i] & 0x0f];
- snd_usbmidi_input_data(ep, cable, &buffer[i + 1], length);
+ snd_usbmidi_input_data(ep, cable, &buffer[i + 1],
+ length);
}
}
-static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint* ep,
- uint8_t* buffer, int buffer_length)
+static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint *ep,
+ uint8_t *buffer, int buffer_length)
{
int i;
@@ -427,8 +429,8 @@ static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint* ep,
* the data bytes but not the status byte and that is marked with CIN 4.
*/
static void snd_usbmidi_maudio_broken_running_status_input(
- struct snd_usb_midi_in_endpoint* ep,
- uint8_t* buffer, int buffer_length)
+ struct snd_usb_midi_in_endpoint *ep,
+ uint8_t *buffer, int buffer_length)
{
int i;
@@ -458,7 +460,8 @@ static void snd_usbmidi_maudio_broken_running_status_input(
* doesn't use this format.)
*/
port->running_status_length = 0;
- snd_usbmidi_input_data(ep, cable, &buffer[i + 1], length);
+ snd_usbmidi_input_data(ep, cable, &buffer[i + 1],
+ length);
}
}
@@ -479,11 +482,13 @@ static void snd_usbmidi_cme_input(struct snd_usb_midi_in_endpoint *ep,
/*
* Adds one USB MIDI packet to the output buffer.
*/
-static void snd_usbmidi_output_standard_packet(struct urb* urb, uint8_t p0,
- uint8_t p1, uint8_t p2, uint8_t p3)
+static void snd_usbmidi_output_standard_packet(struct urb *urb, uint8_t p0,
+ uint8_t p1, uint8_t p2,
+ uint8_t p3)
{
- uint8_t* buf = (uint8_t*)urb->transfer_buffer + urb->transfer_buffer_length;
+ uint8_t *buf =
+ (uint8_t *)urb->transfer_buffer + urb->transfer_buffer_length;
buf[0] = p0;
buf[1] = p1;
buf[2] = p2;
@@ -494,11 +499,13 @@ static void snd_usbmidi_output_standard_packet(struct urb* urb, uint8_t p0,
/*
* Adds one Midiman packet to the output buffer.
*/
-static void snd_usbmidi_output_midiman_packet(struct urb* urb, uint8_t p0,
- uint8_t p1, uint8_t p2, uint8_t p3)
+static void snd_usbmidi_output_midiman_packet(struct urb *urb, uint8_t p0,
+ uint8_t p1, uint8_t p2,
+ uint8_t p3)
{
- uint8_t* buf = (uint8_t*)urb->transfer_buffer + urb->transfer_buffer_length;
+ uint8_t *buf =
+ (uint8_t *)urb->transfer_buffer + urb->transfer_buffer_length;
buf[0] = p1;
buf[1] = p2;
buf[2] = p3;
@@ -509,8 +516,8 @@ static void snd_usbmidi_output_midiman_packet(struct urb* urb, uint8_t p0,
/*
* Converts MIDI commands to USB MIDI packets.
*/
-static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port,
- uint8_t b, struct urb* urb)
+static void snd_usbmidi_transmit_byte(struct usbmidi_out_port *port,
+ uint8_t b, struct urb *urb)
{
uint8_t p0 = port->cable;
void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t) =
@@ -547,10 +554,12 @@ static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port,
output_packet(urb, p0 | 0x05, 0xf7, 0, 0);
break;
case STATE_SYSEX_1:
- output_packet(urb, p0 | 0x06, port->data[0], 0xf7, 0);
+ output_packet(urb, p0 | 0x06, port->data[0],
+ 0xf7, 0);
break;
case STATE_SYSEX_2:
- output_packet(urb, p0 | 0x07, port->data[0], port->data[1], 0xf7);
+ output_packet(urb, p0 | 0x07, port->data[0],
+ port->data[1], 0xf7);
break;
}
port->state = STATE_UNKNOWN;
@@ -596,21 +605,22 @@ static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port,
port->state = STATE_SYSEX_2;
break;
case STATE_SYSEX_2:
- output_packet(urb, p0 | 0x04, port->data[0], port->data[1], b);
+ output_packet(urb, p0 | 0x04, port->data[0],
+ port->data[1], b);
port->state = STATE_SYSEX_0;
break;
}
}
}
-static void snd_usbmidi_standard_output(struct snd_usb_midi_out_endpoint* ep,
+static void snd_usbmidi_standard_output(struct snd_usb_midi_out_endpoint *ep,
struct urb *urb)
{
int p;
/* FIXME: lower-numbered ports can starve higher-numbered ports */
for (p = 0; p < 0x10; ++p) {
- struct usbmidi_out_port* port = &ep->ports[p];
+ struct usbmidi_out_port *port = &ep->ports[p];
if (!port->active)
continue;
while (urb->transfer_buffer_length + 3 < ep->max_transfer) {
@@ -753,18 +763,18 @@ static struct usb_protocol_ops snd_usbmidi_akai_ops = {
* at the third byte.
*/
-static void snd_usbmidi_novation_input(struct snd_usb_midi_in_endpoint* ep,
- uint8_t* buffer, int buffer_length)
+static void snd_usbmidi_novation_input(struct snd_usb_midi_in_endpoint *ep,
+ uint8_t *buffer, int buffer_length)
{
if (buffer_length < 2 || !buffer[0] || buffer_length < buffer[0] + 1)
return;
snd_usbmidi_input_data(ep, 0, &buffer[2], buffer[0] - 1);
}
-static void snd_usbmidi_novation_output(struct snd_usb_midi_out_endpoint* ep,
+static void snd_usbmidi_novation_output(struct snd_usb_midi_out_endpoint *ep,
struct urb *urb)
{
- uint8_t* transfer_buffer;
+ uint8_t *transfer_buffer;
int count;
if (!ep->ports[0].active)
@@ -791,13 +801,13 @@ static struct usb_protocol_ops snd_usbmidi_novation_ops = {
* "raw" protocol: just move raw MIDI bytes from/to the endpoint
*/
-static void snd_usbmidi_raw_input(struct snd_usb_midi_in_endpoint* ep,
- uint8_t* buffer, int buffer_length)
+static void snd_usbmidi_raw_input(struct snd_usb_midi_in_endpoint *ep,
+ uint8_t *buffer, int buffer_length)
{
snd_usbmidi_input_data(ep, 0, buffer, buffer_length);
}
-static void snd_usbmidi_raw_output(struct snd_usb_midi_out_endpoint* ep,
+static void snd_usbmidi_raw_output(struct snd_usb_midi_out_endpoint *ep,
struct urb *urb)
{
int count;
@@ -823,8 +833,8 @@ static struct usb_protocol_ops snd_usbmidi_raw_ops = {
* FTDI protocol: raw MIDI bytes, but input packets have two modem status bytes.
*/
-static void snd_usbmidi_ftdi_input(struct snd_usb_midi_in_endpoint* ep,
- uint8_t* buffer, int buffer_length)
+static void snd_usbmidi_ftdi_input(struct snd_usb_midi_in_endpoint *ep,
+ uint8_t *buffer, int buffer_length)
{
if (buffer_length > 2)
snd_usbmidi_input_data(ep, 0, buffer + 2, buffer_length - 2);
@@ -883,7 +893,7 @@ static struct usb_protocol_ops snd_usbmidi_122l_ops = {
* Emagic USB MIDI protocol: raw MIDI with "F5 xx" port switching.
*/
-static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint* ep)
+static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint *ep)
{
static const u8 init_data[] = {
/* initialization magic: "get version" */
@@ -900,7 +910,7 @@ static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint* ep)
send_bulk_static_data(ep, init_data, sizeof(init_data));
}
-static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint* ep)
+static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint *ep)
{
static const u8 finish_data[] = {
/* switch to patch mode with last preset */
@@ -916,8 +926,8 @@ static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint* ep)
send_bulk_static_data(ep, finish_data, sizeof(finish_data));
}
-static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint* ep,
- uint8_t* buffer, int buffer_length)
+static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint *ep,
+ uint8_t *buffer, int buffer_length)
{
int i;
@@ -960,18 +970,18 @@ static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint* ep,
}
}
-static void snd_usbmidi_emagic_output(struct snd_usb_midi_out_endpoint* ep,
+static void snd_usbmidi_emagic_output(struct snd_usb_midi_out_endpoint *ep,
struct urb *urb)
{
int port0 = ep->current_port;
- uint8_t* buf = urb->transfer_buffer;
+ uint8_t *buf = urb->transfer_buffer;
int buf_free = ep->max_transfer;
int length, i;
for (i = 0; i < 0x10; ++i) {
/* round-robin, starting at the last current port */
int portnum = (port0 + i) & 15;
- struct usbmidi_out_port* port = &ep->ports[portnum];
+ struct usbmidi_out_port *port = &ep->ports[portnum];
if (!port->active)
continue;
@@ -1015,7 +1025,7 @@ static struct usb_protocol_ops snd_usbmidi_emagic_ops = {
};
-static void update_roland_altsetting(struct snd_usb_midi* umidi)
+static void update_roland_altsetting(struct snd_usb_midi *umidi)
{
struct usb_interface *intf;
struct usb_host_interface *hostif;
@@ -1037,7 +1047,7 @@ static void update_roland_altsetting(struct snd_usb_midi* umidi)
static int substream_open(struct snd_rawmidi_substream *substream, int dir,
int open)
{
- struct snd_usb_midi* umidi = substream->rmidi->private_data;
+ struct snd_usb_midi *umidi = substream->rmidi->private_data;
struct snd_kcontrol *ctl;
down_read(&umidi->disc_rwsem);
@@ -1051,7 +1061,8 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
if (!umidi->opened[0] && !umidi->opened[1]) {
if (umidi->roland_load_ctl) {
ctl = umidi->roland_load_ctl;
- ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+ ctl->vd[0].access |=
+ SNDRV_CTL_ELEM_ACCESS_INACTIVE;
snd_ctl_notify(umidi->card,
SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
update_roland_altsetting(umidi);
@@ -1067,7 +1078,8 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
if (!umidi->opened[0] && !umidi->opened[1]) {
if (umidi->roland_load_ctl) {
ctl = umidi->roland_load_ctl;
- ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+ ctl->vd[0].access &=
+ ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
snd_ctl_notify(umidi->card,
SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
}
@@ -1080,8 +1092,8 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
{
- struct snd_usb_midi* umidi = substream->rmidi->private_data;
- struct usbmidi_out_port* port = NULL;
+ struct snd_usb_midi *umidi = substream->rmidi->private_data;
+ struct usbmidi_out_port *port = NULL;
int i, j;
for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i)
@@ -1106,9 +1118,11 @@ static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream)
return substream_open(substream, 0, 0);
}
-static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, int up)
+static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream,
+ int up)
{
- struct usbmidi_out_port* port = (struct usbmidi_out_port*)substream->runtime->private_data;
+ struct usbmidi_out_port *port =
+ (struct usbmidi_out_port *)substream->runtime->private_data;
port->active = up;
if (up) {
@@ -1125,7 +1139,7 @@ static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream,
static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream)
{
- struct usbmidi_out_port* port = substream->runtime->private_data;
+ struct usbmidi_out_port *port = substream->runtime->private_data;
struct snd_usb_midi_out_endpoint *ep = port->ep;
unsigned int drain_urbs;
DEFINE_WAIT(wait);
@@ -1164,9 +1178,10 @@ static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream)
return substream_open(substream, 1, 0);
}
-static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
+static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream,
+ int up)
{
- struct snd_usb_midi* umidi = substream->rmidi->private_data;
+ struct snd_usb_midi *umidi = substream->rmidi->private_data;
if (up)
set_bit(substream->number, &umidi->input_triggered);
@@ -1199,7 +1214,7 @@ static void free_urb_and_buffer(struct snd_usb_midi *umidi, struct urb *urb,
* Frees an input endpoint.
* May be called when ep hasn't been initialized completely.
*/
-static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint* ep)
+static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint *ep)
{
unsigned int i;
@@ -1213,12 +1228,12 @@ static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint* ep)
/*
* Creates an input endpoint.
*/
-static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* ep_info,
- struct snd_usb_midi_endpoint* rep)
+static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *ep_info,
+ struct snd_usb_midi_endpoint *rep)
{
- struct snd_usb_midi_in_endpoint* ep;
- void* buffer;
+ struct snd_usb_midi_in_endpoint *ep;
+ void *buffer;
unsigned int pipe;
int length;
unsigned int i;
@@ -1289,14 +1304,14 @@ static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint *ep
/*
* Creates an output endpoint, and initializes output ports.
*/
-static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* ep_info,
- struct snd_usb_midi_endpoint* rep)
+static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *ep_info,
+ struct snd_usb_midi_endpoint *rep)
{
- struct snd_usb_midi_out_endpoint* ep;
+ struct snd_usb_midi_out_endpoint *ep;
unsigned int i;
unsigned int pipe;
- void* buffer;
+ void *buffer;
rep->out = NULL;
ep = kzalloc(sizeof(*ep), GFP_KERNEL);
@@ -1381,12 +1396,12 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
/*
* Frees everything.
*/
-static void snd_usbmidi_free(struct snd_usb_midi* umidi)
+static void snd_usbmidi_free(struct snd_usb_midi *umidi)
{
int i;
for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
- struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
+ struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i];
if (ep->out)
snd_usbmidi_out_endpoint_delete(ep->out);
if (ep->in)
@@ -1399,9 +1414,9 @@ static void snd_usbmidi_free(struct snd_usb_midi* umidi)
/*
* Unlinks all URBs (must be done before the usb_device is deleted).
*/
-void snd_usbmidi_disconnect(struct list_head* p)
+void snd_usbmidi_disconnect(struct list_head *p)
{
- struct snd_usb_midi* umidi;
+ struct snd_usb_midi *umidi;
unsigned int i, j;
umidi = list_entry(p, struct snd_usb_midi, list);
@@ -1417,7 +1432,7 @@ void snd_usbmidi_disconnect(struct list_head* p)
up_write(&umidi->disc_rwsem);
for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
- struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
+ struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i];
if (ep->out)
tasklet_kill(&ep->out->tasklet);
if (ep->out) {
@@ -1448,16 +1463,18 @@ EXPORT_SYMBOL(snd_usbmidi_disconnect);
static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi)
{
- struct snd_usb_midi* umidi = rmidi->private_data;
+ struct snd_usb_midi *umidi = rmidi->private_data;
snd_usbmidi_free(umidi);
}
-static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi,
- int stream, int number)
+static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi *umidi,
+ int stream,
+ int number)
{
struct snd_rawmidi_substream *substream;
- list_for_each_entry(substream, &umidi->rmidi->streams[stream].substreams, list) {
+ list_for_each_entry(substream, &umidi->rmidi->streams[stream].substreams,
+ list) {
if (substream->number == number)
return substream;
}
@@ -1633,7 +1650,7 @@ static struct port_info {
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER),
};
-static struct port_info *find_port_info(struct snd_usb_midi* umidi, int number)
+static struct port_info *find_port_info(struct snd_usb_midi *umidi, int number)
{
int i;
@@ -1659,16 +1676,18 @@ static void snd_usbmidi_get_port_info(struct snd_rawmidi *rmidi, int number,
}
}
-static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi,
+static void snd_usbmidi_init_substream(struct snd_usb_midi *umidi,
int stream, int number,
- struct snd_rawmidi_substream ** rsubstream)
+ struct snd_rawmidi_substream **rsubstream)
{
struct port_info *port_info;
const char *name_format;
- struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number);
+ struct snd_rawmidi_substream *substream =
+ snd_usbmidi_find_substream(umidi, stream, number);
if (!substream) {
- dev_err(&umidi->dev->dev, "substream %d:%d not found\n", stream, number);
+ dev_err(&umidi->dev->dev, "substream %d:%d not found\n", stream,
+ number);
return;
}
@@ -1684,21 +1703,23 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi,
/*
* Creates the endpoints and their ports.
*/
-static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* endpoints)
+static int snd_usbmidi_create_endpoints(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *endpoints)
{
int i, j, err;
int out_ports = 0, in_ports = 0;
for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
if (endpoints[i].out_cables) {
- err = snd_usbmidi_out_endpoint_create(umidi, &endpoints[i],
+ err = snd_usbmidi_out_endpoint_create(umidi,
+ &endpoints[i],
&umidi->endpoints[i]);
if (err < 0)
return err;
}
if (endpoints[i].in_cables) {
- err = snd_usbmidi_in_endpoint_create(umidi, &endpoints[i],
+ err = snd_usbmidi_in_endpoint_create(umidi,
+ &endpoints[i],
&umidi->endpoints[i]);
if (err < 0)
return err;
@@ -1706,12 +1727,16 @@ static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi,
for (j = 0; j < 0x10; ++j) {
if (endpoints[i].out_cables & (1 << j)) {
- snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_OUTPUT, out_ports,
+ snd_usbmidi_init_substream(umidi,
+ SNDRV_RAWMIDI_STREAM_OUTPUT,
+ out_ports,
&umidi->endpoints[i].out->ports[j].substream);
++out_ports;
}
if (endpoints[i].in_cables & (1 << j)) {
- snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_INPUT, in_ports,
+ snd_usbmidi_init_substream(umidi,
+ SNDRV_RAWMIDI_STREAM_INPUT,
+ in_ports,
&umidi->endpoints[i].in->ports[j].substream);
++in_ports;
}
@@ -1725,16 +1750,16 @@ static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi,
/*
* Returns MIDIStreaming device capabilities.
*/
-static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* endpoints)
+static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *endpoints)
{
- struct usb_interface* intf;
+ struct usb_interface *intf;
struct usb_host_interface *hostif;
- struct usb_interface_descriptor* intfd;
- struct usb_ms_header_descriptor* ms_header;
+ struct usb_interface_descriptor *intfd;
+ struct usb_ms_header_descriptor *ms_header;
struct usb_host_endpoint *hostep;
- struct usb_endpoint_descriptor* ep;
- struct usb_ms_endpoint_descriptor* ms_ep;
+ struct usb_endpoint_descriptor *ep;
+ struct usb_ms_endpoint_descriptor *ms_ep;
int i, epidx;
intf = umidi->iface;
@@ -1742,7 +1767,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
return -ENXIO;
hostif = &intf->altsetting[0];
intfd = get_iface_desc(hostif);
- ms_header = (struct usb_ms_header_descriptor*)hostif->extra;
+ ms_header = (struct usb_ms_header_descriptor *)hostif->extra;
if (hostif->extralen >= 7 &&
ms_header->bLength >= 7 &&
ms_header->bDescriptorType == USB_DT_CS_INTERFACE &&
@@ -1759,7 +1784,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
ep = get_ep_desc(hostep);
if (!usb_endpoint_xfer_bulk(ep) && !usb_endpoint_xfer_int(ep))
continue;
- ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra;
+ ms_ep = (struct usb_ms_endpoint_descriptor *)hostep->extra;
if (hostep->extralen < 4 ||
ms_ep->bLength < 4 ||
ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT ||
@@ -1783,9 +1808,10 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
* ESI MIDI Mate that try to use them anyway.
*/
endpoints[epidx].out_interval = 1;
- endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1;
+ endpoints[epidx].out_cables =
+ (1 << ms_ep->bNumEmbMIDIJack) - 1;
dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n",
- ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
+ ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
} else {
if (endpoints[epidx].in_ep) {
if (++epidx >= MIDI_MAX_ENDPOINTS) {
@@ -1799,9 +1825,10 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
endpoints[epidx].in_interval = ep->bInterval;
else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW)
endpoints[epidx].in_interval = 1;
- endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1;
+ endpoints[epidx].in_cables =
+ (1 << ms_ep->bNumEmbMIDIJack) - 1;
dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n",
- ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
+ ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
}
}
return 0;
@@ -1825,7 +1852,7 @@ static int roland_load_get(struct snd_kcontrol *kcontrol,
static int roland_load_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
{
- struct snd_usb_midi* umidi = kcontrol->private_data;
+ struct snd_usb_midi *umidi = kcontrol->private_data;
int changed;
if (value->value.enumerated.item[0] > 1)
@@ -1851,11 +1878,11 @@ static struct snd_kcontrol_new roland_load_ctl = {
* On Roland devices, use the second alternate setting to be able to use
* the interrupt input endpoint.
*/
-static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi)
+static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi *umidi)
{
- struct usb_interface* intf;
+ struct usb_interface *intf;
struct usb_host_interface *hostif;
- struct usb_interface_descriptor* intfd;
+ struct usb_interface_descriptor *intfd;
intf = umidi->iface;
if (!intf || intf->num_altsetting != 2)
@@ -1864,8 +1891,10 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi)
hostif = &intf->altsetting[1];
intfd = get_iface_desc(hostif);
if (intfd->bNumEndpoints != 2 ||
- (get_endpoint(hostif, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK ||
- (get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
+ (get_endpoint(hostif, 0)->bmAttributes &
+ USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK ||
+ (get_endpoint(hostif, 1)->bmAttributes &
+ USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
return;
dev_dbg(&umidi->dev->dev, "switching to altsetting %d with int ep\n",
@@ -1881,14 +1910,14 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi)
/*
* Try to find any usable endpoints in the interface.
*/
-static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* endpoint,
+static int snd_usbmidi_detect_endpoints(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *endpoint,
int max_endpoints)
{
- struct usb_interface* intf;
+ struct usb_interface *intf;
struct usb_host_interface *hostif;
- struct usb_interface_descriptor* intfd;
- struct usb_endpoint_descriptor* epd;
+ struct usb_interface_descriptor *intfd;
+ struct usb_endpoint_descriptor *epd;
int i, out_eps = 0, in_eps = 0;
if (USB_ID_VENDOR(umidi->usb_id) == 0x0582)
@@ -1929,8 +1958,8 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi,
/*
* Detects the endpoints for one-port-per-endpoint protocols.
*/
-static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* endpoints)
+static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *endpoints)
{
int err, i;
@@ -1947,13 +1976,13 @@ static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi* umidi,
/*
* Detects the endpoints and ports of Yamaha devices.
*/
-static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* endpoint)
+static int snd_usbmidi_detect_yamaha(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *endpoint)
{
- struct usb_interface* intf;
+ struct usb_interface *intf;
struct usb_host_interface *hostif;
- struct usb_interface_descriptor* intfd;
- uint8_t* cs_desc;
+ struct usb_interface_descriptor *intfd;
+ uint8_t *cs_desc;
intf = umidi->iface;
if (!intf)
@@ -1972,9 +2001,11 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi,
cs_desc += cs_desc[0]) {
if (cs_desc[1] == USB_DT_CS_INTERFACE) {
if (cs_desc[2] == UAC_MIDI_IN_JACK)
- endpoint->in_cables = (endpoint->in_cables << 1) | 1;
+ endpoint->in_cables =
+ (endpoint->in_cables << 1) | 1;
else if (cs_desc[2] == UAC_MIDI_OUT_JACK)
- endpoint->out_cables = (endpoint->out_cables << 1) | 1;
+ endpoint->out_cables =
+ (endpoint->out_cables << 1) | 1;
}
}
if (!endpoint->in_cables && !endpoint->out_cables)
@@ -1986,12 +2017,12 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi,
/*
* Detects the endpoints and ports of Roland devices.
*/
-static int snd_usbmidi_detect_roland(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* endpoint)
+static int snd_usbmidi_detect_roland(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *endpoint)
{
- struct usb_interface* intf;
+ struct usb_interface *intf;
struct usb_host_interface *hostif;
- u8* cs_desc;
+ u8 *cs_desc;
intf = umidi->iface;
if (!intf)
@@ -2024,14 +2055,14 @@ static int snd_usbmidi_detect_roland(struct snd_usb_midi* umidi,
/*
* Creates the endpoints and their ports for Midiman devices.
*/
-static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
- struct snd_usb_midi_endpoint_info* endpoint)
+static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *endpoint)
{
struct snd_usb_midi_endpoint_info ep_info;
- struct usb_interface* intf;
+ struct usb_interface *intf;
struct usb_host_interface *hostif;
- struct usb_interface_descriptor* intfd;
- struct usb_endpoint_descriptor* epd;
+ struct usb_interface_descriptor *intfd;
+ struct usb_endpoint_descriptor *epd;
int cable, err;
intf = umidi->iface;
@@ -2068,39 +2099,50 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
epd = get_endpoint(hostif, 4);
if (!usb_endpoint_dir_out(epd) ||
!usb_endpoint_xfer_bulk(epd)) {
- dev_dbg(&umidi->dev->dev, "endpoint[4] isn't bulk output\n");
+ dev_dbg(&umidi->dev->dev,
+ "endpoint[4] isn't bulk output\n");
return -ENXIO;
}
}
- ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+ ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress &
+ USB_ENDPOINT_NUMBER_MASK;
ep_info.out_interval = 0;
ep_info.out_cables = endpoint->out_cables & 0x5555;
- err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]);
+ err = snd_usbmidi_out_endpoint_create(umidi, &ep_info,
+ &umidi->endpoints[0]);
if (err < 0)
return err;
- ep_info.in_ep = get_endpoint(hostif, 0)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+ ep_info.in_ep = get_endpoint(hostif, 0)->bEndpointAddress &
+ USB_ENDPOINT_NUMBER_MASK;
ep_info.in_interval = get_endpoint(hostif, 0)->bInterval;
ep_info.in_cables = endpoint->in_cables;
- err = snd_usbmidi_in_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]);
+ err = snd_usbmidi_in_endpoint_create(umidi, &ep_info,
+ &umidi->endpoints[0]);
if (err < 0)
return err;
if (endpoint->out_cables > 0x0001) {
- ep_info.out_ep = get_endpoint(hostif, 4)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+ ep_info.out_ep = get_endpoint(hostif, 4)->bEndpointAddress &
+ USB_ENDPOINT_NUMBER_MASK;
ep_info.out_cables = endpoint->out_cables & 0xaaaa;
- err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[1]);
+ err = snd_usbmidi_out_endpoint_create(umidi, &ep_info,
+ &umidi->endpoints[1]);
if (err < 0)
return err;
}
for (cable = 0; cable < 0x10; ++cable) {
if (endpoint->out_cables & (1 << cable))
- snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_OUTPUT, cable,
+ snd_usbmidi_init_substream(umidi,
+ SNDRV_RAWMIDI_STREAM_OUTPUT,
+ cable,
&umidi->endpoints[cable & 1].out->ports[cable].substream);
if (endpoint->in_cables & (1 << cable))
- snd_usbmidi_init_substream(umidi, SNDRV_RAWMIDI_STREAM_INPUT, cable,
+ snd_usbmidi_init_substream(umidi,
+ SNDRV_RAWMIDI_STREAM_INPUT,
+ cable,
&umidi->endpoints[0].in->ports[cable].substream);
}
return 0;
@@ -2110,7 +2152,7 @@ static struct snd_rawmidi_global_ops snd_usbmidi_ops = {
.get_port_info = snd_usbmidi_get_port_info,
};
-static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi,
+static int snd_usbmidi_create_rawmidi(struct snd_usb_midi *umidi,
int out_ports, int in_ports)
{
struct snd_rawmidi *rmidi;
@@ -2128,8 +2170,10 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi,
rmidi->ops = &snd_usbmidi_ops;
rmidi->private_data = umidi;
rmidi->private_free = snd_usbmidi_rawmidi_free;
- snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_usbmidi_output_ops);
- snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_usbmidi_input_ops);
+ snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
+ &snd_usbmidi_output_ops);
+ snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
+ &snd_usbmidi_input_ops);
umidi->rmidi = rmidi;
return 0;
@@ -2138,16 +2182,16 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi,
/*
* Temporarily stop input.
*/
-void snd_usbmidi_input_stop(struct list_head* p)
+void snd_usbmidi_input_stop(struct list_head *p)
{
- struct snd_usb_midi* umidi;
+ struct snd_usb_midi *umidi;
unsigned int i, j;
umidi = list_entry(p, struct snd_usb_midi, list);
if (!umidi->input_running)
return;
for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
- struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
+ struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i];
if (ep->in)
for (j = 0; j < INPUT_URBS; ++j)
usb_kill_urb(ep->in->urbs[j]);
@@ -2156,14 +2200,14 @@ void snd_usbmidi_input_stop(struct list_head* p)
}
EXPORT_SYMBOL(snd_usbmidi_input_stop);
-static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep)
+static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint *ep)
{
unsigned int i;
if (!ep)
return;
for (i = 0; i < INPUT_URBS; ++i) {
- struct urb* urb = ep->urbs[i];
+ struct urb *urb = ep->urbs[i];
urb->dev = ep->umidi->dev;
snd_usbmidi_submit_urb(urb, GFP_KERNEL);
}
@@ -2172,9 +2216,9 @@ static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep)
/*
* Resume input after a call to snd_usbmidi_input_stop().
*/
-void snd_usbmidi_input_start(struct list_head* p)
+void snd_usbmidi_input_start(struct list_head *p)
{
- struct snd_usb_midi* umidi;
+ struct snd_usb_midi *umidi;
int i;
umidi = list_entry(p, struct snd_usb_midi, list);
@@ -2218,11 +2262,11 @@ EXPORT_SYMBOL(snd_usbmidi_resume);
* Creates and registers everything needed for a MIDI streaming interface.
*/
int snd_usbmidi_create(struct snd_card *card,
- struct usb_interface* iface,
+ struct usb_interface *iface,
struct list_head *midi_list,
- const struct snd_usb_audio_quirk* quirk)
+ const struct snd_usb_audio_quirk *quirk)
{
- struct snd_usb_midi* umidi;
+ struct snd_usb_midi *umidi;
struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS];
int out_ports, in_ports;
int i, err;
@@ -2320,7 +2364,8 @@ int snd_usbmidi_create(struct snd_card *card,
err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
break;
default:
- dev_err(&umidi->dev->dev, "invalid quirk type %d\n", quirk->type);
+ dev_err(&umidi->dev->dev, "invalid quirk type %d\n",
+ quirk->type);
err = -ENXIO;
break;
}
diff --git a/sound/usb/midi.h b/sound/usb/midi.h
index 46e5b65e81e..ad8a3211f8e 100644
--- a/sound/usb/midi.h
+++ b/sound/usb/midi.h
@@ -43,8 +43,8 @@ int snd_usbmidi_create(struct snd_card *card,
struct usb_interface *iface,
struct list_head *midi_list,
const struct snd_usb_audio_quirk *quirk);
-void snd_usbmidi_input_stop(struct list_head* p);
-void snd_usbmidi_input_start(struct list_head* p);
+void snd_usbmidi_input_stop(struct list_head *p);
+void snd_usbmidi_input_start(struct list_head *p);
void snd_usbmidi_disconnect(struct list_head *p);
void snd_usbmidi_suspend(struct list_head *p);
void snd_usbmidi_resume(struct list_head *p);