From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: linux-media@vger.kernel.org, linux-usb@vger.kernel.org Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, tglx@linutronix.de, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [PATCH 2/3] media: tm6000: use irqsave() in USB's complete callback Date: Mon, 10 Sep 2018 11:19:59 +0200 [thread overview] Message-ID: <20180910092000.14693-3-bigeasy@linutronix.de> (raw) In-Reply-To: <20180910092000.14693-1-bigeasy@linutronix.de> The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller. Use the _irqsave() variant of the locking primitives. Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/media/usb/tm6000/tm6000-video.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index 96055de6e8ce2..7d268f2404e19 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c @@ -419,6 +419,7 @@ static void tm6000_irq_callback(struct urb *urb) { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); + unsigned long flags; int i; switch (urb->status) { @@ -436,9 +437,9 @@ static void tm6000_irq_callback(struct urb *urb) break; } - spin_lock(&dev->slock); + spin_lock_irqsave(&dev->slock, flags); tm6000_isoc_copy(urb); - spin_unlock(&dev->slock); + spin_unlock_irqrestore(&dev->slock, flags); /* Reset urb buffers */ for (i = 0; i < urb->number_of_packets; i++) { -- 2.19.0.rc2
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: linux-media@vger.kernel.org, linux-usb@vger.kernel.org Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, tglx@linutronix.de, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [2/3] media: tm6000: use irqsave() in USB's complete callback Date: Mon, 10 Sep 2018 11:19:59 +0200 [thread overview] Message-ID: <20180910092000.14693-3-bigeasy@linutronix.de> (raw) The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller. Use the _irqsave() variant of the locking primitives. Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/media/usb/tm6000/tm6000-video.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index 96055de6e8ce2..7d268f2404e19 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c @@ -419,6 +419,7 @@ static void tm6000_irq_callback(struct urb *urb) { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); + unsigned long flags; int i; switch (urb->status) { @@ -436,9 +437,9 @@ static void tm6000_irq_callback(struct urb *urb) break; } - spin_lock(&dev->slock); + spin_lock_irqsave(&dev->slock, flags); tm6000_isoc_copy(urb); - spin_unlock(&dev->slock); + spin_unlock_irqrestore(&dev->slock, flags); /* Reset urb buffers */ for (i = 0; i < urb->number_of_packets; i++) {
next prev parent reply other threads:[~2018-09-10 14:13 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-09-10 9:19 [PATCH 0/3] media: use irqsave() in USB's complete callback + remove local_irq_save Sebastian Andrzej Siewior 2018-09-10 9:19 ` [PATCH 1/3] media: em28xx-audio: use irqsave() in USB's complete callback Sebastian Andrzej Siewior 2018-09-10 9:19 ` [1/3] " Sebastian Andrzej Siewior 2018-09-10 9:19 ` Sebastian Andrzej Siewior [this message] 2018-09-10 9:19 ` [2/3] media: tm6000: " Sebastian Andrzej Siewior 2018-09-10 9:20 ` [PATCH 3/3] usb: core: remove local_irq_save() around ->complete() handler Sebastian Andrzej Siewior 2018-09-10 9:20 ` [3/3] " Sebastian Andrzej Siewior 2018-09-10 14:11 ` [PATCH 3/3] " Alan Stern 2018-09-10 14:11 ` [3/3] " Alan Stern 2018-09-10 9:25 ` [PATCH 0/3] media: use irqsave() in USB's complete callback + remove local_irq_save Mauro Carvalho Chehab 2018-09-10 9:30 ` Sebastian Andrzej Siewior 2018-09-10 13:37 ` Greg Kroah-Hartman 2018-09-10 15:58 ` Mauro Carvalho Chehab
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180910092000.14693-3-bigeasy@linutronix.de \ --to=bigeasy@linutronix.de \ --cc=gregkh@linuxfoundation.org \ --cc=linux-media@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=mchehab@kernel.org \ --cc=tglx@linutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.