public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups
@ 2023-11-24 19:31 Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 1/5] mfd: intel-lpss: Revert "Add missing check for platform_get_resource" Andy Shevchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-11-24 19:31 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: Lee Jones

After looking into the latest changes in the driver I noticed one
wrong patch. That induced looking closer to the current state of
affairs in the driver. It appears that some code is outdated and
may be cleaned up. Hence this series.

Andy Shevchenko (5):
  mfd: intel-lpss: Revert "Add missing check for platform_get_resource"
  mfd: intel-lpss: Use device_get_match_data()
  mfd: intel-lpss: Adjust header inclusions
  mfd: intel-lpss: Move exported symbols to INTEL_LPSS namespace
  mfd: intel-lpss: Provide Intel LPSS PM ops structure

 drivers/mfd/intel-lpss-acpi.c | 27 ++++++++++++------------
 drivers/mfd/intel-lpss-pci.c  | 19 ++++++++++-------
 drivers/mfd/intel-lpss.c      | 39 +++++++++++++++++++++--------------
 drivers/mfd/intel-lpss.h      | 28 +------------------------
 4 files changed, 51 insertions(+), 62 deletions(-)

-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/5] mfd: intel-lpss: Revert "Add missing check for platform_get_resource"
  2023-11-24 19:31 [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Andy Shevchenko
@ 2023-11-24 19:31 ` Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 2/5] mfd: intel-lpss: Use device_get_match_data() Andy Shevchenko
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-11-24 19:31 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: Lee Jones

This reverts commit d918e0d5824495a75d00b879118b098fcab36fdb.

The commit in question does not fix anything and only introduces
a duplication in the code. The main intel_lpss_probe() performs
all necessary checks.

While at it and in order of avoiding similar patches to come, add
a comment.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/intel-lpss-acpi.c | 4 +---
 drivers/mfd/intel-lpss-pci.c  | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 5184fd1a5df1..52ffc0d9c23f 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -182,10 +182,8 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)
 	if (!info)
 		return -ENOMEM;
 
+	/* No need to check mem and irq here as intel_lpss_probe() does it for us */
 	info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!info->mem)
-		return -ENODEV;
-
 	info->irq = platform_get_irq(pdev, 0);
 
 	ret = intel_lpss_probe(&pdev->dev, info);
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index cf56cd3a40ee..709b0fb4419d 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -46,6 +46,7 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev,
 	if (!info)
 		return -ENOMEM;
 
+	/* No need to check mem and irq here as intel_lpss_probe() does it for us */
 	info->mem = pci_resource_n(pdev, 0);
 	info->irq = pci_irq_vector(pdev, 0);
 
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/5] mfd: intel-lpss: Use device_get_match_data()
  2023-11-24 19:31 [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 1/5] mfd: intel-lpss: Revert "Add missing check for platform_get_resource" Andy Shevchenko
@ 2023-11-24 19:31 ` Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 3/5] mfd: intel-lpss: Adjust header inclusions Andy Shevchenko
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-11-24 19:31 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: Lee Jones

Use preferred device_get_match_data() instead of acpi_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Introduce a temporary variable in PCI glue driver to be consistent with
ACPI one on the same matter.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/intel-lpss-acpi.c | 11 +++++------
 drivers/mfd/intel-lpss-pci.c  |  4 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 52ffc0d9c23f..bba208235754 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -8,9 +8,9 @@
  *          Mika Westerberg <mika.westerberg@linux.intel.com>
  */
 
-#include <linux/acpi.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/platform_device.h>
@@ -169,16 +169,15 @@ MODULE_DEVICE_TABLE(acpi, intel_lpss_acpi_ids);
 
 static int intel_lpss_acpi_probe(struct platform_device *pdev)
 {
+	const struct intel_lpss_platform_info *data;
 	struct intel_lpss_platform_info *info;
-	const struct acpi_device_id *id;
 	int ret;
 
-	id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev);
-	if (!id)
+	data = device_get_match_data(&pdev->dev);
+	if (!data)
 		return -ENODEV;
 
