summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/completion.h44
-rw-r--r--include/linux/ioport.h16
-rw-r--r--include/linux/kernel.h14
3 files changed, 37 insertions, 37 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 9835826d285..d99ac450e8c 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -129,42 +129,14 @@ extern void complete_all(struct completion *);
#define wait_for_completion(x) do {} while (0)
#define wait_for_completion_io(x) do {} while (0)
-inline int wait_for_completion_interruptible(struct completion *x)
-{
- return 1;
-}
-inline int wait_for_completion_killable(struct completion *x)
-{
- return 1;
-}
-inline unsigned long wait_for_completion_timeout(struct completion *x,
- unsigned long timeout)
-{
- return 1;
-}
-inline unsigned long wait_for_completion_io_timeout(struct completion *x,
- unsigned long timeout)
-{
- return 1;
-}
-inline long wait_for_completion_interruptible_timeout(struct completion *x,
- unsigned long timeout)
-{
- return 1;
-}
-inline long wait_for_completion_killable_timeout(struct completion *x,
- unsigned long timeout)
-{
- return 1;
-}
-inline bool try_wait_for_completion(struct completion *x)
-{
- return 1;
-}
-inline bool completion_done(struct completion *x)
-{
- return 1;
-}
+#define wait_for_completion_interruptible(x) 1
+#define wait_for_completion_killable(x) 1
+#define wait_for_completion_timeout(x, timeout) 1
+#define wait_for_completion_io_timeout(x, timeout) 1
+#define wait_for_completion_interruptible_timeout(x, timeout) 1
+#define wait_for_completion_killable_timeout(x, timeout) 1
+#define try_wait_for_completion(x) 1
+#define completion_done(x) 1
#define complete(x) do {} while (0)
#define complete_all(x) do {} while (0)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 85288c3729a..c12a7f70ad7 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -135,6 +135,22 @@ static inline unsigned long resource_type(const struct resource *res)
return res->flags & IORESOURCE_TYPE_BITS;
}
+/* True iff r1 completely contains r2 */
+static inline bool resource_contains(struct resource *r1, struct resource *r2)
+{
+ if (resource_type(r1) != resource_type(r2))
+ return false;
+ if (r1->flags & IORESOURCE_UNSET || r2->flags & IORESOURCE_UNSET)
+ return false;
+ return r1->start <= r2->start && r1->end >= r2->end;
+}
+
+/* True if any part of r1 overlaps r2 */
+static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
+{
+ return r1->start <= r2->end && r1->end >= r2->start;
+}
+
/* Convenience shorthand with allocation */
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e0443ecac84..44a639a5e4e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -111,7 +111,19 @@
* lower_32_bits - return bits 0-31 of a number
* @n: the number we're accessing
*/
-#define lower_32_bits(n) ((u32)(n))
+#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
+
+/**
+ * upper_16_bits - return bits 16-31 of a number
+ * @n: the number we're accessing
+ */
+#define upper_16_bits(n) ((u16)((n) >> 16))
+
+/**
+ * lower_16_bits - return bits 0-15 of a number
+ * @n: the number we're accessing
+ */
+#define lower_16_bits(n) ((u16)((n) & 0xffff))
/*
* abs() handles unsigned and signed longs, ints, shorts and chars. For all