lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Sep 2020 12:56:59 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Rikard Falkeborn <rikard.falkeborn@...il.com>
Cc:     Lee Jones <lee.jones@...aro.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH 2/8] mfd: intel: Constify static struct resource

On Tue, Sep 22, 2020 at 10:32 PM Rikard Falkeborn
<rikard.falkeborn@...il.com> wrote:
>
> 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.

Okay, I have briefly checked the code and the patch seems correct (we
don't use those structures to update data in them). FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@...il.com>
> ---
>  drivers/mfd/intel_msic.c              | 18 +++++++++---------
>  drivers/mfd/intel_soc_pmic_bxtwc.c    | 14 +++++++-------
>  drivers/mfd/intel_soc_pmic_chtdc_ti.c | 10 +++++-----
>  drivers/mfd/intel_soc_pmic_chtwc.c    |  4 ++--
>  drivers/mfd/intel_soc_pmic_crc.c      | 10 +++++-----
>  5 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/mfd/intel_msic.c b/drivers/mfd/intel_msic.c
> index bb24c2a07900..daa772f8146b 100644
> --- a/drivers/mfd/intel_msic.c
> +++ b/drivers/mfd/intel_msic.c
> @@ -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
> @@ -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),
>  };
>
> diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
> index eba89780dbe7..47d0d3a69a58 100644
> --- a/drivers/mfd/intel_soc_pmic_bxtwc.c
> +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
> @@ -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"),
>  };
>
> diff --git a/drivers/mfd/intel_soc_pmic_chtdc_ti.c b/drivers/mfd/intel_soc_pmic_chtdc_ti.c
> index 64b5c3cc30e7..1c7577b881ff 100644
> --- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c
> +++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c
> @@ -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),
>  };
> diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c b/drivers/mfd/intel_soc_pmic_chtwc.c
> index be84bb2aa837..49c5f71664bc 100644
> --- a/drivers/mfd/intel_soc_pmic_chtwc.c
> +++ b/drivers/mfd/intel_soc_pmic_chtwc.c
> @@ -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),
>  };
>
> diff --git a/drivers/mfd/intel_soc_pmic_crc.c b/drivers/mfd/intel_soc_pmic_crc.c
> index 429efa1f8e55..38acb20e2d60 100644
> --- a/drivers/mfd/intel_soc_pmic_crc.c
> +++ b/drivers/mfd/intel_soc_pmic_crc.c
> @@ -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"),
>  };
>
> --
> 2.28.0
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