-	info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info),
-			    GFP_KERNEL);
+	info = devm_kmemdup(&pdev->dev, data, sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index 709b0fb4419d..94042bfe7dbf 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -30,6 +30,7 @@ static const struct pci_device_id ignore_resource_conflicts_ids[] = {
 static int intel_lpss_pci_probe(struct pci_dev *pdev,
 				const struct pci_device_id *id)
 {
+	const struct intel_lpss_platform_info *data = (void *)id->driver_data;
 	struct intel_lpss_platform_info *info;
 	int ret;
 
@@ -41,8 +42,7 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev,
 	if (ret)
 		return ret;
 
-	info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info),
-			    GFP_KERNEL);
+	info = devm_kmemdup(&pdev->dev, data, sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 3/5] mfd: intel-lpss: Adjust header inclusions
  2023-11-24 19:31 [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 1/5] mfd: intel-lpss: Revert "Add missing check for platform_get_resource" Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 2/5] mfd: intel-lpss: Use device_get_match_data() Andy Shevchenko
@ 2023-11-24 19:31 ` Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 4/5] mfd: intel-lpss: Move exported symbols to INTEL_LPSS namespace Andy Shevchenko
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-11-24 19:31 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: Lee Jones

Adjust header inclusions to avoid "proxy" headers and explicitly
include what we are using.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/intel-lpss-acpi.c |  6 +++++-
 drivers/mfd/intel-lpss-pci.c  |  8 ++++++--
 drivers/mfd/intel-lpss.c      | 17 ++++++++++++-----
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index bba208235754..e4a62cc02cfc 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -8,15 +8,19 @@
  *          Mika Westerberg <mika.westerberg@linux.intel.com>
  */
 
+#include <linux/device.h>
+#include <linux/gfp_types.h>
 #include <linux/ioport.h>
-#include <linux/kernel.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
+
 #include <linux/pxa2xx_ssp.h>
 
+#include <asm/errno.h>
+
 #include "intel-lpss.h"
 
 static const struct property_entry spt_spi_properties[] = {
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index 94042bfe7dbf..bc15379afe3b 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -8,14 +8,18 @@
  *          Mika Westerberg <mika.westerberg@linux.intel.com>
  */
 
-#include <linux/ioport.h>
-#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/gfp_types.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 #include <linux/property.h>
+
 #include <linux/pxa2xx_ssp.h>
 
+#include <asm/errno.h>
+
 #include "intel-lpss.h"
 
 /* Some DSDTs have an unused GEXP ACPI device conflicting with I2C4 resources */
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index bbd65da46db6..79ea5e2ad0a6 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -10,26 +10,33 @@
  *          Jarkko Nikula <jarkko.nikula@linux.intel.com>
  */
 
-#include <linux/clk.h>
+#include <linux/array_size.h>
+#include <linux/bits.h>
 #include <linux/clkdev.h>
+#include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/debugfs.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/gfp_types.h>
 #include <linux/idr.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/mfd/core.h>
+#include <linux/module.h>
 #include <linux/pm_qos.h>
 #include <linux/pm_runtime.h>
-#include <linux/property.h>
-#include <linux/seq_file.h>
+#include <linux/sprintf.h>
+#include <linux/types.h>
+
 #include <linux/io-64-nonatomic-lo-hi.h>
 
 #include <linux/dma/idma64.h>
 
 #include "intel-lpss.h"
 
+struct dentry;
+
 #define LPSS_DEV_OFFSET		0x000
 #define LPSS_DEV_SIZE		0x200
 #define LPSS_PRIV_OFFSET	0x200
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 4/5] mfd: intel-lpss: Move exported symbols to INTEL_LPSS namespace
  2023-11-24 19:31 [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Andy Shevchenko
                   ` (2 preceding siblings ...)
  2023-11-24 19:31 ` [PATCH v1 3/5] mfd: intel-lpss: Adjust header inclusions Andy Shevchenko
@ 2023-11-24 19:31 ` Andy Shevchenko
  2023-11-24 19:31 ` [PATCH v1 5/5] mfd: intel-lpss: Provide Intel LPSS PM ops structure Andy Shevchenko
  2023-11-30 14:45 ` [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Lee Jones
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-11-24 19:31 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: Lee Jones

Avoid unnecessary pollution of the global symbol namespace by
moving library functions in to a specific namespace and import
that into the drivers that make use of the functions.

For more info: https://lwn.net/Articles/760045/

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/intel-lpss-acpi.c |  1 +
 drivers/mfd/intel-lpss-pci.c  |  1 +
 drivers/mfd/intel-lpss.c      | 10 +++++-----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index e4a62cc02cfc..a9e2d9308a01 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -223,3 +223,4 @@ MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
 MODULE_DESCRIPTION("Intel LPSS ACPI driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(INTEL_LPSS);
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index bc15379afe3b..e1d89423daa6 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -603,3 +603,4 @@ MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
 MODULE_DESCRIPTION("Intel LPSS PCI driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(INTEL_LPSS);
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 79ea5e2ad0a6..4a63703b6da5 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -456,7 +456,7 @@ int intel_lpss_probe(struct device *dev,
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(intel_lpss_probe);
+EXPORT_SYMBOL_NS_GPL(intel_lpss_probe, INTEL_LPSS);
 
 void intel_lpss_remove(struct device *dev)
 {
@@ -468,7 +468,7 @@ void intel_lpss_remove(struct device *dev)
 	intel_lpss_unregister_clock(lpss);
 	ida_free(&intel_lpss_devid_ida, lpss->devid);
 }
-EXPORT_SYMBOL_GPL(intel_lpss_remove);
+EXPORT_SYMBOL_NS_GPL(intel_lpss_remove, INTEL_LPSS);
 
 #ifdef CONFIG_PM
 static int resume_lpss_device(struct device *dev, void *data)
@@ -488,7 +488,7 @@ int intel_lpss_prepare(struct device *dev)
 	device_for_each_child_reverse(dev, NULL, resume_lpss_device);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(intel_lpss_prepare);
+EXPORT_SYMBOL_NS_GPL(intel_lpss_prepare, INTEL_LPSS);
 
 int intel_lpss_suspend(struct device *dev)
 {
@@ -509,7 +509,7 @@ int intel_lpss_suspend(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(intel_lpss_suspend);
+EXPORT_SYMBOL_NS_GPL(intel_lpss_suspend, INTEL_LPSS);
 
 int intel_lpss_resume(struct device *dev)
 {
@@ -524,7 +524,7 @@ int intel_lpss_resume(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(intel_lpss_resume);
+EXPORT_SYMBOL_NS_GPL(intel_lpss_resume, INTEL_LPSS);
 #endif
 
 static int __init intel_lpss_init(void)
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 5/5] mfd: intel-lpss: Provide Intel LPSS PM ops structure
  2023-11-24 19:31 [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Andy Shevchenko
                   ` (3 preceding siblings ...)
  2023-11-24 19:31 ` [PATCH v1 4/5] mfd: intel-lpss: Move exported symbols to INTEL_LPSS namespace Andy Shevchenko
@ 2023-11-24 19:31 ` Andy Shevchenko
  2023-11-30 14:45 ` [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Lee Jones
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-11-24 19:31 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: Lee Jones

With the help of EXPORT_NS_GPL_DEV_PM_OPS() and other *_PM_OPS() macros
we may convert PM ops functions to become static. This also takes into
account the PM configuration options such as CONFIG_PM and CONFIG_PM_SLEEP.
This all removes a lot of ugly macros and ifdeffery in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/intel-lpss-acpi.c |  5 ++---
 drivers/mfd/intel-lpss-pci.c  |  5 ++---
 drivers/mfd/intel-lpss.c      | 18 ++++++++++--------
 drivers/mfd/intel-lpss.h      | 28 +---------------------------
 4 files changed, 15 insertions(+), 41 deletions(-)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index a9e2d9308a01..2a83f8678f1d 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -13,6 +13,7 @@
 #include <linux/ioport.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
@@ -205,15 +206,13 @@ static void intel_lpss_acpi_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 }
 
-static INTEL_LPSS_PM_OPS(intel_lpss_acpi_pm_ops);
-
 static struct platform_driver intel_lpss_acpi_driver = {
 	.probe = intel_lpss_acpi_probe,
 	.remove_new = intel_lpss_acpi_remove,
 	.driver = {
 		.name = "intel-lpss",
 		.acpi_match_table = intel_lpss_acpi_ids,
-		.pm = &intel_lpss_acpi_pm_ops,
+		.pm = pm_ptr(&intel_lpss_pm_ops),
 	},
 };
 
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index e1d89423daa6..8f5e10817a9c 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -13,6 +13,7 @@
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/property.h>
 
@@ -81,8 +82,6 @@ static void intel_lpss_pci_remove(struct pci_dev *pdev)
 	intel_lpss_remove(&pdev->dev);
 }
 
-static INTEL_LPSS_PM_OPS(intel_lpss_pci_pm_ops);
-
 static const struct property_entry spt_spi_properties[] = {
 	PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_SPT_SSP),
 	{ }
@@ -593,7 +592,7 @@ static struct pci_driver intel_lpss_pci_driver = {
 	.probe = intel_lpss_pci_probe,
 	.remove = intel_lpss_pci_remove,
 	.driver = {
-		.pm = &intel_lpss_pci_pm_ops,
+		.pm = pm_ptr(&intel_lpss_pm_ops),
 	},
 };
 
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 4a63703b6da5..177915845ba2 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -24,6 +24,7 @@
 #include <linux/ioport.h>
 #include <linux/mfd/core.h>
 #include <linux/module.h>
+#include <linux/pm.h>
 #include <linux/pm_qos.h>
 #include <linux/pm_runtime.h>
 #include <linux/sprintf.h>
@@ -470,7 +471,6 @@ void intel_lpss_remove(struct device *dev)
 }
 EXPORT_SYMBOL_NS_GPL(intel_lpss_remove, INTEL_LPSS);
 
-#ifdef CONFIG_PM
 static int resume_lpss_device(struct device *dev, void *data)
 {
 	if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND))
@@ -479,7 +479,7 @@ static int resume_lpss_device(struct device *dev, void *data)
 	return 0;
 }
 
-int intel_lpss_prepare(struct device *dev)
+static int intel_lpss_prepare(struct device *dev)
 {
 	/*
 	 * Resume both child devices before entering system sleep. This
@@ -488,9 +488,8 @@ int intel_lpss_prepare(struct device *dev)
 	device_for_each_child_reverse(dev, NULL, resume_lpss_device);
 	return 0;
 }
-EXPORT_SYMBOL_NS_GPL(intel_lpss_prepare, INTEL_LPSS);
 
-int intel_lpss_suspend(struct device *dev)
+static int intel_lpss_suspend(struct device *dev)
 {
 	struct intel_lpss *lpss = dev_get_drvdata(dev);
 	unsigned int i;
@@ -509,9 +508,8 @@ int intel_lpss_suspend(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_NS_GPL(intel_lpss_suspend, INTEL_LPSS);
 
-int intel_lpss_resume(struct device *dev)
+static int intel_lpss_resume(struct device *dev)
 {
 	struct intel_lpss *lpss = dev_get_drvdata(dev);
 	unsigned int i;
@@ -524,8 +522,12 @@ int intel_lpss_resume(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_NS_GPL(intel_lpss_resume, INTEL_LPSS);
-#endif
+
+EXPORT_NS_GPL_DEV_PM_OPS(intel_lpss_pm_ops, INTEL_LPSS) = {
+	.prepare = pm_sleep_ptr(&intel_lpss_prepare),
+	LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume)
+	RUNTIME_PM_OPS(intel_lpss_suspend, intel_lpss_resume, NULL)
+};
 
 static int __init intel_lpss_init(void)
 {
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h
index 062ce95b68b9..c1d72b117ed5 100644
--- a/drivers/mfd/intel-lpss.h
+++ b/drivers/mfd/intel-lpss.h
@@ -30,32 +30,6 @@ int intel_lpss_probe(struct device *dev,
 		     const struct intel_lpss_platform_info *info);
 void intel_lpss_remove(struct device *dev);
 
-#ifdef CONFIG_PM
-int intel_lpss_prepare(struct device *dev);
-int intel_lpss_suspend(struct device *dev);
-int intel_lpss_resume(struct device *dev);
-
-#ifdef CONFIG_PM_SLEEP
-#define INTEL_LPSS_SLEEP_PM_OPS			\
-	.prepare = intel_lpss_prepare,		\
-	SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume)
-#else
-#define INTEL_LPSS_SLEEP_PM_OPS
-#endif
-
-#define INTEL_LPSS_RUNTIME_PM_OPS		\
-	.runtime_suspend = intel_lpss_suspend,	\
-	.runtime_resume = intel_lpss_resume,
-
-#else /* !CONFIG_PM */
-#define INTEL_LPSS_SLEEP_PM_OPS
-#define INTEL_LPSS_RUNTIME_PM_OPS
-#endif /* CONFIG_PM */
-
-#define INTEL_LPSS_PM_OPS(name)			\
-const struct dev_pm_ops name = {		\
-	INTEL_LPSS_SLEEP_PM_OPS			\
-	INTEL_LPSS_RUNTIME_PM_OPS		\
-}
+extern const struct dev_pm_ops intel_lpss_pm_ops;
 
 #endif /* __MFD_INTEL_LPSS_H */
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups
  2023-11-24 19:31 [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Andy Shevchenko
                   ` (4 preceding siblings ...)
  2023-11-24 19:31 ` [PATCH v1 5/5] mfd: intel-lpss: Provide Intel LPSS PM ops structure Andy Shevchenko
@ 2023-11-30 14:45 ` Lee Jones
  5 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2023-11-30 14:45 UTC (permalink / raw)
  To: linux-kernel, Andy Shevchenko; +Cc: Lee Jones

On Fri, 24 Nov 2023 21:31:23 +0200, Andy Shevchenko wrote:
> After looking into the latest changes in the driver I noticed one
> wrong patch. That induced looking closer to the current state of
> affairs in the driver. It appears that some code is outdated and
> may be cleaned up. Hence this series.
> 
> Andy Shevchenko (5):
>   mfd: intel-lpss: Revert "Add missing check for platform_get_resource"
>   mfd: intel-lpss: Use device_get_match_data()
>   mfd: intel-lpss: Adjust header inclusions
>   mfd: intel-lpss: Move exported symbols to INTEL_LPSS namespace
>   mfd: intel-lpss: Provide Intel LPSS PM ops structure
> 
> [...]

Applied, thanks!

[1/5] mfd: intel-lpss: Revert "Add missing check for platform_get_resource"
      commit: ad85d36c6770f21d961f5e5e47dc25f56d50c96e
[2/5] mfd: intel-lpss: Use device_get_match_data()
      commit: 403c475743959f787156fc2120c1e5c557f8357d
[3/5] mfd: intel-lpss: Adjust header inclusions
      commit: 62b2a4b3fb4922cb5201ff3787efd84186b0699c
[4/5] mfd: intel-lpss: Move exported symbols to INTEL_LPSS namespace
      commit: 2221afc08e16bf0cbc5234107cc5c9edb850e0bb
[5/5] mfd: intel-lpss: Provide Intel LPSS PM ops structure
      commit: 41e15f246791772c312caa8662368191d5b7289a

--
Lee Jones [李琼斯]


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-11-30 14:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-24 19:31 [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Andy Shevchenko
2023-11-24 19:31 ` [PATCH v1 1/5] mfd: intel-lpss: Revert "Add missing check for platform_get_resource" Andy Shevchenko
2023-11-24 19:31 ` [PATCH v1 2/5] mfd: intel-lpss: Use device_get_match_data() Andy Shevchenko
2023-11-24 19:31 ` [PATCH v1 3/5] mfd: intel-lpss: Adjust header inclusions Andy Shevchenko
2023-11-24 19:31 ` [PATCH v1 4/5] mfd: intel-lpss: Move exported symbols to INTEL_LPSS namespace Andy Shevchenko
2023-11-24 19:31 ` [PATCH v1 5/5] mfd: intel-lpss: Provide Intel LPSS PM ops structure Andy Shevchenko
2023-11-30 14:45 ` [PATCH v1 0/5] mfd: intel-lpss: Set of cleanups Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox