Skip to contentSkip to conversation

patches vs. 2.6.10-mm1

PATCH In review William Lee Irwin III 6 participants 23 messages Jan 3, 2005 – Jan 4, 2005

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

cover patches vs. 2.6.10-mm1

This is a series of patches against 2.6.10-mm1. They are mostly warning cleanups, starting with a compilefix.

-- wli

#1 lore raw

PATCH 1/8 there is no generic_file_(get|set)_policy()

There is no generic_file_set_policy() or generic_file_get_policy. This patch removes the dangling references to them.

Without this patch, the kernel fails to build from source with CONFIG_NUMA=y

mm/filemap.c +0 -4
Index: mm1-2.6.10/mm/filemap.c
===================================================================
@@ -1542,10 +1542,6 @@
 	.nopage		= filemap_nopage,
 	.populate	= filemap_populate,
 	.page_mkwrite	= filemap_page_mkwrite,
-#ifdef CONFIG_NUMA
-	.set_policy     = generic_file_set_policy,
-	.get_policy     = generic_file_get_policy,
-#endif
 };
 
 /* This is used for a general mmap of a disk file */
#2 lore raw

PATCH 2/8 kill quota_v2.c printk() of size_t warning

The printk() of a size_t is off, tripping a warning. This patch qualifies the integer format with a 'z' to suppress the warning.

fs/quota_v2.c +1 -1
Index: mm1-2.6.10/fs/quota_v2.c
===================================================================
@@ -396,7 +396,7 @@
 	/* dq_off is guarded by dqio_sem */
 	if (!dquot->dq_off)
 		if ((ret = dq_insert_tree(dquot)) < 0) {
-			printk(KERN_ERR "VFS: Error %d occurred while creating quota.\n", ret);
+			printk(KERN_ERR "VFS: Error %zd occurred while creating quota.\n", ret);
 			return ret;
 		}
 	spin_lock(&dq_data_lock);
#3 lore raw

PATCH 3/8 kill gen_init_cpio.c printk() of size_t warning

The rest of gen_init_cpio.c seems to cast the result of strlen() to handle this situation, so this patch follows suit while killing off size_t -related printk() warnings.

usr/gen_init_cpio.c +2 -2
Index: mm1-2.6.10/usr/gen_init_cpio.c
===================================================================
@@ -86,7 +86,7 @@
 		0,			/* minor */
 		0,			/* rmajor */
 		0,			/* rminor */
-		(unsigned)strlen(name) + 1, /* namesize */
+		(unsigned)strlen(name)+1, /* namesize */
 		0);			/* chksum */
 	push_hdr(s);
 	push_rest(name);
@@ -112,7 +112,7 @@
 		(long) gid,		/* gid */
 		1,			/* nlink */
 		(long) mtime,		/* mtime */
-		strlen(target) + 1,	/* filesize */
+		(unsigned)strlen(target)+1, /* filesize */
 		3,			/* major */
 		1,			/* minor */
 		0,			/* rmajor */
#4 lore raw

PATCH 4/8 fix arch/x86_64/ia32/syscall32.c misdeclared pud variable

This __map_syscall32() gets an assignment from incompatible pointer type warning; the following patch kills it by declaring the pud variable as a pud_t as is necessary.

arch/x86_64/ia32/syscall32.c +1 -1
Index: mm1-2.6.10/arch/x86_64/ia32/syscall32.c
===================================================================
@@ -41,7 +41,7 @@
 int __map_syscall32(struct mm_struct *mm, unsigned long address)
 { 
 	pgd_t *pgd;
-	pgd_t *pud;
+	pud_t *pud;
 	pte_t *pte;
 	pmd_t *pmd;
 	int err = -ENOMEM;
#5 lore raw

PATCH 4/8 fix arch/x86_64/ia32/syscall32.c misdeclared pud variable

In reply to William Lee Irwin III

pud needs to be declared as a pud_t in order to avoid an assignment from incompatible pointer type warning or two; this patch makes it so.

arch/x86_64/ia32/syscall32.c +1 -1
Index: mm1-2.6.10/arch/x86_64/ia32/syscall32.c
===================================================================
@@ -41,7 +41,7 @@
 int __map_syscall32(struct mm_struct *mm, unsigned long address)
 { 
 	pgd_t *pgd;
-	pgd_t *pud;
+	pud_t *pud;
 	pte_t *pte;
 	pmd_t *pmd;
 	int err = -ENOMEM;
#6 lore raw

PATCH 5/8 silence numerous size_t warnings in drivers/acpi/processor_idle.c

Multiple format -related warnings arise from size_t issues. This patch peppers the seq_printf()'s with 'z' qualifiers and casts to silence them all.

drivers/acpi/processor_idle.c +4 -4
Index: mm1-2.6.10/drivers/acpi/processor_idle.c
===================================================================
@@ -838,12 +838,12 @@
 	if (!pr)
 		goto end;
 
-	seq_printf(seq, "active state:            C%d\n"
+	seq_printf(seq, "active state:            C%zd\n"
 			"max_cstate:              C%d\n"
 			"bus master activity:     %08x\n",
 			pr->power.state ? pr->power.state - pr->power.states : 0,
 			max_cstate,
-			pr->power.bm_activity);
+			(unsigned)pr->power.bm_activity);
 
 	seq_puts(seq, "states:\n");
 
@@ -872,14 +872,14 @@
 		}
 
 		if (pr->power.states[i].promotion.state)
-			seq_printf(seq, "promotion[C%d] ",
+			seq_printf(seq, "promotion[C%zd] ",
 				(pr->power.states[i].promotion.state -
 				 pr->power.states));
 		else
 			seq_puts(seq, "promotion[--] ");
 
 		if (pr->power.states[i].demotion.state)
-			seq_printf(seq, "demotion[C%d] ",
+			seq_printf(seq, "demotion[C%zd] ",
 				(pr->power.states[i].demotion.state -
 				 pr->power.states));
 		else
#7 lore raw

PATCH 6/8 make IRDA string tables conditional on CONFIG_IRDA_DEBUG

There are some string tables only used for debugging printk()'s in IRDA that trip warnings when CONFIG_IRDA_DEBUG is not set.

This patch makes them conditional on CONFIG_IRDA_DEBUG to silence warnings.

net/irda/ircomm/ircomm_event.c +2 -0
Index: mm1-2.6.10/net/irda/ircomm/ircomm_event.c
===================================================================
@@ -57,6 +57,7 @@
 	"IRCOMM_CONN",
 };
 
+#ifdef CONFIG_IRDA_DEBUG
 static char *ircomm_event[] = {
 	"IRCOMM_CONNECT_REQUEST",
         "IRCOMM_CONNECT_RESPONSE",
@@ -75,6 +76,7 @@
         "IRCOMM_CONTROL_REQUEST",
         "IRCOMM_CONTROL_INDICATION",
 };
+#endif /* CONFIG_IRDA_DEBUG */
 
 static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event,
 		      struct sk_buff *skb, struct ircomm_info *info) = 
net/irda/ircomm/ircomm_tty_attach.c +2 -0
Index: mm1-2.6.10/net/irda/ircomm/ircomm_tty_attach.c
===================================================================
@@ -91,6 +91,7 @@
 	"*** ERROR *** ",
 };
 
+#ifdef CONFIG_IRDA_DEBUG
 static char *ircomm_tty_event[] = {
 	"IRCOMM_TTY_ATTACH_CABLE",
 	"IRCOMM_TTY_DETACH_CABLE",
@@ -107,6 +108,7 @@
 	"IRCOMM_TTY_GOT_LSAPSEL",
 	"*** ERROR ****",
 };
+#endif /* CONFIG_IRDA_DEBUG */
 
 static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
 		      struct sk_buff *skb, struct ircomm_tty_info *info) = 
#8 lore raw

PATCH 7/8 fix unresolved MTD symbols in scx200_docflash.c

This driver is using some private #ifdef to try to control the use of partitions and calling functions that get compiled out of the kernel if it's set (which it is by default). This results in unresolved module symbols, which are bad.

This patch synchronizes the conditional compilation of partition management in the driver with the global config option for MTD partition management and thereby fixes the unresolved symbol problem.

drivers/mtd/maps/scx200_docflash.c +3 -6
Index: mm1-2.6.10/drivers/mtd/maps/scx200_docflash.c
===================================================================
@@ -26,9 +26,6 @@
 MODULE_DESCRIPTION("NatSemi SCx200 DOCCS Flash Driver");
 MODULE_LICENSE("GPL");
 
