{
        unsigned char reg;
        struct platform_device *pdev = to_platform_device(dev);
-       struct m48t86_ops *ops = pdev->dev.platform_data;
+       struct m48t86_ops *ops = dev_get_platdata(&pdev->dev);
 
        reg = ops->readbyte(M48T86_REG_B);
 
 {
        unsigned char reg;
        struct platform_device *pdev = to_platform_device(dev);
-       struct m48t86_ops *ops = pdev->dev.platform_data;
+       struct m48t86_ops *ops = dev_get_platdata(&pdev->dev);
 
        reg = ops->readbyte(M48T86_REG_B);
 
 {
        unsigned char reg;
        struct platform_device *pdev = to_platform_device(dev);
-       struct m48t86_ops *ops = pdev->dev.platform_data;
+       struct m48t86_ops *ops = dev_get_platdata(&pdev->dev);
 
        reg = ops->readbyte(M48T86_REG_B);
 
 static int m48t86_rtc_probe(struct platform_device *dev)
 {
        unsigned char reg;
-       struct m48t86_ops *ops = dev->dev.platform_data;
+       struct m48t86_ops *ops = dev_get_platdata(&dev->dev);
        struct rtc_device *rtc;
 
        rtc = devm_rtc_device_register(&dev->dev, "m48t86",