public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Pietikainen <pp@ee.oulu.fi>
To: linux-kernel@vger.kernel.org
Cc: linux-dvb@linuxtv.org
Subject: Use of floating point in the kernel
Date: Thu, 8 Jan 2004 01:59:12 +0200	[thread overview]
Message-ID: <20040107235912.GA23812@ee.oulu.fi> (raw)

Hi

There are a few instances of use of floating point in 2.6,

--- linux-2.6.0-1.30/drivers/media/dvb/ttpci/av7110.c~	2004-01-07 23:14:14.000000000 +0200
+++ linux-2.6.0-1.30/drivers/media/dvb/ttpci/av7110.c	2004-01-07 23:14:14.000000000 +0200
@@ -2673,9 +2673,9 @@
 	buf[1] = div & 0xff;
 	buf[2] = 0x8e;
 
-	if (freq < (u32) 16*168.25 )
+	if (freq < 2692 ) /* 16*168.25 */
 		config = 0xa0;
-	else if (freq < (u32) 16*447.25)
+	else if (freq < 7156) /* 16*447.25 */
 		config = 0x90;
 	else
 		config = 0x30;

(If I'm not mistaken a similar patch for this has already been sent to
Linus, just making sure the DVB people get this in their trees as well)
(u32) (16*168.25) would work too, I suppose.

The other case is a bit more widespread, patch below is mostly rhetoric :-)
http://www.winischhofer.net/linuxsisvga.shtml#download contains the latest version
of the sisfb that doesn't use floating point at all, so that is certainly the better
option.

--- linux-2.6.0-1.30/drivers/video/sis/sis_main.c~	2004-01-08 01:27:44.909006216 +0200
+++ linux-2.6.0-1.30/drivers/video/sis/sis_main.c	2004-01-08 01:28:19.111806600 +0200
@@ -616,6 +616,7 @@
 		var->left_margin + var->xres + var->right_margin +
 		var->hsync_len;
 	unsigned int vtotal = 0; 
+#error Use of floating point in the kernel is NOT safe!
 	double drate = 0, hrate = 0;
 	int found_mode = 0;
 	int old_mode;
--- linux-2.6.0-1.30/drivers/video/Kconfig~	2004-01-08 01:25:37.570364632 +0200
+++ linux-2.6.0-1.30/drivers/video/Kconfig	2004-01-08 01:25:37.571364480 +0200
@@ -704,7 +704,7 @@
 
 config FB_SIS
 	tristate "SIS acceleration"
-	depends on FB && PCI
+	depends on FB && PCI && BROKEN
 	help
 	  This is the frame buffer device driver for the SiS 630 and 640 Super
 	  Socket 7 UMA cards.  Specs available at <http://www.sis.com.tw/>.


-- 
Pekka Pietikainen

             reply	other threads:[~2004-01-08  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 23:59 Pekka Pietikainen [this message]
2004-01-08  3:34 ` Use of floating point in the kernel H. Peter Anvin
2004-01-08  3:48   ` Dave Jones
2004-01-08  3:52   ` Linus Torvalds
2004-01-08  3:54     ` H. Peter Anvin
     [not found] <1bvUw-7Ry-15@gated-at.bofh.it>
     [not found] ` <1bzbF-4cG-5@gated-at.bofh.it>
     [not found]   ` <1bzv7-4Cw-3@gated-at.bofh.it>
2004-01-08  4:12     ` Andi Kleen

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=20040107235912.GA23812@ee.oulu.fi \
    --to=pp@ee.oulu.fi \
    --cc=linux-dvb@linuxtv.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox