lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50460f994b1fe34c329ab0d59bcdb81bbf6b941b.1421202479.git.micky_ching@realsil.com.cn>
Date:	Wed, 14 Jan 2015 10:40:17 +0800
From:	<micky_ching@...lsil.com.cn>
To:	<devel@...uxdriverproject.org>, <linux-kernel@...r.kernel.org>
CC:	<sameo@...ux.intel.com>, <maximlevitsky@...il.com>,
	<gregkh@...uxfoundation.org>, <oakad@...oo.com>,
	<rogerable@...ltek.com>, <wei_wang@...lsil.com.cn>,
	Micky Ching <micky_ching@...lsil.com.cn>
Subject: [PATCH 3/3] memstick: rtsx: move suspend/resume to pm ops

From: Micky Ching <micky_ching@...lsil.com.cn>

Move suspend/resume function to pm ops, make it consistence
with rtsx_usb_ms.c driver.

Signed-off-by: Micky Ching <micky_ching@...lsil.com.cn>
---
 drivers/memstick/host/rtsx_pci_ms.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/memstick/host/rtsx_pci_ms.c b/drivers/memstick/host/rtsx_pci_ms.c
index c9981af..475afa8 100644
--- a/drivers/memstick/host/rtsx_pci_ms.c
+++ b/drivers/memstick/host/rtsx_pci_ms.c
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/highmem.h>
 #include <linux/delay.h>
+#include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/memstick.h>
 #include <linux/mfd/rtsx_pci.h>
@@ -514,11 +515,11 @@ static int rtsx_pci_ms_set_param(struct memstick_host *msh,
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
-static int rtsx_pci_ms_suspend(struct platform_device *pdev, pm_message_t state)
+static int rtsx_pci_ms_suspend(struct device *dev)
 {
-	struct realtek_pci_ms *host = platform_get_drvdata(pdev);
+	struct realtek_pci_ms *host = dev_get_drvdata(dev);
 	struct memstick_host *msh = host->msh;
 
 	dev_dbg(ms_dev(host), "--> %s\n", __func__);
@@ -527,9 +528,9 @@ static int rtsx_pci_ms_suspend(struct platform_device *pdev, pm_message_t state)
 	return 0;
 }
 
-static int rtsx_pci_ms_resume(struct platform_device *pdev)
+static int rtsx_pci_ms_resume(struct device *dev)
 {
-	struct realtek_pci_ms *host = platform_get_drvdata(pdev);
+	struct realtek_pci_ms *host = dev_get_drvdata(dev);
 	struct memstick_host *msh = host->msh;
 
 	dev_dbg(ms_dev(host), "--> %s\n", __func__);
@@ -537,13 +538,7 @@ static int rtsx_pci_ms_resume(struct platform_device *pdev)
 	memstick_resume_host(msh);
 	return 0;
 }
-
-#else /* CONFIG_PM */
-
-#define rtsx_pci_ms_suspend NULL
-#define rtsx_pci_ms_resume NULL
-
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM_SLEEP */
 
 static void rtsx_pci_ms_card_event(struct platform_device *pdev)
 {
@@ -641,6 +636,9 @@ static int rtsx_pci_ms_drv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static SIMPLE_DEV_PM_OPS(rtsx_pci_ms_pm_ops,
+	rtsx_pci_ms_suspend, rtsx_pci_ms_resume);
+
 static struct platform_device_id rtsx_pci_ms_ids[] = {
 	{
 		.name = DRV_NAME_RTSX_PCI_MS,
@@ -654,10 +652,9 @@ static struct platform_driver rtsx_pci_ms_driver = {
 	.probe		= rtsx_pci_ms_drv_probe,
 	.remove		= rtsx_pci_ms_drv_remove,
 	.id_table       = rtsx_pci_ms_ids,
-	.suspend	= rtsx_pci_ms_suspend,
-	.resume		= rtsx_pci_ms_resume,
 	.driver		= {
 		.name	= DRV_NAME_RTSX_PCI_MS,
+		.pm	= &rtsx_pci_ms_pm_ops,
 	},
 };
 module_platform_driver(rtsx_pci_ms_driver);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