line6usb cleanup
cover line6usb cleanup
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(-)
Signature · 1 line
2.1.0
PATCH 1/25 staging: line6: Remove `device_bit' from properties
The `device_bit' member was no longer used as of commit 2807904441d4 (staging: line6: drop MIDI parameter sysfs attrs).
--- 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(-)
drivers/staging/line6/driver.c +22 -22
@@ -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* */
drivers/staging/line6/driver.h +0 -5
@@ -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>"
drivers/staging/line6/pcm.h +2 -0
@@ -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),
drivers/staging/line6/usbdefs.h +0 -59
65 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 2/25 staging: line6: Remove line6_pod_transmit_paramter()
In reply to Chris RorvickThis function was no longer used as of commit 2807904441d4 (staging:
line6: drop MIDI parameter sysfs attrs).
--- drivers/staging/line6/pod.c | 9 --------- drivers/staging/line6/pod.h | 2 -- 2 files changed, 11 deletions(-)
drivers/staging/line6/pod.c +0 -9
@@ -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,
drivers/staging/line6/pod.h +0 -2
@@ -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
Signature · 1 line
2.1.0
PATCH 3/25 staging: line6: Remove unsupported X3 devices
In reply to Chris RorvickSupport for these devices appears to have never been completed. Remove them from the device table along with a minimal amount of supporting code.
--- drivers/staging/line6/driver.c | 26 -------------------------- drivers/staging/line6/pcm.c | 2 -- drivers/staging/line6/usbdefs.h | 2 -- 3 files changed, 30 deletions(-)
drivers/staging/line6/driver.c +0 -26
@@ -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);
drivers/staging/line6/pcm.c +0 -2
@@ -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 ;
drivers/staging/line6/usbdefs.h +0 -2
@@ -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
Signature · 1 line
2.1.0
PATCH 4/25 staging: line6: Cleanup device table
In reply to Chris RorvickWrap USB_DEVICE to avoid repeating the Line 6 vendor ID.
--- drivers/staging/line6/driver.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-)
drivers/staging/line6/driver.c +21 -19
@@ -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);
Signature · 1 line
2.1.0
PATCH 5/25 staging: line6: Define a device type enum
In reply to Chris RorvickDefine an enum containing the supported devices and associate each entry in the device table to the respective value.
--- drivers/staging/line6/driver.c | 54 ++++++++++++++++++++++++++++-------------- drivers/staging/line6/driver.h | 21 ++++++++++++++++ 2 files changed, 57 insertions(+), 18 deletions(-)
drivers/staging/line6/driver.c +36 -18
@@ -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 }, {} };
drivers/staging/line6/driver.h +21 -0
@@ -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
Signature · 1 line
2.1.0
PATCH 6/25 staging: line6: Index properties array with device type
In reply to Chris RorvickThe 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.
--- drivers/staging/line6/driver.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/staging/line6/driver.c +2 -15
@@ -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];
Signature · 1 line
2.1.0
PATCH 7/25 staging: line6: Key off of device type
In reply to Chris RorvickThe 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.
--- 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(-)
drivers/staging/line6/driver.c +102 -101
@@ -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);
drivers/staging/line6/driver.h +2 -2
@@ -126,9 +126,9 @@ struct usb_line6 {struct usb_device *usbdev;/** -Product id. +Device type. */ -int product; +enum line6_device_type type;/** Properties.
drivers/staging/line6/pcm.c +19 -19
@@ -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 ;
drivers/staging/line6/toneport.c +21 -21
104 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 8/25 staging: line6: Remove idVendor and idProduct macros
In reply to Chris RorvickThese 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.
--- drivers/staging/line6/driver.c | 56 ++++++++++++++--------------------------- drivers/staging/line6/usbdefs.h | 24 ------------------ 2 files changed, 19 insertions(+), 61 deletions(-)
drivers/staging/line6/driver.c +19 -37
@@ -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 }, {} };
drivers/staging/line6/usbdefs.h +0 -24
@@ -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 */
Signature · 1 line
2.1.0
PATCH 9/25 staging: line6: Remove useless comments
In reply to Chris Rorvick--- drivers/staging/line6/driver.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/line6/driver.c +0 -2
@@ -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.
Signature · 1 line
2.1.0
PATCH 10/25 staging: line6: Rename capability macros
In reply to Chris RorvickIncluding "BIT" in the macro name is pointless. Replace with "CAP" to provide some context for what its value represents.
--- 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(-)
drivers/staging/line6/driver.c +4 -4
@@ -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 );
drivers/staging/line6/midi.c +1 -1
@@ -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 ; }
drivers/staging/line6/pcm.c +1 -1
@@ -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: */
drivers/staging/line6/playback.c +1 -1
@@ -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,
drivers/staging/line6/pod.c +1 -1
@@ -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: */
drivers/staging/line6/usbdefs.h +6 -6
@@ -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
Signature · 1 line
2.1.0
PATCH 11/25 staging: line6: Use explicit indexes when defining properties
In reply to Chris RorvickSpecify 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.
--- drivers/staging/line6/driver.c | 112 +++++++++++++++++++++++++++++++++-------- 1 file changed, 90 insertions(+), 22 deletions(-)
drivers/staging/line6/driver.c +90 -22
@@ -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 , + } };/*
Signature · 1 line
2.1.0
PATCH 12/25 staging: line6: List out capabilities individually
In reply to Chris RorvickThe `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.
--- drivers/staging/line6/driver.c | 54 +++++++++++++++++++++++++++-------------- drivers/staging/line6/usbdefs.h | 4 --- 2 files changed, 36 insertions(+), 22 deletions(-)
drivers/staging/line6/driver.c +36 -18
@@ -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 , } };
drivers/staging/line6/usbdefs.h +0 -4
@@ -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
Signature · 1 line
2.1.0
PATCH 13/25 staging: line6: Split out PODxt Live interfaces
In reply to Chris RorvickThe PODxt Live device has both a POD and a Variax interface. Add device type entries for each of these.
--- 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(-)
drivers/staging/line6/driver.c +44 -68
@@ -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 :
drivers/staging/line6/driver.h +2 -6
@@ -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;
drivers/staging/line6/pcm.c +2 -1
@@ -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 :
drivers/staging/line6/pod.h +0 -6
@@ -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
Signature · 1 line
2.1.0
PATCH 14/25 staging: line6: Split out POD HD500 interfaces
In reply to Chris RorvickThe driver uses a different altsetting depending on the interface. Add device type entries for each of these.
--- 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(-)
drivers/staging/line6/driver.c +24 -17
@@ -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 ;
drivers/staging/line6/driver.h +2 -1
@@ -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,
drivers/staging/line6/pcm.c +2 -1
@@ -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 ;
Signature · 1 line
2.1.0
PATCH 15/25 staging: line6: Filter on Pocket POD interface
In reply to Chris RorvickThe driver only supports interface 1 of the Pocket POD. Use the device table to filter on this.
--- drivers/staging/line6/driver.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/staging/line6/driver.c +2 -10
@@ -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 :
Signature · 1 line
2.1.0
PATCH 16/25 staging: line6: Filter on UX2 interfaces
In reply to Chris RorvickThe driver only supports interface 0 of the TonePort UX2 and POD Studio UX2 devices. Use the device table to filter on this.
--- drivers/staging/line6/driver.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/staging/line6/driver.c +4 -16
@@ -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 :
Signature · 1 line
2.1.0
PATCH 17/25 staging: line6: Move altsetting to properties
In reply to Chris RorvickThe device type can now be used to determine the altsetting for the interface. Drop the conditional logic and make this value a property.
--- drivers/staging/line6/driver.c | 74 +++++++++++++----------------------------- drivers/staging/line6/driver.h | 2 ++ 2 files changed, 25 insertions(+), 51 deletions(-)
drivers/staging/line6/driver.c +23 -51
@@ -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;
drivers/staging/line6/driver.h +2 -0
@@ -115,6 +115,8 @@ struct line6_properties {line6usb driver. */ int capabilities; + +int altsetting; };/**
Signature · 1 line
2.1.0
PATCH 18/25 staging: line6: Move control endpoints to properties
In reply to Chris RorvickThe 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.
--- 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(-)
drivers/staging/line6/driver.c +44 -29
@@ -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 ) {
drivers/staging/line6/driver.h +3 -10
@@ -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;
drivers/staging/line6/midi.c +1 -1
@@ -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 ;
Signature · 1 line
2.1.0
PATCH 19/25 staging: line6: Remove stale Pocket POD PCM endpoints
In reply to Chris RorvickCommit 1027f476f507 (staging: line6: sync with upstream) removed PCM from the Pocket POD capabilities but left the endpoint configuration.
--- drivers/staging/line6/pcm.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/line6/pcm.c +0 -5
@@ -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 :
Signature · 1 line
2.1.0
PATCH 20/25 staging: line6: Move audio endpoints to properties
In reply to Chris RorvickThe 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.
--- 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(-)
drivers/staging/line6/capture.c +5 -4
@@ -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 ;
drivers/staging/line6/driver.c +38 -0
@@ -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 */ } };
drivers/staging/line6/driver.h +2 -0
@@ -120,6 +120,8 @@ struct line6_properties {unsigned ep_ctrl_r;unsigned ep_ctrl_w; +unsigned ep_audio_r; +unsigned ep_audio_w; };/**
drivers/staging/line6/pcm.c +2 -46
65 lines not on this page · raw message
drivers/staging/line6/pcm.h +0 -10
@@ -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;
drivers/staging/line6/playback.c +5 -4
@@ -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 ;
Signature · 1 line
2.1.0
PATCH 21/25 staging: line6: Pass *_init() `usb_line6' pointers
In reply to Chris RorvickCasting 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.
--- 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(-)
drivers/staging/line6/driver.c +6 -15
@@ -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 :
drivers/staging/line6/pod.c +4 -4
@@ -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);
drivers/staging/line6/pod.h +1 -1
@@ -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
drivers/staging/line6/podhd.c +2 -2
@@ -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 )
drivers/staging/line6/podhd.h +1 -1
@@ -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 */
drivers/staging/line6/toneport.c +4 -4
@@ -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);
drivers/staging/line6/toneport.h +1 -1
@@ -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
drivers/staging/line6/variax.c +4 -4
@@ -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);
drivers/staging/line6/variax.h +1 -1
@@ -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
Signature · 1 line
2.1.0
PATCH 22/25 staging: line6: Pass *_process_message() `usb_line6' pointers
In reply to Chris RorvickCasting 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.
--- 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(-)
drivers/staging/line6/driver.c +4 -9
@@ -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 :
drivers/staging/line6/pod.c +2 -1
@@ -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 ) {
drivers/staging/line6/pod.h +1 -1
@@ -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
drivers/staging/line6/variax.c +2 -1
@@ -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 ]) {
drivers/staging/line6/variax.h +1 -1
@@ -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
Signature · 1 line
2.1.0
PATCH 23/25 staging: line6: Call *_process_message() via pointer
In reply to Chris RorvickWhich *_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.
--- 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(-)
drivers/staging/line6/driver.c +2 -31
@@ -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);
drivers/staging/line6/driver.h +2 -0
@@ -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,
drivers/staging/line6/pod.c +3 -1
@@ -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);
drivers/staging/line6/pod.h +0 -1
@@ -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
drivers/staging/line6/variax.c +3 -1
@@ -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);
drivers/staging/line6/variax.h +0 -1
@@ -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
Signature · 1 line
2.1.0
PATCH 24/25 staging: line6: Call *_disconnect() via pointer
In reply to Chris RorvickWhich *_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.
--- 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(-)
drivers/staging/line6/driver.c +1 -42
@@ -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);
drivers/staging/line6/driver.h +1 -0
@@ -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,
drivers/staging/line6/pod.c +1 -0
@@ -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);
drivers/staging/line6/podhd.c +2 -0
@@ -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 )
drivers/staging/line6/toneport.c +2 -0
@@ -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 )
drivers/staging/line6/variax.c +1 -0
@@ -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);
Signature · 1 line
2.1.0
PATCH 25/25 staging: line6: Make *_disconnect() functions static
In reply to Chris RorvickRemove declarations from the header and move the definitions up in the source so they need not be forward declared.
--- 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(-)
drivers/staging/line6/pod.c +29 -29
@@ -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); -}
drivers/staging/line6/pod.h +0 -1
@@ -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);
drivers/staging/line6/podhd.c +21 -21
51 lines not on this page · raw message
drivers/staging/line6/podhd.h +0 -1
@@ -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);
drivers/staging/line6/toneport.c +33 -30
72 lines not on this page · raw message
drivers/staging/line6/toneport.h +0 -1
@@ -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);
drivers/staging/line6/variax.c +11 -11
@@ -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); -}
drivers/staging/line6/variax.h +0 -1
@@ -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);
Signature · 1 line
2.1.0
Quoted 10 lines · Chris Rorvick
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.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Takashi Iwai
At Fri, 9 Jan 2015 23:35:46 -0600,
Quoted 9 lines · Chris Rorvick
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.
Quoted 8 lines
Quoted 2 lines
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
Quoted 8 lines
At Fri, 9 Jan 2015 23:35:46 -0600,
Quoted 3 lines · Chris Rorvick
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.
Quoted 1 line
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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Greg Kroah-Hartman
maintainerQuoted 41 lines · Takashi Iwai
At Sun, 11 Jan 2015 15:04:55 -0600,
Quoted 24 lines · Chris Rorvick
Quoted 9 lines
At Fri, 9 Jan 2015 23:35:46 -0600,
Quoted 3 lines · Chris Rorvick
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.
Quoted 1 line
are there any active developers for this driver?
Quoted 8 lines
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/line6directory, then apply Chris' cleanup patches, and work on it further.
Quoted 4 lines
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
At Mon, 12 Jan 2015 17:35:01 +0100,
Quoted 42 lines · Takashi Iwai
At Sun, 11 Jan 2015 15:04:55 -0600,
Quoted 24 lines · Chris Rorvick
Quoted 9 lines
At Fri, 9 Jan 2015 23:35:46 -0600,
Quoted 3 lines · Chris Rorvick
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.
Quoted 1 line
are there any active developers for this driver?
Quoted 8 lines
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/line6directory, then apply Chris' cleanup patches, and work on it further.
Quoted 4 lines
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
These patches look really nice. Thanks for doing this.
regards,
dan carpenter