Skip to content

Commit be3206e

Browse files
DhruvaG2000broonie
authored andcommitted
spi: cadence-quadspi: use macro DEFINE_SIMPLE_DEV_PM_OPS
Using this macro makes the code more readable. It also inits the members of dev_pm_ops in the following manner without us explicitly needing to: .suspend = cqspi_suspend, \ .resume = cqspi_resume, \ .freeze = cqspi_suspend, \ .thaw = cqspi_resume, \ .poweroff = cqspi_suspend, \ .restore = cqspi_resume Also get rid of conditional compilation based on CONFIG_PM_SLEEP because it introduces build issues with certain configs when CQSPI_DEV_PM_OPS is just NULL. Reported-by: kernel test robot <[email protected]> Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 1406234 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller") Signed-off-by: Dhruva Gole <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 0187534 commit be3206e

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/spi/spi-cadence-quadspi.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,6 @@ static void cqspi_remove(struct platform_device *pdev)
18201820
pm_runtime_disable(&pdev->dev);
18211821
}
18221822

1823-
#ifdef CONFIG_PM_SLEEP
18241823
static int cqspi_suspend(struct device *dev)
18251824
{
18261825
struct cqspi_st *cqspi = dev_get_drvdata(dev);
@@ -1850,15 +1849,7 @@ static int cqspi_resume(struct device *dev)
18501849
return spi_master_resume(master);
18511850
}
18521851

1853-
static const struct dev_pm_ops cqspi__dev_pm_ops = {
1854-
.suspend = cqspi_suspend,
1855-
.resume = cqspi_resume,
1856-
};
1857-
1858-
#define CQSPI_DEV_PM_OPS (&cqspi__dev_pm_ops)
1859-
#else
1860-
#define CQSPI_DEV_PM_OPS NULL
1861-
#endif
1852+
static DEFINE_SIMPLE_DEV_PM_OPS(cqspi_dev_pm_ops, cqspi_suspend, cqspi_resume);
18621853

18631854
static const struct cqspi_driver_platdata cdns_qspi = {
18641855
.quirks = CQSPI_DISABLE_DAC_MODE,
@@ -1933,7 +1924,7 @@ static struct platform_driver cqspi_platform_driver = {
19331924
.remove_new = cqspi_remove,
19341925
.driver = {
19351926
.name = CQSPI_NAME,
1936-
.pm = CQSPI_DEV_PM_OPS,
1927+
.pm = &cqspi_dev_pm_ops,
19371928
.of_match_table = cqspi_dt_ids,
19381929
},
19391930
};

0 commit comments

Comments
 (0)