Skip to contentSkip to conversation

mtd: Remove #ifdef guards for PM functions

PATCH Applied Paul Cercueil 2 participants 14 messages Nov 17

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover mtd: Remove #ifdef guards for PM functions

Hi,

This is the v2 of my patchset that updates the MTD core / NAND core as well as several drivers to get rid of the #ifdef CONFIG_PM guards.

Instead, the code that depends on PM or runtime PM will be garbage-collected by the compiler automatically if this config option is not set.

The rationale behind this change is that in general conditionally compiled code is a bad choice, as code behind a rarely-used config can get broken without anybody noticing.

In this v2, I removed the pm_ptr() use on shutdown callbacks, as neither platform_driver.shutdown() nor the mtd_suspend() / mtd_resume() that the shutdown callbacks call are related to CONFIG_PM.

Changelog:

v2:
- [04/12]: Don't use pm_ptr(), and rewrite commit message
- [05/12]: Don't use pm_ptr(), and rewrite commit message

Cheers,
-Paul

Paul Cercueil (12):
mtd: Remove #ifdef guards for PM related functions
mtd: rawnand: vf610: Remove #ifdef guards for PM related functions
mtd: spear_smi: Remove #ifdef guards for PM related functions
mtd: physmap: Remove #ifdef guards around shutdown callback
mtd: maps: pxa2xx: Remove #ifdef guards around shutdown callback
mtd: nand: mtk: Remove #ifdef guards for PM related functions
mtd: rawnand: fsmc: Remove #ifdef guards for PM related functions
mtd: rawnand: hisi504: Remove #ifdef guards for PM related functions
mtd: rawnand: mtk: Remove #ifdef guards for PM related functions
mtd: rawnand: omap_elm: Remove #ifdef guards for PM related functions
mtd: rawnand: r852: Remove #ifdef guards for PM related functions
mtd: rawnand: txx9ndfmc: Remove #ifdef guards for PM related functions

 drivers/mtd/devices/spear_smi.c     |  6 ++----
 drivers/mtd/maps/physmap-core.c     |  4 ----
 drivers/mtd/maps/pxa2xx-flash.c     |  4 ----
 drivers/mtd/mtdcore.c               | 10 ++--------
 drivers/mtd/nand/ecc-mtk.c          |  8 ++------
 drivers/mtd/nand/raw/fsmc_nand.c    |  6 ++----
 drivers/mtd/nand/raw/hisi504_nand.c |  7 +++----
 drivers/mtd/nand/raw/mtk_nand.c     |  8 ++------
 drivers/mtd/nand/raw/omap_elm.c     |  6 ++----
 drivers/mtd/nand/raw/r852.c         |  6 ++----
 drivers/mtd/nand/raw/txx9ndfmc.c    |  6 +-----
 drivers/mtd/nand/raw/vf610_nfc.c    |  6 ++----
 12 files changed, 20 insertions(+), 57 deletions(-)
Cc Stefan Agner <[email protected]>
Cc Matthias Brugger <[email protected]>
Cc AngeloGioacchino Del Regno <[email protected]>
Cc Maxim Levitsky <[email protected]>
Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 1/12 mtd: Remove #ifdef guards for PM related functions

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---

v2: No change

---
 drivers/mtd/mtdcore.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/mtd/mtdcore.c +2 -8
index 82b1e6392b16..037fe292867b 100644
@@ -40,8 +40,6 @@
 
 struct backing_dev_info *mtd_bdi;
 
