linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] pinctrl/actions: Constify static variables
@ 2020-08-30 22:43 Rikard Falkeborn
  2020-08-30 22:43 ` [PATCH 1/3] pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and owl_pinmux_ops Rikard Falkeborn
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2020-08-30 22:43 UTC (permalink / raw)
  To: Andreas Färber, Manivannan Sadhasivam, Linus Walleij
  Cc: Rikard Falkeborn, linux-gpio, linux-kernel, linux-arm-kernel

Constify a couple of static variables which are not modified to allow
the compiler to put them in read-only memory. Patch 1/3 is probably
the most important one since those structs contain function pointer.
The patches are independent, and can be applied in any order. 
Compile-tested only.

Rikard Falkeborn (3):
  pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and
    owl_pinmux_ops
  pinctrl: actions: pinctrl-s700: Constify s700_padinfo[]
  pinctrl: actions: pinctrl-s900: Constify s900_padinfo[]

 drivers/pinctrl/actions/pinctrl-owl.c  | 4 ++--
 drivers/pinctrl/actions/pinctrl-s700.c | 2 +-
 drivers/pinctrl/actions/pinctrl-s900.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and owl_pinmux_ops
  2020-08-30 22:43 [PATCH 0/3] pinctrl/actions: Constify static variables Rikard Falkeborn
@ 2020-08-30 22:43 ` Rikard Falkeborn
  2020-08-30 22:43 ` [PATCH 2/3] pinctrl: actions: pinctrl-s700: Constify s700_padinfo[] Rikard Falkeborn
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2020-08-30 22:43 UTC (permalink / raw)
  To: Andreas Färber, Manivannan Sadhasivam, Linus Walleij
  Cc: Rikard Falkeborn, linux-gpio, linux-kernel, linux-arm-kernel

The only usage of owl_pinctrl_ops and owl_pinmux_ops is to assign their
addresses to the pctlops and the pmxops fields in the pinctrl_desc struct,
which are const pointers. Make them const to allow the compiler to put them
in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/pinctrl/actions/pinctrl-owl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/actions/pinctrl-owl.c b/drivers/pinctrl/actions/pinctrl-owl.c
index 7efdfb4f3e9b..903a4baf3846 100644
--- a/drivers/pinctrl/actions/pinctrl-owl.c
+++ b/drivers/pinctrl/actions/pinctrl-owl.c
@@ -125,7 +125,7 @@ static void owl_pin_dbg_show(struct pinctrl_dev *pctrldev,
 	seq_printf(s, "%s", dev_name(pctrl->dev));
 }
 
-static struct pinctrl_ops owl_pinctrl_ops = {
+static const struct pinctrl_ops owl_pinctrl_ops = {
 	.get_groups_count = owl_get_groups_count,
 	.get_group_name = owl_get_group_name,
 	.get_group_pins = owl_get_group_pins,
@@ -212,7 +212,7 @@ static int owl_set_mux(struct pinctrl_dev *pctrldev,
 	return 0;
 }
 
-static struct pinmux_ops owl_pinmux_ops = {
+static const struct pinmux_ops owl_pinmux_ops = {
 	.get_functions_count = owl_get_funcs_count,
 	.get_function_name = owl_get_func_name,
 	.get_function_groups = owl_get_func_groups,
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] pinctrl: actions: pinctrl-s700: Constify s700_padinfo[]
  2020-08-30 22:43 [PATCH 0/3] pinctrl/actions: Constify static variables Rikard Falkeborn
  2020-08-30 22:43 ` [PATCH 1/3] pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and owl_pinmux_ops Rikard Falkeborn
@ 2020-08-30 22:43 ` Rikard Falkeborn
  2020-08-30 22:43 ` [PATCH 3/3] pinctrl: actions: pinctrl-s900: Constify s900_padinfo[] Rikard Falkeborn
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2020-08-30 22:43 UTC (permalink / raw)
  To: Andreas Färber, Manivannan Sadhasivam, Linus Walleij
  Cc: Rikard Falkeborn, linux-gpio, linux-kernel, linux-arm-kernel

The only usage of s700_padinfo[] is to assign it to the padinfo field in
the owl_pinctrl_soc_data struct, which is a const pointer. Make it const
to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/pinctrl/actions/pinctrl-s700.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/actions/pinctrl-s700.c b/drivers/pinctrl/actions/pinctrl-s700.c
index f579a6593f37..fd00940a5799 100644
--- a/drivers/pinctrl/actions/pinctrl-s700.c
+++ b/drivers/pinctrl/actions/pinctrl-s700.c
@@ -1685,7 +1685,7 @@ static PAD_PULLCTL_CONF(I2C2_SDATA, 2, 8, 1);
 static PAD_PULLCTL_CONF(I2C2_SCLK, 2, 7, 1);
 
 /* Pad info table for the pinmux subsystem */
