Skip to content

Commit

Permalink
mfd: wm8xxx-core: 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>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.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 0aefed0 commit f977284
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
52 changes: 26 additions & 26 deletions drivers/mfd/wm831x-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
}
EXPORT_SYMBOL_GPL(wm831x_set_bits);

static struct resource wm831x_dcdc1_resources[] = {
static const struct resource wm831x_dcdc1_resources[] = {
{
.start = WM831X_DC1_CONTROL_1,
.end = WM831X_DC1_DVS_CONTROL,
Expand All @@ -637,7 +637,7 @@ static struct resource wm831x_dcdc1_resources[] = {
};


static struct resource wm831x_dcdc2_resources[] = {
static const struct resource wm831x_dcdc2_resources[] = {
{
.start = WM831X_DC2_CONTROL_1,
.end = WM831X_DC2_DVS_CONTROL,
Expand All @@ -657,7 +657,7 @@ static struct resource wm831x_dcdc2_resources[] = {
},
};

static struct resource wm831x_dcdc3_resources[] = {
static const struct resource wm831x_dcdc3_resources[] = {
{
.start = WM831X_DC3_CONTROL_1,
.end = WM831X_DC3_SLEEP_CONTROL,
Expand All @@ -671,7 +671,7 @@ static struct resource wm831x_dcdc3_resources[] = {
},
};

static struct resource wm831x_dcdc4_resources[] = {
static const struct resource wm831x_dcdc4_resources[] = {
{
.start = WM831X_DC4_CONTROL,
.end = WM831X_DC4_SLEEP_CONTROL,
Expand All @@ -685,7 +685,7 @@ static struct resource wm831x_dcdc4_resources[] = {
},
};

static struct resource wm8320_dcdc4_buck_resources[] = {
static const struct resource wm8320_dcdc4_buck_resources[] = {
{
.start = WM831X_DC4_CONTROL,
.end = WM832X_DC4_SLEEP_CONTROL,
Expand All @@ -699,15 +699,15 @@ static struct resource wm8320_dcdc4_buck_resources[] = {
},
};

static struct resource wm831x_gpio_resources[] = {
static const struct resource wm831x_gpio_resources[] = {
{
.start = WM831X_IRQ_GPIO_1,
.end = WM831X_IRQ_GPIO_16,
.flags = IORESOURCE_IRQ,
},
};

static struct resource wm831x_isink1_resources[] = {
static const struct resource wm831x_isink1_resources[] = {
{
.start = WM831X_CURRENT_SINK_1,
.end = WM831X_CURRENT_SINK_1,
Expand All @@ -720,7 +720,7 @@ static struct resource wm831x_isink1_resources[] = {
},
};

static struct resource wm831x_isink2_resources[] = {
static const struct resource wm831x_isink2_resources[] = {
{
.start = WM831X_CURRENT_SINK_2,
.end = WM831X_CURRENT_SINK_2,
Expand All @@ -733,7 +733,7 @@ static struct resource wm831x_isink2_resources[] = {
},
};

static struct resource wm831x_ldo1_resources[] = {
static const struct resource wm831x_ldo1_resources[] = {
{
.start = WM831X_LDO1_CONTROL,
.end = WM831X_LDO1_SLEEP_CONTROL,
Expand All @@ -747,7 +747,7 @@ static struct resource wm831x_ldo1_resources[] = {
},
};

static struct resource wm831x_ldo2_resources[] = {
static const struct resource wm831x_ldo2_resources[] = {
{
.start = WM831X_LDO2_CONTROL,
.end = WM831X_LDO2_SLEEP_CONTROL,
Expand All @@ -761,7 +761,7 @@ static struct resource wm831x_ldo2_resources[] = {
},
};

static struct resource wm831x_ldo3_resources[] = {
static const struct resource wm831x_ldo3_resources[] = {
{
.start = WM831X_LDO3_CONTROL,
.end = WM831X_LDO3_SLEEP_CONTROL,
Expand All @@ -775,7 +775,7 @@ static struct resource wm831x_ldo3_resources[] = {
},
};

static struct resource wm831x_ldo4_resources[] = {
static const struct resource wm831x_ldo4_resources[] = {
{
.start = WM831X_LDO4_CONTROL,
.end = WM831X_LDO4_SLEEP_CONTROL,
Expand All @@ -789,7 +789,7 @@ static struct resource wm831x_ldo4_resources[] = {
},
};

static struct resource wm831x_ldo5_resources[] = {
static const struct resource wm831x_ldo5_resources[] = {
{
.start = WM831X_LDO5_CONTROL,
.end = WM831X_LDO5_SLEEP_CONTROL,
Expand All @@ -803,7 +803,7 @@ static struct resource wm831x_ldo5_resources[] = {
},
};

static struct resource wm831x_ldo6_resources[] = {
static const struct resource wm831x_ldo6_resources[] = {
{
.start = WM831X_LDO6_CONTROL,
.end = WM831X_LDO6_SLEEP_CONTROL,
Expand All @@ -817,7 +817,7 @@ static struct resource wm831x_ldo6_resources[] = {
},
};

static struct resource wm831x_ldo7_resources[] = {
static const struct resource wm831x_ldo7_resources[] = {
{
.start = WM831X_LDO7_CONTROL,
.end = WM831X_LDO7_SLEEP_CONTROL,
Expand All @@ -831,7 +831,7 @@ static struct resource wm831x_ldo7_resources[] = {
},
};

static struct resource wm831x_ldo8_resources[] = {
static const struct resource wm831x_ldo8_resources[] = {
{
.start = WM831X_LDO8_CONTROL,
.end = WM831X_LDO8_SLEEP_CONTROL,
Expand All @@ -845,7 +845,7 @@ static struct resource wm831x_ldo8_resources[] = {
},
};

static struct resource wm831x_ldo9_resources[] = {
static const struct resource wm831x_ldo9_resources[] = {
{
.start = WM831X_LDO9_CONTROL,
.end = WM831X_LDO9_SLEEP_CONTROL,
Expand All @@ -859,7 +859,7 @@ static struct resource wm831x_ldo9_resources[] = {
},
};

static struct resource wm831x_ldo10_resources[] = {
static const struct resource wm831x_ldo10_resources[] = {
{
.start = WM831X_LDO10_CONTROL,
.end = WM831X_LDO10_SLEEP_CONTROL,
Expand All @@ -873,15 +873,15 @@ static struct resource wm831x_ldo10_resources[] = {
},
};

static struct resource wm831x_ldo11_resources[] = {
static const struct resource wm831x_ldo11_resources[] = {
{
.start = WM831X_LDO11_ON_CONTROL,
.end = WM831X_LDO11_SLEEP_CONTROL,
.flags = IORESOURCE_REG,
},
};

static struct resource wm831x_on_resources[] = {
static const struct resource wm831x_on_resources[] = {
{
.start = WM831X_IRQ_ON,
.end = WM831X_IRQ_ON,
Expand All @@ -890,7 +890,7 @@ static struct resource wm831x_on_resources[] = {
};


static struct resource wm831x_power_resources[] = {
static const struct resource wm831x_power_resources[] = {
{
.name = "SYSLO",
.start = WM831X_IRQ_PPM_SYSLO,
Expand Down Expand Up @@ -959,7 +959,7 @@ static struct resource wm831x_power_resources[] = {
},
};

static struct resource wm831x_rtc_resources[] = {
static const struct resource wm831x_rtc_resources[] = {
{
.name = "PER",
.start = WM831X_IRQ_RTC_PER,
Expand All @@ -974,23 +974,23 @@ static struct resource wm831x_rtc_resources[] = {
},
};

static struct resource wm831x_status1_resources[] = {
static const struct resource wm831x_status1_resources[] = {
{
.start = WM831X_STATUS_LED_1,
.end = WM831X_STATUS_LED_1,
.flags = IORESOURCE_REG,
},
};

static struct resource wm831x_status2_resources[] = {
static const struct resource wm831x_status2_resources[] = {
{
.start = WM831X_STATUS_LED_2,
.end = WM831X_STATUS_LED_2,
.flags = IORESOURCE_REG,
},
};

static struct resource wm831x_touch_resources[] = {
static const struct resource wm831x_touch_resources[] = {
{
.name = "TCHPD",
.start = WM831X_IRQ_TCHPD,
Expand All @@ -1005,7 +1005,7 @@ static struct resource wm831x_touch_resources[] = {
},
};

static struct resource wm831x_wdt_resources[] = {
static const struct resource wm831x_wdt_resources[] = {
{
.start = WM831X_IRQ_WDOG_TO,
.end = WM831X_IRQ_WDOG_TO,
Expand Down
4 changes: 2 additions & 2 deletions drivers/mfd/wm8994-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ static const struct mfd_cell wm8994_regulator_devs[] = {
},
};

static struct resource wm8994_codec_resources[] = {
static const struct resource wm8994_codec_resources[] = {
{
.start = WM8994_IRQ_TEMP_SHUT,
.end = WM8994_IRQ_TEMP_WARN,
.flags = IORESOURCE_IRQ,
},
};

static struct resource wm8994_gpio_resources[] = {
static const struct resource wm8994_gpio_resources[] = {
{
.start = WM8994_IRQ_GPIO(1),
.end = WM8994_IRQ_GPIO(11),
Expand Down

0 comments on commit f977284

Please sign in to comment.