drivers/of: Constify device_node->name and ->path_component_name

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.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Julian Calaby <julian.calaby@gmail.com>
This commit is contained in:
Grant Likely
2012-11-14 22:37:12 +00:00
parent 31982e52f0
commit c22618a11d
6 changed files with 11 additions and 12 deletions

View File

@@ -46,7 +46,7 @@ struct device_node {
const char *name;
const char *type;
phandle phandle;
char *full_name;
const char *full_name;
struct property *properties;
struct property *deadprops; /* removed properties */
@@ -60,7 +60,7 @@ struct device_node {
unsigned long _flags;
void *data;
#if defined(CONFIG_SPARC)
char *path_component_name;
const char *path_component_name;
unsigned int unique_id;
struct of_irq_controller *irq_trans;
#endif