All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] snd-pcsp: relax dependancy on CONFIG_INPUT
       [not found] ` <s5h4p98yfof.wl%tiwai@suse.de>
@ 2008-05-08 17:31   ` Stas Sergeev
  2008-05-08 17:35     ` Adrian Bunk
  0 siblings, 1 reply; 7+ messages in thread
From: Stas Sergeev @ 2008-05-08 17:31 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

Hello.

The attached patch makes an input
driver part of snd-pcsp optional.

Would it be possible to apply that?

[-- Attachment #2: pcsp_inp.diff --]
[-- Type: text/x-patch, Size: 4222 bytes --]

# HG changeset patch
# User Stas Sergeev <stsp@users.sourceforge.net>
# Date 1210267204 -14400
# Node ID 5c3c0b965df21ac55112f907be0786dfa90b9dc6
# Parent  25a20d46d89a57c89e911452171af7e4cdcc8464
snd-pcsp: relax dependancy on CONFIG_INPUT by adding CONFIG_SND_PCSP_INPUT

Signed-off-by: Stas Sergeev <stsp@aknet.ru>

diff -r 25a20d46d89a -r 5c3c0b965df2 drivers/Kconfig
--- a/drivers/Kconfig	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/Kconfig	Thu May 08 21:20:04 2008 +0400
@@ -5,16 +5,14 @@ menu "Generic devices"
 
 
 config SND_PCSP
-	tristate "Internal PC speaker support"
+	tristate "PC-Speaker support"
 	depends on X86_PC && HIGH_RES_TIMERS
-	depends on INPUT
 	depends on SND
 	select SND_PCM
 	help
 	  If you don't have a sound card in your computer, you can include a
 	  driver for the PC speaker which allows it to act like a primitive
 	  sound card.
-	  This driver also replaces the pcspkr driver for beeps.
 
 	  You can compile this as a module which will be called snd-pcsp.
 
@@ -23,6 +21,17 @@ config SND_PCSP
 	  in your PC instead of the real speaker.
 
 	  It should not hurt to say Y or M here in all other cases.
+
+config SND_PCSP_INPUT
+	bool "PC-Speaker input events (beeps) support"
+	depends on INPUT
+	depends on SND_PCSP
+	default y
+	help
+	  This option enables the PC-Speaker system beeps.
+	  This is an alternative to the pcspkr input driver (INPUT_PCSPKR).
+	  It provides the ability to enable/disable the system
+	  beeps with the sound mixer.
 
 config SND_MPU401_UART
         tristate
diff -r 25a20d46d89a -r 5c3c0b965df2 drivers/pcsp/Makefile
--- a/drivers/pcsp/Makefile	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/Makefile	Thu May 08 21:20:04 2008 +0400
@@ -1,2 +1,3 @@ snd-pcsp-objs := pcsp.o pcsp_lib.o pcsp_
-snd-pcsp-objs := pcsp.o pcsp_lib.o pcsp_mixer.o pcsp_input.o
+snd-pcsp-y := pcsp.o pcsp_lib.o pcsp_mixer.o
+snd-pcsp-$(CONFIG_SND_PCSP_INPUT) += pcsp_input.o
 obj-$(CONFIG_SND_PCSP) += snd-pcsp.o
diff -r 25a20d46d89a -r 5c3c0b965df2 drivers/pcsp/pcsp.c
--- a/drivers/pcsp/pcsp.c	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/pcsp.c	Thu May 08 21:20:04 2008 +0400
@@ -188,10 +188,12 @@ static int __devexit pcsp_remove(struct 
 
 static void pcsp_stop_beep(struct snd_pcsp *chip)
 {
+#ifdef CONFIG_SND_PCSP_INPUT
 	spin_lock_irq(&chip->substream_lock);
 	if (!chip->playback_substream)
 		pcspkr_stop_sound();
 	spin_unlock_irq(&chip->substream_lock);
+#endif	/* CONFIG_SND_PCSP_INPUT */
 }
 
 #ifdef CONFIG_PM
diff -r 25a20d46d89a -r 5c3c0b965df2 drivers/pcsp/pcsp_input.h
--- a/drivers/pcsp/pcsp_input.h	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/pcsp_input.h	Thu May 08 21:20:04 2008 +0400
@@ -7,8 +7,15 @@
 #ifndef __PCSP_INPUT_H__
 #define __PCSP_INPUT_H__
 
+#ifdef CONFIG_SND_PCSP_INPUT
 int __devinit pcspkr_input_init(struct input_dev **rdev, struct device *dev);
 int pcspkr_input_remove(struct input_dev *dev);
 void pcspkr_stop_sound(void);
+#else
+static inline int pcspkr_input_init(struct input_dev **rdev,
+	struct device *dev) { return 0; }
+static inline int pcspkr_input_remove(struct input_dev *dev) { return 0; }
+static inline void pcspkr_stop_sound(void) { }
+#endif	/* CONFIG_SND_PCSP_INPUT */
 
 #endif
diff -r 25a20d46d89a -r 5c3c0b965df2 drivers/pcsp/pcsp_mixer.c
--- a/drivers/pcsp/pcsp_mixer.c	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/pcsp_mixer.c	Thu May 08 21:20:04 2008 +0400
@@ -78,6 +78,7 @@ static int pcsp_treble_put(struct snd_kc
 	return changed;
 }
 
+#ifdef CONFIG_SND_PCSP_INPUT
 static int pcsp_pcspkr_info(struct snd_kcontrol *kcontrol,
 			    struct snd_ctl_elem_info *uinfo)
 {
@@ -108,6 +109,7 @@ static int pcsp_pcspkr_put(struct snd_kc
 	}
 	return changed;
 }
+#endif	/* CONFIG_SND_PCSP_INPUT */
 
 #define PCSP_MIXER_CONTROL(ctl_type, ctl_name) \
 { \
@@ -121,7 +123,9 @@ static struct snd_kcontrol_new __devinit
 static struct snd_kcontrol_new __devinitdata snd_pcsp_controls[] = {
 	PCSP_MIXER_CONTROL(enable, "Master Playback Switch"),
 	PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"),
+#ifdef CONFIG_SND_PCSP_INPUT
 	PCSP_MIXER_CONTROL(pcspkr, "PC Speaker Playback Switch"),
+#endif	/* CONFIG_SND_PCSP_INPUT */
 };
 
 int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip)

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [patch] snd-pcsp: relax dependancy on CONFIG_INPUT
  2008-05-08 17:31   ` [patch] snd-pcsp: relax dependancy on CONFIG_INPUT Stas Sergeev
