From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: linux-media@vger.kernel.org Cc: tglx@linutronix.de, Mauro Carvalho Chehab <mchehab@kernel.org>, linux-usb@vger.kernel.org, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [PATCH REPOST 4/5] media: tm6000: use irqsave() in USB's complete callback Date: Sun, 1 Jul 2018 17:39:20 +0200 [thread overview] Message-ID: <20180701153921.13129-5-bigeasy@linutronix.de> (raw) In-Reply-To: <20180701153921.13129-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 96055de6e8ce..7d268f2404e1 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.18.0
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: linux-media@vger.kernel.org Cc: tglx@linutronix.de, Mauro Carvalho Chehab <mchehab@kernel.org>, linux-usb@vger.kernel.org, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [REPOST,4/5] media: tm6000: use irqsave() in USB's complete callback Date: Sun, 1 Jul 2018 17:39:20 +0200 [thread overview] Message-ID: <20180701153921.13129-5-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 96055de6e8ce..7d268f2404e1 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-07-01 15:39 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-01 15:39 [PATCH REPOST 0/5] media: use irqsave() in USB's complete callback Sebastian Andrzej Siewior 2018-07-01 15:39 ` [PATCH REPOST 1/5] media: cx231xx: " Sebastian Andrzej Siewior 2018-07-01 15:39 ` [REPOST,1/5] " Sebastian Andrzej Siewior 2018-07-01 15:39 ` [PATCH REPOST 2/5] media: em28xx-audio: " Sebastian Andrzej Siewior 2018-07-01 15:39 ` [REPOST,2/5] " Sebastian Andrzej Siewior 2018-07-01 15:39 ` [PATCH REPOST 3/5] media: go7007: " Sebastian Andrzej Siewior 2018-07-01 15:39 ` [REPOST,3/5] " Sebastian Andrzej Siewior 2018-07-01 15:39 ` Sebastian Andrzej Siewior [this message] 2018-07-01 15:39 ` [REPOST,4/5] media: tm6000: " Sebastian Andrzej Siewior 2018-07-01 15:39 ` [PATCH REPOST 5/5] media: usbtv: " Sebastian Andrzej Siewior 2018-07-01 15:39 ` [REPOST,5/5] " Sebastian Andrzej Siewior
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=20180701153921.13129-5-bigeasy@linutronix.de \ --to=bigeasy@linutronix.de \ --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.