diff options
author | Ming Lei <tom.leiming@gmail.com> | 2008-09-16 02:32:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:37:08 -0400 |
commit | a31a4055473bf0a7b2b06cb2262347200d0711e1 (patch) | |
tree | 296667c25e67acd933c55c71b85b619b5918ae5e /drivers/media/video/uvc/uvc_status.c | |
parent | d63beb9ef004ff9587b3c466361276254d57d7a7 (diff) |
V4L/DVB:usbvideo:don't use part of buffer for USB transfer #4
The status[] is part of uvc_device structure. We can't make sure
the address of status is at a cache-line boundary in all archs,so
status[] might share a cache-line with some fields in uvc_structure.
This can lead to some cache coherence issues(http://lwn.net/Articles/2265/).
Use dynamically allocated buffer instead.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc/uvc_status.c')
-rw-r--r-- | drivers/media/video/uvc/uvc_status.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c index 75e678ac54eb..5d60b264d59a 100644 --- a/drivers/media/video/uvc/uvc_status.c +++ b/drivers/media/video/uvc/uvc_status.c | |||
@@ -177,9 +177,15 @@ int uvc_status_init(struct uvc_device *dev) | |||
177 | 177 | ||
178 | uvc_input_init(dev); | 178 | uvc_input_init(dev); |
179 | 179 | ||
180 | dev->status = kzalloc(UVC_MAX_STATUS_SIZE, GFP_KERNEL); | ||
181 | if (dev->status == NULL) | ||
182 | return -ENOMEM; | ||
183 | |||
180 | dev->int_urb = usb_alloc_urb(0, GFP_KERNEL); | 184 | dev->int_urb = usb_alloc_urb(0, GFP_KERNEL); |
181 | if (dev->int_urb == NULL) | 185 | if (dev->int_urb == NULL) { |
186 | kfree(dev->status); | ||
182 | return -ENOMEM; | 187 | return -ENOMEM; |
188 | } | ||
183 | 189 | ||
184 | pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress); | 190 | pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress); |
185 | 191 | ||
@@ -192,7 +198,7 @@ int uvc_status_init(struct uvc_device *dev) | |||
192 | interval = fls(interval) - 1; | 198 | interval = fls(interval) - 1; |
193 | 199 | ||
194 | usb_fill_int_urb(dev->int_urb, dev->udev, pipe, | 200 | usb_fill_int_urb(dev->int_urb, dev->udev, pipe, |
195 | dev->status, sizeof dev->status, uvc_status_complete, | 201 | dev->status, UVC_MAX_STATUS_SIZE, uvc_status_complete, |
196 | dev, interval); | 202 | dev, interval); |
197 | 203 | ||
198 | return usb_submit_urb(dev->int_urb, GFP_KERNEL); | 204 | return usb_submit_urb(dev->int_urb, GFP_KERNEL); |
@@ -202,6 +208,7 @@ void uvc_status_cleanup(struct uvc_device *dev) | |||
202 | { | 208 | { |
203 | usb_kill_urb(dev->int_urb); | 209 | usb_kill_urb(dev->int_urb); |
204 | usb_free_urb(dev->int_urb); | 210 | usb_free_urb(dev->int_urb); |
211 | kfree(dev->status); | ||
205 | uvc_input_cleanup(dev); | 212 | uvc_input_cleanup(dev); |
206 | } | 213 | } |
207 | 214 | ||