@ 2008-05-08 17:35     ` Adrian Bunk
  2008-05-08 17:53       ` Stas Sergeev
  2008-05-08 18:25       ` Stas Sergeev
  0 siblings, 2 replies; 7+ messages in thread
From: Adrian Bunk @ 2008-05-08 17:35 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: Takashi Iwai, alsa-devel

On Thu, May 08, 2008 at 09:31:57PM +0400, Stas Sergeev wrote:
> Hello.
> 
> The attached patch makes an input
> driver part of snd-pcsp optional.
> 
> Would it be possible to apply that?
>...

Sorry for the silly question, but are there serious usecases where 
people in very space limited environments and with CONFIG_INPUT=n
want PC-Speaker support?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

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

* Re: [patch] snd-pcsp: relax dependancy on CONFIG_INPUT
  2008-05-08 17:35     ` Adrian Bunk
@ 2008-05-08 17:53       ` Stas Sergeev
  2008-05-08 18:25       ` Stas Sergeev
  1 sibling, 0 replies; 7+ messages in thread
From: Stas Sergeev @ 2008-05-08 17:53 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Takashi Iwai, alsa-devel

Hello.

Adrian Bunk wrote:
> Sorry for the silly question, but are there serious usecases where 
> people in very space limited environments and with CONFIG_INPUT=n
> want PC-Speaker support?
I don't know, but there might be
someone who wants the PCM support
from pc-speaker, and hates the beeps
at the same time. So they can disable
it forever. :)
I also want to resolve the conflict
with INPUT_PCSPKR somehow. Making the
input part of snd-pcsp optional looks
like the first step to me. It became
known to me that loading multiple
drivers for the same device will be
possible in the future. I want to get
everything ready for loading pcspkr
and snd-pcsp together.
And overall, having snd-pcsp to depend
on CONFIG_INPUT only because it can do
a console beeps as a bonus, looks ill-
behaved to me. So I just propose that
patch as a small logical correction
and cleanup, rather than a new feature.

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

* Re: [patch] snd-pcsp: relax dependancy on CONFIG_INPUT
  2008-05-08 17:35     ` Adrian Bunk
  2008-05-08 17:53       ` Stas Sergeev
@ 2008-05-08 18:25       ` Stas Sergeev
  2008-05-08 22:17         ` Adrian Bunk
  1 sibling, 1 reply; 7+ messages in thread
From: Stas Sergeev @ 2008-05-08 18:25 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Takashi Iwai, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

Hello.

Adrian Bunk wrote:
> Sorry for the silly question, but are there serious usecases where 
> people in very space limited environments and with CONFIG_INPUT=n
> want PC-Speaker support?
Oh, I've just heard youre screaming
"this all is not worth a new config option!". :)

Here's another patch instead.
Without exporting a new option to the
user this time.

