Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: nvec: cleanup powermanagement callbacks

Simplify powermanagement initialization by using pm_ops macro.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Marc Dietrich and committed by
Greg Kroah-Hartman
ebefae28 9891b1ce

+20 -14
+10 -10
drivers/staging/nvec/nvec.c
··· 700 700 clk_disable(nvec->i2c_clk); 701 701 } 702 702 703 + #ifdef CONFIG_PM_SLEEP 703 704 static void nvec_disable_i2c_slave(struct nvec_chip *nvec) 704 705 { 705 706 disable_irq(nvec->irq); 706 707 writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG); 707 708 clk_disable(nvec->i2c_clk); 708 709 } 710 + #endif 709 711 710 712 static void nvec_power_off(void) 711 713 { ··· 864 862 return 0; 865 863 } 866 864 867 - #ifdef CONFIG_PM 868 - 869 - static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t state) 865 + #ifdef CONFIG_PM_SLEEP 866 + static int nvec_suspend(struct device *dev) 870 867 { 868 + struct platform_device *pdev = to_platform_device(dev); 871 869 struct nvec_chip *nvec = platform_get_drvdata(pdev); 872 870 struct nvec_msg *msg; 873 871 ··· 884 882 return 0; 885 883 } 886 884 887 - static int tegra_nvec_resume(struct platform_device *pdev) 885 + static int nvec_resume(struct device *dev) 888 886 { 887 + struct platform_device *pdev = to_platform_device(dev); 889 888 struct nvec_chip *nvec = platform_get_drvdata(pdev); 890 889 891 890 dev_dbg(nvec->dev, "resuming\n"); ··· 895 892 896 893 return 0; 897 894 } 898 - 899 - #else 900 - #define tegra_nvec_suspend NULL 901 - #define tegra_nvec_resume NULL 902 895 #endif 896 + 897 + static const SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume); 903 898 904 899 /* Match table for of_platform binding */ 905 900 static const struct of_device_id nvidia_nvec_of_match[] __devinitconst = { ··· 909 908 static struct platform_driver nvec_device_driver = { 910 909 .probe = tegra_nvec_probe, 911 910 .remove = __devexit_p(tegra_nvec_remove), 912 - .suspend = tegra_nvec_suspend, 913 - .resume = tegra_nvec_resume, 914 911 .driver = { 915 912 .name = "nvec", 916 913 .owner = THIS_MODULE, 914 + .pm = &nvec_pm_ops, 917 915 .of_match_table = nvidia_nvec_of_match, 918 916 } 919 917 };
+10 -4
drivers/staging/nvec/nvec_ps2.c
··· 123 123 return 0; 124 124 } 125 125 126 - static int nvec_mouse_suspend(struct platform_device *pdev, pm_message_t state) 126 + #ifdef CONFIG_PM_SLEEP 127 + static int nvec_mouse_suspend(struct device *dev) 127 128 { 129 + struct platform_device *pdev = to_platform_device(dev); 128 130 struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); 129 131 130 132 /* disable mouse */ ··· 138 136 return 0; 139 137 } 140 138 141 - static int nvec_mouse_resume(struct platform_device *pdev) 139 + static int nvec_mouse_resume(struct device *dev) 142 140 { 141 + struct platform_device *pdev = to_platform_device(dev); 143 142 struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); 144 143 145 144 ps2_startstreaming(ps2_dev.ser_dev); ··· 150 147 151 148 return 0; 152 149 } 150 + #endif 151 + 152 + static const SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend, 153 + nvec_mouse_resume); 153 154 154 155 static struct platform_driver nvec_mouse_driver = { 155 156 .probe = nvec_mouse_probe, 156 - .suspend = nvec_mouse_suspend, 157 - .resume = nvec_mouse_resume, 158 157 .driver = { 159 158 .name = "nvec-mouse", 160 159 .owner = THIS_MODULE, 160 + .pm = &nvec_mouse_pm_ops, 161 161 }, 162 162 }; 163 163