* [PATCH 0/2] staging: line6: clean up MIDI post-processing functions
@ 2013-01-19 10:18 Stefan Hajnoczi
2013-01-19 10:18 ` [PATCH 1/2] staging: line6: clean up line6_pod_process_message() Stefan Hajnoczi
2013-01-19 10:18 ` [PATCH 2/2] staging: line6: clean up line6_variax_process_message() Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-01-19 10:18 UTC (permalink / raw)
To: devel
Cc: Markus Grabner, Greg Kroah-Hartman, line6linux-devel,
linux-kernel, Stefan Hajnoczi
The line6 driver inspects fewer MIDI messages than in previous versions. The
conditionals to match these MIDI messages were left in place. This series
removes unused conditionals in order to make the MIDI post-processing functions
easier to read.
Applies to linux-next/master.
Stefan Hajnoczi (2):
staging: line6: clean up line6_pod_process_message()
staging: line6: clean up line6_variax_process_message()
drivers/staging/line6/pod.c | 96 +++++++++---------------------------------
drivers/staging/line6/variax.c | 14 ------
2 files changed, 19 insertions(+), 91 deletions(-)
--
1.8.0.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] staging: line6: clean up line6_pod_process_message()
2013-01-19 10:18 [PATCH 0/2] staging: line6: clean up MIDI post-processing functions Stefan Hajnoczi
@ 2013-01-19 10:18 ` Stefan Hajnoczi
2013-01-19 10:18 ` [PATCH 2/2] staging: line6: clean up line6_variax_process_message() Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-01-19 10:18 UTC (permalink / raw)
To: devel
Cc: Markus Grabner, Greg Kroah-Hartman, line6linux-devel,
linux-kernel, Stefan Hajnoczi
Previous versions of the line6 driver snooped MIDI traffic in order to
make device state accessible via sysfs attributes. This involved a lot
of logic in line6_pod_process_message() that has since been removed.
Drop unused conditionals in line6_pod_process_message() and reduce the
levels of indentation. Only two MIDI messages are still tracked: the
POD version message on startup and monitor level changes originating
from the device.
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
---
drivers/staging/line6/pod.c | 96 +++++++++------------------------------------
1 file changed, 19 insertions(+), 77 deletions(-)
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index ba6fed4..74898c3 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -135,85 +135,27 @@ void line6_pod_process_message(struct usb_line6_pod *pod)
{
const unsigned char *buf = pod->line6.buffer_message;
- /* filter messages by type */
- switch (buf[0] & 0xf0) {
- case LINE6_PARAM_CHANGE:
- case LINE6_PROGRAM_CHANGE:
- case LINE6_SYSEX_BEGIN:
- break; /* handle these further down */
-
- default:
- return; /* ignore all others */
+ if (memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) {
+ pod->firmware_version = buf[13] * 100 + buf[14] * 10 + buf[15];
+ pod->device_id = ((int)buf[8] << 16) | ((int)buf[9] << 8) |
+ (int) buf[10];
+ pod_startup3(pod);
+ return;
+ }
+
+ /* Only look for sysex messages from this device */
+ if (buf[0] != (LINE6_SYSEX_BEGIN | LINE6_CHANNEL_DEVICE) &&
+ buf[0] != (LINE6_SYSEX_BEGIN | LINE6_CHANNEL_UNKNOWN)) {
+ return;
+ }
+ if (memcmp(buf + 1, line6_midi_id, sizeof(line6_midi_id)) != 0) {
+ return;
}
- /* process all remaining messages */
- switch (buf[0]) {
- case LINE6_PARAM_CHANGE | LINE6_CHANNEL_DEVICE:
- case LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST:
- break;
-
- case LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_DEVICE:
- case LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST:
- break;
-
- case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_DEVICE:
- case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_UNKNOWN:
- if (memcmp(buf + 1, line6_midi_id,
- sizeof(line6_midi_id)) == 0) {
- switch (buf[5]) {
- case POD_SYSEX_DUMP:
- break;
-
- case POD_SYSEX_SYSTEM:{
- short value =
- ((int)buf[7] << 12) | ((int)buf[8]
- << 8) |
- ((int)buf[9] << 4) | (int)buf[10];
-
- if (buf[6] == POD_MONITOR_LEVEL)
- pod->monitor_level = value;
- break;
- }
-
- case POD_SYSEX_FINISH:
- /* do we need to respond to this? */
- break;
-
- case POD_SYSEX_SAVE:
- break;
-
- case POD_SYSEX_STORE:
- dev_dbg(pod->line6.ifcdev,
- "message %02X not yet implemented\n",
- buf[5]);
- break;
-
- default:
- dev_dbg(pod->line6.ifcdev,
- "unknown sysex message %02X\n",
- buf[5]);
- }
- } else
- if (memcmp
- (buf, pod_version_header,
- sizeof(pod_version_header)) == 0) {
- pod->firmware_version =
- buf[13] * 100 + buf[14] * 10 + buf[15];
- pod->device_id =
- ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int)
- buf[10];
- pod_startup3(pod);
- } else
- dev_dbg(pod->line6.ifcdev, "unknown sysex header\n");
-
- break;
-
- case LINE6_SYSEX_END:
- break;
-
- default:
- dev_dbg(pod->line6.ifcdev, "POD: unknown message %02X\n",
- buf[0]);
+ if (buf[5] == POD_SYSEX_SYSTEM && buf[6] == POD_MONITOR_LEVEL) {
+ short value = ((int)buf[7] << 12) | ((int)buf[8] << 8) |
+ ((int)buf[9] << 4) | (int)buf[10];
+ pod->monitor_level = value;
}
}
--
1.8.0.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] staging: line6: clean up line6_variax_process_message()
2013-01-19 10:18 [PATCH 0/2] staging: line6: clean up MIDI post-processing functions Stefan Hajnoczi
2013-01-19 10:18 ` [PATCH 1/2] staging: line6: clean up line6_pod_process_message() Stefan Hajnoczi
@ 2013-01-19 10:18 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-01-19 10:18 UTC (permalink / raw)
To: devel
Cc: Markus Grabner, Greg Kroah-Hartman, line6linux-devel,
linux-kernel, Stefan Hajnoczi
Previous versions of the line6 driver snooped MIDI traffic in order to
make device state accessible via sysfs attributes. This involved a lot
of logic in line6_variax_process_message() that has since been removed.
Drop unused conditionals in line6_variax_process_message().
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
---
drivers/staging/line6/variax.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c
index 4fca58f..bd0f694 100644
--- a/drivers/staging/line6/variax.c
+++ b/drivers/staging/line6/variax.c
@@ -133,13 +133,6 @@ void line6_variax_process_message(struct usb_line6_variax *variax)
const unsigned char *buf = variax->line6.buffer_message;
switch (buf[0]) {
- case LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST:
- break;
-
- case LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_DEVICE:
- case LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST:
- break;
-
case LINE6_RESET:
dev_info(variax->line6.ifcdev, "VARIAX reset\n");
break;
@@ -154,13 +147,6 @@ void line6_variax_process_message(struct usb_line6_variax *variax)
variax_startup4((unsigned long)variax);
}
break;
-
- case LINE6_SYSEX_END:
- break;
-
- default:
- dev_dbg(variax->line6.ifcdev,
- "Variax: unknown message %02X\n", buf[0]);
}
}
--
1.8.0.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-19 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-19 10:18 [PATCH 0/2] staging: line6: clean up MIDI post-processing functions Stefan Hajnoczi
2013-01-19 10:18 ` [PATCH 1/2] staging: line6: clean up line6_pod_process_message() Stefan Hajnoczi
2013-01-19 10:18 ` [PATCH 2/2] staging: line6: clean up line6_variax_process_message() Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®