summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorVenkat Reddy Talla <vreddytalla@nvidia.com>2014-06-11 10:54:03 +0530
committerRiham Haidar <rhaidar@nvidia.com>2014-06-11 17:09:57 -0700
commitdbca4e0d9f5cdd7da5270288bf1e8add4e164e6a (patch)
tree4508ab545d2b5c987b545d73c217b9ead39161d0 /drivers/power
parent44a648a412b0733b988a4dad2e14704d1a03190e (diff)
power: extcon:convert extcon lock to spinlock from mutex
use spinlock instread of mutex to avoid kernel warning "sleeping function called from invalid context" if CONFIG_DEBUG_ATOMIC_SLEEP (sleep inside atomic section checking config) enabled and usb cable plugged/unplugged. Bug 1522398 Change-Id: I813f959dc5cb3ce666794a8d57152b6f562046a6 Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com> Reviewed-on: http://git-master/r/421988 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/power_supply_extcon.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/power/power_supply_extcon.c b/drivers/power/power_supply_extcon.c
index 40d9dfe30b1b..16156dc4a058 100644
--- a/drivers/power/power_supply_extcon.c
+++ b/drivers/power/power_supply_extcon.c
@@ -30,7 +30,7 @@
#include <linux/power/power_supply_extcon.h>
#include <linux/slab.h>
#include <linux/extcon.h>
-#include <linux/mutex.h>
+#include <linux/spinlock.h>
#define CHARGER_TYPE_DETECTION_DEFAULT_DEBOUNCE_TIME_MS 500
@@ -43,7 +43,7 @@ struct power_supply_extcon {
uint8_t ac_online;
uint8_t usb_online;
struct power_supply_extcon_plat_data *pdata;
- struct mutex lock;
+ spinlock_t lock;
};
struct power_supply_cables {
@@ -210,14 +210,14 @@ static int psy_extcon_extcon_notifier(struct notifier_block *self,
struct power_supply_extcon *psy_extcon = cable->psy_extcon;
struct extcon_dev *edev = cable->extcon_dev->edev;
- mutex_lock(&psy_extcon->lock);
+ spin_lock(&psy_extcon->lock);
cable->event = event;
if (cable->event == 0)
power_supply_extcon_remove_cable(psy_extcon, edev);
else if (cable->event == 1)
power_supply_extcon_attach_cable(psy_extcon, edev);
- mutex_unlock(&psy_extcon->lock);
+ spin_unlock(&psy_extcon->lock);
return NOTIFY_DONE;
}
@@ -274,7 +274,7 @@ static int psy_extcon_probe(struct platform_device *pdev)
psy_extcon->dev = &pdev->dev;
dev_set_drvdata(&pdev->dev, psy_extcon);
- mutex_init(&psy_extcon->lock);
+ spin_lock_init(&psy_extcon->lock);
dev_info(psy_extcon->dev, "Extcon name %s\n", pdata->extcon_name);
@@ -339,9 +339,9 @@ static int psy_extcon_probe(struct platform_device *pdev)
goto econ_err;
}
- mutex_lock(&psy_extcon->lock);
+ spin_lock(&psy_extcon->lock);
power_supply_extcon_attach_cable(psy_extcon, psy_extcon->edev);
- mutex_unlock(&psy_extcon->lock);
+ spin_unlock(&psy_extcon->lock);
if (pdata->y_cable_extcon_name) {
psy_extcon->y_cable_edev =
@@ -349,10 +349,10 @@ static int psy_extcon_probe(struct platform_device *pdev)
if (!psy_extcon->y_cable_edev)
goto econ_err;
- mutex_lock(&psy_extcon->lock);
+ spin_lock(&psy_extcon->lock);
power_supply_extcon_attach_cable(psy_extcon,
psy_extcon->y_cable_edev);
- mutex_unlock(&psy_extcon->lock);
+ spin_unlock(&psy_extcon->lock);
}
dev_info(&pdev->dev, "%s() get success\n", __func__);