]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
pmdomain: amlogic: Constify struct meson_secure_pwrc_domain_desc
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 1 Jul 2024 19:53:16 +0000 (21:53 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 9 Jul 2024 11:10:39 +0000 (13:10 +0200)
'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 <christophe.jaillet@wanadoo.fr>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/871d6b708de8bb42e1fabd8a601dc9a9a217cf00.1719863475.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/amlogic/meson-secure-pwrc.c

index f6729eea6b8cfa03776fdbde22da0e1f05b5e76f..42ce41a2fe3a0c59a6f2b066b47118b3067e4c4d 100644 (file)
@@ -47,7 +47,7 @@ struct meson_secure_pwrc_domain_desc {
 
 struct meson_secure_pwrc_domain_data {
        unsigned int count;
-       struct meson_secure_pwrc_domain_desc *domains;
+       const struct meson_secure_pwrc_domain_desc *domains;
 };
 
 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)
        .parent = __parent,                     \
 }
 
-static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
+static const struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
        SEC_PD(DSPA,    0),
        SEC_PD(DSPB,    0),
        /* 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[] = {
        SEC_PD(RSA,     0),
 };
 
-static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
+static const struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
        SEC_PD(A4_AUDIO,        0),
        SEC_PD(A4_SDIOA,        0),
        SEC_PD(A4_EMMC, 0),
@@ -156,7 +156,7 @@ static struct meson_secure_pwrc_domain_desc a4_pwrc_domains[] = {
        SEC_PD(A4_AO_IR,        GENPD_FLAG_ALWAYS_ON),
 };
 
-static struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
+static const struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
        SEC_PD(A5_NNA,          0),
        SEC_PD(A5_AUDIO,        0),
        SEC_PD(A5_SDIOA,        0),
@@ -172,7 +172,7 @@ static struct meson_secure_pwrc_domain_desc a5_pwrc_domains[] = {
        SEC_PD(A5_DSPA,         0),
 };
 
-static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
+static const struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
        SEC_PD(C3_NNA,          0),
        SEC_PD(C3_AUDIO,        0),
        SEC_PD(C3_SDIOA,        0),
@@ -189,7 +189,7 @@ static struct meson_secure_pwrc_domain_desc c3_pwrc_domains[] = {
        SEC_PD(C3_VCODEC,       0),
 };
 
-static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
+static const struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
        SEC_PD(S4_DOS_HEVC,     0),
        SEC_PD(S4_DOS_VDEC,     0),
        SEC_PD(S4_VPU_HDMI,     0),
@@ -201,7 +201,7 @@ static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
        SEC_PD(S4_AUDIO,        0),
 };
 
-static struct meson_secure_pwrc_domain_desc t7_pwrc_domains[] = {
+static const struct meson_secure_pwrc_domain_desc t7_pwrc_domains[] = {
        SEC_PD(T7_DSPA,         0),
        SEC_PD(T7_DSPB,         0),
        TOP_PD(T7_DOS_HCODEC,   0, PWRC_T7_NIC3_ID),