All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/25] line6usb cleanup
@ 2015-01-10  5:35 Chris Rorvick
  2015-01-10  5:35 ` [PATCH 01/25] staging: line6: Remove `device_bit' from properties Chris Rorvick
                   ` (27 more replies)
  0 siblings, 28 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The line6usb driver references the device's idProduct and, in some
cases, the interface number in a number of places to determine device-
specific configuration values and to call device-specific functionality.
Rework code to leverage the device table matching more effectively.
Consolidate configuration settings into the properties entries and use
function pointers setup at initialization to remove much of the
conditional logic.

I have a TonePort UX2 that I've used for testing, meaning that some of
this is really only compile-tested.

Regards,

Chris

Chris Rorvick (25):
  staging: line6: Remove `device_bit' from properties
  staging: line6: Remove line6_pod_transmit_paramter()
  staging: line6: Remove unsupported X3 devices
  staging: line6: Cleanup device table
  staging: line6: Define a device type enum
  staging: line6: Index properties array with device type
  staging: line6: Key off of device type
  staging: line6: Remove idVendor and idProduct macros
  staging: line6: Remove useless comments
  staging: line6: Rename capability macros
  staging: line6: Use explicit indexes when defining properties
  staging: line6: List out capabilities individually
  staging: line6: Split out PODxt Live interfaces
  staging: line6: Split out POD HD500 interfaces
  staging: line6: Filter on Pocket POD interface
  staging: line6: Filter on UX2 interfaces
  staging: line6: Move altsetting to properties
  staging: line6: Move control endpoints to properties
  staging: line6: Remove stale Pocket POD PCM endpoints
  staging: line6: Move audio endpoints to properties
  staging: line6: Pass *_init() `usb_line6' pointers
  staging: line6: Pass *_process_message() `usb_line6' pointers
  staging: line6: Call *_process_message() via pointer
  staging: line6: Call *_disconnect() via pointer
  staging: line6: Make *_disconnect() functions static

 drivers/staging/line6/capture.c  |   9 +-
 drivers/staging/line6/driver.c   | 698 ++++++++++++++++++---------------------
 drivers/staging/line6/driver.h   |  57 ++--
 drivers/staging/line6/midi.c     |   4 +-
 drivers/staging/line6/pcm.c      |  55 +--
 drivers/staging/line6/pcm.h      |  12 +-
 drivers/staging/line6/playback.c |  11 +-
 drivers/staging/line6/pod.c      |  83 +++--
 drivers/staging/line6/pod.h      |  12 +-
 drivers/staging/line6/podhd.c    |  48 +--
 drivers/staging/line6/podhd.h    |   3 +-
 drivers/staging/line6/toneport.c | 113 ++++---
 drivers/staging/line6/toneport.h |   3 +-
 drivers/staging/line6/usbdefs.h  |  95 +-----
 drivers/staging/line6/variax.c   |  36 +-
 drivers/staging/line6/variax.h   |   4 +-
 16 files changed, 528 insertions(+), 715 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/25] staging: line6: Remove `device_bit' from properties
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 02/25] staging: line6: Remove line6_pod_transmit_paramter() Chris Rorvick
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The `device_bit' member was no longer used as of commit 2807904441d4
(staging: line6: drop MIDI parameter sysfs attrs).

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c  | 44 +++++++++++++++---------------
 drivers/staging/line6/driver.h  |  5 ----
 drivers/staging/line6/pcm.h     |  2 ++
 drivers/staging/line6/usbdefs.h | 59 -----------------------------------------
 4 files changed, 24 insertions(+), 86 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 503b2d7..15f3bc4 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -57,32 +57,32 @@ static const struct usb_device_id line6_id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, line6_id_table);
 
-#define L6PROP(dev_bit, dev_id, dev_name, dev_cap)\
-	{.device_bit = LINE6_BIT_##dev_bit, .id = dev_id,\
+#define L6PROP(dev_id, dev_name, dev_cap)\
+	{.id = dev_id,\
 	 .name = dev_name, .capabilities = LINE6_BIT_##dev_cap}
 
 /* *INDENT-OFF* */
 static const struct line6_properties line6_properties_table[] = {
-	L6PROP(BASSPODXT,     "BassPODxt",     "BassPODxt",        CTRL_PCM_HW),
-	L6PROP(BASSPODXTLIVE, "BassPODxtLive", "BassPODxt Live",   CTRL_PCM_HW),
-	L6PROP(BASSPODXTPRO,  "BassPODxtPro",  "BassPODxt Pro",    CTRL_PCM_HW),
-	L6PROP(GUITARPORT,    "GuitarPort",    "GuitarPort",       PCM),
-	L6PROP(POCKETPOD,     "PocketPOD",     "Pocket POD",       CONTROL),
-	L6PROP(PODHD300,      "PODHD300",      "POD HD300",        CTRL_PCM_HW),
-	L6PROP(PODHD400,      "PODHD400",      "POD HD400",        CTRL_PCM_HW),
-	L6PROP(PODHD500,      "PODHD500",      "POD HD500",        CTRL_PCM_HW),
-	L6PROP(PODSTUDIO_GX,  "PODStudioGX",   "POD Studio GX",    PCM),
-	L6PROP(PODSTUDIO_UX1, "PODStudioUX1",  "POD Studio UX1",   PCM),
-	L6PROP(PODSTUDIO_UX2, "PODStudioUX2",  "POD Studio UX2",   PCM),
-	L6PROP(PODX3,         "PODX3",         "POD X3",           PCM),
-	L6PROP(PODX3LIVE,     "PODX3Live",     "POD X3 Live",      PCM),
-	L6PROP(PODXT,         "PODxt",         "PODxt",            CTRL_PCM_HW),
-	L6PROP(PODXTLIVE,     "PODxtLive",     "PODxt Live",       CTRL_PCM_HW),
-	L6PROP(PODXTPRO,      "PODxtPro",      "PODxt Pro",        CTRL_PCM_HW),
-	L6PROP(TONEPORT_GX,   "TonePortGX",    "TonePort GX",      PCM),
-	L6PROP(TONEPORT_UX1,  "TonePortUX1",   "TonePort UX1",     PCM),
-	L6PROP(TONEPORT_UX2,  "TonePortUX2",   "TonePort UX2",     PCM),
-	L6PROP(VARIAX,        "Variax",        "Variax Workbench", CONTROL),
+	L6PROP("BassPODxt",     "BassPODxt",        CTRL_PCM_HW),
+	L6PROP("BassPODxtLive", "BassPODxt Live",   CTRL_PCM_HW),
+	L6PROP("BassPODxtPro",  "BassPODxt Pro",    CTRL_PCM_HW),
+	L6PROP("GuitarPort",    "GuitarPort",       PCM),
+	L6PROP("PocketPOD",     "Pocket POD",       CONTROL),
+	L6PROP("PODHD300",      "POD HD300",        CTRL_PCM_HW),
+	L6PROP("PODHD400",      "POD HD400",        CTRL_PCM_HW),
+	L6PROP("PODHD500",      "POD HD500",        CTRL_PCM_HW),
+	L6PROP("PODStudioGX",   "POD Studio GX",    PCM),
+	L6PROP("PODStudioUX1",  "POD Studio UX1",   PCM),
+	L6PROP("PODStudioUX2",  "POD Studio UX2",   PCM),
+	L6PROP("PODX3",         "POD X3",           PCM),
+	L6PROP("PODX3Live",     "POD X3 Live",      PCM),
+	L6PROP("PODxt",         "PODxt",            CTRL_PCM_HW),
+	L6PROP("PODxtLive",     "PODxt Live",       CTRL_PCM_HW),
+	L6PROP("PODxtPro",      "PODxt Pro",        CTRL_PCM_HW),
+	L6PROP("TonePortGX",    "TonePort GX",      PCM),
+	L6PROP("TonePortUX1",   "TonePort UX1",     PCM),
+	L6PROP("TonePortUX2",   "TonePort UX2",     PCM),
+	L6PROP("Variax",        "Variax Workbench", CONTROL),
 };
 /* *INDENT-ON* */
 
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index 16e3fc2..1cc7532 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -76,11 +76,6 @@ static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
 */
 struct line6_properties {
 	/**
-		 Bit identifying this device in the line6usb driver.
-	*/
-	int device_bit;
-
-	/**
 		 Card id string (maximum 16 characters).
 		 This can be used to address the device in ALSA programs as
 		 "default:CARD=<id>"
diff --git a/drivers/staging/line6/pcm.h b/drivers/staging/line6/pcm.h
index 6aa0d46..5716f16 100644
--- a/drivers/staging/line6/pcm.h
+++ b/drivers/staging/line6/pcm.h
@@ -98,6 +98,8 @@ enum {
 	LINE6_INDEX_PAUSE_PLAYBACK,
 	LINE6_INDEX_PREPARED,
 
+#define LINE6_BIT(x) LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x
+
 	/* individual bit masks: */
 	LINE6_BIT(PCM_ALSA_PLAYBACK_BUFFER),
 	LINE6_BIT(PCM_ALSA_PLAYBACK_STREAM),
diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h
index 2d1cc47..2bc2fe7 100644
--- a/drivers/staging/line6/usbdefs.h
+++ b/drivers/staging/line6/usbdefs.h
@@ -40,65 +40,6 @@
 #define LINE6_DEVID_TONEPORT_UX2  0x4142
 #define LINE6_DEVID_VARIAX        0x534d
 
-#define LINE6_BIT(x) LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x
-
-enum {
-	LINE6_INDEX_BASSPODXT,
-	LINE6_INDEX_BASSPODXTLIVE,
-	LINE6_INDEX_BASSPODXTPRO,
-	LINE6_INDEX_GUITARPORT,
-	LINE6_INDEX_POCKETPOD,
-	LINE6_INDEX_PODHD300,
-	LINE6_INDEX_PODHD400,
-	LINE6_INDEX_PODHD500,
-	LINE6_INDEX_PODSTUDIO_GX,
-	LINE6_INDEX_PODSTUDIO_UX1,
-	LINE6_INDEX_PODSTUDIO_UX2,
-	LINE6_INDEX_PODX3,
-	LINE6_INDEX_PODX3LIVE,
-	LINE6_INDEX_PODXT,
-	LINE6_INDEX_PODXTLIVE,
-	LINE6_INDEX_PODXTPRO,
-	LINE6_INDEX_TONEPORT_GX,
-	LINE6_INDEX_TONEPORT_UX1,
-	LINE6_INDEX_TONEPORT_UX2,
-	LINE6_INDEX_VARIAX,
-
-	LINE6_BIT(BASSPODXT),
-	LINE6_BIT(BASSPODXTLIVE),
-	LINE6_BIT(BASSPODXTPRO),
-	LINE6_BIT(GUITARPORT),
-	LINE6_BIT(POCKETPOD),
-	LINE6_BIT(PODHD300),
-	LINE6_BIT(PODHD400),
-	LINE6_BIT(PODHD500),
-	LINE6_BIT(PODSTUDIO_GX),
-	LINE6_BIT(PODSTUDIO_UX1),
-	LINE6_BIT(PODSTUDIO_UX2),
-	LINE6_BIT(PODX3),
-	LINE6_BIT(PODX3LIVE),
-	LINE6_BIT(PODXT),
-	LINE6_BIT(PODXTLIVE),
-	LINE6_BIT(PODXTPRO),
-	LINE6_BIT(TONEPORT_GX),
-	LINE6_BIT(TONEPORT_UX1),
-	LINE6_BIT(TONEPORT_UX2),
-	LINE6_BIT(VARIAX),
-
-	LINE6_BITS_PRO = LINE6_BIT_BASSPODXTPRO | LINE6_BIT_PODXTPRO,
-	LINE6_BITS_LIVE = LINE6_BIT_BASSPODXTLIVE | LINE6_BIT_PODXTLIVE |
-			  LINE6_BIT_PODX3LIVE,
-	LINE6_BITS_PODXTALL = LINE6_BIT_PODXT | LINE6_BIT_PODXTLIVE |
-			      LINE6_BIT_PODXTPRO,
-	LINE6_BITS_PODX3ALL = LINE6_BIT_PODX3 | LINE6_BIT_PODX3LIVE,
-	LINE6_BITS_PODHDALL = LINE6_BIT_PODHD300 |
-			      LINE6_BIT_PODHD400 |
-			      LINE6_BIT_PODHD500,
-	LINE6_BITS_BASSPODXTALL	= LINE6_BIT_BASSPODXT |
-				  LINE6_BIT_BASSPODXTLIVE |
-				  LINE6_BIT_BASSPODXTPRO
-};
-
 /* device supports settings parameter via USB */
 #define LINE6_BIT_CONTROL (1 << 0)
 /* device supports PCM input/output via USB */
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/25] staging: line6: Remove line6_pod_transmit_paramter()
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
  2015-01-10  5:35 ` [PATCH 01/25] staging: line6: Remove `device_bit' from properties Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 03/25] staging: line6: Remove unsupported X3 devices Chris Rorvick
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

This function was no longer used as of commit 2807904441d4 (staging:
line6: drop MIDI parameter sysfs attrs).

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/pod.c | 9 ---------
 drivers/staging/line6/pod.h | 2 --
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index 44f4b2f..7b4ec92f 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -159,15 +159,6 @@ void line6_pod_process_message(struct usb_line6_pod *pod)
 }
 
 /*
-	Transmit PODxt Pro control parameter.
-*/
-void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param,
-				  u8 value)
-{
-	line6_transmit_parameter(&pod->line6, param, value);
-}
-
-/*
 	Send system parameter (from integer).
 */
 static int pod_set_system_param_int(struct usb_line6_pod *pod, int value,
diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h
index 3e3f167..397d94c 100644
--- a/drivers/staging/line6/pod.h
+++ b/drivers/staging/line6/pod.h
@@ -96,7 +96,5 @@ extern void line6_pod_disconnect(struct usb_interface *interface);
 extern int line6_pod_init(struct usb_interface *interface,
 			  struct usb_line6_pod *pod);
 extern void line6_pod_process_message(struct usb_line6_pod *pod);
-extern void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param,
-					 u8 value);
 
 #endif
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/25] staging: line6: Remove unsupported X3 devices
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
  2015-01-10  5:35 ` [PATCH 01/25] staging: line6: Remove `device_bit' from properties Chris Rorvick
  2015-01-10  5:35 ` [PATCH 02/25] staging: line6: Remove line6_pod_transmit_paramter() Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 04/25] staging: line6: Cleanup device table Chris Rorvick
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Support for these devices appears to have never been completed.  Remove
them from the device table along with a minimal amount of supporting
code.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c  | 26 --------------------------
 drivers/staging/line6/pcm.c     |  2 --
 drivers/staging/line6/usbdefs.h |  2 --
 3 files changed, 30 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 15f3bc4..e40400b 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -43,8 +43,6 @@ static const struct usb_device_id line6_id_table[] = {
 	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX)},
 	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1)},
 	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE)},
 	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT)},
 	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE)},
 	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO)},
@@ -74,8 +72,6 @@ static const struct line6_properties line6_properties_table[] = {
 	L6PROP("PODStudioGX",   "POD Studio GX",    PCM),
 	L6PROP("PODStudioUX1",  "POD Studio UX1",   PCM),
 	L6PROP("PODStudioUX2",  "POD Studio UX2",   PCM),
-	L6PROP("PODX3",         "POD X3",           PCM),
-	L6PROP("PODX3Live",     "POD X3 Live",      PCM),
 	L6PROP("PODxt",         "PODxt",            CTRL_PCM_HW),
 	L6PROP("PODxtLive",     "PODxt Live",       CTRL_PCM_HW),
 	L6PROP("PODxtPro",      "PODxt Pro",        CTRL_PCM_HW),
@@ -673,8 +669,6 @@ static int line6_probe(struct usb_interface *interface,
 		break;
 
 	case LINE6_DEVID_PODHD500:
-	case LINE6_DEVID_PODX3:
-	case LINE6_DEVID_PODX3LIVE:
 		switch (interface_number) {
 		case 0:
 			alternate = 1;
@@ -765,14 +759,6 @@ static int line6_probe(struct usb_interface *interface,
 		ep_write = 0x02;
 		break;
 
-	case LINE6_DEVID_PODX3:
-	case LINE6_DEVID_PODX3LIVE:
-		/* currently unused! */
-		size = sizeof(struct usb_line6_pod);
-		ep_read = 0x81;
-		ep_write = 0x01;
-		break;
-
 	case LINE6_DEVID_PODSTUDIO_GX:
 	case LINE6_DEVID_PODSTUDIO_UX1:
 	case LINE6_DEVID_PODSTUDIO_UX2:
@@ -898,8 +884,6 @@ static int line6_probe(struct usb_interface *interface,
 	case LINE6_DEVID_BASSPODXTLIVE:
 	case LINE6_DEVID_BASSPODXTPRO:
 	case LINE6_DEVID_POCKETPOD:
-	case LINE6_DEVID_PODX3:
-	case LINE6_DEVID_PODX3LIVE:
 	case LINE6_DEVID_PODXT:
 	case LINE6_DEVID_PODXTPRO:
 		ret = line6_pod_init(interface, (struct usb_line6_pod *)line6);
@@ -971,14 +955,6 @@ static int line6_probe(struct usb_interface *interface,
 	dev_info(&interface->dev, "Line6 %s now attached\n",
 		 line6->properties->name);
 
-	switch (product) {
-	case LINE6_DEVID_PODX3:
-	case LINE6_DEVID_PODX3LIVE:
-		dev_info(&interface->dev,
-			 "NOTE: the Line6 %s is detected, but not yet supported\n",
-			 line6->properties->name);
-	}
-
 	/* increment reference counters: */
 	usb_get_intf(interface);
 	usb_get_dev(usbdev);
@@ -1026,8 +1002,6 @@ static void line6_disconnect(struct usb_interface *interface)
 		case LINE6_DEVID_BASSPODXTLIVE:
 		case LINE6_DEVID_BASSPODXTPRO:
 		case LINE6_DEVID_POCKETPOD:
-		case LINE6_DEVID_PODX3:
-		case LINE6_DEVID_PODX3LIVE:
 		case LINE6_DEVID_PODXT:
 		case LINE6_DEVID_PODXTPRO:
 			line6_pod_disconnect(interface);
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index a3136b1..076c87b 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -442,8 +442,6 @@ int line6_init_pcm(struct usb_line6 *line6,
 		break;
 
 	case LINE6_DEVID_PODHD500:
-	case LINE6_DEVID_PODX3:
-	case LINE6_DEVID_PODX3LIVE:
 		ep_read = 0x86;
 		ep_write = 0x02;
 		break;
diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h
index 2bc2fe7..06bf909 100644
--- a/drivers/staging/line6/usbdefs.h
+++ b/drivers/staging/line6/usbdefs.h
@@ -30,8 +30,6 @@
 #define LINE6_DEVID_PODSTUDIO_GX  0x4153
 #define LINE6_DEVID_PODSTUDIO_UX1 0x4150
 #define LINE6_DEVID_PODSTUDIO_UX2 0x4151
-#define LINE6_DEVID_PODX3         0x414a
-#define LINE6_DEVID_PODX3LIVE     0x414b
 #define LINE6_DEVID_PODXT         0x5044
 #define LINE6_DEVID_PODXTLIVE     0x4650
 #define LINE6_DEVID_PODXTPRO      0x5050
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/25] staging: line6: Cleanup device table
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (2 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 03/25] staging: line6: Remove unsupported X3 devices Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 05/25] staging: line6: Define a device type enum Chris Rorvick
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Wrap USB_DEVICE to avoid repeating the Line 6 vendor ID.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index e40400b..a263bce 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -30,27 +30,29 @@
 #define DRIVER_DESC    "Line6 USB Driver"
 #define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION
 
+#define LINE6_DEVICE(prod) USB_DEVICE(LINE6_VENDOR_ID, prod)
+
 /* table of devices that work with this driver */
 static const struct usb_device_id line6_id_table[] = {
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXT)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTLIVE)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD300)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD400)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD500)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_GX)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2)},
-	{USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX)},
-	{},
+	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXT) },
+	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE) },
+	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO) },
+	{ LINE6_DEVICE(LINE6_DEVID_GUITARPORT) },
+	{ LINE6_DEVICE(LINE6_DEVID_POCKETPOD) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODHD300) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODHD400) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODHD500) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODXT) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODXTLIVE) },
+	{ LINE6_DEVICE(LINE6_DEVID_PODXTPRO) },
+	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX) },
+	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1) },
+	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2) },
+	{ LINE6_DEVICE(LINE6_DEVID_VARIAX) },
+	{}
 };
 
 MODULE_DEVICE_TABLE(usb, line6_id_table);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/25] staging: line6: Define a device type enum
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (3 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 04/25] staging: line6: Cleanup device table Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 06/25] staging: line6: Index properties array with device type Chris Rorvick
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Define an enum containing the supported devices and associate each entry
in the device table to the respective value.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 54 ++++++++++++++++++++++++++++--------------
 drivers/staging/line6/driver.h | 21 ++++++++++++++++
 2 files changed, 57 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index a263bce..2797e41 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -34,24 +34,42 @@
 
 /* table of devices that work with this driver */
 static const struct usb_device_id line6_id_table[] = {
-	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXT) },
-	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE) },
-	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO) },
-	{ LINE6_DEVICE(LINE6_DEVID_GUITARPORT) },
-	{ LINE6_DEVICE(LINE6_DEVID_POCKETPOD) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODHD300) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODHD400) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODHD500) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODXT) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODXTLIVE) },
-	{ LINE6_DEVICE(LINE6_DEVID_PODXTPRO) },
-	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX) },
-	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1) },
-	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2) },
-	{ LINE6_DEVICE(LINE6_DEVID_VARIAX) },
+	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXT),
+		.driver_info = LINE6_BASSPODXT },
+	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE),
+		.driver_info = LINE6_BASSPODXTLIVE },
+	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO),
+		.driver_info = LINE6_BASSPODXTPRO },
+	{ LINE6_DEVICE(LINE6_DEVID_GUITARPORT),
+		.driver_info = LINE6_GUITARPORT },
+	{ LINE6_DEVICE(LINE6_DEVID_POCKETPOD),
+		.driver_info = LINE6_POCKETPOD },
+	{ LINE6_DEVICE(LINE6_DEVID_PODHD300),
+		.driver_info = LINE6_PODHD300 },
+	{ LINE6_DEVICE(LINE6_DEVID_PODHD400),
+		.driver_info = LINE6_PODHD400 },
+	{ LINE6_DEVICE(LINE6_DEVID_PODHD500),
+		.driver_info = LINE6_PODHD500 },
+	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX),
+		.driver_info = LINE6_PODSTUDIO_GX },
+	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1),
+		.driver_info = LINE6_PODSTUDIO_UX1 },
+	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2),
+		.driver_info = LINE6_PODSTUDIO_UX2 },
+	{ LINE6_DEVICE(LINE6_DEVID_PODXT),
+		.driver_info = LINE6_PODXT },
+	{ LINE6_DEVICE(LINE6_DEVID_PODXTLIVE),
+		.driver_info = LINE6_PODXTLIVE },
+	{ LINE6_DEVICE(LINE6_DEVID_PODXTPRO),
+		.driver_info = LINE6_PODXTPRO },
+	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX),
+		.driver_info = LINE6_TONEPORT_GX },
+	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1),
+		.driver_info = LINE6_TONEPORT_UX1 },
+	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2),
+		.driver_info = LINE6_TONEPORT_UX2 },
+	{ LINE6_DEVICE(LINE6_DEVID_VARIAX),
+		.driver_info = LINE6_VARIAX },
 	{}
 };
 
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index 1cc7532..8fb4a9c 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -20,6 +20,27 @@
 
 #define DRIVER_NAME "line6usb"
 
+enum line6_device_type {
+	LINE6_BASSPODXT,
+	LINE6_BASSPODXTLIVE,
+	LINE6_BASSPODXTPRO,
+	LINE6_GUITARPORT,
+	LINE6_POCKETPOD,
+	LINE6_PODHD300,
+	LINE6_PODHD400,
+	LINE6_PODHD500,
+	LINE6_PODSTUDIO_GX,
+	LINE6_PODSTUDIO_UX1,
+	LINE6_PODSTUDIO_UX2,
+	LINE6_PODXT,
+	LINE6_PODXTLIVE,
+	LINE6_PODXTPRO,
+	LINE6_TONEPORT_GX,
+	LINE6_TONEPORT_UX1,
+	LINE6_TONEPORT_UX2,
+	LINE6_VARIAX
+};
+
 #define LINE6_TIMEOUT 1
 #define LINE6_BUFSIZE_LISTEN 32
 #define LINE6_MESSAGE_MAXLEN 256
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/25] staging: line6: Index properties array with device type
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (4 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 05/25] staging: line6: Define a device type enum Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 07/25] staging: line6: Key off of " Chris Rorvick
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The current logic uses the index of the matched entry from the device
table as an offset to the corresponding properties entry.  The values
of the new `line6_device_type' enum are ordered such that they can be
used as an index into either of these arrays.  Drop the device entry
lookup logic and use the device type (via the .driver_info member)
instead.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 2797e41..c090b2b 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -624,7 +624,7 @@ static void line6_destruct(struct usb_interface *interface)
 static int line6_probe(struct usb_interface *interface,
 		       const struct usb_device_id *id)
 {
-	int devtype;
+	enum line6_device_type devtype;
 	struct usb_device *usbdev;
 	struct usb_line6 *line6;
 	const struct line6_properties *properties;
@@ -646,20 +646,7 @@ static int line6_probe(struct usb_interface *interface,
 		goto err_put;
 	}
 
-	/* check vendor and product id */
-	for (devtype = ARRAY_SIZE(line6_id_table) - 1; devtype--;) {
-		u16 idVendor = le16_to_cpu(usbdev->descriptor.idVendor);
-		u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct);
-
-		if (idVendor == line6_id_table[devtype].idVendor &&
-		    idProduct == line6_id_table[devtype].idProduct)
-			break;
-	}
-
-	if (devtype < 0) {
-		ret = -ENODEV;
-		goto err_put;
-	}
+	devtype = id->driver_info;
 
 	/* initialize device info: */
 	properties = &line6_properties_table[devtype];
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/25] staging: line6: Key off of device type
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (5 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 06/25] staging: line6: Index properties array with device type Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 08/25] staging: line6: Remove idVendor and idProduct macros Chris Rorvick
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The driver currently uses the device's idProduct as input to several
switch statements.  In some cases this is not sufficiently granular and
the interface number must be taken into account.

