ALSA: Simplify with standard helpers
cover ALSA: Simplify with standard helpers
Hi,
this is a series of trivial patches just for replacing some code with the standard string helpers like str_on_off() for code simplification.
No functional change.
Takashi
===
Takashi Iwai (7):
ALSA: trident: Simplify with str_on_off()
ALSA: sonicvibes: Simplify with str_off_on()
ALSA: hdspm: Simplify with str_on_off()
ALSA: emu10k1: Simplify with str_on_off()
ALSA: firewire: Simplify with str_on_off()
ALSA: seq: oss: Simplify with str_enabled_disabled()
ALSA: hda: Simplify with str_enable_disable()
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 ++-- sound/firewire/fireface/ff-protocol-former.c | 4 ++-- sound/hda/hdac_component.c | 7 +++---- sound/pci/emu10k1/emuproc.c | 8 ++++---- sound/pci/rme9652/hdspm.c | 15 ++++++--------- sound/pci/sonicvibes.c | 2 +- sound/pci/trident/trident_main.c | 4 ++-- 9 files changed, 20 insertions(+), 34 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/7 ALSA: trident: Simplify with str_on_off()
Use the standard helper str_on_off() to simplify the code. Only code refactoring, no behavior change.
--- sound/pci/trident/trident_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/trident/trident_main.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 2/7 ALSA: sonicvibes: Simplify with str_off_on()
In reply to Takashi IwaiUse the standard helper str_off_on() to simplify the code. Only code refactoring, no behavior change.
--- sound/pci/sonicvibes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/sonicvibes.c +1 -1
@@ -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%" :
Signature · 1 line
2.43.0
PATCH 3/7 ALSA: hdspm: Simplify with str_on_off()
In reply to Takashi IwaiUse the standard helper str_on_off() to simplify the code. Only code refactoring, no behavior change.
--- sound/pci/rme9652/hdspm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
sound/pci/rme9652/hdspm.c +6 -9
@@ -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);
Signature · 1 line
2.43.0
PATCH 4/7 ALSA: emu10k1: Simplify with str_on_off()
In reply to Takashi IwaiUse the standard helper str_on_off() to simplify the code. Only code refactoring, no behavior change.
--- sound/pci/emu10k1/emuproc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/pci/emu10k1/emuproc.c +4 -4
@@ -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 }
Signature · 1 line
2.43.0
PATCH 5/7 ALSA: firewire: Simplify with str_on_off()
In reply to Takashi IwaiUse the standard helper str_on_off() to simplify the code. Only code refactoring, no behavior change.
--- sound/firewire/fireface/ff-protocol-former.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/firewire/fireface/ff-protocol-former.c +2 -2
@@ -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" );
Signature · 1 line
2.43.0
Re: [PATCH 5/7] ALSA: firewire: Simplify with str_on_off()
Hi,
Quoted 8 lines · Takashi Iwai
Use the standard helper
str_on_off()to simplify the code. Only code refactoring, no behavior change.Cc Takashi Sakamoto <[email protected]>Signed-off-by Takashi Iwai <[email protected]>--- sound/firewire/fireface/ff-protocol-former.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
It was in my TODO list, good.
# Akeome & Kotoyoro
Takashi Sakamoto
PATCH 6/7 ALSA: seq: oss: Simplify with str_enabled_disabled()
In reply to Takashi IwaiUse the standard helper str_enabled_disabled() to simplify the code. Only code refactoring, no behavior change.
--- 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(-)
sound/core/seq/oss/seq_oss_device.h +0 -4
@@ -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 */
sound/core/seq/oss/seq_oss_init.c +0 -6
@@ -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) {
sound/core/seq/oss/seq_oss_synth.c +2 -2
@@ -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); } }
Signature · 1 line
2.43.0
PATCH 7/7 ALSA: hda: Simplify with str_enable_disable()
In reply to Takashi IwaiUse the standard helper str_enable_disable() to simplify the code. Only code refactoring, no behavior change.
--- sound/hda/hdac_component.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/hda/hdac_component.c +3 -4
@@ -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)
Signature · 1 line
2.43.0