linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: Add some dummy static inline functions
@ 2016-09-07  7:17 Baolin Wang
  2016-09-07 12:12 ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Baolin Wang @ 2016-09-07  7:17 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni
  Cc: rostedt, mingo, john.stultz, tglx, baolin.wang, broonie,
	linux-kernel, rtc-linux

Add some dummy static inline functions in case CONFIG_RTC_LIB is not defined.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Fixes: a0a6e06d545a ("time: alarmtimer: Add tracepoints for alarmtimers")
---
 include/linux/rtc.h |   49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index b693ada..521f752 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -16,13 +16,60 @@
 #include <linux/interrupt.h>
 #include <uapi/linux/rtc.h>
 
+#ifdef CONFIG_RTC_LIB
 extern int rtc_month_days(unsigned int month, unsigned int year);
-extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
+extern int rtc_year_days(unsigned int day, unsigned int month,
+			 unsigned int year);
 extern int rtc_valid_tm(struct rtc_time *tm);
 extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
 extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
 ktime_t rtc_tm_to_ktime(struct rtc_time tm);
 struct rtc_time rtc_ktime_to_tm(ktime_t kt);
+#else
+static inline int rtc_month_days(unsigned int month, unsigned int year)
+{
+	return 0;
+}
+
+static inline int rtc_year_days(unsigned int day, unsigned int month,
+				unsigned int year)
+{
+	return 0;
+}
+
+static inline int rtc_valid_tm(struct rtc_time *tm)
+{
+	return 0;
+}
+
+static inline time64_t rtc_tm_to_time64(struct rtc_time *tm)
+{
+	time64_t ret;
+
+	memset(&ret, 0, sizeof(time64_t));
+	return ret;
+}
+
+static inline void rtc_time64_to_tm(time64_t time, struct rtc_time *tm)
+{
+}
+
+static inline ktime_t rtc_tm_to_ktime(struct rtc_time tm)
+{
+	ktime_t ret;
+
+	memset(&ret, 0, sizeof(ktime_t));
+	return ret;
+}
+
+static inline struct rtc_time rtc_ktime_to_tm(ktime_t kt)
+{
+	struct rtc_time ret;
+
+	memset(&ret, 0, sizeof(struct rtc_time));
+	return ret;
+}
+#endif
 
 /*
  * rtc_tm_sub - Return the difference in seconds.
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: Add some dummy static inline functions
  2016-09-07  7:17 [PATCH] rtc: Add some dummy static inline functions Baolin Wang
@ 2016-09-07 12:12 ` Alexandre Belloni
  2016-09-07 12:47   ` Baolin Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2016-09-07 12:12 UTC (permalink / raw)
  To: Baolin Wang
  Cc: a.zummo, rostedt, mingo, john.stultz, tglx, broonie,
	linux-kernel, rtc-linux

On 07/09/2016 at 15:17:26 +0800, Baolin Wang wrote :
> Add some dummy static inline functions in case CONFIG_RTC_LIB is not defined.
> 

The question your commit log should answer is why?

> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> Fixes: a0a6e06d545a ("time: alarmtimer: Add tracepoints for alarmtimers")
> ---
>  include/linux/rtc.h |   49 ++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 48 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> index b693ada..521f752 100644
> --- a/include/linux/rtc.h
> +++ b/include/linux/rtc.h
> @@ -16,13 +16,60 @@
>  #include <linux/interrupt.h>
>  #include <uapi/linux/rtc.h>
>  
> +#ifdef CONFIG_RTC_LIB
>  extern int rtc_month_days(unsigned int month, unsigned int year);
> -extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
> +extern int rtc_year_days(unsigned int day, unsigned int month,
> +			 unsigned int year);
>  extern int rtc_valid_tm(struct rtc_time *tm);
>  extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
>  extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
>  ktime_t rtc_tm_to_ktime(struct rtc_time tm);
>  struct rtc_time rtc_ktime_to_tm(ktime_t kt);
> +#else
> +static inline int rtc_month_days(unsigned int month, unsigned int year)
> +{
> +	return 0;
> +}
> +
> +static inline int rtc_year_days(unsigned int day, unsigned int month,
> +				unsigned int year)
> +{
> +	return 0;
> +}
> +
> +static inline int rtc_valid_tm(struct rtc_time *tm)
> +{
> +	return 0;
> +}
> +
> +static inline time64_t rtc_tm_to_time64(struct rtc_time *tm)
> +{
> +	time64_t ret;
> +
> +	memset(&ret, 0, sizeof(time64_t));
> +	return ret;
> +}
> +
> +static inline void rtc_time64_to_tm(time64_t time, struct rtc_time *tm)
> +{
> +}
> +
> +static inline ktime_t rtc_tm_to_ktime(struct rtc_time tm)
> +{
> +	ktime_t ret;
> +
> +	memset(&ret, 0, sizeof(ktime_t));
> +	return ret;
> +}
> +
> +static inline struct rtc_time rtc_ktime_to_tm(ktime_t kt)
> +{
> +	struct rtc_time ret;
> +
> +	memset(&ret, 0, sizeof(struct rtc_time));
> +	return ret;
> +}
> +#endif
>  
>  /*
>   * rtc_tm_sub - Return the difference in seconds.
> -- 
> 1.7.9.5
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: Add some dummy static inline functions
  2016-09-07 12:12 ` Alexandre Belloni
@ 2016-09-07 12:47   ` Baolin Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Baolin Wang @ 2016-09-07 12:47 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Steven Rostedt, Ingo Molnar, John Stultz,
	Thomas Gleixner, Mark Brown, LKML, rtc-linux

Hi,

On 7 September 2016 at 20:12, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> On 07/09/2016 at 15:17:26 +0800, Baolin Wang wrote :
>> Add some dummy static inline functions in case CONFIG_RTC_LIB is not defined.
>>
>
> The question your commit log should answer is why?

I will add the commit log to explain why like below, thanks.

The patch (commit id: a0a6e06d545a753740c9d8d5ce2c4fdd3ab1c021) adding
tracepoints for alarmtimers will build failed on S390 platform, due to
S390 defconfig did not define CONFIG_RTC_LIB macro to define the
rtc_ktime_to_tm() function which is used in this patch. Thus we should
add dummy static inline functions in case CONFIG_RTC_LIB is not
defined.

>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>> Fixes: a0a6e06d545a ("time: alarmtimer: Add tracepoints for alarmtimers")
>> ---
>>  include/linux/rtc.h |   49 ++++++++++++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 48 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/rtc.h b/include/linux/rtc.h
>> index b693ada..521f752 100644
>> --- a/include/linux/rtc.h
>> +++ b/include/linux/rtc.h
>> @@ -16,13 +16,60 @@
>>  #include <linux/interrupt.h>
>>  #include <uapi/linux/rtc.h>
>>
>> +#ifdef CONFIG_RTC_LIB
>>  extern int rtc_month_days(unsigned int month, unsigned int year);
>> -extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
>> +extern int rtc_year_days(unsigned int day, unsigned int month,
>> +                      unsigned int year);
>>  extern int rtc_valid_tm(struct rtc_time *tm);
>>  extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
>>  extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
>>  ktime_t rtc_tm_to_ktime(struct rtc_time tm);
>>  struct rtc_time rtc_ktime_to_tm(ktime_t kt);
>> +#else
>> +static inline int rtc_month_days(unsigned int month, unsigned int year)
>> +{
>> +     return 0;
>> +}
>> +
>> +static inline int rtc_year_days(unsigned int day, unsigned int month,
>> +                             unsigned int year)
>> +{
>> +     return 0;
>> +}
>> +
>> +static inline int rtc_valid_tm(struct rtc_time *tm)
>> +{
>> +     return 0;
>> +}
>> +
>> +static inline time64_t rtc_tm_to_time64(struct rtc_time *tm)
>> +{
>> +     time64_t ret;
>> +
>> +     memset(&ret, 0, sizeof(time64_t));
>> +     return ret;
>> +}
>> +
>> +static inline void rtc_time64_to_tm(time64_t time, struct rtc_time *tm)
>> +{
>> +}
>> +
>> +static inline ktime_t rtc_tm_to_ktime(struct rtc_time tm)
>> +{
>> +     ktime_t ret;
>> +
>> +     memset(&ret, 0, sizeof(ktime_t));
>> +     return ret;
>> +}
>> +
>> +static inline struct rtc_time rtc_ktime_to_tm(ktime_t kt)
>> +{
>> +     struct rtc_time ret;
>> +
>> +     memset(&ret, 0, sizeof(struct rtc_time));
>> +     return ret;
>> +}
>> +#endif
>>
>>  /*
>>   * rtc_tm_sub - Return the difference in seconds.
>> --
>> 1.7.9.5
>>
>
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com



-- 
Baolin.wang
Best Regards

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-07 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07  7:17 [PATCH] rtc: Add some dummy static inline functions Baolin Wang
2016-09-07 12:12 ` Alexandre Belloni
2016-09-07 12:47   ` Baolin Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).