Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138089
b: refs/heads/master
c: 4e06839
h: refs/heads/master
i:
  138087: ba3ce0d
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 59fb518 commit cd27294
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78175bf2c5e4beb0874aee27dcfce58c4c7d4fb4
refs/heads/master: 4e06839fc7221872d7868855c05659f08d1c9f3d
20 changes: 13 additions & 7 deletions trunk/drivers/media/video/w9968cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3495,12 +3495,14 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
if (!cam)
return -ENOMEM;

err = v4l2_device_register(&udev->dev, &cam->v4l2_dev);
if (err)
goto fail0;

mutex_init(&cam->dev_mutex);
mutex_lock(&cam->dev_mutex);

cam->usbdev = udev;
/* NOTE: a local copy is used to avoid possible race conditions */
memcpy(&cam->dev, &udev->dev, sizeof(struct device));

DBG(2, "%s detected", symbolic(camlist, mod_id))

Expand Down Expand Up @@ -3549,7 +3551,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
cam->v4ldev->minor = video_nr[dev_nr];
cam->v4ldev->release = video_device_release;
video_set_drvdata(cam->v4ldev, cam);
cam->v4ldev->parent = &cam->dev;
cam->v4ldev->v4l2_dev = &cam->v4l2_dev;

err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
video_nr[dev_nr]);
Expand Down Expand Up @@ -3579,6 +3581,9 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)

usb_set_intfdata(intf, cam);
mutex_unlock(&cam->dev_mutex);

if (ovmod_load)
request_module("ovcamchip");
return 0;

fail: /* Free unused memory */
Expand All @@ -3587,6 +3592,8 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
if (cam->v4ldev)
video_device_release(cam->v4ldev);
mutex_unlock(&cam->dev_mutex);
v4l2_device_unregister(&cam->v4l2_dev);
fail0:
kfree(cam);
return err;
}
Expand Down Expand Up @@ -3622,8 +3629,10 @@ static void w9968cf_usb_disconnect(struct usb_interface* intf)

mutex_unlock(&cam->dev_mutex);

if (!cam->users)
if (!cam->users) {
v4l2_device_unregister(&cam->v4l2_dev);
kfree(cam);
}
}

up_write(&w9968cf_disconnect);
Expand All @@ -3650,9 +3659,6 @@ static int __init w9968cf_module_init(void)
KDBG(2, W9968CF_MODULE_NAME" "W9968CF_MODULE_VERSION)
KDBG(3, W9968CF_MODULE_AUTHOR)

if (ovmod_load)
request_module("ovcamchip");

if ((err = usb_register(&w9968cf_usb_driver)))
return err;

Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/media/video/w9968cf.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <linux/rwsem.h>
#include <linux/mutex.h>

#include <media/v4l2-device.h>
#include <media/ovcamchip.h>

#include "w9968cf_vpp.h"
Expand Down Expand Up @@ -195,10 +196,9 @@ enum w9968cf_vpp_flag {

/* Main device driver structure */
struct w9968cf_device {
struct device dev; /* device structure */

enum w9968cf_model_id id; /* private device identifier */

struct v4l2_device v4l2_dev;
struct video_device* v4ldev; /* -> V4L structure */
struct list_head v4llist; /* entry of the list of V4L cameras */

Expand Down Expand Up @@ -291,14 +291,14 @@ struct w9968cf_device {
if ( ((specific_debug) && (debug == (level))) || \
((!specific_debug) && (debug >= (level))) ) { \
if ((level) == 1) \
dev_err(&cam->dev, fmt "\n", ## args); \
v4l2_err(&cam->v4l2_dev, fmt "\n", ## args); \
else if ((level) == 2 || (level) == 3) \
dev_info(&cam->dev, fmt "\n", ## args); \
v4l2_info(&cam->v4l2_dev, fmt "\n", ## args); \
else if ((level) == 4) \
dev_warn(&cam->dev, fmt "\n", ## args); \
v4l2_warn(&cam->v4l2_dev, fmt "\n", ## args); \
else if ((level) >= 5) \
dev_info(&cam->dev, "[%s:%d] " fmt "\n", \
__func__, __LINE__ , ## args); \
v4l2_info(&cam->v4l2_dev, "[%s:%d] " fmt "\n", \
__func__, __LINE__ , ## args); \
} \
}
/* For generic kernel (not device specific) messages */
Expand All @@ -321,7 +321,7 @@ struct w9968cf_device {

#undef PDBG
#define PDBG(fmt, args...) \
dev_info(&cam->dev, "[%s:%d] " fmt "\n", __func__, __LINE__ , ## args);
v4l2_info(&cam->v4l2_dev, "[%s:%d] " fmt "\n", __func__, __LINE__ , ## args);

#undef PDBGG
#define PDBGG(fmt, args...) do {;} while(0); /* nothing: it's a placeholder */
Expand Down

0 comments on commit cd27294

Please sign in to comment.