lkml.org 
[lkml]   [2010]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 01/45] kstrtox: converting strings to integers done (hopefully) right
Date
On Monday 06 December 2010 16:16:36 Alexey Dobriyan wrote:
> > <snip>
> >> +/* Internal, do not use. */
> >> +int _kstrtol(const char *s, unsigned int base, long *res)
> >> +{
> >> + long long tmp;
> >> + int rv;
> >> +
> >> + rv = kstrtoll(s, base, &tmp);
> >> + if (rv < 0)
> >> + return rv;
> >> + if (tmp != (long long)(long)tmp)
> >> + return -EINVAL;
> >> + *res = tmp;
> >> + return 0;
> >> +}
> >> +EXPORT_SYMBOL(_kstrtol);
> >
> > Ok, probably I'm just being dense, but the "_" prefix tells me I probably
> > shouldn't use this function. The comment clearly tells me I shouldn't use
> > this function.
> > So, why is this exported? And if it is not/should not be exported, then
> > why is it not static?
> > (goes for other functions in this patch as well).
>
> It is used by kstrtol() if "long" and "long long" aren't the same type.
> I can't ifdef it because gcc doesn't allow "#if sizeof(long long) == ".
> "Do not use" hints "use kstrtol()".

Can't you use #ifdef CONFIG_64BIT to see if long is 64 bit wide?

Arnd


\
 
 \ /
  Last update: 2010-12-07 10:07    [W:0.072 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site