From patchwork Tue Mar 31 16:14:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6131681 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7C9C79F1BE for ; Tue, 31 Mar 2015 16:16:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ABCBD201B9 for ; Tue, 31 Mar 2015 16:16:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D472C2010E for ; Tue, 31 Mar 2015 16:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753013AbbCaQPy (ORCPT ); Tue, 31 Mar 2015 12:15:54 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:36602 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752855AbbCaQPu (ORCPT ); Tue, 31 Mar 2015 12:15:50 -0400 Received: by wixo5 with SMTP id o5so19774435wix.1; Tue, 31 Mar 2015 09:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZgCVjxRazKTgscQGBvOAUAyM+bEEEP4AOINA32zTO/U=; b=dgFa1q1HS7NtvSA9mDdEIOdP0lnzgGCM0c5/bPrltF4VCiL5RZJ/TKjXOUCclZCf0/ 7xach/yCFzuxtSDGzixzxxyZfQRUXvgKCeJI/Vs1mQUrWA9XXsjQStWGT6MwclyKZcBK S4ntlY3Zzq51MxTT7zR+w/DGoVIS/iPCFa1+FErCNu9y8PQfqgmAmyj1dcIukMFQnz7M 49qqVdCM+4NcH/s4hQ0/oPjvzA9Yc0lPXxegMSYzOd2ZukIvtLXgDOkmcATvaC7MGSG5 8TykYXZYgLMJJZPVAXDn4hNlPVQ8HSdaSgfLRI3LnLNKJWQibuZtHhqu98n95uwJwiKm M+og== X-Received: by 10.180.206.13 with SMTP id lk13mr6738948wic.35.1427818549081; Tue, 31 Mar 2015 09:15:49 -0700 (PDT) Received: from cizrna.lan ([109.72.12.56]) by mx.google.com with ESMTPSA id lx10sm20984796wjb.17.2015.03.31.09.15.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 09:15:48 -0700 (PDT) From: Tomeu Vizoso To: linux-pm@vger.kernel.org Cc: Tomeu Vizoso , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Ramakrishnan Muthukrishnan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] [media] v4l2-core: Implement dev_pm_ops.prepare() Date: Tue, 31 Mar 2015 18:14:46 +0200 Message-Id: <1427818501-10201-3-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1427818501-10201-1-git-send-email-tomeu.vizoso@collabora.com> References: <1427818501-10201-1-git-send-email-tomeu.vizoso@collabora.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Have it return 1 so that video devices that are runtime-suspended won't be suspended when the system goes to a sleep state. This can make resume times considerably shorter because these devices don't need to be resumed when the system is awaken. Signed-off-by: Tomeu Vizoso --- drivers/media/v4l2-core/v4l2-dev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index e2b8b3e..b74e3d3 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -219,9 +219,19 @@ static void v4l2_device_release(struct device *cd) v4l2_device_put(v4l2_dev); } +static int video_device_prepare(struct device *dev) +{ + return 1; +} + +static const struct dev_pm_ops video_device_pm_ops = { + .prepare = video_device_prepare, +}; + static struct class video_class = { .name = VIDEO_NAME, .dev_groups = video_device_groups, + .pm = &video_device_pm_ops, }; struct video_device *video_devdata(struct file *file)