* [PATCH] ALSA: emu10k1: minor optimizations
@ 2023-04-21 17:26 Oswald Buddenhagen
2023-04-22 7:51 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Oswald Buddenhagen @ 2023-04-21 17:26 UTC (permalink / raw)
To: alsa-devel; +Cc: Takashi Iwai
- In snd_emu10k1_look_for_ctl(), evaluate the cheap condition first
- In _snd_emu10k1_{audigy_,}init_efx(), don't use expensive bit setting
loops to fill arrays
- In snd_emu_proc_ptr_reg_read(), remove useless condition - iobase can
be only 0 or 0x20
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
---
sound/pci/emu10k1/emufx.c | 18 +++++++-----------
sound/pci/emu10k1/emuproc.c | 5 +----
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 6cf7c8b1de47..704f6564668e 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -641,8 +641,8 @@ snd_emu10k1_look_for_ctl(struct snd_emu10k1 *emu,
list_for_each_entry(ctl, &emu->fx8010.gpr_ctl, list) {
kcontrol = ctl->kcontrol;
if (kcontrol->id.iface == id->iface &&
- !strcmp(kcontrol->id.name, id->name) &&
- kcontrol->id.index == id->index)
+ kcontrol->id.index == id->index &&
+ !strcmp(kcontrol->id.name, id->name))
return ctl;
}
return NULL;
@@ -1213,7 +1213,7 @@ static int snd_emu10k1_audigy_dsp_convert_32_to_2x16(
static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
{
- int err, i, z, gpr, nctl;
+ int err, z, gpr, nctl;
int bit_shifter16;
const int playback = 10;
const int capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); /* we reserve 10 voices */
@@ -1245,12 +1245,10 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
icode->code = icode->tram_addr_map + 256;
/* clear free GPRs */
- for (i = 0; i < 512; i++)
- set_bit(i, icode->gpr_valid);
+ memset(icode->gpr_valid, 0xff, sizeof(icode->gpr_valid));
/* clear TRAM data & address lines */
- for (i = 0; i < 256; i++)
- set_bit(i, icode->tram_valid);
+ memset(icode->tram_valid, 0xff, sizeof(icode->tram_valid));
strcpy(icode->name, "Audigy DSP code for ALSA");
ptr = 0;
@@ -1886,12 +1884,10 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
icode->code = icode->tram_addr_map + 160;
/* clear free GPRs */
- for (i = 0; i < 256; i++)
- set_bit(i, icode->gpr_valid);
+ memset(icode->gpr_valid, 0xff, sizeof(icode->gpr_valid));
/* clear TRAM data & address lines */
- for (i = 0; i < 160; i++)
- set_bit(i, icode->tram_valid);
+ memset(icode->tram_valid, 0xff, sizeof(icode->tram_valid));
strcpy(icode->name, "SB Live! FX8010 code for ALSA v1.2 by Jaroslav Kysela");
ptr = 0; i = 0;
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 6e20cca9c98f..bec72dc60a41 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -477,10 +477,7 @@ static void snd_emu_proc_ptr_reg_read(struct snd_info_entry *entry,
for(i = offset; i < offset+length; i++) {
snd_iprintf(buffer, "%02X: ",i);
for (j = 0; j < voices; j++) {
- if(iobase == 0)
- value = snd_ptr_read(emu, 0, i, j);
- else
- value = snd_ptr_read(emu, 0x20, i, j);
+ value = snd_ptr_read(emu, iobase, i, j);
snd_iprintf(buffer, "%08lX ", value);
}
snd_iprintf(buffer, "\n");
--
2.40.0.152.g15d061e6df
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ALSA: emu10k1: minor optimizations
2023-04-21 17:26 [PATCH] ALSA: emu10k1: minor optimizations Oswald Buddenhagen
@ 2023-04-22 7:51 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2023-04-22 7:51 UTC (permalink / raw)
To: Oswald Buddenhagen; +Cc: alsa-devel
On Fri, 21 Apr 2023 19:26:23 +0200,
Oswald Buddenhagen wrote:
> @@ -1245,12 +1245,10 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
> icode->code = icode->tram_addr_map + 256;
>
> /* clear free GPRs */
> - for (i = 0; i < 512; i++)
> - set_bit(i, icode->gpr_valid);
> + memset(icode->gpr_valid, 0xff, sizeof(icode->gpr_valid));
>
> /* clear TRAM data & address lines */
> - for (i = 0; i < 256; i++)
> - set_bit(i, icode->tram_valid);
> + memset(icode->tram_valid, 0xff, sizeof(icode->tram_valid));
While those are OK...
> strcpy(icode->name, "Audigy DSP code for ALSA");
> ptr = 0;
> @@ -1886,12 +1884,10 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
> icode->code = icode->tram_addr_map + 160;
>
> /* clear free GPRs */
> - for (i = 0; i < 256; i++)
> - set_bit(i, icode->gpr_valid);
> + memset(icode->gpr_valid, 0xff, sizeof(icode->gpr_valid));
>
> /* clear TRAM data & address lines */
> - for (i = 0; i < 160; i++)
> - set_bit(i, icode->tram_valid);
> + memset(icode->tram_valid, 0xff, sizeof(icode->tram_valid));
... those bitmap sizes don't match with the previous numbers, so this
is a behavior change.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-22 7:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 17:26 [PATCH] ALSA: emu10k1: minor optimizations Oswald Buddenhagen
2023-04-22 7:51 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox