linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] drivers/mfd: Constify static struct resource
@ 2020-09-22 19:26 Rikard Falkeborn
  2020-09-22 19:26 ` [PATCH 6/8] mfd: stmpe: " Rikard Falkeborn
  2020-09-22 19:26 ` [PATCH 7/8] mfd: sun4i-gpadc: " Rikard Falkeborn
  0 siblings, 2 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2020-09-22 19:26 UTC (permalink / raw)
  To: Lee Jones
  Cc: Milo Kim, Andy Shevchenko, support.opensource, Tony Lindgren,
	patches, linux-kernel, Rikard Falkeborn, Chen-Yu Tsai,
	Maxime Ripard, Maxime Coquelin, linux-omap, linux-stm32,
	linux-arm-kernel, Alexandre Torgue

Constify a number of static struct resource to allow the compiler to put
them in read-only memory. Typically, the only usage of these is to assign
their address to the resources field in the mfd_cell struct, which is a
const pointer (a few drivers also read the value of the start field).

I went through the rest of the static instances of struct resource in
drivers/mfd and all of them are either directly modified by the driver
or has its address passed to mfd_add_devices() which takes a non-const
pointer.

The series is compile-tested only.

I split this into patches per maintainer, I'll happily split it (or squash
it) some other way if that's preferable.

Rikard Falkeborn (8):
  mfd: da: Constify static struct resource
  mfd: intel: Constify static struct resource
  mfd: Constify static struct resource in OMAP2+ drivers
  mfd: wm: Constify static struct resource
  mfd: lp8788: Constify static struct resource
  mfd: stmpe: Constify static struct resource
  mfd: sun4i-gpadc: Constify static struct resource
  mfd: Constify static struct resource

 drivers/mfd/88pm800.c                 |  2 +-
 drivers/mfd/88pm860x-core.c           | 50 ++++++++++++------------
 drivers/mfd/da9055-core.c             |  8 ++--
 drivers/mfd/da9062-core.c             | 24 ++++++------
 drivers/mfd/da9063-core.c             |  8 ++--
 drivers/mfd/da9150-core.c             |  6 +--
 drivers/mfd/hi655x-pmic.c             |  2 +-
 drivers/mfd/intel_msic.c              | 18 ++++-----
 drivers/mfd/intel_quark_i2c_gpio.c    |  4 +-
 drivers/mfd/intel_soc_pmic_bxtwc.c    | 14 +++----
 drivers/mfd/intel_soc_pmic_chtdc_ti.c | 10 ++---
 drivers/mfd/intel_soc_pmic_chtwc.c    |  4 +-
 drivers/mfd/intel_soc_pmic_crc.c      | 10 ++---
 drivers/mfd/ioc3.c                    | 16 ++++----
 drivers/mfd/lp8788.c                  |  4 +-
 drivers/mfd/max8925-core.c            | 56 +++++++++++++--------------
 drivers/mfd/rdc321x-southbridge.c     |  4 +-
 drivers/mfd/retu-mfd.c                |  4 +-
 drivers/mfd/rk808.c                   |  8 ++--
 drivers/mfd/stmpe.c                   | 10 ++---
 drivers/mfd/sun4i-gpadc.c             |  2 +-
 drivers/mfd/tc3589x.c                 |  4 +-
 drivers/mfd/tc6387xb.c                |  2 +-
 drivers/mfd/tc6393xb.c                |  6 +--
 drivers/mfd/tps65090.c                |  2 +-
 drivers/mfd/tps65217.c                |  4 +-
 drivers/mfd/tps6586x.c                |  2 +-
 drivers/mfd/tps65910.c                |  2 +-
 drivers/mfd/tps80031.c                |  2 +-
 drivers/mfd/wm831x-core.c             | 52 ++++++++++++-------------
 drivers/mfd/wm8994-core.c             |  4 +-
 31 files changed, 172 insertions(+), 172 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] 5+ messages in thread

* [PATCH 6/8] mfd: stmpe: Constify static struct resource
  2020-09-22 19:26 [PATCH 0/8] drivers/mfd: Constify static struct resource Rikard Falkeborn
