diff mbox

[Xen-devel,v2,17/41] arm : refactor gic into generic and dt specific parts

Message ID 1431893048-5214-18-git-send-email-parth.dixit@linaro.org
State New
Headers show

Commit Message

Parth Dixit May 17, 2015, 8:03 p.m. UTC
refactor gic related functions into dt and generic parts
this will be helpful when adding acpi support for gic

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
---
 xen/arch/arm/gic-v2.c | 13 ++++++++++---
 xen/arch/arm/gic.c    |  7 ++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

Comments

Julien Grall May 21, 2015, 11:06 a.m. UTC | #1
Hi Parth,

On 17/05/15 21:03, Parth Dixit wrote:
> refactor gic related functions into dt and generic parts
> this will be helpful when adding acpi support for gic

Please explain why you don't refactor neither gic-hip04 and gic-v3.

> Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
> ---
>  xen/arch/arm/gic-v2.c | 13 ++++++++++---
>  xen/arch/arm/gic.c    |  7 ++++++-
>  2 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
> index 80acc62..7276951 100644
> --- a/xen/arch/arm/gic-v2.c
> +++ b/xen/arch/arm/gic-v2.c
> @@ -663,7 +663,7 @@ static hw_irq_controller gicv2_guest_irq_type = {
>      .set_affinity = gicv2_irq_set_affinity,
>  };
>  
> -static int __init gicv2_init(void)
> +static int __init dt_gicv2_init(void)
>  {
>      int res;
>      const struct dt_device_node *node = gicv2_info.node;
> @@ -689,6 +689,13 @@ static int __init gicv2_init(void)
>          panic("GICv2: Cannot find the maintenance IRQ");
>      gicv2_info.maintenance_irq = res;
>  
> +    return 0;
> +}
> +
> +static int gicv2_init(void)

static init __init

> +{
> +     dt_gicv2_init();
> +
>      /* TODO: Add check on distributor, cpu size */
>  
>      printk("GICv2 initialization:\n"
> @@ -763,7 +770,7 @@ const static struct gic_hw_operations gicv2_ops = {
>  };
>  
>  /* Set up the GIC */
> -static int __init gicv2_preinit(struct dt_device_node *node, const void *data)
> +static int __init dt_gicv2_preinit(struct dt_device_node *node, const void *data)

This line is too long now.

>  {
>      gicv2_info.hw_version = GIC_V2;
>      gicv2_info.node = node;
> @@ -781,7 +788,7 @@ static const struct dt_device_match gicv2_dt_match[] __initconst =
>  
>  DT_DEVICE_START(gicv2, "GICv2", DEVICE_GIC)
>          .dt_match = gicv2_dt_match,
> -        .init = gicv2_preinit,
> +        .init = dt_gicv2_preinit,
>  DT_DEVICE_END
>  
>  /*
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index f023e4f..701c306 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -231,7 +231,7 @@ int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
>  /* Find the interrupt controller and set up the callback to translate
>   * device tree IRQ.
>   */
> -void __init gic_preinit(void)
> +void __init dt_gic_preinit(void)

This function is not exported, so it should be static.

>  {
>      int rc;
>      struct dt_device_node *node;
> @@ -261,6 +261,11 @@ void __init gic_preinit(void)
>      dt_device_set_used_by(node, DOMID_XEN);
>  }
>  
> +void __init gic_preinit(void)
> +{
> +    dt_gic_preinit();
> +}
> +
>  /* Set up the GIC */
>  void __init gic_init(void)
>  {
> 

Regards,
Parth Dixit July 5, 2015, 1:12 p.m. UTC | #2
+shannon

On 21 May 2015 at 17:52, Julien Grall <julien.grall@citrix.com> wrote:
> On 17/05/15 21:03, Parth Dixit wrote:
>> refactor gic related functions into dt and generic parts
>> this will be helpful when adding acpi support for gic
>>
>> Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
>> ---
>>  xen/arch/arm/gic-v2.c | 13 ++++++++++---
>>  xen/arch/arm/gic.c    |  7 ++++++-
>>  2 files changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
>> index 80acc62..7276951 100644
>> --- a/xen/arch/arm/gic-v2.c
>> +++ b/xen/arch/arm/gic-v2.c
>> @@ -663,7 +663,7 @@ static hw_irq_controller gicv2_guest_irq_type = {
>>      .set_affinity = gicv2_irq_set_affinity,
>>  };
>>
>> -static int __init gicv2_init(void)
>> +static int __init dt_gicv2_init(void)
>>  {
>>      int res;
>>      const struct dt_device_node *node = gicv2_info.node;
>> @@ -689,6 +689,13 @@ static int __init gicv2_init(void)
>>          panic("GICv2: Cannot find the maintenance IRQ");
>>      gicv2_info.maintenance_irq = res;
>>
>> +    return 0;
>> +}
>> +
>> +static int gicv2_init(void)
>> +{
>> +     dt_gicv2_init();
>> +
>
> I forgot it on the first review. dt_gicv2_init is returning an error
> code. You should not ignore it.
>
> If it's not useful (because everything paniced), then the function
> should return void.
>
> Regards,
>
> --
> Julien Grall
diff mbox

Patch

diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 80acc62..7276951 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -663,7 +663,7 @@  static hw_irq_controller gicv2_guest_irq_type = {
     .set_affinity = gicv2_irq_set_affinity,
 };
 
-static int __init gicv2_init(void)
+static int __init dt_gicv2_init(void)
 {
     int res;
     const struct dt_device_node *node = gicv2_info.node;
@@ -689,6 +689,13 @@  static int __init gicv2_init(void)
         panic("GICv2: Cannot find the maintenance IRQ");
     gicv2_info.maintenance_irq = res;
 
+    return 0;
+}
+
+static int gicv2_init(void)
+{
+     dt_gicv2_init();
+
     /* TODO: Add check on distributor, cpu size */
 
     printk("GICv2 initialization:\n"
@@ -763,7 +770,7 @@  const static struct gic_hw_operations gicv2_ops = {
 };
 
 /* Set up the GIC */
-static int __init gicv2_preinit(struct dt_device_node *node, const void *data)
+static int __init dt_gicv2_preinit(struct dt_device_node *node, const void *data)
 {
     gicv2_info.hw_version = GIC_V2;
     gicv2_info.node = node;
@@ -781,7 +788,7 @@  static const struct dt_device_match gicv2_dt_match[] __initconst =
 
 DT_DEVICE_START(gicv2, "GICv2", DEVICE_GIC)
         .dt_match = gicv2_dt_match,
-        .init = gicv2_preinit,
+        .init = dt_gicv2_preinit,
 DT_DEVICE_END
 
 /*
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index f023e4f..701c306 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -231,7 +231,7 @@  int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
 /* Find the interrupt controller and set up the callback to translate
  * device tree IRQ.
  */
-void __init gic_preinit(void)
+void __init dt_gic_preinit(void)
 {
     int rc;
     struct dt_device_node *node;
@@ -261,6 +261,11 @@  void __init gic_preinit(void)
     dt_device_set_used_by(node, DOMID_XEN);
 }
 
+void __init gic_preinit(void)
+{
+    dt_gic_preinit();
+}
+
 /* Set up the GIC */
 void __init gic_init(void)
 {