From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Linus Walleij <linus.walleij@linaro.org>,
Conor Dooley <conor.dooley@microchip.com>,
Daire McNamara <daire.mcnamara@microchip.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org, linux-rtc@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, linux-riscv@lists.infradead.org,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH v2 07/12] rtc: nxp-bbnsm: Use resource managed API to simplify code
Date: Fri, 03 Jan 2025 16:41:19 +0800 [thread overview]
Message-ID: <20250103-wake_irq-v2-7-e3aeff5e9966@nxp.com> (raw)
In-Reply-To: <20250103-wake_irq-v2-0-e3aeff5e9966@nxp.com>
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-nxp-bbnsm.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c
index fa3b0328c7a255ff8a902a58d61a4b0e59eac493..d4fc9dc583d317d4852b7d897a6c45cfff6961a2 100644
--- a/drivers/rtc/rtc-nxp-bbnsm.c
+++ b/drivers/rtc/rtc-nxp-bbnsm.c
@@ -189,36 +189,26 @@ static int bbnsm_rtc_probe(struct platform_device *pdev)
/* clear all the pending events */
regmap_write(bbnsm->regmap, BBNSM_EVENTS, 0x7A);
- device_init_wakeup(&pdev->dev, true);
- dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+ ret = devm_device_init_wakeup(&pdev->dev);
+ if (ret)
+ dev_err(&pdev->dev, "failed to init wakeup, %d\n", ret);
+
+ ret = devm_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+ if (ret)
+ dev_err(&pdev->dev, "failed to set wake irq, %d\n", ret);
ret = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_rtc_irq_handler,
IRQF_SHARED, "rtc alarm", &pdev->dev);
if (ret) {
dev_err(&pdev->dev, "failed to request irq %d: %d\n",
bbnsm->irq, ret);
- goto err;
+ return ret;
}
bbnsm->rtc->ops = &bbnsm_rtc_ops;
bbnsm->rtc->range_max = U32_MAX;
- ret = devm_rtc_register_device(bbnsm->rtc);
- if (ret)
- goto err;
-
- return 0;
-
-err:
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
- return ret;
-}
-
-static void bbnsm_rtc_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
+ return devm_rtc_register_device(bbnsm->rtc);
}
static const struct of_device_id bbnsm_dt_ids[] = {
@@ -233,7 +223,6 @@ static struct platform_driver bbnsm_rtc_driver = {
.of_match_table = bbnsm_dt_ids,
},
.probe = bbnsm_rtc_probe,
- .remove = bbnsm_rtc_remove,
};
module_platform_driver(bbnsm_rtc_driver);
--
2.37.1
WARNING: multiple messages have this Message-ID (diff)
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Linus Walleij <linus.walleij@linaro.org>,
Conor Dooley <conor.dooley@microchip.com>,
Daire McNamara <daire.mcnamara@microchip.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org, linux-rtc@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, linux-riscv@lists.infradead.org,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH v2 07/12] rtc: nxp-bbnsm: Use resource managed API to simplify code
Date: Fri, 03 Jan 2025 16:41:19 +0800 [thread overview]
Message-ID: <20250103-wake_irq-v2-7-e3aeff5e9966@nxp.com> (raw)
In-Reply-To: <20250103-wake_irq-v2-0-e3aeff5e9966@nxp.com>
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-nxp-bbnsm.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c
index fa3b0328c7a255ff8a902a58d61a4b0e59eac493..d4fc9dc583d317d4852b7d897a6c45cfff6961a2 100644
--- a/drivers/rtc/rtc-nxp-bbnsm.c
+++ b/drivers/rtc/rtc-nxp-bbnsm.c
@@ -189,36 +189,26 @@ static int bbnsm_rtc_probe(struct platform_device *pdev)
/* clear all the pending events */
regmap_write(bbnsm->regmap, BBNSM_EVENTS, 0x7A);
- device_init_wakeup(&pdev->dev, true);
- dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+ ret = devm_device_init_wakeup(&pdev->dev);
+ if (ret)
+ dev_err(&pdev->dev, "failed to init wakeup, %d\n", ret);
+
+ ret = devm_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+ if (ret)
+ dev_err(&pdev->dev, "failed to set wake irq, %d\n", ret);
ret = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_rtc_irq_handler,
IRQF_SHARED, "rtc alarm", &pdev->dev);
if (ret) {
dev_err(&pdev->dev, "failed to request irq %d: %d\n",
bbnsm->irq, ret);
- goto err;
+ return ret;
}
bbnsm->rtc->ops = &bbnsm_rtc_ops;
bbnsm->rtc->range_max = U32_MAX;
- ret = devm_rtc_register_device(bbnsm->rtc);
- if (ret)
- goto err;
-
- return 0;
-
-err:
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
- return ret;
-}
-
-static void bbnsm_rtc_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
+ return devm_rtc_register_device(bbnsm->rtc);
}
static const struct of_device_id bbnsm_dt_ids[] = {
@@ -233,7 +223,6 @@ static struct platform_driver bbnsm_rtc_driver = {
.of_match_table = bbnsm_dt_ids,
},
.probe = bbnsm_rtc_probe,
- .remove = bbnsm_rtc_remove,
};
module_platform_driver(bbnsm_rtc_driver);
--
2.37.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2025-01-03 8:53 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 8:41 [PATCH v2 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 01/12] PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-14 20:20 ` Rafael J. Wysocki
2025-01-14 20:20 ` Rafael J. Wysocki
2025-01-15 1:28 ` Peng Fan
2025-01-15 1:28 ` Peng Fan
2025-01-17 19:30 ` Rafael J. Wysocki
2025-01-17 19:30 ` Rafael J. Wysocki
2025-01-03 8:41 ` [PATCH v2 02/12] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 03/12] input: keyboard: omap4_keypad: " Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 04/12] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 05/12] input: touchscreen: ti_am335x_tsc: " Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 06/12] rtc: stm32: " Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-20 8:32 ` [Linux-stm32] " Antonio Borneo
2025-01-20 8:32 ` Antonio Borneo
2025-01-03 8:41 ` Peng Fan (OSS) [this message]
2025-01-03 8:41 ` [PATCH v2 07/12] rtc: nxp-bbnsm: " Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 08/12] rtc: ds1343: Use devm_pm_set_wake_irq Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 09/12] rtc: pm8xxx: " Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-14 12:17 ` Linus Walleij
2025-01-14 12:17 ` Linus Walleij
2025-01-03 8:41 ` [PATCH v2 10/12] rtc: ab8500: Use resource managed API to simplify code Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 11/12] rtc: mpfs: Use devm_pm_set_wake_irq Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-03 8:41 ` [PATCH v2 12/12] rtc: pl031: Use resource managed API to simplify code Peng Fan (OSS)
2025-01-03 8:41 ` Peng Fan (OSS)
2025-01-20 8:57 ` [PATCH v2 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan
2025-01-20 8:57 ` Peng Fan
2025-02-03 19:15 ` patchwork-bot+linux-riscv
2025-02-03 19:15 ` patchwork-bot+linux-riscv
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=20250103-wake_irq-v2-7-e3aeff5e9966@nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=conor.dooley@microchip.com \
--cc=daire.mcnamara@microchip.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=pavel@ucw.cz \
--cc=peng.fan@nxp.com \
--cc=rafael@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 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.