diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2008-09-22 17:47:10 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-29 00:28:29 -0400 |
commit | 67e3e221d61c0e70b2f244fd921e5e601d6c7339 (patch) | |
tree | cdbcd3c30aa394eb0584ff4061ac23e69ead18c5 /drivers/ata/pata_bf54x.c | |
parent | 47d692a946f12c299c21536fff6b39369311f002 (diff) |
[libata] pata_bf54x: Add proper PM operation
[akpm@linux-foundation.org: remove ifdefs, make things static]
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_bf54x.c')
-rw-r--r-- | drivers/ata/pata_bf54x.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index d3932901a3b3..1266924c11f9 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1632,6 +1632,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev) | |||
1632 | return -ENODEV; | 1632 | return -ENODEV; |
1633 | } | 1633 | } |
1634 | 1634 | ||
1635 | dev_set_drvdata(&pdev->dev, host); | ||
1636 | |||
1635 | return 0; | 1637 | return 0; |
1636 | } | 1638 | } |
1637 | 1639 | ||
@@ -1648,6 +1650,7 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev) | |||
1648 | struct ata_host *host = dev_get_drvdata(dev); | 1650 | struct ata_host *host = dev_get_drvdata(dev); |
1649 | 1651 | ||
1650 | ata_host_detach(host); | 1652 | ata_host_detach(host); |
1653 | dev_set_drvdata(&pdev->dev, NULL); | ||
1651 | 1654 | ||
1652 | peripheral_free_list(atapi_io_port); | 1655 | peripheral_free_list(atapi_io_port); |
1653 | 1656 | ||
@@ -1655,27 +1658,44 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev) | |||
1655 | } | 1658 | } |
1656 | 1659 | ||
1657 | #ifdef CONFIG_PM | 1660 | #ifdef CONFIG_PM |
1658 | int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) | 1661 | static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) |
1659 | { | 1662 | { |
1660 | return 0; | 1663 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
1664 | if (host) | ||
1665 | return ata_host_suspend(host, state); | ||
1666 | else | ||
1667 | return 0; | ||
1661 | } | 1668 | } |
1662 | 1669 | ||
1663 | int bfin_atapi_resume(struct platform_device *pdev) | 1670 | static int bfin_atapi_resume(struct platform_device *pdev) |
1664 | { | 1671 | { |
1672 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
1673 | int ret; | ||
1674 | |||
1675 | if (host) { | ||
1676 | ret = bfin_reset_controller(host); | ||
1677 | if (ret) { | ||
1678 | printk(KERN_ERR DRV_NAME ": Error during HW init\n"); | ||
1679 | return ret; | ||
1680 | } | ||
1681 | ata_host_resume(host); | ||
1682 | } | ||
1683 | |||
1665 | return 0; | 1684 | return 0; |
1666 | } | 1685 | } |
1686 | #else | ||
1687 | #define bfin_atapi_suspend NULL | ||
1688 | #define bfin_atapi_resume NULL | ||
1667 | #endif | 1689 | #endif |
1668 | 1690 | ||
1669 | static struct platform_driver bfin_atapi_driver = { | 1691 | static struct platform_driver bfin_atapi_driver = { |
1670 | .probe = bfin_atapi_probe, | 1692 | .probe = bfin_atapi_probe, |
1671 | .remove = __devexit_p(bfin_atapi_remove), | 1693 | .remove = __devexit_p(bfin_atapi_remove), |
1694 | .suspend = bfin_atapi_suspend, | ||
1695 | .resume = bfin_atapi_resume, | ||
1672 | .driver = { | 1696 | .driver = { |
1673 | .name = DRV_NAME, | 1697 | .name = DRV_NAME, |
1674 | .owner = THIS_MODULE, | 1698 | .owner = THIS_MODULE, |
1675 | #ifdef CONFIG_PM | ||
1676 | .suspend = bfin_atapi_suspend, | ||
1677 | .resume = bfin_atapi_resume, | ||
1678 | #endif | ||
1679 | }, | 1699 | }, |
1680 | }; | 1700 | }; |
1681 | 1701 | ||