From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:3745 "EHLO omzsmtpe02.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932329AbdJKAp6 (ORCPT ); Tue, 10 Oct 2017 20:45:58 -0400 From: "Levin, Alexander (Sasha Levin)" To: "gregkh@linuxfoundation.org" CC: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [GIT PULL for-4.9 03/48] watchdog: kempld: fix gcc-4.3 build Date: Wed, 11 Oct 2017 00:45:19 +0000 Message-ID: <20171011004512.7949-4-alexander.levin@verizon.com> References: <20171011004512.7949-1-alexander.levin@verizon.com> In-Reply-To: <20171011004512.7949-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Arnd Bergmann [ Upstream commit 3736d4eb6af37492aeded7fec0072dedd959c842 ] gcc-4.3 can't decide whether the constant value in kempld_prescaler[PRESCALER_21] is built-time constant or not, and gets confused by the logic in do_div(): drivers/watchdog/kempld_wdt.o: In function `kempld_wdt_set_stage_timeout': kempld_wdt.c:(.text.kempld_wdt_set_stage_timeout+0x130): undefined referenc= e to `__aeabi_uldivmod' This adds a call to ACCESS_ONCE() to force it to not consider it to be constant, and leaves the more efficient normal case in place for modern compilers, using an #ifdef to annotate why we do this hack. Signed-off-by: Arnd Bergmann Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/watchdog/kempld_wdt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c index 8e302d0e346c..3efa295ac627 100644 --- a/drivers/watchdog/kempld_wdt.c +++ b/drivers/watchdog/kempld_wdt.c @@ -140,12 +140,19 @@ static int kempld_wdt_set_stage_timeout(struct kempld= _wdt_data *wdt_data, unsigned int timeout) { struct kempld_device_data *pld =3D wdt_data->pld; - u32 prescaler =3D kempld_prescaler[PRESCALER_21]; + u32 prescaler; u64 stage_timeout64; u32 stage_timeout; u32 remainder; u8 stage_cfg; =20 +#if GCC_VERSION < 40400 + /* work around a bug compiling do_div() */ + prescaler =3D READ_ONCE(kempld_prescaler[PRESCALER_21]); +#else + prescaler =3D kempld_prescaler[PRESCALER_21]; +#endif + if (!stage) return -EINVAL; =20 --=20 2.11.0