public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Sven Peter" <sven@svenpeter.dev>
To: "Alyssa Rosenzweig" <alyssa@rosenzweig.io>
Cc: "Janne Grunau" <j@jannau.net>, "Neal Gompa" <neal@gompa.dev>,
	"Hector Martin" <marcan@marcan.st>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Lee Jones" <lee@kernel.org>, "Marc Zyngier" <maz@kernel.org>,
	"Russell King" <rmk+kernel@armlinux.org.uk>,
	asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 6/9] power: reset: macsmc-reboot: Add driver for rebooting via Apple SMC
Date: Fri, 09 May 2025 18:13:09 +0200	[thread overview]
Message-ID: <196f84ea-6567-4fe3-9bee-743bb289223e@app.fastmail.com> (raw)
In-Reply-To: <aB39iJm9759RYAKW@blossom>

thanks for the review!

On Fri, May 9, 2025, at 15:05, Alyssa Rosenzweig wrote:
>> +	for (i = 0; i < ARRAY_SIZE(ac_power_mode_map); i++)
>> +		if (mode == ac_power_mode_map[i])
>> +			len += scnprintf(buf+len, PAGE_SIZE-len,
>> +					 "[%s] ", ac_power_modes[i]);
>> +		else
>> +			len += scnprintf(buf+len, PAGE_SIZE-len,
>> +					 "%s ", ac_power_modes[i]);
>
> Nit: { braces } at least on the for loop...

Will fix that.

>
> (And might be more concise as
>
>     for (i = 0; i < ARRAY_SIZE(ac_power_mode_map); i++) {
>         bool match = (mode == ac_power_mode_map[i]);
>         len += scnprintf(buf+len, PAGE_SIZE-len,
>                  match ? "[%s] " : "%s ", ac_power_modes[i]);
>     }
>
> though IDK how people feel about it.)

imho it's less readable that way but I don't have a strong opinion
either way.

>
>> +		mdelay(100);
>> +		WARN_ON(1);
>
> ...What?

This is done in a few drivers in drivers/power/reboot. If we haven't
rebooted after 100ms something's wrong with SMC. I'll add a comment.

drivers/power/reset/tps65086-restart.c:	WARN_ON(1);
drivers/power/reset/atc260x-poweroff.c:	WARN_ONCE(1, "Unable to power off system\n");
drivers/power/reset/mt6323-poweroff.c:	WARN_ONCE(1, "Unable to power off system\n");
drivers/power/reset/gpio-restart.c:	WARN_ON(1);
drivers/power/reset/regulator-poweroff.c:	WARN_ON(1);



>
>> +	if (ret)
>> +		return dev_err_probe(&pdev->dev, ret,
>> +				     "Failed to register power-off handler\n");
>> +
>> +
>> +	ret = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART_PREPARE,
>> +					    SYS_OFF_PRIO_HIGH, macsmc_prepare_atomic, reboot);
>
> Nit: squash double blank-line

will do.


thanks,


Sven

  reply	other threads:[~2025-05-09 16:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-03 10:06 [PATCH v4 0/9] Apple Mac System Management Controller Sven Peter via B4 Relay
2025-05-03 10:06 ` [PATCH v4 1/9] dt-bindings: gpio: Add Apple Mac SMC GPIO block Sven Peter via B4 Relay
2025-05-05  9:05   ` Linus Walleij
2025-05-09 13:12   ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 2/9] dt-bindings: power: reboot: Add Apple Mac SMC Reboot Controller Sven Peter via B4 Relay
2025-05-09 13:11   ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 3/9] dt-bindings: mfd: Add Apple Mac System Management Controller Sven Peter via B4 Relay
2025-05-09 13:12   ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 4/9] mfd: Add Apple Silicon " Sven Peter via B4 Relay
2025-05-09 13:09   ` Alyssa Rosenzweig
2025-05-09 13:51   ` Lee Jones
2025-05-09 16:04     ` Sven Peter
2025-05-03 10:06 ` [PATCH v4 5/9] gpio: Add new gpio-macsmc driver for Apple Macs Sven Peter via B4 Relay
2025-05-06  8:07   ` Bartosz Golaszewski
2025-05-06 10:16     ` Sven Peter
2025-05-09 13:10   ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 6/9] power: reset: macsmc-reboot: Add driver for rebooting via Apple SMC Sven Peter via B4 Relay
2025-05-09 13:05   ` Alyssa Rosenzweig
2025-05-09 16:13     ` Sven Peter [this message]
2025-05-09 16:21       ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 7/9] arm64: dts: apple: t8103: Add SMC node Sven Peter via B4 Relay
2025-05-09 13:14   ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 8/9] arm64: dts: apple: t8112: " Sven Peter via B4 Relay
2025-05-09 13:13   ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 9/9] arm64: dts: apple: t600x: " Sven Peter via B4 Relay
2025-05-09 13:13   ` Alyssa Rosenzweig
2025-05-09 13:15 ` [PATCH v4 0/9] Apple Mac System Management Controller Alyssa Rosenzweig

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=196f84ea-6567-4fe3-9bee-743bb289223e@app.fastmail.com \
    --to=sven@svenpeter.dev \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=j@jannau.net \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=maz@kernel.org \
    --cc=neal@gompa.dev \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh@kernel.org \
    --cc=sre@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