From 7dc430e612bb965d01a31592f87ee5705d1e3616 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Wed, 19 Nov 2014 14:34:28 +0100 Subject: stringlist: string_list_contains can use a const string Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- include/stringlist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/stringlist.h b/include/stringlist.h index 127998cb6e..2e2addf98f 100644 --- a/include/stringlist.h +++ b/include/stringlist.h @@ -11,7 +11,7 @@ struct string_list { int string_list_add(struct string_list *sl, char *str); int string_list_add_asprintf(struct string_list *sl, const char *fmt, ...); int string_list_add_sorted(struct string_list *sl, char *str); -int string_list_contains(struct string_list *sl, char *str); +int string_list_contains(struct string_list *sl, const char *str); void string_list_print_by_column(struct string_list *sl); static inline void string_list_init(struct string_list *sl) -- cgit v1.2.3 From 0d752cb78cbe0c324151267b3d9eb400d19b05a7 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Wed, 3 Dec 2014 15:33:59 +0100 Subject: stringlist: the string argument should be const Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- include/stringlist.h | 4 ++-- lib/stringlist.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/stringlist.h b/include/stringlist.h index 2e2addf98f..e85500a994 100644 --- a/include/stringlist.h +++ b/include/stringlist.h @@ -8,9 +8,9 @@ struct string_list { char *str; }; -int string_list_add(struct string_list *sl, char *str); +int string_list_add(struct string_list *sl, const char *str); int string_list_add_asprintf(struct string_list *sl, const char *fmt, ...); -int string_list_add_sorted(struct string_list *sl, char *str); +int string_list_add_sorted(struct string_list *sl, const char *str); int string_list_contains(struct string_list *sl, const char *str); void string_list_print_by_column(struct string_list *sl); diff --git a/lib/stringlist.c b/lib/stringlist.c index 57801b3bb0..8a18366a96 100644 --- a/lib/stringlist.c +++ b/lib/stringlist.c @@ -13,7 +13,7 @@ static int string_list_compare(struct list_head *a, struct list_head *b) return strcmp(astr, bstr); } -int string_list_add(struct string_list *sl, char *str) +int string_list_add(struct string_list *sl, const char *str) { struct string_list *new; @@ -48,7 +48,7 @@ int string_list_add_asprintf(struct string_list *sl, const char *fmt, ...) return 0; } -int string_list_add_sorted(struct string_list *sl, char *str) +int string_list_add_sorted(struct string_list *sl, const char *str) { struct string_list *new; -- cgit v1.2.3 From 48ba0a1afda33907fcc4ce4119a7762dda5d7404 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Wed, 3 Dec 2014 15:34:00 +0100 Subject: fdt: of_unflatten_dtb can work on const data Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- drivers/of/fdt.c | 4 ++-- include/of.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d465f98797..84c38fd5a1 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -54,7 +54,7 @@ static inline char *dt_string(struct fdt_header *f, char *strstart, uint32_t ofs * Parse a flat device tree binary blob and return a pointer to the * unflattened tree. */ -struct device_node *of_unflatten_dtb(void *infdt) +struct device_node *of_unflatten_dtb(const void *infdt) { const void *nodep; /* property node pointer */ uint32_t tag; /* tag */ @@ -69,7 +69,7 @@ struct device_node *of_unflatten_dtb(void *infdt) struct fdt_header f; int ret; unsigned int maxlen; - struct fdt_header *fdt = infdt; + const struct fdt_header *fdt = infdt; if (fdt->magic != cpu_to_fdt32(FDT_MAGIC)) { pr_err("bad magic: 0x%08x\n", fdt32_to_cpu(fdt->magic)); diff --git a/include/of.h b/include/of.h index 7b93c58474..5273f87ebd 100644 --- a/include/of.h +++ b/include/of.h @@ -98,7 +98,7 @@ void of_print_cmdline(struct device_node *root); void of_print_nodes(struct device_node *node, int indent); int of_probe(void); int of_parse_dtb(struct fdt_header *fdt); -struct device_node *of_unflatten_dtb(void *fdt); +struct device_node *of_unflatten_dtb(const void *fdt); struct cdev; -- cgit v1.2.3