aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c26
-rw-r--r--drivers/media/rc/nuvoton-cir.c45
-rw-r--r--drivers/media/rc/nuvoton-cir.h1
-rw-r--r--drivers/media/video/gspca/ov519.c22
-rw-r--r--drivers/media/video/gspca/sonixj.c6
-rw-r--r--drivers/media/video/omap/omap_vout.c13
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c1
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c2
-rw-r--r--drivers/media/video/uvc/uvc_driver.c2
-rw-r--r--drivers/media/video/uvc/uvc_entity.c2
-rw-r--r--drivers/media/video/uvc/uvc_video.c10
-rw-r--r--drivers/media/video/uvc/uvcvideo.h2
-rw-r--r--drivers/media/video/v4l2-dev.c11
-rw-r--r--drivers/media/video/v4l2-device.c2
-rw-r--r--drivers/media/video/via-camera.c2
15 files changed, 56 insertions, 91 deletions
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 3db89e3cb0b..536c16c943b 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -224,26 +224,8 @@ static struct dvb_usb_device_properties vp7045_properties;
224static int vp7045_usb_probe(struct usb_interface *intf, 224static int vp7045_usb_probe(struct usb_interface *intf,
225 const struct usb_device_id *id) 225 const struct usb_device_id *id)
226{ 226{
227 struct dvb_usb_device *d; 227 return dvb_usb_device_init(intf, &vp7045_properties,
228 int ret = dvb_usb_device_init(intf, &vp7045_properties, 228 THIS_MODULE, NULL, adapter_nr);
229 THIS_MODULE, &d, adapter_nr);
230 if (ret)
231 return ret;
232
233 d->priv = kmalloc(20, GFP_KERNEL);
234 if (!d->priv) {
235 dvb_usb_device_exit(intf);
236 return -ENOMEM;
237 }
238
239 return ret;
240}
241
242static void vp7045_usb_disconnect(struct usb_interface *intf)
243{
244 struct dvb_usb_device *d = usb_get_intfdata(intf);
245 kfree(d->priv);
246 dvb_usb_device_exit(intf);
247} 229}
248 230
249static struct usb_device_id vp7045_usb_table [] = { 231static struct usb_device_id vp7045_usb_table [] = {
@@ -258,7 +240,7 @@ MODULE_DEVICE_TABLE(usb, vp7045_usb_table);
258static struct dvb_usb_device_properties vp7045_properties = { 240static struct dvb_usb_device_properties vp7045_properties = {
259 .usb_ctrl = CYPRESS_FX2, 241 .usb_ctrl = CYPRESS_FX2,
260 .firmware = "dvb-usb-vp7045-01.fw", 242 .firmware = "dvb-usb-vp7045-01.fw",
261 .size_of_priv = sizeof(u8 *), 243 .size_of_priv = 20,
262 244
263 .num_adapters = 1, 245 .num_adapters = 1,
264 .adapter = { 246 .adapter = {
@@ -305,7 +287,7 @@ static struct dvb_usb_device_properties vp7045_properties = {
305static struct usb_driver vp7045_usb_driver = { 287static struct usb_driver vp7045_usb_driver = {
306 .name = "dvb_usb_vp7045", 288 .name = "dvb_usb_vp7045",
307 .probe = vp7045_usb_probe, 289 .probe = vp7045_usb_probe,
308 .disconnect = vp7045_usb_disconnect, 290 .disconnect = dvb_usb_device_exit,
309 .id_table = vp7045_usb_table, 291 .id_table = vp7045_usb_table,
310}; 292};
311 293
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index eae05b50047..144f3f55d76 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -618,7 +618,6 @@ static void nvt_dump_rx_buf(struct nvt_dev *nvt)
618static void nvt_process_rx_ir_data(struct nvt_dev *nvt) 618static void nvt_process_rx_ir_data(struct nvt_dev *nvt)
619{ 619{
620 DEFINE_IR_RAW_EVENT(rawir); 620 DEFINE_IR_RAW_EVENT(rawir);
621 unsigned int count;
622 u32 carrier; 621 u32 carrier;
623 u8 sample; 622 u8 sample;
624 int i; 623 int i;
@@ -631,65 +630,38 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt)
631 if (nvt->carrier_detect_enabled) 630 if (nvt->carrier_detect_enabled)
632 carrier = nvt_rx_carrier_detect(nvt); 631 carrier = nvt_rx_carrier_detect(nvt);
633 632
634 count = nvt->pkts; 633 nvt_dbg_verbose("Processing buffer of len %d", nvt->pkts);
635 nvt_dbg_verbose("Processing buffer of len %d", count);
636 634
637 init_ir_raw_event(&rawir); 635 init_ir_raw_event(&rawir);
638 636
639 for (i = 0; i < count; i++) { 637 for (i = 0; i < nvt->pkts; i++) {
640 nvt->pkts--;
641 sample = nvt->buf[i]; 638 sample = nvt->buf[i];
642 639
643 rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); 640 rawir.pulse = ((sample & BUF_PULSE_BIT) != 0);
644 rawir.duration = US_TO_NS((sample & BUF_LEN_MASK) 641 rawir.duration = US_TO_NS((sample & BUF_LEN_MASK)
645 * SAMPLE_PERIOD); 642 * SAMPLE_PERIOD);
646 643
647 if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { 644 nvt_dbg("Storing %s with duration %d",
648 if (nvt->rawir.pulse == rawir.pulse) 645 rawir.pulse ? "pulse" : "space", rawir.duration);
649 nvt->rawir.duration += rawir.duration;
650 else {
651 nvt->rawir.duration = rawir.duration;
652 nvt->rawir.pulse = rawir.pulse;
653 }
654 continue;
655 }
656
657 rawir.duration += nvt->rawir.duration;
658 646
659 init_ir_raw_event(&nvt->rawir); 647 ir_raw_event_store_with_filter(nvt->rdev, &rawir);
660 nvt->rawir.duration = 0;
661 nvt->rawir.pulse = rawir.pulse;
662
663 if (sample == BUF_PULSE_BIT)
664 rawir.pulse = false;
665
666 if (rawir.duration) {
667 nvt_dbg("Storing %s with duration %d",
668 rawir.pulse ? "pulse" : "space",
669 rawir.duration);
670
671 ir_raw_event_store_with_filter(nvt->rdev, &rawir);
672 }
673 648
674 /* 649 /*
675 * BUF_PULSE_BIT indicates end of IR data, BUF_REPEAT_BYTE 650 * BUF_PULSE_BIT indicates end of IR data, BUF_REPEAT_BYTE
676 * indicates end of IR signal, but new data incoming. In both 651 * indicates end of IR signal, but new data incoming. In both
677 * cases, it means we're ready to call ir_raw_event_handle 652 * cases, it means we're ready to call ir_raw_event_handle
678 */ 653 */
679 if ((sample == BUF_PULSE_BIT) && nvt->pkts) { 654 if ((sample == BUF_PULSE_BIT) && (i + 1 < nvt->pkts)) {
680 nvt_dbg("Calling ir_raw_event_handle (signal end)\n"); 655 nvt_dbg("Calling ir_raw_event_handle (signal end)\n");
681 ir_raw_event_handle(nvt->rdev); 656 ir_raw_event_handle(nvt->rdev);
682 } 657 }
683 } 658 }
684 659
660 nvt->pkts = 0;
661
685 nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n"); 662 nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n");
686 ir_raw_event_handle(nvt->rdev); 663 ir_raw_event_handle(nvt->rdev);
687 664
688 if (nvt->pkts) {
689 nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts);
690 nvt->pkts = 0;
691 }
692
693 nvt_dbg_verbose("%s done", __func__); 665 nvt_dbg_verbose("%s done", __func__);
694} 666}
695 667
@@ -1048,7 +1020,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1048 1020
1049 spin_lock_init(&nvt->nvt_lock); 1021 spin_lock_init(&nvt->nvt_lock);
1050 spin_lock_init(&nvt->tx.lock); 1022 spin_lock_init(&nvt->tx.lock);
1051 init_ir_raw_event(&nvt->rawir);
1052 1023
1053 ret = -EBUSY; 1024 ret = -EBUSY;
1054 /* now claim resources */ 1025 /* now claim resources */
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h
index 1241fc89a36..0d5e0872a2e 100644
--- a/drivers/media/rc/nuvoton-cir.h
+++ b/drivers/media/rc/nuvoton-cir.h
@@ -67,7 +67,6 @@ static int debug;
67struct nvt_dev { 67struct nvt_dev {
68 struct pnp_dev *pdev; 68 struct pnp_dev *pdev;
69 struct rc_dev *rdev; 69 struct rc_dev *rdev;
70 struct ir_raw_event rawir;
71 70
72 spinlock_t nvt_lock; 71 spinlock_t nvt_lock;
73 72
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index 0800433b209..18305c89083 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -2858,7 +2858,6 @@ static void ov7xx0_configure(struct sd *sd)
2858 case 0x60: 2858 case 0x60:
2859 PDEBUG(D_PROBE, "Sensor is a OV7660"); 2859 PDEBUG(D_PROBE, "Sensor is a OV7660");
2860 sd->sensor = SEN_OV7660; 2860 sd->sensor = SEN_OV7660;
2861 sd->invert_led = 0;
2862 break; 2861 break;
2863 default: 2862 default:
2864 PDEBUG(D_PROBE, "Unknown sensor: 0x76%x", low); 2863 PDEBUG(D_PROBE, "Unknown sensor: 0x76%x", low);
@@ -3337,7 +3336,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
3337 case BRIDGE_OV519: 3336 case BRIDGE_OV519:
3338 cam->cam_mode = ov519_vga_mode; 3337 cam->cam_mode = ov519_vga_mode;
3339 cam->nmodes = ARRAY_SIZE(ov519_vga_mode); 3338 cam->nmodes = ARRAY_SIZE(ov519_vga_mode);
3340 sd->invert_led = !sd->invert_led;
3341 break; 3339 break;
3342 case BRIDGE_OVFX2: 3340 case BRIDGE_OVFX2:
3343 cam->cam_mode = ov519_vga_mode; 3341 cam->cam_mode = ov519_vga_mode;
@@ -5005,24 +5003,24 @@ static const struct sd_desc sd_desc = {
5005/* -- module initialisation -- */ 5003/* -- module initialisation -- */
5006static const struct usb_device_id device_table[] = { 5004static const struct usb_device_id device_table[] = {
5007 {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, 5005 {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF },
5008 {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 }, 5006 {USB_DEVICE(0x041e, 0x4052),
5009 {USB_DEVICE(0x041e, 0x405f),
5010 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, 5007 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
5008 {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 },
5011 {USB_DEVICE(0x041e, 0x4060), .driver_info = BRIDGE_OV519 }, 5009 {USB_DEVICE(0x041e, 0x4060), .driver_info = BRIDGE_OV519 },
5012 {USB_DEVICE(0x041e, 0x4061), .driver_info = BRIDGE_OV519 }, 5010 {USB_DEVICE(0x041e, 0x4061), .driver_info = BRIDGE_OV519 },
5013 {USB_DEVICE(0x041e, 0x4064), 5011 {USB_DEVICE(0x041e, 0x4064), .driver_info = BRIDGE_OV519 },
5014 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
5015 {USB_DEVICE(0x041e, 0x4067), .driver_info = BRIDGE_OV519 }, 5012 {USB_DEVICE(0x041e, 0x4067), .driver_info = BRIDGE_OV519 },
5016 {USB_DEVICE(0x041e, 0x4068), 5013 {USB_DEVICE(0x041e, 0x4068), .driver_info = BRIDGE_OV519 },
5014 {USB_DEVICE(0x045e, 0x028c),
5017 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, 5015 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
5018 {USB_DEVICE(0x045e, 0x028c), .driver_info = BRIDGE_OV519 },
5019 {USB_DEVICE(0x054c, 0x0154), .driver_info = BRIDGE_OV519 }, 5016 {USB_DEVICE(0x054c, 0x0154), .driver_info = BRIDGE_OV519 },
5020 {USB_DEVICE(0x054c, 0x0155), 5017 {USB_DEVICE(0x054c, 0x0155), .driver_info = BRIDGE_OV519 },
5021 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
5022 {USB_DEVICE(0x05a9, 0x0511), .driver_info = BRIDGE_OV511 }, 5018 {USB_DEVICE(0x05a9, 0x0511), .driver_info = BRIDGE_OV511 },
5023 {USB_DEVICE(0x05a9, 0x0518), .driver_info = BRIDGE_OV518 }, 5019 {USB_DEVICE(0x05a9, 0x0518), .driver_info = BRIDGE_OV518 },
5024 {USB_DEVICE(0x05a9, 0x0519), .driver_info = BRIDGE_OV519 }, 5020 {USB_DEVICE(0x05a9, 0x0519),
5025 {USB_DEVICE(0x05a9, 0x0530), .driver_info = BRIDGE_OV519 }, 5021 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
5022 {USB_DEVICE(0x05a9, 0x0530),
5023 .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
5026 {USB_DEVICE(0x05a9, 0x2800), .driver_info = BRIDGE_OVFX2 }, 5024 {USB_DEVICE(0x05a9, 0x2800), .driver_info = BRIDGE_OVFX2 },
5027 {USB_DEVICE(0x05a9, 0x4519), .driver_info = BRIDGE_OV519 }, 5025 {USB_DEVICE(0x05a9, 0x4519), .driver_info = BRIDGE_OV519 },
5028 {USB_DEVICE(0x05a9, 0x8519), .driver_info = BRIDGE_OV519 }, 5026 {USB_DEVICE(0x05a9, 0x8519), .driver_info = BRIDGE_OV519 },
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 81b8a600783..c477ad11f10 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -2386,7 +2386,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
2386 reg_w1(gspca_dev, 0x01, 0x22); 2386 reg_w1(gspca_dev, 0x01, 0x22);
2387 msleep(100); 2387 msleep(100);
2388 reg01 = SCL_SEL_OD | S_PDN_INV; 2388 reg01 = SCL_SEL_OD | S_PDN_INV;
2389 reg17 &= MCK_SIZE_MASK; 2389 reg17 &= ~MCK_SIZE_MASK;
2390 reg17 |= 0x04; /* clock / 4 */ 2390 reg17 |= 0x04; /* clock / 4 */
2391 break; 2391 break;
2392 } 2392 }
@@ -2532,6 +2532,10 @@ static int sd_start(struct gspca_dev *gspca_dev)
2532 if (!mode) { /* if 640x480 */ 2532 if (!mode) { /* if 640x480 */
2533 reg17 &= ~MCK_SIZE_MASK; 2533 reg17 &= ~MCK_SIZE_MASK;
2534 reg17 |= 0x04; /* clock / 4 */ 2534 reg17 |= 0x04; /* clock / 4 */
2535 } else {
2536 reg01 &= ~SYS_SEL_48M; /* clk 24Mz */
2537 reg17 &= ~MCK_SIZE_MASK;
2538 reg17 |= 0x02; /* clock / 2 */
2535 } 2539 }
2536 break; 2540 break;
2537 case SENSOR_OV7630: 2541 case SENSOR_OV7630:
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index b5ef3622244..b3a5ecdb33a 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -2194,19 +2194,6 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2194 "'%s' Display already enabled\n", 2194 "'%s' Display already enabled\n",
2195 def_display->name); 2195 def_display->name);
2196 } 2196 }
2197 /* set the update mode */
2198 if (def_display->caps &
2199 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
2200 if (dssdrv->enable_te)
2201 dssdrv->enable_te(def_display, 0);
2202 if (dssdrv->set_update_mode)
2203 dssdrv->set_update_mode(def_display,
2204 OMAP_DSS_UPDATE_MANUAL);
2205 } else {
2206 if (dssdrv->set_update_mode)
2207 dssdrv->set_update_mode(def_display,
2208 OMAP_DSS_UPDATE_AUTO);
2209 }
2210 } 2197 }
2211 } 2198 }
2212 2199
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index 9d3459de04b..80796eb0c53 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -31,6 +31,7 @@
31#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/mm.h> 32#include <linux/mm.h>
33#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/slab.h>
34#include <media/v4l2-event.h> 35#include <media/v4l2-event.h>
35 36
36#include "isp.h" 37#include "isp.h"
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index e9a0e94b999..8c70e64444e 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -338,7 +338,7 @@ int pwc_init_controls(struct pwc_device *pdev)
338 if (pdev->restore_factory) 338 if (pdev->restore_factory)
339 pdev->restore_factory->flags = V4L2_CTRL_FLAG_UPDATE; 339 pdev->restore_factory->flags = V4L2_CTRL_FLAG_UPDATE;
340 340
341 if (!pdev->features & FEATURE_MOTOR_PANTILT) 341 if (!(pdev->features & FEATURE_MOTOR_PANTILT))
342 return hdl->error; 342 return hdl->error;
343 343
344 /* Motor pan / tilt / reset */ 344 /* Motor pan / tilt / reset */
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index d29f9c2d085..e4100b1f68d 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1961,7 +1961,7 @@ static int __uvc_resume(struct usb_interface *intf, int reset)
1961 1961
1962 list_for_each_entry(stream, &dev->streams, list) { 1962 list_for_each_entry(stream, &dev->streams, list) {
1963 if (stream->intf == intf) 1963 if (stream->intf == intf)
1964 return uvc_video_resume(stream); 1964 return uvc_video_resume(stream, reset);
1965 } 1965 }
1966 1966
1967 uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface " 1967 uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface "
diff --git a/drivers/media/video/uvc/uvc_entity.c b/drivers/media/video/uvc/uvc_entity.c
index 48fea373c25..29e239911d0 100644
--- a/drivers/media/video/uvc/uvc_entity.c
+++ b/drivers/media/video/uvc/uvc_entity.c
@@ -49,7 +49,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
49 if (remote == NULL) 49 if (remote == NULL)
50 return -EINVAL; 50 return -EINVAL;
51 51
52 source = (UVC_ENTITY_TYPE(remote) != UVC_TT_STREAMING) 52 source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING)
53 ? (remote->vdev ? &remote->vdev->entity : NULL) 53 ? (remote->vdev ? &remote->vdev->entity : NULL)
54 : &remote->subdev.entity; 54 : &remote->subdev.entity;
55 if (source == NULL) 55 if (source == NULL)
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index 8244167c891..ffd1158628b 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -1104,10 +1104,18 @@ int uvc_video_suspend(struct uvc_streaming *stream)
1104 * buffers, making sure userspace applications are notified of the problem 1104 * buffers, making sure userspace applications are notified of the problem
1105 * instead of waiting forever. 1105 * instead of waiting forever.
1106 */ 1106 */
1107int uvc_video_resume(struct uvc_streaming *stream) 1107int uvc_video_resume(struct uvc_streaming *stream, int reset)
1108{ 1108{
1109 int ret; 1109 int ret;
1110 1110
1111 /* If the bus has been reset on resume, set the alternate setting to 0.
1112 * This should be the default value, but some devices crash or otherwise
1113 * misbehave if they don't receive a SET_INTERFACE request before any
1114 * other video control request.
1115 */
1116 if (reset)
1117 usb_set_interface(stream->dev->udev, stream->intfnum, 0);
1118
1111 stream->frozen = 0; 1119 stream->frozen = 0;
1112 1120
1113 ret = uvc_commit_video(stream, &stream->ctrl); 1121 ret = uvc_commit_video(stream, &stream->ctrl);
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index df32a43ca86..cbdd49bf8b6 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -638,7 +638,7 @@ extern void uvc_mc_cleanup_entity(struct uvc_entity *entity);
638/* Video */ 638/* Video */
639extern int uvc_video_init(struct uvc_streaming *stream); 639extern int uvc_video_init(struct uvc_streaming *stream);
640extern int uvc_video_suspend(struct uvc_streaming *stream); 640extern int uvc_video_suspend(struct uvc_streaming *stream);
641extern int uvc_video_resume(struct uvc_streaming *stream); 641extern int uvc_video_resume(struct uvc_streaming *stream, int reset);
642extern int uvc_video_enable(struct uvc_streaming *stream, int enable); 642extern int uvc_video_enable(struct uvc_streaming *stream, int enable);
643extern int uvc_probe_video(struct uvc_streaming *stream, 643extern int uvc_probe_video(struct uvc_streaming *stream,
644 struct uvc_streaming_control *probe); 644 struct uvc_streaming_control *probe);
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 06f14008b34..a5c9ed128b9 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -173,6 +173,17 @@ static void v4l2_device_release(struct device *cd)
173 media_device_unregister_entity(&vdev->entity); 173 media_device_unregister_entity(&vdev->entity);
174#endif 174#endif
175 175
176 /* Do not call v4l2_device_put if there is no release callback set.
177 * Drivers that have no v4l2_device release callback might free the
178 * v4l2_dev instance in the video_device release callback below, so we
179 * must perform this check here.
180 *
181 * TODO: In the long run all drivers that use v4l2_device should use the
182 * v4l2_device release callback. This check will then be unnecessary.
183 */
184 if (v4l2_dev && v4l2_dev->release == NULL)
185 v4l2_dev = NULL;
186
176 /* Release video_device and perform other 187 /* Release video_device and perform other
177 cleanups as needed. */ 188 cleanups as needed. */
178 vdev->release(vdev); 189 vdev->release(vdev);
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c
index c72856c4143..e6a2c3b302d 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -38,6 +38,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev)
38 mutex_init(&v4l2_dev->ioctl_lock); 38 mutex_init(&v4l2_dev->ioctl_lock);
39 v4l2_prio_init(&v4l2_dev->prio); 39 v4l2_prio_init(&v4l2_dev->prio);
40 kref_init(&v4l2_dev->ref); 40 kref_init(&v4l2_dev->ref);
41 get_device(dev);
41 v4l2_dev->dev = dev; 42 v4l2_dev->dev = dev;
42 if (dev == NULL) { 43 if (dev == NULL) {
43 /* If dev == NULL, then name must be filled in by the caller */ 44 /* If dev == NULL, then name must be filled in by the caller */
@@ -93,6 +94,7 @@ void v4l2_device_disconnect(struct v4l2_device *v4l2_dev)
93 94
94 if (dev_get_drvdata(v4l2_dev->dev) == v4l2_dev) 95 if (dev_get_drvdata(v4l2_dev->dev) == v4l2_dev)
95 dev_set_drvdata(v4l2_dev->dev, NULL); 96 dev_set_drvdata(v4l2_dev->dev, NULL);
97 put_device(v4l2_dev->dev);
96 v4l2_dev->dev = NULL; 98 v4l2_dev->dev = NULL;
97} 99}
98EXPORT_SYMBOL_GPL(v4l2_device_disconnect); 100EXPORT_SYMBOL_GPL(v4l2_device_disconnect);
diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c
index 85d3048c1d6..bb7f17f2a33 100644
--- a/drivers/media/video/via-camera.c
+++ b/drivers/media/video/via-camera.c
@@ -1332,6 +1332,8 @@ static __devinit bool viacam_serial_is_enabled(void)
1332 struct pci_bus *pbus = pci_find_bus(0, 0); 1332 struct pci_bus *pbus = pci_find_bus(0, 0);
1333 u8 cbyte; 1333 u8 cbyte;
1334 1334
1335 if (!pbus)
1336 return false;
1335 pci_bus_read_config_byte(pbus, VIACAM_SERIAL_DEVFN, 1337 pci_bus_read_config_byte(pbus, VIACAM_SERIAL_DEVFN,
1336 VIACAM_SERIAL_CREG, &cbyte); 1338 VIACAM_SERIAL_CREG, &cbyte);
1337 if ((cbyte & VIACAM_SERIAL_BIT) == 0) 1339 if ((cbyte & VIACAM_SERIAL_BIT) == 0)