Commit d5b40921 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by David S. Miller

net: ks8851: Use dev_pm_ops

Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0582ce92
...@@ -1364,35 +1364,39 @@ static int ks8851_read_selftest(struct ks8851_net *ks) ...@@ -1364,35 +1364,39 @@ static int ks8851_read_selftest(struct ks8851_net *ks)
/* driver bus management functions */ /* driver bus management functions */
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int ks8851_suspend(struct spi_device *spi, pm_message_t state)
static int ks8851_suspend(struct device *dev)
{ {
struct ks8851_net *ks = spi_get_drvdata(spi); struct ks8851_net *ks = dev_get_drvdata(dev);
struct net_device *dev = ks->netdev; struct net_device *netdev = ks->netdev;
if (netif_running(dev)) { if (netif_running(netdev)) {
netif_device_detach(dev); netif_device_detach(netdev);
ks8851_net_stop(dev); ks8851_net_stop(netdev);
} }
return 0; return 0;
} }
static int ks8851_resume(struct spi_device *spi) static int ks8851_resume(struct device *dev)
{ {
struct ks8851_net *ks = spi_get_drvdata(spi); struct ks8851_net *ks = dev_get_drvdata(dev);
struct net_device *dev = ks->netdev; struct net_device *netdev = ks->netdev;
if (netif_running(dev)) { if (netif_running(netdev)) {
ks8851_net_open(dev); ks8851_net_open(netdev);
netif_device_attach(dev); netif_device_attach(netdev);
} }
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(ks8851_pm_ops, ks8851_suspend, ks8851_resume);
#define KS8851_PM_OPS (&ks8851_pm_ops)
#else #else
#define ks8851_suspend NULL #define KS8851_PM_OPS NULL
#define ks8851_resume NULL
#endif #endif
static int ks8851_probe(struct spi_device *spi) static int ks8851_probe(struct spi_device *spi)
...@@ -1532,11 +1536,10 @@ static struct spi_driver ks8851_driver = { ...@@ -1532,11 +1536,10 @@ static struct spi_driver ks8851_driver = {
.driver = { .driver = {
.name = "ks8851", .name = "ks8851",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = KS8851_PM_OPS,
}, },
.probe = ks8851_probe, .probe = ks8851_probe,
.remove = ks8851_remove, .remove = ks8851_remove,
.suspend = ks8851_suspend,
.resume = ks8851_resume,
}; };
module_spi_driver(ks8851_driver); module_spi_driver(ks8851_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment