V4L/DVB (11246): hdpvr: convert printing macros to v4l2_* with struct v4l2_device
it gives us a nice and unique prefix per device Signed-off-by: Janne Grunau <j@jannau.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
06630aec92
commit
9ef77adfb9
|
@ -40,9 +40,9 @@ int hdpvr_config_call(struct hdpvr_device *dev, uint value, u8 valbuf)
|
||||||
dev->usbc_buf, 1, 10000);
|
dev->usbc_buf, 1, 10000);
|
||||||
|
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
dev_dbg(&dev->udev->dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"config call request for value 0x%x returned %d\n", value,
|
"config call request for value 0x%x returned %d\n", value,
|
||||||
ret);
|
ret);
|
||||||
|
|
||||||
return ret < 0 ? ret : 0;
|
return ret < 0 ? ret : 0;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ struct hdpvr_video_info *get_video_info(struct hdpvr_device *dev)
|
||||||
|
|
||||||
vidinf = kzalloc(sizeof(struct hdpvr_video_info), GFP_KERNEL);
|
vidinf = kzalloc(sizeof(struct hdpvr_video_info), GFP_KERNEL);
|
||||||
if (!vidinf) {
|
if (!vidinf) {
|
||||||
dev_err(&dev->udev->dev, "out of memory");
|
v4l2_err(&dev->v4l2_dev, "out of memory\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ struct hdpvr_video_info *get_video_info(struct hdpvr_device *dev)
|
||||||
if (hdpvr_debug & MSG_INFO) {
|
if (hdpvr_debug & MSG_INFO) {
|
||||||
hex_dump_to_buffer(dev->usbc_buf, 5, 16, 1, print_buf,
|
hex_dump_to_buffer(dev->usbc_buf, 5, 16, 1, print_buf,
|
||||||
sizeof(print_buf), 0);
|
sizeof(print_buf), 0);
|
||||||
dev_dbg(&dev->udev->dev, "get video info returned: %d, %s\n",
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
ret, print_buf);
|
"get video info returned: %d, %s\n", ret, print_buf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
|
@ -111,9 +111,9 @@ int get_input_lines_info(struct hdpvr_device *dev)
|
||||||
if (hdpvr_debug & MSG_INFO) {
|
if (hdpvr_debug & MSG_INFO) {
|
||||||
hex_dump_to_buffer(dev->usbc_buf, 3, 16, 1, print_buf,
|
hex_dump_to_buffer(dev->usbc_buf, 3, 16, 1, print_buf,
|
||||||
sizeof(print_buf), 0);
|
sizeof(print_buf), 0);
|
||||||
dev_dbg(&dev->udev->dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"get input lines info returned: %d, %s\n", ret,
|
"get input lines info returned: %d, %s\n", ret,
|
||||||
print_buf);
|
print_buf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
lines = dev->usbc_buf[1] << 8 | dev->usbc_buf[0];
|
lines = dev->usbc_buf[1] << 8 | dev->usbc_buf[0];
|
||||||
|
@ -155,8 +155,8 @@ int hdpvr_set_audio(struct hdpvr_device *dev, u8 input,
|
||||||
dev->usbc_buf[1] = 1;
|
dev->usbc_buf[1] = 1;
|
||||||
else {
|
else {
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
dev_err(&dev->udev->dev, "invalid audio codec %d\n",
|
v4l2_err(&dev->v4l2_dev, "invalid audio codec %d\n",
|
||||||
codec);
|
codec);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
size_t buf_size = 46;
|
size_t buf_size = 46;
|
||||||
char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL);
|
char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL);
|
||||||
if (!print_buf) {
|
if (!print_buf) {
|
||||||
dev_err(&dev->udev->dev, "Out of memory");
|
v4l2_err(&dev->v4l2_dev, "Out of memory\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -138,17 +138,17 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
dev->usbc_buf, 46,
|
dev->usbc_buf, 46,
|
||||||
10000);
|
10000);
|
||||||
if (ret != 46) {
|
if (ret != 46) {
|
||||||
dev_err(&dev->udev->dev,
|
v4l2_err(&dev->v4l2_dev,
|
||||||
"unexpected answer of status request, len %d", ret);
|
"unexpected answer of status request, len %d\n", ret);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#ifdef HDPVR_DEBUG
|
#ifdef HDPVR_DEBUG
|
||||||
else {
|
else {
|
||||||
hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf,
|
hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf,
|
||||||
sizeof(print_buf), 0);
|
sizeof(print_buf), 0);
|
||||||
dev_dbg(&dev->udev->dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"Status request returned, len %d: %s\n",
|
"Status request returned, len %d: %s\n",
|
||||||
ret, print_buf);
|
ret, print_buf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION) {
|
if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION) {
|
||||||
|
@ -156,11 +156,11 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
} else if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION_AC3) {
|
} else if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION_AC3) {
|
||||||
dev->flags |= HDPVR_FLAG_AC3_CAP;
|
dev->flags |= HDPVR_FLAG_AC3_CAP;
|
||||||
} else if (dev->usbc_buf[1] > HDPVR_FIRMWARE_VERSION_AC3) {
|
} else if (dev->usbc_buf[1] > HDPVR_FIRMWARE_VERSION_AC3) {
|
||||||
dev_notice(&dev->udev->dev, "untested firmware version 0x%x, "
|
v4l2_info(&dev->v4l2_dev, "untested firmware version 0x%x, "
|
||||||
"the driver might not work\n", dev->usbc_buf[1]);
|
"the driver might not work\n", dev->usbc_buf[1]);
|
||||||
dev->flags |= HDPVR_FLAG_AC3_CAP;
|
dev->flags |= HDPVR_FLAG_AC3_CAP;
|
||||||
} else {
|
} else {
|
||||||
dev_err(&dev->udev->dev, "unknown firmware version 0x%x\n",
|
v4l2_err(&dev->v4l2_dev, "unknown firmware version 0x%x\n",
|
||||||
dev->usbc_buf[1]);
|
dev->usbc_buf[1]);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -169,12 +169,14 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
response = dev->usbc_buf+38;
|
response = dev->usbc_buf+38;
|
||||||
#ifdef HDPVR_DEBUG
|
#ifdef HDPVR_DEBUG
|
||||||
hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0);
|
hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0);
|
||||||
dev_dbg(&dev->udev->dev, "challenge: %s\n", print_buf);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %s\n",
|
||||||
|
print_buf);
|
||||||
#endif
|
#endif
|
||||||
challenge(response);
|
challenge(response);
|
||||||
#ifdef HDPVR_DEBUG
|
#ifdef HDPVR_DEBUG
|
||||||
hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0);
|
hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0);
|
||||||
dev_dbg(&dev->udev->dev, " response: %s\n", print_buf);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n",
|
||||||
|
print_buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
msleep(100);
|
msleep(100);
|
||||||
|
@ -184,7 +186,8 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
0x0000, 0x0000,
|
0x0000, 0x0000,
|
||||||
response, 8,
|
response, 8,
|
||||||
10000);
|
10000);
|
||||||
dev_dbg(&dev->udev->dev, "magic request returned %d\n", ret);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
|
"magic request returned %d\n", ret);
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
|
|
||||||
retval = ret != 8;
|
retval = ret != 8;
|
||||||
|
@ -214,12 +217,13 @@ static int hdpvr_device_init(struct hdpvr_device *dev)
|
||||||
CTRL_LOW_PASS_FILTER_VALUE, CTRL_DEFAULT_INDEX,
|
CTRL_LOW_PASS_FILTER_VALUE, CTRL_DEFAULT_INDEX,
|
||||||
buf, 4,
|
buf, 4,
|
||||||
1000);
|
1000);
|
||||||
dev_dbg(&dev->udev->dev, "control request returned %d\n", ret);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
|
"control request returned %d\n", ret);
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
|
|
||||||
vidinf = get_video_info(dev);
|
vidinf = get_video_info(dev);
|
||||||
if (!vidinf)
|
if (!vidinf)
|
||||||
dev_dbg(&dev->udev->dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"no valid video signal or device init failed\n");
|
"no valid video signal or device init failed\n");
|
||||||
else
|
else
|
||||||
kfree(vidinf);
|
kfree(vidinf);
|
||||||
|
@ -231,7 +235,8 @@ static int hdpvr_device_init(struct hdpvr_device *dev)
|
||||||
usb_sndctrlpipe(dev->udev, 0),
|
usb_sndctrlpipe(dev->udev, 0),
|
||||||
0xd4, 0x38, 0, 0, buf, 1,
|
0xd4, 0x38, 0, 0, buf, 1,
|
||||||
1000);
|
1000);
|
||||||
dev_dbg(&dev->udev->dev, "control request returned %d\n", ret);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
|
"control request returned %d\n", ret);
|
||||||
|
|
||||||
/* boost analog audio */
|
/* boost analog audio */
|
||||||
buf[0] = boost_audio;
|
buf[0] = boost_audio;
|
||||||
|
@ -239,7 +244,8 @@ static int hdpvr_device_init(struct hdpvr_device *dev)
|
||||||
usb_sndctrlpipe(dev->udev, 0),
|
usb_sndctrlpipe(dev->udev, 0),
|
||||||
0xd5, 0x38, 0, 0, buf, 1,
|
0xd5, 0x38, 0, 0, buf, 1,
|
||||||
1000);
|
1000);
|
||||||
dev_dbg(&dev->udev->dev, "control request returned %d\n", ret);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
|
"control request returned %d\n", ret);
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
|
|
||||||
dev->status = STATUS_IDLE;
|
dev->status = STATUS_IDLE;
|
||||||
|
@ -290,7 +296,7 @@ static int hdpvr_probe(struct usb_interface *interface,
|
||||||
mutex_init(&dev->usbc_mutex);
|
mutex_init(&dev->usbc_mutex);
|
||||||
dev->usbc_buf = kmalloc(64, GFP_KERNEL);
|
dev->usbc_buf = kmalloc(64, GFP_KERNEL);
|
||||||
if (!dev->usbc_buf) {
|
if (!dev->usbc_buf) {
|
||||||
dev_err(&dev->udev->dev, "Out of memory");
|
v4l2_err(&dev->v4l2_dev, "Out of memory\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,26 +338,27 @@ static int hdpvr_probe(struct usb_interface *interface,
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!dev->bulk_in_endpointAddr) {
|
if (!dev->bulk_in_endpointAddr) {
|
||||||
err("Could not find bulk-in endpoint");
|
v4l2_err(&dev->v4l2_dev, "Could not find bulk-in endpoint\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init the device */
|
/* init the device */
|
||||||
if (hdpvr_device_init(dev)) {
|
if (hdpvr_device_init(dev)) {
|
||||||
err("device init failed");
|
v4l2_err(&dev->v4l2_dev, "device init failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&dev->io_mutex);
|
mutex_lock(&dev->io_mutex);
|
||||||
if (hdpvr_alloc_buffers(dev, NUM_BUFFERS)) {
|
if (hdpvr_alloc_buffers(dev, NUM_BUFFERS)) {
|
||||||
err("allocating transfer buffers failed");
|
v4l2_err(&dev->v4l2_dev,
|
||||||
|
"allocating transfer buffers failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
mutex_unlock(&dev->io_mutex);
|
mutex_unlock(&dev->io_mutex);
|
||||||
|
|
||||||
if (hdpvr_register_videodev(dev, &interface->dev,
|
if (hdpvr_register_videodev(dev, &interface->dev,
|
||||||
video_nr[atomic_inc_return(&dev_nr)])) {
|
video_nr[atomic_inc_return(&dev_nr)])) {
|
||||||
err("registering videodev failed");
|
v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +366,7 @@ static int hdpvr_probe(struct usb_interface *interface,
|
||||||
/* until i2c is working properly */
|
/* until i2c is working properly */
|
||||||
retval = 0; /* hdpvr_register_i2c_adapter(dev); */
|
retval = 0; /* hdpvr_register_i2c_adapter(dev); */
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
err("registering i2c adapter failed");
|
v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_I2C */
|
#endif /* CONFIG_I2C */
|
||||||
|
@ -368,7 +375,7 @@ static int hdpvr_probe(struct usb_interface *interface,
|
||||||
usb_set_intfdata(interface, dev);
|
usb_set_intfdata(interface, dev);
|
||||||
|
|
||||||
/* let the user know what node this device is now attached to */
|
/* let the user know what node this device is now attached to */
|
||||||
v4l2_info(dev->video_dev, "device now attached to /dev/video%d\n",
|
v4l2_info(&dev->v4l2_dev, "device now attached to /dev/video%d\n",
|
||||||
dev->video_dev->minor);
|
dev->video_dev->minor);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -418,8 +425,7 @@ static void hdpvr_disconnect(struct usb_interface *interface)
|
||||||
|
|
||||||
atomic_dec(&dev_nr);
|
atomic_dec(&dev_nr);
|
||||||
|
|
||||||
printk(KERN_INFO "Hauppauge HD PVR: device /dev/video%d disconnected\n",
|
v4l2_info(&dev->v4l2_dev, "device /dev/video%d disconnected\n", minor);
|
||||||
minor);
|
|
||||||
|
|
||||||
v4l2_device_unregister(&dev->v4l2_dev);
|
v4l2_device_unregister(&dev->v4l2_dev);
|
||||||
kfree(dev->usbc_buf);
|
kfree(dev->usbc_buf);
|
||||||
|
|
|
@ -28,11 +28,12 @@
|
||||||
|
|
||||||
#define BULK_URB_TIMEOUT 1250 /* 1.25 seconds */
|
#define BULK_URB_TIMEOUT 1250 /* 1.25 seconds */
|
||||||
|
|
||||||
#define print_buffer_status() v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev,\
|
#define print_buffer_status() { \
|
||||||
"%s:%d buffer stat: %d free, %d proc\n",\
|
v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, \
|
||||||
__func__, __LINE__, \
|
"%s:%d buffer stat: %d free, %d proc\n", \
|
||||||
list_size(&dev->free_buff_list), \
|
__func__, __LINE__, \
|
||||||
list_size(&dev->rec_buff_list))
|
list_size(&dev->free_buff_list), \
|
||||||
|
list_size(&dev->rec_buff_list)); }
|
||||||
|
|
||||||
struct hdpvr_fh {
|
struct hdpvr_fh {
|
||||||
struct hdpvr_device *dev;
|
struct hdpvr_device *dev;
|
||||||
|
@ -123,21 +124,21 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count)
|
||||||
struct hdpvr_buffer *buf;
|
struct hdpvr_buffer *buf;
|
||||||
struct urb *urb;
|
struct urb *urb;
|
||||||
|
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"allocating %u buffers\n", count);
|
"allocating %u buffers\n", count);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
|
|
||||||
buf = kzalloc(sizeof(struct hdpvr_buffer), GFP_KERNEL);
|
buf = kzalloc(sizeof(struct hdpvr_buffer), GFP_KERNEL);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
err("cannot allocate buffer");
|
v4l2_err(&dev->v4l2_dev, "cannot allocate buffer\n");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
buf->dev = dev;
|
buf->dev = dev;
|
||||||
|
|
||||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
if (!urb) {
|
if (!urb) {
|
||||||
err("cannot allocate urb");
|
v4l2_err(&dev->v4l2_dev, "cannot allocate urb\n");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
buf->urb = urb;
|
buf->urb = urb;
|
||||||
|
@ -145,7 +146,8 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count)
|
||||||
mem = usb_buffer_alloc(dev->udev, dev->bulk_in_size, GFP_KERNEL,
|
mem = usb_buffer_alloc(dev->udev, dev->bulk_in_size, GFP_KERNEL,
|
||||||
&urb->transfer_dma);
|
&urb->transfer_dma);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
err("cannot allocate usb transfer buffer");
|
v4l2_err(&dev->v4l2_dev,
|
||||||
|
"cannot allocate usb transfer buffer\n");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +180,8 @@ static int hdpvr_submit_buffers(struct hdpvr_device *dev)
|
||||||
buf = list_entry(dev->free_buff_list.next, struct hdpvr_buffer,
|
buf = list_entry(dev->free_buff_list.next, struct hdpvr_buffer,
|
||||||
buff_list);
|
buff_list);
|
||||||
if (buf->status != BUFSTAT_AVAILABLE) {
|
if (buf->status != BUFSTAT_AVAILABLE) {
|
||||||
err("buffer not marked as availbale");
|
v4l2_err(&dev->v4l2_dev,
|
||||||
|
"buffer not marked as availbale\n");
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +191,9 @@ static int hdpvr_submit_buffers(struct hdpvr_device *dev)
|
||||||
urb->actual_length = 0;
|
urb->actual_length = 0;
|
||||||
ret = usb_submit_urb(urb, GFP_KERNEL);
|
ret = usb_submit_urb(urb, GFP_KERNEL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
err("usb_submit_urb in %s returned %d", __func__, ret);
|
v4l2_err(&dev->v4l2_dev,
|
||||||
|
"usb_submit_urb in %s returned %d\n",
|
||||||
|
__func__, ret);
|
||||||
if (++err_count > 2)
|
if (++err_count > 2)
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
|
@ -228,7 +233,7 @@ static void hdpvr_transmit_buffers(struct work_struct *work)
|
||||||
while (dev->status == STATUS_STREAMING) {
|
while (dev->status == STATUS_STREAMING) {
|
||||||
|
|
||||||
if (hdpvr_submit_buffers(dev)) {
|
if (hdpvr_submit_buffers(dev)) {
|
||||||
v4l2_err(dev->video_dev, "couldn't submit buffers\n");
|
v4l2_err(&dev->v4l2_dev, "couldn't submit buffers\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (wait_event_interruptible(dev->wait_buffer,
|
if (wait_event_interruptible(dev->wait_buffer,
|
||||||
|
@ -237,11 +242,11 @@ static void hdpvr_transmit_buffers(struct work_struct *work)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"transmit worker exited\n");
|
"transmit worker exited\n");
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"transmit buffers errored\n");
|
"transmit buffers errored\n");
|
||||||
dev->status = STATUS_ERROR;
|
dev->status = STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +265,7 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
|
||||||
vidinf = get_video_info(dev);
|
vidinf = get_video_info(dev);
|
||||||
|
|
||||||
if (vidinf) {
|
if (vidinf) {
|
||||||
v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"video signal: %dx%d@%dhz\n", vidinf->width,
|
"video signal: %dx%d@%dhz\n", vidinf->width,
|
||||||
vidinf->height, vidinf->fps);
|
vidinf->height, vidinf->fps);
|
||||||
kfree(vidinf);
|
kfree(vidinf);
|
||||||
|
@ -269,7 +274,7 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
|
||||||
ret = usb_control_msg(dev->udev,
|
ret = usb_control_msg(dev->udev,
|
||||||
usb_sndctrlpipe(dev->udev, 0),
|
usb_sndctrlpipe(dev->udev, 0),
|
||||||
0xb8, 0x38, 0x1, 0, NULL, 0, 8000);
|
0xb8, 0x38, 0x1, 0, NULL, 0, 8000);
|
||||||
v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"encoder start control request returned %d\n", ret);
|
"encoder start control request returned %d\n", ret);
|
||||||
|
|
||||||
hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00);
|
hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00);
|
||||||
|
@ -277,14 +282,14 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
|
||||||
INIT_WORK(&dev->worker, hdpvr_transmit_buffers);
|
INIT_WORK(&dev->worker, hdpvr_transmit_buffers);
|
||||||
queue_work(dev->workqueue, &dev->worker);
|
queue_work(dev->workqueue, &dev->worker);
|
||||||
|
|
||||||
v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"streaming started\n");
|
"streaming started\n");
|
||||||
dev->status = STATUS_STREAMING;
|
dev->status = STATUS_STREAMING;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
msleep(250);
|
msleep(250);
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"no video signal at input %d\n", dev->options.video_input);
|
"no video signal at input %d\n", dev->options.video_input);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
@ -330,14 +335,14 @@ static int hdpvr_open(struct file *file)
|
||||||
|
|
||||||
dev = (struct hdpvr_device *)video_get_drvdata(video_devdata(file));
|
dev = (struct hdpvr_device *)video_get_drvdata(video_devdata(file));
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
err("open failing with with ENODEV");
|
v4l2_err(&dev->v4l2_dev, "open failing with with ENODEV\n");
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
fh = kzalloc(sizeof(struct hdpvr_fh), GFP_KERNEL);
|
fh = kzalloc(sizeof(struct hdpvr_fh), GFP_KERNEL);
|
||||||
if (!fh) {
|
if (!fh) {
|
||||||
err("Out of memory?");
|
v4l2_err(&dev->v4l2_dev, "Out of memory\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/* lock the device to allow correctly handling errors
|
/* lock the device to allow correctly handling errors
|
||||||
|
@ -396,8 +401,8 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count,
|
||||||
mutex_lock(&dev->io_mutex);
|
mutex_lock(&dev->io_mutex);
|
||||||
if (dev->status == STATUS_IDLE) {
|
if (dev->status == STATUS_IDLE) {
|
||||||
if (hdpvr_start_streaming(dev)) {
|
if (hdpvr_start_streaming(dev)) {
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"start_streaming failed");
|
"start_streaming failed\n");
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
msleep(200);
|
msleep(200);
|
||||||
dev->status = STATUS_IDLE;
|
dev->status = STATUS_IDLE;
|
||||||
|
@ -445,7 +450,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count,
|
||||||
|
|
||||||
if (copy_to_user(buffer, urb->transfer_buffer + buf->pos,
|
if (copy_to_user(buffer, urb->transfer_buffer + buf->pos,
|
||||||
cnt)) {
|
cnt)) {
|
||||||
err("read: copy_to_user failed");
|
v4l2_err(&dev->v4l2_dev, "read: copy_to_user failed\n");
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -493,8 +498,8 @@ static unsigned int hdpvr_poll(struct file *filp, poll_table *wait)
|
||||||
|
|
||||||
if (dev->status == STATUS_IDLE) {
|
if (dev->status == STATUS_IDLE) {
|
||||||
if (hdpvr_start_streaming(dev)) {
|
if (hdpvr_start_streaming(dev)) {
|
||||||
v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"start_streaming failed");
|
"start_streaming failed\n");
|
||||||
dev->status = STATUS_IDLE;
|
dev->status = STATUS_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1130,7 +1135,7 @@ static int vidioc_encoder_cmd(struct file *filp, void *priv,
|
||||||
res = hdpvr_stop_streaming(dev);
|
res = hdpvr_stop_streaming(dev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"Unsupported encoder cmd %d\n", a->cmd);
|
"Unsupported encoder cmd %d\n", a->cmd);
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -1197,7 +1202,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,
|
||||||
/* setup and register video device */
|
/* setup and register video device */
|
||||||
dev->video_dev = video_device_alloc();
|
dev->video_dev = video_device_alloc();
|
||||||
if (!dev->video_dev) {
|
if (!dev->video_dev) {
|
||||||
err("video_device_alloc() failed");
|
v4l2_err(&dev->v4l2_dev, "video_device_alloc() failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1207,7 +1212,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,
|
||||||
video_set_drvdata(dev->video_dev, dev);
|
video_set_drvdata(dev->video_dev, dev);
|
||||||
|
|
||||||
if (video_register_device(dev->video_dev, VFL_TYPE_GRABBER, devnum)) {
|
if (video_register_device(dev->video_dev, VFL_TYPE_GRABBER, devnum)) {
|
||||||
err("V4L2 device registration failed");
|
v4l2_err(&dev->v4l2_dev, "video_device registration failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue