Re: [PATCH] dmaengine: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Frank Li <[email protected]>
| Newsgroups | org.kernel.vger.dmaengine,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aocdFqx-cRl4mUsX@SMW015318> |
On Thu, Aug 20, 2026 at 02:53:30PM +0700, Triet Hoang wrote: > > Convert the deprecated SIMPLE_DEV_PM_OPS > to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr(). > > This lets us drop the __maybe_unused annotations from the suspend and > resume callbacks, and reduces kernel size in case CONFIG_PM or > CONFIG_PM_SLEEP is disabled. > > Signed-off-by: Triet Hoang <[email protected]> > --- > drivers/dma/k3dma.c | 6 ++---- > drivers/dma/pch_dma.c | 8 ++++---- Does other dmaengine also convert? if not, can you convert all? Frank > 2 files changed, 6 insertions(+), 8 deletions(-) > > diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c > index e84f197fea76..e0138f5bfd65 100644 > --- a/drivers/dma/k3dma.c > +++ b/drivers/dma/k3dma.c > @@ -982,7 +982,6 @@ static void k3_dma_remove(struct platform_device *op) > clk_disable_unprepare(d->clk); > } > > -#ifdef CONFIG_PM_SLEEP > static int k3_dma_suspend_dev(struct device *dev) > { > struct k3_dma_dev *d = dev_get_drvdata(dev); > @@ -1012,14 +1011,13 @@ static int k3_dma_resume_dev(struct device *dev) > k3_dma_enable_dma(d, true); > return 0; > } > -#endif > > -static SIMPLE_DEV_PM_OPS(k3_dma_pmops, k3_dma_suspend_dev, k3_dma_resume_dev); > +static DEFINE_SIMPLE_DEV_PM_OPS(k3_dma_pmops, k3_dma_suspend_dev, k3_dma_resume_dev); > > static struct platform_driver k3_pdma_driver = { > .driver = { > .name = DRIVER_NAME, > - .pm = &k3_dma_pmops, > + .pm = pm_sleep_ptr(&k3_dma_pmops), > .of_match_table = k3_pdma_dt_ids, > }, > .probe = k3_dma_probe, > diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c > index bf805f1024f6..e6d7c72fce3c 100644 > --- a/drivers/dma/pch_dma.c > +++ b/drivers/dma/pch_dma.c > @@ -776,7 +776,7 @@ static void __maybe_unused pch_dma_restore_regs(struct pch_dma *pd) > } > } > > -static int __maybe_unused pch_dma_suspend(struct device *dev) > +static int pch_dma_suspend(struct device *dev) > { > struct pch_dma *pd = dev_get_drvdata(dev); > > @@ -786,7 +786,7 @@ static int __maybe_unused pch_dma_suspend(struct device *dev) > return 0; > } > > -static int __maybe_unused pch_dma_resume(struct device *dev) > +static int pch_dma_resume(struct device *dev) > { > struct pch_dma *pd = dev_get_drvdata(dev); > > @@ -972,14 +972,14 @@ static const struct pci_device_id pch_dma_id_table[] = { > }; > MODULE_DEVICE_TABLE(pci, pch_dma_id_table); > > -static SIMPLE_DEV_PM_OPS(pch_dma_pm_ops, pch_dma_suspend, pch_dma_resume); > +static DEFINE_SIMPLE_DEV_PM_OPS(pch_dma_pm_ops, pch_dma_suspend, pch_dma_resume); > > static struct pci_driver pch_dma_driver = { > .name = DRV_NAME, > .id_table = pch_dma_id_table, > .probe = pch_dma_probe, > .remove = pch_dma_remove, > - .driver.pm = &pch_dma_pm_ops, > + .driver.pm = pm_sleep_ptr(&pch_dma_pm_ops), > }; > > module_pci_driver(pch_dma_driver); > -- > 2.53.0 >