linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: linuxtv@stefanringel.de, linux-media@vger.kernel.org,
	d.belimov@gmail.com
Subject: Re: [PATCH 3/5] tm6000: bugfix interrupt reset
Date: Mon, 05 Dec 2011 10:04:14 -0200	[thread overview]
Message-ID: <4EDCB33E.8090100@redhat.com> (raw)
In-Reply-To: <20111205072131.GB7341@avionic-0098.mockup.avionic-design.de>

On 05-12-2011 05:21, Thierry Reding wrote:
> * linuxtv@stefanringel.de wrote:
>> From: Stefan Ringel<linuxtv@stefanringel.de>
>>
>> Signed-off-by: Stefan Ringel<linuxtv@stefanringel.de>
>
> Your commit message needs more details. Why do you think this is a bugfix?
> Also this commit seems to effectively revert (and then partially reimplement)
> a patch that I posted some months ago.

Thierry,

I noticed this. I tested tm6000 with those changes with both the first gen
tm5600 devices I have and HVR900H and I didn't notice any bad thing with this
approach, and changing from one standard to another is now faster.

So, I decided to apply it (with the remaining patches I've made to
fix audio for PAL/M and NTSC/M).

I also noticed that TM6000_QUIRK_NO_USB_DELAY is not needed anymore
(still, Stefan's patches didn't remove it completely).

Could you please test if the problems you've solved with your approach
are still occurring?

Regards,
Mauro