Store the device type in `usb_line6' and key off of it instead.  New
types can then be added that map to specific interfaces on the device so
that this conditional logic can be flattened out.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c   | 203 ++++++++++++++++++++-------------------
 drivers/staging/line6/driver.h   |   4 +-
 drivers/staging/line6/pcm.c      |  38 ++++----
 drivers/staging/line6/toneport.c |  42 ++++----
 4 files changed, 144 insertions(+), 143 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index c090b2b..81d5a27 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -363,23 +363,23 @@ static void line6_data_received(struct urb *urb)
 		line6->message_length = done;
 		line6_midi_receive(line6, line6->buffer_message, done);
 
-		switch (le16_to_cpu(line6->usbdev->descriptor.idProduct)) {
-		case LINE6_DEVID_BASSPODXT:
-		case LINE6_DEVID_BASSPODXTLIVE:
-		case LINE6_DEVID_BASSPODXTPRO:
-		case LINE6_DEVID_PODXT:
-		case LINE6_DEVID_PODXTPRO:
-		case LINE6_DEVID_POCKETPOD:
+		switch (line6->type) {
+		case LINE6_BASSPODXT:
+		case LINE6_BASSPODXTLIVE:
+		case LINE6_BASSPODXTPRO:
+		case LINE6_PODXT:
+		case LINE6_PODXTPRO:
+		case LINE6_POCKETPOD:
 			line6_pod_process_message((struct usb_line6_pod *)
 						  line6);
 			break;
 
-		case LINE6_DEVID_PODHD300:
-		case LINE6_DEVID_PODHD400:
-		case LINE6_DEVID_PODHD500:
+		case LINE6_PODHD300:
+		case LINE6_PODHD400:
+		case LINE6_PODHD500:
 			break; /* let userspace handle MIDI */
 
-		case LINE6_DEVID_PODXTLIVE:
+		case LINE6_PODXTLIVE:
 			switch (line6->interface_number) {
 			case PODXTLIVE_INTERFACE_POD:
 				line6_pod_process_message((struct usb_line6_pod
@@ -399,7 +399,7 @@ static void line6_data_received(struct urb *urb)
 			}
 			break;
 
-		case LINE6_DEVID_VARIAX:
+		case LINE6_VARIAX:
 			line6_variax_process_message((struct usb_line6_variax *)
 						     line6);
 			break;
@@ -629,7 +629,6 @@ static int line6_probe(struct usb_interface *interface,
 	struct usb_line6 *line6;
 	const struct line6_properties *properties;
 	int interface_number, alternate = 0;
-	int product;
 	int size = 0;
 	int ep_read = 0, ep_write = 0;
 	int ret;
@@ -651,19 +650,18 @@ static int line6_probe(struct usb_interface *interface,
 	/* initialize device info: */
 	properties = &line6_properties_table[devtype];
 	dev_info(&interface->dev, "Line6 %s found\n", properties->name);
-	product = le16_to_cpu(usbdev->descriptor.idProduct);
 
 	/* query interface number */
 	interface_number = interface->cur_altsetting->desc.bInterfaceNumber;
 
-	switch (product) {
-	case LINE6_DEVID_BASSPODXTLIVE:
-	case LINE6_DEVID_PODXTLIVE:
-	case LINE6_DEVID_VARIAX:
+	switch (devtype) {
+	case LINE6_BASSPODXTLIVE:
+	case LINE6_PODXTLIVE:
+	case LINE6_VARIAX:
 		alternate = 1;
 		break;
 
-	case LINE6_DEVID_POCKETPOD:
+	case LINE6_POCKETPOD:
 		switch (interface_number) {
 		case 0:
 			return -ENODEV;	/* this interface has no endpoints */
@@ -675,7 +673,7 @@ static int line6_probe(struct usb_interface *interface,
 		}
 		break;
 
-	case LINE6_DEVID_PODHD500:
+	case LINE6_PODHD500:
 		switch (interface_number) {
 		case 0:
 			alternate = 1;
@@ -688,25 +686,25 @@ static int line6_probe(struct usb_interface *interface,
 		}
 		break;
 
-	case LINE6_DEVID_BASSPODXT:
-	case LINE6_DEVID_BASSPODXTPRO:
-	case LINE6_DEVID_PODXT:
-	case LINE6_DEVID_PODXTPRO:
-	case LINE6_DEVID_PODHD300:
-	case LINE6_DEVID_PODHD400:
+	case LINE6_BASSPODXT:
+	case LINE6_BASSPODXTPRO:
+	case LINE6_PODXT:
+	case LINE6_PODXTPRO:
+	case LINE6_PODHD300:
+	case LINE6_PODHD400:
 		alternate = 5;
 		break;
 
-	case LINE6_DEVID_GUITARPORT:
-	case LINE6_DEVID_PODSTUDIO_GX:
-	case LINE6_DEVID_PODSTUDIO_UX1:
-	case LINE6_DEVID_TONEPORT_GX:
-	case LINE6_DEVID_TONEPORT_UX1:
+	case LINE6_GUITARPORT:
+	case LINE6_PODSTUDIO_GX:
+	case LINE6_PODSTUDIO_UX1:
+	case LINE6_TONEPORT_GX:
+	case LINE6_TONEPORT_UX1:
 		alternate = 2;	/* 1..4 seem to be ok */
 		break;
 
-	case LINE6_DEVID_TONEPORT_UX2:
-	case LINE6_DEVID_PODSTUDIO_UX2:
+	case LINE6_TONEPORT_UX2:
+	case LINE6_PODSTUDIO_UX2:
 		switch (interface_number) {
 		case 0:
 			/* defaults to 44.1kHz, 16-bit */
@@ -735,49 +733,49 @@ static int line6_probe(struct usb_interface *interface,
 		goto err_put;
 	}
 
-	/* initialize device data based on product id: */
-	switch (product) {
-	case LINE6_DEVID_BASSPODXT:
-	case LINE6_DEVID_BASSPODXTLIVE:
-	case LINE6_DEVID_BASSPODXTPRO:
-	case LINE6_DEVID_PODXT:
-	case LINE6_DEVID_PODXTPRO:
+	/* initialize device data based on device: */
+	switch (devtype) {
+	case LINE6_BASSPODXT:
+	case LINE6_BASSPODXTLIVE:
+	case LINE6_BASSPODXTPRO:
+	case LINE6_PODXT:
+	case LINE6_PODXTPRO:
 		size = sizeof(struct usb_line6_pod);
 		ep_read = 0x84;
 		ep_write = 0x03;
 		break;
 
-	case LINE6_DEVID_PODHD300:
-	case LINE6_DEVID_PODHD400:
+	case LINE6_PODHD300:
+	case LINE6_PODHD400:
 		size = sizeof(struct usb_line6_podhd);
 		ep_read = 0x84;
 		ep_write = 0x03;
 		break;
 
-	case LINE6_DEVID_PODHD500:
+	case LINE6_PODHD500:
 		size = sizeof(struct usb_line6_podhd);
 		ep_read = 0x81;
 		ep_write = 0x01;
 		break;
 
-	case LINE6_DEVID_POCKETPOD:
+	case LINE6_POCKETPOD:
 		size = sizeof(struct usb_line6_pod);
 		ep_read = 0x82;
 		ep_write = 0x02;
 		break;
 
-	case LINE6_DEVID_PODSTUDIO_GX:
-	case LINE6_DEVID_PODSTUDIO_UX1:
-	case LINE6_DEVID_PODSTUDIO_UX2:
-	case LINE6_DEVID_TONEPORT_GX:
-	case LINE6_DEVID_TONEPORT_UX1:
-	case LINE6_DEVID_TONEPORT_UX2:
-	case LINE6_DEVID_GUITARPORT:
+	case LINE6_PODSTUDIO_GX:
+	case LINE6_PODSTUDIO_UX1:
+	case LINE6_PODSTUDIO_UX2:
+	case LINE6_TONEPORT_GX:
+	case LINE6_TONEPORT_UX1:
+	case LINE6_TONEPORT_UX2:
+	case LINE6_GUITARPORT:
 		size = sizeof(struct usb_line6_toneport);
 		/* these don't have a control channel */
 		break;
 
-	case LINE6_DEVID_PODXTLIVE:
+	case LINE6_PODXTLIVE:
 		switch (interface_number) {
 		case PODXTLIVE_INTERFACE_POD:
 			size = sizeof(struct usb_line6_pod);
@@ -797,7 +795,7 @@ static int line6_probe(struct usb_interface *interface,
 		}
 		break;
 
-	case LINE6_DEVID_VARIAX:
+	case LINE6_VARIAX:
 		size = sizeof(struct usb_line6_variax);
 		ep_read = 0x82;
 		ep_write = 0x01;
@@ -829,7 +827,7 @@ static int line6_probe(struct usb_interface *interface,
 	line6->ifcdev = &interface->dev;
 	line6->ep_control_read = ep_read;
 	line6->ep_control_write = ep_write;
-	line6->product = product;
+	line6->type = devtype;
 
 	/* get data from endpoint descriptor (see usb_maxpacket): */
 	{
@@ -885,25 +883,25 @@ static int line6_probe(struct usb_interface *interface,
 		}
 	}
 
-	/* initialize device data based on product id: */
-	switch (product) {
-	case LINE6_DEVID_BASSPODXT:
-	case LINE6_DEVID_BASSPODXTLIVE:
-	case LINE6_DEVID_BASSPODXTPRO:
-	case LINE6_DEVID_POCKETPOD:
-	case LINE6_DEVID_PODXT:
-	case LINE6_DEVID_PODXTPRO:
+	/* initialize device data based on device: */
+	switch (devtype) {
+	case LINE6_BASSPODXT:
+	case LINE6_BASSPODXTLIVE:
+	case LINE6_BASSPODXTPRO:
+	case LINE6_POCKETPOD:
+	case LINE6_PODXT:
+	case LINE6_PODXTPRO:
 		ret = line6_pod_init(interface, (struct usb_line6_pod *)line6);
 		break;
 
-	case LINE6_DEVID_PODHD300:
-	case LINE6_DEVID_PODHD400:
-	case LINE6_DEVID_PODHD500:
+	case LINE6_PODHD300:
+	case LINE6_PODHD400:
+	case LINE6_PODHD500:
 		ret = line6_podhd_init(interface,
 				       (struct usb_line6_podhd *)line6);
 		break;
 
-	case LINE6_DEVID_PODXTLIVE:
+	case LINE6_PODXTLIVE:
 		switch (interface_number) {
 		case PODXTLIVE_INTERFACE_POD:
 			ret =
@@ -926,19 +924,19 @@ static int line6_probe(struct usb_interface *interface,
 
 		break;
 
-	case LINE6_DEVID_VARIAX:
+	case LINE6_VARIAX:
 		ret =
 		    line6_variax_init(interface,
 				      (struct usb_line6_variax *)line6);
 		break;
 
-	case LINE6_DEVID_PODSTUDIO_GX:
-	case LINE6_DEVID_PODSTUDIO_UX1:
-	case LINE6_DEVID_PODSTUDIO_UX2:
-	case LINE6_DEVID_TONEPORT_GX:
-	case LINE6_DEVID_TONEPORT_UX1:
-	case LINE6_DEVID_TONEPORT_UX2:
-	case LINE6_DEVID_GUITARPORT:
+	case LINE6_PODSTUDIO_GX:
+	case LINE6_PODSTUDIO_UX1:
+	case LINE6_PODSTUDIO_UX2:
+	case LINE6_TONEPORT_GX:
+	case LINE6_TONEPORT_UX1:
+	case LINE6_TONEPORT_UX2:
+	case LINE6_GUITARPORT:
 		ret =
 		    line6_toneport_init(interface,
 					(struct usb_line6_toneport *)line6);
@@ -1004,23 +1002,23 @@ static void line6_disconnect(struct usb_interface *interface)
 			dev_err(line6->ifcdev,
 				"driver bug: inconsistent usb device\n");
 
-		switch (le16_to_cpu(line6->usbdev->descriptor.idProduct)) {
-		case LINE6_DEVID_BASSPODXT:
-		case LINE6_DEVID_BASSPODXTLIVE:
-		case LINE6_DEVID_BASSPODXTPRO:
-		case LINE6_DEVID_POCKETPOD:
-		case LINE6_DEVID_PODXT:
-		case LINE6_DEVID_PODXTPRO:
+		switch (line6->type) {
+		case LINE6_BASSPODXT:
+		case LINE6_BASSPODXTLIVE:
+		case LINE6_BASSPODXTPRO:
+		case LINE6_POCKETPOD:
+		case LINE6_PODXT:
+		case LINE6_PODXTPRO:
 			line6_pod_disconnect(interface);
 			break;
 
-		case LINE6_DEVID_PODHD300:
-		case LINE6_DEVID_PODHD400:
-		case LINE6_DEVID_PODHD500:
+		case LINE6_PODHD300:
+		case LINE6_PODHD400:
+		case LINE6_PODHD500:
 			line6_podhd_disconnect(interface);
 			break;
 
-		case LINE6_DEVID_PODXTLIVE:
+		case LINE6_PODXTLIVE:
 			switch (interface_number) {
 			case PODXTLIVE_INTERFACE_POD:
 				line6_pod_disconnect(interface);
@@ -1033,17 +1031,17 @@ static void line6_disconnect(struct usb_interface *interface)
 
 			break;
 
-		case LINE6_DEVID_VARIAX:
+		case LINE6_VARIAX:
 			line6_variax_disconnect(interface);
 			break;
 
-		case LINE6_DEVID_PODSTUDIO_GX:
-		case LINE6_DEVID_PODSTUDIO_UX1:
-		case LINE6_DEVID_PODSTUDIO_UX2:
-		case LINE6_DEVID_TONEPORT_GX:
-		case LINE6_DEVID_TONEPORT_UX1:
-		case LINE6_DEVID_TONEPORT_UX2:
-		case LINE6_DEVID_GUITARPORT:
+		case LINE6_PODSTUDIO_GX:
+		case LINE6_PODSTUDIO_UX1:
+		case LINE6_PODSTUDIO_UX2:
+		case LINE6_TONEPORT_GX:
+		case LINE6_TONEPORT_UX1:
+		case LINE6_TONEPORT_UX2:
+		case LINE6_GUITARPORT:
 			line6_toneport_disconnect(interface);
 			break;
 
@@ -1107,15 +1105,18 @@ static int line6_reset_resume(struct usb_interface *interface)
 {
 	struct usb_line6 *line6 = usb_get_intfdata(interface);
 
-	switch (le16_to_cpu(line6->usbdev->descriptor.idProduct)) {
-	case LINE6_DEVID_PODSTUDIO_GX:
-	case LINE6_DEVID_PODSTUDIO_UX1:
-	case LINE6_DEVID_PODSTUDIO_UX2:
-	case LINE6_DEVID_TONEPORT_GX:
-	case LINE6_DEVID_TONEPORT_UX1:
-	case LINE6_DEVID_TONEPORT_UX2:
-	case LINE6_DEVID_GUITARPORT:
+	switch (line6->type) {
+	case LINE6_PODSTUDIO_GX:
+	case LINE6_PODSTUDIO_UX1:
+	case LINE6_PODSTUDIO_UX2:
+	case LINE6_TONEPORT_GX:
+	case LINE6_TONEPORT_UX1:
+	case LINE6_TONEPORT_UX2:
+	case LINE6_GUITARPORT:
 		line6_toneport_reset_resume((struct usb_line6_toneport *)line6);
+
+	default:
+		break;
 	}
 
 	return line6_resume(interface);
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index 8fb4a9c..c536795 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -126,9 +126,9 @@ struct usb_line6 {
 	struct usb_device *usbdev;
 
 	/**
-		 Product id.
+		 Device type.
 	*/
-	int product;
+	enum line6_device_type type;
 
 	/**
 		 Properties.
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index 076c87b..86c7bcb 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -427,37 +427,37 @@ int line6_init_pcm(struct usb_line6 *line6,
 	if (!(line6->properties->capabilities & LINE6_BIT_PCM))
 		return 0;	/* skip PCM initialization and report success */
 
-	/* initialize PCM subsystem based on product id: */
-	switch (line6->product) {
-	case LINE6_DEVID_BASSPODXT:
-	case LINE6_DEVID_BASSPODXTLIVE:
-	case LINE6_DEVID_BASSPODXTPRO:
-	case LINE6_DEVID_PODXT:
-	case LINE6_DEVID_PODXTLIVE:
-	case LINE6_DEVID_PODXTPRO:
-	case LINE6_DEVID_PODHD300:
-	case LINE6_DEVID_PODHD400:
+	/* initialize PCM subsystem based on device: */
+	switch (line6->type) {
+	case LINE6_BASSPODXT:
+	case LINE6_BASSPODXTLIVE:
+	case LINE6_BASSPODXTPRO:
+	case LINE6_PODXT:
+	case LINE6_PODXTLIVE:
+	case LINE6_PODXTPRO:
+	case LINE6_PODHD300:
+	case LINE6_PODHD400:
 		ep_read = 0x82;
 		ep_write = 0x01;
 		break;
 
-	case LINE6_DEVID_PODHD500:
+	case LINE6_PODHD500:
 		ep_read = 0x86;
 		ep_write = 0x02;
 		break;
 
-	case LINE6_DEVID_POCKETPOD:
+	case LINE6_POCKETPOD:
 		ep_read = 0x82;
 		ep_write = 0x02;
 		break;
 
-	case LINE6_DEVID_GUITARPORT:
-	case LINE6_DEVID_PODSTUDIO_GX:
-	case LINE6_DEVID_PODSTUDIO_UX1:
-	case LINE6_DEVID_PODSTUDIO_UX2:
-	case LINE6_DEVID_TONEPORT_GX:
-	case LINE6_DEVID_TONEPORT_UX1:
-	case LINE6_DEVID_TONEPORT_UX2:
+	case LINE6_GUITARPORT:
+	case LINE6_PODSTUDIO_GX:
+	case LINE6_PODSTUDIO_UX1:
+	case LINE6_PODSTUDIO_UX2:
+	case LINE6_TONEPORT_GX:
+	case LINE6_TONEPORT_UX1:
+	case LINE6_TONEPORT_UX2:
 		ep_read = 0x82;
 		ep_write = 0x01;
 		break;
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index 6943715..a2607e7 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -97,11 +97,11 @@ static const struct {
 	{"Inst & Mic", 0x0901}
 };
 
-static bool toneport_has_led(short product)
+static bool toneport_has_led(enum line6_device_type type)
 {
 	return
-	    (product == LINE6_DEVID_GUITARPORT) ||
-	    (product == LINE6_DEVID_TONEPORT_GX);
+	    (type == LINE6_GUITARPORT) ||
+	    (type == LINE6_TONEPORT_GX);
 	/* add your device here if you are missing support for the LEDs */
 }
 
@@ -310,7 +310,6 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
 	int ticks;
 	struct usb_line6 *line6 = &toneport->line6;
 	struct usb_device *usbdev = line6->usbdev;
-	u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct);
 
 	/* sync time on device with host: */
 	ticks = (int)get_seconds();
@@ -320,17 +319,19 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
 	toneport_send_cmd(usbdev, 0x0301, 0x0000);
 
 	/* initialize source select: */
-	switch (le16_to_cpu(usbdev->descriptor.idProduct)) {
-	case LINE6_DEVID_TONEPORT_UX1:
-	case LINE6_DEVID_TONEPORT_UX2:
-	case LINE6_DEVID_PODSTUDIO_UX1:
-	case LINE6_DEVID_PODSTUDIO_UX2:
+	switch (line6->type) {
+	case LINE6_TONEPORT_UX1:
+	case LINE6_TONEPORT_UX2:
+	case LINE6_PODSTUDIO_UX1:
+	case LINE6_PODSTUDIO_UX2:
 		toneport_send_cmd(usbdev,
 				  toneport_source_info[toneport->source].code,
 				  0x0000);
+	default:
+		break;
 	}
 
-	if (toneport_has_led(idProduct))
+	if (toneport_has_led(line6->type))
 		toneport_update_led(&usbdev->dev);
 }
 
@@ -342,8 +343,6 @@ static int toneport_try_init(struct usb_interface *interface,
 {
 	int err;
 	struct usb_line6 *line6 = &toneport->line6;
-	struct usb_device *usbdev = line6->usbdev;
-	u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct);
 
 	if ((interface == NULL) || (toneport == NULL))
 		return -ENODEV;
@@ -366,17 +365,20 @@ static int toneport_try_init(struct usb_interface *interface,
 		return err;
 
 	/* register source select control: */
-	switch (le16_to_cpu(usbdev->descriptor.idProduct)) {
-	case LINE6_DEVID_TONEPORT_UX1:
-	case LINE6_DEVID_TONEPORT_UX2:
-	case LINE6_DEVID_PODSTUDIO_UX1:
-	case LINE6_DEVID_PODSTUDIO_UX2:
+	switch (line6->type) {
+	case LINE6_TONEPORT_UX1:
+	case LINE6_TONEPORT_UX2:
+	case LINE6_PODSTUDIO_UX1:
+	case LINE6_PODSTUDIO_UX2:
 		err =
 		    snd_ctl_add(line6->card,
 				snd_ctl_new1(&toneport_control_source,
 					     line6->line6pcm));
 		if (err < 0)
 			return err;
+
+	default:
+		break;
 	}
 
 	/* register audio system: */
@@ -387,7 +389,7 @@ static int toneport_try_init(struct usb_interface *interface,
 	line6_read_serial_number(line6, &toneport->serial_number);
 	line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);
 
-	if (toneport_has_led(idProduct)) {
+	if (toneport_has_led(line6->type)) {
 		CHECK_RETURN(device_create_file
 			     (&interface->dev, &dev_attr_led_red));
 		CHECK_RETURN(device_create_file
@@ -433,16 +435,14 @@ void line6_toneport_reset_resume(struct usb_line6_toneport *toneport)
 void line6_toneport_disconnect(struct usb_interface *interface)
 {
 	struct usb_line6_toneport *toneport;
-	u16 idProduct;
 
 	if (interface == NULL)
 		return;
 
 	toneport = usb_get_intfdata(interface);
 	del_timer_sync(&toneport->timer);
-	idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct);
 
-	if (toneport_has_led(idProduct)) {
+	if (toneport_has_led(toneport->line6.type)) {
 		device_remove_file(&interface->dev, &dev_attr_led_red);
 		device_remove_file(&interface->dev, &dev_attr_led_green);
 	}
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/25] staging: line6: Remove idVendor and idProduct macros
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (6 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 07/25] staging: line6: Key off of " Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 09/25] staging: line6: Remove useless comments Chris Rorvick
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

These are now only used to build the device table.  Each entry in this
table is already clearly documented as to what device it maps to so the
macros become unnecessary indirection.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c  | 56 ++++++++++++++---------------------------
 drivers/staging/line6/usbdefs.h | 24 ------------------
 2 files changed, 19 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 81d5a27..6dc8a0d 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -30,46 +30,28 @@
 #define DRIVER_DESC    "Line6 USB Driver"
 #define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION
 
-#define LINE6_DEVICE(prod) USB_DEVICE(LINE6_VENDOR_ID, prod)
+#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
 
 /* table of devices that work with this driver */
 static const struct usb_device_id line6_id_table[] = {
-	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXT),
-		.driver_info = LINE6_BASSPODXT },
-	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE),
-		.driver_info = LINE6_BASSPODXTLIVE },
-	{ LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO),
-		.driver_info = LINE6_BASSPODXTPRO },
-	{ LINE6_DEVICE(LINE6_DEVID_GUITARPORT),
-		.driver_info = LINE6_GUITARPORT },
-	{ LINE6_DEVICE(LINE6_DEVID_POCKETPOD),
-		.driver_info = LINE6_POCKETPOD },
-	{ LINE6_DEVICE(LINE6_DEVID_PODHD300),
-		.driver_info = LINE6_PODHD300 },
-	{ LINE6_DEVICE(LINE6_DEVID_PODHD400),
-		.driver_info = LINE6_PODHD400 },
-	{ LINE6_DEVICE(LINE6_DEVID_PODHD500),
-		.driver_info = LINE6_PODHD500 },
-	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX),
-		.driver_info = LINE6_PODSTUDIO_GX },
-	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1),
-		.driver_info = LINE6_PODSTUDIO_UX1 },
-	{ LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2),
-		.driver_info = LINE6_PODSTUDIO_UX2 },
-	{ LINE6_DEVICE(LINE6_DEVID_PODXT),
-		.driver_info = LINE6_PODXT },
-	{ LINE6_DEVICE(LINE6_DEVID_PODXTLIVE),
-		.driver_info = LINE6_PODXTLIVE },
-	{ LINE6_DEVICE(LINE6_DEVID_PODXTPRO),
-		.driver_info = LINE6_PODXTPRO },
-	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX),
-		.driver_info = LINE6_TONEPORT_GX },
-	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1),
-		.driver_info = LINE6_TONEPORT_UX1 },
-	{ LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2),
-		.driver_info = LINE6_TONEPORT_UX2 },
-	{ LINE6_DEVICE(LINE6_DEVID_VARIAX),
-		.driver_info = LINE6_VARIAX },
+	{ LINE6_DEVICE(0x4250),    .driver_info = LINE6_BASSPODXT },
+	{ LINE6_DEVICE(0x4642),    .driver_info = LINE6_BASSPODXTLIVE },
+	{ LINE6_DEVICE(0x4252),    .driver_info = LINE6_BASSPODXTPRO },
+	{ LINE6_DEVICE(0x4750),    .driver_info = LINE6_GUITARPORT },
+	{ LINE6_DEVICE(0x5051),    .driver_info = LINE6_POCKETPOD },
+	{ LINE6_DEVICE(0x5057),    .driver_info = LINE6_PODHD300 },
+	{ LINE6_DEVICE(0x5058),    .driver_info = LINE6_PODHD400 },
+	{ LINE6_DEVICE(0x414D),    .driver_info = LINE6_PODHD500 },
+	{ LINE6_DEVICE(0x4153),    .driver_info = LINE6_PODSTUDIO_GX },
+	{ LINE6_DEVICE(0x4150),    .driver_info = LINE6_PODSTUDIO_UX1 },
+	{ LINE6_DEVICE(0x4151),    .driver_info = LINE6_PODSTUDIO_UX2 },
+	{ LINE6_DEVICE(0x5044),    .driver_info = LINE6_PODXT },
+	{ LINE6_DEVICE(0x4650),    .driver_info = LINE6_PODXTLIVE },
+	{ LINE6_DEVICE(0x5050),    .driver_info = LINE6_PODXTPRO },
+	{ LINE6_DEVICE(0x4147),    .driver_info = LINE6_TONEPORT_GX },
+	{ LINE6_DEVICE(0x4141),    .driver_info = LINE6_TONEPORT_UX1 },
+	{ LINE6_DEVICE(0x4142),    .driver_info = LINE6_TONEPORT_UX2 },
+	{ LINE6_DEVICE(0x534d),    .driver_info = LINE6_VARIAX },
 	{}
 };
 
diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h
index 06bf909..c897dba 100644
--- a/drivers/staging/line6/usbdefs.h
+++ b/drivers/staging/line6/usbdefs.h
@@ -12,32 +12,8 @@
 #ifndef USBDEFS_H
 #define USBDEFS_H
 
-#define LINE6_VENDOR_ID  0x0e41
-
 #define USB_INTERVALS_PER_SECOND 1000
 
-/*
-	Device ids.
-*/
-#define LINE6_DEVID_BASSPODXT     0x4250
-#define LINE6_DEVID_BASSPODXTLIVE 0x4642
-#define LINE6_DEVID_BASSPODXTPRO  0x4252
-#define LINE6_DEVID_GUITARPORT    0x4750
-#define LINE6_DEVID_POCKETPOD     0x5051
-#define LINE6_DEVID_PODHD300      0x5057
-#define LINE6_DEVID_PODHD400      0x5058
-#define LINE6_DEVID_PODHD500      0x414D
-#define LINE6_DEVID_PODSTUDIO_GX  0x4153
-#define LINE6_DEVID_PODSTUDIO_UX1 0x4150
-#define LINE6_DEVID_PODSTUDIO_UX2 0x4151
-#define LINE6_DEVID_PODXT         0x5044
-#define LINE6_DEVID_PODXTLIVE     0x4650
-#define LINE6_DEVID_PODXTPRO      0x5050
-#define LINE6_DEVID_TONEPORT_GX   0x4147
-#define LINE6_DEVID_TONEPORT_UX1  0x4141
-#define LINE6_DEVID_TONEPORT_UX2  0x4142
-#define LINE6_DEVID_VARIAX        0x534d
-
 /* device supports settings parameter via USB */
 #define LINE6_BIT_CONTROL (1 << 0)
 /* device supports PCM input/output via USB */
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/25] staging: line6: Remove useless comments
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (7 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 08/25] staging: line6: Remove idVendor and idProduct macros Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 10/25] staging: line6: Rename capability macros Chris Rorvick
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 6dc8a0d..acde205 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -61,7 +61,6 @@ MODULE_DEVICE_TABLE(usb, line6_id_table);
 	{.id = dev_id,\
 	 .name = dev_name, .capabilities = LINE6_BIT_##dev_cap}
 
-/* *INDENT-OFF* */
 static const struct line6_properties line6_properties_table[] = {
 	L6PROP("BassPODxt",     "BassPODxt",        CTRL_PCM_HW),
 	L6PROP("BassPODxtLive", "BassPODxt Live",   CTRL_PCM_HW),
@@ -82,7 +81,6 @@ static const struct line6_properties line6_properties_table[] = {
 	L6PROP("TonePortUX2",   "TonePort UX2",     PCM),
 	L6PROP("Variax",        "Variax Workbench", CONTROL),
 };
-/* *INDENT-ON* */
 
 /*
 	This is Line6's MIDI manufacturer ID.
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/25] staging: line6: Rename capability macros
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (8 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 09/25] staging: line6: Remove useless comments Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 11/25] staging: line6: Use explicit indexes when defining properties Chris Rorvick
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Including "BIT" in the macro name is pointless.  Replace with "CAP" to
provide some context for what its value represents.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c   |  8 ++++----
 drivers/staging/line6/midi.c     |  2 +-
 drivers/staging/line6/pcm.c      |  2 +-
 drivers/staging/line6/playback.c |  2 +-
 drivers/staging/line6/pod.c      |  2 +-
 drivers/staging/line6/usbdefs.h  | 12 ++++++------
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index acde205..4ec87a3 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -59,7 +59,7 @@ MODULE_DEVICE_TABLE(usb, line6_id_table);
 
 #define L6PROP(dev_id, dev_name, dev_cap)\
 	{.id = dev_id,\
-	 .name = dev_name, .capabilities = LINE6_BIT_##dev_cap}
+	 .name = dev_name, .capabilities = LINE6_CAP_##dev_cap}
 
 static const struct line6_properties line6_properties_table[] = {
 	L6PROP("BassPODxt",     "BassPODxt",        CTRL_PCM_HW),
@@ -830,7 +830,7 @@ static int line6_probe(struct usb_interface *interface,
 
 	usb_set_intfdata(interface, line6);
 
-	if (properties->capabilities & LINE6_BIT_CONTROL) {
+	if (properties->capabilities & LINE6_CAP_CONTROL) {
 		/* initialize USB buffers: */
 		line6->buffer_listen =
 		    kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL);
@@ -1052,7 +1052,7 @@ static int line6_suspend(struct usb_interface *interface, pm_message_t message)
 
 	snd_power_change_state(line6->card, SNDRV_CTL_POWER_D3hot);
 
-	if (line6->properties->capabilities & LINE6_BIT_CONTROL)
+	if (line6->properties->capabilities & LINE6_CAP_CONTROL)
 		line6_stop_listen(line6);
 
 	if (line6pcm != NULL) {
@@ -1071,7 +1071,7 @@ static int line6_resume(struct usb_interface *interface)
 {
 	struct usb_line6 *line6 = usb_get_intfdata(interface);
 
-	if (line6->properties->capabilities & LINE6_BIT_CONTROL)
+	if (line6->properties->capabilities & LINE6_CAP_CONTROL)
 		line6_start_listen(line6);
 
 	snd_power_change_state(line6->card, SNDRV_CTL_POWER_D0);
diff --git a/drivers/staging/line6/midi.c b/drivers/staging/line6/midi.c
index 1ac343b..c453485 100644
--- a/drivers/staging/line6/midi.c
+++ b/drivers/staging/line6/midi.c
@@ -279,7 +279,7 @@ int line6_init_midi(struct usb_line6 *line6)
 	int err;
 	struct snd_line6_midi *line6midi;
 
-	if (!(line6->properties->capabilities & LINE6_BIT_CONTROL)) {
+	if (!(line6->properties->capabilities & LINE6_CAP_CONTROL)) {
 		/* skip MIDI initialization and report success */
 		return 0;
 	}
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index 86c7bcb..e09772f 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -424,7 +424,7 @@ int line6_init_pcm(struct usb_line6 *line6,
 	int ep_read = 0, ep_write = 0;
 	struct snd_line6_pcm *line6pcm;
 
-	if (!(line6->properties->capabilities & LINE6_BIT_PCM))
+	if (!(line6->properties->capabilities & LINE6_CAP_PCM))
 		return 0;	/* skip PCM initialization and report success */
 
 	/* initialize PCM subsystem based on device: */
diff --git a/drivers/staging/line6/playback.c b/drivers/staging/line6/playback.c
index 2ca8900..54b7f60 100644
--- a/drivers/staging/line6/playback.c
+++ b/drivers/staging/line6/playback.c
@@ -261,7 +261,7 @@ static int submit_audio_out_urb(struct snd_line6_pcm *line6pcm)
 #endif
 			if (!
 			    (line6pcm->line6->
-			     properties->capabilities & LINE6_BIT_HWMON)
+			     properties->capabilities & LINE6_CAP_HWMON)
 			    && (line6pcm->flags & LINE6_BITS_PLAYBACK_STREAM)
 			    && (line6pcm->flags & LINE6_BITS_CAPTURE_STREAM))
 				add_monitor_signal(urb_out, line6pcm->prev_fbuf,
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index 7b4ec92f..0fb1788 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -396,7 +396,7 @@ static int pod_try_init(struct usb_interface *interface,
 	   handler.
 	 */
 
-	if (pod->line6.properties->capabilities & LINE6_BIT_CONTROL) {
+	if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) {
 		pod->monitor_level = POD_SYSTEM_INVALID;
 
 		/* initiate startup procedure: */
diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h
index c897dba..d6e46ee 100644
--- a/drivers/staging/line6/usbdefs.h
+++ b/drivers/staging/line6/usbdefs.h
@@ -15,15 +15,15 @@
 #define USB_INTERVALS_PER_SECOND 1000
 
 /* device supports settings parameter via USB */
-#define LINE6_BIT_CONTROL (1 << 0)
+#define LINE6_CAP_CONTROL (1 << 0)
 /* device supports PCM input/output via USB */
-#define LINE6_BIT_PCM (1 << 1)
+#define LINE6_CAP_PCM (1 << 1)
 /* device support hardware monitoring */
-#define LINE6_BIT_HWMON (1 << 2)
+#define LINE6_CAP_HWMON (1 << 2)
 
-#define LINE6_BIT_CTRL_PCM_HW	(LINE6_BIT_CONTROL |	\
-					 LINE6_BIT_PCM |	\
-					 LINE6_BIT_HWMON)
+#define LINE6_CAP_CTRL_PCM_HW	(LINE6_CAP_CONTROL |	\
+					 LINE6_CAP_PCM |	\
+					 LINE6_CAP_HWMON)
 
 #define LINE6_FALLBACK_INTERVAL 10
 #define LINE6_FALLBACK_MAXPACKETSIZE 16
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/25] staging: line6: Use explicit indexes when defining properties
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (9 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 10/25] staging: line6: Rename capability macros Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 12/25] staging: line6: List out capabilities individually Chris Rorvick
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Specify the index of the properties entry explicitly to define this
structure more robustly.  Also, drop the `L6PROP' macro in favor of
initializing each member explicitly on its own line since horizontal
space is limited and more attributes will be added later.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 112 +++++++++++++++++++++++++++++++++--------
 1 file changed, 90 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 4ec87a3..c988b78 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -57,29 +57,97 @@ static const struct usb_device_id line6_id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, line6_id_table);
 
