Re: [PATCH 2/8] PCI / PCIe/ AER: Introduce pci_aer_available()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(2010/08/03 6:54), Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@xxxxxxx>
> 
> Introduce a function allowing the caller to check if PCIe AER should
> be enabled.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
> ---
(snip)
> Index: linux-2.6/drivers/pci/pcie/aer/aerdrv.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/pcie/aer/aerdrv.c
> +++ linux-2.6/drivers/pci/pcie/aer/aerdrv.c
> @@ -72,6 +72,11 @@ void pci_no_aer(void)
>  	pcie_aer_disable = 1;	/* has priority over 'forceload' */
>  }
>  
> +bool pci_aer_available(void)
> +{
> +	return !pcie_aer_disable && pci_msi_enabled();
> +}
> +
>  static int set_device_error_reporting(struct pci_dev *dev, void *data)
>  {
>  	bool enable = *((bool *)data);
> @@ -411,9 +416,7 @@ static void aer_error_resume(struct pci_
>   */
>  static int __init aer_service_init(void)
>  {
> -	if (pcie_aer_disable)
> -		return -ENXIO;
> -	if (!pci_msi_enabled())
> +	if (pci_aer_available())
>  		return -ENXIO;
>  	return pcie_port_service_register(&aerdriver);
>  }

Breaking a big lump into small pieces often makes things clear.
You should return error when AER is _NOT_ available.

if (!pci_aer_available())
	return -ENXIO;

Be careful...

Thanks,
H.Seto

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux