From patchwork Wed Jul 10 04:10:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 257961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-vc0-x23b.google.com (mail-vc0-x23b.google.com [IPv6:2607:f8b0:400c:c03::23b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A739F2C0099 for ; Wed, 10 Jul 2013 14:10:17 +1000 (EST) Received: by mail-vc0-f187.google.com with SMTP id gf11sf1911434vcb.14 for ; Tue, 09 Jul 2013 21:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:x-beenthere:from:to:cc:subject:date:message-id :x-mailer:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-google-group-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=kQG0R6YFmInMtUHzeUbiDZ1i9u8WRgcsapAk8ShtNog=; b=CdosexvbzdjuO+qLvd9aWgZsXP58jz66tuh5wjKxvG7esGMPYOqNovvl08jw8XD9GX dhYuNTRqYliAQ3/p//z7+9bTWz5TNFaWwWCukm3dVKbSyaRAkCjb3R1Rdn9cneavG22n ix+MBmwsARDffGfW5jGiGKaUGrtr+jPiJuehGbOVbXDNwHCkGg2zG8plzsC6Q8TM5o5+ ym0442ZByO6FUMjk+1ElOIjhgb+PacNTQpIsmm/+rUJZo3XbDn9L3c+10keBrKzLvlkj Mb2PzH2l8QP8pGmhkgF1UntxrVKFwg9TjbWmkNZMdvGbxP12e7zN///0fGee2dAc5ob/ hj4w== X-Received: by 10.50.4.99 with SMTP id j3mr2825185igj.6.1373429414125; Tue, 09 Jul 2013 21:10:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.128.166 with SMTP id np6ls3577165igb.18.gmail; Tue, 09 Jul 2013 21:10:13 -0700 (PDT) X-Received: by 10.66.225.239 with SMTP id rn15mr2531034pac.36.1373429413805; Tue, 09 Jul 2013 21:10:13 -0700 (PDT) Received: from qmta15.emeryville.ca.mail.comcast.net (qmta15.emeryville.ca.mail.comcast.net. [2001:558:fe2d:44:76:96:27:228]) by gmr-mx.google.com with ESMTP id cw1si3378514pbb.0.2013.07.09.21.10.13 for ; Tue, 09 Jul 2013 21:10:13 -0700 (PDT) Received-SPF: neutral (google.com: 2001:558:fe2d:44:76:96:27:228 is neither permitted nor denied by best guess record for domain of shuah.kh@samsung.com) client-ip=2001:558:fe2d:44:76:96:27:228; Received: from omta08.emeryville.ca.mail.comcast.net ([76.96.30.12]) by qmta15.emeryville.ca.mail.comcast.net with comcast id yTuA1l0030FhH24AFUADdW; Wed, 10 Jul 2013 04:10:13 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta08.emeryville.ca.mail.comcast.net with comcast id yUAB1l00C0MU7Qa8UUACiU; Wed, 10 Jul 2013 04:10:13 +0000 Received: from orthanc.internal (orthanc.internal [192.168.1.24]) by mail.gonehiking.org (Postfix) with ESMTP id D93ED80340; Tue, 9 Jul 2013 22:10:30 -0600 (MDT) From: Shuah Khan To: rafael.j.wysocki@intel.com, bhelgaas@google.com, a.zummo@towertech.it, key@linux.vnet.ibm.com, mail@srajiv.net, tpmdd@selhorst.net, tpmdd@sirrix.com, matthew.garrett@nebula.com Cc: Shuah Khan , linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, tpmdd-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, shuahkhan@gmail.com Subject: [rtc-linux] [PATCH 3/4] tpm: Convert tpm_tis driver to use dev_pm_ops from legacy pm_ops Date: Tue, 9 Jul 2013 22:10:09 -0600 Message-Id: <1373429409-3944-1-git-send-email-shuah.kh@samsung.com> X-Mailer: git-send-email 1.7.10.4 X-Original-Sender: shuah.kh@samsung.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:558:fe2d:44:76:96:27:228 is neither permitted nor denied by best guess record for domain of shuah.kh@samsung.com) smtp.mail=shuah.kh@samsung.com; dkim=pass (test mode) header.i=@comcast.net Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Convert drivers/char/tpm/tpm_tis.c to use dev_pm_ops instead of legacy pm_ops. This patch depends on pnp driver bus ops change to invoke pnp_driver dev_pm_ops. Signed-off-by: Shuah Khan --- drivers/char/tpm/tpm_tis.c | 60 ++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 4519cb3..5796d01 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -766,6 +766,25 @@ static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) } #endif +#ifdef CONFIG_PM_SLEEP +static int tpm_tis_resume(struct device *dev) +{ + struct tpm_chip *chip = dev_get_drvdata(dev); + int ret; + + if (chip->vendor.irq) + tpm_tis_reenable_interrupts(chip); + + ret = tpm_pm_resume(dev); + if (!ret) + tpm_do_selftest(chip); + + return ret; +} +#endif + +static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume); + #ifdef CONFIG_PNP static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev, const struct pnp_device_id *pnp_id) @@ -787,26 +806,6 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev, return tpm_tis_init(&pnp_dev->dev, start, len, irq); } -static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) -{ - return tpm_pm_suspend(&dev->dev); -} - -static int tpm_tis_pnp_resume(struct pnp_dev *dev) -{ - struct tpm_chip *chip = pnp_get_drvdata(dev); - int ret; - - if (chip->vendor.irq) - tpm_tis_reenable_interrupts(chip); - - ret = tpm_pm_resume(&dev->dev); - if (!ret) - tpm_do_selftest(chip); - - return ret; -} - static struct pnp_device_id tpm_pnp_tbl[] = { {"PNP0C31", 0}, /* TPM */ {"ATM1200", 0}, /* Atmel */ @@ -835,9 +834,12 @@ static struct pnp_driver tis_pnp_driver = { .name = "tpm_tis", .id_table = tpm_pnp_tbl, .probe = tpm_tis_pnp_init, - .suspend = tpm_tis_pnp_suspend, - .resume = tpm_tis_pnp_resume, .remove = tpm_tis_pnp_remove, +#ifdef CONFIG_PM_SLEEP + .driver = { + .pm = &tpm_tis_pm, + }, +#endif }; #define TIS_HID_USR_IDX sizeof(tpm_pnp_tbl)/sizeof(struct pnp_device_id) -2 @@ -846,20 +848,6 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); #endif -#ifdef CONFIG_PM_SLEEP -static int tpm_tis_resume(struct device *dev) -{ - struct tpm_chip *chip = dev_get_drvdata(dev); - - if (chip->vendor.irq) - tpm_tis_reenable_interrupts(chip); - - return tpm_pm_resume(dev); -} -#endif - -static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume); - static struct platform_driver tis_drv = { .driver = { .name = "tpm_tis",