summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-01-14 08:28:28 +1000
committerBen Skeggs <bskeggs@redhat.com>2013-11-08 15:05:49 +1000
commitcda72b4db14efddb6aebac9c46220282b9c460dd (patch)
treedcf9252c46748a81273236e9924dd58d065bf467 /lib
parentce6612031448a3a91c759af8c344733706e0a6ff (diff)
downloadnouveau-cda72b4db14efddb6aebac9c46220282b9c460dd.tar.gz
clk: implement power state and engine clock control in core
User control of this has been hard-coded as disabled for now. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/core/os.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/core/os.h b/lib/core/os.h
index 7f23f9ad0..08934bd40 100644
--- a/lib/core/os.h
+++ b/lib/core/os.h
@@ -226,10 +226,34 @@ struct kref {
* string
*****************************************************************************/
#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
#define kstrdup(a,b) strdup((a))
#define kstrndup(a,b,c) strndup((a), (b))
+static inline int
+kstrtol(const char *s, unsigned int base, long *res)
+{
+ *res = strtol(s, NULL, base);
+ if (errno && *res == LONG_MAX)
+ return errno;
+ if (errno && *res == 0)
+ return errno;
+ return 0;
+}
+
+static inline int
+kstrtoul(const char *s, unsigned int base, unsigned long *res)
+{
+ *res = strtoul(s, NULL, base);
+ if (errno && *res == ULONG_MAX)
+ return errno;
+ if (errno && *res == 0)
+ return errno;
+ return 0;
+}
+
/******************************************************************************
* printk
*****************************************************************************/
@@ -249,8 +273,6 @@ struct kref {
/******************************************************************************
* memory
*****************************************************************************/
-#include <stdlib.h>
-
#define GFP_KERNEL 1
#define __GFP_ZERO 2
#define GFP_DMA32 4
@@ -293,7 +315,6 @@ __free_page(struct page *page)
/******************************************************************************
* assertions
*****************************************************************************/
-#include <errno.h>
#include <assert.h>
#include <execinfo.h>