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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
  };









[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux