From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: "Linux PM" <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"Peixin Xie" <peixin.xie@linux.spacemit.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Linux PCI" <linux-pci@vger.kernel.org>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v3 4/4] ACPI: scan: Combine two conditionals in acpi_bus_attach()
Date: Thu, 03 Sep 2026 19:09:22 +0200 [thread overview]
Message-ID: <8746939.T7Z3S40VBb@rafael.j.wysocki> (raw)
In-Reply-To: <6044499.DvuYhMxLoT@rafael.j.wysocki>
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
There are two conditionals in acpi_bus_attach() that can be combined,
which slightly reduces the overhead and makes the code a bit easier
to follow, so do that.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2 -> v3:
* Add tag from Andy
v1 -> v2:
* Reverse checks to avoid multiple negations (Andy)
* Rebase on top of the new [2/6]
Link to the v1:
https://lore.kernel.org/linux-pci/2021470.taCxCBeP46@rafael.j.wysocki/
---
drivers/acpi/scan.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index f219a16e018a..1b8d833131a0 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2391,13 +2391,8 @@ static int acpi_bus_attach(struct acpi_device *device, void *first_pass)
if (ret < 0)
return 0;
- if (ret > 0 && !device->flags.enumeration_by_parent) {
- acpi_device_set_enumerated(device);
- goto ok;
- }
-
- if (device->pnp.type.platform_id || device->pnp.type.backlight ||
- device->flags.enumeration_by_parent)
+ 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);
--
2.51.0
next prev parent reply other threads:[~2026-09-03 17:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 16:57 [PATCH v3 0/4] ACPI: scan: Adjust power management initialization and PCI devices handling Rafael J. Wysocki
2026-09-03 16:58 ` [PATCH v3 1/4] ACPI: PM: Drop parent state update from acpi_device_get_power() Rafael J. Wysocki
2026-09-03 17:05 ` [PATCH v3 2/4] ACPI: scan: Stop calling acpi_bus_init_power() early Rafael J. Wysocki
2026-09-03 17:06 ` [PATCH v3 3/4] ACPI: PM: Move acpi_bus_init_power() declaration to internal header file Rafael J. Wysocki
2026-09-03 17:09 ` Rafael J. Wysocki [this message]
2026-09-04 9:40 ` [PATCH v3 0/4] ACPI: scan: Adjust power management initialization and PCI devices handling Peixin Xie
2026-09-04 10:04 ` 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=8746939.T7Z3S40VBb@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hansg@kernel.org \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mika.westerberg@linux.intel.com \
--cc=peixin.xie@linux.spacemit.com \
--cc=sakari.ailus@linux.intel.com \
/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