>
>> ---
>>   drivers/media/video/tm6000/tm6000-core.c  |   49 -----------------------------
>>   drivers/media/video/tm6000/tm6000-video.c |   21 ++++++++++--
>>   2 files changed, 17 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/media/video/tm6000/tm6000-core.c b/drivers/media/video/tm6000/tm6000-core.c
>> index c007e6d..920299e 100644
>> --- a/drivers/media/video/tm6000/tm6000-core.c
>> +++ b/drivers/media/video/tm6000/tm6000-core.c
>> @@ -599,55 +599,6 @@ int tm6000_init(struct tm6000_core *dev)
>>   	return rc;
>>   }
>>
>> -int tm6000_reset(struct tm6000_core *dev)
>> -{
>> -	int pipe;
>> -	int err;
>> -
>> -	msleep(500);
>> -
>> -	err = usb_set_interface(dev->udev, dev->isoc_in.bInterfaceNumber, 0);
>> -	if (err<  0) {
>> -		tm6000_err("failed to select interface %d, alt. setting 0\n",
>> -				dev->isoc_in.bInterfaceNumber);
>> -		return err;
>> -	}
>> -
>> -	err = usb_reset_configuration(dev->udev);
>> -	if (err<  0) {
>> -		tm6000_err("failed to reset configuration\n");
>> -		return err;
>> -	}
>> -
>> -	if ((dev->quirks&  TM6000_QUIRK_NO_USB_DELAY) == 0)
>> -		msleep(5);
>> -
>> -	/*
>> -	 * Not all devices have int_in defined
>> -	 */
>> -	if (!dev->int_in.endp)
>> -		return 0;
>> -
>> -	err = usb_set_interface(dev->udev, dev->isoc_in.bInterfaceNumber, 2);
>> -	if (err<  0) {
>> -		tm6000_err("failed to select interface %d, alt. setting 2\n",
>> -				dev->isoc_in.bInterfaceNumber);
>> -		return err;
>> -	}
>> -
>> -	msleep(5);
>> -
>> -	pipe = usb_rcvintpipe(dev->udev,
>> -			dev->int_in.endp->desc.bEndpointAddress&  USB_ENDPOINT_NUMBER_MASK);
>> -
>> -	err = usb_clear_halt(dev->udev, pipe);
>> -	if (err<  0) {
>> -		tm6000_err("usb_clear_halt failed: %d\n", err);
>> -		return err;
>> -	}
>> -
>> -	return 0;
>> -}
>>
>>   int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate)
>>   {
>> diff --git a/drivers/media/video/tm6000/tm6000-video.c b/drivers/media/video/tm6000/tm6000-video.c
>> index 1e5ace0..4db3535 100644
>> --- a/drivers/media/video/tm6000/tm6000-video.c
>> +++ b/drivers/media/video/tm6000/tm6000-video.c
>> @@ -1609,12 +1609,25 @@ static int tm6000_release(struct file *file)
>>
>>   		tm6000_uninit_isoc(dev);
>>
>> +		/* Stop interrupt USB pipe */
>> +		tm6000_ir_int_stop(dev);
>> +
>> +		usb_reset_configuration(dev->udev);
>> +
>> +		if (&dev->int_in)
>
> This check is wrong,&dev->int_in will always be true.
>
>> +			usb_set_interface(dev->udev,
>> +			dev->isoc_in.bInterfaceNumber,
>> +			2);
>> +		else
>> +			usb_set_interface(dev->udev,
>> +			dev->isoc_in.bInterfaceNumber,
>> +			0);
>
> This would need better indentation.
>
>> +
>> +		/* Start interrupt USB pipe */
>> +		tm6000_ir_int_start(dev);
>> +
>
> Why do you restart the IR interrupt pipe when the device is being released?
>
>>   		if (!fh->radio)
>>   			videobuf_mmap_free(&fh->vb_vidq);
>> -
>> -		err = tm6000_reset(dev);
>> -		if (err<  0)
>> -			dev_err(&vdev->dev, "reset failed: %d\n", err);
>>   	}
>>
>>   	kfree(fh);
>
> I think this whole patch should be much shorter. Something along the lines
> of:
>
> @@ -1609,12 +1609,25 @@ static int tm6000_release(struct file *file)
>
>   		tm6000_uninit_isoc(dev);
>
> +		/* Stop interrupt USB pipe */
> +		tm6000_ir_int_stop(dev);
> +
>   		if (!fh->radio)
>   			videobuf_mmap_free(&fh->vb_vidq);
>
>
> Thierry


  reply	other threads:[~2011-12-05 12:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1322509580-14460-1-git-send-email-linuxtv@stefanringel.de>
2011-11-28 19:46 ` [PATCH 2/5] tm6000: bugfix register setting linuxtv
2011-11-28 19:46 ` [PATCH 3/5] tm6000: bugfix interrupt reset linuxtv
2011-12-05  7:21   ` Thierry Reding
2011-12-05 12:04     ` Mauro Carvalho Chehab [this message]
2011-12-05 15:38       ` Thierry Reding
2011-12-05 18:21         ` Mauro Carvalho Chehab
2011-12-05 20:02           ` Stefan Ringel
2011-12-05 20:16             ` Mauro Carvalho Chehab
2011-12-06  6:51               ` Thierry Reding
2011-12-06  8:12                 ` Thierry Reding
2011-12-06 12:25                   ` Mauro Carvalho Chehab
2011-12-06 13:05                     ` [PATCH] [media] tm6000: Fix fast USB access quirk Thierry Reding
2011-12-06 12:22                 ` [PATCH 3/5] tm6000: bugfix interrupt reset Mauro Carvalho Chehab
2011-11-28 19:46 ` [PATCH 4/5] tm6000: bugfix bulk transfer linuxtv
2011-11-28 19:46 ` [PATCH 5/5] tm6000: bugfix data check linuxtv
2011-11-30 17:21   ` Mauro Carvalho Chehab
2011-12-06 13:39 ` [PATCH 1/2] [media] tm6000: Fix check for interrupt endpoint Thierry Reding
2011-12-06 13:39   ` [PATCH 2/2] [media] tm6000: Fix bad indentation Thierry Reding
2011-12-06 13:58     ` Antti Palosaari
2011-12-06 14:13       ` Thierry Reding
2011-12-06 20:58         ` Mauro Carvalho Chehab
2011-12-06 21:03           ` Antti Palosaari
2011-12-07 13:24             ` 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=4EDCB33E.8090100@redhat.com \
    --to=mchehab@redhat.com \
    --cc=d.belimov@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linuxtv@stefanringel.de \
    --cc=thierry.reding@avionic-design.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).