Re: [RFC Patch 15/19] ACPI: Add field offset to struct resource_list_entry

From: Jiang Liu
Date: Wed Jan 21 2015 - 00:37:50 EST


On 2015/1/21 8:53, Rafael J. Wysocki wrote:
> On Thursday, January 08, 2015 10:33:02 AM Jiang Liu wrote:
>> Add field offset to struct resource_list_entry to host address space
>> translation offset so it could be used to represent bridge resources.
>>
>> Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxxxxxxx>
>> ---
>> drivers/acpi/resource.c | 13 ++++++++-----
>> include/linux/acpi.h | 1 +
>> 2 files changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
>> index 16d334a1ee25..54204ac94f8e 100644
>> --- a/drivers/acpi/resource.c
>> +++ b/drivers/acpi/resource.c
>> @@ -462,7 +462,8 @@ struct res_proc_context {
>> };
>>
>> static acpi_status acpi_dev_new_resource_entry(struct resource *r,
>> - struct res_proc_context *c)
>> + struct res_proc_context *c,
>> + resource_size_t offset)
>> {
>> struct resource_list_entry *rentry;
>>
>> @@ -472,6 +473,7 @@ static acpi_status acpi_dev_new_resource_entry(struct resource *r,
>> return AE_NO_MEMORY;
>> }
>> rentry->res = *r;
>> + rentry->offset = offset;
>> list_add_tail(&rentry->node, c->list);
>> c->count++;
>> return AE_OK;
>> @@ -480,6 +482,7 @@ static acpi_status acpi_dev_new_resource_entry(struct resource *r,
>> static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
>> void *context)
>> {
>> + resource_size_t offset = 0;
>> struct res_proc_context *c = context;
>> struct resource r;
>> int i;
>> @@ -500,14 +503,14 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
>>
>> if (acpi_dev_resource_memory(ares, &r)
>> || acpi_dev_resource_io(ares, &r)
>> - || acpi_dev_resource_address_space(ares, &r, NULL)
>> - || acpi_dev_resource_ext_address_space(ares, &r, NULL))
>> - return acpi_dev_new_resource_entry(&r, c);
>> + || acpi_dev_resource_address_space(ares, &r, &offset)
>> + || acpi_dev_resource_ext_address_space(ares, &r, &offset))
>> + return acpi_dev_new_resource_entry(&r, c, offset);
>>
>> for (i = 0; acpi_dev_resource_interrupt(ares, i, &r); i++) {
>> acpi_status status;
>>
>> - status = acpi_dev_new_resource_entry(&r, c);
>> + status = acpi_dev_new_resource_entry(&r, c, 0);
>> if (ACPI_FAILURE(status))
>> return status;
>> }
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index bde8119f5897..fea78e772450 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -300,6 +300,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
>> struct resource_list_entry {
>> struct list_head node;
>> struct resource res;
>> + resource_size_t offset;
>
> Well, so instead of adding the offset thing here and there, wouldn't it be
> cleaner to introduce something like
>
> struct ext_resource {
> sturct resource res;
> resource_size_t offset;
> };
>
> and use struct ext_resource instead of struct resource where an offset is needed?
>
> Just a thought ...
Hi Rafael,
Following patches will achieve this by sharing struct resource_list_entry.
Regards!
Gerry
>
>> };
>>
>> void acpi_dev_free_resource_list(struct list_head *list);
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/