From: sashiko-bot@kernel.org
To: "Atharva Tiwari" <atharvatiwarilinuxdev@gmail.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
"Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>,
"Linus Walleij" <linusw@kernel.org>,
"Bartosz Golaszewski" <brgl@kernel.org>,
"Sven Peter" <sven@kernel.org>, "Janne Grunau" <j@jannau.net>,
"Neal Gompa" <neal@gompa.dev>,
"Guenter Roeck" <linux@roeck-us.net>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>, "Lee Jones" <lee@kernel.org>,
"Pavel Machek" <pavel@kernel.org>,
"Griffin Kroah-Hartman" <griffin@kroah.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Sebastian Reichel" <sre@kernel.org>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Wim Van Sebroeck" <wim@linux-watchdog.org>,
"Jarkko Sakkinen" <jarkko@kernel.org>,
"Mimi Zohar" <zohar@linux.ibm.com>,
"Roberto Sassu" <roberto.sassu@huawei.com>,
"Dmitry Kasatkin" <dmitry.kasatkin@gmail.com>,
"Eric Snowberg" <eric.snowberg@oracle.com>,
"Paul Moore" <paul@paul-moore.com>,
"James Morris" <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-hwmon@vger.kernel.org, linux-leds@vger.kernel.org,
mfd@lists.linux.dev, linux-rtc@vger.kernel.org,
linux-watchdog@vger.kernel.org, keyrings@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [RFC PATCH 11/14] acpi: disable battery and adapter for x86 apple machines
Date: Thu, 29 Oct 2026 09:13:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-189006@kernel.org> (raw)
In-Reply-To: <20261029085504.3547-12-atharvatiwarilinuxdev@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] acpi: sbs: SMBus hang and probe failure in acpi_sbs_probe() on Apple x86
- [High] acpi: missing CONFIG_MACSMC_ACPI check disables battery and AC on x86 Macs
--
commit a9ef8c0ab923a26344436713c10dccfd42ea84d9
Author: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
acpi: disable battery and adapter for x86 apple machines
This commit skips the ACPI SBS, battery, and AC adapter drivers on x86 Apple
machines when CONFIG_MACSMC_POWER is enabled to avoid registering duplicate
power supply devices.
> diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
> index f10bbf13c242f..b12f2acc0a15d 100644
> --- a/drivers/acpi/sbs.c
> +++ b/drivers/acpi/sbs.c
> @@ -634,6 +634,9 @@ static int acpi_sbs_probe(struct platform_device *pdev)
> int result = 0;
> int id;
>
> + if (IS_ENABLED(CONFIG_MACSMC_POWER) && x86_apple_machine)
> + return -ENODEV;
> +
> device = ACPI_COMPANION(&pdev->dev);
> if (!device)
> return -ENODEV;
> @@ -655,14 +658,12 @@ static int acpi_sbs_probe(struct platform_device *pdev)
>
> result = 0;
>
> - if (!x86_apple_machine) {
> - result = acpi_manager_get_info(sbs);
> - if (!result) {
> - sbs->manager_present = 1;
> - for (id = 0; id < MAX_SBS_BAT; ++id)
> - if ((sbs->batteries_supported & (1 << id)))
> - acpi_battery_add(sbs, id);
> - }
> + result = acpi_manager_get_info(sbs);
> + if (!result) {
> + sbs->manager_present = 1;
> + for (id = 0; id < MAX_SBS_BAT; ++id)
> + if ((sbs->batteries_supported & (1 << id)))
> + acpi_battery_add(sbs, id);
> }
[Severity: High]
What happens on x86 Apple machines when CONFIG_MACSMC_POWER is disabled?
When CONFIG_MACSMC_POWER=n, acpi_sbs_probe() does not return early on
x86_apple_machine, and removing the !x86_apple_machine check causes it to
call acpi_manager_get_info(sbs) -> acpi_smbus_read(..., ACPI_SBS_MANAGER, ...).
Commit 9faf6136ff46 ("ACPI / SBS: Disable smart battery manager on Apple")
and commit 630b3aff8a51 guarded this call because accessing ACPI_SBS_MANAGER
on Apple hardware causes the SMBus and EC controller to hang for several
minutes when unplugging the AC adapter. Doesn't removing the
!x86_apple_machine check reintroduce this controller hang whenever
CONFIG_MACSMC_POWER is disabled?
In addition, by removing the !x86_apple_machine condition around
acpi_manager_get_info(sbs), the preceding result = 0 assignment becomes a
dead store, and sbs->manager_present remains 0 only when
acpi_manager_get_info(sbs) returns a non-zero error:
result = acpi_manager_get_info(sbs);
if (!result) {
sbs->manager_present = 1;
...
}
if (!sbs->manager_present)
acpi_battery_add(sbs, 0);
acpi_smbus_register_callback(sbs->hc, acpi_sbs_callback, sbs);
end:
if (result)
acpi_sbs_remove(pdev);
return result;
When acpi_manager_get_info(sbs) fails with a non-zero result, the
!sbs->manager_present fallback registers battery 0 and the SMBus callback,
but because result is still non-zero at the end label, acpi_sbs_remove(pdev)
immediately tears everything back down and fails the probe. Should the
!x86_apple_machine check be kept?
> diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c
> index 418951639f511..9f3b9b7d9c27c 100644
> --- a/drivers/acpi/x86/utils.c
> +++ b/drivers/acpi/x86/utils.c
> @@ -14,6 +14,7 @@
> #include <linux/dmi.h>
> #include <linux/pci.h>
> #include <linux/platform_device.h>
> +#include <linux/platform_data/x86/apple.h>
> #include <asm/cpu_device_id.h>
> #include <asm/intel-family.h>
> #include "../internal.h"
> @@ -608,6 +609,9 @@ bool acpi_quirk_skip_acpi_ac_and_battery(void)
> long quirks = 0;
> int i;
>
> + if (IS_ENABLED(CONFIG_MACSMC_POWER) && x86_apple_machine)
> + return true;
[Severity: High]
Should both acpi_quirk_skip_acpi_ac_and_battery() and acpi_sbs_probe() also
check IS_ENABLED(CONFIG_MACSMC_ACPI)?
In drivers/power/supply/Kconfig, MACSMC_POWER only depends on
MFD_MACSMC_CORE:
config MACSMC_POWER
tristate "Apple SMC Battery and Power Driver"
depends on MFD_MACSMC_CORE
However, on x86 Apple machines, the macsmc-power MFD device is only
registered when apple_smc_acpi_probe() in drivers/platform/x86/macsmc-acpi.c
probes the SMC device, which is controlled by CONFIG_MACSMC_ACPI in
drivers/platform/x86/Kconfig:
config MACSMC_ACPI
tristate "Apple SMC (System Management Controller) ACPI Backend"
depends on MFD_MACSMC_CORE && ACPI && !SENSORS_APPLESMC
If a kernel is built with CONFIG_MACSMC_POWER enabled and CONFIG_MACSMC_ACPI
disabled (for example, whenever CONFIG_SENSORS_APPLESMC is enabled), won't
checking only IS_ENABLED(CONFIG_MACSMC_POWER) disable the ACPI SBS, battery,
and AC adapter drivers on x86 Macs without any macsmc-acpi backend built to
instantiate macsmc-power?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261029085504.3547-1-atharvatiwarilinuxdev@gmail.com?part=11
next prev parent reply other threads:[~2026-10-29 9:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 8:51 [RFC PATCH 00/14] Add macsmc support for Intel Macs, replacing applesmc Atharva Tiwari
2026-10-29 8:51 ` [RFC PATCH 01/14] treewide: Add backend for macsmc Atharva Tiwari
2026-10-29 9:20 ` sashiko-bot
2026-10-29 8:51 ` [RFC PATCH 02/14] platform/x86: add backend for macsmc in intel macs Atharva Tiwari
2026-10-29 9:23 ` sashiko-bot
2026-10-29 12:59 ` Ilpo Järvinen
2026-10-29 8:52 ` [RFC PATCH 03/14] watchdog: add driver for apple smc Atharva Tiwari
2026-10-29 9:17 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 04/14] iio/light: add new driver for macsmc Atharva Tiwari
2026-10-29 9:17 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 05/14] iio/accel: add driver for apple SMS Atharva Tiwari
2026-10-29 9:20 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 06/14] leds: add support for macsmc kbl Atharva Tiwari
2026-10-29 9:16 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 07/14] rtc: add support for x86 macs in macsmc-rtc Atharva Tiwari
2026-10-29 9:15 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 08/14] treewide: Add a flag to detect the Apple T2 chip Atharva Tiwari
2026-10-29 9:11 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 09/14] treewide: disable other rtc's in t2 macs Atharva Tiwari
2026-10-29 9:16 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 10/14] power/supply: add support for x86 macs in macsmc-power Atharva Tiwari
2026-10-29 9:19 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 11/14] acpi: disable battery and adapter for x86 apple machines Atharva Tiwari
2026-10-29 9:13 ` sashiko-bot [this message]
2026-10-29 8:52 ` [RFC PATCH 12/14] hwmon/macsmc: add more types Atharva Tiwari
2026-10-29 9:18 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 13/14] hwmon: add support for x86 macs in macsmc-hwmon Atharva Tiwari
2026-10-29 9:20 ` sashiko-bot
2026-10-29 8:52 ` [RFC PATCH 14/14] mfd/macsmc: add ioctl to access smc keys Atharva Tiwari
2026-10-29 9:26 ` 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=sashiko-outbox-189006@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=andy@kernel.org \
--cc=atharvatiwarilinuxdev@gmail.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=brgl@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=dlechner@baylibre.com \
--cc=dmitry.kasatkin@gmail.com \
--cc=eric.snowberg@oracle.com \
--cc=griffin@kroah.com \
--cc=hansg@kernel.org \
--cc=hpa@zytor.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=j@jannau.net \
--cc=jarkko@kernel.org \
--cc=jic23@kernel.org \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=lee@kernel.org \
--cc=lenb@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mfd@lists.linux.dev \
--cc=mingo@redhat.com \
--cc=neal@gompa.dev \
--cc=nuno.sa@analog.com \
--cc=paul@paul-moore.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=roberto.sassu@huawei.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=serge@hallyn.com \
--cc=sre@kernel.org \
--cc=sven@kernel.org \
--cc=tglx@kernel.org \
--cc=wim@linux-watchdog.org \
--cc=x86@kernel.org \
--cc=zohar@linux.ibm.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