Commit ebefae28 authored by Marc Dietrich's avatar Marc Dietrich Committed by Greg Kroah-Hartman

staging: nvec: cleanup powermanagement callbacks

Simplify powermanagement initialization by using pm_ops macro.
Signed-off-by: default avatarMarc Dietrich <marvin24@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9891b1ce
...@@ -700,12 +700,14 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec) ...@@ -700,12 +700,14 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
clk_disable(nvec->i2c_clk); clk_disable(nvec->i2c_clk);
} }
#ifdef CONFIG_PM_SLEEP
static void nvec_disable_i2c_slave(struct nvec_chip *nvec) static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
{ {
disable_irq(nvec->irq); disable_irq(nvec->irq);
writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG); writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG);
clk_disable(nvec->i2c_clk); clk_disable(nvec->i2c_clk);
} }
#endif
static void nvec_power_off(void) static void nvec_power_off(void)
{ {
...@@ -862,10 +864,10 @@ static int __devexit tegra_nvec_remove(struct platform_device *pdev) ...@@ -862,10 +864,10 @@ static int __devexit tegra_nvec_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int nvec_suspend(struct device *dev)
static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t state)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct nvec_chip *nvec = platform_get_drvdata(pdev); struct nvec_chip *nvec = platform_get_drvdata(pdev);
struct nvec_msg *msg; struct nvec_msg *msg;
...@@ -882,8 +884,9 @@ static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -882,8 +884,9 @@ static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t state)
return 0; return 0;
} }
static int tegra_nvec_resume(struct platform_device *pdev) static int nvec_resume(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct nvec_chip *nvec = platform_get_drvdata(pdev); struct nvec_chip *nvec = platform_get_drvdata(pdev);
dev_dbg(nvec->dev, "resuming\n"); dev_dbg(nvec->dev, "resuming\n");
...@@ -892,12 +895,10 @@ static int tegra_nvec_resume(struct platform_device *pdev) ...@@ -892,12 +895,10 @@ static int tegra_nvec_resume(struct platform_device *pdev)
return 0; return 0;
} }
#else
#define tegra_nvec_suspend NULL
#define tegra_nvec_resume NULL
#endif #endif
static const SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume);
/* Match table for of_platform binding */ /* Match table for of_platform binding */
static const struct of_device_id nvidia_nvec_of_match[] __devinitconst = { static const struct of_device_id nvidia_nvec_of_match[] __devinitconst = {
{ .compatible = "nvidia,nvec", }, { .compatible = "nvidia,nvec", },
...@@ -908,11 +909,10 @@ MODULE_DEVICE_TABLE(of, nvidia_nvec_of_match); ...@@ -908,11 +909,10 @@ MODULE_DEVICE_TABLE(of, nvidia_nvec_of_match);
static struct platform_driver nvec_device_driver = { static struct platform_driver nvec_device_driver = {
.probe = tegra_nvec_probe, .probe = tegra_nvec_probe,
.remove = __devexit_p(tegra_nvec_remove), .remove = __devexit_p(tegra_nvec_remove),
.suspend = tegra_nvec_suspend,
.resume = tegra_nvec_resume,
.driver = { .driver = {
.name = "nvec", .name = "nvec",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &nvec_pm_ops,
.of_match_table = nvidia_nvec_of_match, .of_match_table = nvidia_nvec_of_match,
} }
}; };
......
...@@ -123,8 +123,10 @@ static int __devinit nvec_mouse_probe(struct platform_device *pdev) ...@@ -123,8 +123,10 @@ static int __devinit nvec_mouse_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int nvec_mouse_suspend(struct platform_device *pdev, pm_message_t state) #ifdef CONFIG_PM_SLEEP
static int nvec_mouse_suspend(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
/* disable mouse */ /* disable mouse */
...@@ -136,8 +138,9 @@ static int nvec_mouse_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -136,8 +138,9 @@ static int nvec_mouse_suspend(struct platform_device *pdev, pm_message_t state)
return 0; return 0;
} }
static int nvec_mouse_resume(struct platform_device *pdev) static int nvec_mouse_resume(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
ps2_startstreaming(ps2_dev.ser_dev); ps2_startstreaming(ps2_dev.ser_dev);
...@@ -147,14 +150,17 @@ static int nvec_mouse_resume(struct platform_device *pdev) ...@@ -147,14 +150,17 @@ static int nvec_mouse_resume(struct platform_device *pdev)
return 0; return 0;
} }
#endif
static const SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend,
nvec_mouse_resume);
static struct platform_driver nvec_mouse_driver = { static struct platform_driver nvec_mouse_driver = {
.probe = nvec_mouse_probe, .probe = nvec_mouse_probe,
.suspend = nvec_mouse_suspend,
.resume = nvec_mouse_resume,
.driver = { .driver = {
.name = "nvec-mouse", .name = "nvec-mouse",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &nvec_mouse_pm_ops,
}, },
}; };
......
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