50
50
#include <linux/swab.h>
51
51
#include <linux/phy.h>
52
52
#include <linux/smsc911x.h>
53
+ #include <linux/device.h>
53
54
#include "smsc911x.h"
54
55
55
56
#define SMSC_CHIPNAME "smsc911x"
@@ -2114,10 +2115,12 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2114
2115
/* This implementation assumes the devices remains powered on its VDDVARIO
2115
2116
* pins during suspend. */
2116
2117
2117
- static int smsc911x_suspend (struct platform_device * pdev , pm_message_t state )
2118
+ /* TODO: implement freeze/thaw callbacks for hibernation.*/
2119
+
2120
+ static int smsc911x_suspend (struct device * dev )
2118
2121
{
2119
- struct net_device * dev = platform_get_drvdata ( pdev );
2120
- struct smsc911x_data * pdata = netdev_priv (dev );
2122
+ struct net_device * ndev = dev_get_drvdata ( dev );
2123
+ struct smsc911x_data * pdata = netdev_priv (ndev );
2121
2124
2122
2125
/* enable wake on LAN, energy detection and the external PME
2123
2126
* signal. */
@@ -2128,10 +2131,10 @@ static int smsc911x_suspend(struct platform_device *pdev, pm_message_t state)
2128
2131
return 0 ;
2129
2132
}
2130
2133
2131
- static int smsc911x_resume (struct platform_device * pdev )
2134
+ static int smsc911x_resume (struct device * dev )
2132
2135
{
2133
- struct net_device * dev = platform_get_drvdata ( pdev );
2134
- struct smsc911x_data * pdata = netdev_priv (dev );
2136
+ struct net_device * ndev = dev_get_drvdata ( dev );
2137
+ struct smsc911x_data * pdata = netdev_priv (ndev );
2135
2138
unsigned int to = 100 ;
2136
2139
2137
2140
/* Note 3.11 from the datasheet:
@@ -2149,19 +2152,25 @@ static int smsc911x_resume(struct platform_device *pdev)
2149
2152
return (to == 0 ) ? - EIO : 0 ;
2150
2153
}
2151
2154
2155
+ static struct dev_pm_ops smsc911x_pm_ops = {
2156
+ .suspend = smsc911x_suspend ,
2157
+ .resume = smsc911x_resume ,
2158
+ };
2159
+
2160
+ #define SMSC911X_PM_OPS (&smsc911x_pm_ops)
2161
+
2152
2162
#else
2153
- #define smsc911x_suspend NULL
2154
- #define smsc911x_resume NULL
2163
+ #define SMSC911X_PM_OPS NULL
2155
2164
#endif
2156
2165
2157
2166
static struct platform_driver smsc911x_driver = {
2158
2167
.probe = smsc911x_drv_probe ,
2159
2168
.remove = __devexit_p (smsc911x_drv_remove ),
2160
2169
.driver = {
2161
- .name = SMSC_CHIPNAME ,
2170
+ .name = SMSC_CHIPNAME ,
2171
+ .owner = THIS_MODULE ,
2172
+ .pm = SMSC911X_PM_OPS ,
2162
2173
},
2163
- .suspend = smsc911x_suspend ,
2164
- .resume = smsc911x_resume ,
2165
2174
};
2166
2175
2167
2176
/* Entry point for loading the module */
0 commit comments