Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1240782 > unrolled thread
| Started by | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| First post | 2015-10-06 19:40 +0200 |
| Last post | 2015-10-12 22:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 14/16] acpi/gsi: Cleanup acpi_register_gsi Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:40 +0200
Re: [PATCH 14/16] acpi/gsi: Cleanup acpi_register_gsi "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-12 22:10 +0200
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Date | 2015-10-06 19:40 +0200 |
| Subject | [PATCH 14/16] acpi/gsi: Cleanup acpi_register_gsi |
| Message-ID | <qgEnv-4wt-7@gated-at.bofh.it> |
As the only user of drivers/acpi/gsi.c is now using acpi_set_irq_model
to set acpi_gsi_descriptor_populate 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>
---
drivers/acpi/gsi.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c
index 202a8fe..fa4585a 100644
--- a/drivers/acpi/gsi.c
+++ b/drivers/acpi/gsi.c
@@ -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);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2015-10-12 22:10 +0200 |
| Message-ID | <qiRzY-11h-3@gated-at.bofh.it> |
| In reply to | #1240782 |
On Tuesday, October 06, 2015 06:36:27 PM Marc Zyngier wrote:
> As the only user of drivers/acpi/gsi.c is now using acpi_set_irq_model
> to set acpi_gsi_descriptor_populate 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>
> ---
> drivers/acpi/gsi.c | 30 ++++++++++--------------------
> 1 file changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c
> index 202a8fe..fa4585a 100644
> --- a/drivers/acpi/gsi.c
> +++ b/drivers/acpi/gsi.c
> @@ -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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web