From: Andrew Davis <afd@ti.com> To: Sebastian Reichel <sre@kernel.org>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Cristian Ciocaltea <cristian.ciocaltea@gmail.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Sean Wang <sean.wang@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-actions@lists.infradead.org>, <linux-arm-msm@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, Andrew Davis <afd@ti.com> Subject: [PATCH 04/18] power: reset: tps65086-restart: Use devm_register_sys_off_handler(RESTART) Date: Thu, 1 Feb 2024 12:00:48 -0600 [thread overview] Message-ID: <20240201180102.70395-5-afd@ti.com> (raw) In-Reply-To: <20240201180102.70395-1-afd@ti.com> Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> --- drivers/power/reset/tps65086-restart.c | 35 ++++++-------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/drivers/power/reset/tps65086-restart.c b/drivers/power/reset/tps65086-restart.c index ee8e9f4b837ea..82d7a761a0385 100644 --- a/drivers/power/reset/tps65086-restart.c +++ b/drivers/power/reset/tps65086-restart.c @@ -10,15 +10,12 @@ #include <linux/reboot.h> struct tps65086_restart { - struct notifier_block handler; struct device *dev; }; -static int tps65086_restart_notify(struct notifier_block *this, - unsigned long mode, void *cmd) +static int tps65086_restart_notify(struct sys_off_data *data) { - struct tps65086_restart *tps65086_restart = - container_of(this, struct tps65086_restart, handler); + struct tps65086_restart *tps65086_restart = data->cb_data; struct tps65086 *tps65086 = dev_get_drvdata(tps65086_restart->dev->parent); int ret; @@ -46,13 +43,13 @@ static int tps65086_restart_probe(struct platform_device *pdev) if (!tps65086_restart) return -ENOMEM; - platform_set_drvdata(pdev, tps65086_restart); - - tps65086_restart->handler.notifier_call = tps65086_restart_notify; - tps65086_restart->handler.priority = 192; tps65086_restart->dev = &pdev->dev; - ret = register_restart_handler(&tps65086_restart->handler); + ret = devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_RESTART, + SYS_OFF_PRIO_HIGH, + tps65086_restart_notify, + tps65086_restart); if (ret) { dev_err(&pdev->dev, "%s: cannot register restart handler: %d\n", __func__, ret); @@ -62,23 +59,6 @@ static int tps65086_restart_probe(struct platform_device *pdev) return 0; } -static void tps65086_restart_remove(struct platform_device *pdev) -{ - struct tps65086_restart *tps65086_restart = platform_get_drvdata(pdev); - int ret; - - ret = unregister_restart_handler(&tps65086_restart->handler); - if (ret) { - /* - * tps65086_restart_probe() registered the restart handler. So - * unregistering should work fine. Checking the error code - * shouldn't be needed, still doing it for completeness. - */ - dev_err(&pdev->dev, "%s: cannot unregister restart handler: %d\n", - __func__, ret); - } -} - static const struct platform_device_id tps65086_restart_id_table[] = { { "tps65086-reset", }, { /* sentinel */ } @@ -90,7 +70,6 @@ static struct platform_driver tps65086_restart_driver = { .name = "tps65086-restart", }, .probe = tps65086_restart_probe, - .remove_new = tps65086_restart_remove, .id_table = tps65086_restart_id_table, }; module_platform_driver(tps65086_restart_driver); -- 2.39.2
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Davis <afd@ti.com> To: Sebastian Reichel <sre@kernel.org>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Cristian Ciocaltea <cristian.ciocaltea@gmail.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Sean Wang <sean.wang@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-actions@lists.infradead.org>, <linux-arm-msm@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, Andrew Davis <afd@ti.com> Subject: [PATCH 04/18] power: reset: tps65086-restart: Use devm_register_sys_off_handler(RESTART) Date: Thu, 1 Feb 2024 12:00:48 -0600 [thread overview] Message-ID: <20240201180102.70395-5-afd@ti.com> (raw) In-Reply-To: <20240201180102.70395-1-afd@ti.com> Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis <afd@ti.com> --- drivers/power/reset/tps65086-restart.c | 35 ++++++-------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/drivers/power/reset/tps65086-restart.c b/drivers/power/reset/tps65086-restart.c index ee8e9f4b837ea..82d7a761a0385 100644 --- a/drivers/power/reset/tps65086-restart.c +++ b/drivers/power/reset/tps65086-restart.c @@ -10,15 +10,12 @@ #include <linux/reboot.h> struct tps65086_restart { - struct notifier_block handler; struct device *dev; }; -static int tps65086_restart_notify(struct notifier_block *this, - unsigned long mode, void *cmd) +static int tps65086_restart_notify(struct sys_off_data *data) { - struct tps65086_restart *tps65086_restart = - container_of(this, struct tps65086_restart, handler); + struct tps65086_restart *tps65086_restart = data->cb_data; struct tps65086 *tps65086 = dev_get_drvdata(tps65086_restart->dev->parent); int ret; @@ -46,13 +43,13 @@ static int tps65086_restart_probe(struct platform_device *pdev) if (!tps65086_restart) return -ENOMEM; - platform_set_drvdata(pdev, tps65086_restart); - - tps65086_restart->handler.notifier_call = tps65086_restart_notify; - tps65086_restart->handler.priority = 192; tps65086_restart->dev = &pdev->dev; - ret = register_restart_handler(&tps65086_restart->handler); + ret = devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_RESTART, + SYS_OFF_PRIO_HIGH, + tps65086_restart_notify, + tps65086_restart); if (ret) { dev_err(&pdev->dev, "%s: cannot register restart handler: %d\n", __func__, ret); @@ -62,23 +59,6 @@ static int tps65086_restart_probe(struct platform_device *pdev) return 0; } -static void tps65086_restart_remove(struct platform_device *pdev) -{ - struct tps65086_restart *tps65086_restart = platform_get_drvdata(pdev); - int ret; - - ret = unregister_restart_handler(&tps65086_restart->handler); - if (ret) { - /* - * tps65086_restart_probe() registered the restart handler. So - * unregistering should work fine. Checking the error code - * shouldn't be needed, still doing it for completeness. - */ - dev_err(&pdev->dev, "%s: cannot unregister restart handler: %d\n", - __func__, ret); - } -} - static const struct platform_device_id tps65086_restart_id_table[] = { { "tps65086-reset", }, { /* sentinel */ } @@ -90,7 +70,6 @@ static struct platform_driver tps65086_restart_driver = { .name = "tps65086-restart", }, .probe = tps65086_restart_probe, - .remove_new = tps65086_restart_remove, .id_table = tps65086_restart_id_table, }; module_platform_driver(tps65086_restart_driver); -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-02-01 18:01 UTC|newest] Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-01 18:00 [PATCH 00/18] Remove pm_power_off use in drivers/power/reset Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 01/18] power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(RESTART) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 02/18] power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 03/18] power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` Andrew Davis [this message] 2024-02-01 18:00 ` [PATCH 04/18] power: reset: tps65086-restart: " Andrew Davis 2024-02-01 18:00 ` [PATCH 05/18] power: reset: tps65086-restart: Remove unneeded device data struct Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 06/18] power: reset: brcm-kona-reset: Use devm_register_sys_off_handler(RESTART) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-02 15:42 ` kernel test robot 2024-02-02 15:42 ` kernel test robot 2024-02-01 18:00 ` [PATCH 07/18] power: reset: axxia-reset: " Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 08/18] power: reset: rmobile-reset: Use devm_platform_ioremap_resource() helper Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 09/18] power: reset: rmobile-reset: Use devm_register_sys_off_handler(RESTART) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-03 4:20 ` kernel test robot 2024-02-03 4:20 ` kernel test robot 2024-02-01 18:00 ` [PATCH 10/18] power: reset: mt6323-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 11/18] power: reset: msm-poweroff: " Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 12/18] power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 13/18] power: reset: regulator-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 14/18] power: reset: as3722-poweroff: " Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:00 ` [PATCH 15/18] power: reset: gemini-poweroff: " Andrew Davis 2024-02-01 18:00 ` Andrew Davis 2024-02-01 18:01 ` [PATCH 16/18] power: reset: restart-poweroff: " Andrew Davis 2024-02-01 18:01 ` Andrew Davis 2024-02-01 18:01 ` [PATCH 17/18] power: reset: syscon-poweroff: Move device data into a struct Andrew Davis 2024-02-01 18:01 ` Andrew Davis 2024-02-01 18:01 ` [PATCH 18/18] power: reset: syscon-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Andrew Davis 2024-02-01 18:01 ` Andrew Davis
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=20240201180102.70395-5-afd@ti.com \ --to=afd@ti.com \ --cc=andersson@kernel.org \ --cc=angelogioacchino.delregno@collabora.com \ --cc=cristian.ciocaltea@gmail.com \ --cc=florian.fainelli@broadcom.com \ --cc=konrad.dybcio@linaro.org \ --cc=linux-actions@lists.infradead.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=linux-pm@vger.kernel.org \ --cc=manivannan.sadhasivam@linaro.org \ --cc=matthias.bgg@gmail.com \ --cc=rjui@broadcom.com \ --cc=sbranden@broadcom.com \ --cc=sean.wang@mediatek.com \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.