[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 04/20] kernel: Add combined power-off+restart handler call chain API
- To: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
- From: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx>
- Date: Fri, 6 May 2022 17:46:57 +0300
- Cc: Thierry Reding <thierry.reding@xxxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Greg Ungerer <gerg@xxxxxxxxxxxxxx>, Joshua Thompson <funaho@xxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Sebastian Reichel <sre@xxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Greentime Hu <green.hu@xxxxxxxxx>, Vincent Chen <deanbo422@xxxxxxxxx>, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, the arch/x86 maintainers <x86@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, Santosh Shilimkar <ssantosh@xxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>, Liam Girdwood <lgirdwood@xxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Pavel Machek <pavel@xxxxxx>, Lee Jones <lee.jones@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Guenter Roeck <linux@xxxxxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Michał Mirosław <mirq-linux@xxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, linux-csky@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxxxxxxx, "open list:BROADCOM NVRAM DRIVER" <linux-mips@xxxxxxxxxxxxxxx>, linux-parisc@xxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, Linux-sh list <linux-sh@xxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, ACPI Devel Maling List <linux-acpi@xxxxxxxxxxxxxxx>, Linux PM <linux-pm@xxxxxxxxxxxxxxx>, linux-tegra <linux-tegra@xxxxxxxxxxxxxxx>
- Delivery-date: Fri, 06 May 2022 14:47:17 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 4/20/22 21:47, Rafael J. Wysocki wrote:
>>>> +/**
>>>> + * devm_register_prioritized_power_off_handler - Register prioritized
>>>> power-off callback
>>>> + * @dev: Device that registers callback
>>>> + * @priority: Callback's priority
>>>> + * @callback: Callback function
>>>> + * @cb_data: Callback's argument
>>>> + *
>>>> + * Registers resource-managed power-off callback with a given
>>>> priority.
>>>> + * It will be called as last step of the power-off sequence. Callbacks
>>>> + * chaining is disabled, i.e. further lower priority callbacks won't
>>>> + * be executed if this @callback will fail to execute.
>>>> + *
>>>> + * Returns zero on success, or error code on failure.
>>> What's the case in which this should be used instead of registering a
>>> full sys_off handler?
>> There are a lot of drivers that just want to register power-off handler
>> with a non-default priority and don't need to stop the chain or do
>> anything else special. This is a convinient helper for them.
>>
>> Please note that the callback here takes only the cb_data for the
>> argument, while sys_off uses "struct power_off_data".
>>
>> Similar for the reset of the convinient helpers.
> So if there is a way to do this, why would anyone prefer to use the
> full sys_off handler at all?
There are couple occurrences around kernel where there is no device
available for the devm_ functions, like this for example [1].
[1]
http://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/184dfd3983e774d3cf9050dc5b4ec23a662a9551
--
Best regards,
Dmitry
|