All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: jack: fix a randconfig build issue
@ 2015-05-01  3:10 Jie Yang
  2015-05-01  7:10 ` Takashi Iwai
  0 siblings, 1 reply; 9+ messages in thread
From: Jie Yang @ 2015-05-01  3:10 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel, broonie, liam.r.girdwood

There may be no input_dev for jack(e.g. phantom jack), when
CONFIG_INPUT is not selected, building errors such as:
undefined reference to `input_xxx'...

Here add #ifdef judgement to fix the issue.

Signed-off-by: Jie Yang <yang.jie@intel.com>
---
 include/sound/jack.h |  2 ++
 sound/core/jack.c    | 40 ++++++++++++++++++++++++++--------------
 2 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/include/sound/jack.h b/include/sound/jack.h
index 23bede1..c1010f9 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -72,7 +72,9 @@ enum snd_jack_types {
 #define SND_JACK_SWITCH_TYPES 6
 
 struct snd_jack {
+#ifdef CONFIG_INPUT
 	struct input_dev *input_dev;
+#endif
 	struct list_head kctl_list;
 	struct snd_card *card;
 	int registered;
diff --git a/sound/core/jack.c b/sound/core/jack.c
index eb66327..3a1901e 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -32,6 +32,7 @@ struct snd_jack_kctl {
 	unsigned int mask_bits; /* only masked status bits are reported via kctl */
 };
 
+#ifdef CONFIG_INPUT
 static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
 	SW_HEADPHONE_INSERT,
 	SW_MICROPHONE_INSERT,
@@ -40,9 +41,11 @@ static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
 	SW_VIDEOOUT_INSERT,
 	SW_LINEIN_INSERT,
 };
+#endif
 
 static int snd_jack_dev_disconnect(struct snd_device *device)
 {
+#ifdef CONFIG_INPUT
 	struct snd_jack *jack = device->device_data;
 
 	if (!jack->input_dev)
@@ -54,7 +57,9 @@ static int snd_jack_dev_disconnect(struct snd_device *device)
 		input_unregister_device(jack->input_dev);
 	else
 		input_free_device(jack->input_dev);
+
 	jack->input_dev = NULL;
+#endif
 	return 0;
 }
 
@@ -83,11 +88,12 @@ static int snd_jack_dev_register(struct snd_device *device)
 {
 	struct snd_jack *jack = device->device_data;
 	struct snd_card *card = device->card;
-	int err, i;
+	int err = 0;
 
 	snprintf(jack->name, sizeof(jack->name), "%s %s",
 		 card->shortname, jack->id);
 
+#ifdef CONFIG_INPUT
 	if (!jack->input_dev)
 		return 0;
 
@@ -98,7 +104,7 @@ static int snd_jack_dev_register(struct snd_device *device)
 		jack->input_dev->dev.parent = snd_card_get_device_link(card);
 
 	/* Add capabilities for any keys that are enabled */
-	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
+	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
 		int testbit = SND_JACK_BTN_0 >> i;
 
 		if (!(jack->type & testbit))
@@ -113,6 +119,7 @@ static int snd_jack_dev_register(struct snd_device *device)
 	err = input_register_device(jack->input_dev);
 	if (err == 0)
 		jack->registered = 1;
+#endif
 
 	return err;
 }
@@ -209,7 +216,6 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
 	struct snd_jack *jack;
 	struct snd_jack_kctl *jack_kctl = NULL;
 	int err;
-	int i;
 	static struct snd_device_ops ops = {
 		.dev_free = snd_jack_dev_free,
 		.dev_register = snd_jack_dev_register,
@@ -230,26 +236,31 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
 
 	/* don't creat input device for phantom jack */
 	if (!phantom_jack) {
+#ifdef CONFIG_INPUT
 		jack->input_dev = input_allocate_device();
 		if (jack->input_dev == NULL) {
 			err = -ENOMEM;
-			goto fail_input;
+			goto error;
 		}
 
 		jack->input_dev->phys = "ALSA";
 
-		jack->type = type;
-
-		for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
+		for (int i = 0; i < SND_JACK_SWITCH_TYPES; i++)
 			if (type & (1 << i))
 				input_set_capability(jack->input_dev, EV_SW,
 						     jack_switch_types[i]);
+#endif
+		jack->type = type;
 
 	}
 
 	err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
-	if (err < 0)
-		goto fail_input;
+	if (err < 0) {
+#ifdef CONFIG_INPUT
+		input_free_device(jack->input_dev);
+#endif
+		goto error;
+	}
 
 	jack->card = card;
 	INIT_LIST_HEAD(&jack->kctl_list);
@@ -261,8 +272,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
 
 	return 0;
 
-fail_input:
-	input_free_device(jack->input_dev);
+error:
 	kfree(jack->id);
 	kfree(jack);
 	return err;
@@ -281,11 +291,13 @@ EXPORT_SYMBOL(snd_jack_new);
  */
 void snd_jack_set_parent(struct snd_jack *jack, struct device *parent)
 {
+#ifdef CONFIG_INPUT
 	WARN_ON(jack->registered);
 	if (!jack->input_dev)
 		return;
 
 	jack->input_dev->dev.parent = parent;
+#endif
 }
 EXPORT_SYMBOL(snd_jack_set_parent);
 
@@ -340,7 +352,6 @@ EXPORT_SYMBOL(snd_jack_set_key);
 void snd_jack_report(struct snd_jack *jack, int status)
 {
 	struct snd_jack_kctl *jack_kctl;
-	int i;
 
 	if (!jack)
 		return;
@@ -349,10 +360,11 @@ void snd_jack_report(struct snd_jack *jack, int status)
 		snd_kctl_jack_report(jack->card, jack_kctl->kctl,
 					    status & jack_kctl->mask_bits);
 
+#ifdef CONFIG_INPUT
 	if (!jack->input_dev)
 		return;
 
-	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
+	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
 		int testbit = SND_JACK_BTN_0 >> i;
 
 		if (jack->type & testbit)
@@ -369,7 +381,7 @@ void snd_jack_report(struct snd_jack *jack, int status)
 	}
 
 	input_sync(jack->input_dev);
-
+#endif
 }
 EXPORT_SYMBOL(snd_jack_report);
 
-- 
1.9.1

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

* Re: [PATCH] ALSA: jack: fix a randconfig build issue
  2015-05-01  3:10 [PATCH] ALSA: jack: fix a randconfig build issue Jie Yang
@ 2015-05-01  7:10 ` Takashi Iwai
  2015-05-02  4:51   ` Jie, Yang
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2015-05-01  7:10 UTC (permalink / raw)
  To: Jie Yang; +Cc: alsa-devel, broonie, liam.r.girdwood

At Fri,  1 May 2015 11:10:29 +0800,
Jie Yang wrote:
> 
> There may be no input_dev for jack(e.g. phantom jack), when
> CONFIG_INPUT is not selected, building errors such as:
> undefined reference to `input_xxx'...
> 
> Here add #ifdef judgement to fix the issue.

Well, the standard idiom so far is to enable SND_JACK selectively.
Take a look at the comment in sound/core/Kconfig.

# To be effective this also requires INPUT - users should say:
#    select SND_JACK if INPUT=y || INPUT=SND
# to avoid having to force INPUT on.
config SND_JACK
	bool

And, looking at sound/pci/hda/Kconfig, there is still
SND_HDA_INPUT_JACK.

So, what you need to fix is:
- Remove SND_HDA_INPUT_JACK from sound/pci/hda/Kconfig and the last
  ifdef in hda_codec.h
 
- Replace the line "select SND_JACK" with
	select SND_JACK if INPUT=y || INPUT=SND_HDA


thanks,

Takashi

> 
> Signed-off-by: Jie Yang <yang.jie@intel.com>
> ---
>  include/sound/jack.h |  2 ++
>  sound/core/jack.c    | 40 ++++++++++++++++++++++++++--------------
>  2 files changed, 28 insertions(+), 14 deletions(-)
> 
> diff --git a/include/sound/jack.h b/include/sound/jack.h
> index 23bede1..c1010f9 100644
> --- a/include/sound/jack.h
> +++ b/include/sound/jack.h
> @@ -72,7 +72,9 @@ enum snd_jack_types {
>  #define SND_JACK_SWITCH_TYPES 6
>  
>  struct snd_jack {
> +#ifdef CONFIG_INPUT
>  	struct input_dev *input_dev;
> +#endif
>  	struct list_head kctl_list;
>  	struct snd_card *card;
>  	int registered;
> diff --git a/sound/core/jack.c b/sound/core/jack.c
> index eb66327..3a1901e 100644
> --- a/sound/core/jack.c
> +++ b/sound/core/jack.c
> @@ -32,6 +32,7 @@ struct snd_jack_kctl {
>  	unsigned int mask_bits; /* only masked status bits are reported via kctl */
>  };
>  
> +#ifdef CONFIG_INPUT
>  static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
>  	SW_HEADPHONE_INSERT,
>  	SW_MICROPHONE_INSERT,
> @@ -40,9 +41,11 @@ static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
>  	SW_VIDEOOUT_INSERT,
>  	SW_LINEIN_INSERT,
>  };
> +#endif
>  
>  static int snd_jack_dev_disconnect(struct snd_device *device)
>  {
> +#ifdef CONFIG_INPUT
>  	struct snd_jack *jack = device->device_data;
>  
>  	if (!jack->input_dev)
> @@ -54,7 +57,9 @@ static int snd_jack_dev_disconnect(struct snd_device *device)
>  		input_unregister_device(jack->input_dev);
>  	else
>  		input_free_device(jack->input_dev);
> +
>  	jack->input_dev = NULL;
> +#endif
>  	return 0;
>  }
>  
> @@ -83,11 +88,12 @@ static int snd_jack_dev_register(struct snd_device *device)
>  {
>  	struct snd_jack *jack = device->device_data;
>  	struct snd_card *card = device->card;
> -	int err, i;
> +	int err = 0;
>  
>  	snprintf(jack->name, sizeof(jack->name), "%s %s",
>  		 card->shortname, jack->id);
>  
> +#ifdef CONFIG_INPUT
>  	if (!jack->input_dev)
>  		return 0;
>  
> @@ -98,7 +104,7 @@ static int snd_jack_dev_register(struct snd_device *device)
>  		jack->input_dev->dev.parent = snd_card_get_device_link(card);
>  
>  	/* Add capabilities for any keys that are enabled */
> -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
>  		int testbit = SND_JACK_BTN_0 >> i;
>  
>  		if (!(jack->type & testbit))
> @@ -113,6 +119,7 @@ static int snd_jack_dev_register(struct snd_device *device)
>  	err = input_register_device(jack->input_dev);
>  	if (err == 0)
>  		jack->registered = 1;
> +#endif
>  
>  	return err;
>  }
> @@ -209,7 +216,6 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
>  	struct snd_jack *jack;
>  	struct snd_jack_kctl *jack_kctl = NULL;
>  	int err;
> -	int i;
>  	static struct snd_device_ops ops = {
>  		.dev_free = snd_jack_dev_free,
>  		.dev_register = snd_jack_dev_register,
> @@ -230,26 +236,31 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
>  
>  	/* don't creat input device for phantom jack */
>  	if (!phantom_jack) {
> +#ifdef CONFIG_INPUT
>  		jack->input_dev = input_allocate_device();
>  		if (jack->input_dev == NULL) {
>  			err = -ENOMEM;
> -			goto fail_input;
> +			goto error;
>  		}
>  
>  		jack->input_dev->phys = "ALSA";
>  
> -		jack->type = type;
> -
> -		for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
> +		for (int i = 0; i < SND_JACK_SWITCH_TYPES; i++)
>  			if (type & (1 << i))
>  				input_set_capability(jack->input_dev, EV_SW,
>  						     jack_switch_types[i]);
> +#endif
> +		jack->type = type;
>  
>  	}
>  
>  	err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
> -	if (err < 0)
> -		goto fail_input;
> +	if (err < 0) {
> +#ifdef CONFIG_INPUT
> +		input_free_device(jack->input_dev);
> +#endif
> +		goto error;
> +	}
>  
>  	jack->card = card;
>  	INIT_LIST_HEAD(&jack->kctl_list);
> @@ -261,8 +272,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
>  
>  	return 0;
>  
> -fail_input:
> -	input_free_device(jack->input_dev);
> +error:
>  	kfree(jack->id);
>  	kfree(jack);
>  	return err;
> @@ -281,11 +291,13 @@ EXPORT_SYMBOL(snd_jack_new);
>   */
>  void snd_jack_set_parent(struct snd_jack *jack, struct device *parent)
>  {
> +#ifdef CONFIG_INPUT
>  	WARN_ON(jack->registered);
>  	if (!jack->input_dev)
>  		return;
>  
>  	jack->input_dev->dev.parent = parent;
> +#endif
>  }
>  EXPORT_SYMBOL(snd_jack_set_parent);
>  
> @@ -340,7 +352,6 @@ EXPORT_SYMBOL(snd_jack_set_key);
>  void snd_jack_report(struct snd_jack *jack, int status)
>  {
>  	struct snd_jack_kctl *jack_kctl;
> -	int i;
>  
>  	if (!jack)
>  		return;
> @@ -349,10 +360,11 @@ void snd_jack_report(struct snd_jack *jack, int status)
>  		snd_kctl_jack_report(jack->card, jack_kctl->kctl,
>  					    status & jack_kctl->mask_bits);
>  
> +#ifdef CONFIG_INPUT
>  	if (!jack->input_dev)
>  		return;
>  
> -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
>  		int testbit = SND_JACK_BTN_0 >> i;
>  
>  		if (jack->type & testbit)
> @@ -369,7 +381,7 @@ void snd_jack_report(struct snd_jack *jack, int status)
>  	}
>  
>  	input_sync(jack->input_dev);
> -
> +#endif
>  }
>  EXPORT_SYMBOL(snd_jack_report);
>  
> -- 
> 1.9.1
> 

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

* Re: [PATCH] ALSA: jack: fix a randconfig build issue
  2015-05-01  7:10 ` Takashi Iwai
@ 2015-05-02  4:51   ` Jie, Yang
  2015-05-02  7:01     ` Takashi Iwai
  0 siblings, 1 reply; 9+ messages in thread
From: Jie, Yang @ 2015-05-02  4:51 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, broonie, Girdwood, Liam R

> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Friday, May 01, 2015 3:11 PM
> To: Jie, Yang
> Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam R
> Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> 
> At Fri,  1 May 2015 11:10:29 +0800,
> Jie Yang wrote:
> >
> > There may be no input_dev for jack(e.g. phantom jack), when
> > CONFIG_INPUT is not selected, building errors such as:
> > undefined reference to `input_xxx'...
> >
> > Here add #ifdef judgement to fix the issue.
> 
> Well, the standard idiom so far is to enable SND_JACK selectively.
> Take a look at the comment in sound/core/Kconfig.
> 
> # To be effective this also requires INPUT - users should say:
> #    select SND_JACK if INPUT=y || INPUT=SND
> # to avoid having to force INPUT on.
> config SND_JACK
> 	bool
> 
> And, looking at sound/pci/hda/Kconfig, there is still SND_HDA_INPUT_JACK.
> 
> So, what you need to fix is:
> - Remove SND_HDA_INPUT_JACK from sound/pci/hda/Kconfig and the last
>   ifdef in hda_codec.h
> 
> - Replace the line "select SND_JACK" with
> 	select SND_JACK if INPUT=y || INPUT=SND_HDA
 
OK, will follow this. What I only concern is that if user want SND_JACk when
INPUT=N(e.g. phantom jack?), it becomes impossible.

~Keyon

> 
> 
> thanks,
> 
> Takashi
> 
> >
> > Signed-off-by: Jie Yang <yang.jie@intel.com>
> > ---
> >  include/sound/jack.h |  2 ++
> >  sound/core/jack.c    | 40 ++++++++++++++++++++++++++--------------
> >  2 files changed, 28 insertions(+), 14 deletions(-)
> >
> > diff --git a/include/sound/jack.h b/include/sound/jack.h index
> > 23bede1..c1010f9 100644
> > --- a/include/sound/jack.h
> > +++ b/include/sound/jack.h
> > @@ -72,7 +72,9 @@ enum snd_jack_types {  #define
> SND_JACK_SWITCH_TYPES
> > 6
> >
> >  struct snd_jack {
> > +#ifdef CONFIG_INPUT
> >  	struct input_dev *input_dev;
> > +#endif
> >  	struct list_head kctl_list;
> >  	struct snd_card *card;
> >  	int registered;
> > diff --git a/sound/core/jack.c b/sound/core/jack.c index
> > eb66327..3a1901e 100644
> > --- a/sound/core/jack.c
> > +++ b/sound/core/jack.c
> > @@ -32,6 +32,7 @@ struct snd_jack_kctl {
> >  	unsigned int mask_bits; /* only masked status bits are reported via
> > kctl */  };
> >
> > +#ifdef CONFIG_INPUT
> >  static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
> >  	SW_HEADPHONE_INSERT,
> >  	SW_MICROPHONE_INSERT,
> > @@ -40,9 +41,11 @@ static int
> jack_switch_types[SND_JACK_SWITCH_TYPES] = {
> >  	SW_VIDEOOUT_INSERT,
> >  	SW_LINEIN_INSERT,
> >  };
> > +#endif
> >
> >  static int snd_jack_dev_disconnect(struct snd_device *device)  {
> > +#ifdef CONFIG_INPUT
> >  	struct snd_jack *jack = device->device_data;
> >
> >  	if (!jack->input_dev)
> > @@ -54,7 +57,9 @@ static int snd_jack_dev_disconnect(struct snd_device
> *device)
> >  		input_unregister_device(jack->input_dev);
> >  	else
> >  		input_free_device(jack->input_dev);
> > +
> >  	jack->input_dev = NULL;
> > +#endif
> >  	return 0;
> >  }
> >
> > @@ -83,11 +88,12 @@ static int snd_jack_dev_register(struct snd_device
> > *device)  {
> >  	struct snd_jack *jack = device->device_data;
> >  	struct snd_card *card = device->card;
> > -	int err, i;
> > +	int err = 0;
> >
> >  	snprintf(jack->name, sizeof(jack->name), "%s %s",
> >  		 card->shortname, jack->id);
> >
> > +#ifdef CONFIG_INPUT
> >  	if (!jack->input_dev)
> >  		return 0;
> >
> > @@ -98,7 +104,7 @@ static int snd_jack_dev_register(struct snd_device
> *device)
> >  		jack->input_dev->dev.parent =
> snd_card_get_device_link(card);
> >
> >  	/* Add capabilities for any keys that are enabled */
> > -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
> >  		int testbit = SND_JACK_BTN_0 >> i;
> >
> >  		if (!(jack->type & testbit))
> > @@ -113,6 +119,7 @@ static int snd_jack_dev_register(struct snd_device
> *device)
> >  	err = input_register_device(jack->input_dev);
> >  	if (err == 0)
> >  		jack->registered = 1;
> > +#endif
> >
> >  	return err;
> >  }
> > @@ -209,7 +216,6 @@ int snd_jack_new(struct snd_card *card, const char
> *id, int type,
> >  	struct snd_jack *jack;
> >  	struct snd_jack_kctl *jack_kctl = NULL;
> >  	int err;
> > -	int i;
> >  	static struct snd_device_ops ops = {
> >  		.dev_free = snd_jack_dev_free,
> >  		.dev_register = snd_jack_dev_register, @@ -230,26 +236,31
> @@ int
> > snd_jack_new(struct snd_card *card, const char *id, int type,
> >
> >  	/* don't creat input device for phantom jack */
> >  	if (!phantom_jack) {
> > +#ifdef CONFIG_INPUT
> >  		jack->input_dev = input_allocate_device();
> >  		if (jack->input_dev == NULL) {
> >  			err = -ENOMEM;
> > -			goto fail_input;
> > +			goto error;
> >  		}
> >
> >  		jack->input_dev->phys = "ALSA";
> >
> > -		jack->type = type;
> > -
> > -		for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
> > +		for (int i = 0; i < SND_JACK_SWITCH_TYPES; i++)
> >  			if (type & (1 << i))
> >  				input_set_capability(jack->input_dev,
> EV_SW,
> >  						     jack_switch_types[i]);
> > +#endif
> > +		jack->type = type;
> >
> >  	}
> >
> >  	err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
> > -	if (err < 0)
> > -		goto fail_input;
> > +	if (err < 0) {
> > +#ifdef CONFIG_INPUT
> > +		input_free_device(jack->input_dev);
> > +#endif
> > +		goto error;
> > +	}
> >
> >  	jack->card = card;
> >  	INIT_LIST_HEAD(&jack->kctl_list);
> > @@ -261,8 +272,7 @@ int snd_jack_new(struct snd_card *card, const char
> > *id, int type,
> >
> >  	return 0;
> >
> > -fail_input:
> > -	input_free_device(jack->input_dev);
> > +error:
> >  	kfree(jack->id);
> >  	kfree(jack);
> >  	return err;
> > @@ -281,11 +291,13 @@ EXPORT_SYMBOL(snd_jack_new);
> >   */
> >  void snd_jack_set_parent(struct snd_jack *jack, struct device
> > *parent)  {
> > +#ifdef CONFIG_INPUT
> >  	WARN_ON(jack->registered);
> >  	if (!jack->input_dev)
> >  		return;
> >
> >  	jack->input_dev->dev.parent = parent;
> > +#endif
> >  }
> >  EXPORT_SYMBOL(snd_jack_set_parent);
> >
> > @@ -340,7 +352,6 @@ EXPORT_SYMBOL(snd_jack_set_key);  void
> > snd_jack_report(struct snd_jack *jack, int status)  {
> >  	struct snd_jack_kctl *jack_kctl;
> > -	int i;
> >
> >  	if (!jack)
> >  		return;
> > @@ -349,10 +360,11 @@ void snd_jack_report(struct snd_jack *jack, int
> status)
> >  		snd_kctl_jack_report(jack->card, jack_kctl->kctl,
> >  					    status & jack_kctl->mask_bits);
> >
> > +#ifdef CONFIG_INPUT
> >  	if (!jack->input_dev)
> >  		return;
> >
> > -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
> >  		int testbit = SND_JACK_BTN_0 >> i;
> >
> >  		if (jack->type & testbit)
> > @@ -369,7 +381,7 @@ void snd_jack_report(struct snd_jack *jack, int
> status)
> >  	}
> >
> >  	input_sync(jack->input_dev);
> > -
> > +#endif
> >  }
> >  EXPORT_SYMBOL(snd_jack_report);
> >
> > --
> > 1.9.1
> >

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

* Re: [PATCH] ALSA: jack: fix a randconfig build issue
  2015-05-02  4:51   ` Jie, Yang
@ 2015-05-02  7:01     ` Takashi Iwai
  2015-05-02  7:09       ` Jie, Yang
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2015-05-02  7:01 UTC (permalink / raw)
  To: Jie, Yang; +Cc: alsa-devel, broonie, Girdwood, Liam R

At Sat, 2 May 2015 04:51:34 +0000,
Jie, Yang wrote:
> 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai@suse.de]
> > Sent: Friday, May 01, 2015 3:11 PM
> > To: Jie, Yang
> > Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam R
> > Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> > 
> > At Fri,  1 May 2015 11:10:29 +0800,
> > Jie Yang wrote:
> > >
> > > There may be no input_dev for jack(e.g. phantom jack), when
> > > CONFIG_INPUT is not selected, building errors such as:
> > > undefined reference to `input_xxx'...
> > >
> > > Here add #ifdef judgement to fix the issue.
> > 
> > Well, the standard idiom so far is to enable SND_JACK selectively.
> > Take a look at the comment in sound/core/Kconfig.
> > 
> > # To be effective this also requires INPUT - users should say:
> > #    select SND_JACK if INPUT=y || INPUT=SND
> > # to avoid having to force INPUT on.
> > config SND_JACK
> > 	bool
> > 
> > And, looking at sound/pci/hda/Kconfig, there is still SND_HDA_INPUT_JACK.
> > 
> > So, what you need to fix is:
> > - Remove SND_HDA_INPUT_JACK from sound/pci/hda/Kconfig and the last
> >   ifdef in hda_codec.h
> > 
> > - Replace the line "select SND_JACK" with
> > 	select SND_JACK if INPUT=y || INPUT=SND_HDA
>  
> OK, will follow this. What I only concern is that if user want SND_JACk when
> INPUT=N(e.g. phantom jack?), it becomes impossible.

Right, it's impossible now.  But this is the case really no one would
care much (who wants the jack detection on a system without any input
capability?).


Takashi

> 
> ~Keyon
> 
> > 
> > 
> > thanks,
> > 
> > Takashi
> > 
> > >
> > > Signed-off-by: Jie Yang <yang.jie@intel.com>
> > > ---
> > >  include/sound/jack.h |  2 ++
> > >  sound/core/jack.c    | 40 ++++++++++++++++++++++++++--------------
> > >  2 files changed, 28 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/include/sound/jack.h b/include/sound/jack.h index
> > > 23bede1..c1010f9 100644
> > > --- a/include/sound/jack.h
> > > +++ b/include/sound/jack.h
> > > @@ -72,7 +72,9 @@ enum snd_jack_types {  #define
> > SND_JACK_SWITCH_TYPES
> > > 6
> > >
> > >  struct snd_jack {
> > > +#ifdef CONFIG_INPUT
> > >  	struct input_dev *input_dev;
> > > +#endif
> > >  	struct list_head kctl_list;
> > >  	struct snd_card *card;
> > >  	int registered;
> > > diff --git a/sound/core/jack.c b/sound/core/jack.c index
> > > eb66327..3a1901e 100644
> > > --- a/sound/core/jack.c
> > > +++ b/sound/core/jack.c
> > > @@ -32,6 +32,7 @@ struct snd_jack_kctl {
> > >  	unsigned int mask_bits; /* only masked status bits are reported via
> > > kctl */  };
> > >
> > > +#ifdef CONFIG_INPUT
> > >  static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
> > >  	SW_HEADPHONE_INSERT,
> > >  	SW_MICROPHONE_INSERT,
> > > @@ -40,9 +41,11 @@ static int
> > jack_switch_types[SND_JACK_SWITCH_TYPES] = {
> > >  	SW_VIDEOOUT_INSERT,
> > >  	SW_LINEIN_INSERT,
> > >  };
> > > +#endif
> > >
> > >  static int snd_jack_dev_disconnect(struct snd_device *device)  {
> > > +#ifdef CONFIG_INPUT
> > >  	struct snd_jack *jack = device->device_data;
> > >
> > >  	if (!jack->input_dev)
> > > @@ -54,7 +57,9 @@ static int snd_jack_dev_disconnect(struct snd_device
> > *device)
> > >  		input_unregister_device(jack->input_dev);
> > >  	else
> > >  		input_free_device(jack->input_dev);
> > > +
> > >  	jack->input_dev = NULL;
> > > +#endif
> > >  	return 0;
> > >  }
> > >
> > > @@ -83,11 +88,12 @@ static int snd_jack_dev_register(struct snd_device
> > > *device)  {
> > >  	struct snd_jack *jack = device->device_data;
> > >  	struct snd_card *card = device->card;
> > > -	int err, i;
> > > +	int err = 0;
> > >
> > >  	snprintf(jack->name, sizeof(jack->name), "%s %s",
> > >  		 card->shortname, jack->id);
> > >
> > > +#ifdef CONFIG_INPUT
> > >  	if (!jack->input_dev)
> > >  		return 0;
> > >
> > > @@ -98,7 +104,7 @@ static int snd_jack_dev_register(struct snd_device
> > *device)
> > >  		jack->input_dev->dev.parent =
> > snd_card_get_device_link(card);
> > >
> > >  	/* Add capabilities for any keys that are enabled */
> > > -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > > +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > >  		int testbit = SND_JACK_BTN_0 >> i;
> > >
> > >  		if (!(jack->type & testbit))
> > > @@ -113,6 +119,7 @@ static int snd_jack_dev_register(struct snd_device
> > *device)
> > >  	err = input_register_device(jack->input_dev);
> > >  	if (err == 0)
> > >  		jack->registered = 1;
> > > +#endif
> > >
> > >  	return err;
> > >  }
> > > @@ -209,7 +216,6 @@ int snd_jack_new(struct snd_card *card, const char
> > *id, int type,
> > >  	struct snd_jack *jack;
> > >  	struct snd_jack_kctl *jack_kctl = NULL;
> > >  	int err;
> > > -	int i;
> > >  	static struct snd_device_ops ops = {
> > >  		.dev_free = snd_jack_dev_free,
> > >  		.dev_register = snd_jack_dev_register, @@ -230,26 +236,31
> > @@ int
> > > snd_jack_new(struct snd_card *card, const char *id, int type,
> > >
> > >  	/* don't creat input device for phantom jack */
> > >  	if (!phantom_jack) {
> > > +#ifdef CONFIG_INPUT
> > >  		jack->input_dev = input_allocate_device();
> > >  		if (jack->input_dev == NULL) {
> > >  			err = -ENOMEM;
> > > -			goto fail_input;
> > > +			goto error;
> > >  		}
> > >
> > >  		jack->input_dev->phys = "ALSA";
> > >
> > > -		jack->type = type;
> > > -
> > > -		for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
> > > +		for (int i = 0; i < SND_JACK_SWITCH_TYPES; i++)
> > >  			if (type & (1 << i))
> > >  				input_set_capability(jack->input_dev,
> > EV_SW,
> > >  						     jack_switch_types[i]);
> > > +#endif
> > > +		jack->type = type;
> > >
> > >  	}
> > >
> > >  	err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
> > > -	if (err < 0)
> > > -		goto fail_input;
> > > +	if (err < 0) {
> > > +#ifdef CONFIG_INPUT
> > > +		input_free_device(jack->input_dev);
> > > +#endif
> > > +		goto error;
> > > +	}
> > >
> > >  	jack->card = card;
> > >  	INIT_LIST_HEAD(&jack->kctl_list);
> > > @@ -261,8 +272,7 @@ int snd_jack_new(struct snd_card *card, const char
> > > *id, int type,
> > >
> > >  	return 0;
> > >
> > > -fail_input:
> > > -	input_free_device(jack->input_dev);
> > > +error:
> > >  	kfree(jack->id);
> > >  	kfree(jack);
> > >  	return err;
> > > @@ -281,11 +291,13 @@ EXPORT_SYMBOL(snd_jack_new);
> > >   */
> > >  void snd_jack_set_parent(struct snd_jack *jack, struct device
> > > *parent)  {
> > > +#ifdef CONFIG_INPUT
> > >  	WARN_ON(jack->registered);
> > >  	if (!jack->input_dev)
> > >  		return;
> > >
> > >  	jack->input_dev->dev.parent = parent;
> > > +#endif
> > >  }
> > >  EXPORT_SYMBOL(snd_jack_set_parent);
> > >
> > > @@ -340,7 +352,6 @@ EXPORT_SYMBOL(snd_jack_set_key);  void
> > > snd_jack_report(struct snd_jack *jack, int status)  {
> > >  	struct snd_jack_kctl *jack_kctl;
> > > -	int i;
> > >
> > >  	if (!jack)
> > >  		return;
> > > @@ -349,10 +360,11 @@ void snd_jack_report(struct snd_jack *jack, int
> > status)
> > >  		snd_kctl_jack_report(jack->card, jack_kctl->kctl,
> > >  					    status & jack_kctl->mask_bits);
> > >
> > > +#ifdef CONFIG_INPUT
> > >  	if (!jack->input_dev)
> > >  		return;
> > >
> > > -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > > +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > >  		int testbit = SND_JACK_BTN_0 >> i;
> > >
> > >  		if (jack->type & testbit)
> > > @@ -369,7 +381,7 @@ void snd_jack_report(struct snd_jack *jack, int
> > status)
> > >  	}
> > >
> > >  	input_sync(jack->input_dev);
> > > -
> > > +#endif
> > >  }
> > >  EXPORT_SYMBOL(snd_jack_report);
> > >
> > > --
> > > 1.9.1
> > >
> 

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

* Re: [PATCH] ALSA: jack: fix a randconfig build issue
  2015-05-02  7:01     ` Takashi Iwai
