[PATCH 1/8] mfd: mt6358: refine interrupt code

Lee Jones lee.jones at linaro.org
Mon Jul 27 11:48:40 EDT 2020


On Thu, 23 Jul 2020, Hsin-Hsiung Wang wrote:

> This patch refines the interrupt related code to support new chips.

Refines in what way?

What makes this better?

> Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang at mediatek.com>
> ---
>  drivers/mfd/mt6358-irq.c        | 65 ++++++++++++++++++++++++-----------------
>  include/linux/mfd/mt6358/core.h |  8 ++---
>  2 files changed, 41 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/mfd/mt6358-irq.c b/drivers/mfd/mt6358-irq.c
> index db734f2..4b094e5 100644
> --- a/drivers/mfd/mt6358-irq.c
> +++ b/drivers/mfd/mt6358-irq.c
> @@ -13,7 +13,9 @@
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  
> -static struct irq_top_t mt6358_ints[] = {
> +#define MTK_PMIC_REG_WIDTH 16
> +
> +static const struct irq_top_t mt6358_ints[] = {
>  	MT6358_TOP_GEN(BUCK),
>  	MT6358_TOP_GEN(LDO),
>  	MT6358_TOP_GEN(PSC),
> @@ -24,6 +26,13 @@ static struct irq_top_t mt6358_ints[] = {
>  	MT6358_TOP_GEN(MISC),
>  };
>  
> +static struct pmic_irq_data mt6358_irqd = {
> +	.num_top = ARRAY_SIZE(mt6358_ints),
> +	.num_pmic_irqs = MT6358_IRQ_NR,
> +	.top_int_status_reg = MT6358_TOP_INT_STATUS0,
> +	.pmic_ints = mt6358_ints,
> +};

Dynamically assigned driver data is usually preferred.

Why have you gone static?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog



More information about the Linux-mediatek mailing list