Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Thorsten Kranzkowski <dl8bcu@dl8bcu.de>
To: Richard Henderson <rth@redhat.com>,
	axp-list mailing list <axp-list@redhat.com>
Subject: [PATCH] [RESENT] compilation warnings 4/6
Date: Sat, 9 Nov 2002 01:07:17 +0000	[thread overview]
Message-ID: <20021109010716.G18411@Marvin.DL8BCU.ampr.org> (raw)
In-Reply-To: <20021109010502.F18411@Marvin.DL8BCU.ampr.org>; from dl8bcu@dl8bcu.de on Sat, Nov 09, 2002 at 01:05:03AM +0000

Part 4: these are mostly casts. Hopefully I got the int<->long thing
	right this time. stupid me.



### yes, I agree this is unsigned long. Thanks for reminding me that
### (unsigned) is actually (unsigned int)


diff -ur linux-2.5.46/arch/alpha/kernel/osf_sys.c linux-2.5.46-ds20/arch/alpha/kernel/osf_sys.c
--- linux-2.5.46/arch/alpha/kernel/osf_sys.c	Wed Nov  6 19:04:14 2002
+++ linux-2.5.46-ds20/arch/alpha/kernel/osf_sys.c	Sat Nov  9 00:25:18 2002
@@ -1416,14 +1419,14 @@
 
 	if (addr) {
 		addr = arch_get_unmapped_area_1 (PAGE_ALIGN(addr), len, limit);
-		if (addr != -ENOMEM)
+		if (addr != (unsigned long) -ENOMEM)
 			return addr;
 	}
 
 	/* Next, try allocating at TASK_UNMAPPED_BASE.  */
 	addr = arch_get_unmapped_area_1 (PAGE_ALIGN(TASK_UNMAPPED_BASE),
 					 len, limit);
-	if (addr != -ENOMEM)
+	if (addr != (unsigned long) -ENOMEM)
 		return addr;
 
 	/* Finally, try allocating in low memory.  */







### type is a long parameter. it is explicitely normaized to positive
### values. the only caller supplies an unsigned long from hwrpb_struct.
### But there is this comment suggesting there are 'negative' values:
### /* Restore real CABRIO and EB66+ family names, ie EB64+ and EB66 */
### if (type < 0)
###         type = -type;

### member can only be positive and is checked against positive constants.

### again the comment
### /* Restore real CABRIO and EB66+ family names, ie EB64+ and EB66 */
### otherwise type could be unsigned.

### i is also a loop counter with only positive values

diff -ur linux-2.5.46/arch/alpha/kernel/setup.c linux-2.5.46-ds20/arch/alpha/kernel/setup.c
--- linux-2.5.46/arch/alpha/kernel/setup.c	Sat Oct 19 04:01:16 2002
+++ linux-2.5.46-ds20/arch/alpha/kernel/setup.c	Sat Nov  9 00:25:18 2002
@@ -804,13 +804,13 @@
 
 	/* Search the system tables first... */
 	vec = NULL;
-	if (type < N(systype_vecs)) {
+	if ((unsigned long)type < N(systype_vecs)) {
 		vec = systype_vecs[type];
 	} else if ((type > ST_API_BIAS) &&
-		   (type - ST_API_BIAS) < N(api_vecs)) {
+		   ((unsigned long)type - ST_API_BIAS) < N(api_vecs)) {
 		vec = api_vecs[type - ST_API_BIAS];
 	} else if ((type > ST_UNOFFICIAL_BIAS) &&
-		   (type - ST_UNOFFICIAL_BIAS) < N(unofficial_vecs)) {
+		   ((unsigned long)type - ST_UNOFFICIAL_BIAS) < N(unofficial_vecs)) {
 		vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS];
 	}
 