-static struct owl_padinfo s700_padinfo[NUM_PADS] = {
+static const struct owl_padinfo s700_padinfo[NUM_PADS] = {
 	[ETH_TXD0] = PAD_INFO_ST(ETH_TXD0),
 	[ETH_TXD1] = PAD_INFO_ST(ETH_TXD1),
 	[ETH_TXEN] = PAD_INFO_ST(ETH_TXEN),
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] pinctrl: actions: pinctrl-s900: Constify s900_padinfo[]
  2020-08-30 22:43 [PATCH 0/3] pinctrl/actions: Constify static variables Rikard Falkeborn
  2020-08-30 22:43 ` [PATCH 1/3] pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and owl_pinmux_ops Rikard Falkeborn
  2020-08-30 22:43 ` [PATCH 2/3] pinctrl: actions: pinctrl-s700: Constify s700_padinfo[] Rikard Falkeborn
@ 2020-08-30 22:43 ` Rikard Falkeborn
  2020-08-31  9:15 ` [PATCH 0/3] pinctrl/actions: Constify static variables Manivannan Sadhasivam
  2020-09-12 10:15 ` Linus Walleij
  4 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2020-08-30 22:43 UTC (permalink / raw)
  To: Andreas Färber, Manivannan Sadhasivam, Linus Walleij
  Cc: Rikard Falkeborn, linux-gpio, linux-kernel, linux-arm-kernel

The only usage of s900_padinfo[] is to assign it to the padinfo field in
the owl_pinctrl_soc_data struct, which is a const pointer. Make it const
to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/pinctrl/actions/pinctrl-s900.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/actions/pinctrl-s900.c b/drivers/pinctrl/actions/pinctrl-s900.c
index 9492b86852e7..811249a8011e 100644
--- a/drivers/pinctrl/actions/pinctrl-s900.c
+++ b/drivers/pinctrl/actions/pinctrl-s900.c
@@ -1556,7 +1556,7 @@ static PAD_ST_CONF(I2S_BCLK0, 1, 1, 1);
 static PAD_ST_CONF(I2S_MCLK0, 1, 0, 1);
 
 /* Pad info table */
-static struct owl_padinfo s900_padinfo[NUM_PADS] = {
+static const struct owl_padinfo s900_padinfo[NUM_PADS] = {
 	[ETH_TXD0] = PAD_INFO_ST(ETH_TXD0),
 	[ETH_TXD1] = PAD_INFO_ST(ETH_TXD1),
 	[ETH_TXEN] = PAD_INFO_ST(ETH_TXEN),
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] pinctrl/actions: Constify static variables
  2020-08-30 22:43 [PATCH 0/3] pinctrl/actions: Constify static variables Rikard Falkeborn
                   ` (2 preceding siblings ...)
  2020-08-30 22:43 ` [PATCH 3/3] pinctrl: actions: pinctrl-s900: Constify s900_padinfo[] Rikard Falkeborn
@ 2020-08-31  9:15 ` Manivannan Sadhasivam
  2020-09-12 10:15 ` Linus Walleij
  4 siblings, 0 replies; 6+ messages in thread
From: Manivannan Sadhasivam @ 2020-08-31  9:15 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: linux-gpio, Linus Walleij, Andreas Färber, linux-arm-kernel,
	linux-kernel

On 0831, Rikard Falkeborn wrote:
> Constify a couple of static variables which are not modified to allow
> the compiler to put them in read-only memory. Patch 1/3 is probably
> the most important one since those structs contain function pointer.
> The patches are independent, and can be applied in any order. 
> Compile-tested only.
> 

For the series,

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> Rikard Falkeborn (3):
>   pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and
>     owl_pinmux_ops
>   pinctrl: actions: pinctrl-s700: Constify s700_padinfo[]
>   pinctrl: actions: pinctrl-s900: Constify s900_padinfo[]
> 
>  drivers/pinctrl/actions/pinctrl-owl.c  | 4 ++--
>  drivers/pinctrl/actions/pinctrl-s700.c | 2 +-
>  drivers/pinctrl/actions/pinctrl-s900.c | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> -- 
> 2.28.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] pinctrl/actions: Constify static variables
  2020-08-30 22:43 [PATCH 0/3] pinctrl/actions: Constify static variables Rikard Falkeborn
                   ` (3 preceding siblings ...)
  2020-08-31  9:15 ` [PATCH 0/3] pinctrl/actions: Constify static variables Manivannan Sadhasivam
@ 2020-09-12 10:15 ` Linus Walleij
  4 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2020-09-12 10:15 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: open list:GPIO SUBSYSTEM, linux-kernel, Andreas Färber,
	Linux ARM, Manivannan Sadhasivam

On Mon, Aug 31, 2020 at 12:43 AM Rikard Falkeborn
<rikard.falkeborn@gmail.com> wrote:

> Constify a couple of static variables which are not modified to allow
> the compiler to put them in read-only memory. Patch 1/3 is probably
> the most important one since those structs contain function pointer.
> The patches are independent, and can be applied in any order.
> Compile-tested only.
>
> Rikard Falkeborn (3):
>   pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and
>     owl_pinmux_ops
>   pinctrl: actions: pinctrl-s700: Constify s700_padinfo[]
>   pinctrl: actions: pinctrl-s900: Constify s900_padinfo[]

Patch series applied,
thanks!

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-12 10:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30 22:43 [PATCH 0/3] pinctrl/actions: Constify static variables Rikard Falkeborn
2020-08-30 22:43 ` [PATCH 1/3] pinctrl: actions: pinctrl-owl: Constify owl_pinctrl_ops and owl_pinmux_ops Rikard Falkeborn
2020-08-30 22:43 ` [PATCH 2/3] pinctrl: actions: pinctrl-s700: Constify s700_padinfo[] Rikard Falkeborn
2020-08-30 22:43 ` [PATCH 3/3] pinctrl: actions: pinctrl-s900: Constify s900_padinfo[] Rikard Falkeborn
2020-08-31  9:15 ` [PATCH 0/3] pinctrl/actions: Constify static variables Manivannan Sadhasivam
2020-09-12 10:15 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).