@ 2015-05-02  7:09       ` Jie, Yang
  2015-05-02  7:11         ` Takashi Iwai
  0 siblings, 1 reply; 9+ messages in thread
From: Jie, Yang @ 2015-05-02  7:09 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, broonie, Girdwood, Liam R

> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Saturday, May 02, 2015 3:01 PM
> To: Jie, Yang
> Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam R
> Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> 
> At Sat, 2 May 2015 04:51:34 +0000,
> Jie, Yang wrote:
> >
> > > -----Original Message-----
> > > From: Takashi Iwai [mailto:tiwai@suse.de]
> > > Sent: Friday, May 01, 2015 3:11 PM
> > > To: Jie, Yang
> > > Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam
> > > R
> > > Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> > >
> > > At Fri,  1 May 2015 11:10:29 +0800,
> > > Jie Yang wrote:
> > > >
> > > > There may be no input_dev for jack(e.g. phantom jack), when
> > > > CONFIG_INPUT is not selected, building errors such as:
> > > > undefined reference to `input_xxx'...
> > > >
> > > > Here add #ifdef judgement to fix the issue.
> > >
> > > Well, the standard idiom so far is to enable SND_JACK selectively.
> > > Take a look at the comment in sound/core/Kconfig.
> > >
> > > # To be effective this also requires INPUT - users should say:
> > > #    select SND_JACK if INPUT=y || INPUT=SND
> > > # to avoid having to force INPUT on.
> > > config SND_JACK
> > > 	bool
> > >
> > > And, looking at sound/pci/hda/Kconfig, there is still
> SND_HDA_INPUT_JACK.
> > >
> > > So, what you need to fix is:
> > > - Remove SND_HDA_INPUT_JACK from sound/pci/hda/Kconfig and the
> last
> > >   ifdef in hda_codec.h
> > >
> > > - Replace the line "select SND_JACK" with
> > > 	select SND_JACK if INPUT=y || INPUT=SND_HDA
> >
> > OK, will follow this. What I only concern is that if user want
> > SND_JACk when INPUT=N(e.g. phantom jack?), it becomes impossible.
> 
> Right, it's impossible now.  But this is the case really no one would care much
> (who wants the jack detection on a system without any input capability?).
 
Got it. Another question here, I found that this change in sound/pci/had/Kconfig
doesn't fix the building issue:
	select SND_JACK if INPUT=y || INPUT=SND_HDA
but this do:
	select SND_JACK if INPUT=y || INPUT=SND

suppose we should use the latter one, right? Do you know why the former one
doesn't fix?(seems here "INPUT=SND..." added for both CONFIG_INPUT=m and
SND...=m case?)

Thanks,
~Keyon
> 
> 
> Takashi
> 
> >
> > ~Keyon
> >
> > >
> > >
> > > thanks,
> > >
> > > Takashi
> > >
> > > >
> > > > Signed-off-by: Jie Yang <yang.jie@intel.com>
> > > > ---
> > > >  include/sound/jack.h |  2 ++
> > > >  sound/core/jack.c    | 40 ++++++++++++++++++++++++++--------------
> > > >  2 files changed, 28 insertions(+), 14 deletions(-)
> > > >
> > > > diff --git a/include/sound/jack.h b/include/sound/jack.h index
> > > > 23bede1..c1010f9 100644
> > > > --- a/include/sound/jack.h
> > > > +++ b/include/sound/jack.h
> > > > @@ -72,7 +72,9 @@ enum snd_jack_types {  #define
> > > SND_JACK_SWITCH_TYPES
> > > > 6
> > > >
> > > >  struct snd_jack {
> > > > +#ifdef CONFIG_INPUT
> > > >  	struct input_dev *input_dev;
> > > > +#endif
> > > >  	struct list_head kctl_list;
> > > >  	struct snd_card *card;
> > > >  	int registered;
> > > > diff --git a/sound/core/jack.c b/sound/core/jack.c index
> > > > eb66327..3a1901e 100644
> > > > --- a/sound/core/jack.c
> > > > +++ b/sound/core/jack.c
> > > > @@ -32,6 +32,7 @@ struct snd_jack_kctl {
> > > >  	unsigned int mask_bits; /* only masked status bits are reported
> > > > via kctl */  };
> > > >
> > > > +#ifdef CONFIG_INPUT
> > > >  static int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
> > > >  	SW_HEADPHONE_INSERT,
> > > >  	SW_MICROPHONE_INSERT,
> > > > @@ -40,9 +41,11 @@ static int
> > > jack_switch_types[SND_JACK_SWITCH_TYPES] = {
> > > >  	SW_VIDEOOUT_INSERT,
> > > >  	SW_LINEIN_INSERT,
> > > >  };
> > > > +#endif
> > > >
> > > >  static int snd_jack_dev_disconnect(struct snd_device *device)  {
> > > > +#ifdef CONFIG_INPUT
> > > >  	struct snd_jack *jack = device->device_data;
> > > >
> > > >  	if (!jack->input_dev)
> > > > @@ -54,7 +57,9 @@ static int snd_jack_dev_disconnect(struct
> > > > snd_device
> > > *device)
> > > >  		input_unregister_device(jack->input_dev);
> > > >  	else
> > > >  		input_free_device(jack->input_dev);
> > > > +
> > > >  	jack->input_dev = NULL;
> > > > +#endif
> > > >  	return 0;
> > > >  }
> > > >
> > > > @@ -83,11 +88,12 @@ static int snd_jack_dev_register(struct
> > > > snd_device
> > > > *device)  {
> > > >  	struct snd_jack *jack = device->device_data;
> > > >  	struct snd_card *card = device->card;
> > > > -	int err, i;
> > > > +	int err = 0;
> > > >
> > > >  	snprintf(jack->name, sizeof(jack->name), "%s %s",
> > > >  		 card->shortname, jack->id);
> > > >
> > > > +#ifdef CONFIG_INPUT
> > > >  	if (!jack->input_dev)
> > > >  		return 0;
> > > >
> > > > @@ -98,7 +104,7 @@ static int snd_jack_dev_register(struct
> > > > snd_device
> > > *device)
> > > >  		jack->input_dev->dev.parent =
> > > snd_card_get_device_link(card);
> > > >
> > > >  	/* Add capabilities for any keys that are enabled */
> > > > -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > > > +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > > >  		int testbit = SND_JACK_BTN_0 >> i;
> > > >
> > > >  		if (!(jack->type & testbit))
> > > > @@ -113,6 +119,7 @@ static int snd_jack_dev_register(struct
> > > > snd_device
> > > *device)
> > > >  	err = input_register_device(jack->input_dev);
> > > >  	if (err == 0)
> > > >  		jack->registered = 1;
> > > > +#endif
> > > >
> > > >  	return err;
> > > >  }
> > > > @@ -209,7 +216,6 @@ int snd_jack_new(struct snd_card *card, const
> > > > char
> > > *id, int type,
> > > >  	struct snd_jack *jack;
> > > >  	struct snd_jack_kctl *jack_kctl = NULL;
> > > >  	int err;
> > > > -	int i;
> > > >  	static struct snd_device_ops ops = {
> > > >  		.dev_free = snd_jack_dev_free,
> > > >  		.dev_register = snd_jack_dev_register, @@ -230,26 +236,31
> > > @@ int
> > > > snd_jack_new(struct snd_card *card, const char *id, int type,
> > > >
> > > >  	/* don't creat input device for phantom jack */
> > > >  	if (!phantom_jack) {
> > > > +#ifdef CONFIG_INPUT
> > > >  		jack->input_dev = input_allocate_device();
> > > >  		if (jack->input_dev == NULL) {
> > > >  			err = -ENOMEM;
> > > > -			goto fail_input;
> > > > +			goto error;
> > > >  		}
> > > >
> > > >  		jack->input_dev->phys = "ALSA";
> > > >
> > > > -		jack->type = type;
> > > > -
> > > > -		for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
> > > > +		for (int i = 0; i < SND_JACK_SWITCH_TYPES; i++)
> > > >  			if (type & (1 << i))
> > > >  				input_set_capability(jack->input_dev,
> > > EV_SW,
> > > >  						     jack_switch_types[i]);
> > > > +#endif
> > > > +		jack->type = type;
> > > >
> > > >  	}
> > > >
> > > >  	err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
> > > > -	if (err < 0)
> > > > -		goto fail_input;
> > > > +	if (err < 0) {
> > > > +#ifdef CONFIG_INPUT
> > > > +		input_free_device(jack->input_dev);
> > > > +#endif
> > > > +		goto error;
> > > > +	}
> > > >
> > > >  	jack->card = card;
> > > >  	INIT_LIST_HEAD(&jack->kctl_list); @@ -261,8 +272,7 @@ int
> > > > snd_jack_new(struct snd_card *card, const char *id, int type,
> > > >
> > > >  	return 0;
> > > >
> > > > -fail_input:
> > > > -	input_free_device(jack->input_dev);
> > > > +error:
> > > >  	kfree(jack->id);
> > > >  	kfree(jack);
> > > >  	return err;
> > > > @@ -281,11 +291,13 @@ EXPORT_SYMBOL(snd_jack_new);
> > > >   */
> > > >  void snd_jack_set_parent(struct snd_jack *jack, struct device
> > > > *parent)  {
> > > > +#ifdef CONFIG_INPUT
> > > >  	WARN_ON(jack->registered);
> > > >  	if (!jack->input_dev)
> > > >  		return;
> > > >
> > > >  	jack->input_dev->dev.parent = parent;
> > > > +#endif
> > > >  }
> > > >  EXPORT_SYMBOL(snd_jack_set_parent);
> > > >
> > > > @@ -340,7 +352,6 @@ EXPORT_SYMBOL(snd_jack_set_key);  void
> > > > snd_jack_report(struct snd_jack *jack, int status)  {
> > > >  	struct snd_jack_kctl *jack_kctl;
> > > > -	int i;
> > > >
> > > >  	if (!jack)
> > > >  		return;
> > > > @@ -349,10 +360,11 @@ void snd_jack_report(struct snd_jack *jack,
> > > > int
> > > status)
> > > >  		snd_kctl_jack_report(jack->card, jack_kctl->kctl,
> > > >  					    status & jack_kctl->mask_bits);
> > > >
> > > > +#ifdef CONFIG_INPUT
> > > >  	if (!jack->input_dev)
> > > >  		return;
> > > >
> > > > -	for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > > > +	for (int i = 0; i < ARRAY_SIZE(jack->key); i++) {
> > > >  		int testbit = SND_JACK_BTN_0 >> i;
> > > >
> > > >  		if (jack->type & testbit)
> > > > @@ -369,7 +381,7 @@ void snd_jack_report(struct snd_jack *jack,
> > > > int
> > > status)
> > > >  	}
> > > >
> > > >  	input_sync(jack->input_dev);
> > > > -
> > > > +#endif
> > > >  }
> > > >  EXPORT_SYMBOL(snd_jack_report);
> > > >
> > > > --
> > > > 1.9.1
> > > >
> >

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

* Re: [PATCH] ALSA: jack: fix a randconfig build issue
  2015-05-02  7:09       ` Jie, Yang