-#ifdef CONFIG_PM_SLEEP
-
 static int mtd_cls_suspend(struct device *dev)
 {
 	struct mtd_info *mtd = dev_get_drvdata(dev);
@@ -58,15 +56,11 @@ static int mtd_cls_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(mtd_cls_pm_ops, mtd_cls_suspend, mtd_cls_resume);
-#define MTD_CLS_PM_OPS (&mtd_cls_pm_ops)
-#else
-#define MTD_CLS_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mtd_cls_pm_ops, mtd_cls_suspend, mtd_cls_resume);
 
 static struct class mtd_class = {
 	.name = "mtd",
-	.pm = MTD_CLS_PM_OPS,
+	.pm = pm_sleep_ptr(&mtd_cls_pm_ops),
 };
 
 static DEFINE_IDR(mtd_idr);
Signature · 1 line
2.47.3
#2 lore raw

PATCH v2 2/12 mtd: rawnand: vf610: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---
Cc: Stefan Agner <[email protected]>

v2: No change

---
 drivers/mtd/nand/raw/vf610_nfc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/vf610_nfc.c +2 -4
index 9940681810cf..d785c3d28e51 100644
@@ -906,7 +906,6 @@ static void vf610_nfc_remove(struct platform_device *pdev)
 	nand_cleanup(chip);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int vf610_nfc_suspend(struct device *dev)
 {
 	struct vf610_nfc *nfc = dev_get_drvdata(dev);
@@ -928,15 +927,14 @@ static int vf610_nfc_resume(struct device *dev)
 	vf610_nfc_init_controller(nfc);
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(vf610_nfc_pm_ops, vf610_nfc_suspend, vf610_nfc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(vf610_nfc_pm_ops, vf610_nfc_suspend, vf610_nfc_resume);
 
 static struct platform_driver vf610_nfc_driver = {
 	.driver		= {
 		.name	= DRV_NAME,
 		.of_match_table = vf610_nfc_dt_ids,
-		.pm	= &vf610_nfc_pm_ops,
+		.pm	= pm_sleep_ptr(&vf610_nfc_pm_ops),
 	},
 	.probe		= vf610_nfc_probe,
 	.remove		= vf610_nfc_remove,
Signature · 1 line
2.47.3
#3 lore raw

PATCH v2 3/12 mtd: spear_smi: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---

v2: No change

---
 drivers/mtd/devices/spear_smi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/devices/spear_smi.c +2 -4
index f02f96bff450..689141e525c0 100644
@@ -1050,7 +1050,6 @@ static void spear_smi_remove(struct platform_device *pdev)
 	}
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int spear_smi_suspend(struct device *dev)
 {
 	struct spear_smi *sdev = dev_get_drvdata(dev);
@@ -1073,9 +1072,8 @@ static int spear_smi_resume(struct device *dev)
 		spear_smi_hw_init(sdev);
 	return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(spear_smi_pm_ops, spear_smi_suspend, spear_smi_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(spear_smi_pm_ops, spear_smi_suspend, spear_smi_resume);
 
 #ifdef CONFIG_OF
 static const struct of_device_id spear_smi_id_table[] = {
@@ -1090,7 +1088,7 @@ static struct platform_driver spear_smi_driver = {
 		.name = "smi",
 		.bus = &platform_bus_type,
 		.of_match_table = of_match_ptr(spear_smi_id_table),
-		.pm = &spear_smi_pm_ops,
+		.pm = pm_sleep_ptr(&spear_smi_pm_ops),
 	},
 	.probe = spear_smi_probe,
 	.remove = spear_smi_remove,
Signature · 1 line
2.47.3
#4 lore raw

PATCH v2 4/12 mtd: physmap: Remove #ifdef guards around shutdown callback

In reply to Paul Cercueil

physmap_flash_shutdown() calls mtd_suspend() and mtd_resume().

Unlike what their names suggest, those two functions aren't related to CONFIG_PM, and neither is the platform_driver.shutdown() callback.

---

v2: Don't use pm_ptr(), and rewrite commit message

---
 drivers/mtd/maps/physmap-core.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/mtd/maps/physmap-core.c +0 -4
index dcda7685fc99..672747890972 100644
@@ -600,7 +600,6 @@ static int physmap_flash_probe(struct platform_device *dev)
 	return err;
 }
 
-#ifdef CONFIG_PM
 static void physmap_flash_shutdown(struct platform_device *dev)
 {
 	struct physmap_flash_info *info = platform_get_drvdata(dev);
@@ -610,9 +609,6 @@ static void physmap_flash_shutdown(struct platform_device *dev)
 		if (mtd_suspend(info->mtds[i]) == 0)
 			mtd_resume(info->mtds[i]);
 }
-#else
-#define physmap_flash_shutdown NULL
-#endif
 
 static struct platform_driver physmap_flash_driver = {
 	.probe		= physmap_flash_probe,
Signature · 1 line
2.47.3
#5 lore raw

PATCH v2 5/12 mtd: maps: pxa2xx: Remove #ifdef guards around shutdown callback

In reply to Paul Cercueil

pxa2xx_flash_shutdown() calls mtd_suspend() and mtd_resume().

Unlike what their names suggest, those two functions aren't related to CONFIG_PM, and neither is the platform_driver.shutdown() callback.

---

v2: Don't use pm_ptr(), and rewrite commit message

---
 drivers/mtd/maps/pxa2xx-flash.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/mtd/maps/pxa2xx-flash.c +0 -4
index bc303a9909d4..5846e09cea37 100644
@@ -111,7 +111,6 @@ static void pxa2xx_flash_remove(struct platform_device *dev)
 	kfree(info);
 }
 
-#ifdef CONFIG_PM
 static void pxa2xx_flash_shutdown(struct platform_device *dev)
 {
 	struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
@@ -119,9 +118,6 @@ static void pxa2xx_flash_shutdown(struct platform_device *dev)
 	if (info && mtd_suspend(info->mtd) == 0)
 		mtd_resume(info->mtd);
 }
-#else
-#define pxa2xx_flash_shutdown NULL
-#endif
 
 static struct platform_driver pxa2xx_flash_driver = {
 	.driver = {
Signature · 1 line
2.47.3
#6 lore raw

PATCH v2 6/12 mtd: nand: mtk: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---
Cc: Matthias Brugger <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Cc: [email protected]
Cc: [email protected]

v2: No change

---
 drivers/mtd/nand/ecc-mtk.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/mtd/nand/ecc-mtk.c +2 -6
index 66f0985ef7cd..6f210ba935ad 100644
@@ -588,7 +588,6 @@ static int mtk_ecc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mtk_ecc_suspend(struct device *dev)
 {
 	struct mtk_ecc *ecc = dev_get_drvdata(dev);
@@ -612,8 +611,7 @@ static int mtk_ecc_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(mtk_ecc_pm_ops, mtk_ecc_suspend, mtk_ecc_resume);
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_ecc_pm_ops, mtk_ecc_suspend, mtk_ecc_resume);
 
 MODULE_DEVICE_TABLE(of, mtk_ecc_dt_match);
 
@@ -622,9 +620,7 @@ static struct platform_driver mtk_ecc_driver = {
 	.driver = {
 		.name  = "mtk-ecc",
 		.of_match_table = mtk_ecc_dt_match,
-#ifdef CONFIG_PM_SLEEP
-		.pm = &mtk_ecc_pm_ops,
-#endif
+		.pm = pm_sleep_ptr(&mtk_ecc_pm_ops),
 	},
 };
 
Signature · 1 line
2.47.3
#7 lore raw

PATCH v2 7/12 mtd: rawnand: fsmc: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---

v2: No change

---
 drivers/mtd/nand/raw/fsmc_nand.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/fsmc_nand.c +2 -4
index 837c23c63aeb..56ab42ee9e7d 100644
@@ -1186,7 +1186,6 @@ static void fsmc_nand_remove(struct platform_device *pdev)
 	}
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int fsmc_nand_suspend(struct device *dev)
 {
 	struct fsmc_nand_data *host = dev_get_drvdata(dev);
@@ -1215,9 +1214,8 @@ static int fsmc_nand_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(fsmc_nand_pm_ops, fsmc_nand_suspend, fsmc_nand_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(fsmc_nand_pm_ops, fsmc_nand_suspend, fsmc_nand_resume);
 
 static const struct of_device_id fsmc_nand_id_table[] = {
 	{ .compatible = "st,spear600-fsmc-nand" },
@@ -1231,7 +1229,7 @@ static struct platform_driver fsmc_nand_driver = {
 	.driver = {
 		.name = "fsmc-nand",
 		.of_match_table = fsmc_nand_id_table,
-		.pm = &fsmc_nand_pm_ops,
+		.pm = pm_sleep_ptr(&fsmc_nand_pm_ops),
 	},
 };
 
Signature · 1 line
2.47.3
#8 lore raw

PATCH v2 8/12 mtd: rawnand: hisi504: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---

v2: No change

---
 drivers/mtd/nand/raw/hisi504_nand.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/hisi504_nand.c +3 -4
index d97270ec1185..511d133ea936 100644
@@ -809,7 +809,6 @@ static void hisi_nfc_remove(struct platform_device *pdev)
 	nand_cleanup(chip);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int hisi_nfc_suspend(struct device *dev)
 {
 	struct hinfc_host *host = dev_get_drvdata(dev);
@@ -842,8 +841,8 @@ static int hisi_nfc_resume(struct device *dev)
 
 	return 0;
 }
-#endif
-static SIMPLE_DEV_PM_OPS(hisi_nfc_pm_ops, hisi_nfc_suspend, hisi_nfc_resume);
+
+static DEFINE_SIMPLE_DEV_PM_OPS(hisi_nfc_pm_ops, hisi_nfc_suspend, hisi_nfc_resume);
 
 static const struct of_device_id nfc_id_table[] = {
 	{ .compatible = "hisilicon,504-nfc" },
@@ -855,7 +854,7 @@ static struct platform_driver hisi_nfc_driver = {
 	.driver = {
 		.name  = "hisi_nand",
 		.of_match_table = nfc_id_table,
-		.pm = &hisi_nfc_pm_ops,
+		.pm = pm_sleep_ptr(&hisi_nfc_pm_ops),
 	},
 	.probe		= hisi_nfc_probe,
 	.remove		= hisi_nfc_remove,
Signature · 1 line
2.47.3
#9 lore raw

PATCH v2 9/12 mtd: rawnand: mtk: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---
Cc: Matthias Brugger <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Cc: [email protected]
Cc: [email protected]

v2: No change

---
 drivers/mtd/nand/raw/mtk_nand.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/mtk_nand.c +2 -6
index c439b7814ebb..4b8451772f9b 100644
@@ -1591,7 +1591,6 @@ static void mtk_nfc_remove(struct platform_device *pdev)
 	mtk_ecc_release(nfc->ecc);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mtk_nfc_suspend(struct device *dev)
 {
 	struct mtk_nfc *nfc = dev_get_drvdata(dev);
@@ -1635,8 +1634,7 @@ static int mtk_nfc_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(mtk_nfc_pm_ops, mtk_nfc_suspend, mtk_nfc_resume);
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_nfc_pm_ops, mtk_nfc_suspend, mtk_nfc_resume);
 
 static struct platform_driver mtk_nfc_driver = {
 	.probe  = mtk_nfc_probe,
@@ -1644,9 +1642,7 @@ static struct platform_driver mtk_nfc_driver = {
 	.driver = {
 		.name  = MTK_NAME,
 		.of_match_table = mtk_nfc_id_table,
-#ifdef CONFIG_PM_SLEEP
-		.pm = &mtk_nfc_pm_ops,
-#endif
+		.pm = pm_sleep_ptr(&mtk_nfc_pm_ops),
 	},
 };
 
Signature · 1 line
2.47.3
#10 lore raw

PATCH v2 10/12 mtd: rawnand: omap_elm: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---

v2: No change

---
 drivers/mtd/nand/raw/omap_elm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/omap_elm.c +2 -4
index c1d19b8e6715..2e8ab20d8edb 100644
@@ -428,7 +428,6 @@ static void elm_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 /*
  * elm_context_save
  * saves ELM configurations to preserve them across Hardware powered-down
@@ -540,9 +539,8 @@ static int elm_resume(struct device *dev)
 	elm_context_restore(info);
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);
 
 #ifdef CONFIG_OF
 static const struct of_device_id elm_of_match[] = {
@@ -557,7 +555,7 @@ static struct platform_driver elm_driver = {
 	.driver	= {
 		.name	= DRIVER_NAME,
 		.of_match_table = of_match_ptr(elm_of_match),
-		.pm	= &elm_pm_ops,
+		.pm	= pm_sleep_ptr(&elm_pm_ops),
 	},
 	.probe	= elm_probe,
 	.remove = elm_remove,
Signature · 1 line
2.47.3
#11 lore raw

PATCH v2 11/12 mtd: rawnand: r852: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---
Cc: Maxim Levitsky <[email protected]>

v2: No change

---
 drivers/mtd/nand/raw/r852.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/r852.c +2 -4
index 92c47d351c27..c145eb8ac29d 100644
@@ -1013,7 +1013,6 @@ static void r852_shutdown(struct pci_dev *pci_dev)
 	pci_disable_device(pci_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int r852_suspend(struct device *device)
 {
 	struct r852_device *dev = dev_get_drvdata(device);
@@ -1066,7 +1065,6 @@ static int r852_resume(struct device *device)
 	r852_update_card_detect(dev);
 	return 0;
 }
-#endif
 
 static const struct pci_device_id r852_pci_id_tbl[] = {
 
@@ -1076,7 +1074,7 @@ static const struct pci_device_id r852_pci_id_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, r852_pci_id_tbl);
 
-static SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume);
 
 static struct pci_driver r852_pci_driver = {
 	.name		= DRV_NAME,
@@ -1084,7 +1082,7 @@ static struct pci_driver r852_pci_driver = {
 	.probe		= r852_probe,
 	.remove		= r852_remove,
 	.shutdown	= r852_shutdown,
-	.driver.pm	= &r852_pm_ops,
+	.driver.pm	= pm_sleep_ptr(&r852_pm_ops),
 };
 
 module_pci_driver(r852_pci_driver);
Signature · 1 line
2.47.3
#12 lore raw

PATCH v2 12/12 mtd: rawnand: txx9ndfmc: Remove #ifdef guards for PM related functions

In reply to Paul Cercueil

Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch.

---

v2: No change

---
 drivers/mtd/nand/raw/txx9ndfmc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/mtd/nand/raw/txx9ndfmc.c +1 -5
index 4cc6e91dbc23..9dc624957a3c 100644
@@ -391,21 +391,17 @@ static void txx9ndfmc_remove(struct platform_device *dev)
 	}
 }
 
-#ifdef CONFIG_PM
 static int txx9ndfmc_resume(struct platform_device *dev)
 {
 	if (platform_get_drvdata(dev))
 		txx9ndfmc_initialize(dev);
 	return 0;
 }
-#else
-#define txx9ndfmc_resume NULL
-#endif
 
 static struct platform_driver txx9ndfmc_driver = {
 	.probe		= txx9ndfmc_probe,
 	.remove		= txx9ndfmc_remove,
-	.resume		= txx9ndfmc_resume,
+	.resume		= pm_ptr(txx9ndfmc_resume),
 	.driver		= {
 		.name	= "txx9ndfmc",
 	},
Signature · 1 line
2.47.3
maintainer Applied
#13 lore raw
In reply to Paul Cercueil
Quoted 8 lines · Paul Cercueil

This is the v2 of my patchset that updates the MTD core / NAND core as well as several drivers to get rid of the #ifdef CONFIG_PM guards.

Instead, the code that depends on PM or runtime PM will be garbage-collected by the compiler automatically if this config option is not set.

[...]

Applied to mtd/next, thanks!

[01/12] mtd: Remove #ifdef guards for PM related functions

        commit: 7fb3ea311f1da6a6ef13ed4b4dab7fe74b82f161
[02/12] mtd: rawnand: vf610: Remove #ifdef guards for PM related functions
        commit: ab12847196fdcac7e72e46c5366036c024b0fd8f
[03/12] mtd: spear_smi: Remove #ifdef guards for PM related functions
        commit: 2a37924f5c8152c25bb485ca8419317e086a19aa
[04/12] mtd: physmap: Remove #ifdef guards around shutdown callback
        commit: a54ceff6976e239666f8f19ffbbeea50ae5ca3e0
[05/12] mtd: maps: pxa2xx: Remove #ifdef guards around shutdown callback
        commit: 397d22308379b6445890811a107dc950d4fbec05
[06/12] mtd: nand: mtk: Remove #ifdef guards for PM related functions
        commit: 5d1883f69df537e6ed34bba098cf49f5595dfeb6
[07/12] mtd: rawnand: fsmc: Remove #ifdef guards for PM related functions
        commit: 81f7cbdb040e768bed8db543221a214a5df2042e
[08/12] mtd: rawnand: hisi504: Remove #ifdef guards for PM related functions
        commit: 76ad0034e3013d8a03a79e6820e97e9537b769d8
[09/12] mtd: rawnand: mtk: Remove #ifdef guards for PM related functions
        commit: 41e59826fa387b4a151cc97c2907e0d71aa6bd64
[10/12] mtd: rawnand: omap_elm: Remove #ifdef guards for PM related functions
        commit: ce7455c8b2fd693cadb65078d625c7eac984ea1b
[11/12] mtd: rawnand: r852: Remove #ifdef guards for PM related functions
        commit: 6dbc7c326713261812531134085c7a3d23abf3be
[12/12] mtd: rawnand: txx9ndfmc: Remove #ifdef guards for PM related functions
        commit: dc88e180ed485a7c8c97e06c6f7e0ef896992290

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl