Message ID | 1548410393-6981-5-git-send-email-zhouyanjie@zoho.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [RESEND,1/4] Pinctrl: Ingenic: Fix bugs caused by differences between JZ4770 and JZ4780. | expand |
Hi, 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". > > Signed-off-by: Zhou Yanjie <zhouyanjie@zoho.com > <mailto:zhouyanjie@zoho.com>> > --- > drivers/pinctrl/pinctrl-ingenic.c | 136 > +++++++++++++++++++++----------------- > 1 file changed, 76 insertions(+), 60 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl-ingenic.c > b/drivers/pinctrl/pinctrl-ingenic.c > index 2b3f7e4..e982896 100644 > --- a/drivers/pinctrl/pinctrl-ingenic.c > +++ b/drivers/pinctrl/pinctrl-ingenic.c > @@ -172,23 +172,25 @@ static const struct group_desc jz4740_groups[] > = { > INGENIC_PIN_GROUP("pwm7", jz4740_pwm_pwm7), > }; > > -static const char *jz4740_mmc_groups[] = { "mmc-1bit", "mmc-4bit", }; > -static const char *jz4740_uart0_groups[] = { "uart0-data", > "uart0-hwflow", }; > -static const char *jz4740_uart1_groups[] = { "uart1-data", }; > -static const char *jz4740_lcd_groups[] = { > +static const char * const jz4740_mmc_groups[] = { "mmc-1bit", > "mmc-4bit", }; > +static const char * const jz4740_uart0_groups[] = { > + "uart0-data", "uart0-hwflow", > +}; > +static const char * const jz4740_uart1_groups[] = { "uart1-data", }; > +static const char * const jz4740_lcd_groups[] = { > "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-18bit-tft", > "lcd-no-pins", > }; > -static const char *jz4740_nand_groups[] = { > +static const char * const jz4740_nand_groups[] = { > "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", > }; > -static const char *jz4740_pwm0_groups[] = { "pwm0", }; > -static const char *jz4740_pwm1_groups[] = { "pwm1", }; > -static const char *jz4740_pwm2_groups[] = { "pwm2", }; > -static const char *jz4740_pwm3_groups[] = { "pwm3", }; > -static const char *jz4740_pwm4_groups[] = { "pwm4", }; > -static const char *jz4740_pwm5_groups[] = { "pwm5", }; > -static const char *jz4740_pwm6_groups[] = { "pwm6", }; > -static const char *jz4740_pwm7_groups[] = { "pwm7", }; > +static const char * const jz4740_pwm0_groups[] = { "pwm0", }; > +static const char * const jz4740_pwm1_groups[] = { "pwm1", }; > +static const char * const jz4740_pwm2_groups[] = { "pwm2", }; > +static const char * const jz4740_pwm3_groups[] = { "pwm3", }; > +static const char * const jz4740_pwm4_groups[] = { "pwm4", }; > +static const char * const jz4740_pwm5_groups[] = { "pwm5", }; > +static const char * const jz4740_pwm6_groups[] = { "pwm6", }; > +static const char * const jz4740_pwm7_groups[] = { "pwm7", }; > > 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), }, ^~~~~~~~~~~~~~~~~ > @@ -272,19 +274,19 @@ static const struct group_desc jz4725b_groups[] > = { > INGENIC_PIN_GROUP("pwm5", jz4725b_pwm_pwm5), > }; > > -static const char *jz4725b_mmc0_groups[] = { "mmc0-1bit", > "mmc0-4bit", }; > -static const char *jz4725b_mmc1_groups[] = { "mmc1-1bit", > "mmc1-4bit", }; > -static const char *jz4725b_uart_groups[] = { "uart-data", }; > -static const char *jz4725b_nand_groups[] = { > +static const char * const jz4725b_mmc0_groups[] = { "mmc0-1bit", > "mmc0-4bit", }; > +static const char * const jz4725b_mmc1_groups[] = { "mmc1-1bit", > "mmc1-4bit", }; > +static const char * const jz4725b_uart_groups[] = { "uart-data", }; > +static const char * const jz4725b_nand_groups[] = { > "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", > "nand-cle-ale", "nand-fre-fwe", > }; > -static const char *jz4725b_pwm0_groups[] = { "pwm0", }; > -static const char *jz4725b_pwm1_groups[] = { "pwm1", }; > -static const char *jz4725b_pwm2_groups[] = { "pwm2", }; > -static const char *jz4725b_pwm3_groups[] = { "pwm3", }; > -static const char *jz4725b_pwm4_groups[] = { "pwm4", }; > -static const char *jz4725b_pwm5_groups[] = { "pwm5", }; > +static const char * const jz4725b_pwm0_groups[] = { "pwm0", }; > +static const char * const jz4725b_pwm1_groups[] = { "pwm1", }; > +static const char * const jz4725b_pwm2_groups[] = { "pwm2", }; > +static const char * const jz4725b_pwm3_groups[] = { "pwm3", }; > +static const char * const jz4725b_pwm4_groups[] = { "pwm4", }; > +static const char * const jz4725b_pwm5_groups[] = { "pwm5", }; > > static const struct function_desc jz4725b_functions[] = { > { "mmc0", jz4725b_mmc0_groups, ARRAY_SIZE(jz4725b_mmc0_groups), }, > @@ -500,46 +502,56 @@ static const struct group_desc jz4770_groups[] > = { > INGENIC_PIN_GROUP("mac-mii", jz4770_mac_mii), > }; > > -static const char *jz4770_uart0_groups[] = { "uart0-data", > "uart0-hwflow", }; > -static const char *jz4770_uart1_groups[] = { "uart1-data", > "uart1-hwflow", }; > -static const char *jz4770_uart2_groups[] = { "uart2-data", > "uart2-hwflow", }; > -static const char *jz4770_uart3_groups[] = { "uart3-data", > "uart3-hwflow", }; > -static const char *jz4770_mmc0_groups[] = { > +static const char * const jz4770_uart0_groups[] = { > + "uart0-data", "uart0-hwflow", > +}; > +static const char * const jz4770_uart1_groups[] = { > + "uart1-data", "uart1-hwflow", > +}; > +static const char * const jz4770_uart2_groups[] = { > + "uart2-data", "uart2-hwflow", > +}; > +static const char * const jz4770_uart3_groups[] = { > + "uart3-data", "uart3-hwflow", > +}; > +static const char * const jz4770_mmc0_groups[] = { > "mmc0-1bit-a", "mmc0-4bit-a", > "mmc0-1bit-e", "mmc0-4bit-e", "mmc0-8bit-e", > }; > -static const char *jz4770_mmc1_groups[] = { > +static const char * const jz4770_mmc1_groups[] = { > "mmc1-1bit-d", "mmc1-4bit-d", > "mmc1-1bit-e", "mmc1-4bit-e", "mmc1-8bit-e", > }; > -static const char *jz4770_mmc2_groups[] = { > +static const char * const jz4770_mmc2_groups[] = { > "mmc2-1bit-b", "mmc2-4bit-b", > "mmc2-1bit-e", "mmc2-4bit-e", "mmc2-8bit-e", > }; > -static const char *jz4770_nemc_groups[] = { > +static const char * const jz4770_nemc_groups[] = { > "nemc-8bit-data", "nemc-16bit-data", "nemc-cle-ale", > "nemc-addr", "nemc-rd-we", "nemc-frd-fwe", "nemc-wait", > }; > -static const char *jz4770_cs1_groups[] = { "nemc-cs1", }; > -static const char *jz4770_cs2_groups[] = { "nemc-cs2", }; > -static const char *jz4770_cs3_groups[] = { "nemc-cs3", }; > -static const char *jz4770_cs4_groups[] = { "nemc-cs4", }; > -static const char *jz4770_cs5_groups[] = { "nemc-cs5", }; > -static const char *jz4770_cs6_groups[] = { "nemc-cs6", }; > -static const char *jz4770_i2c0_groups[] = { "i2c0-data", }; > -static const char *jz4770_i2c1_groups[] = { "i2c1-data", }; > -static const char *jz4770_i2c2_groups[] = { "i2c2-data", }; > -static const char *jz4770_cim_groups[] = { "cim-data-8bit", > "cim-data-12bit", }; > -static const char *jz4770_lcd_groups[] = { "lcd-24bit", > "lcd-no-pins", }; > -static const char *jz4770_pwm0_groups[] = { "pwm0", }; > -static const char *jz4770_pwm1_groups[] = { "pwm1", }; > -static const char *jz4770_pwm2_groups[] = { "pwm2", }; > -static const char *jz4770_pwm3_groups[] = { "pwm3", }; > -static const char *jz4770_pwm4_groups[] = { "pwm4", }; > -static const char *jz4770_pwm5_groups[] = { "pwm5", }; > -static const char *jz4770_pwm6_groups[] = { "pwm6", }; > -static const char *jz4770_pwm7_groups[] = { "pwm7", }; > -static const char *jz4770_mac_groups[] = { "mac-rmii", "mac-mii", }; > +static const char * const jz4770_cs1_groups[] = { "nemc-cs1", }; > +static const char * const jz4770_cs2_groups[] = { "nemc-cs2", }; > +static const char * const jz4770_cs3_groups[] = { "nemc-cs3", }; > +static const char * const jz4770_cs4_groups[] = { "nemc-cs4", }; > +static const char * const jz4770_cs5_groups[] = { "nemc-cs5", }; > +static const char * const jz4770_cs6_groups[] = { "nemc-cs6", }; > +static const char * const jz4770_i2c0_groups[] = { "i2c0-data", }; > +static const char * const jz4770_i2c1_groups[] = { "i2c1-data", }; > +static const char * const jz4770_i2c2_groups[] = { "i2c2-data", }; > +static const char * const jz4770_cim_groups[] = { > + "cim-data-8bit", "cim-data-12bit", > +}; > +static const char * const jz4770_lcd_groups[] = { "lcd-24bit", > "lcd-no-pins", }; > +static const char * const jz4770_pwm0_groups[] = { "pwm0", }; > +static const char * const jz4770_pwm1_groups[] = { "pwm1", }; > +static const char * const jz4770_pwm2_groups[] = { "pwm2", }; > +static const char * const jz4770_pwm3_groups[] = { "pwm3", }; > +static const char * const jz4770_pwm4_groups[] = { "pwm4", }; > +static const char * const jz4770_pwm5_groups[] = { "pwm5", }; > +static const char * const jz4770_pwm6_groups[] = { "pwm6", }; > +static const char * const jz4770_pwm7_groups[] = { "pwm7", }; > +static const char * const jz4770_mac_groups[] = { "mac-rmii", > "mac-mii", }; > > static const struct function_desc jz4770_functions[] = { > { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), }, > @@ -652,25 +664,29 @@ static const struct group_desc jz4780_groups[] > = { > INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7), > }; > > -static const char *jz4780_uart2_groups[] = { "uart2-data", > "uart2-hwflow", }; > -static const char *jz4780_uart4_groups[] = { "uart4-data", }; > -static const char *jz4780_mmc0_groups[] = { > +static const char * const jz4780_uart2_groups[] = { > + "uart2-data", "uart2-hwflow", > +}; > +static const char * const jz4780_uart4_groups[] = { "uart4-data", }; > +static const char * const jz4780_mmc0_groups[] = { > "mmc0-1bit-a", "mmc0-4bit-a", "mmc0-8bit-a", > "mmc0-1bit-e", "mmc0-4bit-e", > }; > -static const char *jz4780_mmc1_groups[] = { > +static const char * const jz4780_mmc1_groups[] = { > "mmc1-1bit-d", "mmc1-4bit-d", "mmc1-1bit-e", "mmc1-4bit-e", > }; > -static const char *jz4780_mmc2_groups[] = { > +static const char * const jz4780_mmc2_groups[] = { > "mmc2-1bit-b", "mmc2-4bit-b", "mmc2-1bit-e", "mmc2-4bit-e", > }; > -static const char *jz4780_nemc_groups[] = { > +static const char * const jz4780_nemc_groups[] = { > "nemc-data", "nemc-cle-ale", "nemc-addr", > "nemc-rd-we", "nemc-frd-fwe", "nemc-wait", > }; > -static const char *jz4780_i2c3_groups[] = { "i2c3-data", }; > -static const char *jz4780_i2c4_groups[] = { "i2c4-data-e", > "i2c4-data-f", }; > -static const char *jz4780_cim_groups[] = { "cim-data", }; > +static const char * const jz4780_i2c3_groups[] = { "i2c3-data", }; > +static const char * const jz4780_i2c4_groups[] = { > + "i2c4-data-e", "i2c4-data-f", > +}; > +static const char * const jz4780_cim_groups[] = { "cim-data", }; > > static const struct function_desc jz4780_functions[] = { > { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), }, > -- > 2.7.4 > >
My fault, I checked it again, the reason for this problem is that the member "pins" in structure "group_desc" is not a const type. It did not report this warning when I used gcc-5.2.0. After switching to gcc-6.3.0, the warning appeared. Should we ignore the warning information given by checkpatch.pl? On 2019年01月26日 01:59, Paul Cercueil wrote: > Hi, > > 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". >> >> Signed-off-by: Zhou Yanjie <zhouyanjie@zoho.com >> <mailto:zhouyanjie@zoho.com>> >> --- >> drivers/pinctrl/pinctrl-ingenic.c | 136 >> +++++++++++++++++++++----------------- >> 1 file changed, 76 insertions(+), 60 deletions(-) >> >> diff --git a/drivers/pinctrl/pinctrl-ingenic.c >> b/drivers/pinctrl/pinctrl-ingenic.c >> index 2b3f7e4..e982896 100644 >> --- a/drivers/pinctrl/pinctrl-ingenic.c >> +++ b/drivers/pinctrl/pinctrl-ingenic.c >> @@ -172,23 +172,25 @@ static const struct group_desc jz4740_groups[] = { >> INGENIC_PIN_GROUP("pwm7", jz4740_pwm_pwm7), >> }; >> >> -static const char *jz4740_mmc_groups[] = { "mmc-1bit", "mmc-4bit", }; >> -static const char *jz4740_uart0_groups[] = { "uart0-data", >> "uart0-hwflow", }; >> -static const char *jz4740_uart1_groups[] = { "uart1-data", }; >> -static const char *jz4740_lcd_groups[] = { >> +static const char * const jz4740_mmc_groups[] = { "mmc-1bit", >> "mmc-4bit", }; >> +static const char * const jz4740_uart0_groups[] = { >> + "uart0-data", "uart0-hwflow", >> +}; >> +static const char * const jz4740_uart1_groups[] = { "uart1-data", }; >> +static const char * const jz4740_lcd_groups[] = { >> "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-18bit-tft", >> "lcd-no-pins", >> }; >> -static const char *jz4740_nand_groups[] = { >> +static const char * const jz4740_nand_groups[] = { >> "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", >> }; >> -static const char *jz4740_pwm0_groups[] = { "pwm0", }; >> -static const char *jz4740_pwm1_groups[] = { "pwm1", }; >> -static const char *jz4740_pwm2_groups[] = { "pwm2", }; >> -static const char *jz4740_pwm3_groups[] = { "pwm3", }; >> -static const char *jz4740_pwm4_groups[] = { "pwm4", }; >> -static const char *jz4740_pwm5_groups[] = { "pwm5", }; >> -static const char *jz4740_pwm6_groups[] = { "pwm6", }; >> -static const char *jz4740_pwm7_groups[] = { "pwm7", }; >> +static const char * const jz4740_pwm0_groups[] = { "pwm0", }; >> +static const char * const jz4740_pwm1_groups[] = { "pwm1", }; >> +static const char * const jz4740_pwm2_groups[] = { "pwm2", }; >> +static const char * const jz4740_pwm3_groups[] = { "pwm3", }; >> +static const char * const jz4740_pwm4_groups[] = { "pwm4", }; >> +static const char * const jz4740_pwm5_groups[] = { "pwm5", }; >> +static const char * const jz4740_pwm6_groups[] = { "pwm6", }; >> +static const char * const jz4740_pwm7_groups[] = { "pwm7", }; >> >> 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), }, > ^~~~~~~~~~~~~~~~~ > >> @@ -272,19 +274,19 @@ static const struct group_desc jz4725b_groups[] >> = { >> INGENIC_PIN_GROUP("pwm5", jz4725b_pwm_pwm5), >> }; >> >> -static const char *jz4725b_mmc0_groups[] = { "mmc0-1bit", >> "mmc0-4bit", }; >> -static const char *jz4725b_mmc1_groups[] = { "mmc1-1bit", >> "mmc1-4bit", }; >> -static const char *jz4725b_uart_groups[] = { "uart-data", }; >> -static const char *jz4725b_nand_groups[] = { >> +static const char * const jz4725b_mmc0_groups[] = { "mmc0-1bit", >> "mmc0-4bit", }; >> +static const char * const jz4725b_mmc1_groups[] = { "mmc1-1bit", >> "mmc1-4bit", }; >> +static const char * const jz4725b_uart_groups[] = { "uart-data", }; >> +static const char * const jz4725b_nand_groups[] = { >> "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", >> "nand-cle-ale", "nand-fre-fwe", >> }; >> -static const char *jz4725b_pwm0_groups[] = { "pwm0", }; >> -static const char *jz4725b_pwm1_groups[] = { "pwm1", }; >> -static const char *jz4725b_pwm2_groups[] = { "pwm2", }; >> -static const char *jz4725b_pwm3_groups[] = { "pwm3", }; >> -static const char *jz4725b_pwm4_groups[] = { "pwm4", }; >> -static const char *jz4725b_pwm5_groups[] = { "pwm5", }; >> +static const char * const jz4725b_pwm0_groups[] = { "pwm0", }; >> +static const char * const jz4725b_pwm1_groups[] = { "pwm1", }; >> +static const char * const jz4725b_pwm2_groups[] = { "pwm2", }; >> +static const char * const jz4725b_pwm3_groups[] = { "pwm3", }; >> +static const char * const jz4725b_pwm4_groups[] = { "pwm4", }; >> +static const char * const jz4725b_pwm5_groups[] = { "pwm5", }; >> >> static const struct function_desc jz4725b_functions[] = { >> { "mmc0", jz4725b_mmc0_groups, ARRAY_SIZE(jz4725b_mmc0_groups), }, >> @@ -500,46 +502,56 @@ static const struct group_desc jz4770_groups[] = { >> INGENIC_PIN_GROUP("mac-mii", jz4770_mac_mii), >> }; >> >> -static const char *jz4770_uart0_groups[] = { "uart0-data", >> "uart0-hwflow", }; >> -static const char *jz4770_uart1_groups[] = { "uart1-data", >> "uart1-hwflow", }; >> -static const char *jz4770_uart2_groups[] = { "uart2-data", >> "uart2-hwflow", }; >> -static const char *jz4770_uart3_groups[] = { "uart3-data", >> "uart3-hwflow", }; >> -static const char *jz4770_mmc0_groups[] = { >> +static const char * const jz4770_uart0_groups[] = { >> + "uart0-data", "uart0-hwflow", >> +}; >> +static const char * const jz4770_uart1_groups[] = { >> + "uart1-data", "uart1-hwflow", >> +}; >> +static const char * const jz4770_uart2_groups[] = { >> + "uart2-data", "uart2-hwflow", >> +}; >> +static const char * const jz4770_uart3_groups[] = { >> + "uart3-data", "uart3-hwflow", >> +}; >> +static const char * const jz4770_mmc0_groups[] = { >> "mmc0-1bit-a", "mmc0-4bit-a", >> "mmc0-1bit-e", "mmc0-4bit-e", "mmc0-8bit-e", >> }; >> -static const char *jz4770_mmc1_groups[] = { >> +static const char * const jz4770_mmc1_groups[] = { >> "mmc1-1bit-d", "mmc1-4bit-d", >> "mmc1-1bit-e", "mmc1-4bit-e", "mmc1-8bit-e", >> }; >> -static const char *jz4770_mmc2_groups[] = { >> +static const char * const jz4770_mmc2_groups[] = { >> "mmc2-1bit-b", "mmc2-4bit-b", >> "mmc2-1bit-e", "mmc2-4bit-e", "mmc2-8bit-e", >> }; >> -static const char *jz4770_nemc_groups[] = { >> +static const char * const jz4770_nemc_groups[] = { >> "nemc-8bit-data", "nemc-16bit-data", "nemc-cle-ale", >> "nemc-addr", "nemc-rd-we", "nemc-frd-fwe", "nemc-wait", >> }; >> -static const char *jz4770_cs1_groups[] = { "nemc-cs1", }; >> -static const char *jz4770_cs2_groups[] = { "nemc-cs2", }; >> -static const char *jz4770_cs3_groups[] = { "nemc-cs3", }; >> -static const char *jz4770_cs4_groups[] = { "nemc-cs4", }; >> -static const char *jz4770_cs5_groups[] = { "nemc-cs5", }; >> -static const char *jz4770_cs6_groups[] = { "nemc-cs6", }; >> -static const char *jz4770_i2c0_groups[] = { "i2c0-data", }; >> -static const char *jz4770_i2c1_groups[] = { "i2c1-data", }; >> -static const char *jz4770_i2c2_groups[] = { "i2c2-data", }; >> -static const char *jz4770_cim_groups[] = { "cim-data-8bit", >> "cim-data-12bit", }; >> -static const char *jz4770_lcd_groups[] = { "lcd-24bit", >> "lcd-no-pins", }; >> -static const char *jz4770_pwm0_groups[] = { "pwm0", }; >> -static const char *jz4770_pwm1_groups[] = { "pwm1", }; >> -static const char *jz4770_pwm2_groups[] = { "pwm2", }; >> -static const char *jz4770_pwm3_groups[] = { "pwm3", }; >> -static const char *jz4770_pwm4_groups[] = { "pwm4", }; >> -static const char *jz4770_pwm5_groups[] = { "pwm5", }; >> -static const char *jz4770_pwm6_groups[] = { "pwm6", }; >> -static const char *jz4770_pwm7_groups[] = { "pwm7", }; >> -static const char *jz4770_mac_groups[] = { "mac-rmii", "mac-mii", }; >> +static const char * const jz4770_cs1_groups[] = { "nemc-cs1", }; >> +static const char * const jz4770_cs2_groups[] = { "nemc-cs2", }; >> +static const char * const jz4770_cs3_groups[] = { "nemc-cs3", }; >> +static const char * const jz4770_cs4_groups[] = { "nemc-cs4", }; >> +static const char * const jz4770_cs5_groups[] = { "nemc-cs5", }; >> +static const char * const jz4770_cs6_groups[] = { "nemc-cs6", }; >> +static const char * const jz4770_i2c0_groups[] = { "i2c0-data", }; >> +static const char * const jz4770_i2c1_groups[] = { "i2c1-data", }; >> +static const char * const jz4770_i2c2_groups[] = { "i2c2-data", }; >> +static const char * const jz4770_cim_groups[] = { >> + "cim-data-8bit", "cim-data-12bit", >> +}; >> +static const char * const jz4770_lcd_groups[] = { "lcd-24bit", >> "lcd-no-pins", }; >> +static const char * const jz4770_pwm0_groups[] = { "pwm0", }; >> +static const char * const jz4770_pwm1_groups[] = { "pwm1", }; >> +static const char * const jz4770_pwm2_groups[] = { "pwm2", }; >> +static const char * const jz4770_pwm3_groups[] = { "pwm3", }; >> +static const char * const jz4770_pwm4_groups[] = { "pwm4", }; >> +static const char * const jz4770_pwm5_groups[] = { "pwm5", }; >> +static const char * const jz4770_pwm6_groups[] = { "pwm6", }; >> +static const char * const jz4770_pwm7_groups[] = { "pwm7", }; >> +static const char * const jz4770_mac_groups[] = { "mac-rmii", >> "mac-mii", }; >> >> static const struct function_desc jz4770_functions[] = { >> { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), }, >> @@ -652,25 +664,29 @@ static const struct group_desc jz4780_groups[] = { >> INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7), >> }; >> >> -static const char *jz4780_uart2_groups[] = { "uart2-data", >> "uart2-hwflow", }; >> -static const char *jz4780_uart4_groups[] = { "uart4-data", }; >> -static const char *jz4780_mmc0_groups[] = { >> +static const char * const jz4780_uart2_groups[] = { >> + "uart2-data", "uart2-hwflow", >> +}; >> +static const char * const jz4780_uart4_groups[] = { "uart4-data", }; >> +static const char * const jz4780_mmc0_groups[] = { >> "mmc0-1bit-a", "mmc0-4bit-a", "mmc0-8bit-a", >> "mmc0-1bit-e", "mmc0-4bit-e", >> }; >> -static const char *jz4780_mmc1_groups[] = { >> +static const char * const jz4780_mmc1_groups[] = { >> "mmc1-1bit-d", "mmc1-4bit-d", "mmc1-1bit-e", "mmc1-4bit-e", >> }; >> -static const char *jz4780_mmc2_groups[] = { >> +static const char * const jz4780_mmc2_groups[] = { >> "mmc2-1bit-b", "mmc2-4bit-b", "mmc2-1bit-e", "mmc2-4bit-e", >> }; >> -static const char *jz4780_nemc_groups[] = { >> +static const char * const jz4780_nemc_groups[] = { >> "nemc-data", "nemc-cle-ale", "nemc-addr", >> "nemc-rd-we", "nemc-frd-fwe", "nemc-wait", >> }; >> -static const char *jz4780_i2c3_groups[] = { "i2c3-data", }; >> -static const char *jz4780_i2c4_groups[] = { "i2c4-data-e", >> "i2c4-data-f", }; >> -static const char *jz4780_cim_groups[] = { "cim-data", }; >> +static const char * const jz4780_i2c3_groups[] = { "i2c3-data", }; >> +static const char * const jz4780_i2c4_groups[] = { >> + "i2c4-data-e", "i2c4-data-f", >> +}; >> +static const char * const jz4780_cim_groups[] = { "cim-data", }; >> >> static const struct function_desc jz4780_functions[] = { >> { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), }, >> -- >> 2.7.4 >> >> > >
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; };
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@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; > }; > >
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c index 2b3f7e4..e982896 100644 --- a/drivers/pinctrl/pinctrl-ingenic.c +++ b/drivers/pinctrl/pinctrl-ingenic.c @@ -172,23 +172,25 @@ static const struct group_desc jz4740_groups[] = { INGENIC_PIN_GROUP("pwm7", jz4740_pwm_pwm7), }; -static const char *jz4740_mmc_groups[] = { "mmc-1bit", "mmc-4bit", }; -static const char *jz4740_uart0_groups[] = { "uart0-data", "uart0-hwflow", }; -static const char *jz4740_uart1_groups[] = { "uart1-data", }; -static const char *jz4740_lcd_groups[] = { +static const char * const jz4740_mmc_groups[] = { "mmc-1bit", "mmc-4bit", }; +static const char * const jz4740_uart0_groups[] = { + "uart0-data", "uart0-hwflow", +}; +static const char * const jz4740_uart1_groups[] = { "uart1-data", }; +static const char * const jz4740_lcd_groups[] = { "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-18bit-tft", "lcd-no-pins", }; -static const char *jz4740_nand_groups[] = { +static const char * const jz4740_nand_groups[] = { "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", }; -static const char *jz4740_pwm0_groups[] = { "pwm0", }; -static const char *jz4740_pwm1_groups[] = { "pwm1", }; -static const char *jz4740_pwm2_groups[] = { "pwm2", }; -static const char *jz4740_pwm3_groups[] = { "pwm3", }; -static const char *jz4740_pwm4_groups[] = { "pwm4", }; -static const char *jz4740_pwm5_groups[] = { "pwm5", }; -static const char *jz4740_pwm6_groups[] = { "pwm6", }; -static const char *jz4740_pwm7_groups[] = { "pwm7", }; +static const char * const jz4740_pwm0_groups[] = { "pwm0", }; +static const char * const jz4740_pwm1_groups[] = { "pwm1", }; +static const char * const jz4740_pwm2_groups[] = { "pwm2", }; +static const char * const jz4740_pwm3_groups[] = { "pwm3", }; +static const char * const jz4740_pwm4_groups[] = { "pwm4", }; +static const char * const jz4740_pwm5_groups[] = { "pwm5", }; +static const char * const jz4740_pwm6_groups[] = { "pwm6", }; +static const char * const jz4740_pwm7_groups[] = { "pwm7", }; static const struct function_desc jz4740_functions[] = { { "mmc", jz4740_mmc_groups, ARRAY_SIZE(jz4740_mmc_groups), }, @@ -272,19 +274,19 @@ static const struct group_desc jz4725b_groups[] = { INGENIC_PIN_GROUP("pwm5", jz4725b_pwm_pwm5), }; -static const char *jz4725b_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", }; -static const char *jz4725b_mmc1_groups[] = { "mmc1-1bit", "mmc1-4bit", }; -static const char *jz4725b_uart_groups[] = { "uart-data", }; -static const char *jz4725b_nand_groups[] = { +static const char * const jz4725b_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", }; +static const char * const jz4725b_mmc1_groups[] = { "mmc1-1bit", "mmc1-4bit", }; +static const char * const jz4725b_uart_groups[] = { "uart-data", }; +static const char * const jz4725b_nand_groups[] = { "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", "nand-cle-ale", "nand-fre-fwe", }; -static const char *jz4725b_pwm0_groups[] = { "pwm0", }; -static const char *jz4725b_pwm1_groups[] = { "pwm1", }; -static const char *jz4725b_pwm2_groups[] = { "pwm2", }; -static const char *jz4725b_pwm3_groups[] = { "pwm3", }; -static const char *jz4725b_pwm4_groups[] = { "pwm4", }; -static const char *jz4725b_pwm5_groups[] = { "pwm5", }; +static const char * const jz4725b_pwm0_groups[] = { "pwm0", }; +static const char * const jz4725b_pwm1_groups[] = { "pwm1", }; +static const char * const jz4725b_pwm2_groups[] = { "pwm2", }; +static const char * const jz4725b_pwm3_groups[] = { "pwm3", }; +static const char * const jz4725b_pwm4_groups[] = { "pwm4", }; +static const char * const jz4725b_pwm5_groups[] = { "pwm5", }; static const struct function_desc jz4725b_functions[] = { { "mmc0", jz4725b_mmc0_groups, ARRAY_SIZE(jz4725b_mmc0_groups), }, @@ -500,46 +502,56 @@ static const struct group_desc jz4770_groups[] = { INGENIC_PIN_GROUP("mac-mii", jz4770_mac_mii), }; -static const char *jz4770_uart0_groups[] = { "uart0-data", "uart0-hwflow", }; -static const char *jz4770_uart1_groups[] = { "uart1-data", "uart1-hwflow", }; -static const char *jz4770_uart2_groups[] = { "uart2-data", "uart2-hwflow", }; -static const char *jz4770_uart3_groups[] = { "uart3-data", "uart3-hwflow", }; -static const char *jz4770_mmc0_groups[] = { +static const char * const jz4770_uart0_groups[] = { + "uart0-data", "uart0-hwflow", +}; +static const char * const jz4770_uart1_groups[] = { + "uart1-data", "uart1-hwflow", +}; +static const char * const jz4770_uart2_groups[] = { + "uart2-data", "uart2-hwflow", +}; +static const char * const jz4770_uart3_groups[] = { + "uart3-data", "uart3-hwflow", +}; +static const char * const jz4770_mmc0_groups[] = { "mmc0-1bit-a", "mmc0-4bit-a", "mmc0-1bit-e", "mmc0-4bit-e", "mmc0-8bit-e", }; -static const char *jz4770_mmc1_groups[] = { +static const char * const jz4770_mmc1_groups[] = { "mmc1-1bit-d", "mmc1-4bit-d", "mmc1-1bit-e", "mmc1-4bit-e", "mmc1-8bit-e", }; -static const char *jz4770_mmc2_groups[] = { +static const char * const jz4770_mmc2_groups[] = { "mmc2-1bit-b", "mmc2-4bit-b", "mmc2-1bit-e", "mmc2-4bit-e", "mmc2-8bit-e", }; -static const char *jz4770_nemc_groups[] = { +static const char * const jz4770_nemc_groups[] = { "nemc-8bit-data", "nemc-16bit-data", "nemc-cle-ale", "nemc-addr", "nemc-rd-we", "nemc-frd-fwe", "nemc-wait", }; -static const char *jz4770_cs1_groups[] = { "nemc-cs1", }; -static const char *jz4770_cs2_groups[] = { "nemc-cs2", }; -static const char *jz4770_cs3_groups[] = { "nemc-cs3", }; -static const char *jz4770_cs4_groups[] = { "nemc-cs4", }; -static const char *jz4770_cs5_groups[] = { "nemc-cs5", }; -static const char *jz4770_cs6_groups[] = { "nemc-cs6", }; -static const char *jz4770_i2c0_groups[] = { "i2c0-data", }; -static const char *jz4770_i2c1_groups[] = { "i2c1-data", }; -static const char *jz4770_i2c2_groups[] = { "i2c2-data", }; -static const char *jz4770_cim_groups[] = { "cim-data-8bit", "cim-data-12bit", }; -static const char *jz4770_lcd_groups[] = { "lcd-24bit", "lcd-no-pins", }; -static const char *jz4770_pwm0_groups[] = { "pwm0", }; -static const char *jz4770_pwm1_groups[] = { "pwm1", }; -static const char *jz4770_pwm2_groups[] = { "pwm2", }; -static const char *jz4770_pwm3_groups[] = { "pwm3", }; -static const char *jz4770_pwm4_groups[] = { "pwm4", }; -static const char *jz4770_pwm5_groups[] = { "pwm5", }; -static const char *jz4770_pwm6_groups[] = { "pwm6", }; -static const char *jz4770_pwm7_groups[] = { "pwm7", }; -static const char *jz4770_mac_groups[] = { "mac-rmii", "mac-mii", }; +static const char * const jz4770_cs1_groups[] = { "nemc-cs1", }; +static const char * const jz4770_cs2_groups[] = { "nemc-cs2", }; +static const char * const jz4770_cs3_groups[] = { "nemc-cs3", }; +static const char * const jz4770_cs4_groups[] = { "nemc-cs4", }; +static const char * const jz4770_cs5_groups[] = { "nemc-cs5", }; +static const char * const jz4770_cs6_groups[] = { "nemc-cs6", }; +static const char * const jz4770_i2c0_groups[] = { "i2c0-data", }; +static const char * const jz4770_i2c1_groups[] = { "i2c1-data", }; +static const char * const jz4770_i2c2_groups[] = { "i2c2-data", }; +static const char * const jz4770_cim_groups[] = { + "cim-data-8bit", "cim-data-12bit", +}; +static const char * const jz4770_lcd_groups[] = { "lcd-24bit", "lcd-no-pins", }; +static const char * const jz4770_pwm0_groups[] = { "pwm0", }; +static const char * const jz4770_pwm1_groups[] = { "pwm1", }; +static const char * const jz4770_pwm2_groups[] = { "pwm2", }; +static const char * const jz4770_pwm3_groups[] = { "pwm3", }; +static const char * const jz4770_pwm4_groups[] = { "pwm4", }; +static const char * const jz4770_pwm5_groups[] = { "pwm5", }; +static const char * const jz4770_pwm6_groups[] = { "pwm6", }; +static const char * const jz4770_pwm7_groups[] = { "pwm7", }; +static const char * const jz4770_mac_groups[] = { "mac-rmii", "mac-mii", }; static const struct function_desc jz4770_functions[] = { { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), }, @@ -652,25 +664,29 @@ static const struct group_desc jz4780_groups[] = { INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7), }; -static const char *jz4780_uart2_groups[] = { "uart2-data", "uart2-hwflow", }; -static const char *jz4780_uart4_groups[] = { "uart4-data", }; -static const char *jz4780_mmc0_groups[] = { +static const char * const jz4780_uart2_groups[] = { + "uart2-data", "uart2-hwflow", +}; +static const char * const jz4780_uart4_groups[] = { "uart4-data", }; +static const char * const jz4780_mmc0_groups[] = { "mmc0-1bit-a", "mmc0-4bit-a", "mmc0-8bit-a", "mmc0-1bit-e", "mmc0-4bit-e", }; -static const char *jz4780_mmc1_groups[] = { +static const char * const jz4780_mmc1_groups[] = { "mmc1-1bit-d", "mmc1-4bit-d", "mmc1-1bit-e", "mmc1-4bit-e", }; -static const char *jz4780_mmc2_groups[] = { +static const char * const jz4780_mmc2_groups[] = { "mmc2-1bit-b", "mmc2-4bit-b", "mmc2-1bit-e", "mmc2-4bit-e", }; -static const char *jz4780_nemc_groups[] = { +static const char * const jz4780_nemc_groups[] = { "nemc-data", "nemc-cle-ale", "nemc-addr", "nemc-rd-we", "nemc-frd-fwe", "nemc-wait", }; -static const char *jz4780_i2c3_groups[] = { "i2c3-data", }; -static const char *jz4780_i2c4_groups[] = { "i2c4-data-e", "i2c4-data-f", }; -static const char *jz4780_cim_groups[] = { "cim-data", }; +static const char * const jz4780_i2c3_groups[] = { "i2c3-data", }; +static const char * const jz4780_i2c4_groups[] = { + "i2c4-data-e", "i2c4-data-f", +}; +static const char * const jz4780_cim_groups[] = { "cim-data", }; static const struct function_desc jz4780_functions[] = { { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), },
Warning is reported when checkpatch indicates that "static const char * array" should be changed to "static const char * const". Signed-off-by: Zhou Yanjie <zhouyanjie@zoho.com> --- drivers/pinctrl/pinctrl-ingenic.c | 136 +++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 60 deletions(-)