Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1488695 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-09-22 11:50 +0200 |
| Last post | 2016-09-22 14:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] rtc: cmos: avoid unused function warning Arnd Bergmann <arnd@arndb.de> - 2016-09-22 11:50 +0200
Re: [PATCH] rtc: cmos: avoid unused function warning Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-09-22 14:30 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-09-22 11:50 +0200 |
| Subject | [PATCH] rtc: cmos: avoid unused function warning |
| Message-ID | <sk8NH-4AG-11@gated-at.bofh.it> |
A bug fix for the ACPI side of this driver caused a harmless
build warning:
drivers/rtc/rtc-cmos.c:1115:13: error: 'cmos_check_acpi_rtc_status' defined but not used [-Werror=unused-function]
static void cmos_check_acpi_rtc_status(struct device *dev,
We can avoid the warning and simplify the driver at the same time
by removing the #ifdef for CONFIG_PM and rely on the SIMPLE_DEV_PM_OPS()
to set everything up correctly. cmos_resume() has to get marked
as __maybe_unused so we don't introduce another warning, and
the two variants of cmos_poweroff() can get merged into one using
an IS_ENABLED() check.
Fixes: 983bf1256edb ("rtc: cmos: Clear ACPI-driven alarms upon resume")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/rtc-cmos.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 2943a0d58a3a..dd3d59806ffa 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -848,8 +848,6 @@ static int cmos_aie_poweroff(struct device *dev)
return retval;
}
-#ifdef CONFIG_PM
-
static int cmos_suspend(struct device *dev)
{
struct cmos_rtc *cmos = dev_get_drvdata(dev);
@@ -898,11 +896,12 @@ static int cmos_suspend(struct device *dev)
*/
static inline int cmos_poweroff(struct device *dev)
{
+ if (!IS_ENABLED(CONFIG_PM))
+ return -ENOSYS;
+
return cmos_suspend(dev);
}
-#ifdef CONFIG_PM_SLEEP
-
static void cmos_check_wkalrm(struct device *dev)
{
struct cmos_rtc *cmos = dev_get_drvdata(dev);
@@ -922,7 +921,7 @@ static void cmos_check_wkalrm(struct device *dev)
static void cmos_check_acpi_rtc_status(struct device *dev,
unsigned char *rtc_control);
-static int cmos_resume(struct device *dev)
+static int __maybe_unused cmos_resume(struct device *dev)
{
struct cmos_rtc *cmos = dev_get_drvdata(dev);
unsigned char tmp;
@@ -975,16 +974,6 @@ static int cmos_resume(struct device *dev)
return 0;
}
-#endif
-#else
-
-static inline int cmos_poweroff(struct device *dev)
-{
- return -ENOSYS;
-}
-
-#endif
-
static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume);
/*----------------------------------------------------------------*/
@@ -1278,9 +1267,7 @@ static struct platform_driver cmos_platform_driver = {
.shutdown = cmos_platform_shutdown,
.driver = {
.name = driver_name,
-#ifdef CONFIG_PM
.pm = &cmos_pm_ops,
-#endif
.of_match_table = of_match_ptr(of_cmos_match),
}
};
--
2.9.0
[toc] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-09-22 14:30 +0200 |
| Message-ID | <skbiy-6i0-37@gated-at.bofh.it> |
| In reply to | #1488695 |
On 22/09/2016 at 11:48:00 +0200, Arnd Bergmann wrote :
> A bug fix for the ACPI side of this driver caused a harmless
> build warning:
>
> drivers/rtc/rtc-cmos.c:1115:13: error: 'cmos_check_acpi_rtc_status' defined but not used [-Werror=unused-function]
> static void cmos_check_acpi_rtc_status(struct device *dev,
>
> We can avoid the warning and simplify the driver at the same time
> by removing the #ifdef for CONFIG_PM and rely on the SIMPLE_DEV_PM_OPS()
> to set everything up correctly. cmos_resume() has to get marked
> as __maybe_unused so we don't introduce another warning, and
> the two variants of cmos_poweroff() can get merged into one using
> an IS_ENABLED() check.
>
> Fixes: 983bf1256edb ("rtc: cmos: Clear ACPI-driven alarms upon resume")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/rtc/rtc-cmos.c | 21 ++++-----------------
> 1 file changed, 4 insertions(+), 17 deletions(-)
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web