lkml.org 
[lkml]   [2019]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH RESEND 4/4] Pinctrl: Ingenic: Fix const declaration.
From
Date
On Fri, 2019-01-25 at 14:59 -0300, Paul Cercueil wrote:
> On Fri, Jan 25, 2019 at 6:59 AM, Zhou Yanjie <zhouyanjie@zoho.com>
> 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;
};

\
 
 \ /
  Last update: 2019-01-28 20:23    [W:0.050 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site