From patchwork Fri Apr 3 12:57:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6156611 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 2A7419F1BE for ; Fri, 3 Apr 2015 12:59:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5376A20353 for ; Fri, 3 Apr 2015 12:59:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67A7E202BE for ; Fri, 3 Apr 2015 12:59:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753279AbbDCM7a (ORCPT ); Fri, 3 Apr 2015 08:59:30 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:37574 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150AbbDCM6h (ORCPT ); Fri, 3 Apr 2015 08:58:37 -0400 Received: by wiaa2 with SMTP id a2so139023976wia.0; Fri, 03 Apr 2015 05:58:35 -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=g7QnrwPQ9H0FQ+kZoUIGqqYxG62SCUqE8qAMWubL9ut6cZOv0rp93tntbMsGYXr8Ja qsKSSCy+WvlQ/z7k6BeYzpuegWHFRuMX13Cut6VSw+yaUgqC/m+F1/sRI+W+cH/N4iS/ nzaNiHGCwvdGuKiSjGMpmoA9G2CQfXXVaYuriqpkQgnJlD0n4+3KZotG91sWTqv72Gr0 2BmYf6HUrpi12VsbXlWzQ3tpp08Hbwc67MSJH3m5p2AigYuYIPR2zz8bEuYbP6jKlxjK SB5vaFMz5DkXf+K7wueR2tEawpPz6/DsjAuD84MPmnhi3NS6+r3CrnRKphrMiUTQNGMk qMrQ== X-Received: by 10.180.102.165 with SMTP id fp5mr5172221wib.80.1428065915463; Fri, 03 Apr 2015 05:58:35 -0700 (PDT) Received: from cizrna.lan ([109.72.12.93]) by mx.google.com with ESMTPSA id n6sm2664610wiw.6.2015.04.03.05.58.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 05:58:34 -0700 (PDT) From: Tomeu Vizoso To: linux-pm@vger.kernel.org Cc: Tomeu Vizoso , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Ramakrishnan Muthukrishnan , Sylwester Nawrocki , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/7] [media] v4l2-core: Implement dev_pm_ops.prepare() Date: Fri, 3 Apr 2015 14:57:54 +0200 Message-Id: <1428065887-16017-6-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1428065887-16017-1-git-send-email-tomeu.vizoso@collabora.com> References: <1428065887-16017-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)