@ 2015-05-02  7:11         ` Takashi Iwai
  2015-05-02  7:24           ` Jie, Yang
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2015-05-02  7:11 UTC (permalink / raw)
  To: Jie, Yang; +Cc: alsa-devel, broonie, Girdwood, Liam R

At Sat, 2 May 2015 07:09:50 +0000,
Jie, Yang wrote:
> 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai@suse.de]
> > Sent: Saturday, May 02, 2015 3:01 PM
> > To: Jie, Yang
> > Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam R
> > Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> > 
> > At Sat, 2 May 2015 04:51:34 +0000,
> > Jie, Yang wrote:
> > >
> > > > -----Original Message-----
> > > > From: Takashi Iwai [mailto:tiwai@suse.de]
> > > > Sent: Friday, May 01, 2015 3:11 PM
> > > > To: Jie, Yang
> > > > Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam
> > > > R
> > > > Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> > > >
> > > > At Fri,  1 May 2015 11:10:29 +0800,
> > > > Jie Yang wrote:
> > > > >
> > > > > There may be no input_dev for jack(e.g. phantom jack), when
> > > > > CONFIG_INPUT is not selected, building errors such as:
> > > > > undefined reference to `input_xxx'...
> > > > >
> > > > > Here add #ifdef judgement to fix the issue.
> > > >
> > > > Well, the standard idiom so far is to enable SND_JACK selectively.
> > > > Take a look at the comment in sound/core/Kconfig.
> > > >
> > > > # To be effective this also requires INPUT - users should say:
> > > > #    select SND_JACK if INPUT=y || INPUT=SND
> > > > # to avoid having to force INPUT on.
> > > > config SND_JACK
> > > > 	bool
> > > >
> > > > And, looking at sound/pci/hda/Kconfig, there is still
> > SND_HDA_INPUT_JACK.
> > > >
> > > > So, what you need to fix is:
> > > > - Remove SND_HDA_INPUT_JACK from sound/pci/hda/Kconfig and the
> > last
> > > >   ifdef in hda_codec.h
> > > >
> > > > - Replace the line "select SND_JACK" with
> > > > 	select SND_JACK if INPUT=y || INPUT=SND_HDA
> > >
> > > OK, will follow this. What I only concern is that if user want
> > > SND_JACk when INPUT=N(e.g. phantom jack?), it becomes impossible.
> > 
> > Right, it's impossible now.  But this is the case really no one would care much
> > (who wants the jack detection on a system without any input capability?).
>  
> Got it. Another question here, I found that this change in sound/pci/had/Kconfig
> doesn't fix the building issue:
> 	select SND_JACK if INPUT=y || INPUT=SND_HDA
> but this do:
> 	select SND_JACK if INPUT=y || INPUT=SND
> 
> suppose we should use the latter one, right?

Yes, correct.

> Do you know why the former one
> doesn't fix?(seems here "INPUT=SND..." added for both CONFIG_INPUT=m and
> SND...=m case?)

SND may be y while SND_HDA=m and INPUT=m.


Takashi

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

* Re: [PATCH] ALSA: jack: fix a randconfig build issue
  2015-05-02  7:11         ` Takashi Iwai
