Re: [RFC PATCH v8 7/7] PCI / PM: Add support for the PCIe WAKE# signal for OF

From: Sinan Kaya
Date: Sat Oct 28 2017 - 14:10:09 EST


On 10/27/2017 8:04 PM, Brian Norris wrote:
>> I think you can make this code common by abstracting the IRQ number and
>> have some generic code like pci-wake.c in pci directory without the of prefix
>> in this file.
> Why would 'pci-wake' be a good name for this? We're doing basically the
> same things that pci-acpi.c is doing (it also can configure the WAKE#
> signal, via ACPI firmware calls).
>

I was looking for some code that can be used between OF and ACPI rather than
duplicating the code in two different places just to extract some information
from the platform firmware.

My initial look at your code suggested it to be very generic except the IRQ
read function.

I was expecting that the kernel's PCI Wake handling to be common whether the IRQ
information is coming from DT/ACPI.

There are different approaches to portability.

* One approach is to keep of specific stuff in OF directory.
* Another approach is keep some common code can call it from multiple platform firmware
or from the ARCH directory.
* Another approach is have one file but put OF and ACPI specific pieces at the bottom.

It depends on the code.

Bjorn should chime in here with his preference.

--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.