All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: Add fallbacks for dm functions
@ 2022-09-23 18:30 Sean Anderson
  2022-09-24 14:01 ` Simon Glass
  2022-10-11 19:40 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Sean Anderson @ 2022-09-23 18:30 UTC (permalink / raw)
  To: u-boot, Simon Glass; +Cc: Rasmus Villemoes, Sean Anderson

This adds fallbacks for the various dm_rtc_* functions. This allows
common code to use these functions without ifdefs.

Fixes: c8ce7ba87d1 ("misc: Add support for nvmem cells")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

 include/rtc.h | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/include/rtc.h b/include/rtc.h
index 10104e3bf5a..4bd5f7468d0 100644
--- a/include/rtc.h
+++ b/include/rtc.h
@@ -17,11 +17,9 @@
 #include <rtc_def.h>
 
 typedef int64_t time64_t;
-
-#ifdef CONFIG_DM_RTC
-
 struct udevice;
 
+#if CONFIG_IS_ENABLED(DM_RTC)
 struct rtc_ops {
 	/**
 	 * get() - get the current time
@@ -222,6 +220,33 @@ int rtc_enable_32khz_output(int busnum, int chip_addr);
 #endif
 
 #else
+static inline int dm_rtc_get(struct udevice *dev, struct rtc_time *time)
+{
+	return -ENOSYS;
+}
+
+static inline int dm_rtc_set(struct udevice *dev, struct rtc_time *time)
+{
+	return -ENOSYS;
+}
+
+static inline int dm_rtc_reset(struct udevice *dev)
+{
+	return -ENOSYS;
+}
+
+static inline int dm_rtc_read(struct udevice *dev, unsigned int reg, u8 *buf,
+			      unsigned int len)
+{
+	return -ENOSYS;
+}
+
+static inline int dm_rtc_write(struct udevice *dev, unsigned int reg,
+			       const u8 *buf, unsigned int len)
+{
+	return -ENOSYS;
+}
+
 int rtc_get (struct rtc_time *);
 int rtc_set (struct rtc_time *);
 void rtc_reset (void);
-- 
2.35.1.1320.gc452695387.dirty


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

* Re: [PATCH] rtc: Add fallbacks for dm functions
  2022-09-23 18:30 [PATCH] rtc: Add fallbacks for dm functions Sean Anderson
@ 2022-09-24 14:01 ` Simon Glass
  2022-10-11 19:40 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-09-24 14:01 UTC (permalink / raw)
  To: Sean Anderson; +Cc: U-Boot Mailing List, Rasmus Villemoes

On Fri, 23 Sept 2022 at 12:30, Sean Anderson <sean.anderson@seco.com> wrote:
>
> This adds fallbacks for the various dm_rtc_* functions. This allows
> common code to use these functions without ifdefs.
>
> Fixes: c8ce7ba87d1 ("misc: Add support for nvmem cells")
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>
>  include/rtc.h | 31 ++++++++++++++++++++++++++++---
>  1 file changed, 28 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH] rtc: Add fallbacks for dm functions
  2022-09-23 18:30 [PATCH] rtc: Add fallbacks for dm functions Sean Anderson
  2022-09-24 14:01 ` Simon Glass
@ 2022-10-11 19:40 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-10-11 19:40 UTC (permalink / raw)
  To: Sean Anderson; +Cc: u-boot, Simon Glass, Rasmus Villemoes

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

On Fri, Sep 23, 2022 at 02:30:16PM -0400, Sean Anderson wrote:

> This adds fallbacks for the various dm_rtc_* functions. This allows
> common code to use these functions without ifdefs.
> 
> Fixes: c8ce7ba87d1 ("misc: Add support for nvmem cells")
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

This breaks a number of platforms such as malta64el:
+include/rtc.h: In function 'dm_rtc_get':
+include/rtc.h:225:17: error: 'ENOSYS' undeclared (first use in this function)
+  225 |         return -ENOSYS;
+      |                 ^~~~~~

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2022-10-11 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 18:30 [PATCH] rtc: Add fallbacks for dm functions Sean Anderson
2022-09-24 14:01 ` Simon Glass
2022-10-11 19:40 ` Tom Rini

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.