[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4222319.ltJQ6b6Cov@aspire.rjw.lan>
Date: Wed, 13 Dec 2017 01:19:55 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Vasyl Gomonovych <gomonovych@...il.com>,
Borislav Petkov <bp@...e.de>
Cc: lenb@...nel.org, tony.luck@...el.com, bp@...en8.de,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPI, APEI, Fix use resource_size
On Monday, December 11, 2017 4:44:31 PM CET Vasyl Gomonovych wrote:
> Use resource_size function on resource object
> Underneath __request_region set res->end to start + n - 1
> Lets use resourse_size to set value properly.
>
> Signed-off-by: Vasyl Gomonovych <gomonovych@...il.com>
Boris, what do you think?
> ---
> drivers/acpi/apei/apei-base.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
> index da370e1..af712a8 100644
> --- a/drivers/acpi/apei/apei-base.c
> +++ b/drivers/acpi/apei/apei-base.c
> @@ -506,8 +506,7 @@ int apei_resources_request(struct apei_resources *resources,
>
> rc = -EINVAL;
> list_for_each_entry(res, &resources->iomem, list) {
> - r = request_mem_region(res->start, res->end - res->start,
> - desc);
> + r = request_mem_region(res->start, resource_size(res), desc);
> if (!r) {
> pr_err(APEI_PFX
> "Can not request [mem %#010llx-%#010llx] for %s registers\n",
> @@ -519,7 +518,7 @@ int apei_resources_request(struct apei_resources *resources,
> }
>
> list_for_each_entry(res, &resources->ioport, list) {
> - r = request_region(res->start, res->end - res->start, desc);
> + r = request_region(res->start, resource_size(res), desc);
> if (!r) {
> pr_err(APEI_PFX
> "Can not request [io %#06llx-%#06llx] for %s registers\n",
> @@ -542,14 +541,14 @@ int apei_resources_request(struct apei_resources *resources,
> list_for_each_entry(res, &resources->ioport, list) {
> if (res == res_bak)
> break;
> - release_region(res->start, res->end - res->start);
> + release_region(res->start, resource_size(res));
> }
> res_bak = NULL;
> err_unmap_iomem:
> list_for_each_entry(res, &resources->iomem, list) {
> if (res == res_bak)
> break;
> - release_mem_region(res->start, res->end - res->start);
> + release_mem_region(res->start, resource_size(res));
> }
> arch_res_fini:
> if (arch_apei_filter_addr)
> @@ -566,9 +565,9 @@ void apei_resources_release(struct apei_resources *resources)
> struct apei_res *res;
>
> list_for_each_entry(res, &resources->iomem, list)
> - release_mem_region(res->start, res->end - res->start);
> + release_mem_region(res->start, resource_size(res));
> list_for_each_entry(res, &resources->ioport, list)
> - release_region(res->start, res->end - res->start);
> + release_region(res->start, resource_size(res));
>
> rc = apei_resources_sub(&apei_resources_all, resources);
> if (rc)
>
Powered by blists - more mailing lists