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: 2768411 Return-Path: X-Original-To: patchwork-dri-devel@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 15B1F9F472 for ; Sun, 23 Jun 2013 15:37:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41AEE2011C for ; Sun, 23 Jun 2013 15:37:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 524B620117 for ; Sun, 23 Jun 2013 15:37:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DD94E5FB2 for ; Sun, 23 Jun 2013 08:37:56 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 487 seconds by postgrey-1.32 at gabe; Sat, 22 Jun 2013 13:19:46 PDT Received: from qmta04.emeryville.ca.mail.comcast.net (qmta04.emeryville.ca.mail.comcast.net [76.96.30.40]) by gabe.freedesktop.org (Postfix) with ESMTP id 29445E5CF8 for ; Sat, 22 Jun 2013 13:19:46 -0700 (PDT) Received: from omta06.emeryville.ca.mail.comcast.net ([76.96.30.51]) by qmta04.emeryville.ca.mail.comcast.net with comcast id rY2d1l00116AWCUA4YBe65; 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 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=r1nepsci1NhzNoa7DFx5yjKpnK5oDcXCZUNqZW5gDk7dJ8ON/Ee+Xtz3JWmXpTrA8 SRuysCHRx7dj3J56FUSXuBvWe/d2ud9j5QofzmvpsLcyhtemy3i8cwe+jS6t4jpqm3 D9ltC0bjR6UG/os8Wz3LSpMoLG+e9liId93mWPNapmztiL8IHn/QSOQ7nrzPIwAJj2 6QaOCXxNuAoK1nkaHkEkeIVeFEbttWeCiA9ilEgkMPZx9evqpAIAKShBQqsKnMv7ul 0KW2ve2eAv3JLu3PV2yhXeCOW+aHaR3jQKuaBTs3l4nkt5A3IefT5osQinbdE+l/Kb IXYnohxOhErYw== X-Mailman-Approved-At: Sun, 23 Jun 2013 08:36:46 -0700 Cc: shuahkhan@gmail.com, Shuah Khan , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-pm@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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)