* [PATCH 1/7] ALSA: trident: Simplify with str_on_off()
2025-01-07 15:56 [PATCH 0/7] ALSA: Simplify with standard helpers Takashi Iwai
@ 2025-01-07 15:56 ` Takashi Iwai
2025-01-07 15:56 ` [PATCH 2/7] ALSA: sonicvibes: Simplify with str_off_on() Takashi Iwai
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2025-01-07 15:56 UTC (permalink / raw)
To: linux-sound
Use the standard helper str_on_off() to simplify the code.
Only code refactoring, no behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/trident/trident_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index e98eea1e6d81..8039f445bee2 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3278,9 +3278,9 @@ static void snd_trident_proc_read(struct snd_info_entry *entry,
snd_iprintf(buffer, "Spurious IRQs : %d\n", trident->spurious_irq_count);
snd_iprintf(buffer, "Spurious IRQ dlta: %d\n", trident->spurious_irq_max_delta);
if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018)
- snd_iprintf(buffer, "IEC958 Mixer Out : %s\n", trident->spdif_ctrl == 0x28 ? "on" : "off");
+ snd_iprintf(buffer, "IEC958 Mixer Out : %s\n", str_on_off(trident->spdif_ctrl == 0x28));
if (trident->device == TRIDENT_DEVICE_ID_NX) {
- snd_iprintf(buffer, "Rear Speakers : %s\n", trident->ac97_ctrl & 0x00000010 ? "on" : "off");
+ snd_iprintf(buffer, "Rear Speakers : %s\n", str_on_off(trident->ac97_ctrl & 0x00000010));
if (trident->tlb.entries) {
snd_iprintf(buffer,"\nVirtual Memory\n");
snd_iprintf(buffer, "Memory Maximum : %d\n", trident->tlb.memhdr->size);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/7] ALSA: sonicvibes: Simplify with str_off_on()
2025-01-07 15:56 [PATCH 0/7] ALSA: Simplify with standard helpers Takashi Iwai
2025-01-07 15:56 ` [PATCH 1/7] ALSA: trident: Simplify with str_on_off() Takashi Iwai
@ 2025-01-07 15:56 ` Takashi Iwai
2025-01-07 15:56 ` [PATCH 3/7] ALSA: hdspm: Simplify with str_on_off() Takashi Iwai
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2025-01-07 15:56 UTC (permalink / raw)
To: linux-sound
Use the standard helper str_off_on() to simplify the code.
Only code refactoring, no behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/sonicvibes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index e510715a6c95..c30eaf1038e7 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1118,7 +1118,7 @@ static void snd_sonicvibes_proc_read(struct snd_info_entry *entry,
tmp = sonic->srs_space & 0x0f;
snd_iprintf(buffer, "SRS 3D : %s\n",
- sonic->srs_space & 0x80 ? "off" : "on");
+ str_off_on(sonic->srs_space & 0x80));
snd_iprintf(buffer, "SRS Space : %s\n",
tmp == 0x00 ? "100%" :
tmp == 0x01 ? "75%" :
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 3/7] ALSA: hdspm: Simplify with str_on_off()
2025-01-07 15:56 [PATCH 0/7] ALSA: Simplify with standard helpers Takashi Iwai
2025-01-07 15:56 ` [PATCH 1/7] ALSA: trident: Simplify with str_on_off() Takashi Iwai
2025-01-07 15:56 ` [PATCH 2/7] ALSA: sonicvibes: Simplify with str_off_on() Takashi Iwai
@ 2025-01-07 15:56 ` Takashi Iwai
2025-01-07 15:56 ` [PATCH 4/7] ALSA: emu10k1: " Takashi Iwai
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2025-01-07 15:56 UTC (permalink / raw)
To: linux-sound
Use the standard helper str_on_off() to simplify the code.
Only code refactoring, no behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/rme9652/hdspm.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index d7290463d654..f89718b19d23 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -4927,14 +4927,14 @@ snd_hdspm_proc_read_madi(struct snd_info_entry *entry,
x, (unsigned long) hdspm->period_bytes);
snd_iprintf(buffer, "Line out: %s\n",
- (hdspm->control_register & HDSPM_LineOut) ? "on " : "off");
+ str_on_off(hdspm->control_register & HDSPM_LineOut));
snd_iprintf(buffer,
"ClearTrackMarker = %s, Transmit in %s Channel Mode, "
"Auto Input %s\n",
- (hdspm->control_register & HDSPM_clr_tms) ? "on" : "off",
+ str_on_off(hdspm->control_register & HDSPM_clr_tms),
(hdspm->control_register & HDSPM_TX_64ch) ? "64" : "56",
- (hdspm->control_register & HDSPM_AutoInp) ? "on" : "off");
+ str_on_off(hdspm->control_register & HDSPM_AutoInp));
if (!(hdspm->control_register & HDSPM_ClockModeMaster))
@@ -5088,12 +5088,9 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry,
snd_iprintf(buffer,
"ClearTrackMarker %s, Emphasis %s, Dolby %s\n",
- (hdspm->
- control_register & HDSPM_clr_tms) ? "on" : "off",
- (hdspm->
- control_register & HDSPM_Emphasis) ? "on" : "off",
- (hdspm->
- control_register & HDSPM_Dolby) ? "on" : "off");
+ str_on_off(hdspm->control_register & HDSPM_clr_tms),
+ str_on_off(hdspm->control_register & HDSPM_Emphasis),
+ str_on_off(hdspm->control_register & HDSPM_Dolby));
pref_syncref = hdspm_pref_sync_ref(hdspm);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/7] ALSA: emu10k1: Simplify with str_on_off()
2025-01-07 15:56 [PATCH 0/7] ALSA: Simplify with standard helpers Takashi Iwai
` (2 preceding siblings ...)
2025-01-07 15:56 ` [PATCH 3/7] ALSA: hdspm: Simplify with str_on_off() Takashi Iwai
@ 2025-01-07 15:56 ` Takashi Iwai
2025-01-07 15:56 ` [PATCH 5/7] ALSA: firewire: " Takashi Iwai
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2025-01-07 15:56 UTC (permalink / raw)
To: linux-sound
Use the standard helper str_on_off() to simplify the code.
Only code refactoring, no behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/emu10k1/emuproc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 737c28d31b41..47448750f334 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -46,9 +46,9 @@ static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu,
if (rate_reg > 0) {
rate = snd_emu10k1_ptr_read(emu, rate_reg, 0);
- snd_iprintf(buffer, "S/PDIF Valid : %s\n", rate & SRCS_SPDIFVALID ? "on" : "off");
- snd_iprintf(buffer, "S/PDIF Locked : %s\n", rate & SRCS_SPDIFLOCKED ? "on" : "off");
- snd_iprintf(buffer, "Rate Locked : %s\n", rate & SRCS_RATELOCKED ? "on" : "off");
+ snd_iprintf(buffer, "S/PDIF Valid : %s\n", str_on_off(rate & SRCS_SPDIFVALID));
+ snd_iprintf(buffer, "S/PDIF Locked : %s\n", str_on_off(rate & SRCS_SPDIFLOCKED));
+ snd_iprintf(buffer, "Rate Locked : %s\n", str_on_off(rate & SRCS_RATELOCKED));
/* From ((Rate * 48000 ) / 262144); */
snd_iprintf(buffer, "Estimated Sample Rate : %d\n", ((rate & 0xFFFFF ) * 375) >> 11);
}
@@ -208,7 +208,7 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry,
#if 0
val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0);
snd_iprintf(buffer, "\nZoomed Video\n");
- snd_iprintf(buffer, "Rate Locked : %s\n", val & SRCS_RATELOCKED ? "on" : "off");
+ snd_iprintf(buffer, "Rate Locked : %s\n", str_on_off(val & SRCS_RATELOCKED));
snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", val & SRCS_ESTSAMPLERATE);
#endif
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/7] ALSA: firewire: Simplify with str_on_off()
2025-01-07 15:56 [PATCH 0/7] ALSA: Simplify with standard helpers Takashi Iwai
` (3 preceding siblings ...)
2025-01-07 15:56 ` [PATCH 4/7] ALSA: emu10k1: " Takashi Iwai
@ 2025-01-07 15:56 ` Takashi Iwai
2025-01-07 23:59 ` Takashi Sakamoto
2025-01-07 15:56 ` [PATCH 6/7] ALSA: seq: oss: Simplify with str_enabled_disabled() Takashi Iwai
2025-01-07 15:56 ` [PATCH 7/7] ALSA: hda: Simplify with str_enable_disable() Takashi Iwai
6 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2025-01-07 15:56 UTC (permalink / raw)
To: linux-sound; +Cc: Takashi Sakamoto
Use the standard helper str_on_off() to simplify the code.
Only code refactoring, no behavior change.
Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/firewire/fireface/ff-protocol-former.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/firewire/fireface/ff-protocol-former.c b/sound/firewire/fireface/ff-protocol-former.c
index efd59e9d9935..0907d0a2296f 100644
--- a/sound/firewire/fireface/ff-protocol-former.c
+++ b/sound/firewire/fireface/ff-protocol-former.c
@@ -135,13 +135,13 @@ static void dump_clock_config(struct snd_ff *ff, struct snd_info_buffer *buffer)
snd_iprintf(buffer, "Output S/PDIF format: %s (Emphasis: %s)\n",
(data & 0x00000020) ? "Professional" : "Consumer",
- (data & 0x00000040) ? "on" : "off");
+ str_on_off(data & 0x00000040));
snd_iprintf(buffer, "Optical output interface format: %s\n",
(data & 0x00000100) ? "S/PDIF" : "ADAT");
snd_iprintf(buffer, "Word output single speed: %s\n",
- (data & 0x00002000) ? "on" : "off");
+ str_on_off(data & 0x00002000));
snd_iprintf(buffer, "S/PDIF input interface: %s\n",
(data & 0x00000200) ? "Optical" : "Coaxial");
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 5/7] ALSA: firewire: Simplify with str_on_off()
2025-01-07 15:56 ` [PATCH 5/7] ALSA: firewire: " Takashi Iwai
@ 2025-01-07 23:59 ` Takashi Sakamoto
0 siblings, 0 replies; 9+ messages in thread
From: Takashi Sakamoto @ 2025-01-07 23:59 UTC (permalink / raw)
To: Takashi Iwai, linux-sound
Hi,
On Wed, Jan 8, 2025, at 00:56, Takashi Iwai wrote:
> Use the standard helper str_on_off() to simplify the code.
> Only code refactoring, no behavior change.
>
> Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> sound/firewire/fireface/ff-protocol-former.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
It was in my TODO list, good.
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
# Akeome & Kotoyoro
Takashi Sakamoto
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 6/7] ALSA: seq: oss: Simplify with str_enabled_disabled()
2025-01-07 15:56 [PATCH 0/7] ALSA: Simplify with standard helpers Takashi Iwai
` (4 preceding siblings ...)
2025-01-07 15:56 ` [PATCH 5/7] ALSA: firewire: " Takashi Iwai
@ 2025-01-07 15:56 ` Takashi Iwai
2025-01-07 15:56 ` [PATCH 7/7] ALSA: hda: Simplify with str_enable_disable() Takashi Iwai
6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2025-01-07 15:56 UTC (permalink / raw)
To: linux-sound
Use the standard helper str_enabled_disabled() to simplify the code.
Only code refactoring, no behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/seq/oss/seq_oss_device.h | 4 ----
sound/core/seq/oss/seq_oss_init.c | 6 ------
sound/core/seq/oss/seq_oss_synth.c | 4 ++--
3 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h
index c0b1cce127a3..6163a00bc8de 100644
--- a/sound/core/seq/oss/seq_oss_device.h
+++ b/sound/core/seq/oss/seq_oss_device.h
@@ -156,8 +156,4 @@ snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
ev->dest.port = dest_port;
}
-
-/* misc. functions for proc interface */
-char *enabled_str(bool b);
-
#endif /* __SEQ_OSS_DEVICE_H */
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index e0733efba027..e6d7d83ed0e7 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -449,12 +449,6 @@ snd_seq_oss_reset(struct seq_oss_devinfo *dp)
/*
* misc. functions for proc interface
*/
-char *
-enabled_str(bool b)
-{
- return b ? "enabled" : "disabled";
-}
-
static const char *
filemode_str(int val)
{
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index 02a90c960992..9de47e098b29 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -608,8 +608,8 @@ snd_seq_oss_synth_info_read(struct snd_info_buffer *buf)
rec->synth_type, rec->synth_subtype,
rec->nr_voices);
snd_iprintf(buf, " capabilities : ioctl %s / load_patch %s\n",
- enabled_str((long)rec->oper.ioctl),
- enabled_str((long)rec->oper.load_patch));
+ str_enabled_disabled((long)rec->oper.ioctl),
+ str_enabled_disabled((long)rec->oper.load_patch));
snd_use_lock_free(&rec->use_lock);
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 7/7] ALSA: hda: Simplify with str_enable_disable()
2025-01-07 15:56 [PATCH 0/7] ALSA: Simplify with standard helpers Takashi Iwai
` (5 preceding siblings ...)
2025-01-07 15:56 ` [PATCH 6/7] ALSA: seq: oss: Simplify with str_enabled_disabled() Takashi Iwai
@ 2025-01-07 15:56 ` Takashi Iwai
6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2025-01-07 15:56 UTC (permalink / raw)
To: linux-sound
Use the standard helper str_enable_disable() to simplify the code.
Only code refactoring, no behavior change.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/hda/hdac_component.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c
index bb37e7e0bd79..9c82a2864a2f 100644
--- a/sound/hda/hdac_component.c
+++ b/sound/hda/hdac_component.c
@@ -5,6 +5,7 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/component.h>
+#include <linux/string_choices.h>
#include <sound/core.h>
#include <sound/hdaudio.h>
#include <sound/hda_component.h>
@@ -42,8 +43,7 @@ int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
if (!acomp->ops->codec_wake_override)
return 0;
- dev_dbg(bus->dev, "%s codec wakeup\n",
- enable ? "enable" : "disable");
+ dev_dbg(bus->dev, "%s codec wakeup\n", str_enable_disable(enable));
acomp->ops->codec_wake_override(acomp->dev, enable);
@@ -67,8 +67,7 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable)
{
struct drm_audio_component *acomp = bus->audio_component;
- dev_dbg(bus->dev, "display power %s\n",
- enable ? "enable" : "disable");
+ dev_dbg(bus->dev, "display power %s\n", str_enable_disable(enable));
mutex_lock(&bus->lock);
if (enable)
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread