Patchwork [v2] drivers/of: Constify device_node->name and ->path_component_name

login
register
mail settings
Submitter Michael Neuling
Date Nov. 27, 2012, 11:46 p.m.
Message ID <23435.1354059964@neuling.org>
Download mbox | patch
Permalink /patch/202322/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Michael Neuling - Nov. 27, 2012, 11:46 p.m.
> Neither of these should ever be changed once set. Make them const and
> fix up the users that try to modify it in-place. In one case
> kmalloc+memcpy is replaced with kstrdup() to avoid modifying the string.
> 
> Build tested with defconfigs on ARM, PowerPC, Sparc, MIPS, x86 among
> others.

Grant,

This breaks powerpc chroma_defconfig in next-20121127 with:

arch/powerpc/sysdev/scom.c:160:17: error: assignment discards 'const' qualifier from pointer target type [-Werror]

The following fixes it.  The change is to generic code, so I'm not sure
it's the right fix as it may break other configs/archs.

the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grant Likely - Nov. 29, 2012, 4:34 p.m.
On Wed, 28 Nov 2012 10:46:04 +1100, Michael Neuling <mikey@neuling.org> wrote:
> > Neither of these should ever be changed once set. Make them const and
> > fix up the users that try to modify it in-place. In one case
> > kmalloc+memcpy is replaced with kstrdup() to avoid modifying the string.
> > 
> > Build tested with defconfigs on ARM, PowerPC, Sparc, MIPS, x86 among
> > others.
> 
> Grant,
> 
> This breaks powerpc chroma_defconfig in next-20121127 with:
> 
> arch/powerpc/sysdev/scom.c:160:17: error: assignment discards 'const' qualifier from pointer target type [-Werror]
> 
> The following fixes it.  The change is to generic code, so I'm not sure
> it's the right fix as it may break other configs/archs.

That is rather risky. Post it as a patch to core code, but in the mean
time I'll patch the powerpc scom code.

g.

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 66c434f..77f64e4 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -23,7 +23,7 @@ 
 struct file_operations;
 
 struct debugfs_blob_wrapper {
-	void *data;
+	const void *data;
 	unsigned long size;
 };
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in