From e2336a07bb6356b5d867a7bd363dc5f8ddefbcc7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 18 Feb 2015 08:23:10 -0600 Subject: [PATCH] The RTC ioctl() method is now a configuration option --- arch/arm/src/stm32/stm32_rtc_lowerhalf.c | 2 ++ drivers/timers/Kconfig | 7 +++++++ drivers/timers/rtc.c | 2 ++ include/nuttx/rtc.h | 4 +++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c index 7c4aaf221b5..c56970b0c24 100644 --- a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c @@ -118,7 +118,9 @@ static const struct rtc_ops_s g_rtc_ops = .rdwkalm = NULL, .setwkalm = NULL, #endif +#ifdef CONFIG_RTC_IOCTL .ioctl = NULL, +#endif .destroy = NULL, }; diff --git a/drivers/timers/Kconfig b/drivers/timers/Kconfig index af0fb3e42ca..ee4698d882b 100644 --- a/drivers/timers/Kconfig +++ b/drivers/timers/Kconfig @@ -107,6 +107,13 @@ config RTC_EPOCHYEAR With some RTCs, these operations can be used to read or to set the RTC's Epoch, respectively. +config RTC_IOCTL + bool "RTC IOCTLs" + default n + ---help--- + Support the RTC interface ioctl() method. This allows you to add + architecture-specific RTC operations to the RTC interface + endif # RTC_DRIVER endif # RTC diff --git a/drivers/timers/rtc.c b/drivers/timers/rtc.c index f3231ded11f..6550131e4b3 100644 --- a/drivers/timers/rtc.c +++ b/drivers/timers/rtc.c @@ -509,10 +509,12 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) default: { ret = -ENOTTY; +#ifdef CONFIG_RTC_IOCTL if (ops->ioctl) { ret = ops->ioctl(upper->lower, cmd, arg); } +#endif } break; } diff --git a/include/nuttx/rtc.h b/include/nuttx/rtc.h index d9a4e45d7dc..ba8add61a39 100644 --- a/include/nuttx/rtc.h +++ b/include/nuttx/rtc.h @@ -416,11 +416,13 @@ struct rtc_ops_s FAR const struct rtc_wkalrm *wkalrm); #endif +#ifdef CONFIG_RTC_IOCTL /* Support for architecture-specific RTC operations */ CODE int (*ioctl)(FAR struct rtc_lowerhalf_s *lower, int cmd, unsigned long arg); - +#endif + /* The driver has been unlinked and there are no further open references * to the driver. */