aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/siano/smsusb.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-06-19 19:35:21 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:22:37 -0400
commita0c0abcb1fdb316dee3a38cff9843d7d094c327c (patch)
tree6f6284afd5940e43df2b8004b3bed789fef09ba6 /drivers/media/dvb/siano/smsusb.c
parent068d6c0f5d6c67d0e93f8e214897ddd64746be4e (diff)
V4L/DVB (8294): sms1xxx: move message formatting into printk macros
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/siano/smsusb.c')
-rw-r--r--drivers/media/dvb/siano/smsusb.c90
1 files changed, 42 insertions, 48 deletions
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index 34e60482facb..01f5c74c41e9 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -60,8 +60,8 @@ void smsusb_onresponse(struct urb *urb)
60 struct smsusb_device_t *dev = surb->dev; 60 struct smsusb_device_t *dev = surb->dev;
61 61
62 if (urb->status < 0) { 62 if (urb->status < 0) {
63 sms_info("%s error, urb status %d, %d bytes\n", 63 sms_info("error, urb status %d, %d bytes",
64 __func__, urb->status, urb->actual_length); 64 urb->status, urb->actual_length);
65 return; 65 return;
66 } 66 }
67 67
@@ -81,9 +81,9 @@ void smsusb_onresponse(struct urb *urb)
81 /* sanity check */ 81 /* sanity check */
82 if (((int) phdr->msgLength + 82 if (((int) phdr->msgLength +
83 surb->cb->offset) > urb->actual_length) { 83 surb->cb->offset) > urb->actual_length) {
84 sms_info("%s: invalid response " 84 sms_info("invalid response "
85 "msglen %d offset %d " 85 "msglen %d offset %d "
86 "size %d\n", __func__, 86 "size %d",
87 phdr->msgLength, 87 phdr->msgLength,
88 surb->cb->offset, 88 surb->cb->offset,
89 urb->actual_length); 89 urb->actual_length);
@@ -100,8 +100,8 @@ void smsusb_onresponse(struct urb *urb)
100 smscore_onresponse(dev->coredev, surb->cb); 100 smscore_onresponse(dev->coredev, surb->cb);
101 surb->cb = NULL; 101 surb->cb = NULL;
102 } else { 102 } else {
103 sms_info("%s invalid response " 103 sms_info("invalid response "
104 "msglen %d actual %d\n", __func__, 104 "msglen %d actual %d",
105 phdr->msgLength, urb->actual_length); 105 phdr->msgLength, urb->actual_length);
106 } 106 }
107 } 107 }
@@ -115,8 +115,8 @@ int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb)
115 if (!surb->cb) { 115 if (!surb->cb) {
116 surb->cb = smscore_getbuffer(dev->coredev); 116 surb->cb = smscore_getbuffer(dev->coredev);
117 if (!surb->cb) { 117 if (!surb->cb) {
118 sms_info("%s smscore_getbuffer(...) " 118 sms_info("smscore_getbuffer(...) "
119 "returned NULL\n", __func__); 119 "returned NULL");
120 return -ENOMEM; 120 return -ENOMEM;
121 } 121 }
122 } 122 }
@@ -157,8 +157,8 @@ int smsusb_start_streaming(struct smsusb_device_t *dev)
157 for (i = 0; i < MAX_URBS; i++) { 157 for (i = 0; i < MAX_URBS; i++) {
158 rc = smsusb_submit_urb(dev, &dev->surbs[i]); 158 rc = smsusb_submit_urb(dev, &dev->surbs[i]);
159 if (rc < 0) { 159 if (rc < 0) {
160 sms_info("%s smsusb_submit_urb(...) " 160 sms_info("smsusb_submit_urb(...) "
161 "failed\n", __func__); 161 "failed");
162 smsusb_stop_streaming(dev); 162 smsusb_stop_streaming(dev);
163 break; 163 break;
164 } 164 }
@@ -191,15 +191,14 @@ int smsusb1_load_firmware(struct usb_device *udev, int id)
191 int rc, dummy; 191 int rc, dummy;
192 192
193 if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { 193 if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) {
194 sms_info("%s invalid firmware id specified %d\n", 194 sms_info("invalid firmware id specified %d", id);
195 __func__, id);
196 return -EINVAL; 195 return -EINVAL;
197 } 196 }
198 197
199 rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev); 198 rc = request_firmware(&fw, smsusb1_fw_lkup[id], &udev->dev);
200 if (rc < 0) { 199 if (rc < 0) {
201 sms_info("%s failed to open \"%s\" mode %d\n", 200 sms_info("failed to open \"%s\" mode %d",
202 __func__, smsusb1_fw_lkup[id], id); 201 smsusb1_fw_lkup[id], id);
203 return rc; 202 return rc;
204 } 203 }
205 204
@@ -210,12 +209,11 @@ int smsusb1_load_firmware(struct usb_device *udev, int id)
210 rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), 209 rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2),
211 fw_buffer, fw->size, &dummy, 1000); 210 fw_buffer, fw->size, &dummy, 1000);
212 211
213 sms_info("%s: sent %d(%d) bytes, rc %d\n", 212 sms_info("sent %d(%d) bytes, rc %d", fw->size, dummy, rc);
214 __func__, fw->size, dummy, rc);
215 213
216 kfree(fw_buffer); 214 kfree(fw_buffer);
217 } else { 215 } else {
218 sms_info("failed to allocate firmware buffer\n"); 216 sms_info("failed to allocate firmware buffer");
219 rc = -ENOMEM; 217 rc = -ENOMEM;
220 } 218 }
221 219
@@ -233,7 +231,7 @@ void smsusb1_detectmode(void *context, int *mode)
233 231
234 if (!product_string) { 232 if (!product_string) {
235 product_string = "none"; 233 product_string = "none";
236 sms_err("%s product string not found\n", __func__); 234 sms_err("product string not found");
237 } else if (strstr(product_string, "DVBH")) 235 } else if (strstr(product_string, "DVBH"))
238 *mode = 1; 236 *mode = 1;
239 else if (strstr(product_string, "BDA")) 237 else if (strstr(product_string, "BDA"))
@@ -243,7 +241,7 @@ void smsusb1_detectmode(void *context, int *mode)
243 else if (strstr(product_string, "TDMB")) 241 else if (strstr(product_string, "TDMB"))
244 *mode = 2; 242 *mode = 2;
245 243
246 sms_info("%s: %d \"%s\"\n", __func__, *mode, product_string); 244 sms_info("%d \"%s\"", *mode, product_string);
247} 245}
248 246
249int smsusb1_setmode(void *context, int mode) 247int smsusb1_setmode(void *context, int mode)
@@ -252,8 +250,7 @@ int smsusb1_setmode(void *context, int mode)
252 sizeof(struct SmsMsgHdr_ST), 0 }; 250 sizeof(struct SmsMsgHdr_ST), 0 };
253 251
254 if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { 252 if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) {
255 sms_info("%s invalid firmware id specified %d\n", 253 sms_info("invalid firmware id specified %d", mode);
256 __func__, mode);
257 return -EINVAL; 254 return -EINVAL;
258 } 255 }
259 256
@@ -274,7 +271,7 @@ void smsusb_term_device(struct usb_interface *intf)
274 271
275 kfree(dev); 272 kfree(dev);
276 273
277 sms_info("%s device %p destroyed\n", __func__, dev); 274 sms_info("device %p destroyed", dev);
278 } 275 }
279 276
280 usb_set_intfdata(intf, NULL); 277 usb_set_intfdata(intf, NULL);
@@ -290,8 +287,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id)
290 /* create device object */ 287 /* create device object */
291 dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); 288 dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL);
292 if (!dev) { 289 if (!dev) {
293 sms_info("%s kzalloc(sizeof(struct smsusb_device_t) " 290 sms_info("kzalloc(sizeof(struct smsusb_device_t) "
294 "failed\n", __func__); 291 "failed");
295 return -ENOMEM; 292 return -ENOMEM;
296 } 293 }
297 294
@@ -309,25 +306,24 @@ int smsusb_init_device(struct usb_interface *intf, int board_id)
309 params.setmode_handler = smsusb1_setmode; 306 params.setmode_handler = smsusb1_setmode;
310 params.detectmode_handler = smsusb1_detectmode; 307 params.detectmode_handler = smsusb1_detectmode;
311 params.device_type = SMS_STELLAR; 308 params.device_type = SMS_STELLAR;
312 sms_info("%s stellar device found\n", __func__); 309 sms_info("stellar device found");
313 break; 310 break;
314 default: 311 default:
315 switch (board->type) { 312 switch (board->type) {
316 case SMS_NOVA_A0: 313 case SMS_NOVA_A0:
317 params.device_type = SMS_NOVA_A0; 314 params.device_type = SMS_NOVA_A0;
318 sms_info("%s nova A0 found\n", __func__); 315 sms_info("nova A0 found");
319 break; 316 break;
320 case SMS_NOVA_B0: 317 case SMS_NOVA_B0:
321 params.device_type = SMS_NOVA_B0; 318 params.device_type = SMS_NOVA_B0;
322 sms_info("%s nova B0 found\n", __func__); 319 sms_info("nova B0 found");
323 break; 320 break;
324 case SMS_VEGA: 321 case SMS_VEGA:
325 params.device_type = SMS_VEGA; 322 params.device_type = SMS_VEGA;
326 sms_info("%s Vega found\n", __func__); 323 sms_info("Vega found");
327 break; 324 break;
328 default: 325 default:
329 sms_err("%s Unspecified sms device type!\n", 326 sms_err("Unspecified sms device type!");
330 __func__);
331 } 327 }
332 328
333 dev->buffer_size = USB2_BUFFER_SIZE; 329 dev->buffer_size = USB2_BUFFER_SIZE;
@@ -350,8 +346,8 @@ int smsusb_init_device(struct usb_interface *intf, int board_id)
350 /* register in smscore */ 346 /* register in smscore */
351 rc = smscore_register_device(&params, &dev->coredev); 347 rc = smscore_register_device(&params, &dev->coredev);
352 if (rc < 0) { 348 if (rc < 0) {
353 sms_info("%s smscore_register_device(...) failed, " 349 sms_info("smscore_register_device(...) failed, "
354 "rc %d\n", __func__, rc); 350 "rc %d", rc);
355 smsusb_term_device(intf); 351 smsusb_term_device(intf);
356 return rc; 352 return rc;
357 } 353 }
@@ -364,24 +360,22 @@ int smsusb_init_device(struct usb_interface *intf, int board_id)
364 usb_init_urb(&dev->surbs[i].urb); 360 usb_init_urb(&dev->surbs[i].urb);
365 } 361 }
366 362
367 sms_info("%s smsusb_start_streaming(...).\n", __func__); 363 sms_info("smsusb_start_streaming(...).");
368 rc = smsusb_start_streaming(dev); 364 rc = smsusb_start_streaming(dev);
369 if (rc < 0) { 365 if (rc < 0) {
370 sms_info("%s smsusb_start_streaming(...) failed\n", 366 sms_info("smsusb_start_streaming(...) failed");
371 __func__);
372 smsusb_term_device(intf); 367 smsusb_term_device(intf);
373 return rc; 368 return rc;
374 } 369 }
375 370
376 rc = smscore_start_device(dev->coredev); 371 rc = smscore_start_device(dev->coredev);
377 if (rc < 0) { 372 if (rc < 0) {
378 sms_info("%s smscore_start_device(...) failed\n", 373 sms_info("smscore_start_device(...) failed");
379 __func__);
380 smsusb_term_device(intf); 374 smsusb_term_device(intf);
381 return rc; 375 return rc;
382 } 376 }
383 377
384 sms_info("%s device %p created\n", __func__, dev); 378 sms_info("device %p created", dev);
385 379
386 return rc; 380 return rc;
387} 381}
@@ -399,36 +393,36 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
399 rc = usb_set_interface( 393 rc = usb_set_interface(
400 udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); 394 udev, intf->cur_altsetting->desc.bInterfaceNumber, 0);
401 if (rc < 0) { 395 if (rc < 0) {
402 sms_info("%s usb_set_interface failed, " 396 sms_info("usb_set_interface failed, "
403 "rc %d\n", __func__, rc); 397 "rc %d", rc);
404 return rc; 398 return rc;
405 } 399 }
406 } 400 }
407 401
408 sms_info("smsusb_probe %d\n", 402 sms_info("smsusb_probe %d",
409 intf->cur_altsetting->desc.bInterfaceNumber); 403 intf->cur_altsetting->desc.bInterfaceNumber);
410 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) 404 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++)
411 sms_info("endpoint %d %02x %02x %d\n", i, 405 sms_info("endpoint %d %02x %02x %d", i,
412 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, 406 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
413 intf->cur_altsetting->endpoint[i].desc.bmAttributes, 407 intf->cur_altsetting->endpoint[i].desc.bmAttributes,
414 intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); 408 intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
415 409
416 if ((udev->actconfig->desc.bNumInterfaces == 2) && 410 if ((udev->actconfig->desc.bNumInterfaces == 2) &&
417 (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { 411 (intf->cur_altsetting->desc.bInterfaceNumber == 0)) {
418 sms_info("rom interface 0 is not used\n"); 412 sms_info("rom interface 0 is not used");
419 return -ENODEV; 413 return -ENODEV;
420 } 414 }
421 415
422 if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { 416 if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
423 snprintf(devpath, sizeof(devpath), "usb\\%d-%s", 417 snprintf(devpath, sizeof(devpath), "usb\\%d-%s",
424 udev->bus->busnum, udev->devpath); 418 udev->bus->busnum, udev->devpath);
425 sms_info("stellar device was found.\n"); 419 sms_info("stellar device was found.");
426 return smsusb1_load_firmware( 420 return smsusb1_load_firmware(
427 udev, smscore_registry_getmode(devpath)); 421 udev, smscore_registry_getmode(devpath));
428 } 422 }
429 423
430 rc = smsusb_init_device(intf, id->driver_info); 424 rc = smsusb_init_device(intf, id->driver_info);
431 sms_info("%s rc %d\n", __func__, rc); 425 sms_info("rc %d", rc);
432 return rc; 426 return rc;
433} 427}
434 428
@@ -448,16 +442,16 @@ int smsusb_register(void)
448{ 442{
449 int rc = usb_register(&smsusb_driver); 443 int rc = usb_register(&smsusb_driver);
450 if (rc) 444 if (rc)
451 sms_info("usb_register failed. Error number %d\n", rc); 445 sms_info("usb_register failed. Error number %d", rc);
452 446
453 sms_info("%s\n", __func__); 447 sms_debug("");
454 448
455 return rc; 449 return rc;
456} 450}
457 451
458void smsusb_unregister(void) 452void smsusb_unregister(void)
459{ 453{
460 sms_debug("%s\n", __func__); 454 sms_debug("");
461 /* Regular USB Cleanup */ 455 /* Regular USB Cleanup */
462 usb_deregister(&smsusb_driver); 456 usb_deregister(&smsusb_driver);
463} 457}