Re: [PATCH RESEND 4/4] Pinctrl: Ingenic: Fix const declaration.

From: Zhou Yanjie
Date: Mon Jan 28 2019 - 23:06:35 EST


I would prefer to keep it. There are many other drivers that also use this header file.

On 2019å01æ29æ 03:22, Joe Perches wrote:
On Fri, 2019-01-25 at 14:59 -0300, Paul Cercueil wrote:
On Fri, Jan 25, 2019 at 6:59 AM, Zhou Yanjie <zhouyanjie@xxxxxxxx>
wrote:
Warning is reported when checkpatch indicates that
"static const char * array" should be changed to
"static const char * const".
[]
diff --git a/drivers/pinctrl/pinctrl-ingenic.c
[]
@@ -172,23 +172,25 @@ static const struct group_desc jz4740_groups[]
[]
+static const char * const jz4740_mmc_groups[] = { "mmc-1bit",
"mmc-4bit", };
static const struct function_desc jz4740_functions[] = {
{ "mmc", jz4740_mmc_groups, ARRAY_SIZE(jz4740_mmc_groups), },
With this patch applied I get this:

drivers/pinctrl/pinctrl-ingenic.c:196:11: attention : initialization
discards
âconstâ qualifier from pointer target type [-Wdiscarded-qualifiers]
{ "mmc", jz4740_mmc_groups, ARRAY_SIZE(jz4740_mmc_groups), },
^~~~~~~~~~~~~~~~~
You could change group_names to const char * const group_names
in pinmux.h

---
drivers/pinctrl/pinmux.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h
index 3319535c76cb..2b903774ba5c 100644
--- a/drivers/pinctrl/pinmux.h
+++ b/drivers/pinctrl/pinmux.h
@@ -122,7 +122,7 @@ static inline void pinmux_init_device_debugfs(struct dentry *devroot,
*/
struct function_desc {
const char *name;
- const char **group_names;
+ const char * const *group_names;
int num_group_names;
void *data;
};