From patchwork Thu Jun 20 16:38:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 2757191 Return-Path: X-Original-To: patchwork-linux-fbdev@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 BF9C49F472 for ; Thu, 20 Jun 2013 16:38:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95B982044A for ; Thu, 20 Jun 2013 16:38:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E128220448 for ; Thu, 20 Jun 2013 16:38:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965652Ab3FTQik (ORCPT ); Thu, 20 Jun 2013 12:38:40 -0400 Received: from smtp-out-044.synserver.de ([212.40.185.44]:1043 "EHLO smtp-out-039.synserver.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965632Ab3FTQij (ORCPT ); Thu, 20 Jun 2013 12:38:39 -0400 Received: (qmail 26945 invoked by uid 0); 20 Jun 2013 16:38:29 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 26862 Received: from ppp-188-174-113-193.dynamic.mnet-online.de (HELO lars-adi-laptop.fritz.box) [188.174.113.193] by 217.119.54.87 with SMTP; 20 Jun 2013 16:38:28 -0000 From: Lars-Peter Clausen To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: Michael Hennerich , linux-fbdev@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH resend] fbdev: bfin-lq035q1-fb: Use dev_pm_ops Date: Thu, 20 Jun 2013 18:38:46 +0200 Message-Id: <1371746326-5087-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Use dev_pm_ops instead of the legacy suspend/resume callbacks. Signed-off-by: Lars-Peter Clausen Acked-by: Michael Hennerich --- Since Rafael said he won't take the pm_sleep_ops_ptr() macro, just a resend of the previous version of the patch. --- drivers/video/bfin-lq035q1-fb.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c index 29d8c04..6084c17 100644 --- a/drivers/video/bfin-lq035q1-fb.c +++ b/drivers/video/bfin-lq035q1-fb.c @@ -170,16 +170,19 @@ static int lq035q1_spidev_remove(struct spi_device *spi) return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT); } -#ifdef CONFIG_PM -static int lq035q1_spidev_suspend(struct spi_device *spi, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int lq035q1_spidev_suspend(struct device *dev) { + struct spi_device *spi = to_spi_device(dev); + return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_SHUT); } -static int lq035q1_spidev_resume(struct spi_device *spi) +static int lq035q1_spidev_resume(struct device *dev) { - int ret; + struct spi_device *spi = to_spi_device(dev); struct spi_control *ctl = spi_get_drvdata(spi); + int ret; ret = lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode); if (ret) @@ -187,9 +190,13 @@ static int lq035q1_spidev_resume(struct spi_device *spi) return lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON); } + +static SIMPLE_DEV_PM_OPS(lq035q1_spidev_pm_ops, lq035q1_spidev_suspend, + lq035q1_spidev_resume); +#define LQ035Q1_SPIDEV_PM_OPS (&lq035q1_spidev_pm_ops) + #else -# define lq035q1_spidev_suspend NULL -# define lq035q1_spidev_resume NULL +#define LQ035Q1_SPIDEV_PM_OPS NULL #endif /* Power down all displays on reboot, poweroff or halt */ @@ -708,8 +715,7 @@ static int bfin_lq035q1_probe(struct platform_device *pdev) info->spidrv.probe = lq035q1_spidev_probe; info->spidrv.remove = lq035q1_spidev_remove; info->spidrv.shutdown = lq035q1_spidev_shutdown; - info->spidrv.suspend = lq035q1_spidev_suspend; - info->spidrv.resume = lq035q1_spidev_resume; + info->spidrv.driver.pm = LQ035Q1_SPIDEV_PM_OPS; ret = spi_register_driver(&info->spidrv); if (ret < 0) {