Commit 10c1ea1e authored by Christophe JAILLET's avatar Christophe JAILLET Committed by AngeloGioacchino Del Regno

soc: mediatek: pwrap: Constify some struct int[]

These arrays are not modified in this driver.

Constifying this structure 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
  45528	   8532	     16	  54076	   d33c	drivers/soc/mediatek/mtk-pmic-wrap.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  52664	   1384	     16	  54064	   d330	drivers/soc/mediatek/mtk-pmic-wrap.o
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/f1fea00fbaa0fea298bf67732e019f9cc5c407ab.1720331018.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
parent ded525f8
...@@ -483,7 +483,7 @@ enum pwrap_regs { ...@@ -483,7 +483,7 @@ enum pwrap_regs {
PWRAP_MSB_FIRST, PWRAP_MSB_FIRST,
}; };
static int mt2701_regs[] = { static const int mt2701_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -569,7 +569,7 @@ static int mt2701_regs[] = { ...@@ -569,7 +569,7 @@ static int mt2701_regs[] = {
[PWRAP_ADC_RDATA_ADDR2] = 0x154, [PWRAP_ADC_RDATA_ADDR2] = 0x154,
}; };
static int mt6765_regs[] = { static const int mt6765_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -601,7 +601,7 @@ static int mt6765_regs[] = { ...@@ -601,7 +601,7 @@ static int mt6765_regs[] = {
[PWRAP_DCM_DBC_PRD] = 0x1E0, [PWRAP_DCM_DBC_PRD] = 0x1E0,
}; };
static int mt6779_regs[] = { static const int mt6779_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -640,7 +640,7 @@ static int mt6779_regs[] = { ...@@ -640,7 +640,7 @@ static int mt6779_regs[] = {
[PWRAP_WACS2_VLDCLR] = 0xC28, [PWRAP_WACS2_VLDCLR] = 0xC28,
}; };
static int mt6795_regs[] = { static const int mt6795_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -725,7 +725,7 @@ static int mt6795_regs[] = { ...@@ -725,7 +725,7 @@ static int mt6795_regs[] = {
[PWRAP_EXT_CK] = 0x14c, [PWRAP_EXT_CK] = 0x14c,
}; };
static int mt6797_regs[] = { static const int mt6797_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -758,7 +758,7 @@ static int mt6797_regs[] = { ...@@ -758,7 +758,7 @@ static int mt6797_regs[] = {
[PWRAP_DCM_DBC_PRD] = 0x1D4, [PWRAP_DCM_DBC_PRD] = 0x1D4,
}; };
static int mt6873_regs[] = { static const int mt6873_regs[] = {
[PWRAP_INIT_DONE2] = 0x0, [PWRAP_INIT_DONE2] = 0x0,
[PWRAP_TIMER_EN] = 0x3E0, [PWRAP_TIMER_EN] = 0x3E0,
[PWRAP_INT_EN] = 0x448, [PWRAP_INT_EN] = 0x448,
...@@ -769,7 +769,7 @@ static int mt6873_regs[] = { ...@@ -769,7 +769,7 @@ static int mt6873_regs[] = {
[PWRAP_WACS2_RDATA] = 0xCA8, [PWRAP_WACS2_RDATA] = 0xCA8,
}; };
static int mt7622_regs[] = { static const int mt7622_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -881,7 +881,7 @@ static int mt7622_regs[] = { ...@@ -881,7 +881,7 @@ static int mt7622_regs[] = {
[PWRAP_SPI2_CTRL] = 0x244, [PWRAP_SPI2_CTRL] = 0x244,
}; };
static int mt8135_regs[] = { static const int mt8135_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -954,7 +954,7 @@ static int mt8135_regs[] = { ...@@ -954,7 +954,7 @@ static int mt8135_regs[] = {
[PWRAP_DCM_DBC_PRD] = 0x160, [PWRAP_DCM_DBC_PRD] = 0x160,
}; };
static int mt8173_regs[] = { static const int mt8173_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -1036,7 +1036,7 @@ static int mt8173_regs[] = { ...@@ -1036,7 +1036,7 @@ static int mt8173_regs[] = {
[PWRAP_DCM_DBC_PRD] = 0x148, [PWRAP_DCM_DBC_PRD] = 0x148,
}; };
static int mt8183_regs[] = { static const int mt8183_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -1087,7 +1087,7 @@ static int mt8183_regs[] = { ...@@ -1087,7 +1087,7 @@ static int mt8183_regs[] = {
[PWRAP_WACS2_VLDCLR] = 0xC28, [PWRAP_WACS2_VLDCLR] = 0xC28,
}; };
static int mt8195_regs[] = { static const int mt8195_regs[] = {
[PWRAP_INIT_DONE2] = 0x0, [PWRAP_INIT_DONE2] = 0x0,
[PWRAP_STAUPD_CTRL] = 0x4C, [PWRAP_STAUPD_CTRL] = 0x4C,
[PWRAP_TIMER_EN] = 0x3E4, [PWRAP_TIMER_EN] = 0x3E4,
...@@ -1104,7 +1104,7 @@ static int mt8195_regs[] = { ...@@ -1104,7 +1104,7 @@ static int mt8195_regs[] = {
[PWRAP_WACS2_RDATA] = 0x8A8, [PWRAP_WACS2_RDATA] = 0x8A8,
}; };
static int mt8365_regs[] = { static const int mt8365_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -1166,7 +1166,7 @@ static int mt8365_regs[] = { ...@@ -1166,7 +1166,7 @@ static int mt8365_regs[] = {
[PWRAP_WDT_SRC_EN_1] = 0xf8, [PWRAP_WDT_SRC_EN_1] = 0xf8,
}; };
static int mt8516_regs[] = { static const int mt8516_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -1251,7 +1251,7 @@ static int mt8516_regs[] = { ...@@ -1251,7 +1251,7 @@ static int mt8516_regs[] = {
[PWRAP_MSB_FIRST] = 0x170, [PWRAP_MSB_FIRST] = 0x170,
}; };
static int mt8186_regs[] = { static const int mt8186_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
[PWRAP_DIO_EN] = 0x8, [PWRAP_DIO_EN] = 0x8,
...@@ -1377,7 +1377,7 @@ struct pmic_wrapper { ...@@ -1377,7 +1377,7 @@ struct pmic_wrapper {
}; };
struct pmic_wrapper_type { struct pmic_wrapper_type {
int *regs; const int *regs;
enum pwrap_type type; enum pwrap_type type;
u32 arb_en_all; u32 arb_en_all;
u32 int_en_all; u32 int_en_all;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment