Skip to content

Commit

Permalink
V4L/DVB (11246): hdpvr: convert printing macros to v4l2_* with struct…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Janne Grunau authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 06630ae commit 9ef77ad
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 64 deletions.
22 changes: 11 additions & 11 deletions drivers/media/video/hdpvr/hdpvr-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ int hdpvr_config_call(struct hdpvr_device *dev, uint value, u8 valbuf)
dev->usbc_buf, 1, 10000);

mutex_unlock(&dev->usbc_mutex);
dev_dbg(&dev->udev->dev,
"config call request for value 0x%x returned %d\n", value,
ret);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"config call request for value 0x%x returned %d\n", value,
ret);

return ret < 0 ? ret : 0;
}
Expand All @@ -57,7 +57,7 @@ struct hdpvr_video_info *get_video_info(struct hdpvr_device *dev)

vidinf = kzalloc(sizeof(struct hdpvr_video_info), GFP_KERNEL);
if (!vidinf) {
dev_err(&dev->udev->dev, "out of memory");
v4l2_err(&dev->v4l2_dev, "out of memory\n");
goto err;
}

Expand All @@ -78,8 +78,8 @@ struct hdpvr_video_info *get_video_info(struct hdpvr_device *dev)
if (hdpvr_debug & MSG_INFO) {
hex_dump_to_buffer(dev->usbc_buf, 5, 16, 1, print_buf,
sizeof(print_buf), 0);
dev_dbg(&dev->udev->dev, "get video info returned: %d, %s\n",
ret, print_buf);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"get video info returned: %d, %s\n", ret, print_buf);
}
#endif
mutex_unlock(&dev->usbc_mutex);
Expand Down Expand Up @@ -111,9 +111,9 @@ int get_input_lines_info(struct hdpvr_device *dev)
if (hdpvr_debug & MSG_INFO) {
hex_dump_to_buffer(dev->usbc_buf, 3, 16, 1, print_buf,
sizeof(print_buf), 0);
dev_dbg(&dev->udev->dev,
"get input lines info returned: %d, %s\n", ret,
print_buf);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"get input lines info returned: %d, %s\n", ret,
print_buf);
}
#endif
lines = dev->usbc_buf[1] << 8 | dev->usbc_buf[0];
Expand Down Expand Up @@ -155,8 +155,8 @@ int hdpvr_set_audio(struct hdpvr_device *dev, u8 input,
dev->usbc_buf[1] = 1;
else {
mutex_unlock(&dev->usbc_mutex);
dev_err(&dev->udev->dev, "invalid audio codec %d\n",
codec);
v4l2_err(&dev->v4l2_dev, "invalid audio codec %d\n",
codec);
ret = -EINVAL;
goto error;
}
Expand Down
56 changes: 31 additions & 25 deletions drivers/media/video/hdpvr/hdpvr-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int device_authorization(struct hdpvr_device *dev)
size_t buf_size = 46;
char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL);
if (!print_buf) {
dev_err(&dev->udev->dev, "Out of memory");
v4l2_err(&dev->v4l2_dev, "Out of memory\n");
goto error;
}
#endif
Expand All @@ -138,29 +138,29 @@ static int device_authorization(struct hdpvr_device *dev)
dev->usbc_buf, 46,
10000);
if (ret != 46) {
dev_err(&dev->udev->dev,
"unexpected answer of status request, len %d", ret);
v4l2_err(&dev->v4l2_dev,
"unexpected answer of status request, len %d\n", ret);
goto error;
}
#ifdef HDPVR_DEBUG
else {
hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf,
sizeof(print_buf), 0);
dev_dbg(&dev->udev->dev,
"Status request returned, len %d: %s\n",
ret, print_buf);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"Status request returned, len %d: %s\n",
ret, print_buf);
}
#endif
if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION) {
dev->flags &= ~HDPVR_FLAG_AC3_CAP;
} else if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION_AC3) {
dev->flags |= HDPVR_FLAG_AC3_CAP;
} else if (dev->usbc_buf[1] > HDPVR_FIRMWARE_VERSION_AC3) {
dev_notice(&dev->udev->dev, "untested firmware version 0x%x, "
"the driver might not work\n", dev->usbc_buf[1]);
v4l2_info(&dev->v4l2_dev, "untested firmware version 0x%x, "
"the driver might not work\n", dev->usbc_buf[1]);
dev->flags |= HDPVR_FLAG_AC3_CAP;
} 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]);
ret = -EINVAL;
goto error;
Expand All @@ -169,12 +169,14 @@ static int device_authorization(struct hdpvr_device *dev)
response = dev->usbc_buf+38;
#ifdef HDPVR_DEBUG
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
challenge(response);
#ifdef HDPVR_DEBUG
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

msleep(100);
Expand All @@ -184,7 +186,8 @@ static int device_authorization(struct hdpvr_device *dev)
0x0000, 0x0000,
response, 8,
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);

retval = ret != 8;
Expand Down Expand Up @@ -214,12 +217,13 @@ static int hdpvr_device_init(struct hdpvr_device *dev)
CTRL_LOW_PASS_FILTER_VALUE, CTRL_DEFAULT_INDEX,
buf, 4,
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);

vidinf = get_video_info(dev);
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");
else
kfree(vidinf);
Expand All @@ -231,15 +235,17 @@ static int hdpvr_device_init(struct hdpvr_device *dev)
usb_sndctrlpipe(dev->udev, 0),
0xd4, 0x38, 0, 0, buf, 1,
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 */
buf[0] = boost_audio;
ret = usb_control_msg(dev->udev,
usb_sndctrlpipe(dev->udev, 0),
0xd5, 0x38, 0, 0, buf, 1,
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);

dev->status = STATUS_IDLE;
Expand Down Expand Up @@ -290,7 +296,7 @@ static int hdpvr_probe(struct usb_interface *interface,
mutex_init(&dev->usbc_mutex);
dev->usbc_buf = kmalloc(64, GFP_KERNEL);
if (!dev->usbc_buf) {
dev_err(&dev->udev->dev, "Out of memory");
v4l2_err(&dev->v4l2_dev, "Out of memory\n");
goto error;
}

Expand Down Expand Up @@ -332,34 +338,35 @@ static int hdpvr_probe(struct usb_interface *interface,

}
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;
}

/* init the device */
if (hdpvr_device_init(dev)) {
err("device init failed");
v4l2_err(&dev->v4l2_dev, "device init failed\n");
goto error;
}

mutex_lock(&dev->io_mutex);
if (hdpvr_alloc_buffers(dev, NUM_BUFFERS)) {
err("allocating transfer buffers failed");
v4l2_err(&dev->v4l2_dev,
"allocating transfer buffers failed\n");
goto error;
}
mutex_unlock(&dev->io_mutex);

if (hdpvr_register_videodev(dev, &interface->dev,
video_nr[atomic_inc_return(&dev_nr)])) {
err("registering videodev failed");
v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
goto error;
}

#ifdef CONFIG_I2C
/* until i2c is working properly */
retval = 0; /* hdpvr_register_i2c_adapter(dev); */
if (retval < 0) {
err("registering i2c adapter failed");
v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n");
goto error;
}
#endif /* CONFIG_I2C */
Expand All @@ -368,7 +375,7 @@ static int hdpvr_probe(struct usb_interface *interface,
usb_set_intfdata(interface, dev);

/* 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);
return 0;

Expand Down Expand Up @@ -418,8 +425,7 @@ static void hdpvr_disconnect(struct usb_interface *interface)

atomic_dec(&dev_nr);

printk(KERN_INFO "Hauppauge HD PVR: device /dev/video%d disconnected\n",
minor);
v4l2_info(&dev->v4l2_dev, "device /dev/video%d disconnected\n", minor);

v4l2_device_unregister(&dev->v4l2_dev);
kfree(dev->usbc_buf);
Expand Down
Loading

0 comments on commit 9ef77ad

Please sign in to comment.