mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
spi: cadence-quadspi: use macro DEFINE_SIMPLE_DEV_PM_OPS
[ Upstream commitbe3206e890] 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 <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202304191900.2fARFQW9-lkp@intel.com/ Fixes:1406234105("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller") Signed-off-by: Dhruva Gole <d-gole@ti.com> Link: https://lore.kernel.org/r/20230420054257.925092-1-d-gole@ti.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
727e92fe13
commit
7f43a5bde8
@@ -1763,7 +1763,6 @@ static int cqspi_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int cqspi_suspend(struct device *dev)
|
||||
{
|
||||
struct cqspi_st *cqspi = dev_get_drvdata(dev);
|
||||
@@ -1793,15 +1792,7 @@ static int cqspi_resume(struct device *dev)
|
||||
return spi_master_resume(master);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops cqspi__dev_pm_ops = {
|
||||
.suspend = cqspi_suspend,
|
||||
.resume = cqspi_resume,
|
||||
};
|
||||
|
||||
#define CQSPI_DEV_PM_OPS (&cqspi__dev_pm_ops)
|
||||
#else
|
||||
#define CQSPI_DEV_PM_OPS NULL
|
||||
#endif
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(cqspi_dev_pm_ops, cqspi_suspend, cqspi_resume);
|
||||
|
||||
static const struct cqspi_driver_platdata cdns_qspi = {
|
||||
.quirks = CQSPI_DISABLE_DAC_MODE,
|
||||
@@ -1868,7 +1859,7 @@ static struct platform_driver cqspi_platform_driver = {
|
||||
.remove = cqspi_remove,
|
||||
.driver = {
|
||||
.name = CQSPI_NAME,
|
||||
.pm = CQSPI_DEV_PM_OPS,
|
||||
.pm = &cqspi_dev_pm_ops,
|
||||
.of_match_table = cqspi_dt_ids,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user