summaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-usb-gpio.c
diff options
context:
space:
mode:
authorGrygorii Strashko <grygorii.strashko@ti.com>2016-04-06 20:32:37 +0300
committerChanwoo Choi <cw00.choi@samsung.com>2016-06-21 14:09:53 +0900
commit12bd0f323b855ee548367f48062cf58cae5acda8 (patch)
tree67c257afd1242c2529bb376cbb0157aa29360f66 /drivers/extcon/extcon-usb-gpio.c
parent33688abb2802ff3a230bd2441f765477b94cc89e (diff)
downloadlinux-stable-12bd0f323b855ee548367f48062cf58cae5acda8.tar.gz
linux-stable-12bd0f323b855ee548367f48062cf58cae5acda8.tar.bz2
linux-stable-12bd0f323b855ee548367f48062cf58cae5acda8.zip
extcon: usb-gpio: switch to use pm wakeirq apis
Switch to use PM wakeirq APIs which automates wakeup IRQs enabling/disabling and so allows to make code simpler. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-usb-gpio.c')
-rw-r--r--drivers/extcon/extcon-usb-gpio.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
index 2b2fecffb1ad..bc61d1165d73 100644
--- a/drivers/extcon/extcon-usb-gpio.c
+++ b/drivers/extcon/extcon-usb-gpio.c
@@ -24,6 +24,7 @@
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
+#include <linux/pm_wakeirq.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
@@ -141,7 +142,8 @@ static int usb_extcon_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, info);
- device_init_wakeup(dev, 1);
+ device_init_wakeup(dev, true);
+ dev_pm_set_wake_irq(dev, info->id_irq);
/* Perform initial detection */
usb_extcon_detect_cable(&info->wq_detcable.work);
@@ -155,6 +157,9 @@ static int usb_extcon_remove(struct platform_device *pdev)
cancel_delayed_work_sync(&info->wq_detcable);
+ dev_pm_clear_wake_irq(&pdev->dev);
+ device_init_wakeup(&pdev->dev, false);
+
return 0;
}
@@ -164,12 +169,6 @@ static int usb_extcon_suspend(struct device *dev)
struct usb_extcon_info *info = dev_get_drvdata(dev);
int ret = 0;
- if (device_may_wakeup(dev)) {
- ret = enable_irq_wake(info->id_irq);
- if (ret)
- return ret;
- }
-
/*
* We don't want to process any IRQs after this point
* as GPIOs used behind I2C subsystem might not be
@@ -185,12 +184,6 @@ static int usb_extcon_resume(struct device *dev)
struct usb_extcon_info *info = dev_get_drvdata(dev);
int ret = 0;
- if (device_may_wakeup(dev)) {
- ret = disable_irq_wake(info->id_irq);
- if (ret)
- return ret;
- }
-
enable_irq(info->id_irq);
return ret;