mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 14:05:39 +00:00
mfd: pcf50633: Remove #ifdef guards for PM related functions
Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is 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. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
e1243e0d72
commit
245cb473e5
@ -158,26 +158,6 @@ pcf50633_client_dev_register(struct pcf50633 *pcf, const char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
|
||||||
static int pcf50633_suspend(struct device *dev)
|
|
||||||
{
|
|
||||||
struct i2c_client *client = to_i2c_client(dev);
|
|
||||||
struct pcf50633 *pcf = i2c_get_clientdata(client);
|
|
||||||
|
|
||||||
return pcf50633_irq_suspend(pcf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pcf50633_resume(struct device *dev)
|
|
||||||
{
|
|
||||||
struct i2c_client *client = to_i2c_client(dev);
|
|
||||||
struct pcf50633 *pcf = i2c_get_clientdata(client);
|
|
||||||
|
|
||||||
return pcf50633_irq_resume(pcf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
|
|
||||||
|
|
||||||
static const struct regmap_config pcf50633_regmap_config = {
|
static const struct regmap_config pcf50633_regmap_config = {
|
||||||
.reg_bits = 8,
|
.reg_bits = 8,
|
||||||
.val_bits = 8,
|
.val_bits = 8,
|
||||||
@ -299,7 +279,7 @@ MODULE_DEVICE_TABLE(i2c, pcf50633_id_table);
|
|||||||
static struct i2c_driver pcf50633_driver = {
|
static struct i2c_driver pcf50633_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "pcf50633",
|
.name = "pcf50633",
|
||||||
.pm = &pcf50633_pm,
|
.pm = pm_sleep_ptr(&pcf50633_pm),
|
||||||
},
|
},
|
||||||
.id_table = pcf50633_id_table,
|
.id_table = pcf50633_id_table,
|
||||||
.probe_new = pcf50633_probe,
|
.probe_new = pcf50633_probe,
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/i2c.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
@ -218,10 +219,10 @@ static irqreturn_t pcf50633_irq(int irq, void *data)
|
|||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
static int pcf50633_suspend(struct device *dev)
|
||||||
|
|
||||||
int pcf50633_irq_suspend(struct pcf50633 *pcf)
|
|
||||||
{
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
struct pcf50633 *pcf = i2c_get_clientdata(client);
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
u8 res[5];
|
u8 res[5];
|
||||||
@ -257,8 +258,10 @@ int pcf50633_irq_suspend(struct pcf50633 *pcf)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pcf50633_irq_resume(struct pcf50633 *pcf)
|
static int pcf50633_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
struct pcf50633 *pcf = i2c_get_clientdata(client);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Write the saved mask registers */
|
/* Write the saved mask registers */
|
||||||
@ -273,7 +276,7 @@ int pcf50633_irq_resume(struct pcf50633 *pcf)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
EXPORT_GPL_SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
|
||||||
|
|
||||||
int pcf50633_irq_init(struct pcf50633 *pcf, int irq)
|
int pcf50633_irq_init(struct pcf50633 *pcf, int irq)
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/regulator/driver.h>
|
#include <linux/regulator/driver.h>
|
||||||
#include <linux/regulator/machine.h>
|
#include <linux/regulator/machine.h>
|
||||||
|
#include <linux/pm.h>
|
||||||
#include <linux/power_supply.h>
|
#include <linux/power_supply.h>
|
||||||
#include <linux/mfd/pcf50633/backlight.h>
|
#include <linux/mfd/pcf50633/backlight.h>
|
||||||
|
|
||||||
@ -226,9 +227,6 @@ static inline struct pcf50633 *dev_to_pcf50633(struct device *dev)
|
|||||||
|
|
||||||
int pcf50633_irq_init(struct pcf50633 *pcf, int irq);
|
int pcf50633_irq_init(struct pcf50633 *pcf, int irq);
|
||||||
void pcf50633_irq_free(struct pcf50633 *pcf);
|
void pcf50633_irq_free(struct pcf50633 *pcf);
|
||||||
#ifdef CONFIG_PM
|
extern const struct dev_pm_ops pcf50633_pm;
|
||||||
int pcf50633_irq_suspend(struct pcf50633 *pcf);
|
|
||||||
int pcf50633_irq_resume(struct pcf50633 *pcf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user