public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [patch] eliminate two compiler warnings
Date: Sat, 15 Jan 2005 07:21:58 +0000	[thread overview]
Message-ID: <16872.50326.736554.584145@napali.hpl.hp.com> (raw)

The patch below eliminates two compiler warnings.  The first one
(domain.c) showed when compiling for non-NUMA.  In that case, variable
"node" ended up not being used, which solicits a warning from GCC.
Fix is to evluate cpu_to_node(i) in place.  This has the effect of
doing cpu_to_node(i) twice on NUMA, but this is init code, so
performance is not an issue (and even if it were, you can just declare
cpu_to_node() as being a pure function, so the compiler can eliminate
the second call).

The second warning was due to somebody calling a "const" pointer to
__find_next_zero_bit, but that function didn't declare the pointer as
const.

	--david

Signed-off-by: David Mosberger-Tang <davidm@hpl.hp.com>

=== arch/ia64/kernel/domain.c 1.8 vs edited ==--- 1.8/arch/ia64/kernel/domain.c	2005-01-10 17:29:23 -08:00
+++ edited/arch/ia64/kernel/domain.c	2005-01-14 22:19:50 -08:00
@@ -151,10 +151,9 @@
 	 * Set up domains. Isolated domains just stay on the dummy domain.
 	 */
 	for_each_cpu_mask(i, cpu_default_map) {
-		int node = cpu_to_node(i);
 		int group;
 		struct sched_domain *sd = NULL, *p;
-		cpumask_t nodemask = node_to_cpumask(node);
+		cpumask_t nodemask = node_to_cpumask(cpu_to_node(i));
 
 		cpus_and(nodemask, nodemask, cpu_default_map);
 
@@ -172,7 +171,7 @@
 
 		sd = &per_cpu(node_domains, i);
 		*sd = SD_NODE_INIT;
-		sd->span = sched_domain_node_span(node);
+		sd->span = sched_domain_node_span(cpu_to_node(i));
 		sd->parent = p;
 		cpus_and(sd->span, sd->span, cpu_default_map);
 #endif
=== arch/ia64/lib/bitop.c 1.2 vs edited ==--- 1.2/arch/ia64/lib/bitop.c	2004-10-20 01:37:14 -07:00
+++ edited/arch/ia64/lib/bitop.c	2005-01-14 22:07:50 -08:00
@@ -8,7 +8,8 @@
  * Find next zero bit in a bitmap reasonably efficiently..
  */
 
-int __find_next_zero_bit (void *addr, unsigned long size, unsigned long offset)
+int __find_next_zero_bit (const void *addr, unsigned long size,
+			  unsigned long offset)
 {
 	unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
 	unsigned long result = offset & ~63UL;
=== include/asm-ia64/bitops.h 1.17 vs edited ==--- 1.17/include/asm-ia64/bitops.h	2004-06-04 09:10:31 -07:00
+++ edited/include/asm-ia64/bitops.h	2005-01-14 22:07:17 -08:00
@@ -359,7 +359,7 @@
 
 #endif /* __KERNEL__ */
 
-extern int __find_next_zero_bit (void *addr, unsigned long size,
+extern int __find_next_zero_bit (const void *addr, unsigned long size,
 			unsigned long offset);
 extern int __find_next_bit(const void *addr, unsigned long size,
 			unsigned long offset);

                 reply	other threads:[~2005-01-15  7:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=16872.50326.736554.584145@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=linux-ia64@vger.kernel.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