From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Shanth Murthy <shanth.murthy@intel.com>,
Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>,
Zha Qipeng <qipeng.zha@intel.com>,
Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>
Subject: [PATCH v1] platform/x86: intel_pmc_ipc: fix division in 32-bit case
Date: Wed, 8 Feb 2017 18:00:28 +0200 [thread overview]
Message-ID: <20170208160028.13308-1-andriy.shevchenko@linux.intel.com> (raw)
On 32-bit x86 platforms we can't do 64-bit divisions:
ERROR: "__udivdi3" [drivers/platform/x86/intel_pmc_ipc.ko] undefined!
Replace plain division by do_div() macro call.
Reported-by: Darren Hart <dvhart@infradead.org>
Cc: Shanth Murthy <shanth.murthy@intel.com>
Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/platform/x86/intel_pmc_ipc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c
index 46202b6e7c87..8ad4d7b43423 100644
--- a/drivers/platform/x86/intel_pmc_ipc.c
+++ b/drivers/platform/x86/intel_pmc_ipc.c
@@ -62,7 +62,12 @@
#define GCR_TELEM_SHLW_S0IX_OFFSET 0x1080
/* Residency with clock rate at 19.2MHz to usecs */
-#define S0IX_RESIDENCY_IN_USECS(d, s) (((d) + (s)) * 10 / 192)
+#define S0IX_RESIDENCY_IN_USECS(d, s) \
+({ \
+ u64 result = 10ull * ((d) + (s)); \
+ do_div(result, 192); \
+ result; \
+})
/*
* 16-byte buffer for sending data associated with IPC command.
--
2.11.0
next reply other threads:[~2017-02-08 16:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 16:00 Andy Shevchenko [this message]
2017-02-10 4:24 ` Rajneesh Bhardwaj
2017-02-10 11:52 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170208160028.13308-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=qipeng.zha@intel.com \
--cc=rajneesh.bhardwaj@intel.com \
--cc=shanth.murthy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®