mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
mfd: intel-lpss: Provide Intel LPSS PM ops structure
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> Link: https://lore.kernel.org/r/20231124200258.3682979-6-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
24ee97a9e8
commit
fd58bb8c7d
@ -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),
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -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),
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user