-#define L6PROP(dev_id, dev_name, dev_cap)\
-	{.id = dev_id,\
-	 .name = dev_name, .capabilities = LINE6_CAP_##dev_cap}
-
 static const struct line6_properties line6_properties_table[] = {
-	L6PROP("BassPODxt",     "BassPODxt",        CTRL_PCM_HW),
-	L6PROP("BassPODxtLive", "BassPODxt Live",   CTRL_PCM_HW),
-	L6PROP("BassPODxtPro",  "BassPODxt Pro",    CTRL_PCM_HW),
-	L6PROP("GuitarPort",    "GuitarPort",       PCM),
-	L6PROP("PocketPOD",     "Pocket POD",       CONTROL),
-	L6PROP("PODHD300",      "POD HD300",        CTRL_PCM_HW),
-	L6PROP("PODHD400",      "POD HD400",        CTRL_PCM_HW),
-	L6PROP("PODHD500",      "POD HD500",        CTRL_PCM_HW),
-	L6PROP("PODStudioGX",   "POD Studio GX",    PCM),
-	L6PROP("PODStudioUX1",  "POD Studio UX1",   PCM),
-	L6PROP("PODStudioUX2",  "POD Studio UX2",   PCM),
-	L6PROP("PODxt",         "PODxt",            CTRL_PCM_HW),
-	L6PROP("PODxtLive",     "PODxt Live",       CTRL_PCM_HW),
-	L6PROP("PODxtPro",      "PODxt Pro",        CTRL_PCM_HW),
-	L6PROP("TonePortGX",    "TonePort GX",      PCM),
-	L6PROP("TonePortUX1",   "TonePort UX1",     PCM),
-	L6PROP("TonePortUX2",   "TonePort UX2",     PCM),
-	L6PROP("Variax",        "Variax Workbench", CONTROL),
+	[LINE6_BASSPODXT] = {
+		.id = "BassPODxt",
+		.name = "BassPODxt",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_BASSPODXTLIVE] = {
+		.id = "BassPODxtLive",
+		.name = "BassPODxt Live",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_BASSPODXTPRO] = {
+		.id = "BassPODxtPro",
+		.name = "BassPODxt Pro",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_GUITARPORT] = {
+		.id = "GuitarPort",
+		.name = "GuitarPort",
+		.capabilities = LINE6_CAP_PCM,
+	},
+	[LINE6_POCKETPOD] = {
+		.id = "PocketPOD",
+		.name = "Pocket POD",
+		.capabilities = LINE6_CAP_CONTROL,
+	},
+	[LINE6_PODHD300] = {
+		.id = "PODHD300",
+		.name = "POD HD300",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_PODHD400] = {
+		.id = "PODHD400",
+		.name = "POD HD400",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_PODHD500] = {
+		.id = "PODHD500",
+		.name = "POD HD500",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_PODSTUDIO_GX] = {
+		.id = "PODStudioGX",
+		.name = "POD Studio GX",
+		.capabilities = LINE6_CAP_PCM,
+	},
+	[LINE6_PODSTUDIO_UX1] = {
+		.id = "PODStudioUX1",
+		.name = "POD Studio UX1",
+		.capabilities = LINE6_CAP_PCM,
+	},
+	[LINE6_PODSTUDIO_UX2] = {
+		.id = "PODStudioUX2",
+		.name = "POD Studio UX2",
+		.capabilities = LINE6_CAP_PCM,
+	},
+	[LINE6_PODXT] = {
+		.id = "PODxt",
+		.name = "PODxt",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_PODXTLIVE] = {
+		.id = "PODxtLive",
+		.name = "PODxt Live",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_PODXTPRO] = {
+		.id = "PODxtPro",
+		.name = "PODxt Pro",
+		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+	},
+	[LINE6_TONEPORT_GX] = {
+		.id = "TonePortGX",
+		.name = "TonePort GX",
+		.capabilities = LINE6_CAP_PCM,
+	},
+	[LINE6_TONEPORT_UX1] = {
+		.id = "TonePortUX1",
+		.name = "TonePort UX1",
+		.capabilities = LINE6_CAP_PCM,
+	},
+	[LINE6_TONEPORT_UX2] = {
+		.id = "TonePortUX2",
+		.name = "TonePort UX2",
+		.capabilities = LINE6_CAP_PCM,
+	},
+	[LINE6_VARIAX] = {
+		.id = "Variax",
+		.name = "Variax Workbench",
+		.capabilities = LINE6_CAP_CONTROL,
+	}
 };
 
 /*
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/25] staging: line6: List out capabilities individually
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (10 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 11/25] staging: line6: Use explicit indexes when defining properties Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:35 ` [PATCH 13/25] staging: line6: Split out PODxt Live interfaces Chris Rorvick
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The `LINE6_CAP_CTRL_PCM_HW' macro combines three capabilities to save
horizontal space when defining the properties entries.  Now that these
are no longer limited to single lines this is not such a concern.
Specify capabilities individually when defining each property for
better clarity.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c  | 54 +++++++++++++++++++++++++++--------------
 drivers/staging/line6/usbdefs.h |  4 ---
 2 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index c988b78..6fecc1b 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -61,92 +61,110 @@ static const struct line6_properties line6_properties_table[] = {
 	[LINE6_BASSPODXT] = {
 		.id = "BassPODxt",
 		.name = "BassPODxt",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_BASSPODXTLIVE] = {
 		.id = "BassPODxtLive",
 		.name = "BassPODxt Live",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_BASSPODXTPRO] = {
 		.id = "BassPODxtPro",
 		.name = "BassPODxt Pro",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_GUITARPORT] = {
 		.id = "GuitarPort",
 		.name = "GuitarPort",
-		.capabilities = LINE6_CAP_PCM,
+		.capabilities	= LINE6_CAP_PCM,
 	},
 	[LINE6_POCKETPOD] = {
 		.id = "PocketPOD",
 		.name = "Pocket POD",
-		.capabilities = LINE6_CAP_CONTROL,
+		.capabilities	= LINE6_CAP_CONTROL,
 	},
 	[LINE6_PODHD300] = {
 		.id = "PODHD300",
 		.name = "POD HD300",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_PODHD400] = {
 		.id = "PODHD400",
 		.name = "POD HD400",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_PODHD500] = {
 		.id = "PODHD500",
 		.name = "POD HD500",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_PODSTUDIO_GX] = {
 		.id = "PODStudioGX",
 		.name = "POD Studio GX",
-		.capabilities = LINE6_CAP_PCM,
+		.capabilities	= LINE6_CAP_PCM,
 	},
 	[LINE6_PODSTUDIO_UX1] = {
 		.id = "PODStudioUX1",
 		.name = "POD Studio UX1",
-		.capabilities = LINE6_CAP_PCM,
+		.capabilities	= LINE6_CAP_PCM,
 	},
 	[LINE6_PODSTUDIO_UX2] = {
 		.id = "PODStudioUX2",
 		.name = "POD Studio UX2",
-		.capabilities = LINE6_CAP_PCM,
+		.capabilities	= LINE6_CAP_PCM,
 	},
 	[LINE6_PODXT] = {
 		.id = "PODxt",
 		.name = "PODxt",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_PODXTLIVE] = {
 		.id = "PODxtLive",
 		.name = "PODxt Live",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_PODXTPRO] = {
 		.id = "PODxtPro",
 		.name = "PODxt Pro",
-		.capabilities = LINE6_CAP_CTRL_PCM_HW,
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
 	},
 	[LINE6_TONEPORT_GX] = {
 		.id = "TonePortGX",
 		.name = "TonePort GX",
-		.capabilities = LINE6_CAP_PCM,
+		.capabilities	= LINE6_CAP_PCM,
 	},
 	[LINE6_TONEPORT_UX1] = {
 		.id = "TonePortUX1",
 		.name = "TonePort UX1",
-		.capabilities = LINE6_CAP_PCM,
+		.capabilities	= LINE6_CAP_PCM,
 	},
 	[LINE6_TONEPORT_UX2] = {
 		.id = "TonePortUX2",
 		.name = "TonePort UX2",
-		.capabilities = LINE6_CAP_PCM,
+		.capabilities	= LINE6_CAP_PCM,
 	},
 	[LINE6_VARIAX] = {
 		.id = "Variax",
 		.name = "Variax Workbench",
-		.capabilities = LINE6_CAP_CONTROL,
+		.capabilities	= LINE6_CAP_CONTROL,
 	}
 };
 
diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h
index d6e46ee..f4d080e 100644
--- a/drivers/staging/line6/usbdefs.h
+++ b/drivers/staging/line6/usbdefs.h
@@ -21,10 +21,6 @@
 /* device support hardware monitoring */
 #define LINE6_CAP_HWMON (1 << 2)
 
-#define LINE6_CAP_CTRL_PCM_HW	(LINE6_CAP_CONTROL |	\
-					 LINE6_CAP_PCM |	\
-					 LINE6_CAP_HWMON)
-
 #define LINE6_FALLBACK_INTERVAL 10
 #define LINE6_FALLBACK_MAXPACKETSIZE 16
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/25] staging: line6: Split out PODxt Live interfaces
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (11 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 12/25] staging: line6: List out capabilities individually Chris Rorvick
@ 2015-01-10  5:35 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 14/25] staging: line6: Split out POD HD500 interfaces Chris Rorvick
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The PODxt Live device has both a POD and a Variax interface.  Add device
type entries for each of these.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 112 ++++++++++++++++-------------------------
 drivers/staging/line6/driver.h |   8 +--
 drivers/staging/line6/pcm.c    |   3 +-
 drivers/staging/line6/pod.h    |   6 ---
 4 files changed, 48 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 6fecc1b..cb96029 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -31,6 +31,7 @@
 #define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION
 
 #define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
