Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1528075

Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform

From Dongdong Liu <liudongdong3@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform
Date 2016-11-23 02:50 +0100
Message-ID <sGuRc-6EV-3@gated-at.bofh.it> (permalink)
References <sGhU2-6Ds-3@gated-at.bofh.it> <sGhU2-6Ds-11@gated-at.bofh.it> <sGiwG-79h-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Tomasz

在 2016/11/22 20:32, Tomasz Nowicki 写道:
> 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 <liudongdong3@huawei.com>
>> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
>> ---
>>  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.

  acpi_dev_free_resource_list
	--->resource_list_free
		--->resource_list_destroy_entry
			--->resource_list_free_entry
				--->kfree(entry)
only free entry not free entry->res, so this is ok.

Thanks
Dongdong
>
>> +    return res;
>> +}
>
>
> We either allocate memory for res here or get it from the caller.
>
> Tomasz
>
> .
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform Dongdong Liu <liudongdong3@huawei.com> - 2016-11-22 13:00 +0100
  Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for  ARM64 platform Tomasz Nowicki <tn@semihalf.com> - 2016-11-22 13:40 +0100
    Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for  ARM64 platform Dongdong Liu <liudongdong3@huawei.com> - 2016-11-23 02:50 +0100
      Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for  ARM64 platform Dongdong Liu <liudongdong3@huawei.com> - 2016-11-23 03:30 +0100
  Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for  ARM64 platform Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-11-22 17:00 +0100
    RE: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for  ARM64 platform Gabriele Paoloni <gabriele.paoloni@huawei.com> - 2016-11-22 17:20 +0100
      Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for  ARM64 platform Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-11-22 18:20 +0100

csiph-web