i2c: st: use to_platform_device()
authorGeliang Tang <geliangtang@163.com>
Sun, 27 Dec 2015 13:15:42 +0000 (21:15 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 3 Jan 2016 18:54:31 +0000 (19:54 +0100)
Use to_platform_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-st.c

index ea72dca32fdfde83cfdd223525a915a5721d6816..2c3ad8eea1d5392d89ab326d6ef1389a764ed7a7 100644 (file)
@@ -708,8 +708,7 @@ static int st_i2c_xfer(struct i2c_adapter *i2c_adap,
 #ifdef CONFIG_PM_SLEEP
 static int st_i2c_suspend(struct device *dev)
 {
-       struct platform_device *pdev =
-               container_of(dev, struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(dev);
        struct st_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
 
        if (i2c_dev->busy)