diff mbox series

ALSA: emu10k1: Use str_on_off() and str_yes_no() helpers

Message ID 20250109093110.3850-2-thorsten.blum@linux.dev (mailing list archive)
State New
Headers show
Series ALSA: emu10k1: Use str_on_off() and str_yes_no() helpers | expand

Commit Message

Thorsten Blum Jan. 9, 2025, 9:31 a.m. UTC
Remove hard-coded strings by using the str_on_off() and str_yes_no()
helper functions.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 sound/pci/emu10k1/emuproc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Takashi Iwai Jan. 9, 2025, 10:14 a.m. UTC | #1
On Thu, 09 Jan 2025 10:31:08 +0100,
Thorsten Blum wrote:
> 
> Remove hard-coded strings by using the str_on_off() and str_yes_no()
> helper functions.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

A part of those changes have been already fixed in sound.git tree
for-next branch.  Could you rebase and resubmit the missing piece?

BTW, a few other yes/no changes in sound/* are already on my queue,
which will be submitted in today.  I'll drop emu10k1 from there,
supposing you'll resubmit.


thanks,

Takashi

> ---
>  sound/pci/emu10k1/emuproc.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
> index 737c28d31b41..67a9216d3f4d 100644
> --- a/sound/pci/emu10k1/emuproc.c
> +++ b/sound/pci/emu10k1/emuproc.c
> @@ -11,6 +11,7 @@
>  
>  #include <linux/slab.h>
>  #include <linux/init.h>
> +#include <linux/string_choices.h>
>  #include <sound/core.h>
>  #include <sound/emu10k1.h>
>  #include "p16v.h"
> @@ -32,9 +33,9 @@ static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu,
>  	snd_iprintf(buffer, "\n%s\n", title);
>  
>  	if (status != 0xffffffff) {
> -		snd_iprintf(buffer, "Professional Mode     : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no");
> -		snd_iprintf(buffer, "Not Audio Data        : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no");
> -		snd_iprintf(buffer, "Copyright             : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no");
> +		snd_iprintf(buffer, "Professional Mode     : %s\n", str_yes_no(status & SPCS_PROFESSIONAL));
> +		snd_iprintf(buffer, "Not Audio Data        : %s\n", str_yes_no(status & SPCS_NOTAUDIODATA));
> +		snd_iprintf(buffer, "Copyright             : %s\n", str_yes_no(status & SPCS_COPYRIGHT));
>  		snd_iprintf(buffer, "Emphasis              : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]);
>  		snd_iprintf(buffer, "Mode                  : %i\n", (status & SPCS_MODEMASK) >> 6);
>  		snd_iprintf(buffer, "Category Code         : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8);
> @@ -46,9 +47,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); 
>  		}
> -- 
> 2.47.1
>
Thorsten Blum Jan. 9, 2025, 10:19 a.m. UTC | #2
On 9. Jan 2025, at 11:14, Takashi Iwai wrote:
> On Thu, 09 Jan 2025 10:31:08 +0100, Thorsten Blum wrote:
>> 
>> Remove hard-coded strings by using the str_on_off() and str_yes_no()
>> helper functions.
>> 
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> 
> A part of those changes have been already fixed in sound.git tree
> for-next branch.  Could you rebase and resubmit the missing piece?

Yes, of course.

Thanks,
Thorsten
diff mbox series

Patch

diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 737c28d31b41..67a9216d3f4d 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -11,6 +11,7 @@ 
 
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/string_choices.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 #include "p16v.h"
@@ -32,9 +33,9 @@  static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu,
 	snd_iprintf(buffer, "\n%s\n", title);
 
 	if (status != 0xffffffff) {
-		snd_iprintf(buffer, "Professional Mode     : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no");
-		snd_iprintf(buffer, "Not Audio Data        : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no");
-		snd_iprintf(buffer, "Copyright             : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no");
+		snd_iprintf(buffer, "Professional Mode     : %s\n", str_yes_no(status & SPCS_PROFESSIONAL));
+		snd_iprintf(buffer, "Not Audio Data        : %s\n", str_yes_no(status & SPCS_NOTAUDIODATA));
+		snd_iprintf(buffer, "Copyright             : %s\n", str_yes_no(status & SPCS_COPYRIGHT));
 		snd_iprintf(buffer, "Emphasis              : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]);
 		snd_iprintf(buffer, "Mode                  : %i\n", (status & SPCS_MODEMASK) >> 6);
 		snd_iprintf(buffer, "Category Code         : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8);
@@ -46,9 +47,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); 
 		}