Message ID | 20160112183228.GK30558@pd.tnic (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Tue, Jan 12, 2016 at 10:32 AM, Borislav Petkov <bp@alien8.de> wrote: > On Tue, Jan 12, 2016 at 10:26:04AM -0800, Tuan Phan wrote: >> So are you good with it? > > How about this instead: > > --- > diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c > index fa4585a6914e..e42f6b7eac13 100644 > --- a/drivers/acpi/gsi.c > +++ b/drivers/acpi/gsi.c > @@ -46,17 +46,22 @@ static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity) > * Returns: linux IRQ number on success (>0) > * -EINVAL on failure > */ > -int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) > +int acpi_gsi_to_irq(u32 gsi) > { > + unsigned int irq; > + > struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, > DOMAIN_BUS_ANY); > > - *irq = irq_find_mapping(d, gsi); > + irq = irq_find_mapping(d, gsi); > /* > * *irq == 0 means no mapping, that should > * be reported as a failure > */ > - return (*irq > 0) ? *irq : -EINVAL; > + if (irq > 0) > + return irq; > + else > + return -EINVAL; > } > EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); Well, it basically the same as old code except the change of API interface. And it requires some changes in ACPI core and X86/I64 arch code. Do we really want to go with this solution instead of just return 0 on success and -EINVAL on failure?
On Tue, Jan 12, 2016 at 10:46:15AM -0800, Tuan Phan wrote: > Well, it basically the same as old code except the change of API > interface. And it requires some changes in ACPI core and X86/I64 arch > code. That's why I said: "Patch 1 could be improved. It is Rafael's call in the end of the day."
diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c index fa4585a6914e..e42f6b7eac13 100644 --- a/drivers/acpi/gsi.c +++ b/drivers/acpi/gsi.c @@ -46,17 +46,22 @@ static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity) * Returns: linux IRQ number on success (>0) * -EINVAL on failure */ -int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) +int acpi_gsi_to_irq(u32 gsi) { + unsigned int irq; + struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, DOMAIN_BUS_ANY); - *irq = irq_find_mapping(d, gsi); + irq = irq_find_mapping(d, gsi); /* * *irq == 0 means no mapping, that should * be reported as a failure */ - return (*irq > 0) ? *irq : -EINVAL; + if (irq > 0) + return irq; + else + return -EINVAL; } EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
On Tue, Jan 12, 2016 at 10:26:04AM -0800, Tuan Phan wrote: > So are you good with it? How about this instead: ---