Skip to content

Commit 6cb8782

Browse files
Daniel Mackdavem330
authored andcommitted
net: smsc911x: switch to new dev_pm_ops
Hibernation is unsupported for now, which meets the actual implementation in the driver. For free/thaw, the chip's D2 state should be entered. Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: <steve.glendinning@smsc.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a48ec34 commit 6cb8782

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

drivers/net/smsc911x.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <linux/swab.h>
5151
#include <linux/phy.h>
5252
#include <linux/smsc911x.h>
53+
#include <linux/device.h>
5354
#include "smsc911x.h"
5455

5556
#define SMSC_CHIPNAME "smsc911x"
@@ -2114,10 +2115,12 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
21142115
/* This implementation assumes the devices remains powered on its VDDVARIO
21152116
* pins during suspend. */
21162117

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)
21182121
{
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);
21212124

21222125
/* enable wake on LAN, energy detection and the external PME
21232126
* signal. */
@@ -2128,10 +2131,10 @@ static int smsc911x_suspend(struct platform_device *pdev, pm_message_t state)
21282131
return 0;
21292132
}
21302133

2131-
static int smsc911x_resume(struct platform_device *pdev)
2134+
static int smsc911x_resume(struct device *dev)
21322135
{
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);
21352138
unsigned int to = 100;
21362139

21372140
/* Note 3.11 from the datasheet:
@@ -2149,19 +2152,25 @@ static int smsc911x_resume(struct platform_device *pdev)
21492152
return (to == 0) ? -EIO : 0;
21502153
}
21512154

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+
21522162
#else
2153-
#define smsc911x_suspend NULL
2154-
#define smsc911x_resume NULL
2163+
#define SMSC911X_PM_OPS NULL
21552164
#endif
21562165

21572166
static struct platform_driver smsc911x_driver = {
21582167
.probe = smsc911x_drv_probe,
21592168
.remove = __devexit_p(smsc911x_drv_remove),
21602169
.driver = {
2161-
.name = SMSC_CHIPNAME,
2170+
.name = SMSC_CHIPNAME,
2171+
.owner = THIS_MODULE,
2172+
.pm = SMSC911X_PM_OPS,
21622173
},
2163-
.suspend = smsc911x_suspend,
2164-
.resume = smsc911x_resume,
21652174
};
21662175

21672176
/* Entry point for loading the module */

0 commit comments

Comments
 (0)