Skip to contentSkip to conversation

iio: use boot time instead of realtime

PATCH In review Keith Mok 3 participants 3 messages Feb 3, 2016 – Feb 4, 2016 IIO

lore
Share & tools
lore

Keith Mok

author
#0 lore raw

PATCH 1/1 iio: use boot time instead of realtime

From: Keith Mok <[email protected]>

Advanced sensor has fifo/ring buffer internally, they can store data when the system is suspend, we need a timestamp that is able to take into account of the time when the system is suspend also.

---
 include/linux/iio/iio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iio/iio.h +1 -1
index b589411..7092877 100644
@@ -286,7 +286,7 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
  **/
 static inline s64 iio_get_time_ns(void)
 {
-	return ktime_get_real_ns();
+	return ktime_get_boot_ns();
 }
 
 /* Device operating modes */
Signature · 1 line
2.5.1
#1 lore raw

Seems like doing a blanket change like this would break a lot of drivers since it changes the core ABI

Quoted 32 lines · Keith Mok

From: Keith Mok <[email protected]>

Advanced sensor has fifo/ring buffer internally, they can store data when the system is suspend, we need a timestamp that is able to take into account of the time when the system is suspend also.

---
 include/linux/iio/iio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iio/iio.h +1 -2
index b589411..7092877 100644
@@ -286,7 +286,7 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
  **/
 static inline s64 iio_get_time_ns(void)
 {
-       return ktime_get_real_ns();
+       return ktime_get_boot_ns();
 }
 
 /* Device operating modes */
--

2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 2 lines · Matt Ranostay

Seems like doing a blanket change like this would break a lot of drivers since it changes the core ABI

And I think the commit does not quite do what the description says. ktime_get_real_ns() should account for the time when the system is in suspend.

Keith, please have a look at this discussion for a better approach to solving this problem while keeping ABI compatibility:
http://marc.info/?l=linux-iio&m=145449725410306&w=2

Thanks for looking into this important issue.

- Lars

Quoted 39 lines · Keith Mok
Quoted 28 lines

From: Keith Mok <[email protected]>

Advanced sensor has fifo/ring buffer internally, they can store data when the system is suspend, we need a timestamp that is able to take into account of the time when the system is suspend also.

---
 include/linux/iio/iio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iio/iio.h +1 -2
index b589411..7092877 100644
@@ -286,7 +286,7 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
  **/
 static inline s64 iio_get_time_ns(void)
 {
-       return ktime_get_real_ns();
+       return ktime_get_boot_ns();
 }
 
 /* Device operating modes */
--

2.5.1

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html