diff mbox

[v1,23/49] hid: usbhid: prepare for enabling irq in complete()

Message ID 1376756714-25479-24-git-send-email-ming.lei@canonical.com
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Ming Lei Aug. 17, 2013, 4:24 p.m. UTC
Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/hid/usbhid/hid-core.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ming Lei Aug. 22, 2013, 12:19 p.m. UTC | #1
On Sun, Aug 18, 2013 at 12:24 AM, Ming Lei <ming.lei@canonical.com> wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
>
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Jiri, could you review and give an Ack?


Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Kosina Aug. 26, 2013, 11:44 a.m. UTC | #2
On Sun, 18 Aug 2013, Ming Lei wrote:

> Complete() will be run with interrupt enabled, so change to
> spin_lock_irqsave().
> 
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Jiri Kosina <jkosina@suse.cz>

> ---
>  drivers/hid/usbhid/hid-core.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
> index bd38cdf..2445fd6 100644
> --- a/drivers/hid/usbhid/hid-core.c
> +++ b/drivers/hid/usbhid/hid-core.c
> @@ -489,8 +489,9 @@ static void hid_ctrl(struct urb *urb)
>  	struct hid_device *hid = urb->context;
>  	struct usbhid_device *usbhid = hid->driver_data;
>  	int unplug = 0, status = urb->status;
> +	unsigned long flags;
>  
> -	spin_lock(&usbhid->lock);
> +	spin_lock_irqsave(&usbhid->lock, flags);
>  
>  	switch (status) {
>  	case 0:			/* success */
> @@ -525,7 +526,7 @@ static void hid_ctrl(struct urb *urb)
>  	}
>  
>  	clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
> -	spin_unlock(&usbhid->lock);
> +	spin_unlock_irqrestore(&usbhid->lock, flags);
>  	usb_autopm_put_interface_async(usbhid->intf);
>  	wake_up(&usbhid->wait);
>  }
>
diff mbox

Patch

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index bd38cdf..2445fd6 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -489,8 +489,9 @@  static void hid_ctrl(struct urb *urb)
 	struct hid_device *hid = urb->context;
 	struct usbhid_device *usbhid = hid->driver_data;
 	int unplug = 0, status = urb->status;
+	unsigned long flags;
 
-	spin_lock(&usbhid->lock);
+	spin_lock_irqsave(&usbhid->lock, flags);
 
 	switch (status) {
 	case 0:			/* success */
@@ -525,7 +526,7 @@  static void hid_ctrl(struct urb *urb)
 	}
 
 	clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
-	spin_unlock(&usbhid->lock);
+	spin_unlock_irqrestore(&usbhid->lock, flags);
 	usb_autopm_put_interface_async(usbhid->intf);
 	wake_up(&usbhid->wait);
 }