mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
[media] hdpvr: reduce memory footprint when debugging
There is no need to use hex_dump_to_buffer() since we have a kernel helper to dump up to 64 bytes just via printk(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
3232e04df7
commit
9380e112f7
2 changed files with 12 additions and 36 deletions
|
@ -59,13 +59,10 @@ int get_video_info(struct hdpvr_device *dev, struct hdpvr_video_info *vidinf)
|
||||||
1000);
|
1000);
|
||||||
|
|
||||||
#ifdef HDPVR_DEBUG
|
#ifdef HDPVR_DEBUG
|
||||||
if (hdpvr_debug & MSG_INFO) {
|
if (hdpvr_debug & MSG_INFO)
|
||||||
char print_buf[15];
|
|
||||||
hex_dump_to_buffer(dev->usbc_buf, 5, 16, 1, print_buf,
|
|
||||||
sizeof(print_buf), 0);
|
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"get video info returned: %d, %s\n", ret, print_buf);
|
"get video info returned: %d, %5ph\n", ret,
|
||||||
}
|
dev->usbc_buf);
|
||||||
#endif
|
#endif
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
|
|
||||||
|
@ -82,9 +79,6 @@ int get_video_info(struct hdpvr_device *dev, struct hdpvr_video_info *vidinf)
|
||||||
|
|
||||||
int get_input_lines_info(struct hdpvr_device *dev)
|
int get_input_lines_info(struct hdpvr_device *dev)
|
||||||
{
|
{
|
||||||
#ifdef HDPVR_DEBUG
|
|
||||||
char print_buf[9];
|
|
||||||
#endif
|
|
||||||
int ret, lines;
|
int ret, lines;
|
||||||
|
|
||||||
mutex_lock(&dev->usbc_mutex);
|
mutex_lock(&dev->usbc_mutex);
|
||||||
|
@ -96,13 +90,10 @@ int get_input_lines_info(struct hdpvr_device *dev)
|
||||||
1000);
|
1000);
|
||||||
|
|
||||||
#ifdef HDPVR_DEBUG
|
#ifdef HDPVR_DEBUG
|
||||||
if (hdpvr_debug & MSG_INFO) {
|
if (hdpvr_debug & MSG_INFO)
|
||||||
hex_dump_to_buffer(dev->usbc_buf, 3, 16, 1, print_buf,
|
|
||||||
sizeof(print_buf), 0);
|
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_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, %3ph\n", ret,
|
||||||
print_buf);
|
dev->usbc_buf);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
(void)ret; /* suppress compiler warning */
|
(void)ret; /* suppress compiler warning */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -124,14 +124,6 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
int ret, retval = -ENOMEM;
|
int ret, retval = -ENOMEM;
|
||||||
char request_type = 0x38, rcv_request = 0x81;
|
char request_type = 0x38, rcv_request = 0x81;
|
||||||
char *response;
|
char *response;
|
||||||
#ifdef HDPVR_DEBUG
|
|
||||||
size_t buf_size = 46;
|
|
||||||
char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL);
|
|
||||||
if (!print_buf) {
|
|
||||||
v4l2_err(&dev->v4l2_dev, "Out of memory\n");
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mutex_lock(&dev->usbc_mutex);
|
mutex_lock(&dev->usbc_mutex);
|
||||||
ret = usb_control_msg(dev->udev,
|
ret = usb_control_msg(dev->udev,
|
||||||
|
@ -147,11 +139,9 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
}
|
}
|
||||||
#ifdef HDPVR_DEBUG
|
#ifdef HDPVR_DEBUG
|
||||||
else {
|
else {
|
||||||
hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf,
|
|
||||||
5*buf_size+1, 0);
|
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
|
||||||
"Status request returned, len %d: %s\n",
|
"Status request returned, len %d: %46ph\n",
|
||||||
ret, print_buf);
|
ret, dev->usbc_buf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -189,15 +179,13 @@ 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, 5*buf_size+1, 0);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %8ph\n",
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %s\n",
|
response);
|
||||||
print_buf);
|
|
||||||
#endif
|
#endif
|
||||||
challenge(response);
|
challenge(response);
|
||||||
#ifdef HDPVR_DEBUG
|
#ifdef HDPVR_DEBUG
|
||||||
hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0);
|
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %8ph\n",
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n",
|
response);
|
||||||
print_buf);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
msleep(100);
|
msleep(100);
|
||||||
|
@ -213,9 +201,6 @@ static int device_authorization(struct hdpvr_device *dev)
|
||||||
retval = ret != 8;
|
retval = ret != 8;
|
||||||
unlock:
|
unlock:
|
||||||
mutex_unlock(&dev->usbc_mutex);
|
mutex_unlock(&dev->usbc_mutex);
|
||||||
#ifdef HDPVR_DEBUG
|
|
||||||
kfree(print_buf);
|
|
||||||
#endif
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue