From 888d0d421663313739a8bf93459c6ba61fd4b121 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Thu, 8 Jan 2015 17:54:13 +0200 Subject: drm/i915: add dev_to_i915 helper This will be needed by later patches, so factor it out. No functional change. v2: - s/dev_to_i915_priv/dev_to_i915/ (Jani) - don't use the helper in i915_pm_suspend (Chris) - simplify the helper (Chris) v3: - remove redundant upcasting in the helper (Daniel) Signed-off-by: Imre Deak Reviewed-by: Takashi Iwai Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_drv.c | 9 +++------ drivers/gpu/drm/i915/i915_drv.h | 5 +++++ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 574057cd1d09..cbbd23f78518 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -940,8 +940,7 @@ static int i915_pm_suspend(struct device *dev) static int i915_pm_suspend_late(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_to_i915(dev)->dev; /* * We have a suspedn ordering issue with the snd-hda driver also @@ -960,8 +959,7 @@ static int i915_pm_suspend_late(struct device *dev) static int i915_pm_resume_early(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_to_i915(dev)->dev; if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) return 0; @@ -971,8 +969,7 @@ static int i915_pm_resume_early(struct device *dev) static int i915_pm_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_to_i915(dev)->dev; if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) return 0; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index e9f891c432f8..a343f2f35dfd 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1781,6 +1781,11 @@ static inline struct drm_i915_private *to_i915(const struct drm_device *dev) return dev->dev_private; } +static inline struct drm_i915_private *dev_to_i915(struct device *dev) +{ + return to_i915(dev_get_drvdata(dev)); +} + /* Iterate over initialised rings */ #define for_each_ring(ring__, dev_priv__, i__) \ for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \ -- cgit v1.2.3 From 58fddc288b5cec192ad9eb9221da7ed14d974a27 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Thu, 8 Jan 2015 17:54:14 +0200 Subject: drm/i915: add component support Register a component to be used to interface with the snd_hda_intel driver. This is meant to replace the same interface that is currently based on module symbol lookup. v2: - change roles between the hda and i915 components (Daniel) - add the implementation to a new file (Jani) - use better namespacing (Jani) v3: - move the implementation to intel_audio.c (Daniel) - rename display_component to audio_component (Daniel) - add kerneldoc (Daniel) v4: - run forgotten git rm i915_component.c (Jani) Signed-off-by: Imre Deak Reviewed-by: Takashi Iwai Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_dma.c | 4 ++ drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/intel_audio.c | 110 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 + 4 files changed, 119 insertions(+) (limited to 'drivers') diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index ecee3bcc8772..26b3199e0af2 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -830,6 +830,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) intel_runtime_pm_enable(dev_priv); + i915_audio_component_init(dev_priv); + return 0; out_power_well: @@ -870,6 +872,8 @@ int i915_driver_unload(struct drm_device *dev) struct drm_i915_private *dev_priv = dev->dev_private; int ret; + i915_audio_component_cleanup(dev_priv); + ret = i915_gem_suspend(dev); if (ret) { DRM_ERROR("failed to idle hardware: %d\n", ret); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a343f2f35dfd..176afc507f7c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1698,6 +1698,9 @@ struct drm_i915_private { struct drm_property *broadcast_rgb_property; struct drm_property *force_audio_property; + /* hda/i915 audio component */ + bool audio_component_registered; + uint32_t hw_context_size; struct list_head context_list; diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index 2c7ed5cb29c0..ee41b882e71a 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -22,6 +22,9 @@ */ #include +#include +#include +#include "intel_drv.h" #include #include @@ -461,3 +464,110 @@ void intel_init_audio(struct drm_device *dev) dev_priv->display.audio_codec_disable = ilk_audio_codec_disable; } } + +static void i915_audio_component_get_power(struct device *dev) +{ + intel_display_power_get(dev_to_i915(dev), POWER_DOMAIN_AUDIO); +} + +static void i915_audio_component_put_power(struct device *dev) +{ + intel_display_power_put(dev_to_i915(dev), POWER_DOMAIN_AUDIO); +} + +/* Get CDCLK in kHz */ +static int i915_audio_component_get_cdclk_freq(struct device *dev) +{ + struct drm_i915_private *dev_priv = dev_to_i915(dev); + int ret; + + if (WARN_ON_ONCE(!HAS_DDI(dev_priv))) + return -ENODEV; + + intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); + ret = intel_ddi_get_cdclk_freq(dev_priv); + intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); + + return ret; +} + +static const struct i915_audio_component_ops i915_audio_component_ops = { + .owner = THIS_MODULE, + .get_power = i915_audio_component_get_power, + .put_power = i915_audio_component_put_power, + .get_cdclk_freq = i915_audio_component_get_cdclk_freq, +}; + +static int i915_audio_component_bind(struct device *i915_dev, + struct device *hda_dev, void *data) +{ + struct i915_audio_component *acomp = data; + + if (WARN_ON(acomp->ops || acomp->dev)) + return -EEXIST; + + acomp->ops = &i915_audio_component_ops; + acomp->dev = i915_dev; + + return 0; +} + +static void i915_audio_component_unbind(struct device *i915_dev, + struct device *hda_dev, void *data) +{ + struct i915_audio_component *acomp = data; + + acomp->ops = NULL; + acomp->dev = NULL; +} + +static const struct component_ops i915_audio_component_bind_ops = { + .bind = i915_audio_component_bind, + .unbind = i915_audio_component_unbind, +}; + +/** + * i915_audio_component_init - initialize and register the audio component + * @dev_priv: i915 device instance + * + * This will register with the component framework a child component which + * will bind dynamically to the snd_hda_intel driver's corresponding master + * component when the latter is registered. During binding the child + * initializes an instance of struct i915_audio_component which it receives + * from the master. The master can then start to use the interface defined by + * this struct. Each side can break the binding at any point by deregistering + * its own component after which each side's component unbind callback is + * called. + * + * We ignore any error during registration and continue with reduced + * functionality (i.e. without HDMI audio). + */ +void i915_audio_component_init(struct drm_i915_private *dev_priv) +{ + int ret; + + ret = component_add(dev_priv->dev->dev, &i915_audio_component_bind_ops); + if (ret < 0) { + DRM_ERROR("failed to add audio component (%d)\n", ret); + /* continue with reduced functionality */ + return; + } + + dev_priv->audio_component_registered = true; +} + +/** + * i915_audio_component_cleanup - deregister the audio component + * @dev_priv: i915 device instance + * + * Deregisters the audio component, breaking any existing binding to the + * corresponding snd_hda_intel driver's master component. + */ +void i915_audio_component_cleanup(struct drm_i915_private *dev_priv) +{ + if (!dev_priv->audio_component_registered) + return; + + component_del(dev_priv->dev->dev, &i915_audio_component_bind_ops); + dev_priv->audio_component_registered = false; +} diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 25fdbb16d4e0..e88fd5d12f05 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -872,6 +872,8 @@ void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire); void intel_init_audio(struct drm_device *dev); void intel_audio_codec_enable(struct intel_encoder *encoder); void intel_audio_codec_disable(struct intel_encoder *encoder); +void i915_audio_component_init(struct drm_i915_private *dev_priv); +void i915_audio_component_cleanup(struct drm_i915_private *dev_priv); /* intel_display.c */ const char *intel_output_name(int output); -- cgit v1.2.3 From fcf3aac5fc307f0cae429f5844ddc25761662858 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Thu, 8 Jan 2015 17:54:18 +0200 Subject: drm/i915: remove unused power_well/get_cdclk_freq api After switching to using the component interface this API isn't needed any more. v2-3: unchanged v4: - move the removal of i915_powerwell.h to this patch (Takashi) Signed-off-by: Imre Deak Reviewed-by: Takashi Iwai Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_runtime_pm.c | 56 --------------------------------- 1 file changed, 56 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c index ac6da7102fbb..39ddf40171bf 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.c +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c @@ -31,7 +31,6 @@ #include "i915_drv.h" #include "intel_drv.h" -#include /** * DOC: runtime pm @@ -50,8 +49,6 @@ * present for a given platform. */ -static struct i915_power_domains *hsw_pwr; - #define for_each_power_well(i, power_well, domain_mask, power_domains) \ for (i = 0; \ i < (power_domains)->power_well_count && \ @@ -1071,10 +1068,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv) */ if (IS_HASWELL(dev_priv->dev)) { set_power_wells(power_domains, hsw_power_wells); - hsw_pwr = power_domains; } else if (IS_BROADWELL(dev_priv->dev)) { set_power_wells(power_domains, bdw_power_wells); - hsw_pwr = power_domains; } else if (IS_CHERRYVIEW(dev_priv->dev)) { set_power_wells(power_domains, chv_power_wells); } else if (IS_VALLEYVIEW(dev_priv->dev)) { @@ -1118,8 +1113,6 @@ void intel_power_domains_fini(struct drm_i915_private *dev_priv) * the power well is not enabled, so just enable it in case * we're going to unload/reload. */ intel_display_set_init_power(dev_priv, true); - - hsw_pwr = NULL; } static void intel_power_domains_resume(struct drm_i915_private *dev_priv) @@ -1328,52 +1321,3 @@ void intel_runtime_pm_enable(struct drm_i915_private *dev_priv) pm_runtime_put_autosuspend(device); } -/* Display audio driver power well request */ -int i915_request_power_well(void) -{ - struct drm_i915_private *dev_priv; - - if (!hsw_pwr) - return -ENODEV; - - dev_priv = container_of(hsw_pwr, struct drm_i915_private, - power_domains); - intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); - return 0; -} -EXPORT_SYMBOL_GPL(i915_request_power_well); - -/* Display audio driver power well release */ -int i915_release_power_well(void) -{ - struct drm_i915_private *dev_priv; - - if (!hsw_pwr) - return -ENODEV; - - dev_priv = container_of(hsw_pwr, struct drm_i915_private, - power_domains); - intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); - return 0; -} -EXPORT_SYMBOL_GPL(i915_release_power_well); - -/* - * Private interface for the audio driver to get CDCLK in kHz. - * - * Caller must request power well using i915_request_power_well() prior to - * making the call. - */ -int i915_get_cdclk_freq(void) -{ - struct drm_i915_private *dev_priv; - - if (!hsw_pwr) - return -ENODEV; - - dev_priv = container_of(hsw_pwr, struct drm_i915_private, - power_domains); - - return intel_ddi_get_cdclk_freq(dev_priv); -} -EXPORT_SYMBOL_GPL(i915_get_cdclk_freq); -- cgit v1.2.3 From a248ce068f560ece6b72eb75b54380e3d800cbab Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Mon, 12 Jan 2015 12:42:34 -0800 Subject: staging: line6: toneport.c: Fix for possible null pointer dereference The NULL check was done to late, and there it was a risk of a possible null pointer dereference. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/toneport.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index 69437158d383..660dc3f2aa61 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c @@ -433,12 +433,16 @@ void line6_toneport_reset_resume(struct usb_line6_toneport *toneport) void line6_toneport_disconnect(struct usb_interface *interface) { struct usb_line6_toneport *toneport; + struct snd_line6_pcm *line6pcm; u16 idProduct; if (interface == NULL) return; toneport = usb_get_intfdata(interface); + if (NULL == toneport) + return; + del_timer_sync(&toneport->timer); idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct); @@ -447,13 +451,10 @@ void line6_toneport_disconnect(struct usb_interface *interface) device_remove_file(&interface->dev, &dev_attr_led_green); } - if (toneport != NULL) { - struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm; - - if (line6pcm != NULL) { - line6_pcm_release(line6pcm, LINE6_BITS_PCM_MONITOR); - line6_pcm_disconnect(line6pcm); - } + line6pcm = toneport->line6.line6pcm; + if (line6pcm != NULL) { + line6_pcm_release(line6pcm, LINE6_BITS_PCM_MONITOR); + line6_pcm_disconnect(line6pcm); } toneport_destruct(interface); -- cgit v1.2.3 From 690ea44ede52e3e45eeab3b0e9704d7c3b258ae5 Mon Sep 17 00:00:00 2001 From: Jonas Lundqvist Date: Mon, 12 Jan 2015 12:42:35 -0800 Subject: Staging: line6: remove spaces before commas. Fix three space prohibited errors in pcm.h found by checkpatch.pl. Signed-off-by: Jonas Lundqvist Reviewed-by: Jeremiah Mahler Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/pcm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/pcm.h b/drivers/staging/line6/pcm.h index 6aa0d46a2890..5d87934691ec 100644 --- a/drivers/staging/line6/pcm.h +++ b/drivers/staging/line6/pcm.h @@ -145,21 +145,21 @@ enum { LINE6_BIT_PCM_IMPULSE_PLAYBACK_BUFFER | #endif LINE6_BIT_PCM_ALSA_PLAYBACK_BUFFER | - LINE6_BIT_PCM_MONITOR_PLAYBACK_BUFFER , + LINE6_BIT_PCM_MONITOR_PLAYBACK_BUFFER, LINE6_BITS_PLAYBACK_STREAM = #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE LINE6_BIT_PCM_IMPULSE_PLAYBACK_STREAM | #endif LINE6_BIT_PCM_ALSA_PLAYBACK_STREAM | - LINE6_BIT_PCM_MONITOR_PLAYBACK_STREAM , + LINE6_BIT_PCM_MONITOR_PLAYBACK_STREAM, LINE6_BITS_CAPTURE_BUFFER = #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE LINE6_BIT_PCM_IMPULSE_CAPTURE_BUFFER | #endif LINE6_BIT_PCM_ALSA_CAPTURE_BUFFER | - LINE6_BIT_PCM_MONITOR_CAPTURE_BUFFER , + LINE6_BIT_PCM_MONITOR_CAPTURE_BUFFER, LINE6_BITS_CAPTURE_STREAM = #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE -- cgit v1.2.3 From 5c3396f909aa02d0b7337258c78bd872510e837d Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:36 -0800 Subject: 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). Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- 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(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 503b2d763595..15f3bc4ddb7d 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -57,32 +57,32 @@ static const struct usb_device_id line6_id_table[] = { MODULE_DEVICE_TABLE(usb, line6_id_table); -#define L6PROP(dev_bit, dev_id, dev_name, dev_cap)\ - {.device_bit = LINE6_BIT_##dev_bit, .id = dev_id,\ +#define L6PROP(dev_id, dev_name, dev_cap)\ + {.id = dev_id,\ .name = dev_name, .capabilities = LINE6_BIT_##dev_cap} /* *INDENT-OFF* */ static const struct line6_properties line6_properties_table[] = { - L6PROP(BASSPODXT, "BassPODxt", "BassPODxt", CTRL_PCM_HW), - L6PROP(BASSPODXTLIVE, "BassPODxtLive", "BassPODxt Live", CTRL_PCM_HW), - L6PROP(BASSPODXTPRO, "BassPODxtPro", "BassPODxt Pro", CTRL_PCM_HW), - L6PROP(GUITARPORT, "GuitarPort", "GuitarPort", PCM), - L6PROP(POCKETPOD, "PocketPOD", "Pocket POD", CONTROL), - L6PROP(PODHD300, "PODHD300", "POD HD300", CTRL_PCM_HW), - L6PROP(PODHD400, "PODHD400", "POD HD400", CTRL_PCM_HW), - L6PROP(PODHD500, "PODHD500", "POD HD500", CTRL_PCM_HW), - L6PROP(PODSTUDIO_GX, "PODStudioGX", "POD Studio GX", PCM), - L6PROP(PODSTUDIO_UX1, "PODStudioUX1", "POD Studio UX1", PCM), - L6PROP(PODSTUDIO_UX2, "PODStudioUX2", "POD Studio UX2", PCM), - L6PROP(PODX3, "PODX3", "POD X3", PCM), - L6PROP(PODX3LIVE, "PODX3Live", "POD X3 Live", PCM), - L6PROP(PODXT, "PODxt", "PODxt", CTRL_PCM_HW), - L6PROP(PODXTLIVE, "PODxtLive", "PODxt Live", CTRL_PCM_HW), - L6PROP(PODXTPRO, "PODxtPro", "PODxt Pro", CTRL_PCM_HW), - L6PROP(TONEPORT_GX, "TonePortGX", "TonePort GX", PCM), - L6PROP(TONEPORT_UX1, "TonePortUX1", "TonePort UX1", PCM), - L6PROP(TONEPORT_UX2, "TonePortUX2", "TonePort UX2", PCM), - L6PROP(VARIAX, "Variax", "Variax Workbench", CONTROL), + L6PROP("BassPODxt", "BassPODxt", CTRL_PCM_HW), + L6PROP("BassPODxtLive", "BassPODxt Live", CTRL_PCM_HW), + L6PROP("BassPODxtPro", "BassPODxt Pro", CTRL_PCM_HW), + L6PROP("GuitarPort", "GuitarPort", PCM), + L6PROP("PocketPOD", "Pocket POD", CONTROL), + L6PROP("PODHD300", "POD HD300", CTRL_PCM_HW), + L6PROP("PODHD400", "POD HD400", CTRL_PCM_HW), + L6PROP("PODHD500", "POD HD500", CTRL_PCM_HW), + L6PROP("PODStudioGX", "POD Studio GX", PCM), + L6PROP("PODStudioUX1", "POD Studio UX1", PCM), + L6PROP("PODStudioUX2", "POD Studio UX2", PCM), + L6PROP("PODX3", "POD X3", PCM), + L6PROP("PODX3Live", "POD X3 Live", PCM), + L6PROP("PODxt", "PODxt", CTRL_PCM_HW), + L6PROP("PODxtLive", "PODxt Live", CTRL_PCM_HW), + L6PROP("PODxtPro", "PODxt Pro", CTRL_PCM_HW), + L6PROP("TonePortGX", "TonePort GX", PCM), + L6PROP("TonePortUX1", "TonePort UX1", PCM), + L6PROP("TonePortUX2", "TonePort UX2", PCM), + L6PROP("Variax", "Variax Workbench", CONTROL), }; /* *INDENT-ON* */ diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h index 16e3fc2f1f15..1cc7532257b6 100644 --- a/drivers/staging/line6/driver.h +++ b/drivers/staging/line6/driver.h @@ -75,11 +75,6 @@ static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4; Common properties of Line6 devices. */ 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 diff --git a/drivers/staging/line6/pcm.h b/drivers/staging/line6/pcm.h index 5d87934691ec..4f608237c006 100644 --- a/drivers/staging/line6/pcm.h +++ b/drivers/staging/line6/pcm.h @@ -98,6 +98,8 @@ enum { LINE6_INDEX_PAUSE_PLAYBACK, LINE6_INDEX_PREPARED, +#define LINE6_BIT(x) LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x + /* individual bit masks: */ LINE6_BIT(PCM_ALSA_PLAYBACK_BUFFER), LINE6_BIT(PCM_ALSA_PLAYBACK_STREAM), diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h index 2d1cc472bead..2bc2fe7bd102 100644 --- a/drivers/staging/line6/usbdefs.h +++ b/drivers/staging/line6/usbdefs.h @@ -40,65 +40,6 @@ #define LINE6_DEVID_TONEPORT_UX2 0x4142 #define LINE6_DEVID_VARIAX 0x534d -#define LINE6_BIT(x) LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x - -enum { - LINE6_INDEX_BASSPODXT, - LINE6_INDEX_BASSPODXTLIVE, - LINE6_INDEX_BASSPODXTPRO, - LINE6_INDEX_GUITARPORT, - LINE6_INDEX_POCKETPOD, - LINE6_INDEX_PODHD300, - LINE6_INDEX_PODHD400, - LINE6_INDEX_PODHD500, - LINE6_INDEX_PODSTUDIO_GX, - LINE6_INDEX_PODSTUDIO_UX1, - LINE6_INDEX_PODSTUDIO_UX2, - LINE6_INDEX_PODX3, - LINE6_INDEX_PODX3LIVE, - LINE6_INDEX_PODXT, - LINE6_INDEX_PODXTLIVE, - LINE6_INDEX_PODXTPRO, - LINE6_INDEX_TONEPORT_GX, - LINE6_INDEX_TONEPORT_UX1, - LINE6_INDEX_TONEPORT_UX2, - LINE6_INDEX_VARIAX, - - LINE6_BIT(BASSPODXT), - LINE6_BIT(BASSPODXTLIVE), - LINE6_BIT(BASSPODXTPRO), - LINE6_BIT(GUITARPORT), - LINE6_BIT(POCKETPOD), - LINE6_BIT(PODHD300), - LINE6_BIT(PODHD400), - LINE6_BIT(PODHD500), - LINE6_BIT(PODSTUDIO_GX), - LINE6_BIT(PODSTUDIO_UX1), - LINE6_BIT(PODSTUDIO_UX2), - LINE6_BIT(PODX3), - LINE6_BIT(PODX3LIVE), - LINE6_BIT(PODXT), - LINE6_BIT(PODXTLIVE), - LINE6_BIT(PODXTPRO), - LINE6_BIT(TONEPORT_GX), - LINE6_BIT(TONEPORT_UX1), - LINE6_BIT(TONEPORT_UX2), - LINE6_BIT(VARIAX), - - LINE6_BITS_PRO = LINE6_BIT_BASSPODXTPRO | LINE6_BIT_PODXTPRO, - LINE6_BITS_LIVE = LINE6_BIT_BASSPODXTLIVE | LINE6_BIT_PODXTLIVE | - LINE6_BIT_PODX3LIVE, - LINE6_BITS_PODXTALL = LINE6_BIT_PODXT | LINE6_BIT_PODXTLIVE | - LINE6_BIT_PODXTPRO, - LINE6_BITS_PODX3ALL = LINE6_BIT_PODX3 | LINE6_BIT_PODX3LIVE, - LINE6_BITS_PODHDALL = LINE6_BIT_PODHD300 | - LINE6_BIT_PODHD400 | - LINE6_BIT_PODHD500, - LINE6_BITS_BASSPODXTALL = LINE6_BIT_BASSPODXT | - LINE6_BIT_BASSPODXTLIVE | - LINE6_BIT_BASSPODXTPRO -}; - /* device supports settings parameter via USB */ #define LINE6_BIT_CONTROL (1 << 0) /* device supports PCM input/output via USB */ -- cgit v1.2.3 From c667ee1bac76f52d6fa3bd5430f471213b0e755f Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:37 -0800 Subject: staging: line6: Remove line6_pod_transmit_paramter() This function was no longer used as of commit 2807904441d4 (staging: line6: drop MIDI parameter sysfs attrs). Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/pod.c | 9 --------- drivers/staging/line6/pod.h | 2 -- 2 files changed, 11 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 44f4b2f98570..7b4ec92fe020 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -158,15 +158,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). */ diff --git a/drivers/staging/line6/pod.h b/drivers/staging/line6/pod.h index 3e3f1671337a..397d94c559f7 100644 --- a/drivers/staging/line6/pod.h +++ b/drivers/staging/line6/pod.h @@ -96,7 +96,5 @@ extern void line6_pod_disconnect(struct usb_interface *interface); extern int line6_pod_init(struct usb_interface *interface, struct usb_line6_pod *pod); extern void line6_pod_process_message(struct usb_line6_pod *pod); -extern void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param, - u8 value); #endif -- cgit v1.2.3 From e45bfe5e7c6d8563cad171df052218baa6226fc2 Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:38 -0800 Subject: staging: line6: Remove unsupported X3 devices Support for these devices appears to have never been completed. Remove them from the device table along with a minimal amount of supporting code. Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/driver.c | 26 -------------------------- drivers/staging/line6/pcm.c | 2 -- drivers/staging/line6/usbdefs.h | 2 -- 3 files changed, 30 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 15f3bc4ddb7d..e40400b842a0 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -43,8 +43,6 @@ static const struct usb_device_id line6_id_table[] = { {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX)}, {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1)}, {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODX3LIVE)}, {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT)}, {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE)}, {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO)}, @@ -74,8 +72,6 @@ static const struct line6_properties line6_properties_table[] = { L6PROP("PODStudioGX", "POD Studio GX", PCM), L6PROP("PODStudioUX1", "POD Studio UX1", PCM), L6PROP("PODStudioUX2", "POD Studio UX2", PCM), - L6PROP("PODX3", "POD X3", PCM), - L6PROP("PODX3Live", "POD X3 Live", PCM), L6PROP("PODxt", "PODxt", CTRL_PCM_HW), L6PROP("PODxtLive", "PODxt Live", CTRL_PCM_HW), L6PROP("PODxtPro", "PODxt Pro", CTRL_PCM_HW), @@ -673,8 +669,6 @@ static int line6_probe(struct usb_interface *interface, break; case LINE6_DEVID_PODHD500: - case LINE6_DEVID_PODX3: - case LINE6_DEVID_PODX3LIVE: switch (interface_number) { case 0: alternate = 1; @@ -765,14 +759,6 @@ static int line6_probe(struct usb_interface *interface, ep_write = 0x02; break; - case LINE6_DEVID_PODX3: - case LINE6_DEVID_PODX3LIVE: - /* currently unused! */ - size = sizeof(struct usb_line6_pod); - ep_read = 0x81; - ep_write = 0x01; - break; - case LINE6_DEVID_PODSTUDIO_GX: case LINE6_DEVID_PODSTUDIO_UX1: case LINE6_DEVID_PODSTUDIO_UX2: @@ -898,8 +884,6 @@ static int line6_probe(struct usb_interface *interface, case LINE6_DEVID_BASSPODXTLIVE: case LINE6_DEVID_BASSPODXTPRO: case LINE6_DEVID_POCKETPOD: - case LINE6_DEVID_PODX3: - case LINE6_DEVID_PODX3LIVE: case LINE6_DEVID_PODXT: case LINE6_DEVID_PODXTPRO: ret = line6_pod_init(interface, (struct usb_line6_pod *)line6); @@ -971,14 +955,6 @@ static int line6_probe(struct usb_interface *interface, dev_info(&interface->dev, "Line6 %s now attached\n", line6->properties->name); - switch (product) { - case LINE6_DEVID_PODX3: - case LINE6_DEVID_PODX3LIVE: - dev_info(&interface->dev, - "NOTE: the Line6 %s is detected, but not yet supported\n", - line6->properties->name); - } - /* increment reference counters: */ usb_get_intf(interface); usb_get_dev(usbdev); @@ -1026,8 +1002,6 @@ static void line6_disconnect(struct usb_interface *interface) case LINE6_DEVID_BASSPODXTLIVE: case LINE6_DEVID_BASSPODXTPRO: case LINE6_DEVID_POCKETPOD: - case LINE6_DEVID_PODX3: - case LINE6_DEVID_PODX3LIVE: case LINE6_DEVID_PODXT: case LINE6_DEVID_PODXTPRO: line6_pod_disconnect(interface); diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c index a3136b189ee5..076c87b689d0 100644 --- a/drivers/staging/line6/pcm.c +++ b/drivers/staging/line6/pcm.c @@ -442,8 +442,6 @@ int line6_init_pcm(struct usb_line6 *line6, break; case LINE6_DEVID_PODHD500: - case LINE6_DEVID_PODX3: - case LINE6_DEVID_PODX3LIVE: ep_read = 0x86; ep_write = 0x02; break; diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h index 2bc2fe7bd102..06bf909620e9 100644 --- a/drivers/staging/line6/usbdefs.h +++ b/drivers/staging/line6/usbdefs.h @@ -30,8 +30,6 @@ #define LINE6_DEVID_PODSTUDIO_GX 0x4153 #define LINE6_DEVID_PODSTUDIO_UX1 0x4150 #define LINE6_DEVID_PODSTUDIO_UX2 0x4151 -#define LINE6_DEVID_PODX3 0x414a -#define LINE6_DEVID_PODX3LIVE 0x414b #define LINE6_DEVID_PODXT 0x5044 #define LINE6_DEVID_PODXTLIVE 0x4650 #define LINE6_DEVID_PODXTPRO 0x5050 -- cgit v1.2.3 From daf54a59f37cb156f4d3044810ac4fe2fdb2b208 Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:39 -0800 Subject: staging: line6: Cleanup device table Wrap USB_DEVICE to avoid repeating the Line 6 vendor ID. Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/driver.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index e40400b842a0..a263bce95414 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -30,27 +30,29 @@ #define DRIVER_DESC "Line6 USB Driver" #define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION +#define LINE6_DEVICE(prod) USB_DEVICE(LINE6_VENDOR_ID, prod) + /* table of devices that work with this driver */ static const struct usb_device_id line6_id_table[] = { - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXT)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTLIVE)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD300)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD400)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD500)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXT)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTLIVE)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODXTPRO)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_GX)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2)}, - {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX)}, - {}, + { LINE6_DEVICE(LINE6_DEVID_BASSPODXT) }, + { LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE) }, + { LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO) }, + { LINE6_DEVICE(LINE6_DEVID_GUITARPORT) }, + { LINE6_DEVICE(LINE6_DEVID_POCKETPOD) }, + { LINE6_DEVICE(LINE6_DEVID_PODHD300) }, + { LINE6_DEVICE(LINE6_DEVID_PODHD400) }, + { LINE6_DEVICE(LINE6_DEVID_PODHD500) }, + { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX) }, + { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1) }, + { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2) }, + { LINE6_DEVICE(LINE6_DEVID_PODXT) }, + { LINE6_DEVICE(LINE6_DEVID_PODXTLIVE) }, + { LINE6_DEVICE(LINE6_DEVID_PODXTPRO) }, + { LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX) }, + { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1) }, + { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2) }, + { LINE6_DEVICE(LINE6_DEVID_VARIAX) }, + {} }; MODULE_DEVICE_TABLE(usb, line6_id_table); -- cgit v1.2.3 From 410dca8d99ae508078c90414b19f1758c1b4d6fd Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:40 -0800 Subject: staging: line6: Define a device type enum Define an enum containing the supported devices and associate each entry in the device table to the respective value. Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/driver.c | 54 ++++++++++++++++++++++++++++-------------- drivers/staging/line6/driver.h | 21 ++++++++++++++++ 2 files changed, 57 insertions(+), 18 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index a263bce95414..2797e4132cfa 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -34,24 +34,42 @@ /* table of devices that work with this driver */ static const struct usb_device_id line6_id_table[] = { - { LINE6_DEVICE(LINE6_DEVID_BASSPODXT) }, - { LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE) }, - { LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO) }, - { LINE6_DEVICE(LINE6_DEVID_GUITARPORT) }, - { LINE6_DEVICE(LINE6_DEVID_POCKETPOD) }, - { LINE6_DEVICE(LINE6_DEVID_PODHD300) }, - { LINE6_DEVICE(LINE6_DEVID_PODHD400) }, - { LINE6_DEVICE(LINE6_DEVID_PODHD500) }, - { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX) }, - { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1) }, - { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2) }, - { LINE6_DEVICE(LINE6_DEVID_PODXT) }, - { LINE6_DEVICE(LINE6_DEVID_PODXTLIVE) }, - { LINE6_DEVICE(LINE6_DEVID_PODXTPRO) }, - { LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX) }, - { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1) }, - { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2) }, - { LINE6_DEVICE(LINE6_DEVID_VARIAX) }, + { LINE6_DEVICE(LINE6_DEVID_BASSPODXT), + .driver_info = LINE6_BASSPODXT }, + { LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE), + .driver_info = LINE6_BASSPODXTLIVE }, + { LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO), + .driver_info = LINE6_BASSPODXTPRO }, + { LINE6_DEVICE(LINE6_DEVID_GUITARPORT), + .driver_info = LINE6_GUITARPORT }, + { LINE6_DEVICE(LINE6_DEVID_POCKETPOD), + .driver_info = LINE6_POCKETPOD }, + { LINE6_DEVICE(LINE6_DEVID_PODHD300), + .driver_info = LINE6_PODHD300 }, + { LINE6_DEVICE(LINE6_DEVID_PODHD400), + .driver_info = LINE6_PODHD400 }, + { LINE6_DEVICE(LINE6_DEVID_PODHD500), + .driver_info = LINE6_PODHD500 }, + { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX), + .driver_info = LINE6_PODSTUDIO_GX }, + { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1), + .driver_info = LINE6_PODSTUDIO_UX1 }, + { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2), + .driver_info = LINE6_PODSTUDIO_UX2 }, + { LINE6_DEVICE(LINE6_DEVID_PODXT), + .driver_info = LINE6_PODXT }, + { LINE6_DEVICE(LINE6_DEVID_PODXTLIVE), + .driver_info = LINE6_PODXTLIVE }, + { LINE6_DEVICE(LINE6_DEVID_PODXTPRO), + .driver_info = LINE6_PODXTPRO }, + { LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX), + .driver_info = LINE6_TONEPORT_GX }, + { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1), + .driver_info = LINE6_TONEPORT_UX1 }, + { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2), + .driver_info = LINE6_TONEPORT_UX2 }, + { LINE6_DEVICE(LINE6_DEVID_VARIAX), + .driver_info = LINE6_VARIAX }, {} }; diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h index 1cc7532257b6..8fb4a9c073b2 100644 --- a/drivers/staging/line6/driver.h +++ b/drivers/staging/line6/driver.h @@ -20,6 +20,27 @@ #define DRIVER_NAME "line6usb" +enum line6_device_type { + LINE6_BASSPODXT, + LINE6_BASSPODXTLIVE, + LINE6_BASSPODXTPRO, + LINE6_GUITARPORT, + LINE6_POCKETPOD, + LINE6_PODHD300, + LINE6_PODHD400, + LINE6_PODHD500, + LINE6_PODSTUDIO_GX, + LINE6_PODSTUDIO_UX1, + LINE6_PODSTUDIO_UX2, + LINE6_PODXT, + LINE6_PODXTLIVE, + LINE6_PODXTPRO, + LINE6_TONEPORT_GX, + LINE6_TONEPORT_UX1, + LINE6_TONEPORT_UX2, + LINE6_VARIAX +}; + #define LINE6_TIMEOUT 1 #define LINE6_BUFSIZE_LISTEN 32 #define LINE6_MESSAGE_MAXLEN 256 -- cgit v1.2.3 From c33a20b71daf7e7d0d5746200621867ae44d09e9 Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:41 -0800 Subject: staging: line6: Index properties array with device type The current logic uses the index of the matched entry from the device table as an offset to the corresponding properties entry. The values of the new `line6_device_type' enum are ordered such that they can be used as an index into either of these arrays. Drop the device entry lookup logic and use the device type (via the .driver_info member) instead. Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/driver.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 2797e4132cfa..c090b2bb1729 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -624,7 +624,7 @@ static void line6_destruct(struct usb_interface *interface) static int line6_probe(struct usb_interface *interface, const struct usb_device_id *id) { - int devtype; + enum line6_device_type devtype; struct usb_device *usbdev; struct usb_line6 *line6; const struct line6_properties *properties; @@ -646,20 +646,7 @@ static int line6_probe(struct usb_interface *interface, goto err_put; } - /* check vendor and product id */ - for (devtype = ARRAY_SIZE(line6_id_table) - 1; devtype--;) { - u16 idVendor = le16_to_cpu(usbdev->descriptor.idVendor); - u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct); - - if (idVendor == line6_id_table[devtype].idVendor && - idProduct == line6_id_table[devtype].idProduct) - break; - } - - if (devtype < 0) { - ret = -ENODEV; - goto err_put; - } + devtype = id->driver_info; /* initialize device info: */ properties = &line6_properties_table[devtype]; -- cgit v1.2.3 From a23a8bff1535ddf2f7b9f358f3eb47973d757c54 Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:42 -0800 Subject: staging: line6: Key off of device type The driver currently uses the device's idProduct as input to several switch statements. In some cases this is not sufficiently granular and the interface number must be taken into account. Store the device type in `usb_line6' and key off of it instead. New types can then be added that map to specific interfaces on the device so that this conditional logic can be flattened out. Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- 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(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index c090b2bb1729..81d5a27421cb 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -363,23 +363,23 @@ static void line6_data_received(struct urb *urb) line6->message_length = done; line6_midi_receive(line6, line6->buffer_message, done); - switch (le16_to_cpu(line6->usbdev->descriptor.idProduct)) { - case LINE6_DEVID_BASSPODXT: - case LINE6_DEVID_BASSPODXTLIVE: - case LINE6_DEVID_BASSPODXTPRO: - case LINE6_DEVID_PODXT: - case LINE6_DEVID_PODXTPRO: - case LINE6_DEVID_POCKETPOD: + switch (line6->type) { + case LINE6_BASSPODXT: + case LINE6_BASSPODXTLIVE: + case LINE6_BASSPODXTPRO: + case LINE6_PODXT: + case LINE6_PODXTPRO: + case LINE6_POCKETPOD: line6_pod_process_message((struct usb_line6_pod *) line6); break; - case LINE6_DEVID_PODHD300: - case LINE6_DEVID_PODHD400: - case LINE6_DEVID_PODHD500: + case LINE6_PODHD300: + case LINE6_PODHD400: + case LINE6_PODHD500: break; /* let userspace handle MIDI */ - case LINE6_DEVID_PODXTLIVE: + case LINE6_PODXTLIVE: switch (line6->interface_number) { case PODXTLIVE_INTERFACE_POD: line6_pod_process_message((struct usb_line6_pod @@ -399,7 +399,7 @@ static void line6_data_received(struct urb *urb) } break; - case LINE6_DEVID_VARIAX: + case LINE6_VARIAX: line6_variax_process_message((struct usb_line6_variax *) line6); break; @@ -629,7 +629,6 @@ static int line6_probe(struct usb_interface *interface, struct usb_line6 *line6; const struct line6_properties *properties; int interface_number, alternate = 0; - int product; int size = 0; int ep_read = 0, ep_write = 0; int ret; @@ -651,19 +650,18 @@ static int line6_probe(struct usb_interface *interface, /* initialize device info: */ properties = &line6_properties_table[devtype]; dev_info(&interface->dev, "Line6 %s found\n", properties->name); - product = le16_to_cpu(usbdev->descriptor.idProduct); /* query interface number */ interface_number = interface->cur_altsetting->desc.bInterfaceNumber; - switch (product) { - case LINE6_DEVID_BASSPODXTLIVE: - case LINE6_DEVID_PODXTLIVE: - case LINE6_DEVID_VARIAX: + switch (devtype) { + case LINE6_BASSPODXTLIVE: + case LINE6_PODXTLIVE: + case LINE6_VARIAX: alternate = 1; break; - case LINE6_DEVID_POCKETPOD: + case LINE6_POCKETPOD: switch (interface_number) { case 0: return -ENODEV; /* this interface has no endpoints */ @@ -675,7 +673,7 @@ static int line6_probe(struct usb_interface *interface, } break; - case LINE6_DEVID_PODHD500: + case LINE6_PODHD500: switch (interface_number) { case 0: alternate = 1; @@ -688,25 +686,25 @@ static int line6_probe(struct usb_interface *interface, } break; - case LINE6_DEVID_BASSPODXT: - case LINE6_DEVID_BASSPODXTPRO: - case LINE6_DEVID_PODXT: - case LINE6_DEVID_PODXTPRO: - case LINE6_DEVID_PODHD300: - case LINE6_DEVID_PODHD400: + case LINE6_BASSPODXT: + case LINE6_BASSPODXTPRO: + case LINE6_PODXT: + case LINE6_PODXTPRO: + case LINE6_PODHD300: + case LINE6_PODHD400: alternate = 5; break; - case LINE6_DEVID_GUITARPORT: - case LINE6_DEVID_PODSTUDIO_GX: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_TONEPORT_GX: - case LINE6_DEVID_TONEPORT_UX1: + case LINE6_GUITARPORT: + case LINE6_PODSTUDIO_GX: + case LINE6_PODSTUDIO_UX1: + case LINE6_TONEPORT_GX: + case LINE6_TONEPORT_UX1: alternate = 2; /* 1..4 seem to be ok */ break; - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_PODSTUDIO_UX2: + case LINE6_TONEPORT_UX2: + case LINE6_PODSTUDIO_UX2: switch (interface_number) { case 0: /* defaults to 44.1kHz, 16-bit */ @@ -735,49 +733,49 @@ static int line6_probe(struct usb_interface *interface, goto err_put; } - /* initialize device data based on product id: */ - switch (product) { - case LINE6_DEVID_BASSPODXT: - case LINE6_DEVID_BASSPODXTLIVE: - case LINE6_DEVID_BASSPODXTPRO: - case LINE6_DEVID_PODXT: - case LINE6_DEVID_PODXTPRO: + /* initialize device data based on device: */ + switch (devtype) { + case LINE6_BASSPODXT: + case LINE6_BASSPODXTLIVE: + case LINE6_BASSPODXTPRO: + case LINE6_PODXT: + case LINE6_PODXTPRO: size = sizeof(struct usb_line6_pod); ep_read = 0x84; ep_write = 0x03; break; - case LINE6_DEVID_PODHD300: - case LINE6_DEVID_PODHD400: + case LINE6_PODHD300: + case LINE6_PODHD400: size = sizeof(struct usb_line6_podhd); ep_read = 0x84; ep_write = 0x03; break; - case LINE6_DEVID_PODHD500: + case LINE6_PODHD500: size = sizeof(struct usb_line6_podhd); ep_read = 0x81; ep_write = 0x01; break; - case LINE6_DEVID_POCKETPOD: + case LINE6_POCKETPOD: size = sizeof(struct usb_line6_pod); ep_read = 0x82; ep_write = 0x02; break; - case LINE6_DEVID_PODSTUDIO_GX: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_PODSTUDIO_UX2: - case LINE6_DEVID_TONEPORT_GX: - case LINE6_DEVID_TONEPORT_UX1: - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_GUITARPORT: + case LINE6_PODSTUDIO_GX: + case LINE6_PODSTUDIO_UX1: + case LINE6_PODSTUDIO_UX2: + case LINE6_TONEPORT_GX: + case LINE6_TONEPORT_UX1: + case LINE6_TONEPORT_UX2: + case LINE6_GUITARPORT: size = sizeof(struct usb_line6_toneport); /* these don't have a control channel */ break; - case LINE6_DEVID_PODXTLIVE: + case LINE6_PODXTLIVE: switch (interface_number) { case PODXTLIVE_INTERFACE_POD: size = sizeof(struct usb_line6_pod); @@ -797,7 +795,7 @@ static int line6_probe(struct usb_interface *interface, } break; - case LINE6_DEVID_VARIAX: + case LINE6_VARIAX: size = sizeof(struct usb_line6_variax); ep_read = 0x82; ep_write = 0x01; @@ -829,7 +827,7 @@ static int line6_probe(struct usb_interface *interface, line6->ifcdev = &interface->dev; line6->ep_control_read = ep_read; line6->ep_control_write = ep_write; - line6->product = product; + line6->type = devtype; /* get data from endpoint descriptor (see usb_maxpacket): */ { @@ -885,25 +883,25 @@ static int line6_probe(struct usb_interface *interface, } } - /* initialize device data based on product id: */ - switch (product) { - case LINE6_DEVID_BASSPODXT: - case LINE6_DEVID_BASSPODXTLIVE: - case LINE6_DEVID_BASSPODXTPRO: - case LINE6_DEVID_POCKETPOD: - case LINE6_DEVID_PODXT: - case LINE6_DEVID_PODXTPRO: + /* initialize device data based on device: */ + switch (devtype) { + case LINE6_BASSPODXT: + case LINE6_BASSPODXTLIVE: + case LINE6_BASSPODXTPRO: + case LINE6_POCKETPOD: + case LINE6_PODXT: + case LINE6_PODXTPRO: ret = line6_pod_init(interface, (struct usb_line6_pod *)line6); break; - case LINE6_DEVID_PODHD300: - case LINE6_DEVID_PODHD400: - case LINE6_DEVID_PODHD500: + case LINE6_PODHD300: + case LINE6_PODHD400: + case LINE6_PODHD500: ret = line6_podhd_init(interface, (struct usb_line6_podhd *)line6); break; - case LINE6_DEVID_PODXTLIVE: + case LINE6_PODXTLIVE: switch (interface_number) { case PODXTLIVE_INTERFACE_POD: ret = @@ -926,19 +924,19 @@ static int line6_probe(struct usb_interface *interface, break; - case LINE6_DEVID_VARIAX: + case LINE6_VARIAX: ret = line6_variax_init(interface, (struct usb_line6_variax *)line6); break; - case LINE6_DEVID_PODSTUDIO_GX: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_PODSTUDIO_UX2: - case LINE6_DEVID_TONEPORT_GX: - case LINE6_DEVID_TONEPORT_UX1: - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_GUITARPORT: + case LINE6_PODSTUDIO_GX: + case LINE6_PODSTUDIO_UX1: + case LINE6_PODSTUDIO_UX2: + case LINE6_TONEPORT_GX: + case LINE6_TONEPORT_UX1: + case LINE6_TONEPORT_UX2: + case LINE6_GUITARPORT: ret = line6_toneport_init(interface, (struct usb_line6_toneport *)line6); @@ -1004,23 +1002,23 @@ static void line6_disconnect(struct usb_interface *interface) dev_err(line6->ifcdev, "driver bug: inconsistent usb device\n"); - switch (le16_to_cpu(line6->usbdev->descriptor.idProduct)) { - case LINE6_DEVID_BASSPODXT: - case LINE6_DEVID_BASSPODXTLIVE: - case LINE6_DEVID_BASSPODXTPRO: - case LINE6_DEVID_POCKETPOD: - case LINE6_DEVID_PODXT: - case LINE6_DEVID_PODXTPRO: + switch (line6->type) { + case LINE6_BASSPODXT: + case LINE6_BASSPODXTLIVE: + case LINE6_BASSPODXTPRO: + case LINE6_POCKETPOD: + case LINE6_PODXT: + case LINE6_PODXTPRO: line6_pod_disconnect(interface); break; - case LINE6_DEVID_PODHD300: - case LINE6_DEVID_PODHD400: - case LINE6_DEVID_PODHD500: + case LINE6_PODHD300: + case LINE6_PODHD400: + case LINE6_PODHD500: line6_podhd_disconnect(interface); break; - case LINE6_DEVID_PODXTLIVE: + case LINE6_PODXTLIVE: switch (interface_number) { case PODXTLIVE_INTERFACE_POD: line6_pod_disconnect(interface); @@ -1033,17 +1031,17 @@ static void line6_disconnect(struct usb_interface *interface) break; - case LINE6_DEVID_VARIAX: + case LINE6_VARIAX: line6_variax_disconnect(interface); break; - case LINE6_DEVID_PODSTUDIO_GX: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_PODSTUDIO_UX2: - case LINE6_DEVID_TONEPORT_GX: - case LINE6_DEVID_TONEPORT_UX1: - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_GUITARPORT: + case LINE6_PODSTUDIO_GX: + case LINE6_PODSTUDIO_UX1: + case LINE6_PODSTUDIO_UX2: + case LINE6_TONEPORT_GX: + case LINE6_TONEPORT_UX1: + case LINE6_TONEPORT_UX2: + case LINE6_GUITARPORT: line6_toneport_disconnect(interface); break; @@ -1107,15 +1105,18 @@ static int line6_reset_resume(struct usb_interface *interface) { struct usb_line6 *line6 = usb_get_intfdata(interface); - switch (le16_to_cpu(line6->usbdev->descriptor.idProduct)) { - case LINE6_DEVID_PODSTUDIO_GX: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_PODSTUDIO_UX2: - case LINE6_DEVID_TONEPORT_GX: - case LINE6_DEVID_TONEPORT_UX1: - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_GUITARPORT: + switch (line6->type) { + case LINE6_PODSTUDIO_GX: + case LINE6_PODSTUDIO_UX1: + case LINE6_PODSTUDIO_UX2: + case LINE6_TONEPORT_GX: + case LINE6_TONEPORT_UX1: + case LINE6_TONEPORT_UX2: + case LINE6_GUITARPORT: line6_toneport_reset_resume((struct usb_line6_toneport *)line6); + + default: + break; } return line6_resume(interface); diff --git a/drivers/staging/line6/driver.h b/drivers/staging/line6/driver.h index 8fb4a9c073b2..c5367951a22c 100644 --- a/drivers/staging/line6/driver.h +++ b/drivers/staging/line6/driver.h @@ -126,9 +126,9 @@ struct usb_line6 { struct usb_device *usbdev; /** - Product id. + Device type. */ - int product; + enum line6_device_type type; /** Properties. diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c index 076c87b689d0..86c7bcba7ad6 100644 --- a/drivers/staging/line6/pcm.c +++ b/drivers/staging/line6/pcm.c @@ -427,37 +427,37 @@ int line6_init_pcm(struct usb_line6 *line6, if (!(line6->properties->capabilities & LINE6_BIT_PCM)) return 0; /* skip PCM initialization and report success */ - /* initialize PCM subsystem based on product id: */ - switch (line6->product) { - case LINE6_DEVID_BASSPODXT: - case LINE6_DEVID_BASSPODXTLIVE: - case LINE6_DEVID_BASSPODXTPRO: - case LINE6_DEVID_PODXT: - case LINE6_DEVID_PODXTLIVE: - case LINE6_DEVID_PODXTPRO: - case LINE6_DEVID_PODHD300: - case LINE6_DEVID_PODHD400: + /* initialize PCM subsystem based on device: */ + switch (line6->type) { + case LINE6_BASSPODXT: + case LINE6_BASSPODXTLIVE: + case LINE6_BASSPODXTPRO: + case LINE6_PODXT: + case LINE6_PODXTLIVE: + case LINE6_PODXTPRO: + case LINE6_PODHD300: + case LINE6_PODHD400: ep_read = 0x82; ep_write = 0x01; break; - case LINE6_DEVID_PODHD500: + case LINE6_PODHD500: ep_read = 0x86; ep_write = 0x02; break; - case LINE6_DEVID_POCKETPOD: + case LINE6_POCKETPOD: ep_read = 0x82; ep_write = 0x02; break; - case LINE6_DEVID_GUITARPORT: - case LINE6_DEVID_PODSTUDIO_GX: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_PODSTUDIO_UX2: - case LINE6_DEVID_TONEPORT_GX: - case LINE6_DEVID_TONEPORT_UX1: - case LINE6_DEVID_TONEPORT_UX2: + case LINE6_GUITARPORT: + case LINE6_PODSTUDIO_GX: + case LINE6_PODSTUDIO_UX1: + case LINE6_PODSTUDIO_UX2: + case LINE6_TONEPORT_GX: + case LINE6_TONEPORT_UX1: + case LINE6_TONEPORT_UX2: ep_read = 0x82; ep_write = 0x01; break; diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index 660dc3f2aa61..9e5cee18b542 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c @@ -97,11 +97,11 @@ static const struct { {"Inst & Mic", 0x0901} }; -static bool toneport_has_led(short product) +static bool toneport_has_led(enum line6_device_type type) { return - (product == LINE6_DEVID_GUITARPORT) || - (product == LINE6_DEVID_TONEPORT_GX); + (type == LINE6_GUITARPORT) || + (type == LINE6_TONEPORT_GX); /* add your device here if you are missing support for the LEDs */ } @@ -310,7 +310,6 @@ static void toneport_setup(struct usb_line6_toneport *toneport) int ticks; struct usb_line6 *line6 = &toneport->line6; struct usb_device *usbdev = line6->usbdev; - u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct); /* sync time on device with host: */ ticks = (int)get_seconds(); @@ -320,17 +319,19 @@ static void toneport_setup(struct usb_line6_toneport *toneport) toneport_send_cmd(usbdev, 0x0301, 0x0000); /* initialize source select: */ - switch (le16_to_cpu(usbdev->descriptor.idProduct)) { - case LINE6_DEVID_TONEPORT_UX1: - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_PODSTUDIO_UX2: + switch (line6->type) { + case LINE6_TONEPORT_UX1: + case LINE6_TONEPORT_UX2: + case LINE6_PODSTUDIO_UX1: + case LINE6_PODSTUDIO_UX2: toneport_send_cmd(usbdev, toneport_source_info[toneport->source].code, 0x0000); + default: + break; } - if (toneport_has_led(idProduct)) + if (toneport_has_led(line6->type)) toneport_update_led(&usbdev->dev); } @@ -342,8 +343,6 @@ static int toneport_try_init(struct usb_interface *interface, { int err; struct usb_line6 *line6 = &toneport->line6; - struct usb_device *usbdev = line6->usbdev; - u16 idProduct = le16_to_cpu(usbdev->descriptor.idProduct); if ((interface == NULL) || (toneport == NULL)) return -ENODEV; @@ -366,17 +365,20 @@ static int toneport_try_init(struct usb_interface *interface, return err; /* register source select control: */ - switch (le16_to_cpu(usbdev->descriptor.idProduct)) { - case LINE6_DEVID_TONEPORT_UX1: - case LINE6_DEVID_TONEPORT_UX2: - case LINE6_DEVID_PODSTUDIO_UX1: - case LINE6_DEVID_PODSTUDIO_UX2: + switch (line6->type) { + case LINE6_TONEPORT_UX1: + case LINE6_TONEPORT_UX2: + case LINE6_PODSTUDIO_UX1: + case LINE6_PODSTUDIO_UX2: err = snd_ctl_add(line6->card, snd_ctl_new1(&toneport_control_source, line6->line6pcm)); if (err < 0) return err; + + default: + break; } /* register audio system: */ @@ -387,7 +389,7 @@ static int toneport_try_init(struct usb_interface *interface, line6_read_serial_number(line6, &toneport->serial_number); line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1); - if (toneport_has_led(idProduct)) { + if (toneport_has_led(line6->type)) { CHECK_RETURN(device_create_file (&interface->dev, &dev_attr_led_red)); CHECK_RETURN(device_create_file @@ -434,7 +436,6 @@ void line6_toneport_disconnect(struct usb_interface *interface) { struct usb_line6_toneport *toneport; struct snd_line6_pcm *line6pcm; - u16 idProduct; if (interface == NULL) return; @@ -444,9 +445,8 @@ void line6_toneport_disconnect(struct usb_interface *interface) return; del_timer_sync(&toneport->timer); - idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct); - if (toneport_has_led(idProduct)) { + if (toneport_has_led(toneport->line6.type)) { device_remove_file(&interface->dev, &dev_attr_led_red); device_remove_file(&interface->dev, &dev_attr_led_green); } -- cgit v1.2.3 From f45be7dcc9e50b254eab2bd6373dda0b382e5ca1 Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:43 -0800 Subject: staging: line6: Remove idVendor and idProduct macros These are now only used to build the device table. Each entry in this table is already clearly documented as to what device it maps to so the macros become unnecessary indirection. Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/driver.c | 56 ++++++++++++++--------------------------- drivers/staging/line6/usbdefs.h | 24 ------------------ 2 files changed, 19 insertions(+), 61 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 81d5a27421cb..6dc8a0d4c4b6 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -30,46 +30,28 @@ #define DRIVER_DESC "Line6 USB Driver" #define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION -#define LINE6_DEVICE(prod) USB_DEVICE(LINE6_VENDOR_ID, prod) +#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod) /* table of devices that work with this driver */ static const struct usb_device_id line6_id_table[] = { - { LINE6_DEVICE(LINE6_DEVID_BASSPODXT), - .driver_info = LINE6_BASSPODXT }, - { LINE6_DEVICE(LINE6_DEVID_BASSPODXTLIVE), - .driver_info = LINE6_BASSPODXTLIVE }, - { LINE6_DEVICE(LINE6_DEVID_BASSPODXTPRO), - .driver_info = LINE6_BASSPODXTPRO }, - { LINE6_DEVICE(LINE6_DEVID_GUITARPORT), - .driver_info = LINE6_GUITARPORT }, - { LINE6_DEVICE(LINE6_DEVID_POCKETPOD), - .driver_info = LINE6_POCKETPOD }, - { LINE6_DEVICE(LINE6_DEVID_PODHD300), - .driver_info = LINE6_PODHD300 }, - { LINE6_DEVICE(LINE6_DEVID_PODHD400), - .driver_info = LINE6_PODHD400 }, - { LINE6_DEVICE(LINE6_DEVID_PODHD500), - .driver_info = LINE6_PODHD500 }, - { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_GX), - .driver_info = LINE6_PODSTUDIO_GX }, - { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX1), - .driver_info = LINE6_PODSTUDIO_UX1 }, - { LINE6_DEVICE(LINE6_DEVID_PODSTUDIO_UX2), - .driver_info = LINE6_PODSTUDIO_UX2 }, - { LINE6_DEVICE(LINE6_DEVID_PODXT), - .driver_info = LINE6_PODXT }, - { LINE6_DEVICE(LINE6_DEVID_PODXTLIVE), - .driver_info = LINE6_PODXTLIVE }, - { LINE6_DEVICE(LINE6_DEVID_PODXTPRO), - .driver_info = LINE6_PODXTPRO }, - { LINE6_DEVICE(LINE6_DEVID_TONEPORT_GX), - .driver_info = LINE6_TONEPORT_GX }, - { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX1), - .driver_info = LINE6_TONEPORT_UX1 }, - { LINE6_DEVICE(LINE6_DEVID_TONEPORT_UX2), - .driver_info = LINE6_TONEPORT_UX2 }, - { LINE6_DEVICE(LINE6_DEVID_VARIAX), - .driver_info = LINE6_VARIAX }, + { LINE6_DEVICE(0x4250), .driver_info = LINE6_BASSPODXT }, + { LINE6_DEVICE(0x4642), .driver_info = LINE6_BASSPODXTLIVE }, + { LINE6_DEVICE(0x4252), .driver_info = LINE6_BASSPODXTPRO }, + { LINE6_DEVICE(0x4750), .driver_info = LINE6_GUITARPORT }, + { LINE6_DEVICE(0x5051), .driver_info = LINE6_POCKETPOD }, + { LINE6_DEVICE(0x5057), .driver_info = LINE6_PODHD300 }, + { LINE6_DEVICE(0x5058), .driver_info = LINE6_PODHD400 }, + { LINE6_DEVICE(0x414D), .driver_info = LINE6_PODHD500 }, + { LINE6_DEVICE(0x4153), .driver_info = LINE6_PODSTUDIO_GX }, + { LINE6_DEVICE(0x4150), .driver_info = LINE6_PODSTUDIO_UX1 }, + { LINE6_DEVICE(0x4151), .driver_info = LINE6_PODSTUDIO_UX2 }, + { LINE6_DEVICE(0x5044), .driver_info = LINE6_PODXT }, + { LINE6_DEVICE(0x4650), .driver_info = LINE6_PODXTLIVE }, + { LINE6_DEVICE(0x5050), .driver_info = LINE6_PODXTPRO }, + { LINE6_DEVICE(0x4147), .driver_info = LINE6_TONEPORT_GX }, + { LINE6_DEVICE(0x4141), .driver_info = LINE6_TONEPORT_UX1 }, + { LINE6_DEVICE(0x4142), .driver_info = LINE6_TONEPORT_UX2 }, + { LINE6_DEVICE(0x534d), .driver_info = LINE6_VARIAX }, {} }; diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h index 06bf909620e9..c897dba67a3b 100644 --- a/drivers/staging/line6/usbdefs.h +++ b/drivers/staging/line6/usbdefs.h @@ -12,32 +12,8 @@ #ifndef USBDEFS_H #define USBDEFS_H -#define LINE6_VENDOR_ID 0x0e41 - #define USB_INTERVALS_PER_SECOND 1000 -/* - Device ids. -*/ -#define LINE6_DEVID_BASSPODXT 0x4250 -#define LINE6_DEVID_BASSPODXTLIVE 0x4642 -#define LINE6_DEVID_BASSPODXTPRO 0x4252 -#define LINE6_DEVID_GUITARPORT 0x4750 -#define LINE6_DEVID_POCKETPOD 0x5051 -#define LINE6_DEVID_PODHD300 0x5057 -#define LINE6_DEVID_PODHD400 0x5058 -#define LINE6_DEVID_PODHD500 0x414D -#define LINE6_DEVID_PODSTUDIO_GX 0x4153 -#define LINE6_DEVID_PODSTUDIO_UX1 0x4150 -#define LINE6_DEVID_PODSTUDIO_UX2 0x4151 -#define LINE6_DEVID_PODXT 0x5044 -#define LINE6_DEVID_PODXTLIVE 0x4650 -#define LINE6_DEVID_PODXTPRO 0x5050 -#define LINE6_DEVID_TONEPORT_GX 0x4147 -#define LINE6_DEVID_TONEPORT_UX1 0x4141 -#define LINE6_DEVID_TONEPORT_UX2 0x4142 -#define LINE6_DEVID_VARIAX 0x534d - /* device supports settings parameter via USB */ #define LINE6_BIT_CONTROL (1 << 0) /* device supports PCM input/output via USB */ -- cgit v1.2.3 From 5a8584742586373cd749335b4f7bcb983f39d34e Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:44 -0800 Subject: staging: line6: Remove useless comments Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- drivers/staging/line6/driver.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 6dc8a0d4c4b6..acde205a62ba 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -61,7 +61,6 @@ MODULE_DEVICE_TABLE(usb, line6_id_table); {.id = dev_id,\ .name = dev_name, .capabilities = LINE6_BIT_##dev_cap} -/* *INDENT-OFF* */ static const struct line6_properties line6_properties_table[] = { L6PROP("BassPODxt", "BassPODxt", CTRL_PCM_HW), L6PROP("BassPODxtLive", "BassPODxt Live", CTRL_PCM_HW), @@ -82,7 +81,6 @@ static const struct line6_properties line6_properties_table[] = { L6PROP("TonePortUX2", "TonePort UX2", PCM), L6PROP("Variax", "Variax Workbench", CONTROL), }; -/* *INDENT-ON* */ /* This is Line6's MIDI manufacturer ID. -- cgit v1.2.3 From 4cb1a4ae4afb36234bb0521b282d4861e12ff80b Mon Sep 17 00:00:00 2001 From: Chris Rorvick Date: Mon, 12 Jan 2015 12:42:45 -0800 Subject: staging: line6: Rename capability macros Including "BIT" in the macro name is pointless. Replace with "CAP" to provide some context for what its value represents. Signed-off-by: Chris Rorvick Reviewed-by: Stefan Hajnoczi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Takashi Iwai --- 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(-) (limited to 'drivers') diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index acde205a62ba..4ec87a37ace4 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -59,7 +59,7 @@ MODULE_DEVICE_TABLE(usb, line6_id_table); #define L6PROP(dev_id, dev_name, dev_cap)\ {.id = dev_id,\ - .name = dev_name, .capabilities = LINE6_BIT_##dev_cap} + .name = dev_name, .capabilities = LINE6_CAP_##dev_cap} static const struct line6_properties line6_properties_table[] = { L6PROP("BassPODxt", "BassPODxt", CTRL_PCM_HW), @@ -830,7 +830,7 @@ static int line6_probe(struct usb_interface *interface, usb_set_intfdata(interface, line6); - if (properties->capabilities & LINE6_BIT_CONTROL) { + if (properties->capabilities & LINE6_CAP_CONTROL) { /* initialize USB buffers: */ line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL); @@ -1052,7 +1052,7 @@ static int line6_suspend(struct usb_interface *interface, pm_message_t message) snd_power_change_state(line6->card, SNDRV_CTL_POWER_D3hot); - if (line6->properties->capabilities & LINE6_BIT_CONTROL) + if (line6->properties->capabilities & LINE6_CAP_CONTROL) line6_stop_listen(line6); if (line6pcm != NULL) { @@ -1071,7 +1071,7 @@ static int line6_resume(struct usb_interface *interface) { struct usb_line6 *line6 = usb_get_intfdata(interface); - if (line6->properties->capabilities & LINE6_BIT_CONTROL) + if (line6->properties->capabilities & LINE6_CAP_CONTROL) line6_start_listen(line6); snd_power_change_state(line6->card, SNDRV_CTL_POW