spi: zynq: use to_platform_device()
authorGeliang Tang <geliangtang@163.com>
Fri, 1 Jan 2016 12:29:00 +0000 (20:29 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 5 Jan 2016 11:34:37 +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-zynqmp-gqspi.c

index f23f36ebaf3dc700447da2e4da6e9b1b28e8ed82..aab9b492c627ada109f4cb5ac9840b5b79cdf2f6 100644 (file)
@@ -917,9 +917,7 @@ static int zynqmp_qspi_start_transfer(struct spi_master *master,
  */
 static int __maybe_unused zynqmp_qspi_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);
 
        spi_master_suspend(master);
@@ -940,9 +938,7 @@ static int __maybe_unused zynqmp_qspi_suspend(struct device *dev)
  */
 static int __maybe_unused zynqmp_qspi_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 zynqmp_qspi *xqspi = spi_master_get_devdata(master);
        int ret = 0;