| .. | .. |
|---|
| 240 | 240 | { |
|---|
| 241 | 241 | struct ptp_dte *ptp_dte; |
|---|
| 242 | 242 | struct device *dev = &pdev->dev; |
|---|
| 243 | | - struct resource *res; |
|---|
| 244 | 243 | |
|---|
| 245 | 244 | ptp_dte = devm_kzalloc(dev, sizeof(struct ptp_dte), GFP_KERNEL); |
|---|
| 246 | 245 | if (!ptp_dte) |
|---|
| 247 | 246 | return -ENOMEM; |
|---|
| 248 | 247 | |
|---|
| 249 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 250 | | - ptp_dte->regs = devm_ioremap_resource(dev, res); |
|---|
| 251 | | - if (IS_ERR(ptp_dte->regs)) { |
|---|
| 252 | | - dev_err(dev, |
|---|
| 253 | | - "%s: io remap failed\n", __func__); |
|---|
| 248 | + ptp_dte->regs = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 249 | + if (IS_ERR(ptp_dte->regs)) |
|---|
| 254 | 250 | return PTR_ERR(ptp_dte->regs); |
|---|
| 255 | | - } |
|---|
| 256 | 251 | |
|---|
| 257 | 252 | spin_lock_init(&ptp_dte->lock); |
|---|
| 258 | 253 | |
|---|
| .. | .. |
|---|
| 288 | 283 | #ifdef CONFIG_PM_SLEEP |
|---|
| 289 | 284 | static int ptp_dte_suspend(struct device *dev) |
|---|
| 290 | 285 | { |
|---|
| 291 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 292 | | - struct ptp_dte *ptp_dte = platform_get_drvdata(pdev); |
|---|
| 286 | + struct ptp_dte *ptp_dte = dev_get_drvdata(dev); |
|---|
| 293 | 287 | u8 i; |
|---|
| 294 | 288 | |
|---|
| 295 | 289 | for (i = 0; i < DTE_NUM_REGS_TO_RESTORE; i++) { |
|---|
| .. | .. |
|---|
| 305 | 299 | |
|---|
| 306 | 300 | static int ptp_dte_resume(struct device *dev) |
|---|
| 307 | 301 | { |
|---|
| 308 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 309 | | - struct ptp_dte *ptp_dte = platform_get_drvdata(pdev); |
|---|
| 302 | + struct ptp_dte *ptp_dte = dev_get_drvdata(dev); |
|---|
| 310 | 303 | u8 i; |
|---|
| 311 | 304 | |
|---|
| 312 | 305 | for (i = 0; i < DTE_NUM_REGS_TO_RESTORE; i++) { |
|---|