diff mbox

[1/3] timebase: Add nanosleep_nopoll

Message ID 20150216151522.1774.34084.stgit@thinktux.in.ibm.com
State Accepted
Headers show

Commit Message

Ananth N Mavinakayanahalli Feb. 16, 2015, 3:15 p.m. UTC
For use by hservices mainly...

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
 core/timebase.c    |   11 +++++++++++
 include/timebase.h |    2 ++
 2 files changed, 13 insertions(+)

Comments

Benjamin Herrenschmidt Feb. 16, 2015, 9:14 p.m. UTC | #1
On Mon, 2015-02-16 at 20:45 +0530, Ananth N Mavinakayanahalli wrote:
> For use by hservices mainly...
> 
> Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  core/timebase.c    |   11 +++++++++++
>  include/timebase.h |    2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/core/timebase.c b/core/timebase.c
> index 9321373..ff26689 100644
> --- a/core/timebase.c
> +++ b/core/timebase.c
> @@ -104,3 +104,14 @@ int nanosleep(const struct timespec *req, struct timespec *rem)
>  	}
>  	return 0;
>  }
> +
> +int nanosleep_nopoll(const struct timespec *req, struct timespec *rem)
> +{
> +	time_wait_nopoll(timespec_to_tb(req));
> +
> +	if (rem) {
> +		rem->tv_sec = 0;
> +		rem->tv_nsec = 0;
> +	}
> +	return 0;
> +}
> diff --git a/include/timebase.h b/include/timebase.h
> index 156c296..7f5afe1 100644
> --- a/include/timebase.h
> +++ b/include/timebase.h
> @@ -98,4 +98,6 @@ extern void time_wait_ms_nopoll(unsigned long ms);
>  extern void time_wait_us(unsigned long us);
>  extern void time_wait_us_nopoll(unsigned long us);
>  
> +/* nanosleep_nopoll - variant for use from hostservices */
> +extern int nanosleep_nopoll(const struct timespec *req, struct timespec *rem);
>  #endif /* __TIME_H */
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
diff mbox

Patch

diff --git a/core/timebase.c b/core/timebase.c
index 9321373..ff26689 100644
--- a/core/timebase.c
+++ b/core/timebase.c
@@ -104,3 +104,14 @@  int nanosleep(const struct timespec *req, struct timespec *rem)
 	}
 	return 0;
 }
+
+int nanosleep_nopoll(const struct timespec *req, struct timespec *rem)
+{
+	time_wait_nopoll(timespec_to_tb(req));
+
+	if (rem) {
+		rem->tv_sec = 0;
+		rem->tv_nsec = 0;
+	}
+	return 0;
+}
diff --git a/include/timebase.h b/include/timebase.h
index 156c296..7f5afe1 100644
--- a/include/timebase.h
+++ b/include/timebase.h
@@ -98,4 +98,6 @@  extern void time_wait_ms_nopoll(unsigned long ms);
 extern void time_wait_us(unsigned long us);
 extern void time_wait_us_nopoll(unsigned long us);
 
+/* nanosleep_nopoll - variant for use from hostservices */
+extern int nanosleep_nopoll(const struct timespec *req, struct timespec *rem);
 #endif /* __TIME_H */