From patchwork Mon Jul 24 20:53:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jasmin J." X-Patchwork-Id: 42752 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZkMO-00035U-OG; Mon, 24 Jul 2017 20:53:49 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756018AbdGXUxp (ORCPT + 1 other); Mon, 24 Jul 2017 16:53:45 -0400 Received: from mail.anw.at ([195.234.101.228]:36493 "EHLO mail.anw.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753359AbdGXUxo (ORCPT ); Mon, 24 Jul 2017 16:53:44 -0400 Received: from hoppel.217.196.72.190 (anwhome.anw.at [195.234.103.23]) by mail.anw.at (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id v6OKrgHt002261; Mon, 24 Jul 2017 22:53:42 +0200 From: "Jasmin J." To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, d.scheller@gmx.net, jasmin@anw.at Subject: [PATCH V2 1/3] build: Add compat code for pm_runtime_get_if_in_use Date: Mon, 24 Jul 2017 22:53:35 +0200 Message-Id: <1500929617-13623-2-git-send-email-jasmin@anw.at> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500929617-13623-1-git-send-email-jasmin@anw.at> References: <1500929617-13623-1-git-send-email-jasmin@anw.at> X-Antivirus: checked in 0.019sec at mail.anw.at ([195.234.102.72]) by smf-clamd v1.2.1 - http://smfs.sf.net/ Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Jasmin Jessich Signed-off-by: Jasmin Jessich --- 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");