From patchwork Sat Jun 22 20:11:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 2766071 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56AD59F472 for ; Sat, 22 Jun 2013 20:12:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 594C020108 for ; Sat, 22 Jun 2013 20:12:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D7222010B for ; Sat, 22 Jun 2013 20:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751071Ab3FVULw (ORCPT ); Sat, 22 Jun 2013 16:11:52 -0400 Received: from qmta02.emeryville.ca.mail.comcast.net ([76.96.30.24]:58708 "EHLO qmta02.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042Ab3FVULj (ORCPT ); Sat, 22 Jun 2013 16:11:39 -0400 Received: from omta06.emeryville.ca.mail.comcast.net ([76.96.30.51]) by qmta02.emeryville.ca.mail.comcast.net with comcast id rXfS1l00716AWCUA2YBeyv; Sat, 22 Jun 2013 20:11:38 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta06.emeryville.ca.mail.comcast.net with comcast id rYBd1l0070MU7Qa8SYBdFp; Sat, 22 Jun 2013 20:11:38 +0000 Received: from orthanc.internal (orthanc.internal [192.168.1.24]) by mail.gonehiking.org (Postfix) with ESMTP id 956D68018E; Sat, 22 Jun 2013 14:11:41 -0600 (MDT) From: Shuah Khan To: pavel@ucw.cz, rjw@sisk.pl, len.brown@intel.com, gregkh@linuxfoundation.org, airlied@linux.ie Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, shuahkhan@gmail.com Subject: [PATCH 2/2] drm: Convert drm class driver from legacy pm ops to dev_pm_ops Date: Sat, 22 Jun 2013 14:11:35 -0600 Message-Id: <1371931895-3283-1-git-send-email-shuah.kh@samsung.com> X-Mailer: git-send-email 1.7.10.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1371931898; bh=NHKWUP/IYdWsI9BdF3ihyOkiBKuJThzYo5Lkk5uAmsA=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=S0/uiAnb3JZYQcGuS5Cca93ZAA0zBDKWPne0TZkypTgp29fdKVz4FUNnmrmBmw9KA /ZpivnriTj2Qk2bbCnu6NVGcd6z9lLHm2Q9zkp4q4fu0ldFRcLUH981/jRJeQa2eyJ lmuVavpyuYdAC8PLvGvUUrKPA/DFDDdLS+0MGGhTox88jJqpyBSNrEE9/3QCGBRYT0 jeLiAYRBAouw8zwrHfZIRQ1O2DQFTZ2QpYc5emR0oObEbDGQqK85MaH0ZjKO2xowzu u3qLGB2o+yMqc0LuvPy9V4HtKqcMSd9RHAK+3c3pCuaptsGxs2Guw4pY6bonmI/SiI 8/AnptBczaAxA== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Convert drivers/gpu/drm class to use dev_pm_ops for power management and remove Legacy PM ops hooks. With this change, drm class registers suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy class->suspend/resume. When __device_suspend() runs call-backs, it will find class->pm ops for the drm class. Signed-off-by: Shuah Khan --- drivers/gpu/drm/drm_sysfs.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 0229665..8d94778 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -37,7 +37,7 @@ static struct device_type drm_sysfs_device_minor = { * Just figures out what the actual struct drm_device associated with * @dev is and calls its suspend hook, if present. */ -static int drm_class_suspend(struct device *dev, pm_message_t state) +static int drm_class_suspend(struct device *dev) { if (dev->type == &drm_sysfs_device_minor) { struct drm_minor *drm_minor = to_drm_minor(dev); @@ -46,7 +46,8 @@ static int drm_class_suspend(struct device *dev, pm_message_t state) if (drm_minor->type == DRM_MINOR_LEGACY && !drm_core_check_feature(drm_dev, DRIVER_MODESET) && drm_dev->driver->suspend) - return drm_dev->driver->suspend(drm_dev, state); + return drm_dev->driver->suspend(drm_dev, + get_pm_transition()); } return 0; } @@ -72,6 +73,11 @@ static int drm_class_resume(struct device *dev) return 0; } +static const struct dev_pm_ops drm_class_dev_pm_ops = { + .suspend = drm_class_suspend, + .resume = drm_class_resume, +}; + static char *drm_devnode(struct device *dev, umode_t *mode) { return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); @@ -106,8 +112,7 @@ struct class *drm_sysfs_create(struct module *owner, char *name) goto err_out; } - class->suspend = drm_class_suspend; - class->resume = drm_class_resume; + class->pm = &drm_class_dev_pm_ops; err = class_create_file(class, &class_attr_version.attr); if (err)