All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen.5i5j@gmail.com>
To: nab@linux-iscsi.org
Cc: James Hogan <james.hogan@imgtec.com>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] drivers: target: target_core_mod: use div64_u64_rem() instead of operator '%' for u64
Date: Sat, 21 Dec 2013 10:08:55 +0800	[thread overview]
Message-ID: <52B4F837.1010403@gmail.com> (raw)

In kernel, need use div64_u64_rem() instead of operator '%' for u64, or
can not pass compiling (with allmodconfig under metag):

    MODPOST 2909 modules
  ERROR: "__umoddi3" [drivers/target/target_core_mod.ko] undefined!

Also need u64 type cast for u32 variable multiply u32 variable, or will
cause type overflow issue.


Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 drivers/target/target_core_alua.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index dc0d399..ff2aadc 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -489,7 +489,8 @@ static inline int core_alua_state_lba_dependent(
 			u64 first_lba = map->lba_map_first_lba;
 
 			if (segment_mult) {
-				start_lba = lba % (segment_size * segment_mult);
+				u64 tmp = (u64)segment_size * segment_mult;
+				div64_u64_rem(lba, tmp, &start_lba);
 				last_lba = first_lba + segment_size - 1;
 				if (start_lba >= first_lba &&
 				    start_lba <= last_lba) {
-- 
1.7.11.7

             reply	other threads:[~2013-12-21  2:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-21  2:08 Chen Gang [this message]
2013-12-22  2:56 ` [PATCH] drivers: target: target_core_mod: use div64_u64_rem() instead of operator '%' for u64 Nicholas A. Bellinger
2013-12-22  9:17   ` Chen Gang
2013-12-23  6:51     ` Nicholas A. Bellinger
2013-12-24  3:35       ` Chen Gang
2014-01-08  7:32         ` Hannes Reinecke
2014-01-08  7:32           ` Hannes Reinecke
2014-01-08 14:40           ` Chen Gang
2014-01-08 23:18           ` Nicholas A. Bellinger
2014-01-09 10:17             ` Hannes Reinecke
2014-01-10  5:47               ` Nicholas A. Bellinger
2014-01-10 16:06                 ` Chen Gang

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=52B4F837.1010403@gmail.com \
    --to=gang.chen.5i5j@gmail.com \
    --cc=james.hogan@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.