Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755606AbcKVMcS (ORCPT ); Tue, 22 Nov 2016 07:32:18 -0500 Received: from mail-qk0-f172.google.com ([209.85.220.172]:36542 "EHLO mail-qk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755009AbcKVMcP (ORCPT ); Tue, 22 Nov 2016 07:32:15 -0500 Subject: Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform To: Dongdong Liu , helgaas@kernel.org, arnd@arndb.de, rafael@kernel.org, Lorenzo.Pieralisi@arm.com, wangzhou1@hisilicon.com, pratyush.anand@gmail.com References: <1479816529-97410-1-git-send-email-liudongdong3@huawei.com> <1479816529-97410-2-git-send-email-liudongdong3@huawei.com> Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, jcm@redhat.com, gabriele.paoloni@huawei.com, charles.chenxin@huawei.com, hanjun.guo@linaro.org, linuxarm@huawei.com From: Tomasz Nowicki Message-ID: <56c1d551-a18d-8ee0-eb3c-b2b7d5341161@semihalf.com> Date: Tue, 22 Nov 2016 13:32:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1479816529-97410-2-git-send-email-liudongdong3@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1613 Lines: 57 Hi Dongdong, On 22.11.2016 13:08, Dongdong Liu wrote: > The acpi_get_rc_resources() is used to get the RC register address that can > not be described in MCFG. It takes the _HID&segment to look for and returns > the RC address resource. Use PNP0C02 devices to describe such RC address > resource. Use _UID to match segment to tell which root bus the PNP0C02 > resource belong to. > > Signed-off-by: Dongdong Liu > Signed-off-by: Tomasz Nowicki > --- > drivers/pci/pci-acpi.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ > drivers/pci/pci.h | 4 +++ > 2 files changed, 73 insertions(+) > > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c > index d966d47..76fd6f4 100644 > --- a/drivers/pci/pci-acpi.c > +++ b/drivers/pci/pci-acpi.c > @@ -29,6 +29,75 @@ > 0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d > }; > > +#ifdef CONFIG_ARM64 > +static struct resource *acpi_get_rc_addr(struct acpi_device *adev) > +{ > + struct resource_entry *entry; > + struct list_head list; > + unsigned long flags; > + int ret; > + struct resource *res; > + > + INIT_LIST_HEAD(&list); > + flags = IORESOURCE_MEM; > + ret = acpi_dev_get_resources(adev, &list, > + acpi_dev_filter_resource_type_cb, > + (void *) flags); > + if (ret <= 0) > + return NULL; > + > + entry = list_first_entry(&list, struct resource_entry, node); > + res = entry->res; You return "res" memory pointer and... > + acpi_dev_free_resource_list(&list); free it here. > + return res; > +} We either allocate memory for res here or get it from the caller. Tomasz