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: 9860533 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 79D9D60349 for ; Mon, 24 Jul 2017 20:53:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D63A20265 for ; Mon, 24 Jul 2017 20:53:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61EBC26224; Mon, 24 Jul 2017 20:53:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6480520265 for ; Mon, 24 Jul 2017 20:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756018AbdGXUxp (ORCPT ); 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 X-Virus-Scanned: ClamAV using ClamSMTP 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");