[-- Attachment #2: pcsp_inp1.diff --]
[-- Type: text/x-patch, Size: 3665 bytes --]

# HG changeset patch
# User Stas Sergeev <stsp@users.sourceforge.net>
# Date 1210267204 -14400
# Node ID 903c7be2316a6b892c8c20a0a8a6e21cd9a9ee8c
# Parent  25a20d46d89a57c89e911452171af7e4cdcc8464
snd-pcsp: relax dependancy on CONFIG_INPUT by adding CONFIG_SND_PCSP_INPUT

Signed-off-by: Stas Sergeev <stsp@aknet.ru>

diff -r 25a20d46d89a -r 903c7be2316a drivers/Kconfig
--- a/drivers/Kconfig	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/Kconfig	Thu May 08 21:20:04 2008 +0400
@@ -5,9 +5,8 @@ menu "Generic devices"
 
 
 config SND_PCSP
-	tristate "Internal PC speaker support"
+	tristate "PC-Speaker support"
 	depends on X86_PC && HIGH_RES_TIMERS
-	depends on INPUT
 	depends on SND
 	select SND_PCM
 	help
@@ -23,6 +22,11 @@ config SND_PCSP
 	  in your PC instead of the real speaker.
 
 	  It should not hurt to say Y or M here in all other cases.
+
+config SND_PCSP_INPUT
+	def_bool y
+	depends on INPUT
+	depends on SND_PCSP
 
 config SND_MPU401_UART
         tristate
diff -r 25a20d46d89a -r 903c7be2316a drivers/pcsp/Makefile
--- a/drivers/pcsp/Makefile	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/Makefile	Thu May 08 21:20:04 2008 +0400
@@ -1,2 +1,3 @@ snd-pcsp-objs := pcsp.o pcsp_lib.o pcsp_
-snd-pcsp-objs := pcsp.o pcsp_lib.o pcsp_mixer.o pcsp_input.o
+snd-pcsp-y := pcsp.o pcsp_lib.o pcsp_mixer.o
+snd-pcsp-$(CONFIG_SND_PCSP_INPUT) += pcsp_input.o
 obj-$(CONFIG_SND_PCSP) += snd-pcsp.o
diff -r 25a20d46d89a -r 903c7be2316a drivers/pcsp/pcsp.c
--- a/drivers/pcsp/pcsp.c	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/pcsp.c	Thu May 08 21:20:04 2008 +0400
@@ -188,10 +188,12 @@ static int __devexit pcsp_remove(struct 
 
 static void pcsp_stop_beep(struct snd_pcsp *chip)
 {
+#ifdef CONFIG_SND_PCSP_INPUT
 	spin_lock_irq(&chip->substream_lock);
 	if (!chip->playback_substream)
 		pcspkr_stop_sound();
 	spin_unlock_irq(&chip->substream_lock);
+#endif	/* CONFIG_SND_PCSP_INPUT */
 }
 
 #ifdef CONFIG_PM
diff -r 25a20d46d89a -r 903c7be2316a drivers/pcsp/pcsp_input.h
--- a/drivers/pcsp/pcsp_input.h	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/pcsp_input.h	Thu May 08 21:20:04 2008 +0400
@@ -7,8 +7,15 @@
 #ifndef __PCSP_INPUT_H__
 #define __PCSP_INPUT_H__
 
+#ifdef CONFIG_SND_PCSP_INPUT
 int __devinit pcspkr_input_init(struct input_dev **rdev, struct device *dev);
 int pcspkr_input_remove(struct input_dev *dev);
 void pcspkr_stop_sound(void);
+#else
+static inline int pcspkr_input_init(struct input_dev **rdev,
+	struct device *dev) { return 0; }
+static inline int pcspkr_input_remove(struct input_dev *dev) { return 0; }
+static inline void pcspkr_stop_sound(void) { }
+#endif	/* CONFIG_SND_PCSP_INPUT */
 
 #endif
diff -r 25a20d46d89a -r 903c7be2316a drivers/pcsp/pcsp_mixer.c
--- a/drivers/pcsp/pcsp_mixer.c	Mon May 05 14:16:12 2008 +0200
+++ b/drivers/pcsp/pcsp_mixer.c	Thu May 08 21:20:04 2008 +0400
@@ -78,6 +78,7 @@ static int pcsp_treble_put(struct snd_kc
 	return changed;
 }
 
+#ifdef CONFIG_SND_PCSP_INPUT
 static int pcsp_pcspkr_info(struct snd_kcontrol *kcontrol,
 			    struct snd_ctl_elem_info *uinfo)
 {
@@ -108,6 +109,7 @@ static int pcsp_pcspkr_put(struct snd_kc
 	}
 	return changed;
 }
+#endif	/* CONFIG_SND_PCSP_INPUT */
 
 #define PCSP_MIXER_CONTROL(ctl_type, ctl_name) \
 { \
@@ -121,7 +123,9 @@ static struct snd_kcontrol_new __devinit
 static struct snd_kcontrol_new __devinitdata snd_pcsp_controls[] = {
 	PCSP_MIXER_CONTROL(enable, "Master Playback Switch"),
 	PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"),
+#ifdef CONFIG_SND_PCSP_INPUT
 	PCSP_MIXER_CONTROL(pcspkr, "PC Speaker Playback Switch"),
+#endif	/* CONFIG_SND_PCSP_INPUT */
 };
 
 int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip)

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [patch] snd-pcsp: relax dependancy on CONFIG_INPUT
  2008-05-08 18:25       ` Stas Sergeev
@ 2008-05-08 22:17         ` Adrian Bunk
  2008-05-08 22:38           ` Stas Sergeev
  0 siblings, 1 reply; 7+ messages in thread
From: Adrian Bunk @ 2008-05-08 22:17 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: Takashi Iwai, alsa-devel

On Thu, May 08, 2008 at 10:25:49PM +0400, Stas Sergeev wrote:
> Hello.
> 
> Adrian Bunk wrote:
> > Sorry for the silly question, but are there serious usecases where 
> > people in very space limited environments and with CONFIG_INPUT=n
> > want PC-Speaker support?
> Oh, I've just heard youre screaming
> "this all is not worth a new config option!". :)
> 
> Here's another patch instead.
> Without exporting a new option to the
> user this time.
>...
> +config SND_PCSP_INPUT
> +	def_bool y
> +	depends on INPUT
> +	depends on SND_PCSP
>...

The number of users with CONFIG_INPUT=n on a PC might be more or less 
zero (even more considering the fact that you have to set 
CONFIG_EMBEDDED=y for being able to disable INPUT) - your patch adds a 
few #ifdef's that don't have any effect in practice.

And your patches breaks the compilation with CONFIG_SND_PCSP=y, 
CONFIG_INPUT=m if anyone will ever try this combination.

The latter is not unfixable, and I might be very nitpicking here,
but I do simply not see the point why we need this more complicated.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

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

* Re: [patch] snd-pcsp: relax dependancy on CONFIG_INPUT
  2008-05-08 22:17         ` Adrian Bunk
@ 2008-05-08 22:38           ` Stas Sergeev
  2008-05-08 22:48             ` Adrian Bunk
  0 siblings, 1 reply; 7+ messages in thread
From: Stas Sergeev @ 2008-05-08 22:38 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Takashi Iwai, alsa-devel

Hello.

Adrian Bunk wrote:
> And your patches breaks the compilation with CONFIG_SND_PCSP=y, 
> CONFIG_INPUT=m if anyone will ever try this combination.
OK, that's nasty indeed...
Then I guess it is not a big deal
to leave that dependancy as-is until
the real need in changing it appear.

Btw, is there really no way at all
to tell kconfig something like
depends on INPUT if SND_PCSP_INPUT
or similar?

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

* Re: [patch] snd-pcsp: relax dependancy on CONFIG_INPUT
  2008-05-08 22:38           ` Stas Sergeev
@ 2008-05-08 22:48             ` Adrian Bunk
  0 siblings, 0 replies; 7+ messages in thread
From: Adrian Bunk @ 2008-05-08 22:48 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: Takashi Iwai, alsa-devel

On Fri, May 09, 2008 at 02:38:46AM +0400, Stas Sergeev wrote:
> Hello.
> 
> Adrian Bunk wrote:
> > And your patches breaks the compilation with CONFIG_SND_PCSP=y, 
> > CONFIG_INPUT=m if anyone will ever try this combination.
> OK, that's nasty indeed...
> Then I guess it is not a big deal
> to leave that dependancy as-is until
> the real need in changing it appear.
> 
> Btw, is there really no way at all
> to tell kconfig something like
> depends on INPUT if SND_PCSP_INPUT
> or similar?

There are different ways how you could express this in kconfig
depending on what exactly would be intended.

But the stuff we already have in kconfig has enough problematic 
cornercases, and making anything more complicated IMHO requires
a justification that there's a real need for it.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

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

end of thread, other threads:[~2008-05-08 22:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <482316B8.5080200@aknet.ru>
     [not found] ` <s5h4p98yfof.wl%tiwai@suse.de>
2008-05-08 17:31   ` [patch] snd-pcsp: relax dependancy on CONFIG_INPUT Stas Sergeev
2008-05-08 17:35     ` Adrian Bunk
2008-05-08 17:53       ` Stas Sergeev
2008-05-08 18:25       ` Stas Sergeev
2008-05-08 22:17         ` Adrian Bunk
2008-05-08 22:38           ` Stas Sergeev
2008-05-08 22:48             ` Adrian Bunk

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.