diff options
Diffstat (limited to 'drivers/net/ks8851.c')
-rw-r--r-- | drivers/net/ks8851.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c index 51919fcd50c2..0fa4a9887ba2 100644 --- a/drivers/net/ks8851.c +++ b/drivers/net/ks8851.c | |||
@@ -1545,6 +1545,37 @@ static int ks8851_read_selftest(struct ks8851_net *ks) | |||
1545 | 1545 | ||
1546 | /* driver bus management functions */ | 1546 | /* driver bus management functions */ |
1547 | 1547 | ||
1548 | #ifdef CONFIG_PM | ||
1549 | static int ks8851_suspend(struct spi_device *spi, pm_message_t state) | ||
1550 | { | ||
1551 | struct ks8851_net *ks = dev_get_drvdata(&spi->dev); | ||
1552 | struct net_device *dev = ks->netdev; | ||
1553 | |||
1554 | if (netif_running(dev)) { | ||
1555 | netif_device_detach(dev); | ||
1556 | ks8851_net_stop(dev); | ||
1557 | } | ||
1558 | |||
1559 | return 0; | ||
1560 | } | ||
1561 | |||
1562 | static int ks8851_resume(struct spi_device *spi) | ||
1563 | { | ||
1564 | struct ks8851_net *ks = dev_get_drvdata(&spi->dev); | ||
1565 | struct net_device *dev = ks->netdev; | ||
1566 | |||
1567 | if (netif_running(dev)) { | ||
1568 | ks8851_net_open(dev); | ||
1569 | netif_device_attach(dev); | ||
1570 | } | ||
1571 | |||
1572 | return 0; | ||
1573 | } | ||
1574 | #else | ||
1575 | #define ks8851_suspend NULL | ||
1576 | #define ks8851_resume NULL | ||
1577 | #endif | ||
1578 | |||
1548 | static int __devinit ks8851_probe(struct spi_device *spi) | 1579 | static int __devinit ks8851_probe(struct spi_device *spi) |
1549 | { | 1580 | { |
1550 | struct net_device *ndev; | 1581 | struct net_device *ndev; |
@@ -1679,6 +1710,8 @@ static struct spi_driver ks8851_driver = { | |||
1679 | }, | 1710 | }, |
1680 | .probe = ks8851_probe, | 1711 | .probe = ks8851_probe, |
1681 | .remove = __devexit_p(ks8851_remove), | 1712 | .remove = __devexit_p(ks8851_remove), |
1713 | .suspend = ks8851_suspend, | ||
1714 | .resume = ks8851_resume, | ||
1682 | }; | 1715 | }; |
1683 | 1716 | ||
1684 | static int __init ks8851_init(void) | 1717 | static int __init ks8851_init(void) |