diff options
author | Janne Grunau <j@jannau.net> | 2009-03-27 19:09:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:43 -0400 |
commit | 9ef77adfb9ac170bcaf449530cf129c48547fd55 (patch) | |
tree | 686d2a00fb7e12d5416bf0327f3999612376451d | |
parent | 06630aec92d6a71658ac1538e2a65af5cfc5f2af (diff) |
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>
-rw-r--r-- | drivers/media/video/hdpvr/hdpvr-control.c | 22 | ||||
-rw-r--r-- | drivers/media/video/hdpvr/hdpvr-core.c | 56 | ||||
-rw-r--r-- | drivers/media/video/hdpvr/hdpvr-video.c | 61 |
3 files changed, 75 insertions, 64 deletions
diff --git a/drivers/media/video/hdpvr/hdpvr-control.c b/drivers/media/video/hdpvr/hdpvr-control.c index 51de74aebfcb..06791749d1a0 100644 --- a/drivers/media/video/hdpvr/hdpvr-control.c +++ b/drivers/media/video/hdpvr/hdpvr-control.c | |||
@@ -40,9 +40,9 @@ int hdpvr_config_call(struct hdpvr_device *dev, uint value, u8 valbuf) | |||
40 | dev->usbc_buf, 1, 10000); | 40 | dev->usbc_buf, 1, 10000); |
41 | 41 | ||
42 | mutex_unlock(&dev->usbc_mutex); | 42 | mutex_unlock(&dev->usbc_mutex); |
43 | dev_dbg(&dev->udev->dev, | 43 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
44 | "config call request for value 0x%x returned %d\n", value, | 44 | "config call request for value 0x%x returned %d\n", value, |
45 | ret); | 45 | ret); |
46 | 46 | ||
47 | return ret < 0 ? ret : 0; | 47 | return ret < 0 ? ret : 0; |
48 | } | 48 | } |
@@ -57,7 +57,7 @@ struct hdpvr_video_info *get_video_info(struct hdpvr_device *dev) | |||
57 | 57 | ||
58 | vidinf = kzalloc(sizeof(struct hdpvr_video_info), GFP_KERNEL); | 58 | vidinf = kzalloc(sizeof(struct hdpvr_video_info), GFP_KERNEL); |
59 | if (!vidinf) { | 59 | if (!vidinf) { |
60 | dev_err(&dev->udev->dev, "out of memory"); | 60 | v4l2_err(&dev->v4l2_dev, "out of memory\n"); |
61 | goto err; | 61 | goto err; |
62 | } | 62 | } |
63 | 63 | ||
@@ -78,8 +78,8 @@ struct hdpvr_video_info *get_video_info(struct hdpvr_device *dev) | |||
78 | if (hdpvr_debug & MSG_INFO) { | 78 | if (hdpvr_debug & MSG_INFO) { |
79 | hex_dump_to_buffer(dev->usbc_buf, 5, 16, 1, print_buf, | 79 | hex_dump_to_buffer(dev->usbc_buf, 5, 16, 1, print_buf, |
80 | sizeof(print_buf), 0); | 80 | sizeof(print_buf), 0); |
81 | dev_dbg(&dev->udev->dev, "get video info returned: %d, %s\n", | 81 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
82 | ret, print_buf); | 82 | "get video info returned: %d, %s\n", ret, print_buf); |
83 | } | 83 | } |
84 | #endif | 84 | #endif |
85 | mutex_unlock(&dev->usbc_mutex); | 85 | mutex_unlock(&dev->usbc_mutex); |
@@ -111,9 +111,9 @@ int get_input_lines_info(struct hdpvr_device *dev) | |||
111 | if (hdpvr_debug & MSG_INFO) { | 111 | if (hdpvr_debug & MSG_INFO) { |
112 | hex_dump_to_buffer(dev->usbc_buf, 3, 16, 1, print_buf, | 112 | hex_dump_to_buffer(dev->usbc_buf, 3, 16, 1, print_buf, |
113 | sizeof(print_buf), 0); | 113 | sizeof(print_buf), 0); |
114 | dev_dbg(&dev->udev->dev, | 114 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
115 | "get input lines info returned: %d, %s\n", ret, | 115 | "get input lines info returned: %d, %s\n", ret, |
116 | print_buf); | 116 | print_buf); |
117 | } | 117 | } |
118 | #endif | 118 | #endif |
119 | lines = dev->usbc_buf[1] << 8 | dev->usbc_buf[0]; | 119 | lines = dev->usbc_buf[1] << 8 | dev->usbc_buf[0]; |
@@ -155,8 +155,8 @@ int hdpvr_set_audio(struct hdpvr_device *dev, u8 input, | |||
155 | dev->usbc_buf[1] = 1; | 155 | dev->usbc_buf[1] = 1; |
156 | else { | 156 | else { |
157 | mutex_unlock(&dev->usbc_mutex); | 157 | mutex_unlock(&dev->usbc_mutex); |
158 | dev_err(&dev->udev->dev, "invalid audio codec %d\n", | 158 | v4l2_err(&dev->v4l2_dev, "invalid audio codec %d\n", |
159 | codec); | 159 | codec); |
160 | ret = -EINVAL; | 160 | ret = -EINVAL; |
161 | goto error; | 161 | goto error; |
162 | } | 162 | } |
diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c index 3b19a259dc4e..188bd5aea258 100644 --- a/drivers/media/video/hdpvr/hdpvr-core.c +++ b/drivers/media/video/hdpvr/hdpvr-core.c | |||
@@ -125,7 +125,7 @@ static int device_authorization(struct hdpvr_device *dev) | |||
125 | size_t buf_size = 46; | 125 | size_t buf_size = 46; |
126 | char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL); | 126 | char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL); |
127 | if (!print_buf) { | 127 | if (!print_buf) { |
128 | dev_err(&dev->udev->dev, "Out of memory"); | 128 | v4l2_err(&dev->v4l2_dev, "Out of memory\n"); |
129 | goto error; | 129 | goto error; |
130 | } | 130 | } |
131 | #endif | 131 | #endif |
@@ -138,17 +138,17 @@ static int device_authorization(struct hdpvr_device *dev) | |||
138 | dev->usbc_buf, 46, | 138 | dev->usbc_buf, 46, |
139 | 10000); | 139 | 10000); |
140 | if (ret != 46) { | 140 | if (ret != 46) { |
141 | dev_err(&dev->udev->dev, | 141 | v4l2_err(&dev->v4l2_dev, |
142 | "unexpected answer of status request, len %d", ret); | 142 | "unexpected answer of status request, len %d\n", ret); |
143 | goto error; | 143 | goto error; |
144 | } | 144 | } |
145 | #ifdef HDPVR_DEBUG | 145 | #ifdef HDPVR_DEBUG |
146 | else { | 146 | else { |
147 | hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf, | 147 | hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf, |
148 | sizeof(print_buf), 0); | 148 | sizeof(print_buf), 0); |
149 | dev_dbg(&dev->udev->dev, | 149 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
150 | "Status request returned, len %d: %s\n", | 150 | "Status request returned, len %d: %s\n", |
151 | ret, print_buf); | 151 | ret, print_buf); |
152 | } | 152 | } |
153 | #endif | 153 | #endif |
154 | if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION) { | 154 | if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION) { |
@@ -156,11 +156,11 @@ static int device_authorization(struct hdpvr_device *dev) | |||
156 | } else if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION_AC3) { | 156 | } else if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION_AC3) { |
157 | dev->flags |= HDPVR_FLAG_AC3_CAP; | 157 | dev->flags |= HDPVR_FLAG_AC3_CAP; |
158 | } else if (dev->usbc_buf[1] > HDPVR_FIRMWARE_VERSION_AC3) { | 158 | } else if (dev->usbc_buf[1] > HDPVR_FIRMWARE_VERSION_AC3) { |
159 | dev_notice(&dev->udev->dev, "untested firmware version 0x%x, " | 159 | v4l2_info(&dev->v4l2_dev, "untested firmware version 0x%x, " |
160 | "the driver might not work\n", dev->usbc_buf[1]); | 160 | "the driver might not work\n", dev->usbc_buf[1]); |
161 | dev->flags |= HDPVR_FLAG_AC3_CAP; | 161 | dev->flags |= HDPVR_FLAG_AC3_CAP; |
162 | } else { | 162 | } else { |
163 | dev_err(&dev->udev->dev, "unknown firmware version 0x%x\n", | 163 | v4l2_err(&dev->v4l2_dev, "unknown firmware version 0x%x\n", |
164 | dev->usbc_buf[1]); | 164 | dev->usbc_buf[1]); |
165 | ret = -EINVAL; | 165 | ret = -EINVAL; |
166 | goto error; | 166 | goto error; |
@@ -169,12 +169,14 @@ static int device_authorization(struct hdpvr_device *dev) | |||
169 | response = dev->usbc_buf+38; | 169 | response = dev->usbc_buf+38; |
170 | #ifdef HDPVR_DEBUG | 170 | #ifdef HDPVR_DEBUG |
171 | hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); | 171 | hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); |
172 | dev_dbg(&dev->udev->dev, "challenge: %s\n", print_buf); | 172 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %s\n", |
173 | print_buf); | ||
173 | #endif | 174 | #endif |
174 | challenge(response); | 175 | challenge(response); |
175 | #ifdef HDPVR_DEBUG | 176 | #ifdef HDPVR_DEBUG |
176 | hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); | 177 | hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); |
177 | dev_dbg(&dev->udev->dev, " response: %s\n", print_buf); | 178 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n", |
179 | print_buf); | ||
178 | #endif | 180 | #endif |
179 | 181 | ||
180 | msleep(100); | 182 | msleep(100); |
@@ -184,7 +186,8 @@ static int device_authorization(struct hdpvr_device *dev) | |||
184 | 0x0000, 0x0000, | 186 | 0x0000, 0x0000, |
185 | response, 8, | 187 | response, 8, |
186 | 10000); | 188 | 10000); |
187 | dev_dbg(&dev->udev->dev, "magic request returned %d\n", ret); | 189 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
190 | "magic request returned %d\n", ret); | ||
188 | mutex_unlock(&dev->usbc_mutex); | 191 | mutex_unlock(&dev->usbc_mutex); |
189 | 192 | ||
190 | retval = ret != 8; | 193 | retval = ret != 8; |
@@ -214,12 +217,13 @@ static int hdpvr_device_init(struct hdpvr_device *dev) | |||
214 | CTRL_LOW_PASS_FILTER_VALUE, CTRL_DEFAULT_INDEX, | 217 | CTRL_LOW_PASS_FILTER_VALUE, CTRL_DEFAULT_INDEX, |
215 | buf, 4, | 218 | buf, 4, |
216 | 1000); | 219 | 1000); |
217 | dev_dbg(&dev->udev->dev, "control request returned %d\n", ret); | 220 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
221 | "control request returned %d\n", ret); | ||
218 | mutex_unlock(&dev->usbc_mutex); | 222 | mutex_unlock(&dev->usbc_mutex); |
219 | 223 | ||
220 | vidinf = get_video_info(dev); | 224 | vidinf = get_video_info(dev); |
221 | if (!vidinf) | 225 | if (!vidinf) |
222 | dev_dbg(&dev->udev->dev, | 226 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
223 | "no valid video signal or device init failed\n"); | 227 | "no valid video signal or device init failed\n"); |
224 | else | 228 | else |
225 | kfree(vidinf); | 229 | kfree(vidinf); |
@@ -231,7 +235,8 @@ static int hdpvr_device_init(struct hdpvr_device *dev) | |||
231 | usb_sndctrlpipe(dev->udev, 0), | 235 | usb_sndctrlpipe(dev->udev, 0), |
232 | 0xd4, 0x38, 0, 0, buf, 1, | 236 | 0xd4, 0x38, 0, 0, buf, 1, |
233 | 1000); | 237 | 1000); |
234 | dev_dbg(&dev->udev->dev, "control request returned %d\n", ret); | 238 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
239 | "control request returned %d\n", ret); | ||
235 | 240 | ||
236 | /* boost analog audio */ | 241 | /* boost analog audio */ |
237 | buf[0] = boost_audio; | 242 | buf[0] = boost_audio; |
@@ -239,7 +244,8 @@ static int hdpvr_device_init(struct hdpvr_device *dev) | |||
239 | usb_sndctrlpipe(dev->udev, 0), | 244 | usb_sndctrlpipe(dev->udev, 0), |
240 | 0xd5, 0x38, 0, 0, buf, 1, | 245 | 0xd5, 0x38, 0, 0, buf, 1, |
241 | 1000); | 246 | 1000); |
242 | dev_dbg(&dev->udev->dev, "control request returned %d\n", ret); | 247 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
248 | "control request returned %d\n", ret); | ||
243 | mutex_unlock(&dev->usbc_mutex); | 249 | mutex_unlock(&dev->usbc_mutex); |
244 | 250 | ||
245 | dev->status = STATUS_IDLE; | 251 | dev->status = STATUS_IDLE; |
@@ -290,7 +296,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
290 | mutex_init(&dev->usbc_mutex); | 296 | mutex_init(&dev->usbc_mutex); |
291 | dev->usbc_buf = kmalloc(64, GFP_KERNEL); | 297 | dev->usbc_buf = kmalloc(64, GFP_KERNEL); |
292 | if (!dev->usbc_buf) { | 298 | if (!dev->usbc_buf) { |
293 | dev_err(&dev->udev->dev, "Out of memory"); | 299 | v4l2_err(&dev->v4l2_dev, "Out of memory\n"); |
294 | goto error; | 300 | goto error; |
295 | } | 301 | } |
296 | 302 | ||
@@ -332,26 +338,27 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
332 | 338 | ||
333 | } | 339 | } |
334 | if (!dev->bulk_in_endpointAddr) { | 340 | if (!dev->bulk_in_endpointAddr) { |
335 | err("Could not find bulk-in endpoint"); | 341 | v4l2_err(&dev->v4l2_dev, "Could not find bulk-in endpoint\n"); |
336 | goto error; | 342 | goto error; |
337 | } | 343 | } |
338 | 344 | ||
339 | /* init the device */ | 345 | /* init the device */ |
340 | if (hdpvr_device_init(dev)) { | 346 | if (hdpvr_device_init(dev)) { |
341 | err("device init failed"); | 347 | v4l2_err(&dev->v4l2_dev, "device init failed\n"); |
342 | goto error; | 348 | goto error; |
343 | } | 349 | } |
344 | 350 | ||
345 | mutex_lock(&dev->io_mutex); | 351 | mutex_lock(&dev->io_mutex); |
346 | if (hdpvr_alloc_buffers(dev, NUM_BUFFERS)) { | 352 | if (hdpvr_alloc_buffers(dev, NUM_BUFFERS)) { |
347 | err("allocating transfer buffers failed"); | 353 | v4l2_err(&dev->v4l2_dev, |
354 | "allocating transfer buffers failed\n"); | ||
348 | goto error; | 355 | goto error; |
349 | } | 356 | } |
350 | mutex_unlock(&dev->io_mutex); | 357 | mutex_unlock(&dev->io_mutex); |
351 | 358 | ||
352 | if (hdpvr_register_videodev(dev, &interface->dev, | 359 | if (hdpvr_register_videodev(dev, &interface->dev, |
353 | video_nr[atomic_inc_return(&dev_nr)])) { | 360 | video_nr[atomic_inc_return(&dev_nr)])) { |
354 | err("registering videodev failed"); | 361 | v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); |
355 | goto error; | 362 | goto error; |
356 | } | 363 | } |
357 | 364 | ||
@@ -359,7 +366,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
359 | /* until i2c is working properly */ | 366 | /* until i2c is working properly */ |
360 | retval = 0; /* hdpvr_register_i2c_adapter(dev); */ | 367 | retval = 0; /* hdpvr_register_i2c_adapter(dev); */ |
361 | if (retval < 0) { | 368 | if (retval < 0) { |
362 | err("registering i2c adapter failed"); | 369 | v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n"); |
363 | goto error; | 370 | goto error; |
364 | } | 371 | } |
365 | #endif /* CONFIG_I2C */ | 372 | #endif /* CONFIG_I2C */ |
@@ -368,7 +375,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
368 | usb_set_intfdata(interface, dev); | 375 | usb_set_intfdata(interface, dev); |
369 | 376 | ||
370 | /* let the user know what node this device is now attached to */ | 377 | /* let the user know what node this device is now attached to */ |
371 | v4l2_info(dev->video_dev, "device now attached to /dev/video%d\n", | 378 | v4l2_info(&dev->v4l2_dev, "device now attached to /dev/video%d\n", |
372 | dev->video_dev->minor); | 379 | dev->video_dev->minor); |
373 | return 0; | 380 | return 0; |
374 | 381 | ||
@@ -418,8 +425,7 @@ static void hdpvr_disconnect(struct usb_interface *interface) | |||
418 | 425 | ||
419 | atomic_dec(&dev_nr); | 426 | atomic_dec(&dev_nr); |
420 | 427 | ||
421 | printk(KERN_INFO "Hauppauge HD PVR: device /dev/video%d disconnected\n", | 428 | v4l2_info(&dev->v4l2_dev, "device /dev/video%d disconnected\n", minor); |
422 | minor); | ||
423 | 429 | ||
424 | v4l2_device_unregister(&dev->v4l2_dev); | 430 | v4l2_device_unregister(&dev->v4l2_dev); |
425 | kfree(dev->usbc_buf); | 431 | kfree(dev->usbc_buf); |
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index 2fe57303c0b5..f6e1bcefddb7 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c | |||
@@ -28,11 +28,12 @@ | |||
28 | 28 | ||
29 | #define BULK_URB_TIMEOUT 1250 /* 1.25 seconds */ | 29 | #define BULK_URB_TIMEOUT 1250 /* 1.25 seconds */ |
30 | 30 | ||
31 | #define print_buffer_status() v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev,\ | 31 | #define print_buffer_status() { \ |
32 | "%s:%d buffer stat: %d free, %d proc\n",\ | 32 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, \ |
33 | __func__, __LINE__, \ | 33 | "%s:%d buffer stat: %d free, %d proc\n", \ |
34 | list_size(&dev->free_buff_list), \ | 34 | __func__, __LINE__, \ |
35 | list_size(&dev->rec_buff_list)) | 35 | list_size(&dev->free_buff_list), \ |
36 | list_size(&dev->rec_buff_list)); } | ||
36 | 37 | ||
37 | struct hdpvr_fh { | 38 | struct hdpvr_fh { |
38 | struct hdpvr_device *dev; | 39 | struct hdpvr_device *dev; |
@@ -123,21 +124,21 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) | |||
123 | struct hdpvr_buffer *buf; | 124 | struct hdpvr_buffer *buf; |
124 | struct urb *urb; | 125 | struct urb *urb; |
125 | 126 | ||
126 | v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, | 127 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
127 | "allocating %u buffers\n", count); | 128 | "allocating %u buffers\n", count); |
128 | 129 | ||
129 | for (i = 0; i < count; i++) { | 130 | for (i = 0; i < count; i++) { |
130 | 131 | ||
131 | buf = kzalloc(sizeof(struct hdpvr_buffer), GFP_KERNEL); | 132 | buf = kzalloc(sizeof(struct hdpvr_buffer), GFP_KERNEL); |
132 | if (!buf) { | 133 | if (!buf) { |
133 | err("cannot allocate buffer"); | 134 | v4l2_err(&dev->v4l2_dev, "cannot allocate buffer\n"); |
134 | goto exit; | 135 | goto exit; |
135 | } | 136 | } |
136 | buf->dev = dev; | 137 | buf->dev = dev; |
137 | 138 | ||
138 | urb = usb_alloc_urb(0, GFP_KERNEL); | 139 | urb = usb_alloc_urb(0, GFP_KERNEL); |
139 | if (!urb) { | 140 | if (!urb) { |
140 | err("cannot allocate urb"); | 141 | v4l2_err(&dev->v4l2_dev, "cannot allocate urb\n"); |
141 | goto exit; | 142 | goto exit; |
142 | } | 143 | } |
143 | buf->urb = urb; | 144 | buf->urb = urb; |
@@ -145,7 +146,8 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) | |||
145 | mem = usb_buffer_alloc(dev->udev, dev->bulk_in_size, GFP_KERNEL, | 146 | mem = usb_buffer_alloc(dev->udev, dev->bulk_in_size, GFP_KERNEL, |
146 | &urb->transfer_dma); | 147 | &urb->transfer_dma); |
147 | if (!mem) { | 148 | if (!mem) { |
148 | err("cannot allocate usb transfer buffer"); | 149 | v4l2_err(&dev->v4l2_dev, |
150 | "cannot allocate usb transfer buffer\n"); | ||
149 | goto exit; | 151 | goto exit; |
150 | } | 152 | } |
151 | 153 | ||
@@ -178,7 +180,8 @@ static int hdpvr_submit_buffers(struct hdpvr_device *dev) | |||
178 | buf = list_entry(dev->free_buff_list.next, struct hdpvr_buffer, | 180 | buf = list_entry(dev->free_buff_list.next, struct hdpvr_buffer, |
179 | buff_list); | 181 | buff_list); |
180 | if (buf->status != BUFSTAT_AVAILABLE) { | 182 | if (buf->status != BUFSTAT_AVAILABLE) { |
181 | err("buffer not marked as availbale"); | 183 | v4l2_err(&dev->v4l2_dev, |
184 | "buffer not marked as availbale\n"); | ||
182 | ret = -EFAULT; | 185 | ret = -EFAULT; |
183 | goto err; | 186 | goto err; |
184 | } | 187 | } |
@@ -188,7 +191,9 @@ static int hdpvr_submit_buffers(struct hdpvr_device *dev) | |||
188 | urb->actual_length = 0; | 191 | urb->actual_length = 0; |
189 | ret = usb_submit_urb(urb, GFP_KERNEL); | 192 | ret = usb_submit_urb(urb, GFP_KERNEL); |
190 | if (ret) { | 193 | if (ret) { |
191 | err("usb_submit_urb in %s returned %d", __func__, ret); | 194 | v4l2_err(&dev->v4l2_dev, |
195 | "usb_submit_urb in %s returned %d\n", | ||
196 | __func__, ret); | ||
192 | if (++err_count > 2) | 197 | if (++err_count > 2) |
193 | break; | 198 | break; |
194 | continue; | 199 | continue; |
@@ -228,7 +233,7 @@ static void hdpvr_transmit_buffers(struct work_struct *work) | |||
228 | while (dev->status == STATUS_STREAMING) { | 233 | while (dev->status == STATUS_STREAMING) { |
229 | 234 | ||
230 | if (hdpvr_submit_buffers(dev)) { | 235 | if (hdpvr_submit_buffers(dev)) { |
231 | v4l2_err(dev->video_dev, "couldn't submit buffers\n"); | 236 | v4l2_err(&dev->v4l2_dev, "couldn't submit buffers\n"); |
232 | goto error; | 237 | goto error; |
233 | } | 238 | } |
234 | if (wait_event_interruptible(dev->wait_buffer, | 239 | if (wait_event_interruptible(dev->wait_buffer, |
@@ -237,11 +242,11 @@ static void hdpvr_transmit_buffers(struct work_struct *work) | |||
237 | goto error; | 242 | goto error; |
238 | } | 243 | } |
239 | 244 | ||
240 | v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, | 245 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
241 | "transmit worker exited\n"); | 246 | "transmit worker exited\n"); |
242 | return; | 247 | return; |
243 | error: | 248 | error: |
244 | v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, | 249 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
245 | "transmit buffers errored\n"); | 250 | "transmit buffers errored\n"); |
246 | dev->status = STATUS_ERROR; | 251 | dev->status = STATUS_ERROR; |
247 | } | 252 | } |
@@ -260,7 +265,7 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) | |||
260 | vidinf = get_video_info(dev); | 265 | vidinf = get_video_info(dev); |
261 | 266 | ||
262 | if (vidinf) { | 267 | if (vidinf) { |
263 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev, | 268 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, |
264 | "video signal: %dx%d@%dhz\n", vidinf->width, | 269 | "video signal: %dx%d@%dhz\n", vidinf->width, |
265 | vidinf->height, vidinf->fps); | 270 | vidinf->height, vidinf->fps); |
266 | kfree(vidinf); | 271 | kfree(vidinf); |
@@ -269,7 +274,7 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) | |||
269 | ret = usb_control_msg(dev->udev, | 274 | ret = usb_control_msg(dev->udev, |
270 | usb_sndctrlpipe(dev->udev, 0), | 275 | usb_sndctrlpipe(dev->udev, 0), |
271 | 0xb8, 0x38, 0x1, 0, NULL, 0, 8000); | 276 | 0xb8, 0x38, 0x1, 0, NULL, 0, 8000); |
272 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev, | 277 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, |
273 | "encoder start control request returned %d\n", ret); | 278 | "encoder start control request returned %d\n", ret); |
274 | 279 | ||
275 | hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00); | 280 | hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00); |
@@ -277,14 +282,14 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) | |||
277 | INIT_WORK(&dev->worker, hdpvr_transmit_buffers); | 282 | INIT_WORK(&dev->worker, hdpvr_transmit_buffers); |
278 | queue_work(dev->workqueue, &dev->worker); | 283 | queue_work(dev->workqueue, &dev->worker); |
279 | 284 | ||
280 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev, | 285 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, |
281 | "streaming started\n"); | 286 | "streaming started\n"); |
282 | dev->status = STATUS_STREAMING; | 287 | dev->status = STATUS_STREAMING; |
283 | 288 | ||
284 | return 0; | 289 | return 0; |
285 | } | 290 | } |
286 | msleep(250); | 291 | msleep(250); |
287 | v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, | 292 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
288 | "no video signal at input %d\n", dev->options.video_input); | 293 | "no video signal at input %d\n", dev->options.video_input); |
289 | return -EAGAIN; | 294 | return -EAGAIN; |
290 | } | 295 | } |
@@ -330,14 +335,14 @@ static int hdpvr_open(struct file *file) | |||
330 | 335 | ||
331 | dev = (struct hdpvr_device *)video_get_drvdata(video_devdata(file)); | 336 | dev = (struct hdpvr_device *)video_get_drvdata(video_devdata(file)); |
332 | if (!dev) { | 337 | if (!dev) { |
333 | err("open failing with with ENODEV"); | 338 | v4l2_err(&dev->v4l2_dev, "open failing with with ENODEV\n"); |
334 | retval = -ENODEV; | 339 | retval = -ENODEV; |
335 | goto err; | 340 | goto err; |
336 | } | 341 | } |
337 | 342 | ||
338 | fh = kzalloc(sizeof(struct hdpvr_fh), GFP_KERNEL); | 343 | fh = kzalloc(sizeof(struct hdpvr_fh), GFP_KERNEL); |
339 | if (!fh) { | 344 | if (!fh) { |
340 | err("Out of memory?"); | 345 | v4l2_err(&dev->v4l2_dev, "Out of memory\n"); |
341 | goto err; | 346 | goto err; |
342 | } | 347 | } |
343 | /* lock the device to allow correctly handling errors | 348 | /* 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, | |||
396 | mutex_lock(&dev->io_mutex); | 401 | mutex_lock(&dev->io_mutex); |
397 | if (dev->status == STATUS_IDLE) { | 402 | if (dev->status == STATUS_IDLE) { |
398 | if (hdpvr_start_streaming(dev)) { | 403 | if (hdpvr_start_streaming(dev)) { |
399 | v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, | 404 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
400 | "start_streaming failed"); | 405 | "start_streaming failed\n"); |
401 | ret = -EIO; | 406 | ret = -EIO; |
402 | msleep(200); | 407 | msleep(200); |
403 | dev->status = STATUS_IDLE; | 408 | dev->status = STATUS_IDLE; |
@@ -445,7 +450,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count, | |||
445 | 450 | ||
446 | if (copy_to_user(buffer, urb->transfer_buffer + buf->pos, | 451 | if (copy_to_user(buffer, urb->transfer_buffer + buf->pos, |
447 | cnt)) { | 452 | cnt)) { |
448 | err("read: copy_to_user failed"); | 453 | v4l2_err(&dev->v4l2_dev, "read: copy_to_user failed\n"); |
449 | if (!ret) | 454 | if (!ret) |
450 | ret = -EFAULT; | 455 | ret = -EFAULT; |
451 | goto err; | 456 | goto err; |
@@ -493,8 +498,8 @@ static unsigned int hdpvr_poll(struct file *filp, poll_table *wait) | |||
493 | 498 | ||
494 | if (dev->status == STATUS_IDLE) { | 499 | if (dev->status == STATUS_IDLE) { |
495 | if (hdpvr_start_streaming(dev)) { | 500 | if (hdpvr_start_streaming(dev)) { |
496 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev->video_dev, | 501 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, |
497 | "start_streaming failed"); | 502 | "start_streaming failed\n"); |
498 | dev->status = STATUS_IDLE; | 503 | dev->status = STATUS_IDLE; |
499 | } | 504 | } |
500 | 505 | ||
@@ -1130,7 +1135,7 @@ static int vidioc_encoder_cmd(struct file *filp, void *priv, | |||
1130 | res = hdpvr_stop_streaming(dev); | 1135 | res = hdpvr_stop_streaming(dev); |
1131 | break; | 1136 | break; |
1132 | default: | 1137 | default: |
1133 | v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, | 1138 | v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, |
1134 | "Unsupported encoder cmd %d\n", a->cmd); | 1139 | "Unsupported encoder cmd %d\n", a->cmd); |
1135 | res = -EINVAL; | 1140 | res = -EINVAL; |
1136 | } | 1141 | } |
@@ -1197,7 +1202,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, | |||
1197 | /* setup and register video device */ | 1202 | /* setup and register video device */ |
1198 | dev->video_dev = video_device_alloc(); | 1203 | dev->video_dev = video_device_alloc(); |
1199 | if (!dev->video_dev) { | 1204 | if (!dev->video_dev) { |
1200 | err("video_device_alloc() failed"); | 1205 | v4l2_err(&dev->v4l2_dev, "video_device_alloc() failed\n"); |
1201 | goto error; | 1206 | goto error; |
1202 | } | 1207 | } |
1203 | 1208 | ||
@@ -1207,7 +1212,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, | |||
1207 | video_set_drvdata(dev->video_dev, dev); | 1212 | video_set_drvdata(dev->video_dev, dev); |
1208 | 1213 | ||
1209 | if (video_register_device(dev->video_dev, VFL_TYPE_GRABBER, devnum)) { | 1214 | if (video_register_device(dev->video_dev, VFL_TYPE_GRABBER, devnum)) { |
1210 | err("V4L2 device registration failed"); | 1215 | v4l2_err(&dev->v4l2_dev, "video_device registration failed\n"); |
1211 | goto error; | 1216 | goto error; |
1212 | } | 1217 | } |
1213 | 1218 | ||