lkml.org 
[lkml]   [2008]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux 2.6.26-rc5


On Thu, 5 Jun 2008, Bjorn Helgaas wrote:
>
> for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
> - if (res->flags & IORESOURCE_DISABLED)
> + if (res->flags & IORESOURCE_UNSET ||
> + res->flags & IORESOURCE_DISABLED)
> continue;

Umm. If I was a compiler, I'd be warning about this. You don't get a
warning about suggesting parentheses around the '&'?

Also, regardless of lack of warnings, the natural way to do this is to
just say

if (res->flags & (IORESOURCE_DISABLED | IORESOURCE_UNSET))
continue;

which is what any sane compiler would rewrite it to anyway, but since it's
not just more readable for computers, but for humans too, why not do it
that way?

Linus


\
 
 \ /
  Last update: 2008-06-05 18:21    [W:0.064 / U:0.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site