From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Julien <julien82453@gmail.com>,
jarkko@kernel.org, linux-integrity@vger.kernel.org
Subject: Re: [PATCH v2] ACPI: scan: Avoid registering platform devices with resource overlaps
Date: Fri, 7 Aug 2026 00:23:45 +0300 [thread overview]
Message-ID: <anT7YdW6b-uYwgK0@ashevche-desk.local> (raw)
In-Reply-To: <12954206.O9o76ZdvQC@rafael.j.wysocki>
On Thu, Aug 06, 2026 at 09:28:03PM +0200, Rafael J. Wysocki wrote:
> If acpi_dev_get_resources() returns overlapping I/O or memory resources,
> the subsequent registration of a platform device will fail with -EBUSY
> due to a resource conflict. This is reported to happen on Acer Aspire
> ES1-572 [1].
>
> Avoid that by adjusting resources returned by acpi_dev_get_resources()
> to eliminate partial overlaps between them.
>
> This has not been regarded as necessary before because putting
> overlapping resources into the _CRS of one device is really pointless,
> but now that the issue has been reported to actually happen in the
> field, it needs to be done.
...
> +static unsigned int acpi_platform_adjust_resources(struct acpi_device *adev,
> + struct resource *new_res,
> + struct resource *resources,
> + unsigned int count)
> +{
> + unsigned int i;
> +
> + if (!(new_res->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
> + return count;
> +
> + for (i = 0; i < count; ) {
> + struct resource *res = &resources[i];
> +
> + if (resource_type(new_res) != resource_type(res) ||
> + !resource_overlaps(new_res, res)) {
> + i++;
> + continue;
> + }
> +
> + dev_info(&adev->dev, "Adjusting %pR for %pR\n", new_res, res);
> + /*
> + * Extend the new resource to include the one that has been processed
> + * already.
> + */
> + if (res->start < new_res->start)
> + new_res->start = res->start;
> +
> + if (res->end > new_res->end)
> + new_res->end = res->end;
Can we use resource_union() instead?
> + /*
> + * Eliminate the previously processed resource that has
> + * triggered the adjustment because it is not necessary any
> + * more.
> + */
> + memmove(res, res + 1, (--count - i) * sizeof(*res));
> + }
> +
> + return count;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-06 21:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 19:28 Rafael J. Wysocki
2026-08-06 21:23 ` Andy Shevchenko [this message]
2026-08-07 9:55 ` Rafael J. Wysocki (Intel)
2026-08-07 10:09 ` Rafael J. Wysocki (Intel)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anT7YdW6b-uYwgK0@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=jarkko@kernel.org \
--cc=julien82453@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®