Skip to content

Commit

Permalink
mfd: intel: Constify static struct resource
Browse files Browse the repository at this point in the history
Constify a number of static struct resource. The only usage of the
structs are to assign their address to the resources field in the
mfd_cell struct. This allows the compiler to put them in read-only
memory. Done with the help of Coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Rikard Falkeborn authored and Lee Jones committed Nov 19, 2020
1 parent a0fa0ab commit bf4cceb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
18 changes: 9 additions & 9 deletions drivers/mfd/intel_msic.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ struct intel_msic {
void __iomem *irq_base;
};

static struct resource msic_touch_resources[] = {
static const struct resource msic_touch_resources[] = {
DEFINE_RES_IRQ(0),
};

static struct resource msic_adc_resources[] = {
static const struct resource msic_adc_resources[] = {
DEFINE_RES_IRQ(0),
};

static struct resource msic_battery_resources[] = {
static const struct resource msic_battery_resources[] = {
DEFINE_RES_IRQ(0),
};

static struct resource msic_gpio_resources[] = {
static const struct resource msic_gpio_resources[] = {
DEFINE_RES_IRQ(0),
};

static struct resource msic_audio_resources[] = {
static const struct resource msic_audio_resources[] = {
DEFINE_RES_IRQ_NAMED(0, "IRQ"),
/*
* We will pass IRQ_BASE to the driver now but this can be removed
Expand All @@ -75,19 +75,19 @@ static struct resource msic_audio_resources[] = {
DEFINE_RES_MEM_NAMED(MSIC_IRQ_STATUS_ACCDET, 1, "IRQ_BASE"),
};

static struct resource msic_hdmi_resources[] = {
static const struct resource msic_hdmi_resources[] = {
DEFINE_RES_IRQ(0),
};

static struct resource msic_thermal_resources[] = {
static const struct resource msic_thermal_resources[] = {
DEFINE_RES_IRQ(0),
};

static struct resource msic_power_btn_resources[] = {
static const struct resource msic_power_btn_resources[] = {
DEFINE_RES_IRQ(0),
};

static struct resource msic_ocd_resources[] = {
static const struct resource msic_ocd_resources[] = {
DEFINE_RES_IRQ(0),
};

Expand Down
14 changes: 7 additions & 7 deletions drivers/mfd/intel_soc_pmic_bxtwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,32 +200,32 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip_crit = {
.num_regs = 1,
};

static struct resource gpio_resources[] = {
static const struct resource gpio_resources[] = {
DEFINE_RES_IRQ_NAMED(BXTWC_GPIO_LVL1_IRQ, "GPIO"),
};

static struct resource adc_resources[] = {
static const struct resource adc_resources[] = {
DEFINE_RES_IRQ_NAMED(BXTWC_ADC_IRQ, "ADC"),
};

static struct resource usbc_resources[] = {
static const struct resource usbc_resources[] = {
DEFINE_RES_IRQ(BXTWC_USBC_IRQ),
};

static struct resource charger_resources[] = {
static const struct resource charger_resources[] = {
DEFINE_RES_IRQ_NAMED(BXTWC_CHGR0_IRQ, "CHARGER"),
DEFINE_RES_IRQ_NAMED(BXTWC_CHGR1_IRQ, "CHARGER1"),
};

static struct resource thermal_resources[] = {
static const struct resource thermal_resources[] = {
DEFINE_RES_IRQ(BXTWC_THRM_LVL1_IRQ),
};

static struct resource bcu_resources[] = {
static const struct resource bcu_resources[] = {
DEFINE_RES_IRQ_NAMED(BXTWC_BCU_IRQ, "BCU"),
};

static struct resource tmu_resources[] = {
static const struct resource tmu_resources[] = {
DEFINE_RES_IRQ_NAMED(BXTWC_TMU_IRQ, "TMU"),
};

Expand Down
10 changes: 5 additions & 5 deletions drivers/mfd/intel_soc_pmic_chtdc_ti.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ enum {
CHTDC_TI_CCEOCAL = 7, /* battery */
};

static struct resource power_button_resources[] = {
static const struct resource power_button_resources[] = {
DEFINE_RES_IRQ(CHTDC_TI_PWRBTN),
};

static struct resource thermal_resources[] = {
static const struct resource thermal_resources[] = {
DEFINE_RES_IRQ(CHTDC_TI_DIETMPWARN),
};

static struct resource adc_resources[] = {
static const struct resource adc_resources[] = {
DEFINE_RES_IRQ(CHTDC_TI_ADCCMPL),
};

static struct resource pwrsrc_resources[] = {
static const struct resource pwrsrc_resources[] = {
DEFINE_RES_IRQ(CHTDC_TI_VBUSDET),
};

static struct resource battery_resources[] = {
static const struct resource battery_resources[] = {
DEFINE_RES_IRQ(CHTDC_TI_VBATLOW),
DEFINE_RES_IRQ(CHTDC_TI_CCEOCAL),
};
Expand Down
4 changes: 2 additions & 2 deletions drivers/mfd/intel_soc_pmic_chtwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ enum {
CHT_WC_CRIT_IRQ = 7,
};

static struct resource cht_wc_pwrsrc_resources[] = {
static const struct resource cht_wc_pwrsrc_resources[] = {
DEFINE_RES_IRQ(CHT_WC_PWRSRC_IRQ),
};

static struct resource cht_wc_ext_charger_resources[] = {
static const struct resource cht_wc_ext_charger_resources[] = {
DEFINE_RES_IRQ(CHT_WC_EXT_CHGR_IRQ),
};

Expand Down
10 changes: 5 additions & 5 deletions drivers/mfd/intel_soc_pmic_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@
#define CRYSTAL_COVE_IRQ_GPIO 5
#define CRYSTAL_COVE_IRQ_VHDMIOCP 6

static struct resource gpio_resources[] = {
static const struct resource gpio_resources[] = {
DEFINE_RES_IRQ_NAMED(CRYSTAL_COVE_IRQ_GPIO, "GPIO"),
};

static struct resource pwrsrc_resources[] = {
static const struct resource pwrsrc_resources[] = {
DEFINE_RES_IRQ_NAMED(CRYSTAL_COVE_IRQ_PWRSRC, "PWRSRC"),
};

static struct resource adc_resources[] = {
static const struct resource adc_resources[] = {
DEFINE_RES_IRQ_NAMED(CRYSTAL_COVE_IRQ_ADC, "ADC"),
};

static struct resource thermal_resources[] = {
static const struct resource thermal_resources[] = {
DEFINE_RES_IRQ_NAMED(CRYSTAL_COVE_IRQ_THRM, "THERMAL"),
};

static struct resource bcu_resources[] = {
static const struct resource bcu_resources[] = {
DEFINE_RES_IRQ_NAMED(CRYSTAL_COVE_IRQ_BCU, "BCU"),
};

Expand Down

0 comments on commit bf4cceb

Please sign in to comment.