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

can: flexcan: Use SIMPLE_DEV_PM_OPS

Using SIMPLE_DEV_PM_OPS can make the code smaller and simpler.

Also change CONFIG_PM to CONFIG_PM_SLEEP.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Fabio Estevam and committed by
Marc Kleine-Budde
588e7a8e 4d7f7635

+9 -11
+9 -11
drivers/net/can/flexcan.c
··· 1131 1131 return 0; 1132 1132 } 1133 1133 1134 - #ifdef CONFIG_PM 1135 - static int flexcan_suspend(struct platform_device *pdev, pm_message_t state) 1134 + #ifdef CONFIG_PM_SLEEP 1135 + static int flexcan_suspend(struct device *device) 1136 1136 { 1137 - struct net_device *dev = platform_get_drvdata(pdev); 1137 + struct net_device *dev = dev_get_drvdata(device); 1138 1138 struct flexcan_priv *priv = netdev_priv(dev); 1139 1139 1140 1140 flexcan_chip_disable(priv); ··· 1148 1148 return 0; 1149 1149 } 1150 1150 1151 - static int flexcan_resume(struct platform_device *pdev) 1151 + static int flexcan_resume(struct device *device) 1152 1152 { 1153 - struct net_device *dev = platform_get_drvdata(pdev); 1153 + struct net_device *dev = dev_get_drvdata(device); 1154 1154 struct flexcan_priv *priv = netdev_priv(dev); 1155 1155 1156 1156 priv->can.state = CAN_STATE_ERROR_ACTIVE; ··· 1162 1162 1163 1163 return 0; 1164 1164 } 1165 - #else 1166 - #define flexcan_suspend NULL 1167 - #define flexcan_resume NULL 1168 - #endif 1165 + #endif /* CONFIG_PM_SLEEP */ 1166 + 1167 + static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); 1169 1168 1170 1169 static struct platform_driver flexcan_driver = { 1171 1170 .driver = { 1172 1171 .name = DRV_NAME, 1173 1172 .owner = THIS_MODULE, 1173 + .pm = &flexcan_pm_ops, 1174 1174 .of_match_table = flexcan_of_match, 1175 1175 }, 1176 1176 .probe = flexcan_probe, 1177 1177 .remove = flexcan_remove, 1178 - .suspend = flexcan_suspend, 1179 - .resume = flexcan_resume, 1180 1178 .id_table = flexcan_id_table, 1181 1179 }; 1182 1180