@ 2015-05-02  7:24           ` Jie, Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Jie, Yang @ 2015-05-02  7:24 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, broonie, Girdwood, Liam R

> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Saturday, May 02, 2015 3:12 PM
> To: Jie, Yang
> Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam R
> Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> 
> At Sat, 2 May 2015 07:09:50 +0000,
> Jie, Yang wrote:
> >
> > > -----Original Message-----
> > > From: Takashi Iwai [mailto:tiwai@suse.de]
> > > Sent: Saturday, May 02, 2015 3:01 PM
> > > To: Jie, Yang
> > > Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam
> > > R
> > > Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> > >
> > > At Sat, 2 May 2015 04:51:34 +0000,
> > > Jie, Yang wrote:
> > > >
> > > > > -----Original Message-----
> > > > > From: Takashi Iwai [mailto:tiwai@suse.de]
> > > > > Sent: Friday, May 01, 2015 3:11 PM
> > > > > To: Jie, Yang
> > > > > Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood,
> > > > > Liam R
> > > > > Subject: Re: [PATCH] ALSA: jack: fix a randconfig build issue
> > > > >
> > > > > At Fri,  1 May 2015 11:10:29 +0800, Jie Yang wrote:
> > > > > >
> > > > > > There may be no input_dev for jack(e.g. phantom jack), when
> > > > > > CONFIG_INPUT is not selected, building errors such as:
> > > > > > undefined reference to `input_xxx'...
> > > > > >
> > > > > > Here add #ifdef judgement to fix the issue.
> > > > >
> > > > > Well, the standard idiom so far is to enable SND_JACK selectively.
> > > > > Take a look at the comment in sound/core/Kconfig.
> > > > >
> > > > > # To be effective this also requires INPUT - users should say:
> > > > > #    select SND_JACK if INPUT=y || INPUT=SND
> > > > > # to avoid having to force INPUT on.
> > > > > config SND_JACK
> > > > > 	bool
> > > > >
> > > > > And, looking at sound/pci/hda/Kconfig, there is still
> > > SND_HDA_INPUT_JACK.
> > > > >
> > > > > So, what you need to fix is:
> > > > > - Remove SND_HDA_INPUT_JACK from sound/pci/hda/Kconfig and
> the
> > > last
> > > > >   ifdef in hda_codec.h
> > > > >
> > > > > - Replace the line "select SND_JACK" with
> > > > > 	select SND_JACK if INPUT=y || INPUT=SND_HDA
> > > >
> > > > OK, will follow this. What I only concern is that if user want
> > > > SND_JACk when INPUT=N(e.g. phantom jack?), it becomes impossible.
> > >
> > > Right, it's impossible now.  But this is the case really no one
> > > would care much (who wants the jack detection on a system without any
> input capability?).
> >
> > Got it. Another question here, I found that this change in
> > sound/pci/had/Kconfig doesn't fix the building issue:
> > 	select SND_JACK if INPUT=y || INPUT=SND_HDA but this do:
> > 	select SND_JACK if INPUT=y || INPUT=SND
> >
> > suppose we should use the latter one, right?
> 
> Yes, correct.
> 
> > Do you know why the former one
> > doesn't fix?(seems here "INPUT=SND..." added for both
> CONFIG_INPUT=m
> > and SND...=m case?)
> 
> SND may be y while SND_HDA=m and INPUT=m.
 