+#define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
 
 /* table of devices that work with this driver */
 static const struct usb_device_id line6_id_table[] = {
@@ -46,7 +47,8 @@ static const struct usb_device_id line6_id_table[] = {
 	{ LINE6_DEVICE(0x4150),    .driver_info = LINE6_PODSTUDIO_UX1 },
 	{ LINE6_DEVICE(0x4151),    .driver_info = LINE6_PODSTUDIO_UX2 },
 	{ LINE6_DEVICE(0x5044),    .driver_info = LINE6_PODXT },
-	{ LINE6_DEVICE(0x4650),    .driver_info = LINE6_PODXTLIVE },
+	{ LINE6_IF_NUM(0x4650, 0), .driver_info = LINE6_PODXTLIVE_POD },
+	{ LINE6_IF_NUM(0x4650, 1), .driver_info = LINE6_PODXTLIVE_VARIAX },
 	{ LINE6_DEVICE(0x5050),    .driver_info = LINE6_PODXTPRO },
 	{ LINE6_DEVICE(0x4147),    .driver_info = LINE6_TONEPORT_GX },
 	{ LINE6_DEVICE(0x4141),    .driver_info = LINE6_TONEPORT_UX1 },
@@ -132,7 +134,14 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 	},
-	[LINE6_PODXTLIVE] = {
+	[LINE6_PODXTLIVE_POD] = {
+		.id = "PODxtLive",
+		.name = "PODxt Live",
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
+	},
+	[LINE6_PODXTLIVE_VARIAX] = {
 		.id = "PODxtLive",
 		.name = "PODxt Live",
 		.capabilities	= LINE6_CAP_CONTROL
@@ -445,24 +454,15 @@ static void line6_data_received(struct urb *urb)
 		case LINE6_PODHD500:
 			break; /* let userspace handle MIDI */
 
-		case LINE6_PODXTLIVE:
-			switch (line6->interface_number) {
-			case PODXTLIVE_INTERFACE_POD:
-				line6_pod_process_message((struct usb_line6_pod
+		case LINE6_PODXTLIVE_POD:
+			line6_pod_process_message((struct usb_line6_pod
 							   *)line6);
-				break;
-
-			case PODXTLIVE_INTERFACE_VARIAX:
-				line6_variax_process_message((struct
-							      usb_line6_variax
-							      *)line6);
-				break;
-
-			default:
-				dev_err(line6->ifcdev,
-					"PODxt Live interface %d not supported\n",
-					line6->interface_number);
-			}
+			break;
+
+		case LINE6_PODXTLIVE_VARIAX:
+			line6_variax_process_message((struct
+						      usb_line6_variax
+						      *)line6);
 			break;
 
 		case LINE6_VARIAX:
@@ -722,7 +722,8 @@ static int line6_probe(struct usb_interface *interface,
 
 	switch (devtype) {
 	case LINE6_BASSPODXTLIVE:
-	case LINE6_PODXTLIVE:
+	case LINE6_PODXTLIVE_POD:
+	case LINE6_PODXTLIVE_VARIAX:
 	case LINE6_VARIAX:
 		alternate = 1;
 		break;
@@ -841,24 +842,16 @@ static int line6_probe(struct usb_interface *interface,
 		/* these don't have a control channel */
 		break;
 
-	case LINE6_PODXTLIVE:
-		switch (interface_number) {
-		case PODXTLIVE_INTERFACE_POD:
-			size = sizeof(struct usb_line6_pod);
-			ep_read = 0x84;
-			ep_write = 0x03;
-			break;
-
-		case PODXTLIVE_INTERFACE_VARIAX:
-			size = sizeof(struct usb_line6_variax);
-			ep_read = 0x86;
-			ep_write = 0x05;
-			break;
+	case LINE6_PODXTLIVE_POD:
+		size = sizeof(struct usb_line6_pod);
+		ep_read = 0x84;
+		ep_write = 0x03;
+		break;
 
-		default:
-			ret = -ENODEV;
-			goto err_put;
-		}
+	case LINE6_PODXTLIVE_VARIAX:
+		size = sizeof(struct usb_line6_variax);
+		ep_read = 0x86;
+		ep_write = 0x05;
 		break;
 
 	case LINE6_VARIAX:
@@ -887,7 +880,6 @@ static int line6_probe(struct usb_interface *interface,
 	}
 
 	/* store basic data: */
-	line6->interface_number = interface_number;
 	line6->properties = properties;
 	line6->usbdev = usbdev;
 	line6->ifcdev = &interface->dev;
@@ -967,27 +959,16 @@ static int line6_probe(struct usb_interface *interface,
 				       (struct usb_line6_podhd *)line6);
 		break;
 
-	case LINE6_PODXTLIVE:
-		switch (interface_number) {
-		case PODXTLIVE_INTERFACE_POD:
-			ret =
-			    line6_pod_init(interface,
-					   (struct usb_line6_pod *)line6);
-			break;
-
-		case PODXTLIVE_INTERFACE_VARIAX:
-			ret =
-			    line6_variax_init(interface,
-					      (struct usb_line6_variax *)line6);
-			break;
-
-		default:
-			dev_err(&interface->dev,
-				"PODxt Live interface %d not supported\n",
-				interface_number);
-			ret = -ENODEV;
-		}
+	case LINE6_PODXTLIVE_POD:
+		ret =
+		    line6_pod_init(interface,
+				   (struct usb_line6_pod *)line6);
+		break;
 
+	case LINE6_PODXTLIVE_VARIAX:
+		ret =
+		    line6_variax_init(interface,
+				      (struct usb_line6_variax *)line6);
 		break;
 
 	case LINE6_VARIAX:
@@ -1084,17 +1065,12 @@ static void line6_disconnect(struct usb_interface *interface)
 			line6_podhd_disconnect(interface);
 			break;
 
-		case LINE6_PODXTLIVE:
-			switch (interface_number) {
-			case PODXTLIVE_INTERFACE_POD:
-				line6_pod_disconnect(interface);
-				break;
-
-			case PODXTLIVE_INTERFACE_VARIAX:
-				line6_variax_disconnect(interface);
-				break;
-			}
+		case LINE6_PODXTLIVE_POD:
+			line6_pod_disconnect(interface);
+			break;
 
+		case LINE6_PODXTLIVE_VARIAX:
+			line6_variax_disconnect(interface);
 			break;
 
 		case LINE6_VARIAX:
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index c536795..085aa44 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -33,7 +33,8 @@ enum line6_device_type {
 	LINE6_PODSTUDIO_UX1,
 	LINE6_PODSTUDIO_UX2,
 	LINE6_PODXT,
-	LINE6_PODXTLIVE,
+	LINE6_PODXTLIVE_POD,
+	LINE6_PODXTLIVE_VARIAX,
 	LINE6_PODXTPRO,
 	LINE6_TONEPORT_GX,
 	LINE6_TONEPORT_UX1,
@@ -136,11 +137,6 @@ struct usb_line6 {
 	const struct line6_properties *properties;
 
 	/**
-		 Interface number.
-	*/
-	int interface_number;
-
-	/**
 		 Interval (ms).
 	*/
 	int interval;
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index e09772f..d09d1ea 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -433,7 +433,8 @@ int line6_init_pcm(struct usb_line6 *line6,
 	case LINE6_BASSPODXTLIVE:
 	case LINE6_BASSPODXTPRO:
 	case LINE6_PODXT:
-	case LINE6_PODXTLIVE:
+	case LINE6_PODXTLIVE_POD:
+	case LINE6_PODXTLIVE_VARIAX:
 	case LINE6_PODXTPRO:
 	case LINE6_PODHD300:
 	case LINE6_PODHD400:
diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h
index 397d94c..91fd4c5 100644
--- a/drivers/staging/line6/pod.h
+++ b/drivers/staging/line6/pod.h
@@ -21,12 +21,6 @@
 #include "driver.h"
 
 /*
-	PODxt Live interfaces
-*/
-#define PODXTLIVE_INTERFACE_POD    0
-#define PODXTLIVE_INTERFACE_VARIAX 1
-
-/*
 	Locate name in binary program dump
 */
 #define	POD_NAME_OFFSET 0
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/25] staging: line6: Split out POD HD500 interfaces
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (12 preceding siblings ...)
  2015-01-10  5:35 ` [PATCH 13/25] staging: line6: Split out PODxt Live interfaces Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 15/25] staging: line6: Filter on Pocket POD interface Chris Rorvick
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The driver uses a different altsetting depending on the interface.  Add
device type entries for each of these.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 41 ++++++++++++++++++++++++-----------------
 drivers/staging/line6/driver.h |  3 ++-
 drivers/staging/line6/pcm.c    |  3 ++-
 3 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index cb96029..e97e2cb 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -42,7 +42,8 @@ static const struct usb_device_id line6_id_table[] = {
 	{ LINE6_DEVICE(0x5051),    .driver_info = LINE6_POCKETPOD },
 	{ LINE6_DEVICE(0x5057),    .driver_info = LINE6_PODHD300 },
 	{ LINE6_DEVICE(0x5058),    .driver_info = LINE6_PODHD400 },
-	{ LINE6_DEVICE(0x414D),    .driver_info = LINE6_PODHD500 },
+	{ LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500_0 },
+	{ LINE6_IF_NUM(0x414D, 1), .driver_info = LINE6_PODHD500_1 },
 	{ LINE6_DEVICE(0x4153),    .driver_info = LINE6_PODSTUDIO_GX },
 	{ LINE6_DEVICE(0x4150),    .driver_info = LINE6_PODSTUDIO_UX1 },
 	{ LINE6_DEVICE(0x4151),    .driver_info = LINE6_PODSTUDIO_UX2 },
@@ -105,7 +106,14 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 	},
-	[LINE6_PODHD500] = {
+	[LINE6_PODHD500_0] = {
+		.id = "PODHD500",
+		.name = "POD HD500",
+		.capabilities	= LINE6_CAP_CONTROL
+				| LINE6_CAP_PCM
+				| LINE6_CAP_HWMON,
+	},
+	[LINE6_PODHD500_1] = {
 		.id = "PODHD500",
 		.name = "POD HD500",
 		.capabilities	= LINE6_CAP_CONTROL
@@ -451,7 +459,8 @@ static void line6_data_received(struct urb *urb)
 
 		case LINE6_PODHD300:
 		case LINE6_PODHD400:
-		case LINE6_PODHD500:
+		case LINE6_PODHD500_0:
+		case LINE6_PODHD500_1:
 			break; /* let userspace handle MIDI */
 
 		case LINE6_PODXTLIVE_POD:
@@ -740,17 +749,12 @@ static int line6_probe(struct usb_interface *interface,
 		}
 		break;
 
-	case LINE6_PODHD500:
-		switch (interface_number) {
-		case 0:
-			alternate = 1;
-			break;
-		case 1:
-			alternate = 0;
-			break;
-		default:
-			MISSING_CASE;
-		}
+	case LINE6_PODHD500_0:
+		alternate = 1;
+		break;
+
+	case LINE6_PODHD500_1:
+		alternate = 0;
 		break;
 
 	case LINE6_BASSPODXT:
@@ -819,7 +823,8 @@ static int line6_probe(struct usb_interface *interface,
 		ep_write = 0x03;
 		break;
 
-	case LINE6_PODHD500:
+	case LINE6_PODHD500_0:
+	case LINE6_PODHD500_1:
 		size = sizeof(struct usb_line6_podhd);
 		ep_read = 0x81;
 		ep_write = 0x01;
@@ -954,7 +959,8 @@ static int line6_probe(struct usb_interface *interface,
 
 	case LINE6_PODHD300:
 	case LINE6_PODHD400:
-	case LINE6_PODHD500:
+	case LINE6_PODHD500_0:
+	case LINE6_PODHD500_1:
 		ret = line6_podhd_init(interface,
 				       (struct usb_line6_podhd *)line6);
 		break;
@@ -1061,7 +1067,8 @@ static void line6_disconnect(struct usb_interface *interface)
 
 		case LINE6_PODHD300:
 		case LINE6_PODHD400:
-		case LINE6_PODHD500:
+		case LINE6_PODHD500_0:
+		case LINE6_PODHD500_1:
 			line6_podhd_disconnect(interface);
 			break;
 
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index 085aa44..9d6b351 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -28,7 +28,8 @@ enum line6_device_type {
 	LINE6_POCKETPOD,
 	LINE6_PODHD300,
 	LINE6_PODHD400,
-	LINE6_PODHD500,
+	LINE6_PODHD500_0,
+	LINE6_PODHD500_1,
 	LINE6_PODSTUDIO_GX,
 	LINE6_PODSTUDIO_UX1,
 	LINE6_PODSTUDIO_UX2,
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index d09d1ea..d8450af 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -442,7 +442,8 @@ int line6_init_pcm(struct usb_line6 *line6,
 		ep_write = 0x01;
 		break;
 
-	case LINE6_PODHD500:
+	case LINE6_PODHD500_0:
+	case LINE6_PODHD500_1:
 		ep_read = 0x86;
 		ep_write = 0x02;
 		break;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/25] staging: line6: Filter on Pocket POD interface
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (13 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 14/25] staging: line6: Split out POD HD500 interfaces Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 16/25] staging: line6: Filter on UX2 interfaces Chris Rorvick
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The driver only supports interface 1 of the Pocket POD.  Use the device
table to filter on this.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index e97e2cb..8b03bc0 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -39,7 +39,7 @@ static const struct usb_device_id line6_id_table[] = {
 	{ LINE6_DEVICE(0x4642),    .driver_info = LINE6_BASSPODXTLIVE },
 	{ LINE6_DEVICE(0x4252),    .driver_info = LINE6_BASSPODXTPRO },
 	{ LINE6_DEVICE(0x4750),    .driver_info = LINE6_GUITARPORT },
-	{ LINE6_DEVICE(0x5051),    .driver_info = LINE6_POCKETPOD },
+	{ LINE6_IF_NUM(0x5051, 1), .driver_info = LINE6_POCKETPOD },
 	{ LINE6_DEVICE(0x5057),    .driver_info = LINE6_PODHD300 },
 	{ LINE6_DEVICE(0x5058),    .driver_info = LINE6_PODHD400 },
 	{ LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500_0 },
@@ -738,15 +738,7 @@ static int line6_probe(struct usb_interface *interface,
 		break;
 
 	case LINE6_POCKETPOD:
-		switch (interface_number) {
-		case 0:
-			return -ENODEV;	/* this interface has no endpoints */
-		case 1:
-			alternate = 0;
-			break;
-		default:
-			MISSING_CASE;
-		}
+		alternate = 0;
 		break;
 
 	case LINE6_PODHD500_0:
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/25] staging: line6: Filter on UX2 interfaces
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (14 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 15/25] staging: line6: Filter on Pocket POD interface Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 17/25] staging: line6: Move altsetting to properties Chris Rorvick
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The driver only supports interface 0 of the TonePort UX2 and POD Studio
UX2 devices.  Use the device table to filter on this.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 8b03bc0..f04ff80 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -46,14 +46,14 @@ static const struct usb_device_id line6_id_table[] = {
 	{ LINE6_IF_NUM(0x414D, 1), .driver_info = LINE6_PODHD500_1 },
 	{ LINE6_DEVICE(0x4153),    .driver_info = LINE6_PODSTUDIO_GX },
 	{ LINE6_DEVICE(0x4150),    .driver_info = LINE6_PODSTUDIO_UX1 },
-	{ LINE6_DEVICE(0x4151),    .driver_info = LINE6_PODSTUDIO_UX2 },
+	{ LINE6_IF_NUM(0x4151, 0), .driver_info = LINE6_PODSTUDIO_UX2 },
 	{ LINE6_DEVICE(0x5044),    .driver_info = LINE6_PODXT },
 	{ LINE6_IF_NUM(0x4650, 0), .driver_info = LINE6_PODXTLIVE_POD },
 	{ LINE6_IF_NUM(0x4650, 1), .driver_info = LINE6_PODXTLIVE_VARIAX },
 	{ LINE6_DEVICE(0x5050),    .driver_info = LINE6_PODXTPRO },
 	{ LINE6_DEVICE(0x4147),    .driver_info = LINE6_TONEPORT_GX },
 	{ LINE6_DEVICE(0x4141),    .driver_info = LINE6_TONEPORT_UX1 },
-	{ LINE6_DEVICE(0x4142),    .driver_info = LINE6_TONEPORT_UX2 },
+	{ LINE6_IF_NUM(0x4142, 0), .driver_info = LINE6_TONEPORT_UX2 },
 	{ LINE6_DEVICE(0x534d),    .driver_info = LINE6_VARIAX },
 	{}
 };
@@ -768,20 +768,8 @@ static int line6_probe(struct usb_interface *interface,
 
 	case LINE6_TONEPORT_UX2:
 	case LINE6_PODSTUDIO_UX2:
-		switch (interface_number) {
-		case 0:
-			/* defaults to 44.1kHz, 16-bit */
-			alternate = 2;
-			break;
-		case 1:
-			/* don't know yet what this is ...
-			   alternate = 1;
-			   break;
-			 */
-			return -ENODEV;
-		default:
-			MISSING_CASE;
-		}
+		/* defaults to 44.1kHz, 16-bit */
+		alternate = 2;
 		break;
 
 	default:
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/25] staging: line6: Move altsetting to properties
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (15 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 16/25] staging: line6: Filter on UX2 interfaces Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 18/25] staging: line6: Move control endpoints " Chris Rorvick
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The device type can now be used to determine the altsetting for the
interface.  Drop the conditional logic and make this value a property.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 74 +++++++++++++-----------------------------
 drivers/staging/line6/driver.h |  2 ++
 2 files changed, 25 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index f04ff80..0150470 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -67,6 +67,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 5,
 	},
 	[LINE6_BASSPODXTLIVE] = {
 		.id = "BassPODxtLive",
@@ -74,6 +75,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 1,
 	},
 	[LINE6_BASSPODXTPRO] = {
 		.id = "BassPODxtPro",
@@ -81,16 +83,19 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 5,
 	},
 	[LINE6_GUITARPORT] = {
 		.id = "GuitarPort",
 		.name = "GuitarPort",
 		.capabilities	= LINE6_CAP_PCM,
+		.altsetting = 2,  /* 1..4 seem to be ok */
 	},
 	[LINE6_POCKETPOD] = {
 		.id = "PocketPOD",
 		.name = "Pocket POD",
 		.capabilities	= LINE6_CAP_CONTROL,
+		.altsetting = 0,
 	},
 	[LINE6_PODHD300] = {
 		.id = "PODHD300",
@@ -98,6 +103,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 5,
 	},
 	[LINE6_PODHD400] = {
 		.id = "PODHD400",
@@ -105,6 +111,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 5,
 	},
 	[LINE6_PODHD500_0] = {
 		.id = "PODHD500",
@@ -112,6 +119,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 1,
 	},
 	[LINE6_PODHD500_1] = {
 		.id = "PODHD500",
@@ -119,21 +127,25 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 1,
 	},
 	[LINE6_PODSTUDIO_GX] = {
 		.id = "PODStudioGX",
 		.name = "POD Studio GX",
 		.capabilities	= LINE6_CAP_PCM,
+		.altsetting = 2,  /* 1..4 seem to be ok */
 	},
 	[LINE6_PODSTUDIO_UX1] = {
 		.id = "PODStudioUX1",
 		.name = "POD Studio UX1",
 		.capabilities	= LINE6_CAP_PCM,
+		.altsetting = 2,  /* 1..4 seem to be ok */
 	},
 	[LINE6_PODSTUDIO_UX2] = {
 		.id = "PODStudioUX2",
 		.name = "POD Studio UX2",
 		.capabilities	= LINE6_CAP_PCM,
+		.altsetting = 2,  /* defaults to 44.1kHz, 16-bit */
 	},
 	[LINE6_PODXT] = {
 		.id = "PODxt",
@@ -141,6 +153,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 5,
 	},
 	[LINE6_PODXTLIVE_POD] = {
 		.id = "PODxtLive",
@@ -148,6 +161,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 1,
 	},
 	[LINE6_PODXTLIVE_VARIAX] = {
 		.id = "PODxtLive",
@@ -155,6 +169,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 1,
 	},
 	[LINE6_PODXTPRO] = {
 		.id = "PODxtPro",
@@ -162,26 +177,31 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_CONTROL
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
+		.altsetting = 5,
 	},
 	[LINE6_TONEPORT_GX] = {
 		.id = "TonePortGX",
 		.name = "TonePort GX",
 		.capabilities	= LINE6_CAP_PCM,
+		.altsetting = 2,  /* 1..4 seem to be ok */
 	},
 	[LINE6_TONEPORT_UX1] = {
 		.id = "TonePortUX1",
 		.name = "TonePort UX1",
 		.capabilities	= LINE6_CAP_PCM,
+		.altsetting = 2,  /* 1..4 seem to be ok */
 	},
 	[LINE6_TONEPORT_UX2] = {
 		.id = "TonePortUX2",
 		.name = "TonePort UX2",
 		.capabilities	= LINE6_CAP_PCM,
+		.altsetting = 2,  /* defaults to 44.1kHz, 16-bit */
 	},
 	[LINE6_VARIAX] = {
 		.id = "Variax",
 		.name = "Variax Workbench",
 		.capabilities	= LINE6_CAP_CONTROL,
+		.altsetting = 1,
 	}
 };
 
@@ -703,7 +723,7 @@ static int line6_probe(struct usb_interface *interface,
 	struct usb_device *usbdev;
 	struct usb_line6 *line6;
 	const struct line6_properties *properties;
-	int interface_number, alternate = 0;
+	int interface_number;
 	int size = 0;
 	int ep_read = 0, ep_write = 0;
 	int ret;
@@ -729,56 +749,8 @@ static int line6_probe(struct usb_interface *interface,
 	/* query interface number */
 	interface_number = interface->cur_altsetting->desc.bInterfaceNumber;
 
-	switch (devtype) {
-	case LINE6_BASSPODXTLIVE:
-	case LINE6_PODXTLIVE_POD:
-	case LINE6_PODXTLIVE_VARIAX:
-	case LINE6_VARIAX:
-		alternate = 1;
-		break;
-
-	case LINE6_POCKETPOD:
-		alternate = 0;
-		break;
-
-	case LINE6_PODHD500_0:
-		alternate = 1;
-		break;
-
-	case LINE6_PODHD500_1:
-		alternate = 0;
-		break;
-
-	case LINE6_BASSPODXT:
-	case LINE6_BASSPODXTPRO:
-	case LINE6_PODXT:
-	case LINE6_PODXTPRO:
-	case LINE6_PODHD300:
-	case LINE6_PODHD400:
-		alternate = 5;
-		break;
-
-	case LINE6_GUITARPORT:
-	case LINE6_PODSTUDIO_GX:
-	case LINE6_PODSTUDIO_UX1:
-	case LINE6_TONEPORT_GX:
-	case LINE6_TONEPORT_UX1:
-		alternate = 2;	/* 1..4 seem to be ok */
-		break;
-
-	case LINE6_TONEPORT_UX2:
-	case LINE6_PODSTUDIO_UX2:
-		/* defaults to 44.1kHz, 16-bit */
-		alternate = 2;
-		break;
-
-	default:
-		MISSING_CASE;
-		ret = -ENODEV;
-		goto err_put;
-	}
-
-	ret = usb_set_interface(usbdev, interface_number, alternate);
+	ret = usb_set_interface(usbdev, interface_number,
+			properties->altsetting);
 	if (ret < 0) {
 		dev_err(&interface->dev, "set_interface failed\n");
 		goto err_put;
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index 9d6b351..97d6be1 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -115,6 +115,8 @@ struct line6_properties {
 		 line6usb driver.
 	*/
 	int capabilities;
+
+	int altsetting;
 };
 
 /**
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/25] staging: line6: Move control endpoints to properties
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (16 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 17/25] staging: line6: Move altsetting to properties Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 19/25] staging: line6: Remove stale Pocket POD PCM endpoints Chris Rorvick
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The device type can now be used to determine the addresses of the
control endpoints for the interface.  Drop the conditional logic and
make these values properties.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 73 +++++++++++++++++++++++++-----------------
 drivers/staging/line6/driver.h | 13 ++------
 drivers/staging/line6/midi.c   |  2 +-
 3 files changed, 48 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 0150470..40ec57c 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -68,6 +68,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 5,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_BASSPODXTLIVE] = {
 		.id = "BassPODxtLive",
@@ -76,6 +78,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 1,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_BASSPODXTPRO] = {
 		.id = "BassPODxtPro",
@@ -84,18 +88,23 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 5,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_GUITARPORT] = {
 		.id = "GuitarPort",
 		.name = "GuitarPort",
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
+		/* no control channel */
 	},
 	[LINE6_POCKETPOD] = {
 		.id = "PocketPOD",
 		.name = "Pocket POD",
 		.capabilities	= LINE6_CAP_CONTROL,
 		.altsetting = 0,
+		.ep_ctrl_r = 0x82,
+		.ep_ctrl_w = 0x02,
 	},
 	[LINE6_PODHD300] = {
 		.id = "PODHD300",
@@ -104,6 +113,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 5,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_PODHD400] = {
 		.id = "PODHD400",
@@ -112,6 +123,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 5,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_PODHD500_0] = {
 		.id = "PODHD500",
@@ -120,6 +133,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 1,
+		.ep_ctrl_r = 0x81,
+		.ep_ctrl_w = 0x01,
 	},
 	[LINE6_PODHD500_1] = {
 		.id = "PODHD500",
@@ -128,24 +143,29 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 1,
+		.ep_ctrl_r = 0x81,
+		.ep_ctrl_w = 0x01,
 	},
 	[LINE6_PODSTUDIO_GX] = {
 		.id = "PODStudioGX",
 		.name = "POD Studio GX",
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
+		/* no control channel */
 	},
 	[LINE6_PODSTUDIO_UX1] = {
 		.id = "PODStudioUX1",
 		.name = "POD Studio UX1",
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
+		/* no control channel */
 	},
 	[LINE6_PODSTUDIO_UX2] = {
 		.id = "PODStudioUX2",
 		.name = "POD Studio UX2",
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* defaults to 44.1kHz, 16-bit */
+		/* no control channel */
 	},
 	[LINE6_PODXT] = {
 		.id = "PODxt",
@@ -154,6 +174,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 5,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_PODXTLIVE_POD] = {
 		.id = "PODxtLive",
@@ -162,6 +184,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 1,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_PODXTLIVE_VARIAX] = {
 		.id = "PODxtLive",
@@ -170,6 +194,8 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 1,
+		.ep_ctrl_r = 0x86,
+		.ep_ctrl_w = 0x05,
 	},
 	[LINE6_PODXTPRO] = {
 		.id = "PODxtPro",
@@ -178,30 +204,37 @@ static const struct line6_properties line6_properties_table[] = {
 				| LINE6_CAP_PCM
 				| LINE6_CAP_HWMON,
 		.altsetting = 5,
+		.ep_ctrl_r = 0x84,
+		.ep_ctrl_w = 0x03,
 	},
 	[LINE6_TONEPORT_GX] = {
 		.id = "TonePortGX",
 		.name = "TonePort GX",
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
+		/* no control channel */
 	},
 	[LINE6_TONEPORT_UX1] = {
 		.id = "TonePortUX1",
 		.name = "TonePort UX1",
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
+		/* no control channel */
 	},
 	[LINE6_TONEPORT_UX2] = {
 		.id = "TonePortUX2",
 		.name = "TonePort UX2",
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* defaults to 44.1kHz, 16-bit */
+		/* no control channel */
 	},
 	[LINE6_VARIAX] = {
 		.id = "Variax",
 		.name = "Variax Workbench",
 		.capabilities	= LINE6_CAP_CONTROL,
 		.altsetting = 1,
+		.ep_ctrl_r = 0x82,
+		.ep_ctrl_w = 0x01,
 	}
 };
 
@@ -245,9 +278,9 @@ static int line6_start_listen(struct usb_line6 *line6)
 	int err;
 
 	usb_fill_int_urb(line6->urb_listen, line6->usbdev,
-			 usb_rcvintpipe(line6->usbdev, line6->ep_control_read),
-			 line6->buffer_listen, LINE6_BUFSIZE_LISTEN,
-			 line6_data_received, line6, line6->interval);
+		usb_rcvintpipe(line6->usbdev, line6->properties->ep_ctrl_r),
+		line6->buffer_listen, LINE6_BUFSIZE_LISTEN,
+		line6_data_received, line6, line6->interval);
 	line6->urb_listen->actual_length = 0;
 	err = usb_submit_urb(line6->urb_listen, GFP_ATOMIC);
 	return err;
@@ -277,7 +310,7 @@ int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
 
 		retval = usb_interrupt_msg(line6->usbdev,
 					usb_sndintpipe(line6->usbdev,
-						line6->ep_control_write),
+						line6->properties->ep_ctrl_w),
 					(char *)frag_buf, frag_size,
 					&partial, LINE6_TIMEOUT * HZ);
 
@@ -319,9 +352,9 @@ static int line6_send_raw_message_async_part(struct message *msg,
 	int bytes = min(msg->size - done, line6->max_packet_size);
 
 	usb_fill_int_urb(urb, line6->usbdev,
-			 usb_sndintpipe(line6->usbdev, line6->ep_control_write),
-			 (char *)msg->buffer + done, bytes,
-			 line6_async_request_sent, msg, line6->interval);
+		usb_sndintpipe(line6->usbdev, line6->properties->ep_ctrl_w),
+		(char *)msg->buffer + done, bytes,
+		line6_async_request_sent, msg, line6->interval);
 
 	msg->done += bytes;
 	retval = usb_submit_urb(urb, GFP_ATOMIC);
@@ -525,7 +558,7 @@ int line6_send_program(struct usb_line6 *line6, u8 value)
 
 	retval = usb_interrupt_msg(line6->usbdev,
 				   usb_sndintpipe(line6->usbdev,
-						  line6->ep_control_write),
+						  line6->properties->ep_ctrl_w),
 				   buffer, 2, &partial, LINE6_TIMEOUT * HZ);
 
 	if (retval)
@@ -555,7 +588,7 @@ int line6_transmit_parameter(struct usb_line6 *line6, int param, u8 value)
 
 	retval = usb_interrupt_msg(line6->usbdev,
 				   usb_sndintpipe(line6->usbdev,
-						  line6->ep_control_write),
+						  line6->properties->ep_ctrl_w),
 				   buffer, 3, &partial, LINE6_TIMEOUT * HZ);
 
 	if (retval)
@@ -725,7 +758,6 @@ static int line6_probe(struct usb_interface *interface,
 	const struct line6_properties *properties;
 	int interface_number;
 	int size = 0;
-	int ep_read = 0, ep_write = 0;
 	int ret;
 
 	if (interface == NULL)
@@ -764,28 +796,20 @@ static int line6_probe(struct usb_interface *interface,
 	case LINE6_PODXT:
 	case LINE6_PODXTPRO:
 		size = sizeof(struct usb_line6_pod);
-		ep_read = 0x84;
-		ep_write = 0x03;
 		break;
 
 	case LINE6_PODHD300:
 	case LINE6_PODHD400:
 		size = sizeof(struct usb_line6_podhd);
-		ep_read = 0x84;
-		ep_write = 0x03;
 		break;
 
 	case LINE6_PODHD500_0:
 	case LINE6_PODHD500_1:
 		size = sizeof(struct usb_line6_podhd);
-		ep_read = 0x81;
-		ep_write = 0x01;
 		break;
 
 	case LINE6_POCKETPOD:
 		size = sizeof(struct usb_line6_pod);
-		ep_read = 0x82;
-		ep_write = 0x02;
 		break;
 
 	case LINE6_PODSTUDIO_GX:
@@ -796,25 +820,18 @@ static int line6_probe(struct usb_interface *interface,
 	case LINE6_TONEPORT_UX2:
 	case LINE6_GUITARPORT:
 		size = sizeof(struct usb_line6_toneport);
-		/* these don't have a control channel */
 		break;
 
 	case LINE6_PODXTLIVE_POD:
 		size = sizeof(struct usb_line6_pod);
-		ep_read = 0x84;
-		ep_write = 0x03;
 		break;
 
 	case LINE6_PODXTLIVE_VARIAX:
 		size = sizeof(struct usb_line6_variax);
-		ep_read = 0x86;
-		ep_write = 0x05;
 		break;
 
 	case LINE6_VARIAX:
 		size = sizeof(struct usb_line6_variax);
-		ep_read = 0x82;
-		ep_write = 0x01;
 		break;
 
 	default:
@@ -840,15 +857,13 @@ static int line6_probe(struct usb_interface *interface,
 	line6->properties = properties;
 	line6->usbdev = usbdev;
 	line6->ifcdev = &interface->dev;
-	line6->ep_control_read = ep_read;
-	line6->ep_control_write = ep_write;
 	line6->type = devtype;
 
 	/* get data from endpoint descriptor (see usb_maxpacket): */
 	{
 		struct usb_host_endpoint *ep;
-		unsigned epnum =
-		    usb_pipeendpoint(usb_rcvintpipe(usbdev, ep_read));
+		unsigned pipe = usb_rcvintpipe(usbdev, properties->ep_ctrl_r);
+		unsigned epnum = usb_pipeendpoint(pipe);
 		ep = usbdev->ep_in[epnum];
 
 		if (ep != NULL) {
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index 97d6be1..a0555f4 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -117,6 +117,9 @@ struct line6_properties {
 	int capabilities;
 
 	int altsetting;
+
+	unsigned ep_ctrl_r;
+	unsigned ep_ctrl_w;
 };
 
 /**
@@ -171,16 +174,6 @@ struct usb_line6 {
 	struct snd_line6_midi *line6midi;
 
 	/**
-		 USB endpoint for listening to control commands.
-	*/
-	int ep_control_read;
-
-	/**
-		 USB endpoint for writing control commands.
-	*/
-	int ep_control_write;
-
-	/**
 		 URB for listening to PODxt Pro control endpoint.
 	*/
 	struct urb *urb_listen;
diff --git a/drivers/staging/line6/midi.c b/drivers/staging/line6/midi.c
index c453485..c9d725a 100644
--- a/drivers/staging/line6/midi.c
+++ b/drivers/staging/line6/midi.c
@@ -136,7 +136,7 @@ static int send_midi_async(struct usb_line6 *line6, unsigned char *data,
 
 	usb_fill_int_urb(urb, line6->usbdev,
 			 usb_sndbulkpipe(line6->usbdev,
-					 line6->ep_control_write),
+					 line6->properties->ep_ctrl_w),
 			 transfer_buffer, length, midi_sent, line6,
 			 line6->interval);
 	urb->actual_length = 0;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/25] staging: line6: Remove stale Pocket POD PCM endpoints
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (17 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 18/25] staging: line6: Move control endpoints " Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 20/25] staging: line6: Move audio endpoints to properties Chris Rorvick
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Commit 1027f476f507 (staging: line6: sync with upstream) removed PCM
from the Pocket POD capabilities but left the endpoint configuration.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/pcm.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index d8450af..19aa927 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -448,11 +448,6 @@ int line6_init_pcm(struct usb_line6 *line6,
 		ep_write = 0x02;
 		break;
 
-	case LINE6_POCKETPOD:
-		ep_read = 0x82;
-		ep_write = 0x02;
-		break;
-
 	case LINE6_GUITARPORT:
 	case LINE6_PODSTUDIO_GX:
 	case LINE6_PODSTUDIO_UX1:
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/25] staging: line6: Move audio endpoints to properties
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (18 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 19/25] staging: line6: Remove stale Pocket POD PCM endpoints Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 21/25] staging: line6: Pass *_init() `usb_line6' pointers Chris Rorvick
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

The device type can now be used to determine the addresses of the
audio endpoints for the interface.  Drop the conditional logic and make
these values properties.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/capture.c  |  9 ++++----
 drivers/staging/line6/driver.c   | 38 +++++++++++++++++++++++++++++++
 drivers/staging/line6/driver.h   |  2 ++
 drivers/staging/line6/pcm.c      | 48 ++--------------------------------------
 drivers/staging/line6/pcm.h      | 10 ---------
 drivers/staging/line6/playback.c |  9 ++++----
 6 files changed, 52 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/line6/capture.c b/drivers/staging/line6/capture.c
index e6ca631..f24c7c5 100644
--- a/drivers/staging/line6/capture.c
+++ b/drivers/staging/line6/capture.c
@@ -400,6 +400,7 @@ struct snd_pcm_ops snd_line6_capture_ops = {
 
 int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)
 {
+	struct usb_line6 *line6 = line6pcm->line6;
 	int i;
 
 	/* create audio URBs and fill in constant values: */
@@ -411,14 +412,14 @@ int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)
 		    usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL);
 
 		if (urb == NULL) {
-			dev_err(line6pcm->line6->ifcdev, "Out of memory\n");
+			dev_err(line6->ifcdev, "Out of memory\n");
 			return -ENOMEM;
 		}
 
-		urb->dev = line6pcm->line6->usbdev;
+		urb->dev = line6->usbdev;
 		urb->pipe =
-		    usb_rcvisocpipe(line6pcm->line6->usbdev,
-				    line6pcm->ep_audio_read &
+		    usb_rcvisocpipe(line6->usbdev,
+				    line6->properties->ep_audio_r &
 				    USB_ENDPOINT_NUMBER_MASK);
 		urb->transfer_flags = URB_ISO_ASAP;
 		urb->start_frame = -1;
diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 40ec57c..4bfef21 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -70,6 +70,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 5,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_BASSPODXTLIVE] = {
 		.id = "BassPODxtLive",
@@ -80,6 +82,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 1,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_BASSPODXTPRO] = {
 		.id = "BassPODxtPro",
@@ -90,6 +94,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 5,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_GUITARPORT] = {
 		.id = "GuitarPort",
@@ -97,6 +103,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
 		/* no control channel */
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_POCKETPOD] = {
 		.id = "PocketPOD",
@@ -105,6 +113,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 0,
 		.ep_ctrl_r = 0x82,
 		.ep_ctrl_w = 0x02,
+		/* no audio channel */
 	},
 	[LINE6_PODHD300] = {
 		.id = "PODHD300",
@@ -115,6 +124,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 5,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODHD400] = {
 		.id = "PODHD400",
@@ -125,6 +136,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 5,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODHD500_0] = {
 		.id = "PODHD500",
@@ -135,6 +148,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 1,
 		.ep_ctrl_r = 0x81,
 		.ep_ctrl_w = 0x01,
+		.ep_audio_r = 0x86,
+		.ep_audio_w = 0x02,
 	},
 	[LINE6_PODHD500_1] = {
 		.id = "PODHD500",
@@ -145,6 +160,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 1,
 		.ep_ctrl_r = 0x81,
 		.ep_ctrl_w = 0x01,
+		.ep_audio_r = 0x86,
+		.ep_audio_w = 0x02,
 	},
 	[LINE6_PODSTUDIO_GX] = {
 		.id = "PODStudioGX",
@@ -152,6 +169,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
 		/* no control channel */
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODSTUDIO_UX1] = {
 		.id = "PODStudioUX1",
@@ -159,6 +178,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
 		/* no control channel */
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODSTUDIO_UX2] = {
 		.id = "PODStudioUX2",
@@ -166,6 +187,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* defaults to 44.1kHz, 16-bit */
 		/* no control channel */
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODXT] = {
 		.id = "PODxt",
@@ -176,6 +199,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 5,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODXTLIVE_POD] = {
 		.id = "PODxtLive",
@@ -186,6 +211,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 1,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODXTLIVE_VARIAX] = {
 		.id = "PODxtLive",
@@ -196,6 +223,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 1,
 		.ep_ctrl_r = 0x86,
 		.ep_ctrl_w = 0x05,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_PODXTPRO] = {
 		.id = "PODxtPro",
@@ -206,6 +235,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 5,
 		.ep_ctrl_r = 0x84,
 		.ep_ctrl_w = 0x03,
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_TONEPORT_GX] = {
 		.id = "TonePortGX",
@@ -213,6 +244,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
 		/* no control channel */
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_TONEPORT_UX1] = {
 		.id = "TonePortUX1",
@@ -220,6 +253,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* 1..4 seem to be ok */
 		/* no control channel */
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_TONEPORT_UX2] = {
 		.id = "TonePortUX2",
@@ -227,6 +262,8 @@ static const struct line6_properties line6_properties_table[] = {
 		.capabilities	= LINE6_CAP_PCM,
 		.altsetting = 2,  /* defaults to 44.1kHz, 16-bit */
 		/* no control channel */
+		.ep_audio_r = 0x82,
+		.ep_audio_w = 0x01,
 	},
 	[LINE6_VARIAX] = {
 		.id = "Variax",
@@ -235,6 +272,7 @@ static const struct line6_properties line6_properties_table[] = {
 		.altsetting = 1,
 		.ep_ctrl_r = 0x82,
 		.ep_ctrl_w = 0x01,
+		/* no audio channel */
 	}
 };
 
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index a0555f4..a4bde71 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -120,6 +120,8 @@ struct line6_properties {
 
 	unsigned ep_ctrl_r;
 	unsigned ep_ctrl_w;
+	unsigned ep_audio_r;
+	unsigned ep_audio_w;
 };
 
 /**
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index 19aa927..6d4e5cd 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -421,55 +421,13 @@ int line6_init_pcm(struct usb_line6 *line6,
 	};
 
 	int err;
-	int ep_read = 0, ep_write = 0;
+	unsigned ep_read = line6->properties->ep_audio_r;
+	unsigned ep_write = line6->properties->ep_audio_w;
 	struct snd_line6_pcm *line6pcm;
 
 	if (!(line6->properties->capabilities & LINE6_CAP_PCM))
 		return 0;	/* skip PCM initialization and report success */
 
-	/* initialize PCM subsystem based on device: */
-	switch (line6->type) {
-	case LINE6_BASSPODXT:
-	case LINE6_BASSPODXTLIVE:
-	case LINE6_BASSPODXTPRO:
-	case LINE6_PODXT:
-	case LINE6_PODXTLIVE_POD:
-	case LINE6_PODXTLIVE_VARIAX:
-	case LINE6_PODXTPRO:
-	case LINE6_PODHD300:
-	case LINE6_PODHD400:
-		ep_read = 0x82;
-		ep_write = 0x01;
-		break;
-
-	case LINE6_PODHD500_0:
-	case LINE6_PODHD500_1:
-		ep_read = 0x86;
-		ep_write = 0x02;
-		break;
-
-	case LINE6_GUITARPORT:
-	case LINE6_PODSTUDIO_GX:
-	case LINE6_PODSTUDIO_UX1:
-	case LINE6_PODSTUDIO_UX2:
-	case LINE6_TONEPORT_GX:
-	case LINE6_TONEPORT_UX1:
-	case LINE6_TONEPORT_UX2:
-		ep_read = 0x82;
-		ep_write = 0x01;
-		break;
-
-	/* this is for interface_number == 1:
-	case LINE6_DEVID_TONEPORT_UX2:
-	case LINE6_DEVID_PODSTUDIO_UX2:
-		ep_read  = 0x87;
-		ep_write = 0x00;
-		break; */
-
-	default:
-		MISSING_CASE;
-	}
-
 	line6pcm = kzalloc(sizeof(*line6pcm), GFP_KERNEL);
 
 	if (line6pcm == NULL)
@@ -478,8 +436,6 @@ int line6_init_pcm(struct usb_line6 *line6,
 	line6pcm->volume_playback[0] = line6pcm->volume_playback[1] = 255;
 	line6pcm->volume_monitor = 255;
 	line6pcm->line6 = line6;
-	line6pcm->ep_audio_read = ep_read;
-	line6pcm->ep_audio_write = ep_write;
 
 	/* Read and write buffers are sized identically, so choose minimum */
 	line6pcm->max_packet_size = min(
diff --git a/drivers/staging/line6/pcm.h b/drivers/staging/line6/pcm.h
index 5716f16..cddfd06 100644
--- a/drivers/staging/line6/pcm.h
+++ b/drivers/staging/line6/pcm.h
@@ -297,16 +297,6 @@ struct snd_line6_pcm {
 	int max_packet_size;
 
 	/**
-		 USB endpoint for listening to audio data.
-	*/
-	int ep_audio_read;
-
-	/**
-		 USB endpoint for writing audio data.
-	*/
-	int ep_audio_write;
-
-	/**
 		 Bit mask of active capture URBs.
 	*/
 	unsigned long active_urb_in;
diff --git a/drivers/staging/line6/playback.c b/drivers/staging/line6/playback.c
index 54b7f60..da2e3b8 100644
--- a/drivers/staging/line6/playback.c
+++ b/drivers/staging/line6/playback.c
@@ -560,6 +560,7 @@ struct snd_pcm_ops snd_line6_playback_ops = {
 
 int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
 {
+	struct usb_line6 *line6 = line6pcm->line6;
 	int i;
 
 	/* create audio URBs and fill in constant values: */
@@ -571,14 +572,14 @@ int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
 		    usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL);
 
 		if (urb == NULL) {
-			dev_err(line6pcm->line6->ifcdev, "Out of memory\n");
+			dev_err(line6->ifcdev, "Out of memory\n");
 			return -ENOMEM;
 		}
 
-		urb->dev = line6pcm->line6->usbdev;
+		urb->dev = line6->usbdev;
 		urb->pipe =
-		    usb_sndisocpipe(line6pcm->line6->usbdev,
-				    line6pcm->ep_audio_write &
+		    usb_sndisocpipe(line6->usbdev,
+				    line6->properties->ep_audio_w &
 				    USB_ENDPOINT_NUMBER_MASK);
 		urb->transfer_flags = URB_ISO_ASAP;
 		urb->start_frame = -1;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/25] staging: line6: Pass *_init() `usb_line6' pointers
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (19 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 20/25] staging: line6: Move audio endpoints to properties Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 22/25] staging: line6: Pass *_process_message() " Chris Rorvick
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Casting the `struct usb_line6' pointer at the call point makes the code
difficult to read.  This is substantially cleaned up by moving the cast
into the callees.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c   | 21 ++++++---------------
 drivers/staging/line6/pod.c      |  8 ++++----
 drivers/staging/line6/pod.h      |  2 +-
 drivers/staging/line6/podhd.c    |  4 ++--
 drivers/staging/line6/podhd.h    |  2 +-
 drivers/staging/line6/toneport.c |  8 ++++----
 drivers/staging/line6/toneport.h |  2 +-
 drivers/staging/line6/variax.c   |  8 ++++----
 drivers/staging/line6/variax.h   |  2 +-
 9 files changed, 24 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 4bfef21..08f8051 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -959,33 +959,26 @@ static int line6_probe(struct usb_interface *interface,
 	case LINE6_POCKETPOD:
 	case LINE6_PODXT:
 	case LINE6_PODXTPRO:
-		ret = line6_pod_init(interface, (struct usb_line6_pod *)line6);
+		ret = line6_pod_init(interface, line6);
 		break;
 
 	case LINE6_PODHD300:
 	case LINE6_PODHD400:
 	case LINE6_PODHD500_0:
 	case LINE6_PODHD500_1:
-		ret = line6_podhd_init(interface,
-				       (struct usb_line6_podhd *)line6);
+		ret = line6_podhd_init(interface, line6);
 		break;
 
 	case LINE6_PODXTLIVE_POD:
-		ret =
-		    line6_pod_init(interface,
-				   (struct usb_line6_pod *)line6);
+		ret = line6_pod_init(interface, line6);
 		break;
 
 	case LINE6_PODXTLIVE_VARIAX:
-		ret =
-		    line6_variax_init(interface,
-				      (struct usb_line6_variax *)line6);
+		ret = line6_variax_init(interface, line6);
 		break;
 
 	case LINE6_VARIAX:
-		ret =
-		    line6_variax_init(interface,
-				      (struct usb_line6_variax *)line6);
+		ret = line6_variax_init(interface, line6);
 		break;
 
 	case LINE6_PODSTUDIO_GX:
@@ -995,9 +988,7 @@ static int line6_probe(struct usb_interface *interface,
 	case LINE6_TONEPORT_UX1:
 	case LINE6_TONEPORT_UX2:
 	case LINE6_GUITARPORT:
-		ret =
-		    line6_toneport_init(interface,
-					(struct usb_line6_toneport *)line6);
+		ret = line6_toneport_init(interface, line6);
 		break;
 
 	default:
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index 0fb1788..9292b72 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -353,10 +353,10 @@ static int pod_create_files2(struct device *dev)
 	 Try to init POD device.
 */
 static int pod_try_init(struct usb_interface *interface,
-			struct usb_line6_pod *pod)
+			struct usb_line6 *line6)
 {
 	int err;
-	struct usb_line6 *line6 = &pod->line6;
+	struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
 
 	init_timer(&pod->startup_timer);
 	INIT_WORK(&pod->startup_work, pod_startup4);
@@ -409,9 +409,9 @@ static int pod_try_init(struct usb_interface *interface,
 /*
 	 Init POD device (and clean up in case of failure).
 */
-int line6_pod_init(struct usb_interface *interface, struct usb_line6_pod *pod)
+int line6_pod_init(struct usb_interface *interface, struct usb_line6 *line6)
 {
-	int err = pod_try_init(interface, pod);
+	int err = pod_try_init(interface, line6);
 
 	if (err < 0)
 		pod_destruct(interface);
diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h
index 91fd4c5..cf6c75cd 100644
--- a/drivers/staging/line6/pod.h
+++ b/drivers/staging/line6/pod.h
@@ -88,7 +88,7 @@ struct usb_line6_pod {
 
 extern void line6_pod_disconnect(struct usb_interface *interface);
 extern int line6_pod_init(struct usb_interface *interface,
-			  struct usb_line6_pod *pod);
+			  struct usb_line6 *line6);
 extern void line6_pod_process_message(struct usb_line6_pod *pod);
 
 #endif
diff --git a/drivers/staging/line6/podhd.c b/drivers/staging/line6/podhd.c
index 7ef4543..3bb942e 100644
--- a/drivers/staging/line6/podhd.c
+++ b/drivers/staging/line6/podhd.c
@@ -121,9 +121,9 @@ static int podhd_try_init(struct usb_interface *interface,
 /*
 	Init POD HD device (and clean up in case of failure).
 */
-int line6_podhd_init(struct usb_interface *interface,
-		     struct usb_line6_podhd *podhd)
+int line6_podhd_init(struct usb_interface *interface, struct usb_line6 *line6)
 {
+	struct usb_line6_podhd *podhd = (struct usb_line6_podhd *) line6;
 	int err = podhd_try_init(interface, podhd);
 
 	if (err < 0)
diff --git a/drivers/staging/line6/podhd.h b/drivers/staging/line6/podhd.h
index 652f740..b7d9568 100644
--- a/drivers/staging/line6/podhd.h
+++ b/drivers/staging/line6/podhd.h
@@ -25,6 +25,6 @@ struct usb_line6_podhd {
 
 extern void line6_podhd_disconnect(struct usb_interface *interface);
 extern int line6_podhd_init(struct usb_interface *interface,
-			    struct usb_line6_podhd *podhd);
+			    struct usb_line6 *line6);
 
 #endif /* PODHD_H */
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index a2607e7..70fba02 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -339,10 +339,10 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
 	 Try to init Toneport device.
 */
 static int toneport_try_init(struct usb_interface *interface,
-			     struct usb_line6_toneport *toneport)
+			     struct usb_line6 *line6)
 {
 	int err;
-	struct usb_line6 *line6 = &toneport->line6;
+	struct usb_line6_toneport *toneport =  (struct usb_line6_toneport *) line6;
 
 	if ((interface == NULL) || (toneport == NULL))
 		return -ENODEV;
@@ -411,9 +411,9 @@ static int toneport_try_init(struct usb_interface *interface,
 	 Init Toneport device (and clean up in case of failure).
 */
 int line6_toneport_init(struct usb_interface *interface,
-			struct usb_line6_toneport *toneport)
+			struct usb_line6 *line6)
 {
-	int err = toneport_try_init(interface, toneport);
+	int err = toneport_try_init(interface, line6);
 
 	if (err < 0)
 		toneport_destruct(interface);
diff --git a/drivers/staging/line6/toneport.h b/drivers/staging/line6/toneport.h
index 8576b72..af2b4e0 100644
--- a/drivers/staging/line6/toneport.h
+++ b/drivers/staging/line6/toneport.h
@@ -46,7 +46,7 @@ struct usb_line6_toneport {
 
 extern void line6_toneport_disconnect(struct usb_interface *interface);
 extern int line6_toneport_init(struct usb_interface *interface,
-			       struct usb_line6_toneport *toneport);
+			       struct usb_line6 *line6);
 extern void line6_toneport_reset_resume(struct usb_line6_toneport *toneport);
 
 #endif
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c
index ae2be99..f5b618b 100644
--- a/drivers/staging/line6/variax.c
+++ b/drivers/staging/line6/variax.c
@@ -174,8 +174,9 @@ static void variax_destruct(struct usb_interface *interface)
 	 Try to init workbench device.
 */
 static int variax_try_init(struct usb_interface *interface,
-			   struct usb_line6_variax *variax)
+			   struct usb_line6 *line6)
 {
+	struct usb_line6_variax *variax = (struct usb_line6_variax *) line6;
 	int err;
 
 	init_timer(&variax->startup_timer1);
@@ -212,10 +213,9 @@ static int variax_try_init(struct usb_interface *interface,
 /*
 	 Init workbench device (and clean up in case of failure).
 */
-int line6_variax_init(struct usb_interface *interface,
-		      struct usb_line6_variax *variax)
+int line6_variax_init(struct usb_interface *interface, struct usb_line6 *line6)
 {
-	int err = variax_try_init(interface, variax);
+	int err = variax_try_init(interface, line6);
 
 	if (err < 0)
 		variax_destruct(interface);
diff --git a/drivers/staging/line6/variax.h b/drivers/staging/line6/variax.h
index 24de796..9bf1464 100644
--- a/drivers/staging/line6/variax.h
+++ b/drivers/staging/line6/variax.h
@@ -66,7 +66,7 @@ struct usb_line6_variax {
 
 extern void line6_variax_disconnect(struct usb_interface *interface);
 extern int line6_variax_init(struct usb_interface *interface,
-			     struct usb_line6_variax *variax);
+			     struct usb_line6 *line6);
 extern void line6_variax_process_message(struct usb_line6_variax *variax);
 
 #endif
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 22/25] staging: line6: Pass *_process_message() `usb_line6' pointers
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (20 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 21/25] staging: line6: Pass *_init() `usb_line6' pointers Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 23/25] staging: line6: Call *_process_message() via pointer Chris Rorvick
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Casting the `struct usb_line6' pointer at the call point makes the code
difficult to read.  This is substantially cleaned up by moving the cast
into the callees.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 13 ++++---------
 drivers/staging/line6/pod.c    |  3 ++-
 drivers/staging/line6/pod.h    |  2 +-
 drivers/staging/line6/variax.c |  3 ++-
 drivers/staging/line6/variax.h |  2 +-
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 08f8051..369e60e 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -544,8 +544,7 @@ static void line6_data_received(struct urb *urb)
 		case LINE6_PODXT:
 		case LINE6_PODXTPRO:
 		case LINE6_POCKETPOD:
-			line6_pod_process_message((struct usb_line6_pod *)
-						  line6);
+			line6_pod_process_message(line6);
 			break;
 
 		case LINE6_PODHD300:
@@ -555,19 +554,15 @@ static void line6_data_received(struct urb *urb)
 			break; /* let userspace handle MIDI */
 
 		case LINE6_PODXTLIVE_POD:
-			line6_pod_process_message((struct usb_line6_pod
-							   *)line6);
+			line6_pod_process_message(line6);
 			break;
 
 		case LINE6_PODXTLIVE_VARIAX:
-			line6_variax_process_message((struct
-						      usb_line6_variax
-						      *)line6);
+			line6_variax_process_message(line6);
 			break;
 
 		case LINE6_VARIAX:
-			line6_variax_process_message((struct usb_line6_variax *)
-						     line6);
+			line6_variax_process_message(line6);
 			break;
 
 		default:
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index 9292b72..aa8977d 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -131,8 +131,9 @@ static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code,
 /*
 	Process a completely received message.
 */
-void line6_pod_process_message(struct usb_line6_pod *pod)
+void line6_pod_process_message(struct usb_line6 *line6)
 {
+	struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
 	const unsigned char *buf = pod->line6.buffer_message;
 
 	if (memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) {
diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h
index cf6c75cd..984a00b 100644
--- a/drivers/staging/line6/pod.h
+++ b/drivers/staging/line6/pod.h
@@ -89,6 +89,6 @@ struct usb_line6_pod {
 extern void line6_pod_disconnect(struct usb_interface *interface);
 extern int line6_pod_init(struct usb_interface *interface,
 			  struct usb_line6 *line6);
-extern void line6_pod_process_message(struct usb_line6_pod *pod);
+extern void line6_pod_process_message(struct usb_line6 *line6);
 
 #endif
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c
index f5b618b..4d41994 100644
--- a/drivers/staging/line6/variax.c
+++ b/drivers/staging/line6/variax.c
@@ -130,8 +130,9 @@ static void variax_startup6(struct work_struct *work)
 /*
 	Process a completely received message.
 */
-void line6_variax_process_message(struct usb_line6_variax *variax)
+void line6_variax_process_message(struct usb_line6 *line6)
 {
+	struct usb_line6_variax *variax = (struct usb_line6_variax *) line6;
 	const unsigned char *buf = variax->line6.buffer_message;
 
 	switch (buf[0]) {
diff --git a/drivers/staging/line6/variax.h b/drivers/staging/line6/variax.h
index 9bf1464..7d445ff 100644
--- a/drivers/staging/line6/variax.h
+++ b/drivers/staging/line6/variax.h
@@ -67,6 +67,6 @@ struct usb_line6_variax {
 extern void line6_variax_disconnect(struct usb_interface *interface);
 extern int line6_variax_init(struct usb_interface *interface,
 			     struct usb_line6 *line6);
-extern void line6_variax_process_message(struct usb_line6_variax *variax);
+extern void line6_variax_process_message(struct usb_line6 *line6);
 
 #endif
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 23/25] staging: line6: Call *_process_message() via pointer
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (21 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 22/25] staging: line6: Pass *_process_message() " Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 24/25] staging: line6: Call *_disconnect() " Chris Rorvick
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Which *_process_message() function (if any) to call when data is
received is known at initialization.  Add a function pointer to the
`usb_line6' struct and use to call into the appropriate logic instead
of evaluating the conditional logic for each message.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c | 33 ++-------------------------------
 drivers/staging/line6/driver.h |  2 ++
 drivers/staging/line6/pod.c    |  4 +++-
 drivers/staging/line6/pod.h    |  1 -
 drivers/staging/line6/variax.c |  4 +++-
 drivers/staging/line6/variax.h |  1 -
 6 files changed, 10 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index 369e60e..f7629cb 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -537,37 +537,8 @@ static void line6_data_received(struct urb *urb)
 		line6->message_length = done;
 		line6_midi_receive(line6, line6->buffer_message, done);
 
-		switch (line6->type) {
-		case LINE6_BASSPODXT:
-		case LINE6_BASSPODXTLIVE:
-		case LINE6_BASSPODXTPRO:
-		case LINE6_PODXT:
-		case LINE6_PODXTPRO:
-		case LINE6_POCKETPOD:
-			line6_pod_process_message(line6);
-			break;
-
-		case LINE6_PODHD300:
-		case LINE6_PODHD400:
-		case LINE6_PODHD500_0:
-		case LINE6_PODHD500_1:
-			break; /* let userspace handle MIDI */
-
-		case LINE6_PODXTLIVE_POD:
-			line6_pod_process_message(line6);
-			break;
-
-		case LINE6_PODXTLIVE_VARIAX:
-			line6_variax_process_message(line6);
-			break;
-
-		case LINE6_VARIAX:
-			line6_variax_process_message(line6);
-			break;
-
-		default:
-			MISSING_CASE;
-		}
+		if (line6->process_message)
+			line6->process_message(line6);
 	}
 
 	line6_start_listen(line6);
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index a4bde71..220813f 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -194,6 +194,8 @@ struct usb_line6 {
 		 Length of message to be processed.
 	*/
 	int message_length;
+
+	void (*process_message)(struct usb_line6 *);
 };
 
 extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index aa8977d..79dcff4 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -131,7 +131,7 @@ static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code,
 /*
 	Process a completely received message.
 */
-void line6_pod_process_message(struct usb_line6 *line6)
+static void line6_pod_process_message(struct usb_line6 *line6)
 {
 	struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
 	const unsigned char *buf = pod->line6.buffer_message;
@@ -359,6 +359,8 @@ static int pod_try_init(struct usb_interface *interface,
 	int err;
 	struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
 
+	line6->process_message = line6_pod_process_message;
+
 	init_timer(&pod->startup_timer);
 	INIT_WORK(&pod->startup_work, pod_startup4);
 
diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h
index 984a00b..0d78ca7 100644
--- a/drivers/staging/line6/pod.h
+++ b/drivers/staging/line6/pod.h
@@ -89,6 +89,5 @@ struct usb_line6_pod {
 extern void line6_pod_disconnect(struct usb_interface *interface);
 extern int line6_pod_init(struct usb_interface *interface,
 			  struct usb_line6 *line6);
-extern void line6_pod_process_message(struct usb_line6 *line6);
 
 #endif
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c
index 4d41994..ccb1f68 100644
--- a/drivers/staging/line6/variax.c
+++ b/drivers/staging/line6/variax.c
@@ -130,7 +130,7 @@ static void variax_startup6(struct work_struct *work)
 /*
 	Process a completely received message.
 */
-void line6_variax_process_message(struct usb_line6 *line6)
+static void line6_variax_process_message(struct usb_line6 *line6)
 {
 	struct usb_line6_variax *variax = (struct usb_line6_variax *) line6;
 	const unsigned char *buf = variax->line6.buffer_message;
@@ -180,6 +180,8 @@ static int variax_try_init(struct usb_interface *interface,
 	struct usb_line6_variax *variax = (struct usb_line6_variax *) line6;
 	int err;
 
+	line6->process_message = line6_variax_process_message;
+
 	init_timer(&variax->startup_timer1);
 	init_timer(&variax->startup_timer2);
 	INIT_WORK(&variax->startup_work, variax_startup6);
diff --git a/drivers/staging/line6/variax.h b/drivers/staging/line6/variax.h
index 7d445ff..f21ff20 100644
--- a/drivers/staging/line6/variax.h
+++ b/drivers/staging/line6/variax.h
@@ -67,6 +67,5 @@ struct usb_line6_variax {
 extern void line6_variax_disconnect(struct usb_interface *interface);
 extern int line6_variax_init(struct usb_interface *interface,
 			     struct usb_line6 *line6);
-extern void line6_variax_process_message(struct usb_line6 *line6);
 
 #endif
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 24/25] staging: line6: Call *_disconnect() via pointer
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (22 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 23/25] staging: line6: Call *_process_message() via pointer Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  5:36 ` [PATCH 25/25] staging: line6: Make *_disconnect() functions static Chris Rorvick
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Which *_disconnect() to call on disconnect is known at initialization.
Add a function pointer to the `usb_line6' struct and use to call into
the appropriate logic instead of evaluating the conditional logic.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/driver.c   | 43 +---------------------------------------
 drivers/staging/line6/driver.h   |  1 +
 drivers/staging/line6/pod.c      |  1 +
 drivers/staging/line6/podhd.c    |  2 ++
 drivers/staging/line6/toneport.c |  2 ++
 drivers/staging/line6/variax.c   |  1 +
 6 files changed, 8 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index f7629cb..fc852f6 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -1017,48 +1017,7 @@ static void line6_disconnect(struct usb_interface *interface)
 			dev_err(line6->ifcdev,
 				"driver bug: inconsistent usb device\n");
 
-		switch (line6->type) {
-		case LINE6_BASSPODXT:
-		case LINE6_BASSPODXTLIVE:
-		case LINE6_BASSPODXTPRO:
-		case LINE6_POCKETPOD:
-		case LINE6_PODXT:
-		case LINE6_PODXTPRO:
-			line6_pod_disconnect(interface);
-			break;
-
-		case LINE6_PODHD300:
-		case LINE6_PODHD400:
-		case LINE6_PODHD500_0:
-		case LINE6_PODHD500_1:
-			line6_podhd_disconnect(interface);
-			break;
-
-		case LINE6_PODXTLIVE_POD:
-			line6_pod_disconnect(interface);
-			break;
-
-		case LINE6_PODXTLIVE_VARIAX:
-			line6_variax_disconnect(interface);
-			break;
-
-		case LINE6_VARIAX:
-			line6_variax_disconnect(interface);
-			break;
-
-		case LINE6_PODSTUDIO_GX:
-		case LINE6_PODSTUDIO_UX1:
-		case LINE6_PODSTUDIO_UX2:
-		case LINE6_TONEPORT_GX:
-		case LINE6_TONEPORT_UX1:
-		case LINE6_TONEPORT_UX2:
-		case LINE6_GUITARPORT:
-			line6_toneport_disconnect(interface);
-			break;
-
-		default:
-			MISSING_CASE;
-		}
+		line6->disconnect(interface);
 
 		dev_info(&interface->dev, "Line6 %s now disconnected\n",
 			 line6->properties->name);
diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h
index 220813f..ad203f1 100644
--- a/drivers/staging/line6/driver.h
+++ b/drivers/staging/line6/driver.h
@@ -196,6 +196,7 @@ struct usb_line6 {
 	int message_length;
 
 	void (*process_message)(struct usb_line6 *);
+	void (*disconnect)(struct usb_interface *);
 };
 
 extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index 79dcff4..b9af5cf 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -360,6 +360,7 @@ static int pod_try_init(struct usb_interface *interface,
 	struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
 
 	line6->process_message = line6_pod_process_message;
+	line6->disconnect = line6_pod_disconnect;
 
 	init_timer(&pod->startup_timer);
 	INIT_WORK(&pod->startup_work, pod_startup4);
diff --git a/drivers/staging/line6/podhd.c b/drivers/staging/line6/podhd.c
index 3bb942e..a57fbce 100644
--- a/drivers/staging/line6/podhd.c
+++ b/drivers/staging/line6/podhd.c
@@ -98,6 +98,8 @@ static int podhd_try_init(struct usb_interface *interface,
 	if ((interface == NULL) || (podhd == NULL))
 		return -ENODEV;
 
+	line6->disconnect = line6_podhd_disconnect;
+
 	/* initialize audio system: */
 	err = line6_init_audio(line6);
 	if (err < 0)
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index 70fba02..42c34eb 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -347,6 +347,8 @@ static int toneport_try_init(struct usb_interface *interface,
 	if ((interface == NULL) || (toneport == NULL))
 		return -ENODEV;
 
+	line6->disconnect = line6_toneport_disconnect;
+
 	/* initialize audio system: */
 	err = line6_init_audio(line6);
 	if (err < 0)
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c
index ccb1f68..ca25b41 100644
--- a/drivers/staging/line6/variax.c
+++ b/drivers/staging/line6/variax.c
@@ -181,6 +181,7 @@ static int variax_try_init(struct usb_interface *interface,
 	int err;
 
 	line6->process_message = line6_variax_process_message;
+	line6->disconnect = line6_variax_disconnect;
 
 	init_timer(&variax->startup_timer1);
 	init_timer(&variax->startup_timer2);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 25/25] staging: line6: Make *_disconnect() functions static
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (23 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 24/25] staging: line6: Call *_disconnect() " Chris Rorvick
@ 2015-01-10  5:36 ` Chris Rorvick
  2015-01-10  8:48 ` [PATCH 00/25] line6usb cleanup Stefan Hajnoczi
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 32+ messages in thread
From: Chris Rorvick @ 2015-01-10  5:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi,
	Takashi Iwai

Remove declarations from the header and move the definitions up in the
source so they need not be forward declared.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
---
 drivers/staging/line6/pod.c      | 58 ++++++++++++++++++------------------
 drivers/staging/line6/pod.h      |  1 -
 drivers/staging/line6/podhd.c    | 42 +++++++++++++--------------
 drivers/staging/line6/podhd.h    |  1 -
 drivers/staging/line6/toneport.c | 63 +++++++++++++++++++++-------------------
 drivers/staging/line6/toneport.h |  1 -
 drivers/staging/line6/variax.c   | 22 +++++++-------
 drivers/staging/line6/variax.h   |  1 -
 8 files changed, 94 insertions(+), 95 deletions(-)

diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c
index b9af5cf..85a4363 100644
--- a/drivers/staging/line6/pod.c
+++ b/drivers/staging/line6/pod.c
@@ -338,6 +338,35 @@ static void pod_destruct(struct usb_interface *interface)
 }
 
 /*
+	POD device disconnected.
+*/
+static void line6_pod_disconnect(struct usb_interface *interface)
+{
+	struct usb_line6_pod *pod;
+
+	if (interface == NULL)
+		return;
+	pod = usb_get_intfdata(interface);
+
+	if (pod != NULL) {
+		struct snd_line6_pcm *line6pcm = pod->line6.line6pcm;
+		struct device *dev = &interface->dev;
+
+		if (line6pcm != NULL)
+			line6_pcm_disconnect(line6pcm);
+
+		if (dev != NULL) {
+			/* remove sysfs entries: */
+			device_remove_file(dev, &dev_attr_device_id);
+			device_remove_file(dev, &dev_attr_firmware_version);
+			device_remove_file(dev, &dev_attr_serial_number);
+		}
+	}
+
+	pod_destruct(interface);
+}
+
+/*
 	Create sysfs entries.
 */
 static int pod_create_files2(struct device *dev)
@@ -422,32 +451,3 @@ int line6_pod_init(struct usb_interface *interface, struct usb_line6 *line6)
 
 	return err;
 }
-
-/*
-	POD device disconnected.
-*/
-void line6_pod_disconnect(struct usb_interface *interface)
-{
-	struct usb_line6_pod *pod;
-
-	if (interface == NULL)
-		return;
-	pod = usb_get_intfdata(interface);
-
-	if (pod != NULL) {
-		struct snd_line6_pcm *line6pcm = pod->line6.line6pcm;
-		struct device *dev = &interface->dev;
-
-		if (line6pcm != NULL)
-			line6_pcm_disconnect(line6pcm);
-
-		if (dev != NULL) {
-			/* remove sysfs entries: */
-			device_remove_file(dev, &dev_attr_device_id);
-			device_remove_file(dev, &dev_attr_firmware_version);
-			device_remove_file(dev, &dev_attr_serial_number);
-		}
-	}
-
-	pod_destruct(interface);
-}
diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h
index 0d78ca7..87a8f0f 100644
--- a/drivers/staging/line6/pod.h
+++ b/drivers/staging/line6/pod.h
@@ -86,7 +86,6 @@ struct usb_line6_pod {
 	int device_id;
 };
 
-extern void line6_pod_disconnect(struct usb_interface *interface);
 extern int line6_pod_init(struct usb_interface *interface,
 			  struct usb_line6 *line6);
 
diff --git a/drivers/staging/line6/podhd.c b/drivers/staging/line6/podhd.c
index a57fbce..27c5402 100644
--- a/drivers/staging/line6/podhd.c
+++ b/drivers/staging/line6/podhd.c
@@ -87,6 +87,27 @@ static void podhd_destruct(struct usb_interface *interface)
 }
 
 /*
+	POD HD device disconnected.
+*/
+static void line6_podhd_disconnect(struct usb_interface *interface)
+{
+	struct usb_line6_podhd *podhd;
+
+	if (interface == NULL)
+		return;
+	podhd = usb_get_intfdata(interface);
+
+	if (podhd != NULL) {
+		struct snd_line6_pcm *line6pcm = podhd->line6.line6pcm;
+
+		if (line6pcm != NULL)
+			line6_pcm_disconnect(line6pcm);
+	}
+
+	podhd_destruct(interface);
+}
+
+/*
 	Try to init POD HD device.
 */
 static int podhd_try_init(struct usb_interface *interface,
@@ -133,24 +154,3 @@ int line6_podhd_init(struct usb_interface *interface, struct usb_line6 *line6)
 
 	return err;
 }
-
-/*
-	POD HD device disconnected.
-*/
-void line6_podhd_disconnect(struct usb_interface *interface)
-{
-	struct usb_line6_podhd *podhd;
-
-	if (interface == NULL)
-		return;
-	podhd = usb_get_intfdata(interface);
-
-	if (podhd != NULL) {
-		struct snd_line6_pcm *line6pcm = podhd->line6.line6pcm;
-
-		if (line6pcm != NULL)
-			line6_pcm_disconnect(line6pcm);
-	}
-
-	podhd_destruct(interface);
-}
diff --git a/drivers/staging/line6/podhd.h b/drivers/staging/line6/podhd.h
index b7d9568..a14f711 100644
--- a/drivers/staging/line6/podhd.h
+++ b/drivers/staging/line6/podhd.h
@@ -23,7 +23,6 @@ struct usb_line6_podhd {
 	struct usb_line6 line6;
 };
 
-extern void line6_podhd_disconnect(struct usb_interface *interface);
 extern int line6_podhd_init(struct usb_interface *interface,
 			    struct usb_line6 *line6);
 
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index 42c34eb..aae78d8 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -336,6 +336,39 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
 }
 
 /*
+	Toneport device disconnected.
+*/
+static void line6_toneport_disconnect(struct usb_interface *interface)
+{
+	struct usb_line6_toneport *toneport;
+	u16 idProduct;
+
+	if (interface == NULL)
+		return;
+
+	toneport = usb_get_intfdata(interface);
+	del_timer_sync(&toneport->timer);
+	idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct);
+
+	if (toneport_has_led(idProduct)) {
+		device_remove_file(&interface->dev, &dev_attr_led_red);
+		device_remove_file(&interface->dev, &dev_attr_led_green);
+	}
+
+	if (toneport != NULL) {
+		struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm;
+
+		if (line6pcm != NULL) {
+			line6_pcm_release(line6pcm, LINE6_BITS_PCM_MONITOR);
+			line6_pcm_disconnect(line6pcm);
+		}
+	}
+
+	toneport_destruct(interface);
+}
+
+
+/*
 	 Try to init Toneport device.
 */
 static int toneport_try_init(struct usb_interface *interface,
@@ -430,33 +463,3 @@ void line6_toneport_reset_resume(struct usb_line6_toneport *toneport)
 {
 	toneport_setup(toneport);
 }
-
-/*
-	Toneport device disconnected.
-*/
-void line6_toneport_disconnect(struct usb_interface *interface)
-{
-	struct usb_line6_toneport *toneport;
-
-	if (interface == NULL)
-		return;
-
-	toneport = usb_get_intfdata(interface);
-	del_timer_sync(&toneport->timer);
-
-	if (toneport_has_led(toneport->line6.type)) {
-		device_remove_file(&interface->dev, &dev_attr_led_red);
-		device_remove_file(&interface->dev, &dev_attr_led_green);
-	}
-
-	if (toneport != NULL) {
-		struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm;
-
-		if (line6pcm != NULL) {
-			line6_pcm_release(line6pcm, LINE6_BITS_PCM_MONITOR);
-			line6_pcm_disconnect(line6pcm);
-		}
-	}
-
-	toneport_destruct(interface);
-}
diff --git a/drivers/staging/line6/toneport.h b/drivers/staging/line6/toneport.h
index af2b4e0..8cb1442 100644
--- a/drivers/staging/line6/toneport.h
+++ b/drivers/staging/line6/toneport.h
@@ -44,7 +44,6 @@ struct usb_line6_toneport {
 	struct timer_list timer;
 };
 
-extern void line6_toneport_disconnect(struct usb_interface *interface);
 extern int line6_toneport_init(struct usb_interface *interface,
 			       struct usb_line6 *line6);
 extern void line6_toneport_reset_resume(struct usb_line6_toneport *toneport);
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c
index ca25b41..b4a41b0 100644
--- a/drivers/staging/line6/variax.c
+++ b/drivers/staging/line6/variax.c
@@ -172,6 +172,17 @@ static void variax_destruct(struct usb_interface *interface)
 }
 
 /*
+	Workbench device disconnected.
+*/
+static void line6_variax_disconnect(struct usb_interface *interface)
+{
+	if (interface == NULL)
+		return;
+
+	variax_destruct(interface);
+}
+
+/*
 	 Try to init workbench device.
 */
 static int variax_try_init(struct usb_interface *interface,
@@ -226,14 +237,3 @@ int line6_variax_init(struct usb_interface *interface, struct usb_line6 *line6)
 
 	return err;
 }
-
-/*
-	Workbench device disconnected.
-*/
-void line6_variax_disconnect(struct usb_interface *interface)
-{
-	if (interface == NULL)
-		return;
-
-	variax_destruct(interface);
-}
diff --git a/drivers/staging/line6/variax.h b/drivers/staging/line6/variax.h
index f21ff20..dfb94e5 100644
--- a/drivers/staging/line6/variax.h
+++ b/drivers/staging/line6/variax.h
@@ -64,7 +64,6 @@ struct usb_line6_variax {
 	int startup_progress;
 };
 
-extern void line6_variax_disconnect(struct usb_interface *interface);
 extern int line6_variax_init(struct usb_interface *interface,
 			     struct usb_line6 *line6);
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/25] line6usb cleanup
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (24 preceding siblings ...)
  2015-01-10  5:36 ` [PATCH 25/25] staging: line6: Make *_disconnect() functions static Chris Rorvick
@ 2015-01-10  8:48 ` Stefan Hajnoczi
       [not found] ` <s5h8uh94nce.wl-tiwai@suse.de>
  2015-01-12  9:23 ` Dan Carpenter
  27 siblings, 0 replies; 32+ messages in thread
From: Stefan Hajnoczi @ 2015-01-10  8:48 UTC (permalink / raw)
  To: Chris Rorvick
  Cc: Greg Kroah-Hartman, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Takashi Iwai

On Sat, Jan 10, 2015 at 5:35 AM, Chris Rorvick <chris@rorvick.com> wrote:
> The line6usb driver references the device's idProduct and, in some
> cases, the interface number in a number of places to determine device-
> specific configuration values and to call device-specific functionality.
> Rework code to leverage the device table matching more effectively.
> Consolidate configuration settings into the properties entries and use
> function pointers setup at initialization to remove much of the
> conditional logic.
>
> I have a TonePort UX2 that I've used for testing, meaning that some of
> this is really only compile-tested.

I no longer own a Pod HD300 so I cannot test these patches.  The code
looks fine.

Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/25] line6usb cleanup
       [not found] ` <s5h8uh94nce.wl-tiwai@suse.de>
@ 2015-01-11 11:26   ` Stefan Hajnoczi
  2015-01-11 21:04   ` Chris Rorvick
  1 sibling, 0 replies; 32+ messages in thread
From: Stefan Hajnoczi @ 2015-01-11 11:26 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Chris Rorvick, Greg Kroah-Hartman, Alexey Khoroshilov,
	Davide Berardi, devel, Fabian Mewes, Gulsah Kose,
	Himangi Saraogi, Jerry Snitselaar, L. Alberto Giménez,
	linux-kernel, Mikhail Boiko, Monam Agarwal,
	Peter P Waskiewicz Jr

On Sun, Jan 11, 2015 at 10:34 AM, Takashi Iwai <tiwai@suse.de> wrote:
> At Fri,  9 Jan 2015 23:35:46 -0600,
> Chris Rorvick wrote:
>>
>> The line6usb driver references the device's idProduct and, in some
>> cases, the interface number in a number of places to determine device-
>> specific configuration values and to call device-specific functionality.
>> Rework code to leverage the device table matching more effectively.
>> Consolidate configuration settings into the properties entries and use
>> function pointers setup at initialization to remove much of the
>> conditional logic.
>>
>> I have a TonePort UX2 that I've used for testing, meaning that some of
>> this is really only compile-tested.
>
> BTW, are there any active developers for this driver?  It doesn't make
> sense to sit in staging directory forever.  It should be promoted to
> the official sound directory, or dropped from the kernel tree if not.
> If anyone is responsible for testing with real hardware, I'll happily
> review.

I am not active but willing to help with review and advice if anyone
wants to tackle this driver.

Stefan

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/25] line6usb cleanup
       [not found] ` <s5h8uh94nce.wl-tiwai@suse.de>
  2015-01-11 11:26   ` Stefan Hajnoczi
@ 2015-01-11 21:04   ` Chris Rorvick
       [not found]     ` <s5hh9vwj6tm.wl-tiwai@suse.de>
  1 sibling, 1 reply; 32+ messages in thread
From: Chris Rorvick @ 2015-01-11 21:04 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Greg Kroah-Hartman, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi

> At Fri,  9 Jan 2015 23:35:46 -0600,
> Chris Rorvick wrote:
>>
>> I have a TonePort UX2 that I've used for testing, meaning that some of
>> this is really only compile-tested.
>
> If anyone is responsible for testing with real hardware, I'll happily
> review.

To be clear, the TonePort UX2 is real hardware.  But this driver
basically supports four classes of Line 6 devices and I'm only covering
one of them.

So this series is a first step in trying to address this.  Having this
as a single driver probably made sense when it was a separate project,
but now that it is in-tree it seems like the POD, PODHD, TonePort, and
Variax pieces should each be separate drivers that each depend on a core
Line 6 driver.  I think the cleanup in this series will make that
easier.  None of this is my area of expertise, though, so advice and
feedback is very welcome.

> are there any active developers for this driver?

I intended to do further work.  I know there is quite a bit of mundane
checkpatch cleanup that would need to get done before this could get
promoted, and I believe I read that it's using sysfs for stuff that
would normally be done via an ALSA interface, and the sysfs interface
has not been documented nor has it been justified.  All stuff I thought
I might look into.

But I'm just doing this for fun so I can't promise anything.  :-)

Chris

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/25] line6usb cleanup
  2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
                   ` (26 preceding siblings ...)
       [not found] ` <s5h8uh94nce.wl-tiwai@suse.de>
@ 2015-01-12  9:23 ` Dan Carpenter
  27 siblings, 0 replies; 32+ messages in thread
From: Dan Carpenter @ 2015-01-12  9:23 UTC (permalink / raw)
  To: Chris Rorvick
  Cc: Greg Kroah-Hartman, devel, Fabian Mewes, Gulsah Kose,
	Stefan Hajnoczi, Mikhail Boiko, Peter P Waskiewicz Jr,
	linux-kernel, Takashi Iwai, Himangi Saraogi, Monam Agarwal,
	Alexey Khoroshilov

These patches look really nice.  Thanks for doing this.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/25] line6usb cleanup
       [not found]     ` <s5hh9vwj6tm.wl-tiwai@suse.de>
@ 2015-01-12 19:52       ` Greg Kroah-Hartman
  2015-01-12 22:07       ` Takashi Iwai
  1 sibling, 0 replies; 32+ messages in thread
From: Greg Kroah-Hartman @ 2015-01-12 19:52 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Chris Rorvick, Alexey Khoroshilov, Davide Berardi, devel,
	Fabian Mewes, Gulsah Kose, Himangi Saraogi, Jerry Snitselaar,
	L. Alberto Giménez, linux-kernel, Mikhail Boiko,
	Monam Agarwal, Peter P Waskiewicz Jr, Stefan Hajnoczi

On Mon, Jan 12, 2015 at 05:35:01PM +0100, Takashi Iwai wrote:
> At Sun, 11 Jan 2015 15:04:55 -0600,
> Chris Rorvick wrote:
> > 
> > > At Fri,  9 Jan 2015 23:35:46 -0600,
> > > Chris Rorvick wrote:
> > >>
> > >> I have a TonePort UX2 that I've used for testing, meaning that some of
> > >> this is really only compile-tested.
> > >
> > > If anyone is responsible for testing with real hardware, I'll happily
> > > review.
> > 
> > To be clear, the TonePort UX2 is real hardware.  But this driver
> > basically supports four classes of Line 6 devices and I'm only covering
> > one of them.
> > 
> > So this series is a first step in trying to address this.  Having this
> > as a single driver probably made sense when it was a separate project,
> > but now that it is in-tree it seems like the POD, PODHD, TonePort, and
> > Variax pieces should each be separate drivers that each depend on a core
> > Line 6 driver.  I think the cleanup in this series will make that
> > easier.  None of this is my area of expertise, though, so advice and
> > feedback is very welcome.
> > 
> > > are there any active developers for this driver?
> > 
> > I intended to do further work.  I know there is quite a bit of mundane
> > checkpatch cleanup that would need to get done before this could get
> > promoted, and I believe I read that it's using sysfs for stuff that
> > would normally be done via an ALSA interface, and the sysfs interface
> > has not been documented nor has it been justified.  All stuff I thought
> > I might look into.
> > 
> > But I'm just doing this for fun so I can't promise anything.  :-)
> 
> OK, so the situation looks fairly good, we have a few active
> developers and/or testers.  And the current code doesn't look so
> terrible despite of it being in staging directory.  That said, I think
> we can promote this stuff into sound/usb/line6 directory, then apply
> Chris' cleanup patches, and work on it further.
> 
> Does it sound OK for you guys?  Greg?
> 
> Once when I get approval, I'll start a new clean branch on sound.git
> tree so that you guys can work on it further for 3.20 kernel.

That sounds fine with me.  I have 4 other patches in my "to-apply" queue
other than these 25 for this driver that I'll forward on to you for
inclusion in your tree.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/25] line6usb cleanup
       [not found]     ` <s5hh9vwj6tm.wl-tiwai@suse.de>
  2015-01-12 19:52       ` Greg Kroah-Hartman
@ 2015-01-12 22:07       ` Takashi Iwai
  1 sibling, 0 replies; 32+ messages in thread
From: Takashi Iwai @ 2015-01-12 22:07 UTC (permalink / raw)
  To: Chris Rorvick
  Cc: devel, alsa-devel, Peter P Waskiewicz Jr, Fabian Mewes,
	Gulsah Kose, Stefan Hajnoczi, Greg Kroah-Hartman, Mikhail Boiko,
	Monam Agarwal, linux-kernel, Himangi Saraogi, Alexey Khoroshilov

At Mon, 12 Jan 2015 17:35:01 +0100,
Takashi Iwai wrote:
> 
> At Sun, 11 Jan 2015 15:04:55 -0600,
> Chris Rorvick wrote:
> > 
> > > At Fri,  9 Jan 2015 23:35:46 -0600,
> > > Chris Rorvick wrote:
> > >>
> > >> I have a TonePort UX2 that I've used for testing, meaning that some of
> > >> this is really only compile-tested.
> > >
> > > If anyone is responsible for testing with real hardware, I'll happily
> > > review.
> > 
> > To be clear, the TonePort UX2 is real hardware.  But this driver
> > basically supports four classes of Line 6 devices and I'm only covering
> > one of them.
> > 
> > So this series is a first step in trying to address this.  Having this
> > as a single driver probably made sense when it was a separate project,
> > but now that it is in-tree it seems like the POD, PODHD, TonePort, and
> > Variax pieces should each be separate drivers that each depend on a core
> > Line 6 driver.  I think the cleanup in this series will make that
> > easier.  None of this is my area of expertise, though, so advice and
> > feedback is very welcome.
> > 
> > > are there any active developers for this driver?
> > 
> > I intended to do further work.  I know there is quite a bit of mundane
> > checkpatch cleanup that would need to get done before this could get
> > promoted, and I believe I read that it's using sysfs for stuff that
> > would normally be done via an ALSA interface, and the sysfs interface
> > has not been documented nor has it been justified.  All stuff I thought
> > I might look into.
> > 
> > But I'm just doing this for fun so I can't promise anything.  :-)
> 
> OK, so the situation looks fairly good, we have a few active
> developers and/or testers.  And the current code doesn't look so
> terrible despite of it being in staging directory.  That said, I think
> we can promote this stuff into sound/usb/line6 directory, then apply
> Chris' cleanup patches, and work on it further.
> 
> Does it sound OK for you guys?  Greg?
> 
> Once when I get approval, I'll start a new clean branch on sound.git
> tree so that you guys can work on it further for 3.20 kernel.

JFYI, I merged all patches Greg forwarded to me into topic/line6
branch of sound git tree.  It's included to linux-next, so you can
work on linux-next or my branch as well.

Now the code has been moved from driver/staging/line6 to
sound/usb/line6.  I'm going to apply some driver rename and cleanup
patches to follow to other ALSA driver standards, and think of
splitting to each driver with a core line6 helper module after that.

Feel free to send the further development patches to me and/or
alsa-devel ML like other sound drivers.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2015-01-12 22:07 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-10  5:35 [PATCH 00/25] line6usb cleanup Chris Rorvick
2015-01-10  5:35 ` [PATCH 01/25] staging: line6: Remove `device_bit' from properties Chris Rorvick
2015-01-10  5:35 ` [PATCH 02/25] staging: line6: Remove line6_pod_transmit_paramter() Chris Rorvick
2015-01-10  5:35 ` [PATCH 03/25] staging: line6: Remove unsupported X3 devices Chris Rorvick
2015-01-10  5:35 ` [PATCH 04/25] staging: line6: Cleanup device table Chris Rorvick
2015-01-10  5:35 ` [PATCH 05/25] staging: line6: Define a device type enum Chris Rorvick
2015-01-10  5:35 ` [PATCH 06/25] staging: line6: Index properties array with device type Chris Rorvick
2015-01-10  5:35 ` [PATCH 07/25] staging: line6: Key off of " Chris Rorvick
2015-01-10  5:35 ` [PATCH 08/25] staging: line6: Remove idVendor and idProduct macros Chris Rorvick
2015-01-10  5:35 ` [PATCH 09/25] staging: line6: Remove useless comments Chris Rorvick
2015-01-10  5:35 ` [PATCH 10/25] staging: line6: Rename capability macros Chris Rorvick
2015-01-10  5:35 ` [PATCH 11/25] staging: line6: Use explicit indexes when defining properties Chris Rorvick
2015-01-10  5:35 ` [PATCH 12/25] staging: line6: List out capabilities individually Chris Rorvick
2015-01-10  5:35 ` [PATCH 13/25] staging: line6: Split out PODxt Live interfaces Chris Rorvick
2015-01-10  5:36 ` [PATCH 14/25] staging: line6: Split out POD HD500 interfaces Chris Rorvick
2015-01-10  5:36 ` [PATCH 15/25] staging: line6: Filter on Pocket POD interface Chris Rorvick
2015-01-10  5:36 ` [PATCH 16/25] staging: line6: Filter on UX2 interfaces Chris Rorvick
2015-01-10  5:36 ` [PATCH 17/25] staging: line6: Move altsetting to properties Chris Rorvick
2015-01-10  5:36 ` [PATCH 18/25] staging: line6: Move control endpoints " Chris Rorvick
2015-01-10  5:36 ` [PATCH 19/25] staging: line6: Remove stale Pocket POD PCM endpoints Chris Rorvick
2015-01-10  5:36 ` [PATCH 20/25] staging: line6: Move audio endpoints to properties Chris Rorvick
2015-01-10  5:36 ` [PATCH 21/25] staging: line6: Pass *_init() `usb_line6' pointers Chris Rorvick
2015-01-10  5:36 ` [PATCH 22/25] staging: line6: Pass *_process_message() " Chris Rorvick
2015-01-10  5:36 ` [PATCH 23/25] staging: line6: Call *_process_message() via pointer Chris Rorvick
2015-01-10  5:36 ` [PATCH 24/25] staging: line6: Call *_disconnect() " Chris Rorvick
2015-01-10  5:36 ` [PATCH 25/25] staging: line6: Make *_disconnect() functions static Chris Rorvick
2015-01-10  8:48 ` [PATCH 00/25] line6usb cleanup Stefan Hajnoczi
     [not found] ` <s5h8uh94nce.wl-tiwai@suse.de>
2015-01-11 11:26   ` Stefan Hajnoczi
2015-01-11 21:04   ` Chris Rorvick
     [not found]     ` <s5hh9vwj6tm.wl-tiwai@suse.de>
2015-01-12 19:52       ` Greg Kroah-Hartman
2015-01-12 22:07       ` Takashi Iwai
2015-01-12  9:23 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.