Re: autosuspend for radio-mr800 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 2, 2009 at 9:04 PM, Oliver Neukum <oliver@xxxxxxxxxx> wrote:
> Am Freitag, 9. Oktober 2009 01:16:45 schrieb Alexey Klimov:
>> Sorry for very long delay. Finally we patched radio-mr800 driver.
>> Well, lock/unlock_kernel() was removed and open/close/suspend/resume
>> functions were changed. But last patchset was not pulled in upstrem
>> kernel yet. So, latest driver is available in mercurial hg v4l-dvb
>> repository
>> http://linuxtv.org/hg/v4l-dvb/file/17ce959c2b91/linux/drivers/media/radio/r
>>adio-mr800.c and link to raw file
>> http://linuxtv.org/hg/v4l-dvb/raw-file/17ce959c2b91/linux/drivers/media/rad
>>io/radio-mr800.c If you want  to redesign your patch feel free to send new
>> version to me. I can test any patch.
>> Also, if you want i can look into your patch and redesign it.
>
> Hi,
>
> I made a patch for this version. Please test.
>
>        Regards
>                Oliver

Hello Oliver,

Thanks, i tested your patch and found no problems with it. Device works fine.
If you need my ack here it is:

Acked-by: Alexey Klimov <klimov.linux@xxxxxxxxx>

Will it go through usb-tree or do we need to post it to v4l-maillist?


> --
>
> --- a/drivers/media/radio/radio-mr800.c
> +++ b/drivers/media/radio/radio-mr800.c
> @@ -133,6 +133,7 @@ static int usb_amradio_resume(struct usb_interface *intf);
>  struct amradio_device {
>        /* reference to USB and video device */
>        struct usb_device *usbdev;
> +       struct usb_interface *intf;
>        struct video_device videodev;
>        struct v4l2_device v4l2_dev;
>
> @@ -166,7 +167,7 @@ static struct usb_driver usb_amradio_driver = {
>        .reset_resume           = usb_amradio_resume,
>  #endif
>        .id_table               = usb_amradio_device_table,
> -       .supports_autosuspend   = 0,
> +       .supports_autosuspend   = 1,
>  };
>
>  /* switch on/off the radio. Send 8 bytes to device */
> @@ -509,9 +510,15 @@ static int usb_amradio_open(struct file *file)
>        }
>
>        file->private_data = radio;
> +       retval = usb_autopm_get_interface(radio->intf);
> +       if (retval)
> +               goto unlock;
>
> -       if (unlikely(!radio->initialized))
> +       if (unlikely(!radio->initialized)) {
>                retval = usb_amradio_init(radio);
> +               if (retval)
> +                       usb_autopm_put_interface(radio->intf);
> +       }
>
>  unlock:
>        mutex_unlock(&radio->lock);
> @@ -528,6 +535,8 @@ static int usb_amradio_close(struct file *file)
>
>        if (!radio->usbdev)
>                retval = -EIO;
> +       else
> +               usb_autopm_put_interface(radio->intf);
>
>        mutex_unlock(&radio->lock);
>        return retval;
> @@ -669,6 +678,7 @@ static int usb_amradio_probe(struct usb_interface *intf,
>        radio->videodev.release = usb_amradio_video_device_release;
>
>        radio->usbdev = interface_to_usbdev(intf);
> +       radio->intf = intf;
>        radio->curfreq = 95.16 * FREQ_MUL;
>
>        mutex_init(&radio->lock);
>
>
>



-- 
Best regards, Klimov Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux