diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2014-09-04 09:04:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-23 15:13:36 -0400 |
commit | 9380e112f7b9ab83b57062f2164476e76c5533c7 (patch) | |
tree | 0e14860038f4fe84fc6a9f4a26fd37cecef1f24d /drivers/media/usb | |
parent | 3232e04df7224f31a31cfe927096f3d03ba743ab (diff) |
[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>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/hdpvr/hdpvr-control.c | 21 | ||||
-rw-r--r-- | drivers/media/usb/hdpvr/hdpvr-core.c | 27 |
2 files changed, 12 insertions, 36 deletions
diff --git a/drivers/media/usb/hdpvr/hdpvr-control.c b/drivers/media/usb/hdpvr/hdpvr-control.c index 6053661dc04b..6e86032ea5db 100644 --- a/drivers/media/usb/hdpvr/hdpvr-control.c +++ b/drivers/media/usb/hdpvr/hdpvr-control.c | |||
@@ -59,13 +59,10 @@ int get_video_info(struct hdpvr_device *dev, struct hdpvr_video_info *vidinf) | |||
59 | 1000); | 59 | 1000); |
60 | 60 | ||
61 | #ifdef HDPVR_DEBUG | 61 | #ifdef HDPVR_DEBUG |
62 | if (hdpvr_debug & MSG_INFO) { | 62 | if (hdpvr_debug & MSG_INFO) |
63 | char print_buf[15]; | ||
64 | hex_dump_to_buffer(dev->usbc_buf, 5, 16, 1, print_buf, | ||
65 | sizeof(print_buf), 0); | ||
66 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, | 63 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
67 | "get video info returned: %d, %s\n", ret, print_buf); | 64 | "get video info returned: %d, %5ph\n", ret, |
68 | } | 65 | dev->usbc_buf); |
69 | #endif | 66 | #endif |
70 | mutex_unlock(&dev->usbc_mutex); | 67 | mutex_unlock(&dev->usbc_mutex); |
71 | 68 | ||
@@ -82,9 +79,6 @@ int get_video_info(struct hdpvr_device *dev, struct hdpvr_video_info *vidinf) | |||
82 | 79 | ||
83 | int get_input_lines_info(struct hdpvr_device *dev) | 80 | int get_input_lines_info(struct hdpvr_device *dev) |
84 | { | 81 | { |
85 | #ifdef HDPVR_DEBUG | ||
86 | char print_buf[9]; | ||
87 | #endif | ||
88 | int ret, lines; | 82 | int ret, lines; |
89 | 83 | ||
90 | mutex_lock(&dev->usbc_mutex); | 84 | mutex_lock(&dev->usbc_mutex); |
@@ -96,13 +90,10 @@ int get_input_lines_info(struct hdpvr_device *dev) | |||
96 | 1000); | 90 | 1000); |
97 | 91 | ||
98 | #ifdef HDPVR_DEBUG | 92 | #ifdef HDPVR_DEBUG |
99 | if (hdpvr_debug & MSG_INFO) { | 93 | if (hdpvr_debug & MSG_INFO) |
100 | hex_dump_to_buffer(dev->usbc_buf, 3, 16, 1, print_buf, | ||
101 | sizeof(print_buf), 0); | ||
102 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, | 94 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
103 | "get input lines info returned: %d, %s\n", ret, | 95 | "get input lines info returned: %d, %3ph\n", ret, |
104 | print_buf); | 96 | dev->usbc_buf); |
105 | } | ||
106 | #else | 97 | #else |
107 | (void)ret; /* suppress compiler warning */ | 98 | (void)ret; /* suppress compiler warning */ |
108 | #endif | 99 | #endif |
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index c5638964c3f2..42b4cdf28cfd 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c | |||
@@ -124,14 +124,6 @@ static int device_authorization(struct hdpvr_device *dev) | |||
124 | int ret, retval = -ENOMEM; | 124 | int ret, retval = -ENOMEM; |
125 | char request_type = 0x38, rcv_request = 0x81; | 125 | char request_type = 0x38, rcv_request = 0x81; |
126 | char *response; | 126 | char *response; |
127 | #ifdef HDPVR_DEBUG | ||
128 | size_t buf_size = 46; | ||
129 | char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL); | ||
130 | if (!print_buf) { | ||
131 | v4l2_err(&dev->v4l2_dev, "Out of memory\n"); | ||
132 | return retval; | ||
133 | } | ||
134 | #endif | ||
135 | 127 | ||
136 | mutex_lock(&dev->usbc_mutex); | 128 | mutex_lock(&dev->usbc_mutex); |
137 | ret = usb_control_msg(dev->udev, | 129 | ret = usb_control_msg(dev->udev, |
@@ -147,11 +139,9 @@ static int device_authorization(struct hdpvr_device *dev) | |||
147 | } | 139 | } |
148 | #ifdef HDPVR_DEBUG | 140 | #ifdef HDPVR_DEBUG |
149 | else { | 141 | else { |
150 | hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf, | ||
151 | 5*buf_size+1, 0); | ||
152 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, | 142 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
153 | "Status request returned, len %d: %s\n", | 143 | "Status request returned, len %d: %46ph\n", |
154 | ret, print_buf); | 144 | ret, dev->usbc_buf); |
155 | } | 145 | } |
156 | #endif | 146 | #endif |
157 | 147 | ||
@@ -189,15 +179,13 @@ static int device_authorization(struct hdpvr_device *dev) | |||
189 | 179 | ||
190 | response = dev->usbc_buf+38; | 180 | response = dev->usbc_buf+38; |
191 | #ifdef HDPVR_DEBUG | 181 | #ifdef HDPVR_DEBUG |
192 | hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0); | 182 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %8ph\n", |
193 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %s\n", | 183 | response); |
194 | print_buf); | ||
195 | #endif | 184 | #endif |
196 | challenge(response); | 185 | challenge(response); |
197 | #ifdef HDPVR_DEBUG | 186 | #ifdef HDPVR_DEBUG |
198 | hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0); | 187 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %8ph\n", |
199 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n", | 188 | response); |
200 | print_buf); | ||
201 | #endif | 189 | #endif |
202 | 190 | ||
203 | msleep(100); | 191 | msleep(100); |
@@ -213,9 +201,6 @@ static int device_authorization(struct hdpvr_device *dev) | |||
213 | retval = ret != 8; | 201 | retval = ret != 8; |
214 | unlock: | 202 | unlock: |
215 | mutex_unlock(&dev->usbc_mutex); | 203 | mutex_unlock(&dev->usbc_mutex); |
216 | #ifdef HDPVR_DEBUG | ||
217 | kfree(print_buf); | ||
218 | #endif | ||
219 | return retval; | 204 | return retval; |
220 | } | 205 | } |
221 | 206 | ||