* [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data
@ 2025-06-21 18:28 Christophe JAILLET
2025-06-21 18:30 ` [PATCH v2 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2025-06-21 18:28 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
27804 10016 256 38076 94bc 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
Changes in v2:
- Rebase with latest -next because part of this patch was already
submitted by someone else, and applied
- Update the numbers accordingly
v1: https://lore.kernel.org/all/c4abceb95665e4363937a1f41588772f38c47411.1749998382.git.christophe.jaillet@wanadoo.fr/
---
drivers/mfd/tps65219.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c
index f6387345457e..83b8ab4707c2 100644
--- a/drivers/mfd/tps65219.c
+++ b/drivers/mfd/tps65219.c
@@ -260,7 +260,7 @@ static const 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] 4+ messages in thread
* [PATCH v2 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219'
2025-06-21 18:28 [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
@ 2025-06-21 18:30 ` Christophe JAILLET
2025-06-21 18:30 ` [PATCH v2 3/3] mfd: tps65219: Remove another " Christophe JAILLET
2025-06-25 10:18 ` [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2025-06-21 18:30 UTC (permalink / raw)
To: aaro.koskinen, andreas, khilman, rogerq, tony, Lee Jones
Cc: linux-kernel, linux-omap, 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.
Changes in v2:
- No change
v1: https://lore.kernel.org/all/1f5e2e582ad97e9863ed5885266ae271f2be32bc.1749998382.git.christophe.jaillet@wanadoo.fr/
---
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] 4+ messages in thread
* [PATCH v2 3/3] mfd: tps65219: Remove another unused field from 'struct tps65219'
2025-06-21 18:28 [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
2025-06-21 18:30 ` [PATCH v2 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
@ 2025-06-21 18:30 ` Christophe JAILLET
2025-06-25 10:18 ` [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2025-06-21 18:30 UTC (permalink / raw)
To: aaro.koskinen, andreas, khilman, rogerq, tony, Lee Jones
Cc: linux-kernel, linux-omap, 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.
Changes in v2:
- No change
v1: https://lore.kernel.org/all/410d08b7043f8c724d0dee29c06b7029fb933a47.1749998382.git.christophe.jaillet@wanadoo.fr/
---
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 83b8ab4707c2..65a952555218 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] 4+ messages in thread
* Re: [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data
2025-06-21 18:28 [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
2025-06-21 18:30 ` [PATCH v2 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
2025-06-21 18:30 ` [PATCH v2 3/3] mfd: tps65219: Remove another " Christophe JAILLET
@ 2025-06-25 10:18 ` Lee Jones
2 siblings, 0 replies; 4+ 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 Sat, 21 Jun 2025 20:28: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
> 27804 10016 256 38076 94bc 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] 4+ messages in thread
end of thread, other threads:[~2025-06-25 10:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-21 18:28 [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data Christophe JAILLET
2025-06-21 18:30 ` [PATCH v2 2/3] mfd: tps65219: Remove an unused field from 'struct tps65219' Christophe JAILLET
2025-06-21 18:30 ` [PATCH v2 3/3] mfd: tps65219: Remove another " Christophe JAILLET
2025-06-25 10:18 ` [PATCH v2 1/3] mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data 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).