[05/12] pinctrl: armada-37xx: account for const type of of_device_id.data

Message ID 1514899688-27844-6-git-send-email-Julia.Lawall@lip6.fr
State New
Headers show
Series
  • account for const type of of_device_id.data
Related show

Commit Message

Julia Lawall Jan. 2, 2018, 1:28 p.m.
The data field of an of_device_id structure has type const void *, so
there is no need for a const-discarding cast when putting const values
into such a structure.

Done using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Gregory CLEMENT Jan. 2, 2018, 3:36 p.m. | #1
Hi Julia,
 
 On mar., janv. 02 2018, Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> The data field of an of_device_id structure has type const void *, so
> there is no need for a const-discarding cast when putting const values
> into such a structure.
>
> Done using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>


Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Thanks,

Gregory


PS: actually the intent was not to do a const-discarding cast it was
just a useless cast! :)


>
> ---
>  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff -u -p a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> @@ -1006,11 +1006,11 @@ static int armada_37xx_pinctrl_register(
>  static const struct of_device_id armada_37xx_pinctrl_of_match[] = {
>  	{
>  		.compatible = "marvell,armada3710-sb-pinctrl",
> -		.data = (void *)&armada_37xx_pin_sb,
> +		.data = &armada_37xx_pin_sb,
>  	},
>  	{
>  		.compatible = "marvell,armada3710-nb-pinctrl",
> -		.data = (void *)&armada_37xx_pin_nb,
> +		.data = &armada_37xx_pin_nb,
>  	},
>  	{ },
>  };
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Linus Walleij Jan. 3, 2018, 8:03 a.m. | #2
On Tue, Jan 2, 2018 at 2:28 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> The data field of an of_device_id structure has type const void *, so
> there is no need for a const-discarding cast when putting const values
> into such a structure.
>
> Done using Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Patch applied with Gregory's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -u -p a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -1006,11 +1006,11 @@  static int armada_37xx_pinctrl_register(
 static const struct of_device_id armada_37xx_pinctrl_of_match[] = {
 	{
 		.compatible = "marvell,armada3710-sb-pinctrl",
-		.data = (void *)&armada_37xx_pin_sb,
+		.data = &armada_37xx_pin_sb,
 	},
 	{
 		.compatible = "marvell,armada3710-nb-pinctrl",
-		.data = (void *)&armada_37xx_pin_nb,
+		.data = &armada_37xx_pin_nb,
 	},
 	{ },
 };