@ 2020-09-22 19:26 ` Rikard Falkeborn
  2020-11-04 10:58   ` Lee Jones
  2020-09-22 19:26 ` [PATCH 7/8] mfd: sun4i-gpadc: " Rikard Falkeborn
  1 sibling, 1 reply; 5+ messages in thread
From: Rikard Falkeborn @ 2020-09-22 19:26 UTC (permalink / raw)
  To: Lee Jones
  Cc: Alexandre Torgue, linux-kernel, Rikard Falkeborn,
	Maxime Coquelin, linux-stm32, linux-arm-kernel

Constify a couple of static struct resource. The only usage of the
structs is to assign their address to the resources field in the
mfd_cell struct. This allows the compiler to put them in read-only
memory. Done with the help of Coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/mfd/stmpe.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index 1aee3b3253fc..90f3292230c9 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -312,7 +312,7 @@ EXPORT_SYMBOL_GPL(stmpe_set_altfunc);
  * GPIO (all variants)
  */
 
-static struct resource stmpe_gpio_resources[] = {
+static const struct resource stmpe_gpio_resources[] = {
 	/* Start and end filled dynamically */
 	{
 		.flags	= IORESOURCE_IRQ,
@@ -336,7 +336,7 @@ static const struct mfd_cell stmpe_gpio_cell_noirq = {
  * Keypad (1601, 2401, 2403)
  */
 
-static struct resource stmpe_keypad_resources[] = {
+static const struct resource stmpe_keypad_resources[] = {
 	{
 		.name	= "KEYPAD",
 		.flags	= IORESOURCE_IRQ,
@@ -357,7 +357,7 @@ static const struct mfd_cell stmpe_keypad_cell = {
 /*
  * PWM (1601, 2401, 2403)
  */
-static struct resource stmpe_pwm_resources[] = {
+static const struct resource stmpe_pwm_resources[] = {
 	{
 		.name	= "PWM0",
 		.flags	= IORESOURCE_IRQ,
@@ -445,7 +445,7 @@ static struct stmpe_variant_info stmpe801_noirq = {
  * Touchscreen (STMPE811 or STMPE610)
  */
 
-static struct resource stmpe_ts_resources[] = {
+static const struct resource stmpe_ts_resources[] = {
 	{
 		.name	= "TOUCH_DET",
 		.flags	= IORESOURCE_IRQ,
@@ -467,7 +467,7 @@ static const struct mfd_cell stmpe_ts_cell = {
  * ADC (STMPE811)
  */
 
-static struct resource stmpe_adc_resources[] = {
+static const struct resource stmpe_adc_resources[] = {
 	{
 		.name	= "STMPE_TEMP_SENS",
 		.flags	= IORESOURCE_IRQ,
-- 
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] 5+ messages in thread

* [PATCH 7/8] mfd: sun4i-gpadc: Constify static struct resource
  2020-09-22 19:26 [PATCH 0/8] drivers/mfd: Constify static struct resource Rikard Falkeborn
  2020-09-22 19:26 ` [PATCH 6/8] mfd: stmpe: " Rikard Falkeborn
@ 2020-09-22 19:26 ` Rikard Falkeborn
  2020-11-04 10:59   ` Lee Jones
  1 sibling, 1 reply; 5+ messages in thread
From: Rikard Falkeborn @ 2020-09-22 19:26 UTC (permalink / raw)
  To: Lee Jones
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-kernel, Rikard Falkeborn,
	linux-arm-kernel

Constify adc_resources[]. The only usage is to assign its address to the
resources field of the mfd_cell struct. This allows the compiler to put
it in read-only memory. Done with the help of Coccinelle.

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

diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c
index b346fbce3c01..aaa233d916b2 100644
--- a/drivers/mfd/sun4i-gpadc.c
+++ b/drivers/mfd/sun4i-gpadc.c
@@ -18,7 +18,7 @@
 #define ARCH_SUN5I_A13 1
 #define ARCH_SUN6I_A31 2
 
-static struct resource adc_resources[] = {
+static const struct resource adc_resources[] = {
 	DEFINE_RES_IRQ_NAMED(SUN4I_GPADC_IRQ_FIFO_DATA, "FIFO_DATA_PENDING"),
 	DEFINE_RES_IRQ_NAMED(SUN4I_GPADC_IRQ_TEMP_DATA, "TEMP_DATA_PENDING"),
 };
-- 
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] 5+ messages in thread

* Re: [PATCH 6/8] mfd: stmpe: Constify static struct resource
  2020-09-22 19:26 ` [PATCH 6/8] mfd: stmpe: " Rikard Falkeborn
@ 2020-11-04 10:58   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2020-11-04 10:58 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: linux-arm-kernel, linux-stm32, linux-kernel, Maxime Coquelin,
	Alexandre Torgue

On Tue, 22 Sep 2020, Rikard Falkeborn wrote:

> Constify a couple of static struct resource. The only usage of the
> structs is to assign their address to the resources field in the
> mfd_cell struct. This allows the compiler to put them in read-only
> memory. Done with the help of Coccinelle.
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> ---
>  drivers/mfd/stmpe.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
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] 5+ messages in thread

* Re: [PATCH 7/8] mfd: sun4i-gpadc: Constify static struct resource
  2020-09-22 19:26 ` [PATCH 7/8] mfd: sun4i-gpadc: " Rikard Falkeborn
@ 2020-11-04 10:59   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2020-11-04 10:59 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: linux-arm-kernel, Chen-Yu Tsai, linux-kernel, Maxime Ripard

On Tue, 22 Sep 2020, Rikard Falkeborn wrote:

> Constify adc_resources[]. The only usage is to assign its address to the
> resources field of the mfd_cell struct. This allows the compiler to put
> it in read-only memory. Done with the help of Coccinelle.
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> ---
>  drivers/mfd/sun4i-gpadc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2020-11-04 11:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 19:26 [PATCH 0/8] drivers/mfd: Constify static struct resource Rikard Falkeborn
2020-09-22 19:26 ` [PATCH 6/8] mfd: stmpe: " Rikard Falkeborn
2020-11-04 10:58   ` Lee Jones
2020-09-22 19:26 ` [PATCH 7/8] mfd: sun4i-gpadc: " Rikard Falkeborn
2020-11-04 10:59   ` Lee Jones

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).