au88x0 eq cleanups
PATCH 1/2 au88x0 eq cleanups
Cleans up the equalizer code by converting some loops to proper for loops and fixes the conditions for looping.
Approved by Manuel Jander.
-Jeff
sound/pci/au88x0/au88x0_eq.c +18 -66
@@ -50,12 +50,9 @@static void vortex_EqHw_SetLeftCoefs (vortex_t * vortex,u16 a[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int eax, i =0 , n/*esp2c */ =0 ; +int eax, i =0 , n/*esp2c */ ; -if (eqhw->this04 <= n) -return ; - - do { +for (n =0 ; n < eqhw->this04; n++) {hwwrite (vortex->mmio,0x2b000 + n *0x30 , a[i +0 ]);hwwrite (vortex->mmio,0x2b004 + n *0x30 , a[i +1 ]);
@@ -81,21 +78,16 @@ }hwwrite (vortex->mmio,0x2b010 + n *0x30 , eax); - n++; i +=5 ; } -while (n < eqhw->this04); }static void vortex_EqHw_SetRightCoefs (vortex_t * vortex,u16 a[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int i =0 , n/*esp2c */ =0 , eax; - -if (eqhw->this04 <= n) -return ; +int i =0 , n/*esp2c */ , eax; - do { +for (n =0 ; n < eqhw->this04; n++) {hwwrite (vortex->mmio,0x2b1e0 + n *0x30 , a[0 + i]);hwwrite (vortex->mmio,0x2b1e4 + n *0x30 , a[1 + i]);
@@ -121,54 +113,42 @@ }hwwrite (vortex->mmio,0x2b1f0 + n *0x30 , eax); i +=5 ; - n++; } -while (n < eqhw->this04); }static void vortex_EqHw_SetLeftStates (vortex_t * vortex,u16 a[],u16 b[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int i =0 , ebx =0 ; +int i =0 , ebx =0 ;hwwrite (vortex->mmio,0x2b3fc , a[0 ]);hwwrite (vortex->mmio,0x2b400 , a[1 ]); -if (eqhw->this04 <0 ) -return ; - -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b014 + (i *0xc ), b[i]);hwwrite (vortex->mmio,0x2b018 + (i *0xc ), b[1 + i]);hwwrite (vortex->mmio,0x2b01c + (i *0xc ), b[2 + i]);hwwrite (vortex->mmio,0x2b020 + (i *0xc ), b[3 + i]); i +=4 ; - ebx++; } -while (eqhw->this04 > ebx); }static void vortex_EqHw_SetRightStates (vortex_t * vortex,u16 a[],u16 b[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int i =0 , ebx =0 ; +int i =0 , ebx =0 ;hwwrite (vortex->mmio,0x2b404 , a[0 ]);hwwrite (vortex->mmio,0x2b408 , a[1 ]); -if (eqhw->this04 <0 ) -return ; - -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b1f4 + (i *0xc ), b[i]);hwwrite (vortex->mmio,0x2b1f8 + (i *0xc ), b[1 + i]);hwwrite (vortex->mmio,0x2b1fc + (i *0xc ), b[2 + i]);hwwrite (vortex->mmio,0x2b200 + (i *0xc ), b[3 + i]); i +=4 ; - ebx++; } -while (ebx < eqhw->this04); }#if 0
@@ -260,60 +240,41 @@static void vortex_EqHw_SetLeftGainsTarget (vortex_t * vortex,u16 a[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int ebx =0 ; +int ebx; -if (eqhw->this04 <0 ) -return ; -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b02c + ebx *0x30 , a[ebx]); - ebx++; } -while (ebx < eqhw->this04); }static void vortex_EqHw_SetRightGainsTarget (vortex_t * vortex,u16 a[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int ebx =0 ; - -if (eqhw->this04 <0 ) -return ; +int ebx; -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b20c + ebx *0x30 , a[ebx]); - ebx++; } -while (ebx < eqhw->this04); }static void vortex_EqHw_SetLeftGainsCurrent (vortex_t * vortex,u16 a[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int ebx =0 ; - -if (eqhw->this04 <0 ) -return ; +int ebx; -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b028 + ebx *0x30 , a[ebx]); - ebx++; } -while (ebx < eqhw->this04); }static void vortex_EqHw_SetRightGainsCurrent (vortex_t * vortex,u16 a[]) {eqhw_t *eqhw = &(vortex->eq.this04); -int ebx =0 ; - -if (eqhw->this04 <0 ) -return ; +int ebx; -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b208 + ebx *0x30 , a[ebx]); - ebx++; } -while (ebx < eqhw->this04); }#if 0
@@ -384,26 +345,17 @@eqhw_t *eqhw = &(vortex->eq.this04);int ebx; -if (eqhw->this04 <0 ) -return ; - - ebx =0 ; -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b024 + ebx *0x30 , a[ebx]); - ebx++; } -while (ebx < eqhw->this04);hwwrite (vortex->mmio,0x2b3cc , a[eqhw->this04]);hwwrite (vortex->mmio,0x2b3d8 , a[eqhw->this04 +1 ]); - ebx =0 ; -do { +for (ebx =0 ; ebx < eqhw->this04; ebx++) {hwwrite (vortex->mmio,0x2b204 + ebx *0x30 , a[ebx + (eqhw->this04 +2 )]); - ebx++; } -while (ebx < eqhw->this04);hwwrite (vortex->mmio,0x2b3e4 , a[2 + (eqhw->this04 *2 )]);hwwrite (vortex->mmio,0x2b3f0 , a[3 + (eqhw->this04 *2 )]);