From patchwork Wed Jul 11 19:27:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 1185101 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 39D8A3FC8E for ; Wed, 11 Jul 2012 19:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932191Ab2GKTWr (ORCPT ); Wed, 11 Jul 2012 15:22:47 -0400 Received: from ogre.sisk.pl ([193.178.161.156]:36048 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933066Ab2GKTWn (ORCPT ); Wed, 11 Jul 2012 15:22:43 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 91F4D1D8676; Wed, 11 Jul 2012 21:21:16 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04799-04; Wed, 11 Jul 2012 21:20:54 +0200 (CEST) Received: from ferrari.rjw.lan (62-121-64-87.home.aster.pl [62.121.64.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 13BE91DA9D3; Wed, 11 Jul 2012 21:20:34 +0200 (CEST) From: "Rafael J. Wysocki" To: LKML Subject: [PATCH 7/7] i2c-tegra: Use struct dev_pm_ops for power management Date: Wed, 11 Jul 2012 21:27:30 +0200 User-Agent: KMail/1.13.6 (Linux/3.5.0-rc5+; KDE/4.6.0; x86_64; ; ) Cc: Linux PM list , Linus Walleij , linux-i2c@vger.kernel.org, Sonic Zhang , Jean Delvare , Ben Dooks , Wolfram Sang , Peter Korsgaard , Guan Xuetao , Vitaly Wool , Colin Cross , Stephen Warren References: <201207112121.11046.rjw@sisk.pl> In-Reply-To: <201207112121.11046.rjw@sisk.pl> MIME-Version: 1.0 Message-Id: <201207112127.31139.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Rafael J. Wysocki Make the Tegra I2C controller driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct platform_driver. Signed-off-by: Rafael J. Wysocki --- drivers/i2c/busses/i2c-tegra.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/drivers/i2c/busses/i2c-tegra.c =================================================================== --- linux.orig/drivers/i2c/busses/i2c-tegra.c +++ linux/drivers/i2c/busses/i2c-tegra.c @@ -717,9 +717,9 @@ static int __devexit tegra_i2c_remove(st } #ifdef CONFIG_PM -static int tegra_i2c_suspend(struct platform_device *pdev, pm_message_t state) +static int tegra_i2c_suspend(struct device *dev) { - struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); + struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); i2c_lock_adapter(&i2c_dev->adapter); i2c_dev->is_suspended = true; @@ -728,9 +728,9 @@ static int tegra_i2c_suspend(struct plat return 0; } -static int tegra_i2c_resume(struct platform_device *pdev) +static int tegra_i2c_resume(struct device *dev) { - struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); + struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); int ret; i2c_lock_adapter(&i2c_dev->adapter); @@ -748,6 +748,11 @@ static int tegra_i2c_resume(struct platf return 0; } + +static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume); +#define TEGRA_I2C_PM (&tegra_i2c_pm) +#else +#define TEGRA_I2C_PM NULL #endif #if defined(CONFIG_OF) @@ -765,14 +770,11 @@ MODULE_DEVICE_TABLE(of, tegra_i2c_of_mat static struct platform_driver tegra_i2c_driver = { .probe = tegra_i2c_probe, .remove = __devexit_p(tegra_i2c_remove), -#ifdef CONFIG_PM - .suspend = tegra_i2c_suspend, - .resume = tegra_i2c_resume, -#endif .driver = { .name = "tegra-i2c", .owner = THIS_MODULE, .of_match_table = tegra_i2c_of_match, + .pm = TEGRA_I2C_PM, }, };