linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] pinctrl: Constify read-only struct regmap_config
@ 2024-07-04 18:36 Javier Carrasco
  2024-07-04 18:36 ` [PATCH 1/2] pinctrl: ti-iodelay: Constify " Javier Carrasco
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Javier Carrasco @ 2024-07-04 18:36 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Javier Carrasco

This series adds the const modifier to the remaining regmap_config
structs in the pinctrl subsystem that are effectively used as const
(i.e., only read after their declaration), but kept ad writtable data.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Javier Carrasco (2):
      pinctrl: ti-iodelay: Constify struct regmap_config
      pinctrl: realtek: Constify struct regmap_config

 drivers/pinctrl/realtek/pinctrl-rtd.c   | 2 +-
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 0b58e108042b0ed28a71cd7edf5175999955b233
change-id: 20240704-pinctrl-const-regmap_config-836a87d7e7e5

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>


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

* [PATCH 1/2] pinctrl: ti-iodelay: Constify struct regmap_config
  2024-07-04 18:36 [PATCH 0/2] pinctrl: Constify read-only struct regmap_config Javier Carrasco
@ 2024-07-04 18:36 ` Javier Carrasco
  2024-07-04 18:36 ` [PATCH 2/2] pinctrl: realtek: " Javier Carrasco
  2024-08-05  7:08 ` [PATCH 0/2] pinctrl: Constify read-only " Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Javier Carrasco @ 2024-07-04 18:36 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Javier Carrasco

`dra7_iodelay_regmap_config` is not modified and can be declared as
const to move its data to a read-only section.

The pointer used to reference that struct has been made const
accordingly.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
index ef9758638501..08d785c8e0e3 100644
--- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
+++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
@@ -82,7 +82,7 @@ struct ti_iodelay_reg_data {
 	u32 reg_start_offset;
 	u32 reg_nr_per_pin;
 
-	struct regmap_config *regmap_config;
+	const struct regmap_config *regmap_config;
 };
 
 /**
@@ -770,7 +770,7 @@ static int ti_iodelay_alloc_pins(struct device *dev,
 	return 0;
 }
 
-static struct regmap_config dra7_iodelay_regmap_config = {
+static const struct regmap_config dra7_iodelay_regmap_config = {
 	.reg_bits = 32,
 	.reg_stride = 4,
 	.val_bits = 32,

-- 
2.40.1


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

* [PATCH 2/2] pinctrl: realtek: Constify struct regmap_config
  2024-07-04 18:36 [PATCH 0/2] pinctrl: Constify read-only struct regmap_config Javier Carrasco
  2024-07-04 18:36 ` [PATCH 1/2] pinctrl: ti-iodelay: Constify " Javier Carrasco
@ 2024-07-04 18:36 ` Javier Carrasco
  2024-08-05  7:08 ` [PATCH 0/2] pinctrl: Constify read-only " Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Javier Carrasco @ 2024-07-04 18:36 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Javier Carrasco

`rtd_pinctrl_regmap_config` is not modified and can be declared as const
to move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/pinctrl/realtek/pinctrl-rtd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/realtek/pinctrl-rtd.c b/drivers/pinctrl/realtek/pinctrl-rtd.c
index 208896593b61..244060486332 100644
--- a/drivers/pinctrl/realtek/pinctrl-rtd.c
+++ b/drivers/pinctrl/realtek/pinctrl-rtd.c
@@ -533,7 +533,7 @@ static const struct pinconf_ops rtd_pinconf_ops = {
 	.pin_config_group_set = rtd_pin_config_group_set,
 };
 
-static struct regmap_config rtd_pinctrl_regmap_config = {
+static const struct regmap_config rtd_pinctrl_regmap_config = {
 	.reg_bits = 32,
 	.val_bits = 32,
 	.reg_stride = 4,

-- 
2.40.1


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

* Re: [PATCH 0/2] pinctrl: Constify read-only struct regmap_config
  2024-07-04 18:36 [PATCH 0/2] pinctrl: Constify read-only struct regmap_config Javier Carrasco
  2024-07-04 18:36 ` [PATCH 1/2] pinctrl: ti-iodelay: Constify " Javier Carrasco
  2024-07-04 18:36 ` [PATCH 2/2] pinctrl: realtek: " Javier Carrasco
@ 2024-08-05  7:08 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2024-08-05  7:08 UTC (permalink / raw)
  To: Javier Carrasco; +Cc: linux-gpio, linux-kernel

On Thu, Jul 4, 2024 at 8:36 PM Javier Carrasco
<javier.carrasco.cruz@gmail.com> wrote:

> This series adds the const modifier to the remaining regmap_config
> structs in the pinctrl subsystem that are effectively used as const
> (i.e., only read after their declaration), but kept ad writtable data.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>

Patches applied.

Yours,
Linus Walleij

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

end of thread, other threads:[~2024-08-05  7:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-04 18:36 [PATCH 0/2] pinctrl: Constify read-only struct regmap_config Javier Carrasco
2024-07-04 18:36 ` [PATCH 1/2] pinctrl: ti-iodelay: Constify " Javier Carrasco
2024-07-04 18:36 ` [PATCH 2/2] pinctrl: realtek: " Javier Carrasco
2024-08-05  7:08 ` [PATCH 0/2] pinctrl: Constify read-only " 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).