acpi/gsi: Cleanup acpi_register_gsi
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 13 Oct 2015 11:51:42 +0000 (12:51 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 13 Oct 2015 17:01:25 +0000 (19:01 +0200)
As the only user of drivers/acpi/gsi.c is now using acpi_set_irq_model
to set acpi_gsi_domain_id to something meaningful, we can always rely
on that information to be present (its absence is an error), and
guarantee that new interrupt controllers will use this API.

Take this opportunity to cleanup acpi_register_gsi.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-and-tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>
Cc: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Graeme Gregory <graeme@xora.org.uk>
Cc: Jake Oshins <jakeo@microsoft.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Link: http://lkml.kernel.org/r/1444737105-31573-15-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/acpi/gsi.c

index 202a8fee77dcb67bdbcf04af1ae5049f40583c63..fa4585a6914e912a402ec339d4bd241dd0fadac1 100644 (file)
@@ -73,29 +73,19 @@ EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
 int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
                      int polarity)
 {
-       unsigned int irq;
-       unsigned int irq_type = acpi_gsi_get_irq_type(trigger, polarity);
+       struct irq_fwspec fwspec;
 
-       if (acpi_gsi_domain_id) {
-               struct irq_fwspec fwspec;
-
-               fwspec.fwnode = acpi_gsi_domain_id;
-               fwspec.param[0] = gsi;
-               fwspec.param[1] = irq_type;
-               fwspec.param_count = 2;
-
-               return irq_create_fwspec_mapping(&fwspec);
-       } else {
-               irq = irq_create_mapping(NULL, gsi);
-               if (!irq)
-                       return -EINVAL;
+       if (WARN_ON(!acpi_gsi_domain_id)) {
+               pr_warn("GSI: No registered irqchip, giving up\n");
+               return -EINVAL;
        }
 
-       /* Set irq type if specified and different than the current one */
-       if (irq_type != IRQ_TYPE_NONE &&
-               irq_type != irq_get_trigger_type(irq))
-               irq_set_irq_type(irq, irq_type);
-       return irq;
+       fwspec.fwnode = acpi_gsi_domain_id;
+       fwspec.param[0] = gsi;
+       fwspec.param[1] = acpi_gsi_get_irq_type(trigger, polarity);
+       fwspec.param_count = 2;
+
+       return irq_create_fwspec_mapping(&fwspec);
 }
 EXPORT_SYMBOL_GPL(acpi_register_gsi);