Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 4/6] ACPI: scan: Add ACPI device enumerated marker
Date: Wed, 02 Sep 2026 20:26:30 +0000	[thread overview]
Message-ID: <20260902202631.3BDB81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <3985136.kQq0lBPeGt@rafael.j.wysocki>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message establishes a strict structural invariant: 'The rule regarding flags.visited and the "enumerated" field is that the latter cannot be set until the former has been set and they need to be cleared in reverse order.' However, the implementation violates this rule in multiple paths. For early and fixed devices, `acpi_bus_register_early_device()` and `acpi_bus_add_fixed_device_object()` call `acpi_default_enumeration()`, which sets `enumerated = true`, but their `flags.visited` is never set to 1. Additionally, for generic devices, `acpi_scan_attach_handler()` calls `acpi_generic_device_attach()`, which triggers `acpi_default_enumeration()`, setting `enumerated = true` before `acpi_bus_attach()` sets `device->flags.visited = 1`.
--

commit 193e84bf6b51af7db08c641525537f0a2b63b3c2
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

ACPI: scan: Add ACPI device enumerated marker

Currently, the "visited" flag of ACPI device objects has two roles.
One of them is to indicate that the given ACPI device object has been
enumerated, and the other is to indicate that acpi_bus_attach() has
processed the device. This commit adds a new "enumerated" bool field to
struct acpi_device to separate these purposes.

> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 7208cc5158660..2e853add5e605 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
[ ... ]
> @@ -2338,46 +2340,42 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
>  	return ret;
>  }
>  
> -static int acpi_bus_attach(struct acpi_device *device, void *first_pass)
> +static int acpi_bus_attach(struct acpi_device *device, void *not_used)
>  {
[ ... ]
>  	acpi_bus_init_power(device);
>  
> -	if (device->flags.visited)
> -		goto ok;
> -
>  	ret = acpi_scan_attach_handler(device);
>  	if (ret < 0)
>  		return 0;
>  
> +	device->flags.visited = 1;

[Severity: Medium]
The commit message establishes a strict structural invariant: 'The rule
regarding flags.visited and the "enumerated" field is that the latter cannot
be set until the former has been set and they need to be cleared in reverse
order.'

Does the implementation violate this rule in multiple paths?

For generic devices, acpi_scan_attach_handler() (called just above) calls
acpi_generic_device_attach(), which triggers acpi_default_enumeration().
This sets enumerated = true before acpi_bus_attach() reaches this line to
set device->flags.visited = 1.

Additionally, for early and fixed devices, acpi_bus_register_early_device()
and acpi_bus_add_fixed_device_object() call acpi_default_enumeration(),
which sets enumerated = true, but their flags.visited is never set to 1.

> +
>  	if (device->flags.enumeration_by_parent ||
>  	    (!ret && (device->pnp.type.platform_id || device->pnp.type.backlight)))
>  		acpi_default_enumeration(device);
>  	else
>  		acpi_device_set_enumerated(device);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/5144065.31r3eYUQgx@rafael.j.wysocki?part=4

  reply	other threads:[~2026-09-02 20:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5144065.31r3eYUQgx@rafael.j.wysocki>
2026-09-02 19:26 ` [PATCH v2 2/6] ACPI: scan: Stop calling acpi_bus_init_power() early Rafael J. Wysocki
2026-09-02 19:58   ` sashiko-bot
2026-09-02 19:30 ` [PATCH v2 3/6] ACPI: scan: Combine two conditionals in acpi_bus_attach() Rafael J. Wysocki
2026-09-02 20:01   ` sashiko-bot
2026-09-03  7:27   ` Andy Shevchenko
2026-09-02 19:33 ` [PATCH v2 4/6] ACPI: scan: Add ACPI device enumerated marker Rafael J. Wysocki
2026-09-02 20:26   ` sashiko-bot [this message]
2026-09-02 19:35 ` [PATCH v2 5/6] ACPI: scan: Adjust and rename acpi_bus_attach() Rafael J. Wysocki
2026-09-02 20:30   ` sashiko-bot
2026-09-02 19:36 ` [PATCH v2 6/6] ACPI: scan: Take PCI device enumeration into account directly Rafael J. Wysocki
2026-09-02 20:51   ` sashiko-bot
2026-09-03  8:12   ` Andy Shevchenko
     [not found] ` <2292173.irdbgypaU6@rafael.j.wysocki>
2026-09-02 19:44   ` [PATCH v2 1/6] ACPI: PM: Drop parent state update from acpi_device_get_power() sashiko-bot

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=20260902202631.3BDB81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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