Skip to content

Commit 3324a81

Browse files
tititiou36storulf
authored andcommitted
pmdomain: amlogic: Constify struct meson_secure_pwrc_domain_desc
'struct meson_secure_pwrc_domain_desc' is 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, as an example: Before: ====== text data bss dec hex filename 4909 4072 0 8981 2315 drivers/pmdomain/amlogic/meson-secure-pwrc.o After: ===== text data bss dec hex filename 8605 392 0 8997 2325 drivers/pmdomain/amlogic/meson-secure-pwrc.o Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/871d6b708de8bb42e1fabd8a601dc9a9a217cf00.1719863475.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson <[email protected]>
1 parent ec9a652 commit 3324a81

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/pmdomain/amlogic/meson-secure-pwrc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct meson_secure_pwrc_domain_desc {
4747

4848
struct meson_secure_pwrc_domain_data {
4949
unsigned int count;
50-
struct meson_secure_pwrc_domain_desc *domains;
50+
const struct meson_secure_pwrc_domain_desc *domains;
5151
};
5252

5353
static bool pwrc_secure_is_off(struct meson_secure_pwrc_domain *pwrc_domain)
@@ -111,7 +111,7 @@ static int meson_secure_pwrc_on(struct generic_pm_domain *domain)
111111
.parent = __parent, \
112112
}
113113

114-
static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
114+
static const struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
115115
SEC_PD(DSPA, 0),
116116
SEC_PD(DSPB, 0),
117117
/* UART should keep working in ATF after suspend and before resume */
@@ -138,7 +138,7 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
138138
SEC_PD(RSA, 0),
139139
};
140140

141-
static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
141+
static const struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
142142
SEC_PD(A4_AUDIO, 0),
143143
SEC_PD(A4_SDIOA, 0),
144144
SEC_PD(A4_EMMC, 0),
@@ -156,7 +156,7 @@ static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
156156
SEC_PD(A4_AO_IR, GENPD_FLAG_ALWAYS_ON),
157157
};
158158

159-
static struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
159+
static const struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
160160
SEC_PD(A5_NNA, 0),
161161
SEC_PD(A5_AUDIO, 0),
162162
SEC_PD(A5_SDIOA, 0),
@@ -172,7 +172,7 @@ static struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
172172
SEC_PD(A5_DSPA, 0),
173173
};
174174

175-
static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
175+
static const struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
176176
SEC_PD(C3_NNA, 0),
177177
SEC_PD(C3_AUDIO, 0),
178178
SEC_PD(C3_SDIOA, 0),
@@ -189,7 +189,7 @@ static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
189189
SEC_PD(C3_VCODEC, 0),
190190
};
191191

192-
static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
192+
static const struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
193193
SEC_PD(S4_DOS_HEVC, 0),
194194
SEC_PD(S4_DOS_VDEC, 0),
195195
SEC_PD(S4_VPU_HDMI, 0),
@@ -201,7 +201,7 @@ static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
201201
SEC_PD(S4_AUDIO, 0),
202202
};
203203

204-
static struct meson_secure_pwrc_domain_desc t7_pwrc_domains[] = {
204+
static const struct meson_secure_pwrc_domain_desc t7_pwrc_domains[] = {
205205
SEC_PD(T7_DSPA, 0),
206206
SEC_PD(T7_DSPB, 0),
207207
TOP_PD(T7_DOS_HCODEC, 0, PWRC_T7_NIC3_ID),

0 commit comments

Comments
 (0)