linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: JP <jp@jpvw.nl>
To: Andrei Koshkosh <andreykosh000@mail.ru>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, "Sean Young" <sean@mess.org>,
	"Stefan Brüns" <stefan.bruens@rwth-aachen.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] media: dvbsky: use a single mutex and state buffers for all R/W ops
Date: Sun, 29 Sep 2019 23:40:16 +0200	[thread overview]
Message-ID: <fa7cfdba-42b3-bcc2-7e61-f4108c07529d@jpvw.nl> (raw)
In-Reply-To: <1569744245-23030-1-git-send-email-andreykosh000@mail.ru>

This works very well for me.
(and please see unrelated comment below)

On 9/29/19 10:04 AM, Andrei Koshkosh wrote:
> Signed-off-by: Andrei Koshkosh <andreykosh000@mail.ru>
> ---
>   drivers/media/usb/dvb-usb-v2/dvbsky.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> index c41e10b..6a118a0 100644
> --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
> +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> @@ -22,7 +22,6 @@ MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver.");
>   DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>   
>   struct dvbsky_state {
> -	struct mutex stream_mutex;
>   	u8 ibuf[DVBSKY_BUF_LEN];
>   	u8 obuf[DVBSKY_BUF_LEN];
>   	u8 last_lock;
> @@ -61,16 +60,18 @@ static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff)
>   {
>   	struct dvbsky_state *state = d_to_priv(d);
>   	int ret;
> -	u8 obuf_pre[3] = { 0x37, 0, 0 };
> -	u8 obuf_post[3] = { 0x36, 3, 0 };
> +	static u8 obuf_pre[3] = { 0x37, 0, 0 };
> +	static u8 obuf_post[3] = { 0x36, 3, 0 };
>   
> -	mutex_lock(&state->stream_mutex);
> -	ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0);
> +	mutex_lock(&d->usb_mutex);
> +	memcpy(state->obuf, obuf_pre, 3);
> +	ret = dvb_usbv2_generic_write_locked(d, state->obuf, 3);
>   	if (!ret && onoff) {
>   		msleep(20);
> -		ret = dvbsky_usb_generic_rw(d, obuf_post, 3, NULL, 0);
> +		memcpy(state->obuf, obuf_post, 3);
> +		ret = dvb_usbv2_generic_write_locked(d, state->obuf, 3);
>   	}
> -	mutex_unlock(&state->stream_mutex);
> +	mutex_unlock(&d->usb_mutex);
>   	return ret;
>   }
>   
> @@ -599,7 +600,6 @@ static int dvbsky_init(struct dvb_usb_device *d)
>   	if (ret)
>   		return ret;
>   	*/
commented-out code has call to non-existing function.

> -	mutex_init(&state->stream_mutex);
>   
>   	state->last_lock = 0;
>   
Thanks,
Jan Pieter.

  reply	other threads:[~2019-09-29 22:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-29  8:04 [PATCH 1/1] media: dvbsky: use a single mutex and state buffers for all R/W ops Andrei Koshkosh
2019-09-29 21:40 ` JP [this message]
2019-11-08 18:15 Andrei Koshkosh
2019-11-08 18:22 ` Brüns, Stefan
2019-11-08 19:15   ` JP

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=fa7cfdba-42b3-bcc2-7e61-f4108c07529d@jpvw.nl \
    --to=jp@jpvw.nl \
    --cc=andreykosh000@mail.ru \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sean@mess.org \
    --cc=stefan.bruens@rwth-aachen.de \
    --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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).