From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 739BBC433EF for ; Fri, 6 May 2022 14:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442446AbiEFOvB (ORCPT ); Fri, 6 May 2022 10:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237385AbiEFOuy (ORCPT ); Fri, 6 May 2022 10:50:54 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D21496AA5C; Fri, 6 May 2022 07:47:11 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dmitry.osipenko) with ESMTPSA id C32391F468F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1651848427; bh=utol468ApKu3UfEFy7x8r+aU8cRRwOmqk4bK/1Di3gM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jBE3ytwUGToW06KmZyXbQlLMQh11EfcrZ6bdwLxbmA9KbTMiYuuNn3kvbqh632rH2 Jgx0CZHq1E9lNHGEsuRz21D8kAvAh8rFaR8jds1ArktyMwvqKLxX4GAkX19BTWUmPP b1quvNeRnJpwzsGfRULjPmqW94UBaLvY+SdyGZ2o/bAt8UYAzh00sKV0zWBnlAl37N VELNP3WacCdMrm2dk8Vabl3yhZXLesCAV/s6oeDX+kpR+1yBykPgcYSQODD7Vr7gKd V7A6zoiXfzrqEzkhyai26Ys6RbYpjgl9Ni5GI2/IasHsLcZOIHlsySI8JROUyGnbmg dahigOUrcy3KA== Message-ID: Date: Fri, 6 May 2022 17:46:57 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v7 04/20] kernel: Add combined power-off+restart handler call chain API Content-Language: en-US To: "Rafael J. Wysocki" Cc: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , the arch/x86 maintainers , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, "open list:BROADCOM NVRAM DRIVER" , linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, Linux-sh list , xen-devel@lists.xenproject.org, ACPI Devel Maling List , Linux PM , linux-tegra References: <20220411233832.391817-1-dmitry.osipenko@collabora.com> <20220411233832.391817-5-dmitry.osipenko@collabora.com> <990621e7-9f8a-8b4a-02ec-fd6c1e1f48ff@collabora.com> From: Dmitry Osipenko In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.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] https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/184dfd3983e774d3cf9050dc5b4ec23a662a9551 -- Best regards, Dmitry From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B40FC433F5 for ; Fri, 6 May 2022 14:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JVkbx0lNdQIyBd78v7bDw1ALqvVstRBZlJzRQu5r81M=; b=frpjXLTzf/NRCW fqWxQmy2dpa8DwssOsJwiN4HmJf2tOy/vshrmsOdqLFDyM246IY47h0xXgLC929e5aXjL0VUpQx5x ZsGwXh+F4bRJKietSImZWteX+K16v6GV1nyODSd+AVGY5z3cGKWwvCn2d9pVf3Ab7cE2BOdZiRXQy c+nFWOaXNul6Fp0PEp+Ij5WmH+80NSky1P+hvpOqmTu4q1iXPi7WrqbG4cpabzcgp9JPhSwZfqD5v fJun3r3za/kefxVzak1XmXNgjCO2BfzBRmGZL1988pVVzNlcoyZzSPcHL73Z3z8q+1JibyKPyH8+w kFa2+DbAdwoFOJg31ezg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmzEf-003sse-2d; Fri, 06 May 2022 14:47:13 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmzEb-003sqQ-32 for linux-riscv@lists.infradead.org; Fri, 06 May 2022 14:47:10 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dmitry.osipenko) with ESMTPSA id C32391F468F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1651848427; bh=utol468ApKu3UfEFy7x8r+aU8cRRwOmqk4bK/1Di3gM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jBE3ytwUGToW06KmZyXbQlLMQh11EfcrZ6bdwLxbmA9KbTMiYuuNn3kvbqh632rH2 Jgx0CZHq1E9lNHGEsuRz21D8kAvAh8rFaR8jds1ArktyMwvqKLxX4GAkX19BTWUmPP b1quvNeRnJpwzsGfRULjPmqW94UBaLvY+SdyGZ2o/bAt8UYAzh00sKV0zWBnlAl37N VELNP3WacCdMrm2dk8Vabl3yhZXLesCAV/s6oeDX+kpR+1yBykPgcYSQODD7Vr7gKd V7A6zoiXfzrqEzkhyai26Ys6RbYpjgl9Ni5GI2/IasHsLcZOIHlsySI8JROUyGnbmg dahigOUrcy3KA== Message-ID: Date: Fri, 6 May 2022 17:46:57 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v7 04/20] kernel: Add combined power-off+restart handler call chain API Content-Language: en-US To: "Rafael J. Wysocki" Cc: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , the arch/x86 maintainers , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, "open list:BROADCOM NVRAM DRIVER" , linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, Linux-sh list , xen-devel@lists.xenproject.org, ACPI Devel Maling List , Linux PM , linux-tegra References: <20220411233832.391817-1-dmitry.osipenko@collabora.com> <20220411233832.391817-5-dmitry.osipenko@collabora.com> <990621e7-9f8a-8b4a-02ec-fd6c1e1f48ff@collabora.com> From: Dmitry Osipenko In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220506_074709_310374_587950B8 X-CRM114-Status: GOOD ( 17.07 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.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] https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/184dfd3983e774d3cf9050dc5b4ec23a662a9551 -- Best regards, Dmitry _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Osipenko Date: Fri, 06 May 2022 14:46:57 +0000 Subject: Re: [PATCH v7 04/20] kernel: Add combined power-off+restart handler call chain API Message-Id: List-Id: References: <20220411233832.391817-1-dmitry.osipenko@collabora.com> <20220411233832.391817-5-dmitry.osipenko@collabora.com> <990621e7-9f8a-8b4a-02ec-fd6c1e1f48ff@collabora.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Rafael J. Wysocki" Cc: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , the arch/x86 maintainers , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, "open list:BROADCOM NVRAM DRIVER" , linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, Linux-sh list , xen-devel@lists.xenproject.org, ACPI Devel Maling List , Linux PM , linux-tegra 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] https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/184dfd3983e774d3cf9050dc5b4ec23a662a9551 -- Best regards, Dmitry