Commit 3e8040b0 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: at32psif - convert to dev_pm_ops

Convert driver to use dev_pm_ops instead of legacy PM infrastructure.
Also make 'open' a bool since it is really a boolean.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 89f0f170
...@@ -98,9 +98,9 @@ struct psif { ...@@ -98,9 +98,9 @@ struct psif {
struct serio *io; struct serio *io;
void __iomem *regs; void __iomem *regs;
unsigned int irq; unsigned int irq;
unsigned int open;
/* Prevent concurrent writes to PSIF THR. */ /* Prevent concurrent writes to PSIF THR. */
spinlock_t lock; spinlock_t lock;
bool open;
}; };
static irqreturn_t psif_interrupt(int irq, void *_ptr) static irqreturn_t psif_interrupt(int irq, void *_ptr)
...@@ -164,7 +164,7 @@ static int psif_open(struct serio *io) ...@@ -164,7 +164,7 @@ static int psif_open(struct serio *io)
psif_writel(psif, CR, PSIF_BIT(CR_TXEN) | PSIF_BIT(CR_RXEN)); psif_writel(psif, CR, PSIF_BIT(CR_TXEN) | PSIF_BIT(CR_RXEN));
psif_writel(psif, IER, PSIF_BIT(RXRDY)); psif_writel(psif, IER, PSIF_BIT(RXRDY));
psif->open = 1; psif->open = true;
out: out:
return retval; return retval;
} }
...@@ -173,7 +173,7 @@ static void psif_close(struct serio *io) ...@@ -173,7 +173,7 @@ static void psif_close(struct serio *io)
{ {
struct psif *psif = io->port_data; struct psif *psif = io->port_data;
psif->open = 0; psif->open = false;
psif_writel(psif, IDR, ~0UL); psif_writel(psif, IDR, ~0UL);
psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS)); psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS));
...@@ -319,9 +319,10 @@ static int __exit psif_remove(struct platform_device *pdev) ...@@ -319,9 +319,10 @@ static int __exit psif_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int psif_suspend(struct platform_device *pdev, pm_message_t state) static int psif_suspend(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct psif *psif = platform_get_drvdata(pdev); struct psif *psif = platform_get_drvdata(pdev);
if (psif->open) { if (psif->open) {
...@@ -332,8 +333,9 @@ static int psif_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -332,8 +333,9 @@ static int psif_suspend(struct platform_device *pdev, pm_message_t state)
return 0; return 0;
} }
static int psif_resume(struct platform_device *pdev) static int psif_resume(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct psif *psif = platform_get_drvdata(pdev); struct psif *psif = platform_get_drvdata(pdev);
if (psif->open) { if (psif->open) {
...@@ -344,19 +346,17 @@ static int psif_resume(struct platform_device *pdev) ...@@ -344,19 +346,17 @@ static int psif_resume(struct platform_device *pdev)
return 0; return 0;
} }
#else
#define psif_suspend NULL
#define psif_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(psif_pm_ops, psif_suspend, psif_resume);
static struct platform_driver psif_driver = { static struct platform_driver psif_driver = {
.remove = __exit_p(psif_remove), .remove = __exit_p(psif_remove),
.driver = { .driver = {
.name = "atmel_psif", .name = "atmel_psif",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &psif_pm_ops,
}, },
.suspend = psif_suspend,
.resume = psif_resume,
}; };
module_platform_driver(psif_driver); module_platform_driver(psif_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment