Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd58d3d2 authored by Guru Das Srinagesh's avatar Guru Das Srinagesh
Browse files

power: smb1398: Replace use of do_div() with plain division



do_div() operates on a 64-bit divisor and hence its use leads to the
following compilation error (error output edited for brevity):

  warning: comparison of distinct pointer types ('typeof ((iout_ua)) *'
  (aka 'int *') and 'uint64_t *' (aka 'unsigned long long *'))
  [-Wcompare-distinct-pointer-types]
          rc = smb1398_set_ichg_ma(chip, do_div(iout_ua, 1000));
                                         ^~~~~~~~~~~~~~~~~~~~~
  include/asm-generic/div64.h:226:28: note: expanded from macro 'do_div'
          (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
                 ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
  error: incompatible pointer types passing 'int *' to parameter of type
  'uint64_t *' (aka 'unsigned long long *')
  [-Werror,-Wincompatible-pointer-types]
          rc = smb1398_set_ichg_ma(chip, do_div(iout_ua, 1000));

Fix this by replacing do_div() with a simple division operation.

Change-Id: Ifb43b7cc68e0424bfbd7fa58dce449d6dd849cd6
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent 084fe9ff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2284,7 +2284,7 @@ static int smb1398_pre_regulator_iout_vote_cb(struct votable *votable,
		return -EINVAL;

	iout_ua = min(iout_ua, MAX_IOUT_UA);
	rc = smb1398_set_ichg_ma(chip, do_div(iout_ua, 1000));
	rc = smb1398_set_ichg_ma(chip, (iout_ua / 1000));
	if (rc < 0)
		return rc;