diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2008-07-03 23:35:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:17:40 -0400 |
commit | 291358785cde5536d98a4f3cae77efd8ca626486 (patch) | |
tree | 1357726b2b26e99119ced788347071b5a41f2ca4 /drivers/media/video/uvc | |
parent | 233548a2fd934a0220db8b1521c0bc88c82e5e53 (diff) |
V4L/DVB (8208): uvcvideo: Use GFP_NOIO when allocating memory during resume
The swap device might still be asleep, so memory allocated in the resume
handler must use GFP_NOIO. Thanks to Oliver Neukum for catching and reporting
this bug.
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/uvc')
-rw-r--r-- | drivers/media/video/uvc/uvc_status.c | 2 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_video.c | 24 |
2 files changed, 13 insertions, 13 deletions
diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c index be9084e5eace..06b47980ed98 100644 --- a/drivers/media/video/uvc/uvc_status.c +++ b/drivers/media/video/uvc/uvc_status.c | |||
@@ -203,5 +203,5 @@ int uvc_status_resume(struct uvc_device *dev) | |||
203 | if (dev->int_urb == NULL) | 203 | if (dev->int_urb == NULL) |
204 | return 0; | 204 | return 0; |
205 | 205 | ||
206 | return usb_submit_urb(dev->int_urb, GFP_KERNEL); | 206 | return usb_submit_urb(dev->int_urb, GFP_NOIO); |
207 | } | 207 | } |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 6faf1fb21614..8eb5748c446e 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -586,7 +586,7 @@ static void uvc_uninit_video(struct uvc_video_device *video) | |||
586 | * is given by the endpoint. | 586 | * is given by the endpoint. |
587 | */ | 587 | */ |
588 | static int uvc_init_video_isoc(struct uvc_video_device *video, | 588 | static int uvc_init_video_isoc(struct uvc_video_device *video, |
589 | struct usb_host_endpoint *ep) | 589 | struct usb_host_endpoint *ep, gfp_t gfp_flags) |
590 | { | 590 | { |
591 | struct urb *urb; | 591 | struct urb *urb; |
592 | unsigned int npackets, i, j; | 592 | unsigned int npackets, i, j; |
@@ -611,14 +611,14 @@ static int uvc_init_video_isoc(struct uvc_video_device *video, | |||
611 | size = npackets * psize; | 611 | size = npackets * psize; |
612 | 612 | ||
613 | for (i = 0; i < UVC_URBS; ++i) { | 613 | for (i = 0; i < UVC_URBS; ++i) { |
614 | urb = usb_alloc_urb(npackets, GFP_KERNEL); | 614 | urb = usb_alloc_urb(npackets, gfp_flags); |
615 | if (urb == NULL) { | 615 | if (urb == NULL) { |
616 | uvc_uninit_video(video); | 616 | uvc_uninit_video(video); |
617 | return -ENOMEM; | 617 | return -ENOMEM; |
618 | } | 618 | } |
619 | 619 | ||
620 | video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev, | 620 | video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev, |
621 | size, GFP_KERNEL, &urb->transfer_dma); | 621 | size, gfp_flags, &urb->transfer_dma); |
622 | if (video->urb_buffer[i] == NULL) { | 622 | if (video->urb_buffer[i] == NULL) { |
623 | usb_free_urb(urb); | 623 | usb_free_urb(urb); |
624 | uvc_uninit_video(video); | 624 | uvc_uninit_video(video); |
@@ -652,7 +652,7 @@ static int uvc_init_video_isoc(struct uvc_video_device *video, | |||
652 | * given by the endpoint. | 652 | * given by the endpoint. |
653 | */ | 653 | */ |
654 | static int uvc_init_video_bulk(struct uvc_video_device *video, | 654 | static int uvc_init_video_bulk(struct uvc_video_device *video, |
655 | struct usb_host_endpoint *ep) | 655 | struct usb_host_endpoint *ep, gfp_t gfp_flags) |
656 | { | 656 | { |
657 | struct urb *urb; | 657 | struct urb *urb; |
658 | unsigned int pipe, i; | 658 | unsigned int pipe, i; |
@@ -674,14 +674,14 @@ static int uvc_init_video_bulk(struct uvc_video_device *video, | |||
674 | pipe = usb_rcvbulkpipe(video->dev->udev, ep->desc.bEndpointAddress); | 674 | pipe = usb_rcvbulkpipe(video->dev->udev, ep->desc.bEndpointAddress); |
675 | 675 | ||
676 | for (i = 0; i < UVC_URBS; ++i) { | 676 | for (i = 0; i < UVC_URBS; ++i) { |
677 | urb = usb_alloc_urb(0, GFP_KERNEL); | 677 | urb = usb_alloc_urb(0, gfp_flags); |
678 | if (urb == NULL) { | 678 | if (urb == NULL) { |
679 | uvc_uninit_video(video); | 679 | uvc_uninit_video(video); |
680 | return -ENOMEM; | 680 | return -ENOMEM; |
681 | } | 681 | } |
682 | 682 | ||
683 | video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev, | 683 | video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev, |
684 | size, GFP_KERNEL, &urb->transfer_dma); | 684 | size, gfp_flags, &urb->transfer_dma); |
685 | if (video->urb_buffer[i] == NULL) { | 685 | if (video->urb_buffer[i] == NULL) { |
686 | usb_free_urb(urb); | 686 | usb_free_urb(urb); |
687 | uvc_uninit_video(video); | 687 | uvc_uninit_video(video); |
@@ -702,7 +702,7 @@ static int uvc_init_video_bulk(struct uvc_video_device *video, | |||
702 | /* | 702 | /* |
703 | * Initialize isochronous/bulk URBs and allocate transfer buffers. | 703 | * Initialize isochronous/bulk URBs and allocate transfer buffers. |
704 | */ | 704 | */ |
705 | static int uvc_init_video(struct uvc_video_device *video) | 705 | static int uvc_init_video(struct uvc_video_device *video, gfp_t gfp_flags) |
706 | { | 706 | { |
707 | struct usb_interface *intf = video->streaming->intf; | 707 | struct usb_interface *intf = video->streaming->intf; |
708 | struct usb_host_interface *alts; | 708 | struct usb_host_interface *alts; |
@@ -747,7 +747,7 @@ static int uvc_init_video(struct uvc_video_device *video) | |||
747 | if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) | 747 | if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) |
748 | return ret; | 748 | return ret; |
749 | 749 | ||
750 | ret = uvc_init_video_isoc(video, ep); | 750 | ret = uvc_init_video_isoc(video, ep, gfp_flags); |
751 | } else { | 751 | } else { |
752 | /* Bulk endpoint, proceed to URB initialization. */ | 752 | /* Bulk endpoint, proceed to URB initialization. */ |
753 | ep = uvc_find_endpoint(&intf->altsetting[0], | 753 | ep = uvc_find_endpoint(&intf->altsetting[0], |
@@ -755,7 +755,7 @@ static int uvc_init_video(struct uvc_video_device *video) | |||
755 | if (ep == NULL) | 755 | if (ep == NULL) |
756 | return -EIO; | 756 | return -EIO; |
757 | 757 | ||
758 | ret = uvc_init_video_bulk(video, ep); | 758 | ret = uvc_init_video_bulk(video, ep, gfp_flags); |
759 | } | 759 | } |
760 | 760 | ||
761 | if (ret < 0) | 761 | if (ret < 0) |
@@ -763,7 +763,7 @@ static int uvc_init_video(struct uvc_video_device *video) | |||
763 | 763 | ||
764 | /* Submit the URBs. */ | 764 | /* Submit the URBs. */ |
765 | for (i = 0; i < UVC_URBS; ++i) { | 765 | for (i = 0; i < UVC_URBS; ++i) { |
766 | if ((ret = usb_submit_urb(video->urb[i], GFP_KERNEL)) < 0) { | 766 | if ((ret = usb_submit_urb(video->urb[i], gfp_flags)) < 0) { |
767 | uvc_printk(KERN_ERR, "Failed to submit URB %u " | 767 | uvc_printk(KERN_ERR, "Failed to submit URB %u " |
768 | "(%d).\n", i, ret); | 768 | "(%d).\n", i, ret); |
769 | uvc_uninit_video(video); | 769 | uvc_uninit_video(video); |
@@ -818,7 +818,7 @@ int uvc_video_resume(struct uvc_video_device *video) | |||
818 | if (!uvc_queue_streaming(&video->queue)) | 818 | if (!uvc_queue_streaming(&video->queue)) |
819 | return 0; | 819 | return 0; |
820 | 820 | ||
821 | if ((ret = uvc_init_video(video)) < 0) | 821 | if ((ret = uvc_init_video(video, GFP_NOIO)) < 0) |
822 | uvc_queue_enable(&video->queue, 0); | 822 | uvc_queue_enable(&video->queue, 0); |
823 | 823 | ||
824 | return ret; | 824 | return ret; |
@@ -930,5 +930,5 @@ int uvc_video_enable(struct uvc_video_device *video, int enable) | |||
930 | if ((ret = uvc_queue_enable(&video->queue, 1)) < 0) | 930 | if ((ret = uvc_queue_enable(&video->queue, 1)) < 0) |
931 | return ret; | 931 | return ret; |
932 | 932 | ||
933 | return uvc_init_video(video); | 933 | return uvc_init_video(video, GFP_KERNEL); |
934 | } | 934 | } |