OSDN Git Service

qpnp-fg-gen3: fix 32-bit compilation
authorTirupathi Reddy <tirupath@codeaurora.org>
Fri, 10 Feb 2017 12:36:40 +0000 (18:06 +0530)
committerTirupathi Reddy <tirupath@codeaurora.org>
Fri, 10 Feb 2017 12:48:41 +0000 (18:18 +0530)
Make division operations in qpnp-fg-gen3 32-bit compatible.

CRs-Fixed: 2005232
Change-Id: I33215147d093aef3f04c46912bddd5aef284d7c4
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
drivers/power/supply/qcom/qpnp-fg-gen3.c

index 12f3d44..ed62c63 100644 (file)
@@ -2283,7 +2283,8 @@ static void sram_dump_work(struct work_struct *work)
                                            sram_dump_work.work);
        u8 buf[FG_SRAM_LEN];
        int rc;
-       s64 timestamp_ms;
+       s64 timestamp_ms, quotient;
+       s32 remainder;
 
        rc = fg_sram_read(chip, 0, 0, buf, FG_SRAM_LEN, FG_IMA_DEFAULT);
        if (rc < 0) {
@@ -2292,12 +2293,14 @@ static void sram_dump_work(struct work_struct *work)
        }
 
        timestamp_ms = ktime_to_ms(ktime_get_boottime());
-       fg_dbg(chip, FG_STATUS, "SRAM Dump Started at %lld.%lld\n",
-               timestamp_ms / 1000, timestamp_ms % 1000);
+       quotient = div_s64_rem(timestamp_ms, 1000, &remainder);
+       fg_dbg(chip, FG_STATUS, "SRAM Dump Started at %lld.%d\n",
+               quotient, remainder);
        dump_sram(buf, 0, FG_SRAM_LEN);
        timestamp_ms = ktime_to_ms(ktime_get_boottime());
-       fg_dbg(chip, FG_STATUS, "SRAM Dump done at %lld.%lld\n",
-               timestamp_ms / 1000, timestamp_ms % 1000);
+       quotient = div_s64_rem(timestamp_ms, 1000, &remainder);
+       fg_dbg(chip, FG_STATUS, "SRAM Dump done at %lld.%d\n",
+               quotient, remainder);
 resched:
        schedule_delayed_work(&chip->sram_dump_work,
                        msecs_to_jiffies(fg_sram_dump_period_ms));