[PATCH 045/641] Staging: rtl8187se: merge r8180_pm.c with r8180_core.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>

* merge r8180_pm.c with r8180_core.c
* make functions static

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/rtl8187se/Makefile      |    1 -
 drivers/staging/rtl8187se/r8180_core.c  |   63 +++++++++++++++++++++++++-
 drivers/staging/rtl8187se/r8180_pm.c    |   74 -------------------------------
 drivers/staging/rtl8187se/r8180_pm.h    |   24 ----------
 drivers/staging/rtl8187se/r8185b_init.c |    2 -
 5 files changed, 61 insertions(+), 103 deletions(-)
 delete mode 100644 drivers/staging/rtl8187se/r8180_pm.c
 delete mode 100644 drivers/staging/rtl8187se/r8180_pm.h

diff --git a/drivers/staging/rtl8187se/Makefile b/drivers/staging/rtl8187se/Makefile
index 15cbecf..98b2300 100644
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -25,7 +25,6 @@ rtl8187se-objs :=			\
 		r8180_rtl8225z2.o	\
 		r8185b_init.o		\
 		r8180_dm.o		\
-		r8180_pm.o		\
 		ieee80211/dot11d.o			\
 		ieee80211/ieee80211_softmac.o		\
 		ieee80211/ieee80211_rx.o		\
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 1864682..6875606 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -22,6 +22,9 @@
 
    A big big thanks goes also to Realtek corp. for their help in my attempt to
    add RTL8185 and RTL8225 support, and to David Young also.
+
+   Power management interface routines.
+   Written by Mariusz Matuszek.
 */
 
 #undef RX_DONT_PASS_UL
@@ -37,8 +40,6 @@
 #include "r8180_wx.h"
 #include "r8180_dm.h"
 
-#include "r8180_pm.h"
-
 #include "ieee80211/dot11d.h"
 
 #ifndef PCI_VENDOR_ID_BELKIN
@@ -121,6 +122,64 @@ static void rtl8180_shutdown (struct pci_dev *pdev)
 	pci_disable_device(pdev);
 }
 
+static int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+
+	if (!netif_running(dev))
+		goto out_pci_suspend;
+
+	if (dev->netdev_ops->ndo_stop)
+		dev->netdev_ops->ndo_stop(dev);
+
+	netif_device_detach(dev);
+
+out_pci_suspend:
+	pci_save_state(pdev);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+	return 0;
+}
+
+static int rtl8180_resume(struct pci_dev *pdev)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+	int err;
+	u32 val;
+
+	pci_set_power_state(pdev, PCI_D0);
+
+	err = pci_enable_device(pdev);
+	if (err) {
+		printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
+				dev->name);
+
+		return err;
+	}
+
+	pci_restore_state(pdev);
+
+	/*
+	 * Suspend/Resume resets the PCI configuration space, so we have to
+	 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
+	 * from interfering with C3 CPU state. pci_restore_state won't help
+	 * here since it only restores the first 64 bytes pci config header.
+	 */
+	pci_read_config_dword(pdev, 0x40, &val);
+	if ((val & 0x0000ff00) != 0)
+		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
+
+	if (!netif_running(dev))
+		goto out;
+
+	if (dev->netdev_ops->ndo_open)
+		dev->netdev_ops->ndo_open(dev);
+
+	netif_device_attach(dev);
+out:
+	return 0;
+}
+
 static struct pci_driver rtl8180_pci_driver = {
 	.name		= RTL8180_MODULE_NAME,	          /* Driver name   */
 	.id_table	= rtl8180_pci_id_tbl,	          /* PCI_ID table  */
diff --git a/drivers/staging/rtl8187se/r8180_pm.c b/drivers/staging/rtl8187se/r8180_pm.c
deleted file mode 100644
index 56a5ff9..0000000
--- a/drivers/staging/rtl8187se/r8180_pm.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-   Power management interface routines.
-   Written by Mariusz Matuszek.
-   This code is currently just a placeholder for later work and
-   does not do anything useful.
-
-   This is part of rtl8180 OpenSource driver.
-   Copyright (C) Andrea Merello 2004  <andreamrl@xxxxxxxxxx>
-   Released under the terms of GPL (General Public Licence)
-*/
-
-
-
-#include "r8180_hw.h"
-#include "r8180_pm.h"
-#include "r8180.h"
-
-int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
-{
-	struct net_device *dev = pci_get_drvdata(pdev);
-
-	if (!netif_running(dev))
-		goto out_pci_suspend;
-
-	if (dev->netdev_ops->ndo_stop)
-		dev->netdev_ops->ndo_stop(dev);
-
-	netif_device_detach(dev);
-
-out_pci_suspend:
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, pci_choose_state(pdev, state));
-	return 0;
-}
-
-int rtl8180_resume(struct pci_dev *pdev)
-{
-	struct net_device *dev = pci_get_drvdata(pdev);
-	int err;
-	u32 val;
-
-	pci_set_power_state(pdev, PCI_D0);
-
-	err = pci_enable_device(pdev);
-	if (err) {
-		printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
-				dev->name);
-
-		return err;
-	}
-
-	pci_restore_state(pdev);
-
-	/*
-	 * Suspend/Resume resets the PCI configuration space, so we have to
-	 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
-	 * from interfering with C3 CPU state. pci_restore_state won't help
-	 * here since it only restores the first 64 bytes pci config header.
-	 */
-	pci_read_config_dword(pdev, 0x40, &val);
-	if ((val & 0x0000ff00) != 0)
-		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
-
-	if (!netif_running(dev))
-		goto out;
-
-	if (dev->netdev_ops->ndo_open)
-		dev->netdev_ops->ndo_open(dev);
-
-	netif_device_attach(dev);
-out:
-	return 0;
-}
diff --git a/drivers/staging/rtl8187se/r8180_pm.h b/drivers/staging/rtl8187se/r8180_pm.h
deleted file mode 100644
index 48ab9cd..0000000
--- a/drivers/staging/rtl8187se/r8180_pm.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-        Power management interface routines.
-	Written by Mariusz Matuszek.
-	This code is currently just a placeholder for later work and
-	does not do anything useful.
-
-	This is part of rtl8180 OpenSource driver.
-	Copyright (C) Andrea Merello 2004  <andreamrl@xxxxxxxxxx>
-	Released under the terms of GPL (General Public Licence)
-
-*/
-
-
-#ifndef R8180_PM_H
-#define R8180_PM_H
-
-#include <linux/types.h>
-#include <linux/pci.h>
-
-int rtl8180_suspend (struct pci_dev *pdev, pm_message_t state);
-int rtl8180_resume (struct pci_dev *pdev);
-
-#endif //R8180_PM_H
-
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c
index b88648a..ed5d19c 100644
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -26,8 +26,6 @@ Notes:
 #include "r8180_93cx6.h"   /* Card EEPROM */
 #include "r8180_wx.h"
 
-#include "r8180_pm.h"
-
 #include "ieee80211/dot11d.h"
 
 
-- 
1.6.4.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux