aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-06-26 21:44:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-04 06:56:39 -0400
commitd10d1b9ac97b96dd9183944d30b1664bdbb5fbf6 (patch)
treece5ade5d7846e76ade1806d898e017804a9b5d8a /drivers/media/dvb
parenta13a6e1f9db8361cd018560f2664e3d341323a31 (diff)
[media] dvb_usb_v2: use dev_* logging macros
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb_usb_core.c215
-rw-r--r--drivers/media/dvb/dvb-usb/dvb_usb_urb.c9
-rw-r--r--drivers/media/dvb/dvb-usb/usb_urb.c72
3 files changed, 161 insertions, 135 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_core.c b/drivers/media/dvb/dvb-usb/dvb_usb_core.c
index 07a0ac7e956c..920542c0b672 100644
--- a/drivers/media/dvb/dvb-usb/dvb_usb_core.c
+++ b/drivers/media/dvb/dvb-usb/dvb_usb_core.c
@@ -35,7 +35,7 @@ static int dvb_usbv2_download_firmware(struct dvb_usb_device *d, const char *nam
35{ 35{
36 int ret; 36 int ret;
37 const struct firmware *fw; 37 const struct firmware *fw;
38 pr_debug("%s:\n", __func__); 38 dev_dbg(&d->udev->dev, "%s:\n", __func__);
39 39
40 if (!d->props->download_firmware) { 40 if (!d->props->download_firmware) {
41 ret = -EINVAL; 41 ret = -EINVAL;
@@ -44,15 +44,15 @@ static int dvb_usbv2_download_firmware(struct dvb_usb_device *d, const char *nam
44 44
45 ret = request_firmware(&fw, name, &d->udev->dev); 45 ret = request_firmware(&fw, name, &d->udev->dev);
46 if (ret < 0) { 46 if (ret < 0) {
47 pr_err("%s: Did not find the firmware file '%s'. " \ 47 dev_err(&d->udev->dev, "%s: Did not find the firmware file "\
48 "Please see linux/Documentation/dvb/ for " \ 48 "'%s'. Please see linux/Documentation/dvb/ " \
49 "more details on firmware-problems. Status " \ 49 "for more details on firmware-problems. " \
50 "%d\n", KBUILD_MODNAME, name, ret); 50 "Status %d\n", KBUILD_MODNAME, name, ret);
51 goto err; 51 goto err;
52 } 52 }
53 53
54 pr_info("%s: downloading firmware from file '%s'\n", KBUILD_MODNAME, 54 dev_info(&d->udev->dev, "%s: downloading firmware from file '%s'\n",
55 name); 55 KBUILD_MODNAME, name);
56 56
57 ret = d->props->download_firmware(d, fw); 57 ret = d->props->download_firmware(d, fw);
58 release_firmware(fw); 58 release_firmware(fw);
@@ -61,14 +61,14 @@ static int dvb_usbv2_download_firmware(struct dvb_usb_device *d, const char *nam
61 61
62 return ret; 62 return ret;
63err: 63err:
64 pr_debug("%s: failed=%d\n", __func__, ret); 64 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
65 return ret; 65 return ret;
66} 66}
67 67
68static int dvb_usbv2_i2c_init(struct dvb_usb_device *d) 68static int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
69{ 69{
70 int ret; 70 int ret;
71 pr_debug("%s:\n", __func__); 71 dev_dbg(&d->udev->dev, "%s:\n", __func__);
72 72
73 if (!d->props->i2c_algo) 73 if (!d->props->i2c_algo)
74 return 0; 74 return 0;
@@ -81,20 +81,20 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
81 ret = i2c_add_adapter(&d->i2c_adap); 81 ret = i2c_add_adapter(&d->i2c_adap);
82 if (ret < 0) { 82 if (ret < 0) {
83 d->i2c_adap.algo = NULL; 83 d->i2c_adap.algo = NULL;
84 pr_err("%s: i2c_add_adapter() failed=%d\n", KBUILD_MODNAME, 84 dev_err(&d->udev->dev, "%s: i2c_add_adapter() failed=%d\n",
85 ret); 85 KBUILD_MODNAME, ret);
86 goto err; 86 goto err;
87 } 87 }
88 88
89 return 0; 89 return 0;
90err: 90err:
91 pr_debug("%s: failed=%d\n", __func__, ret); 91 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
92 return ret; 92 return ret;
93} 93}
94 94
95static int dvb_usbv2_i2c_exit(struct dvb_usb_device *d) 95static int dvb_usbv2_i2c_exit(struct dvb_usb_device *d)
96{ 96{
97 pr_debug("%s:\n", __func__); 97 dev_dbg(&d->udev->dev, "%s:\n", __func__);
98 98
99 if (d->i2c_adap.algo) 99 if (d->i2c_adap.algo)
100 i2c_del_adapter(&d->i2c_adap); 100 i2c_del_adapter(&d->i2c_adap);
@@ -117,7 +117,8 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
117 117
118 ret = d->rc.query(d); 118 ret = d->rc.query(d);
119 if (ret < 0) { 119 if (ret < 0) {
120 pr_err("%s: rc.query() failed=%d\n", KBUILD_MODNAME, ret); 120 dev_err(&d->udev->dev, "%s: rc.query() failed=%d\n",
121 KBUILD_MODNAME, ret);
121 return; /* stop polling */ 122 return; /* stop polling */
122 } 123 }
123 124
@@ -129,7 +130,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
129{ 130{
130 int ret; 131 int ret;
131 struct rc_dev *dev; 132 struct rc_dev *dev;
132 pr_debug("%s:\n", __func__); 133 dev_dbg(&d->udev->dev, "%s:\n", __func__);
133 134
134 if (dvb_usbv2_disable_rc_polling || !d->props->get_rc_config) 135 if (dvb_usbv2_disable_rc_polling || !d->props->get_rc_config)
135 return 0; 136 return 0;
@@ -174,21 +175,22 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
174 /* initialize a work queue for handling polling */ 175 /* initialize a work queue for handling polling */
175 INIT_DELAYED_WORK(&d->rc_query_work, 176 INIT_DELAYED_WORK(&d->rc_query_work,
176 dvb_usb_read_remote_control); 177 dvb_usb_read_remote_control);
177 pr_info("%s: schedule remote query interval to %d msecs\n", 178 dev_info(&d->udev->dev, "%s: schedule remote query interval " \
178 KBUILD_MODNAME, d->rc.interval); 179 "to %d msecs\n", KBUILD_MODNAME,
180 d->rc.interval);
179 schedule_delayed_work(&d->rc_query_work, 181 schedule_delayed_work(&d->rc_query_work,
180 msecs_to_jiffies(d->rc.interval)); 182 msecs_to_jiffies(d->rc.interval));
181 } 183 }
182 184
183 return 0; 185 return 0;
184err: 186err:
185 pr_debug("%s: failed=%d\n", __func__, ret); 187 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
186 return ret; 188 return ret;
187} 189}
188 190
189static int dvb_usbv2_remote_exit(struct dvb_usb_device *d) 191static int dvb_usbv2_remote_exit(struct dvb_usb_device *d)
190{ 192{
191 pr_debug("%s:\n", __func__); 193 dev_dbg(&d->udev->dev, "%s:\n", __func__);
192 194
193 if (d->rc_dev) { 195 if (d->rc_dev) {
194 cancel_delayed_work_sync(&d->rc_query_work); 196 cancel_delayed_work_sync(&d->rc_query_work);
@@ -222,7 +224,8 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, u8 *buf,
222 224
223int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) 225int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
224{ 226{
225 pr_debug("%s: adap=%d\n", __func__, adap->id); 227 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
228 adap->id);
226 229
227 adap->stream.udev = adap_to_d(adap)->udev; 230 adap->stream.udev = adap_to_d(adap)->udev;
228 adap->stream.user_priv = adap; 231 adap->stream.user_priv = adap;
@@ -233,7 +236,8 @@ int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
233 236
234int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap) 237int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)
235{ 238{
236 pr_debug("%s: adap=%d\n", __func__, adap->id); 239 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
240 adap->id);
237 241
238 return usb_urb_exitv2(&adap->stream); 242 return usb_urb_exitv2(&adap->stream);
239} 243}
@@ -244,9 +248,9 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
244 struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv; 248 struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
245 struct dvb_usb_device *d = adap_to_d(adap); 249 struct dvb_usb_device *d = adap_to_d(adap);
246 int ret; 250 int ret;
247 pr_debug("%s: adap=%d active_fe=%d feed_type=%d setting pid [%s]: " \ 251 dev_dbg(&d->udev->dev, "%s: adap=%d active_fe=%d feed_type=%d " \
248 "%04x (%04d) at index %d '%s'\n", __func__, adap->id, 252 "setting pid [%s]: %04x (%04d) at index %d '%s'\n",
249 adap->active_fe, dvbdmxfeed->type, 253 __func__, adap->id, adap->active_fe, dvbdmxfeed->type,
250 adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid, 254 adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid,
251 dvbdmxfeed->pid, dvbdmxfeed->index, 255 dvbdmxfeed->pid, dvbdmxfeed->index,
252 (count == 1) ? "on" : "off"); 256 (count == 1) ? "on" : "off");
@@ -258,15 +262,16 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
258 262
259 /* stop feeding if it is last pid */ 263 /* stop feeding if it is last pid */
260 if (adap->feed_count == 0) { 264 if (adap->feed_count == 0) {
261 pr_debug("%s: stop feeding\n", __func__); 265 dev_dbg(&d->udev->dev, "%s: stop feeding\n", __func__);
262 usb_urb_killv2(&adap->stream); 266 usb_urb_killv2(&adap->stream);
263 267
264 if (d->props->streaming_ctrl) { 268 if (d->props->streaming_ctrl) {
265 ret = d->props->streaming_ctrl( 269 ret = d->props->streaming_ctrl(
266 adap->fe[adap->active_fe], 0); 270 adap->fe[adap->active_fe], 0);
267 if (ret < 0) { 271 if (ret < 0) {
268 pr_err("%s: streaming_ctrl() failed=%d\n", 272 dev_err(&d->udev->dev, "%s: streaming_ctrl() " \
269 KBUILD_MODNAME, ret); 273 "failed=%d\n", KBUILD_MODNAME,
274 ret);
270 goto err_mutex_unlock; 275 goto err_mutex_unlock;
271 } 276 }
272 } 277 }
@@ -280,14 +285,15 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
280 ret = adap->props->pid_filter(adap, dvbdmxfeed->index, 285 ret = adap->props->pid_filter(adap, dvbdmxfeed->index,
281 dvbdmxfeed->pid, (count == 1) ? 1 : 0); 286 dvbdmxfeed->pid, (count == 1) ? 1 : 0);
282 if (ret < 0) 287 if (ret < 0)
283 pr_err("%s: pid_filter() failed=%d\n", 288 dev_err(&d->udev->dev, "%s: pid_filter() " \
284 KBUILD_MODNAME, ret); 289 "failed=%d\n", KBUILD_MODNAME,
290 ret);
285 291
286 /* start feeding if it is first pid */ 292 /* start feeding if it is first pid */
287 if (adap->feed_count == 1 && count == 1) { 293 if (adap->feed_count == 1 && count == 1) {
288 struct usb_data_stream_properties stream_props; 294 struct usb_data_stream_properties stream_props;
289 mutex_lock(&adap->sync_mutex); 295 mutex_lock(&adap->sync_mutex);
290 pr_debug("%s: start feeding\n", __func__); 296 dev_dbg(&d->udev->dev, "%s: start feeding\n", __func__);
291 297
292 /* resolve input and output streaming paramters */ 298 /* resolve input and output streaming paramters */
293 if (d->props->get_stream_config) { 299 if (d->props->get_stream_config) {
@@ -324,7 +330,8 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
324 ret = adap->props->pid_filter_ctrl(adap, 330 ret = adap->props->pid_filter_ctrl(adap,
325 adap->pid_filtering); 331 adap->pid_filtering);
326 if (ret < 0) { 332 if (ret < 0) {
327 pr_err("%s: pid_filter_ctrl() failed=%d\n", 333 dev_err(&d->udev->dev, "%s: " \
334 "pid_filter_ctrl() failed=%d\n",
328 KBUILD_MODNAME, ret); 335 KBUILD_MODNAME, ret);
329 goto err_mutex_unlock; 336 goto err_mutex_unlock;
330 } 337 }
@@ -334,8 +341,9 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
334 ret = d->props->streaming_ctrl( 341 ret = d->props->streaming_ctrl(
335 adap->fe[adap->active_fe], 1); 342 adap->fe[adap->active_fe], 1);
336 if (ret < 0) { 343 if (ret < 0) {
337 pr_err("%s: streaming_ctrl() failed=%d\n", 344 dev_err(&d->udev->dev, "%s: streaming_ctrl() " \
338 KBUILD_MODNAME, ret); 345 "failed=%d\n", KBUILD_MODNAME,
346 ret);
339 goto err_mutex_unlock; 347 goto err_mutex_unlock;
340 } 348 }
341 } 349 }
@@ -344,7 +352,7 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
344 return 0; 352 return 0;
345err_mutex_unlock: 353err_mutex_unlock:
346 mutex_unlock(&adap->sync_mutex); 354 mutex_unlock(&adap->sync_mutex);
347 pr_debug("%s: failed=%d\n", __func__, ret); 355 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
348 return ret; 356 return ret;
349} 357}
350 358
@@ -362,13 +370,13 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
362{ 370{
363 int ret; 371 int ret;
364 struct dvb_usb_device *d = adap_to_d(adap); 372 struct dvb_usb_device *d = adap_to_d(adap);
365 pr_debug("%s: adap=%d\n", __func__, adap->id); 373 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id);
366 374
367 ret = dvb_register_adapter(&adap->dvb_adap, d->name, d->props->owner, 375 ret = dvb_register_adapter(&adap->dvb_adap, d->name, d->props->owner,
368 &d->udev->dev, d->props->adapter_nr); 376 &d->udev->dev, d->props->adapter_nr);
369 if (ret < 0) { 377 if (ret < 0) {
370 pr_debug("%s: dvb_register_adapter() failed=%d\n", __func__, 378 dev_dbg(&d->udev->dev, "%s: dvb_register_adapter() failed=%d\n",
371 ret); 379 __func__, ret);
372 goto err_dvb_register_adapter; 380 goto err_dvb_register_adapter;
373 } 381 }
374 382
@@ -380,8 +388,8 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
380 if (ret < 0) 388 if (ret < 0)
381 goto err_dvb_dmx_init; 389 goto err_dvb_dmx_init;
382 390
383 pr_info("%s: MAC address: %pM\n", KBUILD_MODNAME, 391 dev_info(&d->udev->dev, "%s: MAC address: %pM\n",
384 adap->dvb_adap.proposed_mac); 392 KBUILD_MODNAME, adap->dvb_adap.proposed_mac);
385 } 393 }
386 394
387 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; 395 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING;
@@ -394,7 +402,8 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
394 adap->demux.write_to_decoder = NULL; 402 adap->demux.write_to_decoder = NULL;
395 ret = dvb_dmx_init(&adap->demux); 403 ret = dvb_dmx_init(&adap->demux);
396 if (ret < 0) { 404 if (ret < 0) {
397 pr_err("%s: dvb_dmx_init() failed=%d\n", KBUILD_MODNAME, ret); 405 dev_err(&d->udev->dev, "%s: dvb_dmx_init() failed=%d\n",
406 KBUILD_MODNAME, ret);
398 goto err_dvb_dmx_init; 407 goto err_dvb_dmx_init;
399 } 408 }
400 409
@@ -403,14 +412,15 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
403 adap->dmxdev.capabilities = 0; 412 adap->dmxdev.capabilities = 0;
404 ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap); 413 ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap);
405 if (ret < 0) { 414 if (ret < 0) {
406 pr_err("%s: dvb_dmxdev_init() failed=%d\n", KBUILD_MODNAME, 415 dev_err(&d->udev->dev, "%s: dvb_dmxdev_init() failed=%d\n",
407 ret); 416 KBUILD_MODNAME, ret);
408 goto err_dvb_dmxdev_init; 417 goto err_dvb_dmxdev_init;
409 } 418 }
410 419
411 ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx); 420 ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx);
412 if (ret < 0) { 421 if (ret < 0) {
413 pr_err("%s: dvb_net_init() failed=%d\n", KBUILD_MODNAME, ret); 422 dev_err(&d->udev->dev, "%s: dvb_net_init() failed=%d\n",
423 KBUILD_MODNAME, ret);
414 goto err_dvb_net_init; 424 goto err_dvb_net_init;
415 } 425 }
416 426
@@ -430,7 +440,8 @@ err_dvb_register_adapter:
430 440
431int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) 441int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
432{ 442{
433 pr_debug("%s: adap=%d\n", __func__, adap->id); 443 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
444 adap->id);
434 445
435 if (adap->dvb_adap.priv) { 446 if (adap->dvb_adap.priv) {
436 dvb_net_release(&adap->dvb_net); 447 dvb_net_release(&adap->dvb_net);
@@ -454,7 +465,7 @@ int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff)
454 465
455 if (d->powered == 0 || (onoff && d->powered == 1)) { 466 if (d->powered == 0 || (onoff && d->powered == 1)) {
456 /* when switching from 1 to 0 or from 0 to 1 */ 467 /* when switching from 1 to 0 or from 0 to 1 */
457 pr_debug("%s: power control=%d\n", __func__, onoff); 468 dev_dbg(&d->udev->dev, "%s: power=%d\n", __func__, onoff);
458 if (d->props->power_ctrl) { 469 if (d->props->power_ctrl) {
459 ret = d->props->power_ctrl(d, onoff); 470 ret = d->props->power_ctrl(d, onoff);
460 if (ret < 0) 471 if (ret < 0)
@@ -464,7 +475,7 @@ int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff)
464 475
465 return 0; 476 return 0;
466err: 477err:
467 pr_debug("%s: failed=%d\n", __func__, ret); 478 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
468 return ret; 479 return ret;
469} 480}
470 481
@@ -474,7 +485,8 @@ static int dvb_usb_fe_init(struct dvb_frontend *fe)
474 struct dvb_usb_adapter *adap = fe->dvb->priv; 485 struct dvb_usb_adapter *adap = fe->dvb->priv;
475 struct dvb_usb_device *d = adap_to_d(adap); 486 struct dvb_usb_device *d = adap_to_d(adap);
476 mutex_lock(&adap->sync_mutex); 487 mutex_lock(&adap->sync_mutex);
477 pr_debug("%s: adap=%d fe=%d\n", __func__, adap->id, fe->id); 488 dev_dbg(&d->udev->dev, "%s: adap=%d fe=%d\n", __func__, adap->id,
489 fe->id);
478 490
479 ret = dvb_usbv2_device_power_ctrl(d, 1); 491 ret = dvb_usbv2_device_power_ctrl(d, 1);
480 if (ret < 0) 492 if (ret < 0)
@@ -498,7 +510,7 @@ static int dvb_usb_fe_init(struct dvb_frontend *fe)
498 return 0; 510 return 0;
499err: 511err:
500 mutex_unlock(&adap->sync_mutex); 512 mutex_unlock(&adap->sync_mutex);
501 pr_debug("%s: failed=%d\n", __func__, ret); 513 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
502 return ret; 514 return ret;
503} 515}
504 516
@@ -508,7 +520,8 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
508 struct dvb_usb_adapter *adap = fe->dvb->priv; 520 struct dvb_usb_adapter *adap = fe->dvb->priv;
509 struct dvb_usb_device *d = adap_to_d(adap); 521 struct dvb_usb_device *d = adap_to_d(adap);
510 mutex_lock(&adap->sync_mutex); 522 mutex_lock(&adap->sync_mutex);
511 pr_debug("%s: adap=%d fe=%d\n", __func__, adap->id, fe->id); 523 dev_dbg(&d->udev->dev, "%s: adap=%d fe=%d\n", __func__, adap->id,
524 fe->id);
512 525
513 if (adap->fe_sleep[fe->id]) { 526 if (adap->fe_sleep[fe->id]) {
514 ret = adap->fe_sleep[fe->id](fe); 527 ret = adap->fe_sleep[fe->id](fe);
@@ -532,7 +545,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
532 return 0; 545 return 0;
533err: 546err:
534 mutex_unlock(&adap->sync_mutex); 547 mutex_unlock(&adap->sync_mutex);
535 pr_debug("%s: failed=%d\n", __func__, ret); 548 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
536 return ret; 549 return ret;
537} 550}
538 551
@@ -540,7 +553,7 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
540{ 553{
541 int ret, i, count_registered = 0; 554 int ret, i, count_registered = 0;
542 struct dvb_usb_device *d = adap_to_d(adap); 555 struct dvb_usb_device *d = adap_to_d(adap);
543 pr_debug("%s: adap=%d\n", __func__, adap->id); 556 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id);
544 557
545 memset(adap->fe, 0, sizeof(adap->fe)); 558 memset(adap->fe, 0, sizeof(adap->fe));
546 adap->active_fe = -1; 559 adap->active_fe = -1;
@@ -548,12 +561,13 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
548 if (d->props->frontend_attach) { 561 if (d->props->frontend_attach) {
549 ret = d->props->frontend_attach(adap); 562 ret = d->props->frontend_attach(adap);
550 if (ret < 0) { 563 if (ret < 0) {
551 pr_debug("%s: frontend_attach() failed=%d\n", __func__, 564 dev_dbg(&d->udev->dev, "%s: frontend_attach() " \
552 ret); 565 "failed=%d\n", __func__, ret);
553 goto err_dvb_frontend_detach; 566 goto err_dvb_frontend_detach;
554 } 567 }
555 } else { 568 } else {
556 pr_debug("%s: frontend_attach() do not exists\n", __func__); 569 dev_dbg(&d->udev->dev, "%s: frontend_attach() do not exists\n",
570 __func__);
557 ret = 0; 571 ret = 0;
558 goto err; 572 goto err;
559 } 573 }
@@ -568,8 +582,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
568 582
569 ret = dvb_register_frontend(&adap->dvb_adap, adap->fe[i]); 583 ret = dvb_register_frontend(&adap->dvb_adap, adap->fe[i]);
570 if (ret < 0) { 584 if (ret < 0) {
571 pr_err("%s: frontend%d registration failed\n", 585 dev_err(&d->udev->dev, "%s: frontend%d registration " \
572 KBUILD_MODNAME, i); 586 "failed\n", KBUILD_MODNAME, i);
573 goto err_dvb_unregister_frontend; 587 goto err_dvb_unregister_frontend;
574 } 588 }
575 589
@@ -579,8 +593,8 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
579 if (d->props->tuner_attach) { 593 if (d->props->tuner_attach) {
580 ret = d->props->tuner_attach(adap); 594 ret = d->props->tuner_attach(adap);
581 if (ret < 0) { 595 if (ret < 0) {
582 pr_debug("%s: tuner_attach() failed=%d\n", __func__, 596 dev_dbg(&d->udev->dev, "%s: tuner_attach() failed=%d\n",
583 ret); 597 __func__, ret);
584 goto err_dvb_unregister_frontend; 598 goto err_dvb_unregister_frontend;
585 } 599 }
586 } 600 }
@@ -598,14 +612,15 @@ err_dvb_frontend_detach:
598 } 612 }
599 613
600err: 614err:
601 pr_debug("%s: failed=%d\n", __func__, ret); 615 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
602 return ret; 616 return ret;
603} 617}
604 618
605int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap) 619int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap)
606{ 620{
607 int i; 621 int i;
608 pr_debug("%s: adap=%d\n", __func__, adap->id); 622 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
623 adap->id);
609 624
610 for (i = MAX_NO_OF_FE_PER_ADAP - 1; i >= 0; i--) { 625 for (i = MAX_NO_OF_FE_PER_ADAP - 1; i >= 0; i--) {
611 if (adap->fe[i]) { 626 if (adap->fe[i]) {
@@ -640,32 +655,33 @@ static int dvb_usbv2_adapter_init(struct dvb_usb_device *d)
640 /* speed - when running at FULL speed we need a HW PID filter */ 655 /* speed - when running at FULL speed we need a HW PID filter */
641 if (d->udev->speed == USB_SPEED_FULL && 656 if (d->udev->speed == USB_SPEED_FULL &&
642 !(adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER)) { 657 !(adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER)) {
643 pr_err("%s: this USB2.0 device cannot be run on a " \ 658 dev_err(&d->udev->dev, "%s: this USB2.0 device " \
644 "USB1.1 port (it lacks a hardware " \ 659 "cannot be run on a USB1.1 port (it " \
645 "PID filter)\n", KBUILD_MODNAME); 660 "lacks a hardware PID filter)\n",
661 KBUILD_MODNAME);
646 ret = -ENODEV; 662 ret = -ENODEV;
647 goto err; 663 goto err;
648 } else if ((d->udev->speed == USB_SPEED_FULL && 664 } else if ((d->udev->speed == USB_SPEED_FULL &&
649 adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) || 665 adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) ||
650 (adap->props->caps & DVB_USB_ADAP_NEED_PID_FILTERING)) { 666 (adap->props->caps & DVB_USB_ADAP_NEED_PID_FILTERING)) {
651 pr_info("%s: will use the device's hardware PID " \ 667 dev_info(&d->udev->dev, "%s: will use the device's " \
652 "filter (table count: %d)\n", 668 "hardware PID filter " \
653 KBUILD_MODNAME, 669 "(table count: %d)\n", KBUILD_MODNAME,
654 adap->props->pid_filter_count); 670 adap->props->pid_filter_count);
655 adap->pid_filtering = 1; 671 adap->pid_filtering = 1;
656 adap->max_feed_count = adap->props->pid_filter_count; 672 adap->max_feed_count = adap->props->pid_filter_count;
657 } else { 673 } else {
658 pr_info("%s: will pass the complete MPEG2 transport " \ 674 dev_info(&d->udev->dev, "%s: will pass the complete " \
659 "stream to the software demuxer\n", 675 "MPEG2 transport stream to the " \
660 KBUILD_MODNAME); 676 "software demuxer\n", KBUILD_MODNAME);
661 adap->pid_filtering = 0; 677 adap->pid_filtering = 0;
662 adap->max_feed_count = 255; 678 adap->max_feed_count = 255;
663 } 679 }
664 680
665 if (!adap->pid_filtering && dvb_usb_force_pid_filter_usage && 681 if (!adap->pid_filtering && dvb_usb_force_pid_filter_usage &&
666 adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) { 682 adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) {
667 pr_info("%s: pid filter enabled by module option\n", 683 dev_info(&d->udev->dev, "%s: PID filter enabled by " \
668 KBUILD_MODNAME); 684 "module option\n", KBUILD_MODNAME);
669 adap->pid_filtering = 1; 685 adap->pid_filtering = 1;
670 adap->max_feed_count = adap->props->pid_filter_count; 686 adap->max_feed_count = adap->props->pid_filter_count;
671 } 687 }
@@ -691,14 +707,14 @@ static int dvb_usbv2_adapter_init(struct dvb_usb_device *d)
691 707
692 return 0; 708 return 0;
693err: 709err:
694 pr_debug("%s: failed=%d\n", __func__, ret); 710 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
695 return ret; 711 return ret;
696} 712}
697 713
698static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d) 714static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d)
699{ 715{
700 int i; 716 int i;
701 pr_debug("%s:\n", __func__); 717 dev_dbg(&d->udev->dev, "%s:\n", __func__);
702 718
703 for (i = MAX_NO_OF_ADAPTER_PER_DEVICE - 1; i >= 0; i--) { 719 for (i = MAX_NO_OF_ADAPTER_PER_DEVICE - 1; i >= 0; i--) {
704 dvb_usbv2_adapter_frontend_exit(&d->adapter[i]); 720 dvb_usbv2_adapter_frontend_exit(&d->adapter[i]);
@@ -712,7 +728,7 @@ static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d)
712/* general initialization functions */ 728/* general initialization functions */
713static int dvb_usbv2_exit(struct dvb_usb_device *d) 729static int dvb_usbv2_exit(struct dvb_usb_device *d)
714{ 730{
715 pr_debug("%s:\n", __func__); 731 dev_dbg(&d->udev->dev, "%s:\n", __func__);
716 732
717 dvb_usbv2_remote_exit(d); 733 dvb_usbv2_remote_exit(d);
718 dvb_usbv2_adapter_exit(d); 734 dvb_usbv2_adapter_exit(d);
@@ -726,7 +742,7 @@ static int dvb_usbv2_exit(struct dvb_usb_device *d)
726static int dvb_usbv2_init(struct dvb_usb_device *d) 742static int dvb_usbv2_init(struct dvb_usb_device *d)
727{ 743{
728 int ret; 744 int ret;
729 pr_debug("%s:\n", __func__); 745 dev_dbg(&d->udev->dev, "%s:\n", __func__);
730 746
731 dvb_usbv2_device_power_ctrl(d, 1); 747 dvb_usbv2_device_power_ctrl(d, 1);
732 748
@@ -759,7 +775,7 @@ static int dvb_usbv2_init(struct dvb_usb_device *d)
759 return 0; 775 return 0;
760err: 776err:
761 dvb_usbv2_device_power_ctrl(d, 0); 777 dvb_usbv2_device_power_ctrl(d, 0);
762 pr_debug("%s: failed=%d\n", __func__, ret); 778 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
763 return ret; 779 return ret;
764} 780}
765 781
@@ -776,12 +792,13 @@ static void dvb_usbv2_init_work(struct work_struct *work)
776 container_of(work, struct dvb_usb_device, probe_work); 792 container_of(work, struct dvb_usb_device, probe_work);
777 793
778 d->work_pid = current->pid; 794 d->work_pid = current->pid;
779 pr_debug("%s: work_pid=%d\n", __func__, d->work_pid); 795 dev_dbg(&d->udev->dev, "%s: work_pid=%d\n", __func__, d->work_pid);
780 796
781 if (d->props->size_of_priv) { 797 if (d->props->size_of_priv) {
782 d->priv = kzalloc(d->props->size_of_priv, GFP_KERNEL); 798 d->priv = kzalloc(d->props->size_of_priv, GFP_KERNEL);
783 if (!d->priv) { 799 if (!d->priv) {
784 pr_err("%s: kzalloc() failed\n", KBUILD_MODNAME); 800 dev_err(&d->udev->dev, "%s: kzalloc() failed\n",
801 KBUILD_MODNAME);
785 ret = -ENOMEM; 802 ret = -ENOMEM;
786 goto err_usb_driver_release_interface; 803 goto err_usb_driver_release_interface;
787 } 804 }
@@ -793,8 +810,8 @@ static void dvb_usbv2_init_work(struct work_struct *work)
793 if (ret == 0) { 810 if (ret == 0) {
794 ; 811 ;
795 } else if (ret == COLD) { 812 } else if (ret == COLD) {
796 pr_info("%s: found a '%s' in cold state\n", 813 dev_info(&d->udev->dev, "%s: found a '%s' in cold " \
797 KBUILD_MODNAME, d->name); 814 "state\n", KBUILD_MODNAME, d->name);
798 815
799 if (!name) 816 if (!name)
800 name = d->props->firmware; 817 name = d->props->firmware;
@@ -829,22 +846,23 @@ static void dvb_usbv2_init_work(struct work_struct *work)
829 } 846 }
830 } 847 }
831 848
832 pr_info("%s: found a '%s' in warm state\n", KBUILD_MODNAME, d->name); 849 dev_info(&d->udev->dev, "%s: found a '%s' in warm state\n",
850 KBUILD_MODNAME, d->name);
833 851
834 ret = dvb_usbv2_init(d); 852 ret = dvb_usbv2_init(d);
835 if (ret < 0) 853 if (ret < 0)
836 goto err_usb_driver_release_interface; 854 goto err_usb_driver_release_interface;
837 855
838 pr_info("%s: '%s' successfully initialized and connected\n", 856 dev_info(&d->udev->dev, "%s: '%s' successfully initialized and " \
839 KBUILD_MODNAME, d->name); 857 "connected\n", KBUILD_MODNAME, d->name);
840 858
841 return; 859 return;
842err_usb_driver_release_interface: 860err_usb_driver_release_interface:
843 pr_info("%s: '%s' error while loading driver (%d)\n", KBUILD_MODNAME, 861 dev_info(&d->udev->dev, "%s: '%s' error while loading driver (%d)\n",
844 d->name, ret); 862 KBUILD_MODNAME, d->name, ret);
845 usb_driver_release_interface(to_usb_driver(d->intf->dev.driver), 863 usb_driver_release_interface(to_usb_driver(d->intf->dev.driver),
846 d->intf); 864 d->intf);
847 pr_debug("%s: failed=%d\n", __func__, ret); 865 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
848 return; 866 return;
849} 867}
850 868
@@ -853,28 +871,29 @@ int dvb_usbv2_probe(struct usb_interface *intf,
853{ 871{
854 int ret; 872 int ret;
855 struct dvb_usb_device *d; 873 struct dvb_usb_device *d;
874 struct usb_device *udev = interface_to_usbdev(intf);
856 struct dvb_usb_driver_info *driver_info = 875 struct dvb_usb_driver_info *driver_info =
857 (struct dvb_usb_driver_info *) id->driver_info; 876 (struct dvb_usb_driver_info *) id->driver_info;
858 877
859 pr_debug("%s: bInterfaceNumber=%d\n", __func__, 878 dev_dbg(&udev->dev, "%s: bInterfaceNumber=%d\n", __func__,
860 intf->cur_altsetting->desc.bInterfaceNumber); 879 intf->cur_altsetting->desc.bInterfaceNumber);
861 880
862 if (!id->driver_info) { 881 if (!id->driver_info) {
863 pr_err("%s: driver_info failed\n", KBUILD_MODNAME); 882 dev_err(&udev->dev, "%s: driver_info failed\n", KBUILD_MODNAME);
864 ret = -ENODEV; 883 ret = -ENODEV;
865 goto err; 884 goto err;
866 } 885 }
867 886
868 d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL); 887 d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL);
869 if (!d) { 888 if (!d) {
870 pr_err("%s: kzalloc() failed\n", KBUILD_MODNAME); 889 dev_err(&udev->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME);
871 ret = -ENOMEM; 890 ret = -ENOMEM;
872 goto err; 891 goto err;
873 } 892 }
874 893
875 d->name = driver_info->name; 894 d->name = driver_info->name;
876 d->rc_map = driver_info->rc_map; 895 d->rc_map = driver_info->rc_map;
877 d->udev = interface_to_usbdev(intf); 896 d->udev = udev;
878 d->intf = intf; 897 d->intf = intf;
879 d->props = driver_info->props; 898 d->props = driver_info->props;
880 899
@@ -890,7 +909,8 @@ int dvb_usbv2_probe(struct usb_interface *intf,
890 usb_set_intfdata(intf, d); 909 usb_set_intfdata(intf, d);
891 ret = schedule_work(&d->probe_work); 910 ret = schedule_work(&d->probe_work);
892 if (ret < 0) { 911 if (ret < 0) {
893 pr_err("%s: schedule_work() failed\n", KBUILD_MODNAME); 912 dev_err(&d->udev->dev, "%s: schedule_work() failed\n",
913 KBUILD_MODNAME);
894 goto err_kfree; 914 goto err_kfree;
895 } 915 }
896 916
@@ -898,7 +918,7 @@ int dvb_usbv2_probe(struct usb_interface *intf,
898err_kfree: 918err_kfree:
899 kfree(d); 919 kfree(d);
900err: 920err:
901 pr_debug("%s: failed=%d\n", __func__, ret); 921 dev_dbg(&udev->dev, "%s: failed=%d\n", __func__, ret);
902 return ret; 922 return ret;
903} 923}
904EXPORT_SYMBOL(dvb_usbv2_probe); 924EXPORT_SYMBOL(dvb_usbv2_probe);
@@ -907,8 +927,9 @@ void dvb_usbv2_disconnect(struct usb_interface *intf)
907{ 927{
908 struct dvb_usb_device *d = usb_get_intfdata(intf); 928 struct dvb_usb_device *d = usb_get_intfdata(intf);
909 const char *name = d->name; 929 const char *name = d->name;
910 pr_debug("%s: pid=%d work_pid=%d\n", __func__, current->pid, 930 struct device dev = d->udev->dev;
911 d->work_pid); 931 dev_dbg(&d->udev->dev, "%s: pid=%d work_pid=%d\n", __func__,
932 current->pid, d->work_pid);
912 933
913 /* ensure initialization work is finished until release resources */ 934 /* ensure initialization work is finished until release resources */
914 if (d->work_pid != current->pid) 935 if (d->work_pid != current->pid)
@@ -919,7 +940,7 @@ void dvb_usbv2_disconnect(struct usb_interface *intf)
919 940
920 dvb_usbv2_exit(d); 941 dvb_usbv2_exit(d);
921 942
922 pr_info("%s: '%s' successfully deinitialized and disconnected\n", 943 dev_info(&dev, "%s: '%s' successfully deinitialized and disconnected\n",
923 KBUILD_MODNAME, name); 944 KBUILD_MODNAME, name);
924} 945}
925EXPORT_SYMBOL(dvb_usbv2_disconnect); 946EXPORT_SYMBOL(dvb_usbv2_disconnect);
@@ -928,7 +949,7 @@ int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg)
928{ 949{
929 struct dvb_usb_device *d = usb_get_intfdata(intf); 950 struct dvb_usb_device *d = usb_get_intfdata(intf);
930 int i; 951 int i;
931 pr_debug("%s:\n", __func__); 952 dev_dbg(&d->udev->dev, "%s:\n", __func__);
932 953
933 /* stop remote controller poll */ 954 /* stop remote controller poll */
934 if (d->rc.query && !d->rc.bulk_mode) 955 if (d->rc.query && !d->rc.bulk_mode)
@@ -949,7 +970,7 @@ int dvb_usbv2_resume(struct usb_interface *intf)
949{ 970{
950 struct dvb_usb_device *d = usb_get_intfdata(intf); 971 struct dvb_usb_device *d = usb_get_intfdata(intf);
951 int i; 972 int i;
952 pr_debug("%s:\n", __func__); 973 dev_dbg(&d->udev->dev, "%s:\n", __func__);
953 974
954 /* start streaming */ 975 /* start streaming */
955 for (i = 0; i < MAX_NO_OF_ADAPTER_PER_DEVICE; i++) { 976 for (i = 0; i < MAX_NO_OF_ADAPTER_PER_DEVICE; i++) {
diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_urb.c b/drivers/media/dvb/dvb-usb/dvb_usb_urb.c
index 985b517adb24..5f5bdd0c4c9d 100644
--- a/drivers/media/dvb/dvb-usb/dvb_usb_urb.c
+++ b/drivers/media/dvb/dvb-usb/dvb_usb_urb.c
@@ -29,7 +29,7 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
29 29
30 if (!d || !wbuf || !wlen || !d->props->generic_bulk_ctrl_endpoint || 30 if (!d || !wbuf || !wlen || !d->props->generic_bulk_ctrl_endpoint ||
31 !d->props->generic_bulk_ctrl_endpoint_response) { 31 !d->props->generic_bulk_ctrl_endpoint_response) {
32 pr_debug("%s: failed=%d\n", __func__, -EINVAL); 32 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, -EINVAL);
33 return -EINVAL; 33 return -EINVAL;
34 } 34 }
35 35
@@ -45,7 +45,8 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
45 d->props->generic_bulk_ctrl_endpoint), wbuf, wlen, 45 d->props->generic_bulk_ctrl_endpoint), wbuf, wlen,
46 &actual_length, 2000); 46 &actual_length, 2000);
47 if (ret < 0) 47 if (ret < 0)
48 pr_err("%s: usb_bulk_msg() failed=%d\n", KBUILD_MODNAME, ret); 48 dev_err(&d->udev->dev, "%s: usb_bulk_msg() failed=%d\n",
49 KBUILD_MODNAME, ret);
49 else 50 else
50 ret = actual_length != wlen ? -EIO : 0; 51 ret = actual_length != wlen ? -EIO : 0;
51 52
@@ -60,8 +61,8 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
60 d->props->generic_bulk_ctrl_endpoint_response), 61 d->props->generic_bulk_ctrl_endpoint_response),
61 rbuf, rlen, &actual_length, 2000); 62 rbuf, rlen, &actual_length, 2000);
62 if (ret) 63 if (ret)
63 pr_err("%s: 2nd usb_bulk_msg() failed=%d\n", 64 dev_err(&d->udev->dev, "%s: 2nd usb_bulk_msg() " \
64 KBUILD_MODNAME, ret); 65 "failed=%d\n", KBUILD_MODNAME, ret);
65 66
66#ifdef DVB_USB_XFER_DEBUG 67#ifdef DVB_USB_XFER_DEBUG
67 print_hex_dump(KERN_DEBUG, KBUILD_MODNAME ": <<< ", 68 print_hex_dump(KERN_DEBUG, KBUILD_MODNAME ": <<< ",
diff --git a/drivers/media/dvb/dvb-usb/usb_urb.c b/drivers/media/dvb/dvb-usb/usb_urb.c
index d860dac2a83d..c5e2ff0ca3fb 100644
--- a/drivers/media/dvb/dvb-usb/usb_urb.c
+++ b/drivers/media/dvb/dvb-usb/usb_urb.c
@@ -22,8 +22,8 @@ static void usb_urb_complete(struct urb *urb)
22 int i; 22 int i;
23 u8 *b; 23 u8 *b;
24 24
25 pr_debug("%s: %s urb completed status=%d length=%d/%d" \ 25 dev_dbg(&stream->udev->dev, "%s: %s urb completed status=%d " \
26 " pack_num=%d errors=%d\n", __func__, 26 "length=%d/%d pack_num=%d errors=%d\n", __func__,
27 ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk", 27 ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk",
28 urb->status, urb->actual_length, 28 urb->status, urb->actual_length,
29 urb->transfer_buffer_length, 29 urb->transfer_buffer_length,
@@ -38,8 +38,8 @@ static void usb_urb_complete(struct urb *urb)
38 case -ESHUTDOWN: 38 case -ESHUTDOWN:
39 return; 39 return;
40 default: /* error */ 40 default: /* error */
41 pr_debug("%s: urb completition failed=%d\n", __func__, 41 dev_dbg(&stream->udev->dev, "%s: urb completition failed=%d\n",
42 urb->status); 42 __func__, urb->status);
43 break; 43 break;
44 } 44 }
45 45
@@ -48,8 +48,9 @@ static void usb_urb_complete(struct urb *urb)
48 case PIPE_ISOCHRONOUS: 48 case PIPE_ISOCHRONOUS:
49 for (i = 0; i < urb->number_of_packets; i++) { 49 for (i = 0; i < urb->number_of_packets; i++) {
50 if (urb->iso_frame_desc[i].status != 0) 50 if (urb->iso_frame_desc[i].status != 0)
51 pr_debug("%s: iso frame descriptor has an " \ 51 dev_dbg(&stream->udev->dev, "%s: iso frame " \
52 "error=%d\n", __func__, 52 "descriptor has an error=%d\n",
53 __func__,
53 urb->iso_frame_desc[i].status); 54 urb->iso_frame_desc[i].status);
54 else if (urb->iso_frame_desc[i].actual_length > 0) 55 else if (urb->iso_frame_desc[i].actual_length > 0)
55 stream->complete(stream, 56 stream->complete(stream,
@@ -65,8 +66,8 @@ static void usb_urb_complete(struct urb *urb)
65 stream->complete(stream, b, urb->actual_length); 66 stream->complete(stream, b, urb->actual_length);
66 break; 67 break;
67 default: 68 default:
68 pr_err("%s: unknown endpoint type in completition handler\n", 69 dev_err(&stream->udev->dev, "%s: unknown endpoint type in " \
69 KBUILD_MODNAME); 70 "completition handler\n", KBUILD_MODNAME);
70 return; 71 return;
71 } 72 }
72 usb_submit_urb(urb, GFP_ATOMIC); 73 usb_submit_urb(urb, GFP_ATOMIC);
@@ -76,7 +77,7 @@ int usb_urb_killv2(struct usb_data_stream *stream)
76{ 77{
77 int i; 78 int i;
78 for (i = 0; i < stream->urbs_submitted; i++) { 79 for (i = 0; i < stream->urbs_submitted; i++) {
79 pr_debug("%s: kill urb=%d\n", __func__, i); 80 dev_dbg(&stream->udev->dev, "%s: kill urb=%d\n", __func__, i);
80 /* stop the URB */ 81 /* stop the URB */
81 usb_kill_urb(stream->urb_list[i]); 82 usb_kill_urb(stream->urb_list[i]);
82 } 83 }
@@ -96,11 +97,12 @@ int usb_urb_submitv2(struct usb_data_stream *stream,
96 } 97 }
97 98
98 for (i = 0; i < stream->urbs_initialized; i++) { 99 for (i = 0; i < stream->urbs_initialized; i++) {
99 pr_debug("%s: submit urb=%d\n", __func__, i); 100 dev_dbg(&stream->udev->dev, "%s: submit urb=%d\n", __func__, i);
100 ret = usb_submit_urb(stream->urb_list[i], GFP_ATOMIC); 101 ret = usb_submit_urb(stream->urb_list[i], GFP_ATOMIC);
101 if (ret) { 102 if (ret) {
102 pr_err("%s: could not submit urb no. %d - get them " \ 103 dev_err(&stream->udev->dev, "%s: could not submit " \
103 "all back\n", KBUILD_MODNAME, i); 104 "urb no. %d - get them all back\n",
105 KBUILD_MODNAME, i);
104 usb_urb_killv2(stream); 106 usb_urb_killv2(stream);
105 return ret; 107 return ret;
106 } 108 }
@@ -117,7 +119,8 @@ int usb_urb_free_urbs(struct usb_data_stream *stream)
117 119
118 for (i = stream->urbs_initialized - 1; i >= 0; i--) { 120 for (i = stream->urbs_initialized - 1; i >= 0; i--) {
119 if (stream->urb_list[i]) { 121 if (stream->urb_list[i]) {
120 pr_debug("%s: free urb=%d\n", __func__, i); 122 dev_dbg(&stream->udev->dev, "%s: free urb=%d\n",
123 __func__, i);
121 /* free the URBs */ 124 /* free the URBs */
122 usb_free_urb(stream->urb_list[i]); 125 usb_free_urb(stream->urb_list[i]);
123 } 126 }
@@ -133,10 +136,10 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream)
133 136
134 /* allocate the URBs */ 137 /* allocate the URBs */
135 for (i = 0; i < stream->props.count; i++) { 138 for (i = 0; i < stream->props.count; i++) {
136 pr_debug("%s: alloc urb=%d\n", __func__, i); 139 dev_dbg(&stream->udev->dev, "%s: alloc urb=%d\n", __func__, i);
137 stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); 140 stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC);
138 if (!stream->urb_list[i]) { 141 if (!stream->urb_list[i]) {
139 pr_debug("%s: failed\n", __func__); 142 dev_dbg(&stream->udev->dev, "%s: failed\n", __func__);
140 for (j = 0; j < i; j++) 143 for (j = 0; j < i; j++)
141 usb_free_urb(stream->urb_list[j]); 144 usb_free_urb(stream->urb_list[j]);
142 return -ENOMEM; 145 return -ENOMEM;
@@ -164,11 +167,11 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream)
164 for (i = 0; i < stream->props.count; i++) { 167 for (i = 0; i < stream->props.count; i++) {
165 struct urb *urb; 168 struct urb *urb;
166 int frame_offset = 0; 169 int frame_offset = 0;
167 pr_debug("%s: alloc urb=%d\n", __func__, i); 170 dev_dbg(&stream->udev->dev, "%s: alloc urb=%d\n", __func__, i);
168 stream->urb_list[i] = usb_alloc_urb( 171 stream->urb_list[i] = usb_alloc_urb(
169 stream->props.u.isoc.framesperurb, GFP_ATOMIC); 172 stream->props.u.isoc.framesperurb, GFP_ATOMIC);
170 if (!stream->urb_list[i]) { 173 if (!stream->urb_list[i]) {
171 pr_debug("%s: failed\n", __func__); 174 dev_dbg(&stream->udev->dev, "%s: failed\n", __func__);
172 for (j = 0; j < i; j++) 175 for (j = 0; j < i; j++)
173 usb_free_urb(stream->urb_list[j]); 176 usb_free_urb(stream->urb_list[j]);
174 return -ENOMEM; 177 return -ENOMEM;
@@ -206,8 +209,8 @@ int usb_free_stream_buffers(struct usb_data_stream *stream)
206 if (stream->state & USB_STATE_URB_BUF) { 209 if (stream->state & USB_STATE_URB_BUF) {
207 while (stream->buf_num) { 210 while (stream->buf_num) {
208 stream->buf_num--; 211 stream->buf_num--;
209 pr_debug("%s: free buf=%d\n", __func__, 212 dev_dbg(&stream->udev->dev, "%s: free buf=%d\n",
210 stream->buf_num); 213 __func__, stream->buf_num);
211 usb_free_coherent(stream->udev, stream->buf_size, 214 usb_free_coherent(stream->udev, stream->buf_size,
212 stream->buf_list[stream->buf_num], 215 stream->buf_list[stream->buf_num],
213 stream->dma_addr[stream->buf_num]); 216 stream->dma_addr[stream->buf_num]);
@@ -225,22 +228,22 @@ int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num,
225 stream->buf_num = 0; 228 stream->buf_num = 0;
226 stream->buf_size = size; 229 stream->buf_size = size;
227 230
228 pr_debug("%s: all in all I will use %lu bytes for streaming\n", 231 dev_dbg(&stream->udev->dev, "%s: all in all I will use %lu bytes for " \
229 __func__, num * size); 232 "streaming\n", __func__, num * size);
230 233
231 for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) { 234 for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) {
232 stream->buf_list[stream->buf_num] = usb_alloc_coherent( 235 stream->buf_list[stream->buf_num] = usb_alloc_coherent(
233 stream->udev, size, GFP_ATOMIC, 236 stream->udev, size, GFP_ATOMIC,
234 &stream->dma_addr[stream->buf_num]); 237 &stream->dma_addr[stream->buf_num]);
235 if (!stream->buf_list[stream->buf_num]) { 238 if (!stream->buf_list[stream->buf_num]) {
236 pr_debug("%s: alloc buf=%d failed\n", __func__, 239 dev_dbg(&stream->udev->dev, "%s: alloc buf=%d failed\n",
237 stream->buf_num); 240 __func__, stream->buf_num);
238 usb_free_stream_buffers(stream); 241 usb_free_stream_buffers(stream);
239 return -ENOMEM; 242 return -ENOMEM;
240 } 243 }
241 244
242 pr_debug("%s: alloc buf=%d %p (dma %llu)\n", __func__, 245 dev_dbg(&stream->udev->dev, "%s: alloc buf=%d %p (dma %llu)\n",
243 stream->buf_num, 246 __func__, stream->buf_num,
244 stream->buf_list[stream->buf_num], 247 stream->buf_list[stream->buf_num],
245 (long long)stream->dma_addr[stream->buf_num]); 248 (long long)stream->dma_addr[stream->buf_num]);
246 memset(stream->buf_list[stream->buf_num], 0, size); 249 memset(stream->buf_list[stream->buf_num], 0, size);
@@ -264,14 +267,15 @@ int usb_urb_reconfig(struct usb_data_stream *stream,
264 } else if (props->type == USB_ISOC) { 267 } else if (props->type == USB_ISOC) {
265 buf_size = props->u.isoc.framesize * props->u.isoc.framesperurb; 268 buf_size = props->u.isoc.framesize * props->u.isoc.framesperurb;
266 } else { 269 } else {
267 pr_err("%s: invalid endpoint type=%d\n", KBUILD_MODNAME, 270 dev_err(&stream->udev->dev, "%s: invalid endpoint type=%d\n",
268 props->type); 271 KBUILD_MODNAME, props->type);
269 return -EINVAL; 272 return -EINVAL;
270 } 273 }
271 274
272 if (stream->buf_num < props->count || stream->buf_size < buf_size) { 275 if (stream->buf_num < props->count || stream->buf_size < buf_size) {
273 pr_err("%s: cannot reconfigure as allocated buffers are too " \ 276 dev_err(&stream->udev->dev, "%s: cannot reconfigure as " \
274 "small\n", KBUILD_MODNAME); 277 "allocated buffers are too small\n",
278 KBUILD_MODNAME);
275 return -EINVAL; 279 return -EINVAL;
276 } 280 }
277 281
@@ -293,7 +297,7 @@ int usb_urb_reconfig(struct usb_data_stream *stream,
293 return 0; 297 return 0;
294 } 298 }
295 299
296 pr_debug("%s: re-alloc urbs\n", __func__); 300 dev_dbg(&stream->udev->dev, "%s: re-alloc urbs\n", __func__);
297 301
298 usb_urb_free_urbs(stream); 302 usb_urb_free_urbs(stream);
299 memcpy(&stream->props, props, sizeof(*props)); 303 memcpy(&stream->props, props, sizeof(*props));
@@ -319,8 +323,8 @@ int usb_urb_initv2(struct usb_data_stream *stream,
319 stream->props.endpoint)); 323 stream->props.endpoint));
320 324
321 if (!stream->complete) { 325 if (!stream->complete) {
322 pr_err("%s: there is no data callback - this doesn't make " \ 326 dev_err(&stream->udev->dev, "%s: there is no data callback - " \
323 "sense\n", KBUILD_MODNAME); 327 "this doesn't make sense\n", KBUILD_MODNAME);
324 return -EINVAL; 328 return -EINVAL;
325 } 329 }
326 330
@@ -341,8 +345,8 @@ int usb_urb_initv2(struct usb_data_stream *stream,
341 345
342 return usb_urb_alloc_isoc_urbs(stream); 346 return usb_urb_alloc_isoc_urbs(stream);
343 default: 347 default:
344 pr_err("%s: unknown urb-type for data transfer\n", 348 dev_err(&stream->udev->dev, "%s: unknown urb-type for data " \
345 KBUILD_MODNAME); 349 "transfer\n", KBUILD_MODNAME);
346 return -EINVAL; 350 return -EINVAL;
347 } 351 }
348} 352}