|
@@ -281,32 +281,25 @@ EXPORT_SYMBOL_GPL(device_wakeup_enable);
|
|
* Attach a device wakeirq to the wakeup source so the device
|
|
* Attach a device wakeirq to the wakeup source so the device
|
|
* wake IRQ can be configured automatically for suspend and
|
|
* wake IRQ can be configured automatically for suspend and
|
|
* resume.
|
|
* resume.
|
|
|
|
+ *
|
|
|
|
+ * Call under the device's power.lock lock.
|
|
*/
|
|
*/
|
|
int device_wakeup_attach_irq(struct device *dev,
|
|
int device_wakeup_attach_irq(struct device *dev,
|
|
struct wake_irq *wakeirq)
|
|
struct wake_irq *wakeirq)
|
|
{
|
|
{
|
|
struct wakeup_source *ws;
|
|
struct wakeup_source *ws;
|
|
- int ret = 0;
|
|
|
|
|
|
|
|
- spin_lock_irq(&dev->power.lock);
|
|
|
|
ws = dev->power.wakeup;
|
|
ws = dev->power.wakeup;
|
|
if (!ws) {
|
|
if (!ws) {
|
|
dev_err(dev, "forgot to call call device_init_wakeup?\n");
|
|
dev_err(dev, "forgot to call call device_init_wakeup?\n");
|
|
- ret = -EINVAL;
|
|
|
|
- goto unlock;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (ws->wakeirq) {
|
|
|
|
- ret = -EEXIST;
|
|
|
|
- goto unlock;
|
|
|
|
- }
|
|
|
|
|
|
+ if (ws->wakeirq)
|
|
|
|
+ return -EEXIST;
|
|
|
|
|
|
ws->wakeirq = wakeirq;
|
|
ws->wakeirq = wakeirq;
|
|
-
|
|
|
|
-unlock:
|
|
|
|
- spin_unlock_irq(&dev->power.lock);
|
|
|
|
-
|
|
|
|
- return ret;
|
|
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -314,20 +307,16 @@ unlock:
|
|
* @dev: Device to handle
|
|
* @dev: Device to handle
|
|
*
|
|
*
|
|
* Removes a device wakeirq from the wakeup source.
|
|
* Removes a device wakeirq from the wakeup source.
|
|
|
|
+ *
|
|
|
|
+ * Call under the device's power.lock lock.
|
|
*/
|
|
*/
|
|
void device_wakeup_detach_irq(struct device *dev)
|
|
void device_wakeup_detach_irq(struct device *dev)
|
|
{
|
|
{
|
|
struct wakeup_source *ws;
|
|
struct wakeup_source *ws;
|
|
|
|
|
|
- spin_lock_irq(&dev->power.lock);
|
|
|
|
ws = dev->power.wakeup;
|
|
ws = dev->power.wakeup;
|
|
- if (!ws)
|
|
|
|
- goto unlock;
|
|
|
|
-
|
|
|
|
- ws->wakeirq = NULL;
|
|
|
|
-
|
|
|
|
-unlock:
|
|
|
|
- spin_unlock_irq(&dev->power.lock);
|
|
|
|
|
|
+ if (ws)
|
|
|
|
+ ws->wakeirq = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|