diff mbox

[v2,8/9] ALSA: line6: Cleanup initialization

Message ID 1471558839-14120-9-git-send-email-dev@andree.sk (mailing list archive)
State New, archived
Headers show

Commit Message

Andrej Krutak Aug. 18, 2016, 10:20 p.m. UTC
Only determine control port properties if the devices needs it.
Only initialize PCM for POD HD devices that support it.
No POD HD seems to support MIDI, thus drop the initialization.

Signed-off-by: Andrej Krutak <dev@andree.sk>
---
 sound/usb/line6/driver.c |  3 +--
 sound/usb/line6/podhd.c  | 19 ++++++++-----------
 2 files changed, 9 insertions(+), 13 deletions(-)

Comments

Takashi Iwai Aug. 24, 2016, 3:06 p.m. UTC | #1
On Fri, 19 Aug 2016 00:20:38 +0200,
Andrej Krutak wrote:
> 
> Only determine control port properties if the devices needs it.
> Only initialize PCM for POD HD devices that support it.
> No POD HD seems to support MIDI, thus drop the initialization.

This should be split to two individual patches.  They are irrelevant
with each other at all.


Takashi

> 
> Signed-off-by: Andrej Krutak <dev@andree.sk>
> ---
>  sound/usb/line6/driver.c |  3 +--
>  sound/usb/line6/podhd.c  | 19 ++++++++-----------
>  2 files changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
> index 853a143..8a71d45 100644
> --- a/sound/usb/line6/driver.c
> +++ b/sound/usb/line6/driver.c
> @@ -612,9 +612,8 @@ int line6_probe(struct usb_interface *interface,
>  		goto error;
>  	}
>  
> -	line6_get_interval(line6);
> -
>  	if (properties->capabilities & LINE6_CAP_CONTROL) {
> +		line6_get_interval(line6);
>  		ret = line6_init_cap_control(line6);
>  		if (ret < 0)
>  			goto error;
> diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
> index 8246ea5..193eb29 100644
> --- a/sound/usb/line6/podhd.c
> +++ b/sound/usb/line6/podhd.c
> @@ -314,17 +314,14 @@ static int podhd_init(struct usb_line6 *line6,
>  			return err;
>  	}
>  
> -	/* initialize MIDI subsystem: */
> -	err = line6_init_midi(line6);
> -	if (err < 0)
> -		return err;
> -
> -	/* initialize PCM subsystem: */
> -	err = line6_init_pcm(line6,
> -		(id->driver_info == LINE6_PODX3) ? &podx3_pcm_properties :
> -		&podhd_pcm_properties);
> -	if (err < 0)
> -		return err;
> +	if (pod->line6.properties->capabilities & LINE6_CAP_PCM) {
> +		/* initialize PCM subsystem: */
> +		err = line6_init_pcm(line6,
> +			(id->driver_info == LINE6_PODX3) ? &podx3_pcm_properties :
> +			&podhd_pcm_properties);
> +		if (err < 0)
> +			return err;
> +	}
>  
>  	if (!(pod->line6.properties->capabilities & LINE6_CAP_CONTROL)) {
>  		/* register USB audio system directly */
> -- 
> 1.9.1
> 
>
diff mbox

Patch

diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 853a143..8a71d45 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -612,9 +612,8 @@  int line6_probe(struct usb_interface *interface,
 		goto error;
 	}
 
-	line6_get_interval(line6);
-
 	if (properties->capabilities & LINE6_CAP_CONTROL) {
+		line6_get_interval(line6);
 		ret = line6_init_cap_control(line6);
 		if (ret < 0)
 			goto error;
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index 8246ea5..193eb29 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -314,17 +314,14 @@  static int podhd_init(struct usb_line6 *line6,
 			return err;
 	}
 
-	/* initialize MIDI subsystem: */
-	err = line6_init_midi(line6);
-	if (err < 0)
-		return err;
-
-	/* initialize PCM subsystem: */
-	err = line6_init_pcm(line6,
-		(id->driver_info == LINE6_PODX3) ? &podx3_pcm_properties :
-		&podhd_pcm_properties);
-	if (err < 0)
-		return err;
+	if (pod->line6.properties->capabilities & LINE6_CAP_PCM) {
+		/* initialize PCM subsystem: */
+		err = line6_init_pcm(line6,
+			(id->driver_info == LINE6_PODX3) ? &podx3_pcm_properties :
+			&podhd_pcm_properties);
+		if (err < 0)
+			return err;
+	}
 
 	if (!(pod->line6.properties->capabilities & LINE6_CAP_CONTROL)) {
 		/* register USB audio system directly */