lkml.org 
[lkml]   [2003]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.5.69-mm3
On Fri, May 09, 2003 at 11:12:57AM -0700, William Lee Irwin III wrote:
> topology.h has a syntactic hygiene issue where it has a for () loop with
> an if () in the body defined as a macro:
> #define foo(...) for (...) if (...)
> This patch prepares some of the bitop definitions used for the loop
> mechanics to be usable in headers where BITS_PER_LONG is not guaranteed
> to be defined for some reason. It removes the #ifdef on BITS_PER_LONG
> in favor of if (sizeof(...) == ...) tests so hweight_long() will be
> defined even when BITS_PER_LONG is not. unsigned long is also used for
> some variables and/or return types that changed size with BITS_PER_LONG.
> The 32-bit generic_hweight64() also changed its argument from a pointer
> to a u64, which actually makes for a consistent interface in both cases.
> The follow-up will make use of this to clean up the hygiene issue above
> and correct a compilation error in topology.h


diff -urpN mm3-2.5.69-1/include/linux/topology.h mm3-2.5.69-2/include/linux/topology.h
--- mm3-2.5.69-1/include/linux/topology.h 2003-05-09 09:22:16.000000000 -0700
+++ mm3-2.5.69-2/include/linux/topology.h 2003-05-09 10:29:08.000000000 -0700
@@ -32,8 +32,15 @@

#define nr_cpus_node(node) (hweight_long(node_to_cpumask(node)))

+static inline int __next_node_with_cpus(int node)
+{
+ do
+ ++node;
+ while (!nr_cpus_node(node) && node < numnodes);
+ return node;
+}
+
#define for_each_node_with_cpus(node) \
- for (node = 0; node < numnodes; node++) \
- if (nr_cpus_node(node)
+ for (node = 0; node < numnodes; node = __next_node_with_cpus(node))

#endif /* _LINUX_TOPOLOGY_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:35    [W:0.302 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site