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, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Hans Verkuil <hans.verkuil@cisco.com> Subject: [PATCH 2nd REPOST 5/5] media: usbtv: use irqsave() in USB's complete callback Date: Tue, 10 Jul 2018 18:18:33 +0200 [thread overview] Message-ID: <20180710161833.2435-6-bigeasy@linutronix.de> (raw) In-Reply-To: <20180710161833.2435-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> Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/media/usb/usbtv/usbtv-audio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv-audio.c b/drivers/media/usb/usbtv/usbtv-audio.c index 2c2ca77fa01f..4ce38246ed64 100644 --- a/drivers/media/usb/usbtv/usbtv-audio.c +++ b/drivers/media/usb/usbtv/usbtv-audio.c @@ -126,6 +126,7 @@ static void usbtv_audio_urb_received(struct urb *urb) struct snd_pcm_runtime *runtime = substream->runtime; size_t i, frame_bytes, chunk_length, buffer_pos, period_pos; int period_elapsed; + unsigned long flags; void *urb_current; switch (urb->status) { @@ -179,12 +180,12 @@ static void usbtv_audio_urb_received(struct urb *urb) } } - snd_pcm_stream_lock(substream); + snd_pcm_stream_lock_irqsave(substream, flags); chip->snd_buffer_pos = buffer_pos; chip->snd_period_pos = period_pos; - snd_pcm_stream_unlock(substream); + snd_pcm_stream_unlock_irqrestore(substream, flags); if (period_elapsed) snd_pcm_period_elapsed(substream); -- 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, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Hans Verkuil <hans.verkuil@cisco.com> Subject: [2nd,REPOST,5/5] media: usbtv: use irqsave() in USB's complete callback Date: Tue, 10 Jul 2018 18:18:33 +0200 [thread overview] Message-ID: <20180710161833.2435-6-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> Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/media/usb/usbtv/usbtv-audio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv-audio.c b/drivers/media/usb/usbtv/usbtv-audio.c index 2c2ca77fa01f..4ce38246ed64 100644 --- a/drivers/media/usb/usbtv/usbtv-audio.c +++ b/drivers/media/usb/usbtv/usbtv-audio.c @@ -126,6 +126,7 @@ static void usbtv_audio_urb_received(struct urb *urb) struct snd_pcm_runtime *runtime = substream->runtime; size_t i, frame_bytes, chunk_length, buffer_pos, period_pos; int period_elapsed; + unsigned long flags; void *urb_current; switch (urb->status) { @@ -179,12 +180,12 @@ static void usbtv_audio_urb_received(struct urb *urb) } } - snd_pcm_stream_lock(substream); + snd_pcm_stream_lock_irqsave(substream, flags); chip->snd_buffer_pos = buffer_pos; chip->snd_period_pos = period_pos; - snd_pcm_stream_unlock(substream); + snd_pcm_stream_unlock_irqrestore(substream, flags); if (period_elapsed) snd_pcm_period_elapsed(substream);
next prev parent reply other threads:[~2018-07-10 16:18 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-10 16:18 [PATCH 2nd REPOST 0/5] media: use irqsave() in USB's complete callback Sebastian Andrzej Siewior 2018-07-10 16:18 ` [PATCH 2nd REPOST 1/5] media: cx231xx: " Sebastian Andrzej Siewior 2018-07-10 16:18 ` [2nd,REPOST,1/5] " Sebastian Andrzej Siewior 2018-07-10 16:18 ` [PATCH 2nd REPOST 2/5] media: em28xx-audio: " Sebastian Andrzej Siewior 2018-07-10 16:18 ` [2nd,REPOST,2/5] " Sebastian Andrzej Siewior 2018-07-10 16:18 ` [PATCH 2nd REPOST 3/5] media: go7007: " Sebastian Andrzej Siewior 2018-07-10 16:18 ` [2nd,REPOST,3/5] " Sebastian Andrzej Siewior 2018-07-10 16:18 ` [PATCH 2nd REPOST 4/5] media: tm6000: " Sebastian Andrzej Siewior 2018-07-10 16:18 ` [2nd,REPOST,4/5] " Sebastian Andrzej Siewior 2018-07-10 16:18 ` Sebastian Andrzej Siewior [this message] 2018-07-10 16:18 ` [2nd,REPOST,5/5] media: usbtv: " Sebastian Andrzej Siewior 2018-07-16 16:30 ` [PATCH 2nd REPOST 0/5] media: " Sebastian Andrzej Siewior 2018-07-16 16:45 ` Greg Kroah-Hartman 2018-07-16 16:49 ` Sebastian Andrzej Siewior 2018-08-02 17:47 ` Mauro Carvalho Chehab 2018-08-02 20:39 ` Sebastian Andrzej Siewior 2018-08-02 21:22 ` 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=20180710161833.2435-6-bigeasy@linutronix.de \ --to=bigeasy@linutronix.de \ --cc=gregkh@linuxfoundation.org \ --cc=hans.verkuil@cisco.com \ --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.