compat: backport pm_qos_*_request
authorFelix Fietkau <nbd@openwrt.org>
Wed, 10 Nov 2010 22:50:00 +0000 (14:50 -0800)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 10 Nov 2010 22:50:00 +0000 (14:50 -0800)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
include/linux/compat-2.6.36.h

index 1d929d7917c5c7802f34d56feb73811fa92df16e..4f6e24c8845b2fc82d55f6a37ffb5c6ed4de7c20 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/usb.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
+#include <linux/pm_qos_params.h>
 
 #define kparam_block_sysfs_write(a)
 #define kparam_unblock_sysfs_write(a)
@@ -56,6 +57,39 @@ static inline int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t wh
        return pcmcia_access_configuration_register(p_dev, &reg);
 }
 
+struct pm_qos_request_list {
+       u32 qos;
+       void *request;
+};
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
+
+#define pm_qos_add_request(_req, _class, _value) do {                  \
+       (_req)->request = #_req;                                        \
+       (_req)->qos = _class;                                           \
+       pm_qos_add_requirement((_class), (_req)->request, (_value));    \
+    } while(0)
+
+#define pm_qos_update_request(_req, _value)                            \
+       pm_qos_update_requirement((_req)->qos, (_req)->request, (_value))
+
+#define pm_qos_remove_request(_req)                                    \
+       pm_qos_remove_requirement((_req)->qos, (_req)->request)
+
+#else
+
+#define pm_qos_add_request(_req, _class, _value) do {                  \
+       (_req)->request = pm_qos_add_request((_class), (_value));       \
+    } while (0)
+
+#define pm_qos_update_request(_req, _value)                            \
+       pm_qos_update_request((_req)->request, (_value)
+
+#define pm_qos_remove_request(_req)                                    \
+       pm_qos_remove_request((_req)->request)
+
+#endif
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
 
 #endif /* LINUX_26_36_COMPAT_H */