[PATCH v3 1/2] acpi: Fix proper return code for function acpi_gsi_to_irq

Tuan Phan tphan at apm.com
Tue Jan 12 10:46:15 PST 2016


On Tue, Jan 12, 2016 at 10:32 AM, Borislav Petkov <bp at 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?

-- 
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and contains information that 
is confidential and proprietary to Applied Micro Circuits Corporation or 
its subsidiaries. It is to be used solely for the purpose of furthering the 
parties' business relationship. All unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.



More information about the linux-arm-kernel mailing list