Thanks, will update the patch and send out soon.

~Keyon
> 
> 
> Takashi

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

* Re: [PATCH] ALSA: jack: fix a randconfig build issue
  2015-05-02  7:28 Jie Yang
@ 2015-05-02  8:03 ` Takashi Iwai
  0 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-05-02  8:03 UTC (permalink / raw)
  To: Jie Yang; +Cc: alsa-devel, broonie, liam.r.girdwood

At Sat,  2 May 2015 15:28:07 +0800,
Jie Yang wrote:
> 
> Building errors reported such as below when 'CONFIG_INPUT=m':
>     ...undefined reference to `input_xxx'...
> 
> Here change to enable SND_JACK selectively to fix the issue.
> 
> Also remove the config 'SND_HDA_INPUT_JACK' which won't be
> used anymore.
> 
> Signed-off-by: Jie Yang <yang.jie@intel.com>

Applied, thanks.


Takashi

> ---
>  sound/pci/hda/Kconfig     | 10 +---------
>  sound/pci/hda/hda_codec.h |  2 --
>  2 files changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
> index 5c296d3..117bf5c 100644
> --- a/sound/pci/hda/Kconfig
> +++ b/sound/pci/hda/Kconfig
> @@ -4,7 +4,7 @@ config SND_HDA
>  	tristate
>  	select SND_PCM
>  	select SND_VMASTER
> -	select SND_JACK
> +	select SND_JACK if INPUT=y || INPUT=SND
>  	select SND_HDA_CORE
>  
>  config SND_HDA_INTEL
> @@ -84,14 +84,6 @@ config SND_HDA_INPUT_BEEP_MODE
>  	  Set 1 to always enable the digital beep interface for HD-audio by
>  	  default.
>  
> -config SND_HDA_INPUT_JACK
> -	bool "Support jack plugging notification via input layer"
> -	depends on INPUT=y || INPUT=SND
> -	select SND_JACK
> -	help
> -	  Say Y here to enable the jack plugging notification via
> -	  input layer.
> -
>  config SND_HDA_PATCH_LOADER
>  	bool "Support initialization patch loading for HD-audio"
>  	select FW_LOADER
> diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
> index 0f8b6b5..ed7e9cf 100644
> --- a/sound/pci/hda/hda_codec.h
> +++ b/sound/pci/hda/hda_codec.h
> @@ -274,10 +274,8 @@ struct hda_codec {
>  	unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */
>  	struct delayed_work jackpoll_work;
>  
> -#ifdef CONFIG_SND_HDA_INPUT_JACK
>  	/* jack detection */
>  	struct snd_array jacks;
> -#endif
>  
>  	int depop_delay; /* depop delay in ms, -1 for default delay time */
>  
> -- 
> 1.9.1
> 

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

* [PATCH] ALSA: jack: fix a randconfig build issue
@ 2015-05-02  7:28 Jie Yang
  2015-05-02  8:03 ` Takashi Iwai
  0 siblings, 1 reply; 9+ messages in thread
From: Jie Yang @ 2015-05-02  7:28 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel, broonie, liam.r.girdwood

Building errors reported such as below when 'CONFIG_INPUT=m':
    ...undefined reference to `input_xxx'...

Here change to enable SND_JACK selectively to fix the issue.

Also remove the config 'SND_HDA_INPUT_JACK' which won't be
used anymore.

Signed-off-by: Jie Yang <yang.jie@intel.com>
---
 sound/pci/hda/Kconfig     | 10 +---------
 sound/pci/hda/hda_codec.h |  2 --
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 5c296d3..117bf5c 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -4,7 +4,7 @@ config SND_HDA
 	tristate
 	select SND_PCM
 	select SND_VMASTER
-	select SND_JACK
+	select SND_JACK if INPUT=y || INPUT=SND
 	select SND_HDA_CORE
 
 config SND_HDA_INTEL
@@ -84,14 +84,6 @@ config SND_HDA_INPUT_BEEP_MODE
 	  Set 1 to always enable the digital beep interface for HD-audio by
 	  default.
 
-config SND_HDA_INPUT_JACK
-	bool "Support jack plugging notification via input layer"
-	depends on INPUT=y || INPUT=SND
-	select SND_JACK
-	help
-	  Say Y here to enable the jack plugging notification via
-	  input layer.
-
 config SND_HDA_PATCH_LOADER
 	bool "Support initialization patch loading for HD-audio"
 	select FW_LOADER
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 0f8b6b5..ed7e9cf 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -274,10 +274,8 @@ struct hda_codec {
 	unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */
 	struct delayed_work jackpoll_work;
 
-#ifdef CONFIG_SND_HDA_INPUT_JACK
 	/* jack detection */
 	struct snd_array jacks;
-#endif
 
 	int depop_delay; /* depop delay in ms, -1 for default delay time */
 
-- 
1.9.1

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

end of thread, other threads:[~2015-05-02  8:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-01  3:10 [PATCH] ALSA: jack: fix a randconfig build issue Jie Yang
2015-05-01  7:10 ` Takashi Iwai
2015-05-02  4:51   ` Jie, Yang
2015-05-02  7:01     ` Takashi Iwai
2015-05-02  7:09       ` Jie, Yang
2015-05-02  7:11         ` Takashi Iwai
2015-05-02  7:24           ` Jie, Yang
2015-05-02  7:28 Jie Yang
2015-05-02  8:03 ` Takashi Iwai

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