From: Takashi Iwai Subject: Re: [PATCH] ASoC: prevent compilers from optimising pll calculation into __aeabi__uldivmod Date: Wed, 27 Apr 2011 10:19:48 +0200 Message-ID: References: <1303889252-6722-1-git-send-email-bs14@csr.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 87C5A10385E for ; Wed, 27 Apr 2011 10:19:49 +0200 (CEST) In-Reply-To: <1303889252-6722-1-git-send-email-bs14@csr.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Barry Song Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com, Barry Song <21cnbao@gmail.com>, Zhiwu Song , Binghua Duan , lrg@slimlogic.co.uk List-Id: alsa-devel@alsa-project.org At Wed, 27 Apr 2011 00:27:32 -0700, Barry Song wrote: > > From: Barry Song <21cnbao@gmail.com> > > The newest compiliers can optimize pll calculation in several codecs into __aeabi__uldivmod which doesn't exist in kernel. > Then the link will fail: > ERROR: "__aeabi_uldivmod" [sound/soc/codecs/snd-soc-wm8974.ko] undefined! > ERROR: "__aeabi_uldivmod" [sound/soc/codecs/snd-soc-wm8940.ko] undefined! > ERROR: "__aeabi_uldivmod" [sound/soc/codecs/snd-soc-wm8510.ko] undefined! > This patch prevent the optimizaton by insert ASM. Don't do this in the low driver level. If any, we should fix do_div() instead. thanks, Takashi > > Signed-off-by: Barry Song <21cnbao@gmail.com> > Cc: Zhiwu Song > Cc: Binghua Duan > --- > sound/soc/codecs/wm8510.c | 6 ++++++ > sound/soc/codecs/wm8940.c | 6 ++++++ > sound/soc/codecs/wm8974.c | 6 ++++++ > 3 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c > index db0dced..a636b15 100644 > --- a/sound/soc/codecs/wm8510.c > +++ b/sound/soc/codecs/wm8510.c > @@ -258,6 +258,12 @@ static void pll_factors(unsigned int target, unsigned int source) > Nmod = target % source; > Kpart = FIXED_PLL_SIZE * (long long)Nmod; > > + /* > + * The following asm() prevents the compiler from optimising > + * into a standard EABI function __aeabi__uldivmod() > + */ > + asm("" : "+r"(source)); > + > do_div(Kpart, source); > > K = Kpart & 0xFFFFFFFF; > diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c > index 25580e3..f6148af 100644 > --- a/sound/soc/codecs/wm8940.c > +++ b/sound/soc/codecs/wm8940.c > @@ -520,6 +520,12 @@ static void pll_factors(unsigned int target, unsigned int source) > Nmod = target % source; > Kpart = FIXED_PLL_SIZE * (long long)Nmod; > > + /* > + * The following asm() prevents the compiler from optimising > + * into a standard EABI function __aeabi__uldivmod() > + */ > + asm("" : "+r"(source)); > + > do_div(Kpart, source); > > K = Kpart & 0xFFFFFFFF; > diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c > index ca646a8..c9036d9 100644 > --- a/sound/soc/codecs/wm8974.c > +++ b/sound/soc/codecs/wm8974.c > @@ -317,6 +317,12 @@ static void pll_factors(struct pll_ *pll_div, > Nmod = target % source; > Kpart = FIXED_PLL_SIZE * (long long)Nmod; > > + /* > + * The following asm() prevents the compiler from optimising > + * into a standard EABI function __aeabi__uldivmod() > + */ > + asm("" : "+r"(source)); > + > do_div(Kpart, source); > > K = Kpart & 0xFFFFFFFF; > -- > 1.7.1 > > > > Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >