mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Zhao Qiang <qiang.zhao@nxp.com>, oss@buserror.net
Cc: jason@lakedaemon.net, xiaobo.xie@nxp.com,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [Patch V7 2/4] irqchip/qeic: merge qeic init code from platforms to a common function
Date: Thu, 5 Jan 2017 16:59:45 +0000	[thread overview]
Message-ID: <e8a862c2-3853-4188-8002-0f0790dfa7fa@arm.com> (raw)
In-Reply-To: <1482741166-33164-2-git-send-email-qiang.zhao@nxp.com>

On 26/12/16 08:32, Zhao Qiang wrote:
> The codes of qe_ic init from a variety of platforms are redundant,
> merge them to a common function and put it to irqchip/irq-qeic.c
> 
> For non-p1021_mds mpc85xx_mds boards, use "qe_ic_init(np, 0,
> qe_ic_cascade_low_mpic, qe_ic_cascade_high_mpic);" instead of
> "qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);".
> 
> qe_ic_cascade_muxed_mpic was used for boards has the same interrupt
> number for low interrupt and high interrupt, qe_ic_init has checked
> if "low interrupt == high interrupt"
> 
> Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
> ---
> Changes for v2:
> 	- modify subject and commit msg
> 	- add check for qeic by type
> Changes for v3:
> 	- na
> Changes for v4:
> 	- na
> Changes for v5:
> 	- na
> Changes for v6:
> 	- rebase
> Changes for v7:
> 	- na
> 
>  arch/powerpc/platforms/83xx/misc.c            | 15 ---------------
>  arch/powerpc/platforms/85xx/corenet_generic.c |  9 ---------
>  arch/powerpc/platforms/85xx/mpc85xx_mds.c     | 14 --------------
>  arch/powerpc/platforms/85xx/mpc85xx_rdb.c     | 16 ----------------
>  arch/powerpc/platforms/85xx/twr_p102x.c       | 14 --------------
>  drivers/irqchip/irq-qeic.c                    | 16 ++++++++++++++++
>  6 files changed, 16 insertions(+), 68 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c
> index d75c981..c09a135 100644
> --- a/arch/powerpc/platforms/83xx/misc.c
> +++ b/arch/powerpc/platforms/83xx/misc.c
> @@ -93,24 +93,9 @@ void __init mpc83xx_ipic_init_IRQ(void)
>  }
>  
>  #ifdef CONFIG_QUICC_ENGINE
> -void __init mpc83xx_qe_init_IRQ(void)
> -{
> -	struct device_node *np;
> -
> -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> -	if (!np) {
> -		np = of_find_node_by_type(NULL, "qeic");
> -		if (!np)
> -			return;
> -	}
> -	qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
> -	of_node_put(np);
> -}
> -
>  void __init mpc83xx_ipic_and_qe_init_IRQ(void)
>  {
>  	mpc83xx_ipic_init_IRQ();
> -	mpc83xx_qe_init_IRQ();
>  }
>  #endif /* CONFIG_QUICC_ENGINE */
>  
> diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
> index 1179115..1d96c3f 100644
> --- a/arch/powerpc/platforms/85xx/corenet_generic.c
> +++ b/arch/powerpc/platforms/85xx/corenet_generic.c
> @@ -41,8 +41,6 @@ void __init corenet_gen_pic_init(void)
>  	unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
>  		MPIC_NO_RESET;
>  
> -	struct device_node *np;
> -
>  	if (ppc_md.get_irq == mpic_get_coreint_irq)
>  		flags |= MPIC_ENABLE_COREINT;
>  
> @@ -50,13 +48,6 @@ void __init corenet_gen_pic_init(void)
>  	BUG_ON(mpic == NULL);
>  
>  	mpic_init(mpic);
> -
> -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> -	if (np) {
> -		qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> -				qe_ic_cascade_high_mpic);
> -		of_node_put(np);
> -	}
>  }
>  
>  /*
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> index d7e440e..06f34a9 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -283,20 +283,6 @@ static void __init mpc85xx_mds_qeic_init(void)
>  		of_node_put(np);
>  		return;
>  	}
> -
> -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> -	if (!np) {
> -		np = of_find_node_by_type(NULL, "qeic");
> -		if (!np)
> -			return;
> -	}
> -
> -	if (machine_is(p1021_mds))
> -		qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> -				qe_ic_cascade_high_mpic);
> -	else
> -		qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
> -	of_node_put(np);
>  }
>  #else
>  static void __init mpc85xx_mds_qe_init(void) { }
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
> index 1006950..000d385 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
> @@ -48,10 +48,6 @@ void __init mpc85xx_rdb_pic_init(void)
>  {
>  	struct mpic *mpic;
>  
> -#ifdef CONFIG_QUICC_ENGINE
> -	struct device_node *np;
> -#endif
> -
>  	if (of_machine_is_compatible("fsl,MPC85XXRDB-CAMP")) {
>  		mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET |
>  			MPIC_BIG_ENDIAN |
> @@ -66,18 +62,6 @@ void __init mpc85xx_rdb_pic_init(void)
>  
>  	BUG_ON(mpic == NULL);
>  	mpic_init(mpic);
> -
> -#ifdef CONFIG_QUICC_ENGINE
> -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> -	if (np) {
> -		qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> -				qe_ic_cascade_high_mpic);
> -		of_node_put(np);
> -
> -	} else
> -		pr_err("%s: Could not find qe-ic node\n", __func__);
> -#endif
> -
>  }
>  
>  /*
> diff --git a/arch/powerpc/platforms/85xx/twr_p102x.c b/arch/powerpc/platforms/85xx/twr_p102x.c
> index 360f625..6be9b33 100644
> --- a/arch/powerpc/platforms/85xx/twr_p102x.c
> +++ b/arch/powerpc/platforms/85xx/twr_p102x.c
> @@ -35,26 +35,12 @@ static void __init twr_p1025_pic_init(void)
>  {
>  	struct mpic *mpic;
>  
> -#ifdef CONFIG_QUICC_ENGINE
> -	struct device_node *np;
> -#endif
> -
>  	mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
>  			MPIC_SINGLE_DEST_CPU,
>  			0, 256, " OpenPIC  ");
>  
>  	BUG_ON(mpic == NULL);
>  	mpic_init(mpic);
> -
> -#ifdef CONFIG_QUICC_ENGINE
> -	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> -	if (np) {
> -		qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> -				qe_ic_cascade_high_mpic);
> -		of_node_put(np);
> -	} else
> -		pr_err("Could not find qe-ic node\n");
> -#endif
>  }
>  
>  /* ************************************************************************
> diff --git a/drivers/irqchip/irq-qeic.c b/drivers/irqchip/irq-qeic.c
> index 48ceded..1463731 100644
> --- a/drivers/irqchip/irq-qeic.c
> +++ b/drivers/irqchip/irq-qeic.c
> @@ -598,4 +598,20 @@ static int __init init_qe_ic_sysfs(void)
>  	return 0;
>  }
>  
> +static int __init qeic_of_init(void)
> +{
> +	struct device_node *np;
> +
> +	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> +	if (!np) {
> +		np = of_find_node_by_type(NULL, "qeic");
> +		if (!np)
> +			return;
> +	}
> +	qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> +		   qe_ic_cascade_high_mpic);
> +	of_node_put(np);
> +}
> +
> +subsys_initcall(qeic_of_init);

Why is it a subsys_initcall? Can't you use IRQCHIP_DECLARE(), like any
other interrupt controller that is DT driven? irq-xilinx-intc.c is used
on powerpc as well, and is using that infrastructure, so there must be a
way for you to use it too.

Also, please add a cover letter to your series and keep the changelog there.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2017-01-05 16:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26  8:32 [Patch V7 1/4] irqchip/qeic: move qeic driver from drivers/soc/fsl/qe Zhao Qiang
2016-12-26  8:32 ` [Patch V7 2/4] irqchip/qeic: merge qeic init code from platforms to a common function Zhao Qiang
2017-01-05 16:59   ` Marc Zyngier [this message]
2016-12-26  8:32 ` [Patch V7 3/4] irqchip/qeic: merge qeic_of_init into qe_ic_init Zhao Qiang
2016-12-26  8:32 ` [Patch V7 4/4] irqchip/qeic: remove PPCisms for QEIC Zhao Qiang
2017-01-05 17:04   ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8a862c2-3853-4188-8002-0f0790dfa7fa@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oss@buserror.net \
    --cc=qiang.zhao@nxp.com \
    --cc=xiaobo.xie@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®