linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data
@ 2025-06-15 14:40 Christophe JAILLET
  2025-06-15 14:42 ` [PATCH 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christophe JAILLET @ 2025-06-15 14:40 UTC (permalink / raw)
  To: Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
	Tony Lindgren, Lee Jones
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-omap

'struct regmap_irq_sub_irq_map' and 'struct tps65219_chip_data' are not
modified in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  27413	  10272	    256	  37941	   9435	drivers/mfd/tps65219.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  27893	   9792	    256	  37941	   9435	drivers/mfd/tps65219.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/mfd/tps65219.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c
index fd390600fbf0..62669041e0d9 100644
--- a/drivers/mfd/tps65219.c
+++ b/drivers/mfd/tps65219.c
@@ -238,7 +238,7 @@ static unsigned int tps65214_bit4_offsets[] = { TPS65214_REG_INT_BUCK_3_POS };
 static unsigned int tps65214_bit5_offsets[] = { TPS65214_REG_INT_LDO_1_2_POS };
 static unsigned int tps65214_bit7_offsets[] = { TPS65214_REG_INT_PB_POS };
 
-static struct regmap_irq_sub_irq_map tps65219_sub_irq_offsets[] = {
+static const struct regmap_irq_sub_irq_map tps65219_sub_irq_offsets[] = {
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit0_offsets),
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit1_offsets),
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit2_offsets),
@@ -249,7 +249,7 @@ static struct regmap_irq_sub_irq_map tps65219_sub_irq_offsets[] = {
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit7_offsets),
 };
 
-static struct regmap_irq_sub_irq_map tps65215_sub_irq_offsets[] = {
+static const struct regmap_irq_sub_irq_map tps65215_sub_irq_offsets[] = {
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit0_offsets),
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit1_offsets),
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit2_offsets),
@@ -260,7 +260,7 @@ static struct regmap_irq_sub_irq_map tps65215_sub_irq_offsets[] = {
 	REGMAP_IRQ_MAIN_REG_OFFSET(bit7_offsets),
 };
 
-static struct regmap_irq_sub_irq_map tps65214_sub_irq_offsets[] = {
+static const struct regmap_irq_sub_irq_map tps65214_sub_irq_offsets[] = {
 	REGMAP_IRQ_MAIN_REG_OFFSET(tps65214_bit0_offsets),
 	REGMAP_IRQ_MAIN_REG_OFFSET(tps65214_bit1_offsets),
 	REGMAP_IRQ_MAIN_REG_OFFSET(tps65214_bit2_offsets),
@@ -455,7 +455,7 @@ struct tps65219_chip_data {
 	int n_cells;
 };
 
-static struct tps65219_chip_data chip_info_table[] = {
+static const struct tps65219_chip_data chip_info_table[] = {
 	[TPS65214] = {
 		.irq_chip = &tps65214_irq_chip,
 		.cells = tps65214_cells,
@@ -476,7 +476,7 @@ static struct tps65219_chip_data chip_info_table[] = {
 static int tps65219_probe(struct i2c_client *client)
 {
 	struct tps65219 *tps;
-	struct tps65219_chip_data *pmic;
+	const struct tps65219_chip_data *pmic;
 	bool pwr_button;
 	int ret;
 
-- 
2.49.0


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

* [PATCH 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219'
  2025-06-15 14:40 [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
@ 2025-06-15 14:42 ` Christophe JAILLET
  2025-06-15 14:42 ` [PATCH 3/3] mfd: tps65219: Remove another " Christophe JAILLET
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2025-06-15 14:42 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, Lee Jones
  Cc: linux-omap, linux-kernel, kernel-janitors, Christophe JAILLET

Since commit 3df4c6367520 ("mfd: tps65219: Add support for soft shutdown
via sys-off API"), the 'nb' field from 'struct tps65219' is unused.
Remove it.

Also remove the now useless #include <linux/notifier.h> for the same
reason.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 include/linux/mfd/tps65219.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/mfd/tps65219.h b/include/linux/mfd/tps65219.h
index 3e8d29189267..690002932377 100644
--- a/include/linux/mfd/tps65219.h
+++ b/include/linux/mfd/tps65219.h
@@ -10,7 +10,6 @@
 #define MFD_TPS65219_H
 
 #include <linux/bitops.h>
-#include <linux/notifier.h>
 #include <linux/regmap.h>
 #include <linux/regulator/driver.h>
 
@@ -440,7 +439,6 @@ enum tps65219_irqs {
  * @regmap: Regmap for accessing the device registers
  * @chip_id: Chip ID
  * @irq_data: Regmap irq data used for the irq chip
- * @nb: notifier block for the restart handler
  */
 struct tps65219 {
 	struct device *dev;
@@ -448,7 +446,6 @@ struct tps65219 {
 
 	unsigned int chip_id;
 	struct regmap_irq_chip_data *irq_data;
-	struct notifier_block nb;
 };
 
 #endif /* MFD_TPS65219_H */
-- 
2.49.0


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

* [PATCH 3/3] mfd: tps65219: Remove another unused field from 'struct tps65219'
  2025-06-15 14:40 [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
  2025-06-15 14:42 ` [PATCH 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
@ 2025-06-15 14:42 ` Christophe JAILLET
  2025-06-19 11:48 ` [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Lee Jones
  2025-06-25 10:18 ` Lee Jones
  3 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2025-06-15 14:42 UTC (permalink / raw)
  To: aaro.koskinen, andreas, khilman, rogerq, tony, Lee Jones
  Cc: linux-omap, linux-kernel, kernel-janitors, Christophe JAILLET

The 'chip_id' field from 'struct tps65219' is unused.
Remove it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/mfd/tps65219.c       | 5 +++--
 include/linux/mfd/tps65219.h | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c
index 62669041e0d9..cc6121fd0ec3 100644
--- a/drivers/mfd/tps65219.c
+++ b/drivers/mfd/tps65219.c
@@ -477,6 +477,7 @@ static int tps65219_probe(struct i2c_client *client)
 {
 	struct tps65219 *tps;
 	const struct tps65219_chip_data *pmic;
+	unsigned int chip_id;
 	bool pwr_button;
 	int ret;
 
@@ -487,8 +488,8 @@ static int tps65219_probe(struct i2c_client *client)
 	i2c_set_clientdata(client, tps);
 
 	tps->dev = &client->dev;
-	tps->chip_id = (uintptr_t)i2c_get_match_data(client);
-	pmic = &chip_info_table[tps->chip_id];
+	chip_id = (uintptr_t)i2c_get_match_data(client);
+	pmic = &chip_info_table[chip_id];
 
 	tps->regmap = devm_regmap_init_i2c(client, &tps65219_regmap_config);
 	if (IS_ERR(tps->regmap)) {
diff --git a/include/linux/mfd/tps65219.h b/include/linux/mfd/tps65219.h
index 690002932377..55234e771ba7 100644
--- a/include/linux/mfd/tps65219.h
+++ b/include/linux/mfd/tps65219.h
@@ -437,14 +437,12 @@ enum tps65219_irqs {
  *
  * @dev: MFD device
  * @regmap: Regmap for accessing the device registers
- * @chip_id: Chip ID
  * @irq_data: Regmap irq data used for the irq chip
  */
 struct tps65219 {
 	struct device *dev;
 	struct regmap *regmap;
 
-	unsigned int chip_id;
 	struct regmap_irq_chip_data *irq_data;
 };
 
-- 
2.49.0


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

* Re: [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data
  2025-06-15 14:40 [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
  2025-06-15 14:42 ` [PATCH 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
  2025-06-15 14:42 ` [PATCH 3/3] mfd: tps65219: Remove another " Christophe JAILLET
@ 2025-06-19 11:48 ` Lee Jones
  2025-06-25 10:18 ` Lee Jones
  3 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2025-06-19 11:48 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
	Tony Lindgren, linux-kernel, kernel-janitors, linux-omap

On Sun, 15 Jun 2025, Christophe JAILLET wrote:

> 'struct regmap_irq_sub_irq_map' and 'struct tps65219_chip_data' are not
> modified in this driver.
> 
> Constifying these structures moves some data to a read-only section, so
> increases overall security.
> 
> On a x86_64, with allmodconfig:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>   27413	  10272	    256	  37941	   9435	drivers/mfd/tps65219.o
> 
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>   27893	   9792	    256	  37941	   9435	drivers/mfd/tps65219.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
>  drivers/mfd/tps65219.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Set doesn't apply.  Please rebase.

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data
  2025-06-15 14:40 [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
                   ` (2 preceding siblings ...)
  2025-06-19 11:48 ` [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Lee Jones
@ 2025-06-25 10:18 ` Lee Jones
  3 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2025-06-25 10:18 UTC (permalink / raw)
  To: Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros,
	Tony Lindgren, Lee Jones, Christophe JAILLET
  Cc: linux-kernel, kernel-janitors, linux-omap

On Sun, 15 Jun 2025 16:40:20 +0200, Christophe JAILLET wrote:
> 'struct regmap_irq_sub_irq_map' and 'struct tps65219_chip_data' are not
> modified in this driver.
> 
> Constifying these structures moves some data to a read-only section, so
> increases overall security.
> 
> On a x86_64, with allmodconfig:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>   27413	  10272	    256	  37941	   9435	drivers/mfd/tps65219.o
> 
> [...]

Applied, thanks!

[1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data
      commit: 33b7335e37896ffbc8cc5dcd46f82d5a0e654bf8
[2/3] mfd: tps65219: Remove an unused field from 'struct tps65219'
      commit: 0bbdb525bfa39980bb2f4bdaddd73591eedb6346
[3/3] mfd: tps65219: Remove another unused field from 'struct tps65219'
      commit: ea003d0598460c84effb55a13c362c9c1c6e1cd7

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2025-06-25 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-15 14:40 [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
2025-06-15 14:42 ` [PATCH 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
2025-06-15 14:42 ` [PATCH 3/3] mfd: tps65219: Remove another " Christophe JAILLET
2025-06-19 11:48 ` [PATCH 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Lee Jones
2025-06-25 10:18 ` 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).