Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit cfff199

Browse files
tititiou36rafaeljw
authored andcommitted
ACPI: PMIC: Constify struct pmic_table
'struct pmic_table' is not modified in these drivers. Constifying this structure moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 3811 786 0 4597 11f5 drivers/acpi/pmic/intel_pmic_xpower.o text data bss dec hex filename 4147 450 0 4597 11f5 drivers/acpi/pmic/intel_pmic_xpower.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://patch.msgid.link/a6c9b1bcdf259adabbcaf91183d3f5ab87a98600.1719644292.git.christophe.jaillet@wanadoo.fr Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent f42cfd5 commit cfff199

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

drivers/acpi/pmic/intel_pmic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct intel_pmic_opregion {
3131

3232
static struct intel_pmic_opregion *intel_pmic_opregion;
3333

34-
static int pmic_get_reg_bit(int address, struct pmic_table *table,
34+
static int pmic_get_reg_bit(int address, const struct pmic_table *table,
3535
int count, int *reg, int *bit)
3636
{
3737
int i;

drivers/acpi/pmic/intel_pmic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ struct intel_pmic_opregion_data {
2121
u32 reg_address, u32 value, u32 mask);
2222
int (*lpat_raw_to_temp)(struct acpi_lpat_conversion_table *lpat_table,
2323
int raw);
24-
struct pmic_table *power_table;
24+
const struct pmic_table *power_table;
2525
int power_table_count;
26-
struct pmic_table *thermal_table;
26+
const struct pmic_table *thermal_table;
2727
int thermal_table_count;
2828
/* For generic exec_mipi_pmic_seq_element handling */
2929
int pmic_i2c_address;

drivers/acpi/pmic/intel_pmic_bxtwc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define VSWITCH1_OUTPUT BIT(4)
2525
#define VUSBPHY_CHARGE BIT(1)
2626

27-
static struct pmic_table power_table[] = {
27+
static const struct pmic_table power_table[] = {
2828
{
2929
.address = 0x0,
3030
.reg = 0x63,
@@ -177,7 +177,7 @@ static struct pmic_table power_table[] = {
177177
} /* MOFF -> MODEMCTRL Bit 0 */
178178
};
179179

180-
static struct pmic_table thermal_table[] = {
180+
static const struct pmic_table thermal_table[] = {
181181
{
182182
.address = 0x00,
183183
.reg = 0x4F39

drivers/acpi/pmic/intel_pmic_bytcrc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#define PMIC_A0LOCK_REG 0xc5
1818

19-
static struct pmic_table power_table[] = {
19+
static const struct pmic_table power_table[] = {
2020
/* {
2121
.address = 0x00,
2222
.reg = ??,
@@ -134,7 +134,7 @@ static struct pmic_table power_table[] = {
134134
}, /* V105 -> V1P05S, L2 SRAM */
135135
};
136136

137-
static struct pmic_table thermal_table[] = {
137+
static const struct pmic_table thermal_table[] = {
138138
{
139139
.address = 0x00,
140140
.reg = 0x75

drivers/acpi/pmic/intel_pmic_chtdc_ti.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define CHTDC_TI_BPTHERM 0x58
2424
#define CHTDC_TI_GPADC 0x5a
2525

26-
static struct pmic_table chtdc_ti_power_table[] = {
26+
static const struct pmic_table chtdc_ti_power_table[] = {
2727
{ .address = 0x00, .reg = 0x41 }, /* LDO1 */
2828
{ .address = 0x04, .reg = 0x42 }, /* LDO2 */
2929
{ .address = 0x08, .reg = 0x43 }, /* LDO3 */
@@ -39,7 +39,7 @@ static struct pmic_table chtdc_ti_power_table[] = {
3939
{ .address = 0x30, .reg = 0x4e }, /* LD14 */
4040
};
4141

42-
static struct pmic_table chtdc_ti_thermal_table[] = {
42+
static const struct pmic_table chtdc_ti_thermal_table[] = {
4343
{
4444
.address = 0x00,
4545
.reg = CHTDC_TI_GPADC

drivers/acpi/pmic/intel_pmic_chtwc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
* "regulator: whiskey_cove: implements Whiskey Cove pmic VRF support"
7171
* https://github.com/intel-aero/meta-intel-aero/blob/master/recipes-kernel/linux/linux-yocto/0019-regulator-whiskey_cove-implements-WhiskeyCove-pmic-V.patch
7272
*/
73-
static struct pmic_table power_table[] = {
73+
static const struct pmic_table power_table[] = {
7474
{
7575
.address = 0x0,
7676
.reg = CHT_WC_V1P8A_CTRL,

drivers/acpi/pmic/intel_pmic_xpower.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0)
2727
#define AXP288_ADC_TS_CURRENT_ON (3 << 0)
2828

29-
static struct pmic_table power_table[] = {
29+
static const struct pmic_table power_table[] = {
3030
{
3131
.address = 0x00,
3232
.reg = 0x13,
@@ -129,7 +129,7 @@ static struct pmic_table power_table[] = {
129129
};
130130

131131
/* TMP0 - TMP5 are the same, all from GPADC */
132-
static struct pmic_table thermal_table[] = {
132+
static const struct pmic_table thermal_table[] = {
133133
{
134134
.address = 0x00,
135135
.reg = XPOWER_GPADC_LOW

0 commit comments

Comments
 (0)