spi: cadence: use to_platform_device()
authorGeliang Tang <geliangtang@163.com>
Fri, 1 Jan 2016 12:28:59 +0000 (20:28 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 5 Jan 2016 11:34:23 +0000 (11:34 +0000)
Use to_platform_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-cadence.c

index 5a6749881ff9c90c2e887c2cded0f055e01f7288..121a4135b5401b4dbe025f822c927d0f4d1b2947 100644 (file)
@@ -617,8 +617,7 @@ static int cdns_spi_remove(struct platform_device *pdev)
  */
 static int __maybe_unused cdns_spi_suspend(struct device *dev)
 {
-       struct platform_device *pdev = container_of(dev,
-                       struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(dev);
        struct spi_master *master = platform_get_drvdata(pdev);
        struct cdns_spi *xspi = spi_master_get_devdata(master);
 
@@ -641,8 +640,7 @@ static int __maybe_unused cdns_spi_suspend(struct device *dev)
  */
 static int __maybe_unused cdns_spi_resume(struct device *dev)
 {
-       struct platform_device *pdev = container_of(dev,
-                       struct platform_device, dev);
+       struct platform_device *pdev = to_platform_device(dev);
        struct spi_master *master = platform_get_drvdata(pdev);
        struct cdns_spi *xspi = spi_master_get_devdata(master);
        int ret = 0;