Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce9b490c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Staging: line6: fix checkpatch errors in midibuf.c



Lots of warnings also fixed up.

Cc: Markus Grabner <grabner@icg.tugraz.at>
Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d7e37336
Loading
Loading
Loading
Loading
+51 −55
Original line number Diff line number Diff line
@@ -23,13 +23,14 @@ static int midibuf_message_length(unsigned char code)
	else if (code < 0xf0) {
		static const int length[] = { 3, 3, 3, 3, 2, 2, 3 };
		return length[(code >> 4) - 8];
	}
	else {
	} else {
		/*
			Note that according to the MIDI specification 0xf2 is the "Song Position
			Pointer", but this is used by Line6 to send sysex messages to the host.
			Note that according to the MIDI specification 0xf2 is
			the "Song Position Pointer", but this is used by Line6
			to send sysex messages to the host.
		*/
		static const int length[] = { -1, 2, -1, 2, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1 };
		static const int length[] = { -1, 2, -1, 2, -1, -1, 1, 1, 1, 1,
					       1, 1, 1, -1, 1, 1 };
		return length[code & 0x0f];
	}
}
@@ -42,7 +43,7 @@ void midibuf_reset(struct MidiBuffer *this)

int midibuf_init(struct MidiBuffer *this, int size, int split)
{
	this->buf = (unsigned char *)kmalloc(size, GFP_KERNEL);
	this->buf = kmalloc(size, GFP_KERNEL);

	if (this->buf == NULL)
		return -ENOMEM;
@@ -55,8 +56,9 @@ int midibuf_init(struct MidiBuffer *this, int size, int split)

void midibuf_status(struct MidiBuffer *this)
{
	printk("midibuf size=%d split=%d pos_read=%d pos_write=%d full=%d command_prev=%02x\n",
				 this->size, this->split, this->pos_read, this->pos_write, this->full, this->command_prev);
	printk(KERN_DEBUG "midibuf size=%d split=%d pos_read=%d pos_write=%d "
	       "full=%d command_prev=%02x\n", this->size, this->split,
	       this->pos_read, this->pos_write, this->full, this->command_prev);
}

static int midibuf_is_empty(struct MidiBuffer *this)
@@ -112,8 +114,7 @@ int midibuf_write(struct MidiBuffer *this, unsigned char *data, int length)
			/* no buffer wraparound */
			memcpy(this->buf + this->pos_write, data, length);
			this->pos_write += length;
		}
		else {
		} else {
			/* buffer wraparound */
			length2 = length - length1;
			memcpy(this->buf + this->pos_write, data, length1);
@@ -137,8 +138,9 @@ int midibuf_read(struct MidiBuffer *this, unsigned char *data, int length)
	int repeat = 0;
	int i;

	/* we need to be able to store at least a 3 byte MIDI message */
	if (length < 3)
		return -EINVAL;  /* we need to be able to store at least a 3 byte MIDI message */
		return -EINVAL;

	if (midibuf_is_empty(this))
		return 0;
@@ -156,19 +158,16 @@ int midibuf_read(struct MidiBuffer *this, unsigned char *data, int length)
	if (command & 0x80) {
		midi_length = midibuf_message_length(command);
		this->command_prev = command;
	}
	else {
	} else {
		if (this->command_prev > 0) {
			int midi_length_prev = midibuf_message_length(this->command_prev);

			if (midi_length_prev > 0) {
				midi_length = midi_length_prev - 1;
				repeat = 1;
			}
			else
			} else
				midi_length = -1;
		}
		else
		} else
			midi_length = -1;
	}

@@ -181,8 +180,7 @@ int midibuf_read(struct MidiBuffer *this, unsigned char *data, int length)
					break;

			midi_length = i;
		}
		else {
		} else {
			/* buffer wraparound */
			length2 = length - length1;

@@ -208,8 +206,7 @@ int midibuf_read(struct MidiBuffer *this, unsigned char *data, int length)
	if (midi_length < 0) {
		if (!this->split)
			return 0;  /* command is not yet complete */
	}
	else {
	} else {
		if (length < midi_length)
			return 0;  /* command is not yet complete */

@@ -220,8 +217,7 @@ int midibuf_read(struct MidiBuffer *this, unsigned char *data, int length)
		/* no buffer wraparound */
		memcpy(data + repeat, this->buf + this->pos_read, length);
		this->pos_read += length;
	}
	else {
	} else {
		/* buffer wraparound */
		length2 = length - length1;
		memcpy(data + repeat, this->buf + this->pos_read, length1);