[lkml]   [2002]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux 2.5.8-pre2
Russell King wrote:
> (Oh, and a bugbear - people go running around adding checks for the
> return value of request_region and friends on embedded devices where
> there can't be the possibility of a clash waste memory needlessly.)

If you do:

#define request_region(start, n, name)
__request_region(start, n, name);
(struct resource *)1;
#define release_region(start, n) do { } while (0)

then the compiler will remove all those error checks for you,
as well as the release_region calls.

Of course if you actually want to use the innards of the
returned resource * then that's not so good.

However, you can make it:

#define request_region() \
({ \
struct resource *r; \
r = __request_region(); \
(struct resource *)((long)r | 1); \

and, amazingly, the compiler still knows that the value
is non-zero, and still will elide those tests. You'll
need to mask that bit off again to use the pointer.

Whether you'll stoop this low depends upon how much you
want those bytes back :)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:22    [W:0.083 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site