All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ward <david.ward@gatech.edu>
To: Michael Krufky <mkrufky@kernellabs.com>, linux-media@vger.kernel.org
Subject: [PATCH] cx18: Use do_div for 64-bit division to fix 32-bit kernels
Date: Thu, 28 May 2009 20:27:39 -0400	[thread overview]
Message-ID: <4A1F2BFB.6010109@gatech.edu> (raw)

Use the do_div macro for 64-bit division.  Otherwise, the module will 
reference __udivdi3 under 32-bit kernels, which is not allowed in kernel 
space.  Follows style used in cx88 module.

Signed-off-by: David Ward <david.ward@gatech.edu>

diff -r 65ec132f20df -r 91b89f13adb7 
linux/drivers/media/video/cx18/cx18-av-core.c
--- a/linux/drivers/media/video/cx18/cx18-av-core.c    Wed May 27 
15:53:00 2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-av-core.c    Thu May 28 
19:16:10 2009 -0400
@@ -447,6 +447,7 @@ void cx18_av_std_setup(struct cx18 *cx)

      if (pll_post) {
          int fsc, pll;
+        u64 tmp64;

          pll = (28636360L * ((((u64)pll_int) << 25) + pll_frac)) >> 25;
          pll /= pll_post;
@@ -459,7 +460,9 @@ void cx18_av_std_setup(struct cx18 *cx)
                      "= %d.%03d\n", src_decimation / 256,
                      ((src_decimation % 256) * 1000) / 256);

-        fsc = ((((u64)sc) * 28636360)/src_decimation) >> 13L;
+        tmp64 = ((u64)sc) * 28636360;
+        do_div(tmp64, src_decimation);
+        fsc = ((u32)(tmp64 >> 13L));
          CX18_DEBUG_INFO_DEV(sd,
                      "Chroma sub-carrier initial freq = %d.%06d "
                      "MHz\n", fsc / 1000000, fsc % 1000000);


             reply	other threads:[~2009-05-29  0:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-29  0:27 David Ward [this message]
2009-05-29 11:09 ` [PATCH] cx18: Use do_div for 64-bit division to fix 32-bit kernels Andy Walls
2009-05-29 15:49   ` David Ward

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=4A1F2BFB.6010109@gatech.edu \
    --to=david.ward@gatech.edu \
    --cc=linux-media@vger.kernel.org \
    --cc=mkrufky@kernellabs.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 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.