From: Jasmin Jessich <jas...@anw.at>

Signed-off-by: Jasmin Jessich <jas...@anw.at>
---
 v4l/compat.h                      | 15 +++++++++++++++
 v4l/scripts/make_config_compat.pl |  1 +
 2 files changed, 16 insertions(+)

diff --git a/v4l/compat.h b/v4l/compat.h
index e565292..b5b0846 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -2084,4 +2084,19 @@ static inline void *skb_put_data(struct sk_buff *skb, 
const void *data,
 }
 #endif
 
+#ifdef NEED_PM_RUNTIME_GET
+static inline int pm_runtime_get_if_in_use(struct device *dev)
+{
+       unsigned long flags;
+       int retval;
+
+       spin_lock_irqsave(&dev->power.lock, flags);
+       retval = dev->power.disable_depth > 0 ? -EINVAL :
+               dev->power.runtime_status == RPM_ACTIVE
+                       && atomic_inc_not_zero(&dev->power.usage_count);
+       spin_unlock_irqrestore(&dev->power.lock, flags);
+       return retval;
+}
+#endif
+
 #endif /*  _COMPAT_H */
diff --git a/v4l/scripts/make_config_compat.pl 
b/v4l/scripts/make_config_compat.pl
index 5ac59ab..be278aa 100644
--- a/v4l/scripts/make_config_compat.pl
+++ b/v4l/scripts/make_config_compat.pl
@@ -700,6 +700,7 @@ sub check_other_dependencies()
        check_files_for_func("to_of_node", "NEED_TO_OF_NODE", 
"include/linux/of.h");
        check_files_for_func("is_of_node", "NEED_IS_OF_NODE", 
"include/linux/of.h");
        check_files_for_func("skb_put_data", "NEED_SKB_PUT_DATA", 
"include/linux/skbuff.h");
+       check_files_for_func("pm_runtime_get_if_in_use", "NEED_PM_RUNTIME_GET", 
"include/linux/pm_runtime.h");
 
        # For tests for uapi-dependent logic
        check_files_for_func_uapi("usb_endpoint_maxp", 
"NEED_USB_ENDPOINT_MAXP", "usb/ch9.h");
-- 
2.7.4

Reply via email to