* [PATCH] rtc: rx6110: Constify struct regmap_config
@ 2024-05-04 22:43 Christophe JAILLET
2024-05-07 21:43 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-05-04 22:43 UTC (permalink / raw)
To: Alexandre Belloni
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-rtc
'regmap_spi_config' and 'regmap_i2c_config' are not modified in this diver
and are only used as a const struct regmap_config.
Constifying these structures moves some data to a read-only section, so
increase overall security.
On a x86_64, with allmodconfig:
Before:
text data bss dec hex filename
8896 1554 32 10482 28f2 drivers/rtc/rtc-rx6110.o
After:
text data bss dec hex filename
9536 914 32 10482 28f2 drivers/rtc/rtc-rx6110.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/rtc/rtc-rx6110.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-rx6110.c b/drivers/rtc/rtc-rx6110.c
index 834274db8c3f..af6dd6ccbe3b 100644
--- a/drivers/rtc/rtc-rx6110.c
+++ b/drivers/rtc/rtc-rx6110.c
@@ -330,7 +330,7 @@ static int rx6110_probe(struct rx6110_data *rx6110, struct device *dev)
}
#if IS_ENABLED(CONFIG_SPI_MASTER)
-static struct regmap_config regmap_spi_config = {
+static const struct regmap_config regmap_spi_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = RX6110_REG_IRQ,
@@ -410,7 +410,7 @@ static void rx6110_spi_unregister(void)
#endif /* CONFIG_SPI_MASTER */
#if IS_ENABLED(CONFIG_I2C)
-static struct regmap_config regmap_i2c_config = {
+static const struct regmap_config regmap_i2c_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = RX6110_REG_IRQ,
--
2.45.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: rx6110: Constify struct regmap_config
2024-05-04 22:43 [PATCH] rtc: rx6110: Constify struct regmap_config Christophe JAILLET
@ 2024-05-07 21:43 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2024-05-07 21:43 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors, linux-rtc
On Sun, 05 May 2024 00:43:07 +0200, Christophe JAILLET wrote:
> 'regmap_spi_config' and 'regmap_i2c_config' are not modified in this diver
> and are only used as a const struct regmap_config.
>
> Constifying these structures moves some data to a read-only section, so
> increase overall security.
>
> On a x86_64, with allmodconfig:
> Before:
> text data bss dec hex filename
> 8896 1554 32 10482 28f2 drivers/rtc/rtc-rx6110.o
>
> [...]
Applied, thanks!
[1/1] rtc: rx6110: Constify struct regmap_config
https://git.kernel.org/abelloni/c/6a216cbadbe0
Best regards,
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-07 21:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-04 22:43 [PATCH] rtc: rx6110: Constify struct regmap_config Christophe JAILLET
2024-05-07 21:43 ` Alexandre Belloni
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).