netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>,
	dada1@cosmosbay.com, bunk@stusta.de, davem@davemloft.net,
	netdev@vger.kernel.org
Subject: Re: [PATCH] Fix build errors on 32bit platforms with new ktime
Date: Wed, 25 Apr 2007 00:15:15 +0200	[thread overview]
Message-ID: <1177452915.30986.61.camel@localhost.localdomain> (raw)
In-Reply-To: <20070424145754.1a37f666@dxpl.pdx.osdl.net>

On Tue, 2007-04-24 at 14:57 -0700, Stephen Hemminger wrote:
> On Wed, 25 Apr 2007 06:55:39 +0900 (JST)
> YOSHIFUJI Hideaki / 吉藤英明  <yoshfuji@linux-ipv6.org> wrote:
> 
> > In article <20070424100420.2860db68@dxpl.pdx.osdl.net> (at Tue, 24 Apr 2007 10:04:20 -0700), Stephen Hemminger <shemminger@linux-foundation.org> says:
> > 
> > > Yoshifuji-san had the right idea, but ktime_to_us needs to be defined
> > > in a way that works on both 64 and 32bit platforms.
> > 
> > No, this does not cure.
> > >  
> > > +#define ktime_to_us(kt)			((kt).tv64 / NSEC_PER_SEC)
> > > +
> > 
> > NSEC_PER_USEC?
> 
> On 64 bit platforms, ktime stores nano-seconds in a 64 bit value, so
> this is correct.

Err, nsec_value / NSEC_PER_SEC results in seconds AFAICS

nsec_value / NSEC_PER_USEC gives you microseconds

> > 
> > > +static inline s64 ktime_to_us(const ktime_t kt)
> > > +{
> > > +	return (s64) kt.tv_sec * USEC_PER_SEC + kt.tv_nsec / NSEC_PER_USEC;
> > > +}
> > > +
> > 
> > Please do NOT use division here, which was the source of the
> > linkage error, and the reason why I posted a patch to use
> > ktime_to_timeval().
> 
> On 32 bit platforms, ktime stores as two 32 bit values. Therefore the
> division is only 32bit and therefore okay.

Nope.

#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
....

and on i386

config KTIME_SCALAR
        bool
        default y

so you take the 

ktime_to_timeval is probably the right way for it.

	tglx



  parent reply	other threads:[~2007-04-24 22:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-24 15:17 [net-2.6.22] [TCP]: Fix linkage errors YOSHIFUJI Hideaki / 吉藤英明
2007-04-24 15:53 ` Adrian Bunk
2007-04-24 15:58   ` YOSHIFUJI Hideaki / 吉藤英明
2007-04-24 16:10     ` YOSHIFUJI Hideaki / 吉藤英明
2007-04-24 16:38       ` Eric Dumazet
2007-04-24 17:04         ` [PATCH] Fix build errors on 32bit platforms with new ktime Stephen Hemminger
2007-04-24 18:19           ` Adrian Bunk
2007-04-24 18:48           ` Eric Dumazet
2007-04-24 21:54             ` David Miller
2007-04-24 21:55           ` YOSHIFUJI Hideaki / 吉藤英明
2007-04-24 21:57             ` Stephen Hemminger
2007-04-24 22:12               ` Eric Dumazet
2007-04-24 22:29                 ` Stephen Hemminger
2007-04-24 22:15               ` Thomas Gleixner [this message]
2007-04-24 22:49                 ` YOSHIFUJI Hideaki / 吉藤英明
2007-04-24 23:22                   ` David Miller
2007-04-24 16:03   ` [net-2.6.22] [TCP]: Fix linkage errors Eric Dumazet
2007-04-24 18:17     ` Adrian Bunk

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=1177452915.30986.61.camel@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=bunk@stusta.de \
    --cc=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    --cc=yoshfuji@linux-ipv6.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;
as well as URLs for NNTP newsgroup(s).