summaryrefslogtreecommitdiff
path: root/libdde_linux26/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'libdde_linux26/include/linux')
-rw-r--r--libdde_linux26/include/linux/firmware.h75
-rw-r--r--libdde_linux26/include/linux/spinlock.h19
2 files changed, 85 insertions, 9 deletions
diff --git a/libdde_linux26/include/linux/firmware.h b/libdde_linux26/include/linux/firmware.h
new file mode 100644
index 00000000..06e7a1ce
--- /dev/null
+++ b/libdde_linux26/include/linux/firmware.h
@@ -0,0 +1,75 @@
+#ifndef _LINUX_FIRMWARE_H
+#define _LINUX_FIRMWARE_H
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/compiler.h>
+
+#define FIRMWARE_NAME_MAX 30
+#define FW_ACTION_NOHOTPLUG 0
+#define FW_ACTION_HOTPLUG 1
+
+struct firmware {
+ size_t size;
+ const u8 *data;
+};
+
+struct device;
+
+struct builtin_fw {
+ char *name;
+ void *data;
+ unsigned long size;
+};
+
+/* We have to play tricks here much like stringify() to get the
+ __COUNTER__ macro to be expanded as we want it */
+#define __fw_concat1(x, y) x##y
+#define __fw_concat(x, y) __fw_concat1(x, y)
+
+#define DECLARE_BUILTIN_FIRMWARE(name, blob) \
+ DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob))
+
+#define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \
+ static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
+ __used __section(.builtin_fw) = { name, blob, size }
+
+#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
+int request_firmware(const struct firmware **fw, const char *name,
+ struct device *device);
+int request_firmware_nowait(
+ struct module *module, int uevent,
+ const char *name, struct device *device, void *context,
+ void (*cont)(const struct firmware *fw, void *context));
+
+void release_firmware(const struct firmware *fw);
+#else
+#ifdef DDE_LINUX
+#include <ddekit/printf.h>
+#endif
+static inline int request_firmware(const struct firmware **fw,
+ const char *name,
+ struct device *device)
+{
+#ifdef DDE_LINUX
+ ddekit_printf("firmware %s requested, but not implemented\n", name);
+#endif
+ return -EINVAL;
+}
+static inline int request_firmware_nowait(
+ struct module *module, int uevent,
+ const char *name, struct device *device, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+#ifdef DDE_LINUX
+ ddekit_printf("firmware %s requested, but not implemented\n", name);
+#endif
+ return -EINVAL;
+}
+
+static inline void release_firmware(const struct firmware *fw)
+{
+}
+#endif
+
+#endif
diff --git a/libdde_linux26/include/linux/spinlock.h b/libdde_linux26/include/linux/spinlock.h
index 6830752b..ab862f99 100644
--- a/libdde_linux26/include/linux/spinlock.h
+++ b/libdde_linux26/include/linux/spinlock.h
@@ -372,10 +372,6 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
#else /* DDE_LINUX */
-unsigned long fake_local_irq_disable_flags(void);
-void fake_local_irq_enable(void);
-void fake_local_irq_restore(unsigned long flags);
-
#define spin_lock_init(l) \
do { \
ddekit_lock_init(&(l)->ddekit_lock); \
@@ -398,7 +394,7 @@ void fake_local_irq_restore(unsigned long flags);
#define read_lock(lock) spin_lock(lock)
#define write_lock(lock) spin_lock(lock)
-#define spin_lock_irq(lock) fake_local_irq_disable_flags(); spin_lock(lock)
+#define spin_lock_irq(lock) local_irq_disable(); spin_lock(lock)
#define spin_lock_bh(lock) spin_lock(lock)
#define read_lock_irq(lock) spin_lock_irq(lock)
#define read_lock_bh(lock) spin_lock_bh(lock)
@@ -415,7 +411,7 @@ void fake_local_irq_restore(unsigned long flags);
#define read_unlock(lock) spin_unlock(lock)
#define write_unlock(lock) spin_unlock(lock)
-#define spin_unlock_irq(lock) spin_unlock(lock); fake_local_irq_enable()
+#define spin_unlock_irq(lock) spin_unlock(lock); local_irq_enable()
#define spin_unlock_bh(lock) spin_unlock(lock)
#define read_unlock_irq(lock) spin_unlock_irq(lock)
#define read_unlock_bh(lock) spin_unlock_bh(lock)
@@ -424,7 +420,7 @@ void fake_local_irq_restore(unsigned long flags);
#define spin_lock_irqsave(lock, flags) \
do { \
- flags = fake_local_irq_disable_flags(); \
+ local_irq_save(flags); \
spin_lock(lock);\
} while (0);
@@ -434,7 +430,7 @@ void fake_local_irq_restore(unsigned long flags);
#define spin_unlock_irqrestore(lock, flags) \
do { \
spin_unlock(lock); \
- fake_local_irq_restore (flags); \
+ local_irq_restore(flags); \
} while (0);
#define read_unlock_irqrestore(lock, flags) spin_unlock_irqrestore(lock, flags)
@@ -450,7 +446,12 @@ static int __lockfunc spin_trylock(spinlock_t *lock)
#define _raw_spin_unlock(l) spin_unlock(l)
#define _raw_spin_trylock(l) spin_trylock(l)
-#define spin_trylock_irqsave(lock, flags) spin_trylock(lock)
+#define spin_trylock_irqsave(lock, flags) \
+({ \
+ local_irq_save(flags); \
+ spin_trylock(lock) ? \
+ 1 : ({ local_irq_restore(flags); 0; }); \
+})
#define read_trylock(l) spin_trylock(l)
#define write_trylock(l) read_trylock(l)