diff mbox

[1/5] ASoC: intel: use __iowrite32_copy for 32 bit copy

Message ID 1413799148-6368-2-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul Oct. 20, 2014, 9:59 a.m. UTC
The driver was using own method to do 32bit copy, turns out we have a kernel
API so use that instead

Tested-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/sst/sst_loader.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

Comments

Takashi Iwai Oct. 20, 2014, 11:29 a.m. UTC | #1
At Mon, 20 Oct 2014 15:29:04 +0530,
Vinod Koul wrote:
> 
> The driver was using own method to do 32bit copy, turns out we have a kernel
> API so use that instead
> 
> Tested-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>  sound/soc/intel/sst/sst_loader.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/intel/sst/sst_loader.c b/sound/soc/intel/sst/sst_loader.c
> index b6d27c1..40e501b 100644
> --- a/sound/soc/intel/sst/sst_loader.c
> +++ b/sound/soc/intel/sst/sst_loader.c
> @@ -41,12 +41,9 @@
>  
>  static void memcpy32_toio(void __iomem *dst, const void *src, int count)
>  {
> -	int i;
> -	const u32 *src_32 = src;
> -	u32 *dst_32 = dst;
> -
> -	for (i = 0; i < count/sizeof(u32); i++)
> -		writel(*src_32++, dst_32++);
> +	/* __iowrite32_copy uses 32-bit count values so dev by 4 for right
> +	 * count in words */

s/dev/div/

Also, it's worth to make it inline, although the compiler would do it
automatically in most cases like this.


Takashi

> +	__iowrite32_copy(dst, src, count/4);
>  }
>  
>  /**
> -- 
> 1.7.0.4
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Vinod Koul Oct. 20, 2014, 1:14 p.m. UTC | #2
On Mon, Oct 20, 2014 at 01:29:33PM +0200, Takashi Iwai wrote:
> At Mon, 20 Oct 2014 15:29:04 +0530,
> Vinod Koul wrote:
> > 
> > The driver was using own method to do 32bit copy, turns out we have a kernel
> > API so use that instead
> > 
> > Tested-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> > Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> > ---
> >  sound/soc/intel/sst/sst_loader.c |    9 +++------
> >  1 files changed, 3 insertions(+), 6 deletions(-)
> > 
> > diff --git a/sound/soc/intel/sst/sst_loader.c b/sound/soc/intel/sst/sst_loader.c
> > index b6d27c1..40e501b 100644
> > --- a/sound/soc/intel/sst/sst_loader.c
> > +++ b/sound/soc/intel/sst/sst_loader.c
> > @@ -41,12 +41,9 @@
> >  
> >  static void memcpy32_toio(void __iomem *dst, const void *src, int count)
> >  {
> > -	int i;
> > -	const u32 *src_32 = src;
> > -	u32 *dst_32 = dst;
> > -
> > -	for (i = 0; i < count/sizeof(u32); i++)
> > -		writel(*src_32++, dst_32++);
> > +	/* __iowrite32_copy uses 32-bit count values so dev by 4 for right
> > +	 * count in words */
> 
> s/dev/div/
> 
> Also, it's worth to make it inline, although the compiler would do it
> automatically in most cases like this.
Yes it did, although it would make sense to do so here as well
diff mbox

Patch

diff --git a/sound/soc/intel/sst/sst_loader.c b/sound/soc/intel/sst/sst_loader.c
index b6d27c1..40e501b 100644
--- a/sound/soc/intel/sst/sst_loader.c
+++ b/sound/soc/intel/sst/sst_loader.c
@@ -41,12 +41,9 @@ 
 
 static void memcpy32_toio(void __iomem *dst, const void *src, int count)
 {
-	int i;
-	const u32 *src_32 = src;
-	u32 *dst_32 = dst;
-
-	for (i = 0; i < count/sizeof(u32); i++)
-		writel(*src_32++, dst_32++);
+	/* __iowrite32_copy uses 32-bit count values so dev by 4 for right
+	 * count in words */
+	__iowrite32_copy(dst, src, count/4);
 }
 
 /**