-/* Set this to one if you want to partition the flash */
-#define PARTITION 1
-
 static int probe = 0;		/* Don't autoprobe */
 static unsigned size = 0x1000000; /* 16 MiB the whole ISA address space */
 static unsigned width = 8;	/* Default to 8 bits wide */
@@ -50,7 +47,7 @@
 
 static struct mtd_info *mymtd;
 
-#if PARTITION
+#ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition partition_info[] = {
 	{ 
 		.name   = "DOCCS Boot kernel", 
@@ -200,7 +197,7 @@
 
 	mymtd->owner = THIS_MODULE;
 
-#if PARTITION
+#ifdef CONFIG_MTD_PARTITIONS
 	partition_info[3].offset = mymtd->size-partition_info[3].size;
 	partition_info[2].size = partition_info[3].offset-partition_info[2].offset;
 	add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
@@ -213,7 +210,7 @@
 static void __exit cleanup_scx200_docflash(void)
 {
 	if (mymtd) {
-#if PARTITION
+#ifdef CONFIG_MTD_PARTITIONS
 		del_mtd_partitions(mymtd);
 #else
 		del_mtd_device(mymtd);
#9 lore raw

PATCH 8/8 fix module_param() type mismatch in drivers/char/n_hdlc.c

maxframe is a variable of type ssize_t; this patch repairs the warning arising from the type mismatch in the module_param() declaration.

drivers/char/n_hdlc.c +1 -1
Index: mm1-2.6.10/drivers/char/n_hdlc.c
===================================================================
@@ -976,5 +976,5 @@
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Paul Fulghum [email protected]");
 module_param(debuglevel, int, 0);
-module_param(maxframe, int, 0);
+module_param(maxframe, ssize_t, 0);
 MODULE_ALIAS_LDISC(N_HDLC);
#10 lore raw

Re: [8/8] fix module_param() type mismatch in drivers/char/n_hdlc.c

Quoted 3 lines · William Lee Irwin III

maxframe is a variable of type ssize_t; this patch repairs the warning arising from the type mismatch in the module_param() declaration.

I flubbed the testing cycle for that patch only. The following patch should be applied instead.

drivers/char/n_hdlc.c +2 -2
Index: mm1-2.6.10/drivers/char/n_hdlc.c
===================================================================
@@ -177,7 +177,7 @@
 static int debuglevel;
 
 /* max frame size for memory allocations */
-static ssize_t maxframe = 4096;
+static int maxframe = 4096;
 
 /* TTY callbacks */
 
@@ -672,7 +672,7 @@
 		if (debuglevel & DEBUG_LEVEL_INFO)
 			printk (KERN_WARNING
 				"n_hdlc_tty_write: truncating user packet "
-				"from %lu to %Zd\n", (unsigned long) count,
+				"from %lu to %d\n", (unsigned long) count,
 				maxframe );
 		count = maxframe;
 	}
#11 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

In reply to William Lee Irwin III
Quoted 20 lines · William Lee Irwin III

The rest of gen_init_cpio.c seems to cast the result of strlen() to handle this situation, so this patch follows suit while killing off size_t -related printk() warnings.

Index: mm1-2.6.10/usr/gen_init_cpio.c
===================================================================

usr/gen_init_cpio.c +1 -1
@@ -86,7 +86,7 @@
 		0,			/* minor */
 		0,			/* rmajor */
 		0,			/* rminor */
-		(unsigned)strlen(name) + 1, /* namesize */
+		(unsigned)strlen(name)+1, /* namesize */
 		0);			/* chksum */
 	push_hdr(s);
 	push_rest(name);

usr/gen_init_cpio.c line 115

Quoted 5 lines
usr/gen_init_cpio.c +1 -1
@@ -112,7 +112,7 @@
 		(long) gid,		/* gid */
 		1,			/* nlink */
 		(long) mtime,		/* mtime */
-		strlen(target) + 1,	/* filesize */
+		(unsigned)strlen(target)+1, /* filesize */

This removes whitespace in the process, violating the file's chosen style (and typical lkml style).

Jeff

#12 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Quoted 2 lines · Jeff Garzik

This removes whitespace in the process, violating the file's chosen style (and typical lkml style).

I have no personal interest in the whitespace involved. The following amended patch is likely to avoid inconsistencies with the rest of the file regarding whitespace.

-- wli

usr/gen_init_cpio.c +1 -1
Index: mm1-2.6.10/usr/gen_init_cpio.c
===================================================================
@@ -112,7 +112,7 @@
 		(long) gid,		/* gid */
 		1,			/* nlink */
 		(long) mtime,		/* mtime */
-		strlen(target) + 1,	/* filesize */
+		(unsigned)strlen(target) + 1,/* filesize */
 		3,			/* major */
 		1,			/* minor */
 		0,			/* rmajor */
#13 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Quoted 11 lines · William Lee Irwin III
Quoted 2 lines · Jeff Garzik

This removes whitespace in the process, violating the file's chosen style (and typical lkml style).

I have no personal interest in the whitespace involved. The following amended patch is likely to avoid inconsistencies with the rest of the file regarding whitespace.

-- wli

But it's wrong.
It should be:

Review

Quoted 1 line
(quoted diff) +1 -0
+		strlen(target) + 1U,	/* filesize */

strlen() already returns a size_t. You need an unsigned 1 to not affect it. As previously stated, an integer constant is an int, not an unsigned int unless you make it so with "U".

Quoted 15 lines

Index: mm1-2.6.10/usr/gen_init_cpio.c
===================================================================

usr/gen_init_cpio.c +1 -2
@@ -112,7 +112,7 @@
 		(long) gid,		/* gid */
 		1,			/* nlink */
 		(long) mtime,		/* mtime */
-		strlen(target) + 1,	/* filesize */
+		(unsigned)strlen(target) + 1,/* filesize */
 		3,			/* major */
 		1,			/* minor */
 		0,			/* rmajor */
-
Quoted 5 lines

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.

#14 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Followup to:  <[email protected]>
By author:    linux-os <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 10 lines

But it's wrong.
It should be:

Review

Quoted 1 line
(quoted diff) +1 -0
+		strlen(target) + 1U,	/* filesize */

strlen() already returns a size_t. You need an unsigned 1 to not affect it. As previously stated, an integer constant is an int, not an unsigned int unless you make it so with "U".

Dear Wrongbot,

Bullshit. Signed is promoted to unsigned.

-hpa

#15 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Followup to:  <[email protected]>
By author:    linux-os <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 7 lines
Quoted 7 lines

But it's wrong.
It should be:

Review

Quoted 1 line
(quoted diff) +1 -0
+		strlen(target) + 1U,	/* filesize */

strlen() already returns a size_t. You need an unsigned 1 to not affect it. As previously stated, an integer constant is an int, not an unsigned int unless you make it so with "U".

Quoted 2 lines · H. Peter Anvin

Dear Wrongbot,
Bullshit. Signed is promoted to unsigned.

I'm not sure who you're responding to here, but gcc emitted an actual warning and I was only attempting to carry out the minimal effort necessary to silence it. I'm not really interested in creating or being involved with controversy, just silencing the core build in the least invasive and so on way possible, leaving deeper drivers/ issues to the resolution of the true underlying problems.

I don't have anything to do with the code excerpt above; I merely followed the style of the other unsigned integer coercions in the file.

-- wli

#16 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Quoted 13 lines · William Lee Irwin III
Quoted 2 lines · H. Peter Anvin

Dear Wrongbot,
Bullshit. Signed is promoted to unsigned.

I'm not sure who you're responding to here, but gcc emitted an actual warning and I was only attempting to carry out the minimal effort necessary to silence it. I'm not really interested in creating or being involved with controversy, just silencing the core build in the least invasive and so on way possible, leaving deeper drivers/ issues to the resolution of the true underlying problems.

Quoted 3 lines

I don't have anything to do with the code excerpt above; I merely followed the style of the other unsigned integer coercions in the file.

I was not responding to you, your stuff is perfectly sane.

The claim from the Wrongbot was that "foo + 1" is bad when foo is a size_t. This is utter bullshit, since that's EXACTLY equivalent to:

	foo + (size_t)1

... because of promotion rules.

-hpa

#17 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Quoted 20 lines · H. Peter Anvin
Quoted 13 lines · William Lee Irwin III
Quoted 2 lines · H. Peter Anvin

Dear Wrongbot,
Bullshit. Signed is promoted to unsigned.

I'm not sure who you're responding to here, but gcc emitted an actual warning and I was only attempting to carry out the minimal effort necessary to silence it. I'm not really interested in creating or being involved with controversy, just silencing the core build in the least invasive and so on way possible, leaving deeper drivers/ issues to the resolution of the true underlying problems.

Quoted 3 lines

I don't have anything to do with the code excerpt above; I merely followed the style of the other unsigned integer coercions in the file.

I was not responding to you, your stuff is perfectly sane.

Quoted 8 lines

The claim from the Wrongbot was that "foo + 1" is bad when foo is a size_t. This is utter bullshit, since that's EXACTLY equivalent to:

	foo + (size_t)1

... because of promotion rules.

-hpa
-

I made no such claim. I claimed that the posted fix was wrong:

Quoted 6 lines

Index: mm1-2.6.10/usr/gen_init_cpio.c
===================================================================

usr/gen_init_cpio.c

Quoted 9 lines
usr/gen_init_cpio.c +1 -2
@@ -112,7 +112,7 @@
 		(long) gid,		/* gid */
 		1,			/* nlink */
 		(long) mtime,		/* mtime */
-		strlen(target) + 1,	/* filesize */
+		(unsigned)strlen(target) + 1,/* filesize */
 		3,			/* major */
 		1,			/* minor */
 		0,			/* rmajor */
-

This is wrong because strlen() already returns a size_t (unsigned). This "fix" only served to quiet the compiler which was warning about the conversion. It is a "conversion", not a "promotion". The simple fix to quiet this conversion warning is to use 1U as previously shown.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.

#18 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

In reply to William Lee Irwin III
Quoted 9 lines · William Lee Irwin III

I'm not sure who you're responding to here, but gcc emitted an actual warning and I was only attempting to carry out the minimal effort necessary to silence it. I'm not really interested in creating or being involved with controversy, just silencing the core build in the least invasive and so on way possible, leaving deeper drivers/ issues to the resolution of the true underlying problems.

I don't have anything to do with the code excerpt above; I merely followed the style of the other unsigned integer coercions in the file.

Egads... Just use %zd for size_t. It's going to have rank no less than that of int, so you'll get 1 converted to size_t and size_t as type of result.

#19 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Quoted 8 lines · William Lee Irwin III
Quoted 8 lines

I'm not sure who you're responding to here, but gcc emitted an actual warning and I was only attempting to carry out the minimal effort necessary to silence it. I'm not really interested in creating or being involved with controversy, just silencing the core build in the least invasive and so on way possible, leaving deeper drivers/ issues to the resolution of the true underlying problems.
I don't have anything to do with the code excerpt above; I merely followed the style of the other unsigned integer coercions in the file.

Quoted 3 lines · Al Viro

Egads... Just use %zd for size_t. It's going to have rank no less than that of int, so you'll get 1 converted to size_t and size_t as type of result.

My personal preference was to do that, but it would have been inconsistent with the approach used in the rest of the file.

-- wli

#21 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

Followup to:  <[email protected]>
By author:    Ben Pfaff <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 7 lines
Quoted 1 line · Al Viro

Egads... Just use %zd for size_t.

%zu?

Right, %zu for size_t, %zd for ssize_t.

-hpa

#22 lore raw

Re: [3/8] kill gen_init_cpio.c printk() of size_t warning

In reply to William Lee Irwin III
Quoted 20 lines · William Lee Irwin III

The rest of gen_init_cpio.c seems to cast the result of strlen() to handle this situation, so this patch follows suit while killing off size_t -related printk() warnings.

Index: mm1-2.6.10/usr/gen_init_cpio.c
===================================================================

usr/gen_init_cpio.c +1 -1
@@ -86,7 +86,7 @@
 		0,			/* minor */
 		0,			/* rmajor */
 		0,			/* rminor */
-		(unsigned)strlen(name) + 1, /* namesize */
+		(unsigned)strlen(name)+1, /* namesize */
 		0);			/* chksum */
 	push_hdr(s);
 	push_rest(name);

usr/gen_init_cpio.c

Quoted 9 lines
usr/gen_init_cpio.c +1 -2
@@ -112,7 +112,7 @@
 		(long) gid,		/* gid */
 		1,			/* nlink */
 		(long) mtime,		/* mtime */
-		strlen(target) + 1,	/* filesize */
+		(unsigned)strlen(target)+1, /* filesize */
 		3,			/* major */
 		1,			/* minor */
 		0,			/* rmajor */
-

The problem is that '1' is an int, not an unsigned int. So, the correct fix is:

		strlen(target) + 1U;

Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.