@@ -930,7 +930,7 @@
 get_sysnames(long type, long variation, long cpu,
 	     char **type_name, char **variation_name)
 {
-	long member;
+	unsigned long member;
 
 	/* Restore real CABRIO and EB66+ family names, ie EB64+ and EB66 */
 	if (type < 0)
@@ -938,13 +938,13 @@
 
 	/* If not in the tables, make it UNKNOWN,
 	   else set type name to family */
-	if (type < N(systype_names)) {
+	if ((unsigned long)type < N(systype_names)) {
 		*type_name = systype_names[type];
 	} else if ((type > ST_API_BIAS) &&
-		   (type - ST_API_BIAS) < N(api_names)) {
+		   ((unsigned long)type - ST_API_BIAS) < N(api_names)) {
 		*type_name = api_names[type - ST_API_BIAS];
 	} else if ((type > ST_UNOFFICIAL_BIAS) &&
-		   (type - ST_UNOFFICIAL_BIAS) < N(unofficial_names)) {
+		   ((unsigned long)type - ST_UNOFFICIAL_BIAS) < N(unofficial_names)) {
 		*type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS];
 	} else {
 		*type_name = sys_unknown;
@@ -1042,7 +1042,8 @@
 get_nr_processors(struct percpu_struct *cpubase, unsigned long num)
 {
 	struct percpu_struct *cpu;
-	int i, count = 0;
+	unsigned long i;
+	int count = 0;
 
 	for (i = 0; i < num; i++) {
 		cpu = (struct percpu_struct *)









### diff is normalized to positive values here, but needed signed during
### calculation. all the frequencies are unsigned long.
### so insert a cast here.


diff -ur linux-2.5.46/arch/alpha/kernel/time.c linux-2.5.46-ds20/arch/alpha/kernel/time.c
--- linux-2.5.46/arch/alpha/kernel/time.c	Sat Oct 19 04:01:54 2002
+++ linux-2.5.46-ds20/arch/alpha/kernel/time.c	Fri Nov  8 23:29:27 2002
@@ -316,7 +316,7 @@
 		diff = cycle_freq - est_cycle_freq;
 		if (diff < 0)
 			diff = -diff;
-		if (diff > one_percent) {
+		if ((unsigned long)diff > one_percent) {
 			cycle_freq = est_cycle_freq;
 			printk("HWRPB cycle frequency bogus.  "
 			       "Estimated %lu Hz\n", cycle_freq);





### assignment from pointer to integer without a cast.
### ok, cast it.

diff -ur linux-2.5.46/arch/alpha/kernel/traps.c linux-2.5.46-ds20/arch/alpha/kernel/traps.c
--- linux-2.5.46/arch/alpha/kernel/traps.c	Wed Nov  6 19:04:14 2002
+++ linux-2.5.46-ds20/arch/alpha/kernel/traps.c	Fri Nov  8 23:29:27 2002
@@ -406,7 +406,7 @@
 	info.si_signo = SIGILL;
 	info.si_errno = 0;
 	info.si_code = ILL_ILLOPC;
-	info.si_addr = regs.pc;
+	info.si_addr = (void *)regs.pc;
 	send_sig_info(SIGILL, &info, current);
 }
 
@@ -429,7 +429,7 @@
 	info.si_signo = SIGILL;
 	info.si_errno = 0;
 	info.si_code = ILL_ILLOPC;
-	info.si_addr = regs.pc;
+	info.si_addr = (void *)regs.pc;
 	force_sig_info(SIGILL, &info, current);
 }
 









### to is already casted and from is already unsigned long. since we're
### doing bitops here, use unsigned long for both.


diff -ur linux-2.5.46/arch/alpha/lib/io.c linux-2.5.46-ds20/arch/alpha/lib/io.c
--- linux-2.5.46/arch/alpha/lib/io.c	Sat Oct 19 04:02:27 2002
+++ linux-2.5.46-ds20/arch/alpha/lib/io.c	Fri Nov  8 23:29:27 2002
@@ -414,7 +414,7 @@
 	/* Optimize co-aligned transfers.  Everything else gets handled
 	   a byte at a time. */
 
-	if (count >= 8 && ((long)to & 7) == (from & 7)) {
+	if (count >= 8 && ((unsigned long)to & 7) == (from & 7)) {
 		count -= 8;
 		do {
 			*(u64 *)to = __raw_readq(from);
@@ -425,7 +425,7 @@
 		count += 8;
 	}
 
-	if (count >= 4 && ((long)to & 3) == (from & 3)) {
+	if (count >= 4 && ((unsigned long)to & 3) == (from & 3)) {
 		count -= 4;
 		do {
 			*(u32 *)to = __raw_readl(from);
@@ -436,7 +436,7 @@
 		count += 4;
 	}
 		
-	if (count >= 2 && ((long)to & 1) == (from & 1)) {
+	if (count >= 2 && ((unsigned long)to & 1) == (from & 1)) {
 		count -= 2;
 		do {
 			*(u16 *)to = __raw_readw(from);
@@ -465,7 +465,7 @@
 	   a byte at a time. */
 	/* FIXME -- align FROM.  */
 
-	if (count >= 8 && (to & 7) == ((long)from & 7)) {
+	if (count >= 8 && (to & 7) == ((unsigned long)from & 7)) {
 		count -= 8;
 		do {
 			__raw_writeq(*(const u64 *)from, to);
@@ -476,7 +476,7 @@
 		count += 8;
 	}
 
-	if (count >= 4 && (to & 3) == ((long)from & 3)) {
+	if (count >= 4 && (to & 3) == ((unsigned long)from & 3)) {
 		count -= 4;
 		do {
 			__raw_writel(*(const u32 *)from, to);
@@ -487,7 +487,7 @@
 		count += 4;
 	}
 		
-	if (count >= 2 && (to & 1) == ((long)from & 1)) {
+	if (count >= 2 && (to & 1) == ((unsigned long)from & 1)) {
 		count -= 2;
 		do {
 			__raw_writew(*(const u16 *)from, to);
-- 
| Thorsten Kranzkowski        Internet: dl8bcu@dl8bcu.de                      |
| Mobile: ++49 170 1876134       Snail: Niemannsweg 30, 49201 Dissen, Germany |
| Ampr: dl8bcu@db0lj.#rpl.deu.eu, dl8bcu@marvin.dl8bcu.ampr.org [44.130.8.19] |




  reply	other threads:[~2002-11-09  1:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-09  1:00 [PATCH] [RESENT] compilation warnings 1/6 Thorsten Kranzkowski
2002-11-09  1:03 ` [PATCH] [RESENT] compilation warnings 2/6 Thorsten Kranzkowski
2002-11-09  1:05   ` [PATCH] [RESENT] compilation warnings 3/6 Thorsten Kranzkowski
2002-11-09  1:07     ` Thorsten Kranzkowski [this message]
2002-11-09  1:08       ` [PATCH] [RESENT] compilation warnings 5/6 Thorsten Kranzkowski
2002-11-09  1:13         ` [PATCH] [RESENT] compilation warnings 6/6 Thorsten Kranzkowski
2002-11-09  1:47       ` [PATCH] [RESENT] compilation warnings 4/6 Michal Jaegermann
2002-11-09  5:51       ` Richard Henderson
2002-11-09  4:50     ` [PATCH] [RESENT] compilation warnings 3/6 Richard Henderson
2002-11-09 19:14       ` Peter Rival
2002-11-09 21:29         ` Michal Jaegermann
2002-11-14  6:44         ` Richard Henderson
2002-11-09  4:32 ` [PATCH] [RESENT] compilation warnings 1/6 Richard Henderson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox