aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-02 05:21:44 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-03 12:57:54 -0500
commitb7085c08647598aafbf8f6223ebcdd413745449c (patch)
tree7b5cd24fc88f58be58b0346542dac2c44c710d05
parent77e97ba2da47fe75bb9a835bb43a29e046c60f99 (diff)
[media] cx231xx: convert from pr_foo to dev_foo
Replace all pr_foo occurrences by dev_foo, as this is the recommended way for drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-417.c38
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-audio.c44
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-avcore.c213
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-cards.c125
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-core.c73
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-dvb.c14
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-i2c.c19
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-input.c1
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c43
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-vbi.c36
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-video.c62
-rw-r--r--drivers/media/usb/cx231xx/cx231xx.h3
12 files changed, 395 insertions, 276 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
index a0d1156d1df1..0773da4dc29b 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -39,7 +39,6 @@
39#include <media/v4l2-event.h> 39#include <media/v4l2-event.h>
40#include <media/cx2341x.h> 40#include <media/cx2341x.h>
41#include <media/tuner.h> 41#include <media/tuner.h>
42#include <linux/usb.h>
43 42
44#define CX231xx_FIRM_IMAGE_SIZE 376836 43#define CX231xx_FIRM_IMAGE_SIZE 376836
45#define CX231xx_FIRM_IMAGE_NAME "v4l-cx23885-enc.fw" 44#define CX231xx_FIRM_IMAGE_NAME "v4l-cx23885-enc.fw"
@@ -988,7 +987,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
988 IVTV_REG_APU, 0); 987 IVTV_REG_APU, 0);
989 988
990 if (retval != 0) { 989 if (retval != 0) {
991 pr_err("%s: Error with mc417_register_write\n", __func__); 990 dev_err(&dev->udev->dev,
991 "%s: Error with mc417_register_write\n", __func__);
992 return -1; 992 return -1;
993 } 993 }
994 994
@@ -996,21 +996,25 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
996 &dev->udev->dev); 996 &dev->udev->dev);
997 997
998 if (retval != 0) { 998 if (retval != 0) {
999 pr_err("ERROR: Hotplug firmware request failed (%s).\n", 999 dev_err(&dev->udev->dev,
1000 "ERROR: Hotplug firmware request failed (%s).\n",
1000 CX231xx_FIRM_IMAGE_NAME); 1001 CX231xx_FIRM_IMAGE_NAME);
1001 pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n"); 1002 dev_err(&dev->udev->dev,
1003 "Please fix your hotplug setup, the board will not work without firmware loaded!\n");
1002 return -1; 1004 return -1;
1003 } 1005 }
1004 1006
1005 if (firmware->size != CX231xx_FIRM_IMAGE_SIZE) { 1007 if (firmware->size != CX231xx_FIRM_IMAGE_SIZE) {
1006 pr_err("ERROR: Firmware size mismatch (have %zd, expected %d)\n", 1008 dev_err(&dev->udev->dev,
1009 "ERROR: Firmware size mismatch (have %zd, expected %d)\n",
1007 firmware->size, CX231xx_FIRM_IMAGE_SIZE); 1010 firmware->size, CX231xx_FIRM_IMAGE_SIZE);
1008 release_firmware(firmware); 1011 release_firmware(firmware);
1009 return -1; 1012 return -1;
1010 } 1013 }
1011 1014
1012 if (0 != memcmp(firmware->data, magic, 8)) { 1015 if (0 != memcmp(firmware->data, magic, 8)) {
1013 pr_err("ERROR: Firmware magic mismatch, wrong file?\n"); 1016 dev_err(&dev->udev->dev,
1017 "ERROR: Firmware magic mismatch, wrong file?\n");
1014 release_firmware(firmware); 1018 release_firmware(firmware);
1015 return -1; 1019 return -1;
1016 } 1020 }
@@ -1057,7 +1061,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
1057 retval |= mc417_register_write(dev, IVTV_REG_HW_BLOCKS, 1061 retval |= mc417_register_write(dev, IVTV_REG_HW_BLOCKS,
1058 IVTV_CMD_HW_BLOCKS_RST); 1062 IVTV_CMD_HW_BLOCKS_RST);
1059 if (retval < 0) { 1063 if (retval < 0) {
1060 pr_err("%s: Error with mc417_register_write\n", 1064 dev_err(&dev->udev->dev,
1065 "%s: Error with mc417_register_write\n",
1061 __func__); 1066 __func__);
1062 return retval; 1067 return retval;
1063 } 1068 }
@@ -1069,7 +1074,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
1069 retval |= mc417_register_write(dev, IVTV_REG_VPU, value & 0xFFFFFFE8); 1074 retval |= mc417_register_write(dev, IVTV_REG_VPU, value & 0xFFFFFFE8);
1070 1075
1071 if (retval < 0) { 1076 if (retval < 0) {
1072 pr_err("%s: Error with mc417_register_write\n", 1077 dev_err(&dev->udev->dev,
1078 "%s: Error with mc417_register_write\n",
1073 __func__); 1079 __func__);
1074 return retval; 1080 return retval;
1075 } 1081 }
@@ -1117,25 +1123,28 @@ static int cx231xx_initialize_codec(struct cx231xx *dev)
1117 dprintk(2, "%s: PING OK\n", __func__); 1123 dprintk(2, "%s: PING OK\n", __func__);
1118 retval = cx231xx_load_firmware(dev); 1124 retval = cx231xx_load_firmware(dev);
1119 if (retval < 0) { 1125 if (retval < 0) {
1120 pr_err("%s: f/w load failed\n", __func__); 1126 dev_err(&dev->udev->dev,
1127 "%s: f/w load failed\n", __func__);
1121 return retval; 1128 return retval;
1122 } 1129 }
1123 retval = cx231xx_find_mailbox(dev); 1130 retval = cx231xx_find_mailbox(dev);
1124 if (retval < 0) { 1131 if (retval < 0) {
1125 pr_err("%s: mailbox < 0, error\n", 1132 dev_err(&dev->udev->dev, "%s: mailbox < 0, error\n",
1126 __func__); 1133 __func__);
1127 return -1; 1134 return -1;
1128 } 1135 }
1129 dev->cx23417_mailbox = retval; 1136 dev->cx23417_mailbox = retval;
1130 retval = cx231xx_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); 1137 retval = cx231xx_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0);
1131 if (retval < 0) { 1138 if (retval < 0) {
1132 pr_err("ERROR: cx23417 firmware ping failed!\n"); 1139 dev_err(&dev->udev->dev,
1140 "ERROR: cx23417 firmware ping failed!\n");
1133 return -1; 1141 return -1;
1134 } 1142 }
1135 retval = cx231xx_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1, 1143 retval = cx231xx_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1,
1136 &version); 1144 &version);
1137 if (retval < 0) { 1145 if (retval < 0) {
1138 pr_err("ERROR: cx23417 firmware get encoder: version failed!\n"); 1146 dev_err(&dev->udev->dev,
1147 "ERROR: cx23417 firmware get encoder: version failed!\n");
1139 return -1; 1148 return -1;
1140 } 1149 }
1141 dprintk(1, "cx23417 firmware version is 0x%08x\n", version); 1150 dprintk(1, "cx23417 firmware version is 0x%08x\n", version);
@@ -1416,8 +1425,9 @@ static int bb_buf_prepare(struct videobuf_queue *q,
1416 if (!dev->video_mode.bulk_ctl.num_bufs) 1425 if (!dev->video_mode.bulk_ctl.num_bufs)
1417 urb_init = 1; 1426 urb_init = 1;
1418 } 1427 }
1419 /*pr_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n", 1428 dev_dbg(&dev->udev->dev,
1420 urb_init, dev->video_mode.max_pkt_size);*/ 1429 "urb_init=%d dev->video_mode.max_pkt_size=%d\n",
1430 urb_init, dev->video_mode.max_pkt_size);
1421 dev->mode_tv = 1; 1431 dev->mode_tv = 1;
1422 1432
1423 if (urb_init) { 1433 if (urb_init) {
diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c
index e96703180c0c..1c3f68179fc9 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -22,7 +22,6 @@
22 22
23#include "cx231xx.h" 23#include "cx231xx.h"
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/usb.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/sound.h> 26#include <linux/sound.h>
28#include <linux/spinlock.h> 27#include <linux/spinlock.h>
@@ -182,8 +181,9 @@ static void cx231xx_audio_isocirq(struct urb *urb)
182 181
183 status = usb_submit_urb(urb, GFP_ATOMIC); 182 status = usb_submit_urb(urb, GFP_ATOMIC);
184 if (status < 0) { 183 if (status < 0) {
185 pr_err("resubmit of audio urb failed (error=%i)\n", 184 dev_err(&dev->udev->dev,
186 status); 185 "resubmit of audio urb failed (error=%i)\n",
186 status);
187 } 187 }
188 return; 188 return;
189} 189}
@@ -266,8 +266,9 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
266 266
267 status = usb_submit_urb(urb, GFP_ATOMIC); 267 status = usb_submit_urb(urb, GFP_ATOMIC);
268 if (status < 0) { 268 if (status < 0) {
269 pr_err("resubmit of audio urb failed (error=%i)\n", 269 dev_err(&dev->udev->dev,
270 status); 270 "resubmit of audio urb failed (error=%i)\n",
271 status);
271 } 272 }
272 return; 273 return;
273} 274}
@@ -277,7 +278,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
277 int i, errCode; 278 int i, errCode;
278 int sb_size; 279 int sb_size;
279 280
280 pr_debug("%s: Starting ISO AUDIO transfers\n", __func__); 281 dev_dbg(&dev->udev->dev,
282 "%s: Starting ISO AUDIO transfers\n", __func__);
281 283
282 if (dev->state & DEV_DISCONNECTED) 284 if (dev->state & DEV_DISCONNECTED)
283 return -ENODEV; 285 return -ENODEV;
@@ -295,7 +297,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
295 memset(dev->adev.transfer_buffer[i], 0x80, sb_size); 297 memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
296 urb = usb_alloc_urb(CX231XX_ISO_NUM_AUDIO_PACKETS, GFP_ATOMIC); 298 urb = usb_alloc_urb(CX231XX_ISO_NUM_AUDIO_PACKETS, GFP_ATOMIC);
297 if (!urb) { 299 if (!urb) {
298 pr_err("usb_alloc_urb failed!\n"); 300 dev_err(&dev->udev->dev, "usb_alloc_urb failed!\n");
299 for (j = 0; j < i; j++) { 301 for (j = 0; j < i; j++) {
300 usb_free_urb(dev->adev.urb[j]); 302 usb_free_urb(dev->adev.urb[j]);
301 kfree(dev->adev.transfer_buffer[j]); 303 kfree(dev->adev.transfer_buffer[j]);
@@ -338,7 +340,8 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
338 int i, errCode; 340 int i, errCode;
339 int sb_size; 341 int sb_size;
340 342
341 pr_debug("%s: Starting BULK AUDIO transfers\n", __func__); 343 dev_dbg(&dev->udev->dev,
344 "%s: Starting BULK AUDIO transfers\n", __func__);
342 345
343 if (dev->state & DEV_DISCONNECTED) 346 if (dev->state & DEV_DISCONNECTED)
344 return -ENODEV; 347 return -ENODEV;
@@ -356,7 +359,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
356 memset(dev->adev.transfer_buffer[i], 0x80, sb_size); 359 memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
357 urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); 360 urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
358 if (!urb) { 361 if (!urb) {
359 pr_err("usb_alloc_urb failed!\n"); 362 dev_err(&dev->udev->dev, "usb_alloc_urb failed!\n");
360 for (j = 0; j < i; j++) { 363 for (j = 0; j < i; j++) {
361 usb_free_urb(dev->adev.urb[j]); 364 usb_free_urb(dev->adev.urb[j]);
362 kfree(dev->adev.transfer_buffer[j]); 365 kfree(dev->adev.transfer_buffer[j]);
@@ -439,12 +442,14 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
439 dprintk("opening device and trying to acquire exclusive lock\n"); 442 dprintk("opening device and trying to acquire exclusive lock\n");
440 443
441 if (!dev) { 444 if (!dev) {
442 pr_err("BUG: cx231xx can't find device struct. Can't proceed with open\n"); 445 dev_err(&dev->udev->dev,
446 "BUG: cx231xx can't find device struct. Can't proceed with open\n");
443 return -ENODEV; 447 return -ENODEV;
444 } 448 }
445 449
446 if (dev->state & DEV_DISCONNECTED) { 450 if (dev->state & DEV_DISCONNECTED) {
447 pr_err("Can't open. the device was removed.\n"); 451 dev_err(&dev->udev->dev,
452 "Can't open. the device was removed.\n");
448 return -ENODEV; 453 return -ENODEV;
449 } 454 }
450 455
@@ -457,7 +462,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
457 ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); 462 ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
458 mutex_unlock(&dev->lock); 463 mutex_unlock(&dev->lock);
459 if (ret < 0) { 464 if (ret < 0) {
460 pr_err("failed to set alternate setting !\n"); 465 dev_err(&dev->udev->dev,
466 "failed to set alternate setting !\n");
461 467
462 return ret; 468 return ret;
463 } 469 }
@@ -493,7 +499,8 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
493 /* 1 - 48000 samples per sec */ 499 /* 1 - 48000 samples per sec */
494 ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); 500 ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
495 if (ret < 0) { 501 if (ret < 0) {
496 pr_err("failed to set alternate setting !\n"); 502 dev_err(&dev->udev->dev,
503 "failed to set alternate setting !\n");
497 504
498 mutex_unlock(&dev->lock); 505 mutex_unlock(&dev->lock);
499 return ret; 506 return ret;
@@ -661,7 +668,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
661 return 0; 668 return 0;
662 } 669 }
663 670
664 pr_debug("probing for cx231xx non standard usbaudio\n"); 671 dev_dbg(&dev->udev->dev,
672 "probing for cx231xx non standard usbaudio\n");
665 673
666 err = snd_card_new(&dev->udev->dev, index[devnr], "Cx231xx Audio", 674 err = snd_card_new(&dev->udev->dev, index[devnr], "Cx231xx Audio",
667 THIS_MODULE, 0, &card); 675 THIS_MODULE, 0, &card);
@@ -705,7 +713,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
705 bEndpointAddress; 713 bEndpointAddress;
706 714
707 adev->num_alt = uif->num_altsetting; 715 adev->num_alt = uif->num_altsetting;
708 pr_info("audio EndPoint Addr 0x%x, Alternate settings: %i\n", 716 dev_info(&dev->udev->dev,
717 "audio EndPoint Addr 0x%x, Alternate settings: %i\n",
709 adev->end_point_addr, adev->num_alt); 718 adev->end_point_addr, adev->num_alt);
710 adev->alt_max_pkt_size = kmalloc(32 * adev->num_alt, GFP_KERNEL); 719 adev->alt_max_pkt_size = kmalloc(32 * adev->num_alt, GFP_KERNEL);
711 720
@@ -718,8 +727,9 @@ static int cx231xx_audio_init(struct cx231xx *dev)
718 wMaxPacketSize); 727 wMaxPacketSize);
719 adev->alt_max_pkt_size[i] = 728 adev->alt_max_pkt_size[i] =
720 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); 729 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
721 pr_debug("audio alternate setting %i, max size= %i\n", i, 730 dev_dbg(&dev->udev->dev,
722 adev->alt_max_pkt_size[i]); 731 "audio alternate setting %i, max size= %i\n", i,
732 adev->alt_max_pkt_size[i]);
723 } 733 }
724 734
725 return 0; 735 return 0;
diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c
index 62c63b9e2291..9088a32db2d1 100644
--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
+++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
@@ -28,7 +28,6 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/bitmap.h> 30#include <linux/bitmap.h>
31#include <linux/usb.h>
32#include <linux/i2c.h> 31#include <linux/i2c.h>
33#include <linux/mm.h> 32#include <linux/mm.h>
34#include <linux/mutex.h> 33#include <linux/mutex.h>
@@ -83,10 +82,10 @@ void initGPIO(struct cx231xx *dev)
83 cx231xx_send_gpio_cmd(dev, _gpio_direction, (u8 *)&value, 4, 0, 0); 82 cx231xx_send_gpio_cmd(dev, _gpio_direction, (u8 *)&value, 4, 0, 0);
84 83
85 verve_read_byte(dev, 0x07, &val); 84 verve_read_byte(dev, 0x07, &val);
86 pr_debug("verve_read_byte address0x07=0x%x\n", val); 85 dev_dbg(&dev->udev->dev, "verve_read_byte address0x07=0x%x\n", val);
87 verve_write_byte(dev, 0x07, 0xF4); 86 verve_write_byte(dev, 0x07, 0xF4);
88 verve_read_byte(dev, 0x07, &val); 87 verve_read_byte(dev, 0x07, &val);
89 pr_debug("verve_read_byte address0x07=0x%x\n", val); 88 dev_dbg(&dev->udev->dev, "verve_read_byte address0x07=0x%x\n", val);
90 89
91 cx231xx_capture_start(dev, 1, Vbi); 90 cx231xx_capture_start(dev, 1, Vbi);
92 91
@@ -156,7 +155,8 @@ int cx231xx_afe_init_super_block(struct cx231xx *dev, u32 ref_count)
156 while (afe_power_status != 0x18) { 155 while (afe_power_status != 0x18) {
157 status = afe_write_byte(dev, SUP_BLK_PWRDN, 0x18); 156 status = afe_write_byte(dev, SUP_BLK_PWRDN, 0x18);
158 if (status < 0) { 157 if (status < 0) {
159 pr_debug("%s: Init Super Block failed in send cmd\n", 158 dev_dbg(&dev->udev->dev,
159 "%s: Init Super Block failed in send cmd\n",
160 __func__); 160 __func__);
161 break; 161 break;
162 } 162 }
@@ -164,13 +164,15 @@ int cx231xx_afe_init_super_block(struct cx231xx *dev, u32 ref_count)
164 status = afe_read_byte(dev, SUP_BLK_PWRDN, &afe_power_status); 164 status = afe_read_byte(dev, SUP_BLK_PWRDN, &afe_power_status);
165 afe_power_status &= 0xff; 165 afe_power_status &= 0xff;
166 if (status < 0) { 166 if (status < 0) {
167 pr_debug("%s: Init Super Block failed in receive cmd\n", 167 dev_dbg(&dev->udev->dev,
168 "%s: Init Super Block failed in receive cmd\n",
168 __func__); 169 __func__);
169 break; 170 break;
170 } 171 }
171 i++; 172 i++;
172 if (i == 10) { 173 if (i == 10) {
173 pr_debug("%s: Init Super Block force break in loop !!!!\n", 174 dev_dbg(&dev->udev->dev,
175 "%s: Init Super Block force break in loop !!!!\n",
174 __func__); 176 __func__);
175 status = -1; 177 status = -1;
176 break; 178 break;
@@ -410,7 +412,7 @@ int cx231xx_afe_update_power_control(struct cx231xx *dev,
410 status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3, 412 status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
411 0x00); 413 0x00);
412 } else { 414 } else {
413 pr_debug("Invalid AV mode input\n"); 415 dev_dbg(&dev->udev->dev, "Invalid AV mode input\n");
414 status = -1; 416 status = -1;
415 } 417 }
416 break; 418 break;
@@ -467,7 +469,7 @@ int cx231xx_afe_update_power_control(struct cx231xx *dev,
467 status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3, 469 status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
468 0x40); 470 0x40);
469 } else { 471 } else {
470 pr_debug("Invalid AV mode input\n"); 472 dev_dbg(&dev->udev->dev, "Invalid AV mode input\n");
471 status = -1; 473 status = -1;
472 } 474 }
473 } /* switch */ 475 } /* switch */
@@ -573,9 +575,9 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input)
573 status = cx231xx_set_power_mode(dev, 575 status = cx231xx_set_power_mode(dev,
574 POLARIS_AVMODE_ENXTERNAL_AV); 576 POLARIS_AVMODE_ENXTERNAL_AV);
575 if (status < 0) { 577 if (status < 0) {
576 pr_err("%s: set_power_mode : Failed to" 578 dev_err(&dev->udev->dev,
577 " set Power - errCode [%d]!\n", 579 "%s: Failed to set Power - errCode [%d]!\n",
578 __func__, status); 580 __func__, status);
579 return status; 581 return status;
580 } 582 }
581 } 583 }
@@ -591,8 +593,8 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input)
591 status = cx231xx_set_power_mode(dev, 593 status = cx231xx_set_power_mode(dev,
592 POLARIS_AVMODE_ANALOGT_TV); 594 POLARIS_AVMODE_ANALOGT_TV);
593 if (status < 0) { 595 if (status < 0) {
594 pr_err("%s: set_power_mode:Failed" 596 dev_err(&dev->udev->dev,
595 " to set Power - errCode [%d]!\n", 597 "%s: Failed to set Power - errCode [%d]!\n",
596 __func__, status); 598 __func__, status);
597 return status; 599 return status;
598 } 600 }
@@ -608,8 +610,8 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input)
608 610
609 break; 611 break;
610 default: 612 default:
611 pr_err("%s: set_power_mode : Unknown Input %d !\n", 613 dev_err(&dev->udev->dev, "%s: Unknown Input %d !\n",
612 __func__, INPUT(input)->type); 614 __func__, INPUT(input)->type);
613 break; 615 break;
614 } 616 }
615 617
@@ -628,7 +630,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
628 if (pin_type != dev->video_input) { 630 if (pin_type != dev->video_input) {
629 status = cx231xx_afe_adjust_ref_count(dev, pin_type); 631 status = cx231xx_afe_adjust_ref_count(dev, pin_type);
630 if (status < 0) { 632 if (status < 0) {
631 pr_err("%s: adjust_ref_count :Failed to set AFE input mux - errCode [%d]!\n", 633 dev_err(&dev->udev->dev,
634 "%s: adjust_ref_count :Failed to set AFE input mux - errCode [%d]!\n",
632 __func__, status); 635 __func__, status);
633 return status; 636 return status;
634 } 637 }
@@ -637,7 +640,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
637 /* call afe block to set video inputs */ 640 /* call afe block to set video inputs */
638 status = cx231xx_afe_set_input_mux(dev, input); 641 status = cx231xx_afe_set_input_mux(dev, input);
639 if (status < 0) { 642 if (status < 0) {
640 pr_err("%s: set_input_mux :Failed to set AFE input mux - errCode [%d]!\n", 643 dev_err(&dev->udev->dev,
644 "%s: set_input_mux :Failed to set AFE input mux - errCode [%d]!\n",
641 __func__, status); 645 __func__, status);
642 return status; 646 return status;
643 } 647 }
@@ -668,7 +672,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
668 /* Tell DIF object to go to baseband mode */ 672 /* Tell DIF object to go to baseband mode */
669 status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); 673 status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND);
670 if (status < 0) { 674 if (status < 0) {
671 pr_err("%s: cx231xx_dif set to By pass mode- errCode [%d]!\n", 675 dev_err(&dev->udev->dev,
676 "%s: cx231xx_dif set to By pass mode- errCode [%d]!\n",
672 __func__, status); 677 __func__, status);
673 return status; 678 return status;
674 } 679 }
@@ -712,7 +717,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
712 /* Tell DIF object to go to baseband mode */ 717 /* Tell DIF object to go to baseband mode */
713 status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); 718 status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND);
714 if (status < 0) { 719 if (status < 0) {
715 pr_err("%s: cx231xx_dif set to By pass mode- errCode [%d]!\n", 720 dev_err(&dev->udev->dev,
721 "%s: cx231xx_dif set to By pass mode- errCode [%d]!\n",
716 __func__, status); 722 __func__, status);
717 return status; 723 return status;
718 } 724 }
@@ -786,7 +792,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
786 status = cx231xx_dif_set_standard(dev, 792 status = cx231xx_dif_set_standard(dev,
787 DIF_USE_BASEBAND); 793 DIF_USE_BASEBAND);
788 if (status < 0) { 794 if (status < 0) {
789 pr_err("%s: cx231xx_dif set to By pass mode- errCode [%d]!\n", 795 dev_err(&dev->udev->dev,
796 "%s: cx231xx_dif set to By pass mode- errCode [%d]!\n",
790 __func__, status); 797 __func__, status);
791 return status; 798 return status;
792 } 799 }
@@ -821,7 +828,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
821 /* Reinitialize the DIF */ 828 /* Reinitialize the DIF */
822 status = cx231xx_dif_set_standard(dev, dev->norm); 829 status = cx231xx_dif_set_standard(dev, dev->norm);
823 if (status < 0) { 830 if (status < 0) {
824 pr_err("%s: cx231xx_dif set to By pass mode- errCode [%d]!\n", 831 dev_err(&dev->udev->dev,
832 "%s: cx231xx_dif set to By pass mode- errCode [%d]!\n",
825 __func__, status); 833 __func__, status);
826 return status; 834 return status;
827 } 835 }
@@ -964,14 +972,14 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
964{ 972{
965 int status = 0; 973 int status = 0;
966 974
967 pr_debug("%s: 0x%x\n", 975 dev_dbg(&dev->udev->dev, "%s: 0x%x\n",
968 __func__, (unsigned int)dev->norm); 976 __func__, (unsigned int)dev->norm);
969 977
970 /* Change the DFE_CTRL3 bp_percent to fix flagging */ 978 /* Change the DFE_CTRL3 bp_percent to fix flagging */
971 status = vid_blk_write_word(dev, DFE_CTRL3, 0xCD3F0280); 979 status = vid_blk_write_word(dev, DFE_CTRL3, 0xCD3F0280);
972 980
973 if (dev->norm & (V4L2_STD_NTSC | V4L2_STD_PAL_M)) { 981 if (dev->norm & (V4L2_STD_NTSC | V4L2_STD_PAL_M)) {
974 pr_debug("%s: NTSC\n", __func__); 982 dev_dbg(&dev->udev->dev, "%s: NTSC\n", __func__);
975 983
976 /* Move the close caption lines out of active video, 984 /* Move the close caption lines out of active video,
977 adjust the active video start point */ 985 adjust the active video start point */
@@ -998,7 +1006,7 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
998 (FLD_HBLANK_CNT, 0x79)); 1006 (FLD_HBLANK_CNT, 0x79));
999 1007
1000 } else if (dev->norm & V4L2_STD_SECAM) { 1008 } else if (dev->norm & V4L2_STD_SECAM) {
1001 pr_debug("%s: SECAM\n", __func__); 1009 dev_dbg(&dev->udev->dev, "%s: SECAM\n", __func__);
1002 status = cx231xx_read_modify_write_i2c_dword(dev, 1010 status = cx231xx_read_modify_write_i2c_dword(dev,
1003 VID_BLK_I2C_ADDRESS, 1011 VID_BLK_I2C_ADDRESS,
1004 VERT_TIM_CTRL, 1012 VERT_TIM_CTRL,
@@ -1025,7 +1033,7 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
1025 cx231xx_set_field 1033 cx231xx_set_field
1026 (FLD_HBLANK_CNT, 0x85)); 1034 (FLD_HBLANK_CNT, 0x85));
1027 } else { 1035 } else {
1028 pr_debug("%s: PAL\n", __func__); 1036 dev_dbg(&dev->udev->dev, "%s: PAL\n", __func__);
1029 status = cx231xx_read_modify_write_i2c_dword(dev, 1037 status = cx231xx_read_modify_write_i2c_dword(dev,
1030 VID_BLK_I2C_ADDRESS, 1038 VID_BLK_I2C_ADDRESS,
1031 VERT_TIM_CTRL, 1039 VERT_TIM_CTRL,
@@ -1325,111 +1333,129 @@ void cx231xx_dump_HH_reg(struct cx231xx *dev)
1325 1333
1326 for (i = 0x100; i < 0x140; i++) { 1334 for (i = 0x100; i < 0x140; i++) {
1327 vid_blk_read_word(dev, i, &value); 1335 vid_blk_read_word(dev, i, &value);
1328 pr_debug("reg0x%x=0x%x\n", i, value); 1336 dev_dbg(&dev->udev->dev, "reg0x%x=0x%x\n", i, value);
1329 i = i+3; 1337 i = i+3;
1330 } 1338 }
1331 1339
1332 for (i = 0x300; i < 0x400; i++) { 1340 for (i = 0x300; i < 0x400; i++) {
1333 vid_blk_read_word(dev, i, &value); 1341 vid_blk_read_word(dev, i, &value);
1334 pr_debug("reg0x%x=0x%x\n", i, value); 1342 dev_dbg(&dev->udev->dev, "reg0x%x=0x%x\n", i, value);
1335 i = i+3; 1343 i = i+3;
1336 } 1344 }
1337 1345
1338 for (i = 0x400; i < 0x440; i++) { 1346 for (i = 0x400; i < 0x440; i++) {
1339 vid_blk_read_word(dev, i, &value); 1347 vid_blk_read_word(dev, i, &value);
1340 pr_debug("reg0x%x=0x%x\n", i, value); 1348 dev_dbg(&dev->udev->dev, "reg0x%x=0x%x\n", i, value);
1341 i = i+3; 1349 i = i+3;
1342 } 1350 }
1343 1351
1344 vid_blk_read_word(dev, AFE_CTRL_C2HH_SRC_CTRL, &value); 1352 vid_blk_read_word(dev, AFE_CTRL_C2HH_SRC_CTRL, &value);
1345 pr_debug("AFE_CTRL_C2HH_SRC_CTRL=0x%x\n", value); 1353 dev_dbg(&dev->udev->dev, "AFE_CTRL_C2HH_SRC_CTRL=0x%x\n", value);
1346 vid_blk_write_word(dev, AFE_CTRL_C2HH_SRC_CTRL, 0x4485D390); 1354 vid_blk_write_word(dev, AFE_CTRL_C2HH_SRC_CTRL, 0x4485D390);
1347 vid_blk_read_word(dev, AFE_CTRL_C2HH_SRC_CTRL, &value); 1355 vid_blk_read_word(dev, AFE_CTRL_C2HH_SRC_CTRL, &value);
1348 pr_debug("AFE_CTRL_C2HH_SRC_CTRL=0x%x\n", value); 1356 dev_dbg(&dev->udev->dev, "AFE_CTRL_C2HH_SRC_CTRL=0x%x\n", value);
1349} 1357}
1350 1358
1351#if 0 1359#if 0
1352static void cx231xx_dump_SC_reg(struct cx231xx *dev) 1360static void cx231xx_dump_SC_reg(struct cx231xx *dev)
1353{ 1361{
1354 u8 value[4] = { 0, 0, 0, 0 }; 1362 u8 value[4] = { 0, 0, 0, 0 };
1355 pr_debug("%s!\n", __func__); 1363 dev_dbg(&dev->udev->dev, "%s!\n", __func__);
1356 1364
1357 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT, 1365 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT,
1358 value, 4); 1366 value, 4);
1359 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", BOARD_CFG_STAT, value[0], 1367 dev_dbg(&dev->udev->dev,
1360 value[1], value[2], value[3]); 1368 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", BOARD_CFG_STAT, value[0],
1369 value[1], value[2], value[3]);
1361 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS_MODE_REG, 1370 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS_MODE_REG,
1362 value, 4); 1371 value, 4);
1363 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS_MODE_REG, value[0], 1372 dev_dbg(&dev->udev->dev,
1364 value[1], value[2], value[3]); 1373 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS_MODE_REG, value[0],
1374 value[1], value[2], value[3]);
1365 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS1_CFG_REG, 1375 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS1_CFG_REG,
1366 value, 4); 1376 value, 4);
1367 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS1_CFG_REG, value[0], 1377 dev_dbg(&dev->udev->dev,
1368 value[1], value[2], value[3]); 1378 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS1_CFG_REG, value[0],
1379 value[1], value[2], value[3]);
1369 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS1_LENGTH_REG, 1380 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS1_LENGTH_REG,
1370 value, 4); 1381 value, 4);
1371 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS1_LENGTH_REG, value[0], 1382 dev_dbg(&dev->udev->dev,
1372 value[1], value[2], value[3]); 1383 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS1_LENGTH_REG, value[0],
1384 value[1], value[2], value[3]);
1373 1385
1374 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS2_CFG_REG, 1386 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS2_CFG_REG,
1375 value, 4); 1387 value, 4);
1376 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS2_CFG_REG, value[0], 1388 dev_dbg(&dev->udev->dev,
1377 value[1], value[2], value[3]); 1389 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS2_CFG_REG, value[0],
1390 value[1], value[2], value[3]);
1378 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS2_LENGTH_REG, 1391 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS2_LENGTH_REG,
1379 value, 4); 1392 value, 4);
1380 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS2_LENGTH_REG, value[0], 1393 dev_dbg(&dev->udev->dev,
1381 value[1], value[2], value[3]); 1394 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS2_LENGTH_REG, value[0],
1395 value[1], value[2], value[3]);
1382 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET, 1396 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET,
1383 value, 4); 1397 value, 4);
1384 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", EP_MODE_SET, value[0], 1398 dev_dbg(&dev->udev->dev,
1385 value[1], value[2], value[3]); 1399 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", EP_MODE_SET, value[0],
1400 value[1], value[2], value[3]);
1386 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN1, 1401 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN1,
1387 value, 4); 1402 value, 4);
1388 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN1, value[0], 1403 dev_dbg(&dev->udev->dev,
1389 value[1], value[2], value[3]); 1404 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN1, value[0],
1405 value[1], value[2], value[3]);
1390 1406
1391 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN2, 1407 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN2,
1392 value, 4); 1408 value, 4);
1393 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN2, value[0], 1409 dev_dbg(&dev->udev->dev,
1394 value[1], value[2], value[3]); 1410 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN2, value[0],
1411 value[1], value[2], value[3]);
1395 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN3, 1412 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN3,
1396 value, 4); 1413 value, 4);
1397 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN3, value[0], 1414 dev_dbg(&dev->udev->dev,
1398 value[1], value[2], value[3]); 1415 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN3, value[0],
1416 value[1], value[2], value[3]);
1399 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK0, 1417 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK0,
1400 value, 4); 1418 value, 4);
1401 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK0, value[0], 1419 dev_dbg(&dev->udev->dev,
1402 value[1], value[2], value[3]); 1420 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK0, value[0],
1421 value[1], value[2], value[3]);
1403 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK1, 1422 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK1,
1404 value, 4); 1423 value, 4);
1405 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK1, value[0], 1424 dev_dbg(&dev->udev->dev,
1406 value[1], value[2], value[3]); 1425 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK1, value[0],
1426 value[1], value[2], value[3]);
1407 1427
1408 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK2, 1428 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK2,
1409 value, 4); 1429 value, 4);
1410 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK2, value[0], 1430 dev_dbg(&dev->udev->dev,
1411 value[1], value[2], value[3]); 1431 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK2, value[0],
1432 value[1], value[2], value[3]);
1412 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_GAIN, 1433 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_GAIN,
1413 value, 4); 1434 value, 4);
1414 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_GAIN, value[0], 1435 dev_dbg(&dev->udev->dev,
1415 value[1], value[2], value[3]); 1436 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_GAIN, value[0],
1437 value[1], value[2], value[3]);
1416 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_CAR_REG, 1438 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_CAR_REG,
1417 value, 4); 1439 value, 4);
1418 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_CAR_REG, value[0], 1440 dev_dbg(&dev->udev->dev,
1419 value[1], value[2], value[3]); 1441 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_CAR_REG, value[0],
1442 value[1], value[2], value[3]);
1420 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_OT_CFG1, 1443 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_OT_CFG1,
1421 value, 4); 1444 value, 4);
1422 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_OT_CFG1, value[0], 1445 dev_dbg(&dev->udev->dev,
1423 value[1], value[2], value[3]); 1446 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_OT_CFG1, value[0],
1447 value[1], value[2], value[3]);
1424 1448
1425 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_OT_CFG2, 1449 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_OT_CFG2,
1426 value, 4); 1450 value, 4);
1427 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_OT_CFG2, value[0], 1451 dev_dbg(&dev->udev->dev,
1428 value[1], value[2], value[3]); 1452 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_OT_CFG2, value[0],
1453 value[1], value[2], value[3]);
1429 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, 1454 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN,
1430 value, 4); 1455 value, 4);
1431 pr_debug("reg0x%x=0x%x 0x%x 0x%x 0x%x\n", PWR_CTL_EN, value[0], 1456 dev_dbg(&dev->udev->dev,
1432 value[1], value[2], value[3]); 1457 "reg0x%x=0x%x 0x%x 0x%x 0x%x\n", PWR_CTL_EN, value[0],
1458 value[1], value[2], value[3]);
1433} 1459}
1434#endif 1460#endif
1435 1461
@@ -1497,7 +1523,7 @@ void cx231xx_set_Colibri_For_LowIF(struct cx231xx *dev, u32 if_freq,
1497 u32 standard = 0; 1523 u32 standard = 0;
1498 u8 value[4] = { 0, 0, 0, 0 }; 1524 u8 value[4] = { 0, 0, 0, 0 };
1499 1525
1500 pr_debug("Enter cx231xx_set_Colibri_For_LowIF()\n"); 1526 dev_dbg(&dev->udev->dev, "Enter cx231xx_set_Colibri_For_LowIF()\n");
1501 value[0] = (u8) 0x6F; 1527 value[0] = (u8) 0x6F;
1502 value[1] = (u8) 0x6F; 1528 value[1] = (u8) 0x6F;
1503 value[2] = (u8) 0x6F; 1529 value[2] = (u8) 0x6F;
@@ -1517,7 +1543,7 @@ void cx231xx_set_Colibri_For_LowIF(struct cx231xx *dev, u32 if_freq,
1517 colibri_carrier_offset = cx231xx_Get_Colibri_CarrierOffset(mode, 1543 colibri_carrier_offset = cx231xx_Get_Colibri_CarrierOffset(mode,
1518 standard); 1544 standard);
1519 1545
1520 pr_debug("colibri_carrier_offset=%d, standard=0x%x\n", 1546 dev_dbg(&dev->udev->dev, "colibri_carrier_offset=%d, standard=0x%x\n",
1521 colibri_carrier_offset, standard); 1547 colibri_carrier_offset, standard);
1522 1548
1523 /* Set the band Pass filter for DIF*/ 1549 /* Set the band Pass filter for DIF*/
@@ -1551,8 +1577,8 @@ void cx231xx_set_DIF_bandpass(struct cx231xx *dev, u32 if_freq,
1551 u64 pll_freq_u64 = 0; 1577 u64 pll_freq_u64 = 0;
1552 u32 i = 0; 1578 u32 i = 0;
1553 1579
1554 pr_debug("if_freq=%d;spectral_invert=0x%x;mode=0x%x\n", 1580 dev_dbg(&dev->udev->dev, "if_freq=%d;spectral_invert=0x%x;mode=0x%x\n",
1555 if_freq, spectral_invert, mode); 1581 if_freq, spectral_invert, mode);
1556 1582
1557 1583
1558 if (mode == TUNER_MODE_FM_RADIO) { 1584 if (mode == TUNER_MODE_FM_RADIO) {
@@ -1595,8 +1621,7 @@ void cx231xx_set_DIF_bandpass(struct cx231xx *dev, u32 if_freq,
1595 if_freq = 16000000; 1621 if_freq = 16000000;
1596 } 1622 }
1597 1623
1598 pr_debug("Enter IF=%zu\n", 1624 dev_dbg(&dev->udev->dev, "Enter IF=%zu\n", ARRAY_SIZE(Dif_set_array));
1599 ARRAY_SIZE(Dif_set_array));
1600 for (i = 0; i < ARRAY_SIZE(Dif_set_array); i++) { 1625 for (i = 0; i < ARRAY_SIZE(Dif_set_array); i++) {
1601 if (Dif_set_array[i].if_freq == if_freq) { 1626 if (Dif_set_array[i].if_freq == if_freq) {
1602 vid_blk_write_word(dev, 1627 vid_blk_write_word(dev,
@@ -1708,7 +1733,7 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
1708 u32 dif_misc_ctrl_value = 0; 1733 u32 dif_misc_ctrl_value = 0;
1709 u32 func_mode = 0; 1734 u32 func_mode = 0;
1710 1735
1711 pr_debug("%s: setStandard to %x\n", __func__, standard); 1736 dev_dbg(&dev->udev->dev, "%s: setStandard to %x\n", __func__, standard);
1712 1737
1713 status = vid_blk_read_word(dev, DIF_MISC_CTRL, &dif_misc_ctrl_value); 1738 status = vid_blk_read_word(dev, DIF_MISC_CTRL, &dif_misc_ctrl_value);
1714 if (standard != DIF_USE_BASEBAND) 1739 if (standard != DIF_USE_BASEBAND)
@@ -2111,8 +2136,8 @@ int cx231xx_tuner_post_channel_change(struct cx231xx *dev)
2111{ 2136{
2112 int status = 0; 2137 int status = 0;
2113 u32 dwval; 2138 u32 dwval;
2114 pr_debug("%s: dev->tuner_type =0%d\n", 2139 dev_dbg(&dev->udev->dev, "%s: dev->tuner_type =0%d\n",
2115 __func__, dev->tuner_type); 2140 __func__, dev->tuner_type);
2116 /* Set the RF and IF k_agc values to 4 for PAL/NTSC and 8 for 2141 /* Set the RF and IF k_agc values to 4 for PAL/NTSC and 8 for
2117 * SECAM L/B/D standards */ 2142 * SECAM L/B/D standards */
2118 status = vid_blk_read_word(dev, DIF_AGC_IF_REF, &dwval); 2143 status = vid_blk_read_word(dev, DIF_AGC_IF_REF, &dwval);
@@ -2213,7 +2238,7 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode)
2213 if (dev->power_mode != mode) 2238 if (dev->power_mode != mode)
2214 dev->power_mode = mode; 2239 dev->power_mode = mode;
2215 else { 2240 else {
2216 pr_debug("%s: mode = %d, No Change req.\n", 2241 dev_dbg(&dev->udev->dev, "%s: mode = %d, No Change req.\n",
2217 __func__, mode); 2242 __func__, mode);
2218 return 0; 2243 return 0;
2219 } 2244 }
@@ -2453,7 +2478,7 @@ int cx231xx_start_stream(struct cx231xx *dev, u32 ep_mask)
2453 u32 tmp = 0; 2478 u32 tmp = 0;
2454 int status = 0; 2479 int status = 0;
2455 2480
2456 pr_debug("%s: ep_mask = %x\n", __func__, ep_mask); 2481 dev_dbg(&dev->udev->dev, "%s: ep_mask = %x\n", __func__, ep_mask);
2457 status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET, 2482 status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET,
2458 value, 4); 2483 value, 4);
2459 if (status < 0) 2484 if (status < 0)
@@ -2478,7 +2503,7 @@ int cx231xx_stop_stream(struct cx231xx *dev, u32 ep_mask)
2478 u32 tmp = 0; 2503 u32 tmp = 0;
2479 int status = 0; 2504 int status = 0;
2480 2505
2481 pr_debug("%s: ep_mask = %x\n", __func__, ep_mask); 2506 dev_dbg(&dev->udev->dev, "%s: ep_mask = %x\n", __func__, ep_mask);
2482 status = 2507 status =
2483 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET, value, 4); 2508 cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET, value, 4);
2484 if (status < 0) 2509 if (status < 0)
@@ -2506,32 +2531,38 @@ int cx231xx_initialize_stream_xfer(struct cx231xx *dev, u32 media_type)
2506 if (dev->udev->speed == USB_SPEED_HIGH) { 2531 if (dev->udev->speed == USB_SPEED_HIGH) {
2507 switch (media_type) { 2532 switch (media_type) {
2508 case Audio: 2533 case Audio:
2509 pr_debug("%s: Audio enter HANC\n", __func__); 2534 dev_dbg(&dev->udev->dev,
2535 "%s: Audio enter HANC\n", __func__);
2510 status = 2536 status =
2511 cx231xx_mode_register(dev, TS_MODE_REG, 0x9300); 2537 cx231xx_mode_register(dev, TS_MODE_REG, 0x9300);
2512 break; 2538 break;
2513 2539
2514 case Vbi: 2540 case Vbi:
2515 pr_debug("%s: set vanc registers\n", __func__); 2541 dev_dbg(&dev->udev->dev,
2542 "%s: set vanc registers\n", __func__);
2516 status = cx231xx_mode_register(dev, TS_MODE_REG, 0x300); 2543 status = cx231xx_mode_register(dev, TS_MODE_REG, 0x300);
2517 break; 2544 break;
2518 2545
2519 case Sliced_cc: 2546 case Sliced_cc:
2520 pr_debug("%s: set hanc registers\n", __func__); 2547 dev_dbg(&dev->udev->dev,
2548 "%s: set hanc registers\n", __func__);
2521 status = 2549 status =
2522 cx231xx_mode_register(dev, TS_MODE_REG, 0x1300); 2550 cx231xx_mode_register(dev, TS_MODE_REG, 0x1300);
2523 break; 2551 break;
2524 2552
2525 case Raw_Video: 2553 case Raw_Video:
2526 pr_debug("%s: set video registers\n", __func__); 2554 dev_dbg(&dev->udev->dev,
2555 "%s: set video registers\n", __func__);
2527 status = cx231xx_mode_register(dev, TS_MODE_REG, 0x100); 2556 status = cx231xx_mode_register(dev, TS_MODE_REG, 0x100);
2528 break; 2557 break;
2529 2558
2530 case TS1_serial_mode: 2559 case TS1_serial_mode:
2531 pr_debug("%s: set ts1 registers", __func__); 2560 dev_dbg(&dev->udev->dev,
2561 "%s: set ts1 registers", __func__);
2532 2562
2533 if (dev->board.has_417) { 2563 if (dev->board.has_417) {
2534 pr_debug("%s: MPEG\n", __func__); 2564 dev_dbg(&dev->udev->dev,
2565 "%s: MPEG\n", __func__);
2535 value &= 0xFFFFFFFC; 2566 value &= 0xFFFFFFFC;
2536 value |= 0x3; 2567 value |= 0x3;
2537 2568
@@ -2554,7 +2585,7 @@ int cx231xx_initialize_stream_xfer(struct cx231xx *dev, u32 media_type)
2554 VRT_SET_REGISTER, 2585 VRT_SET_REGISTER,
2555 TS1_LENGTH_REG, val, 4); 2586 TS1_LENGTH_REG, val, 4);
2556 } else { 2587 } else {
2557 pr_debug("%s: BDA\n", __func__); 2588 dev_dbg(&dev->udev->dev, "%s: BDA\n", __func__);
2558 status = cx231xx_mode_register(dev, 2589 status = cx231xx_mode_register(dev,
2559 TS_MODE_REG, 0x101); 2590 TS_MODE_REG, 0x101);
2560 status = cx231xx_mode_register(dev, 2591 status = cx231xx_mode_register(dev,
@@ -2563,8 +2594,9 @@ int cx231xx_initialize_stream_xfer(struct cx231xx *dev, u32 media_type)
2563 break; 2594 break;
2564 2595
2565 case TS1_parallel_mode: 2596 case TS1_parallel_mode:
2566 pr_debug("%s: set ts1 parallel mode registers\n", 2597 dev_dbg(&dev->udev->dev,
2567 __func__); 2598 "%s: set ts1 parallel mode registers\n",
2599 __func__);
2568 status = cx231xx_mode_register(dev, TS_MODE_REG, 0x100); 2600 status = cx231xx_mode_register(dev, TS_MODE_REG, 0x100);
2569 status = cx231xx_mode_register(dev, TS1_CFG_REG, 0x400); 2601 status = cx231xx_mode_register(dev, TS1_CFG_REG, 0x400);
2570 break; 2602 break;
@@ -2917,8 +2949,9 @@ int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev)
2917 (nCnt > 0)); 2949 (nCnt > 0));
2918 2950
2919 if (nCnt == 0) 2951 if (nCnt == 0)
2920 pr_debug("No ACK after %d msec -GPIO I2C failed!", 2952 dev_dbg(&dev->udev->dev,
2921 nInit * 10); 2953 "No ACK after %d msec -GPIO I2C failed!",
2954 nInit * 10);
2922 2955
2923 /* 2956 /*
2924 * readAck 2957 * readAck
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index d59f483102d2..2e8741314bce 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -26,7 +26,6 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/usb.h>
30#include <media/tuner.h> 29#include <media/tuner.h>
31#include <media/tveeprom.h> 30#include <media/tveeprom.h>
32#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
@@ -856,8 +855,9 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg)
856 855
857 if (dev->tuner_type == TUNER_XC5000) { 856 if (dev->tuner_type == TUNER_XC5000) {
858 if (command == XC5000_TUNER_RESET) { 857 if (command == XC5000_TUNER_RESET) {
859 pr_debug("Tuner CB: RESET: cmd %d : tuner type %d \n", 858 dev_dbg(&dev->udev->dev,
860 command, dev->tuner_type); 859 "Tuner CB: RESET: cmd %d : tuner type %d\n",
860 command, dev->tuner_type);
861 cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 861 cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit,
862 1); 862 1);
863 msleep(10); 863 msleep(10);
@@ -915,7 +915,7 @@ void cx231xx_pre_card_setup(struct cx231xx *dev)
915 915
916 cx231xx_set_model(dev); 916 cx231xx_set_model(dev);
917 917
918 pr_info("Identified as %s (card=%d)\n", 918 dev_info(&dev->udev->dev, "Identified as %s (card=%d)\n",
919 dev->board.name, dev->model); 919 dev->board.name, dev->model);
920 920
921 /* set the direction for GPIO pins */ 921 /* set the direction for GPIO pins */
@@ -989,7 +989,7 @@ static int read_eeprom(struct cx231xx *dev, struct i2c_client *client,
989 /* start reading at offset 0 */ 989 /* start reading at offset 0 */
990 ret = i2c_transfer(client->adapter, &msg_write, 1); 990 ret = i2c_transfer(client->adapter, &msg_write, 1);
991 if (ret < 0) { 991 if (ret < 0) {
992 pr_err("Can't read eeprom\n"); 992 dev_err(&dev->udev->dev, "Can't read eeprom\n");
993 return ret; 993 return ret;
994 } 994 }
995 995
@@ -999,7 +999,7 @@ static int read_eeprom(struct cx231xx *dev, struct i2c_client *client,
999 999
1000 ret = i2c_transfer(client->adapter, &msg_read, 1); 1000 ret = i2c_transfer(client->adapter, &msg_read, 1);
1001 if (ret < 0) { 1001 if (ret < 0) {
1002 pr_err("Can't read eeprom\n"); 1002 dev_err(&dev->udev->dev, "Can't read eeprom\n");
1003 return ret; 1003 return ret;
1004 } 1004 }
1005 eedata_cur += msg_read.len; 1005 eedata_cur += msg_read.len;
@@ -1007,7 +1007,8 @@ static int read_eeprom(struct cx231xx *dev, struct i2c_client *client,
1007 } 1007 }
1008 1008
1009 for (i = 0; i + 15 < len; i += 16) 1009 for (i = 0; i + 15 < len; i += 16)
1010 pr_debug("i2c eeprom %02x: %*ph\n", i, 16, &eedata[i]); 1010 dev_dbg(&dev->udev->dev, "i2c eeprom %02x: %*ph\n",
1011 i, 16, &eedata[i]);
1011 1012
1012 return 0; 1013 return 0;
1013} 1014}
@@ -1027,7 +1028,8 @@ void cx231xx_card_setup(struct cx231xx *dev)
1027 cx231xx_get_i2c_adap(dev, I2C_0), 1028 cx231xx_get_i2c_adap(dev, I2C_0),
1028 "cx25840", 0x88 >> 1, NULL); 1029 "cx25840", 0x88 >> 1, NULL);
1029 if (dev->sd_cx25840 == NULL) 1030 if (dev->sd_cx25840 == NULL)
1030 pr_err("cx25840 subdev registration failure\n"); 1031 dev_err(&dev->udev->dev,
1032 "cx25840 subdev registration failure\n");
1031 cx25840_call(dev, core, load_fw); 1033 cx25840_call(dev, core, load_fw);
1032 1034
1033 } 1035 }
@@ -1041,7 +1043,8 @@ void cx231xx_card_setup(struct cx231xx *dev)
1041 "tuner", 1043 "tuner",
1042 dev->tuner_addr, NULL); 1044 dev->tuner_addr, NULL);
1043 if (dev->sd_tuner == NULL) 1045 if (dev->sd_tuner == NULL)
1044 pr_err("tuner subdev registration failure\n"); 1046 dev_err(&dev->udev->dev,
1047 "tuner subdev registration failure\n");
1045 else 1048 else
1046 cx231xx_config_tuner(dev); 1049 cx231xx_config_tuner(dev);
1047 } 1050 }
@@ -1147,7 +1150,7 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,
1147 /* Query cx231xx to find what pcb config it is related to */ 1150 /* Query cx231xx to find what pcb config it is related to */
1148 retval = initialize_cx231xx(dev); 1151 retval = initialize_cx231xx(dev);
1149 if (retval < 0) { 1152 if (retval < 0) {
1150 pr_err("Failed to read PCB config\n"); 1153 dev_err(&udev->dev, "Failed to read PCB config\n");
1151 return retval; 1154 return retval;
1152 } 1155 }
1153 1156
@@ -1163,7 +1166,7 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,
1163 1166
1164 retval = cx231xx_config(dev); 1167 retval = cx231xx_config(dev);
1165 if (retval) { 1168 if (retval) {
1166 pr_err("error configuring device\n"); 1169 dev_err(&udev->dev, "error configuring device\n");
1167 return -ENOMEM; 1170 return -ENOMEM;
1168 } 1171 }
1169 1172
@@ -1173,8 +1176,9 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,
1173 /* register i2c bus */ 1176 /* register i2c bus */
1174 retval = cx231xx_dev_init(dev); 1177 retval = cx231xx_dev_init(dev);
1175 if (retval) { 1178 if (retval) {
1176 pr_err("%s: cx231xx_i2c_register - errCode [%d]!\n", 1179 dev_err(&udev->dev,
1177 __func__, retval); 1180 "%s: cx231xx_i2c_register - errCode [%d]!\n",
1181 __func__, retval);
1178 goto err_dev_init; 1182 goto err_dev_init;
1179 } 1183 }
1180 1184
@@ -1195,7 +1199,7 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,
1195 1199
1196 retval = cx231xx_config(dev); 1200 retval = cx231xx_config(dev);
1197 if (retval) { 1201 if (retval) {
1198 pr_err("%s: cx231xx_config - errCode [%d]!\n", 1202 dev_err(&udev->dev, "%s: cx231xx_config - errCode [%d]!\n",
1199 __func__, retval); 1203 __func__, retval);
1200 goto err_dev_init; 1204 goto err_dev_init;
1201 } 1205 }
@@ -1280,7 +1284,8 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1280 /* compute alternate max packet sizes for video */ 1284 /* compute alternate max packet sizes for video */
1281 idx = dev->current_pcb_config.hs_config_info[0].interface_info.video_index + 1; 1285 idx = dev->current_pcb_config.hs_config_info[0].interface_info.video_index + 1;
1282 if (idx >= dev->max_iad_interface_count) { 1286 if (idx >= dev->max_iad_interface_count) {
1283 pr_err("Video PCB interface #%d doesn't exist\n", idx); 1287 dev_err(&dev->udev->dev,
1288 "Video PCB interface #%d doesn't exist\n", idx);
1284 return -ENODEV; 1289 return -ENODEV;
1285 } 1290 }
1286 1291
@@ -1289,9 +1294,10 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1289 dev->video_mode.end_point_addr = uif->altsetting[0].endpoint[isoc_pipe].desc.bEndpointAddress; 1294 dev->video_mode.end_point_addr = uif->altsetting[0].endpoint[isoc_pipe].desc.bEndpointAddress;
1290 dev->video_mode.num_alt = uif->num_altsetting; 1295 dev->video_mode.num_alt = uif->num_altsetting;
1291 1296
1292 pr_info("video EndPoint Addr 0x%x, Alternate settings: %i\n", 1297 dev_info(&dev->udev->dev,
1293 dev->video_mode.end_point_addr, 1298 "video EndPoint Addr 0x%x, Alternate settings: %i\n",
1294 dev->video_mode.num_alt); 1299 dev->video_mode.end_point_addr,
1300 dev->video_mode.num_alt);
1295 1301
1296 dev->video_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->video_mode.num_alt, GFP_KERNEL); 1302 dev->video_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->video_mode.num_alt, GFP_KERNEL);
1297 if (dev->video_mode.alt_max_pkt_size == NULL) 1303 if (dev->video_mode.alt_max_pkt_size == NULL)
@@ -1300,15 +1306,17 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1300 for (i = 0; i < dev->video_mode.num_alt; i++) { 1306 for (i = 0; i < dev->video_mode.num_alt; i++) {
1301 u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize); 1307 u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
1302 dev->video_mode.alt_max_pkt_size[i] = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); 1308 dev->video_mode.alt_max_pkt_size[i] = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
1303 pr_debug("Alternate setting %i, max size= %i\n", i, 1309 dev_dbg(&dev->udev->dev,
1304 dev->video_mode.alt_max_pkt_size[i]); 1310 "Alternate setting %i, max size= %i\n", i,
1311 dev->video_mode.alt_max_pkt_size[i]);
1305 } 1312 }
1306 1313
1307 /* VBI Init */ 1314 /* VBI Init */
1308 1315
1309 idx = dev->current_pcb_config.hs_config_info[0].interface_info.vanc_index + 1; 1316 idx = dev->current_pcb_config.hs_config_info[0].interface_info.vanc_index + 1;
1310 if (idx >= dev->max_iad_interface_count) { 1317 if (idx >= dev->max_iad_interface_count) {
1311 pr_err("VBI PCB interface #%d doesn't exist\n", idx); 1318 dev_err(&dev->udev->dev,
1319 "VBI PCB interface #%d doesn't exist\n", idx);
1312 return -ENODEV; 1320 return -ENODEV;
1313 } 1321 }
1314 uif = udev->actconfig->interface[idx]; 1322 uif = udev->actconfig->interface[idx];
@@ -1318,9 +1326,10 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1318 bEndpointAddress; 1326 bEndpointAddress;
1319 1327
1320 dev->vbi_mode.num_alt = uif->num_altsetting; 1328 dev->vbi_mode.num_alt = uif->num_altsetting;
1321 pr_info("VBI EndPoint Addr 0x%x, Alternate settings: %i\n", 1329 dev_info(&dev->udev->dev,
1322 dev->vbi_mode.end_point_addr, 1330 "VBI EndPoint Addr 0x%x, Alternate settings: %i\n",
1323 dev->vbi_mode.num_alt); 1331 dev->vbi_mode.end_point_addr,
1332 dev->vbi_mode.num_alt);
1324 1333
1325 /* compute alternate max packet sizes for vbi */ 1334 /* compute alternate max packet sizes for vbi */
1326 dev->vbi_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->vbi_mode.num_alt, GFP_KERNEL); 1335 dev->vbi_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->vbi_mode.num_alt, GFP_KERNEL);
@@ -1333,8 +1342,9 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1333 desc.wMaxPacketSize); 1342 desc.wMaxPacketSize);
1334 dev->vbi_mode.alt_max_pkt_size[i] = 1343 dev->vbi_mode.alt_max_pkt_size[i] =
1335 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); 1344 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
1336 pr_debug("Alternate setting %i, max size= %i\n", i, 1345 dev_dbg(&dev->udev->dev,
1337 dev->vbi_mode.alt_max_pkt_size[i]); 1346 "Alternate setting %i, max size= %i\n", i,
1347 dev->vbi_mode.alt_max_pkt_size[i]);
1338 } 1348 }
1339 1349
1340 /* Sliced CC VBI init */ 1350 /* Sliced CC VBI init */
@@ -1342,7 +1352,8 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1342 /* compute alternate max packet sizes for sliced CC */ 1352 /* compute alternate max packet sizes for sliced CC */
1343 idx = dev->current_pcb_config.hs_config_info[0].interface_info.hanc_index + 1; 1353 idx = dev->current_pcb_config.hs_config_info[0].interface_info.hanc_index + 1;
1344 if (idx >= dev->max_iad_interface_count) { 1354 if (idx >= dev->max_iad_interface_count) {
1345 pr_err("Sliced CC PCB interface #%d doesn't exist\n", idx); 1355 dev_err(&dev->udev->dev,
1356 "Sliced CC PCB interface #%d doesn't exist\n", idx);
1346 return -ENODEV; 1357 return -ENODEV;
1347 } 1358 }
1348 uif = udev->actconfig->interface[idx]; 1359 uif = udev->actconfig->interface[idx];
@@ -1352,9 +1363,10 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1352 bEndpointAddress; 1363 bEndpointAddress;
1353 1364
1354 dev->sliced_cc_mode.num_alt = uif->num_altsetting; 1365 dev->sliced_cc_mode.num_alt = uif->num_altsetting;
1355 pr_info("sliced CC EndPoint Addr 0x%x, Alternate settings: %i\n", 1366 dev_info(&dev->udev->dev,
1356 dev->sliced_cc_mode.end_point_addr, 1367 "sliced CC EndPoint Addr 0x%x, Alternate settings: %i\n",
1357 dev->sliced_cc_mode.num_alt); 1368 dev->sliced_cc_mode.end_point_addr,
1369 dev->sliced_cc_mode.num_alt);
1358 dev->sliced_cc_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->sliced_cc_mode.num_alt, GFP_KERNEL); 1370 dev->sliced_cc_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->sliced_cc_mode.num_alt, GFP_KERNEL);
1359 if (dev->sliced_cc_mode.alt_max_pkt_size == NULL) 1371 if (dev->sliced_cc_mode.alt_max_pkt_size == NULL)
1360 return -ENOMEM; 1372 return -ENOMEM;
@@ -1364,8 +1376,9 @@ static int cx231xx_init_v4l2(struct cx231xx *dev,
1364 desc.wMaxPacketSize); 1376 desc.wMaxPacketSize);
1365 dev->sliced_cc_mode.alt_max_pkt_size[i] = 1377 dev->sliced_cc_mode.alt_max_pkt_size[i] =
1366 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); 1378 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
1367 pr_debug("Alternate setting %i, max size= %i\n", i, 1379 dev_dbg(&dev->udev->dev,
1368 dev->sliced_cc_mode.alt_max_pkt_size[i]); 1380 "Alternate setting %i, max size= %i\n", i,
1381 dev->sliced_cc_mode.alt_max_pkt_size[i]);
1369 } 1382 }
1370 1383
1371 return 0; 1384 return 0;
@@ -1389,6 +1402,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1389 struct usb_interface_assoc_descriptor *assoc_desc; 1402 struct usb_interface_assoc_descriptor *assoc_desc;
1390 1403
1391 ifnum = interface->altsetting[0].desc.bInterfaceNumber; 1404 ifnum = interface->altsetting[0].desc.bInterfaceNumber;
1405 udev = usb_get_dev(interface_to_usbdev(interface));
1392 1406
1393 /* 1407 /*
1394 * Interface number 0 - IR interface (handled by mceusb driver) 1408 * Interface number 0 - IR interface (handled by mceusb driver)
@@ -1402,13 +1416,13 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1402 nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS); 1416 nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
1403 if (nr >= CX231XX_MAXBOARDS) { 1417 if (nr >= CX231XX_MAXBOARDS) {
1404 /* No free device slots */ 1418 /* No free device slots */
1405 pr_err("Supports only %i devices.\n", CX231XX_MAXBOARDS); 1419 dev_err(&udev->dev,
1420 "Supports only %i devices.\n",
1421 CX231XX_MAXBOARDS);
1406 return -ENOMEM; 1422 return -ENOMEM;
1407 } 1423 }
1408 } while (test_and_set_bit(nr, &cx231xx_devused)); 1424 } while (test_and_set_bit(nr, &cx231xx_devused));
1409 1425
1410 udev = usb_get_dev(interface_to_usbdev(interface));
1411
1412 /* allocate memory for our device state and initialize it */ 1426 /* allocate memory for our device state and initialize it */
1413 dev = devm_kzalloc(&udev->dev, sizeof(*dev), GFP_KERNEL); 1427 dev = devm_kzalloc(&udev->dev, sizeof(*dev), GFP_KERNEL);
1414 if (dev == NULL) { 1428 if (dev == NULL) {
@@ -1458,13 +1472,14 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1458 speed = "unknown"; 1472 speed = "unknown";
1459 } 1473 }
1460 1474
1461 pr_info("New device %s %s @ %s Mbps (%04x:%04x) with %d interfaces\n", 1475 dev_info(&udev->dev,
1462 udev->manufacturer ? udev->manufacturer : "", 1476 "New device %s %s @ %s Mbps (%04x:%04x) with %d interfaces\n",
1463 udev->product ? udev->product : "", 1477 udev->manufacturer ? udev->manufacturer : "",
1464 speed, 1478 udev->product ? udev->product : "",
1465 le16_to_cpu(udev->descriptor.idVendor), 1479 speed,
1466 le16_to_cpu(udev->descriptor.idProduct), 1480 le16_to_cpu(udev->descriptor.idVendor),
1467 dev->max_iad_interface_count); 1481 le16_to_cpu(udev->descriptor.idProduct),
1482 dev->max_iad_interface_count);
1468 1483
1469 /* increment interface count */ 1484 /* increment interface count */
1470 dev->interface_count++; 1485 dev->interface_count++;
@@ -1474,12 +1489,12 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1474 1489
1475 assoc_desc = udev->actconfig->intf_assoc[0]; 1490 assoc_desc = udev->actconfig->intf_assoc[0];
1476 if (assoc_desc->bFirstInterface != ifnum) { 1491 if (assoc_desc->bFirstInterface != ifnum) {
1477 pr_err("Not found matching IAD interface\n"); 1492 dev_err(&udev->dev, "Not found matching IAD interface\n");
1478 retval = -ENODEV; 1493 retval = -ENODEV;
1479 goto err_if; 1494 goto err_if;
1480 } 1495 }
1481 1496
1482 pr_debug("registering interface %d\n", ifnum); 1497 dev_dbg(&udev->dev, "registering interface %d\n", ifnum);
1483 1498
1484 /* save our data pointer in this interface device */ 1499 /* save our data pointer in this interface device */
1485 usb_set_intfdata(interface, dev); 1500 usb_set_intfdata(interface, dev);
@@ -1487,7 +1502,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1487 /* Create v4l2 device */ 1502 /* Create v4l2 device */
1488 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev); 1503 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
1489 if (retval) { 1504 if (retval) {
1490 pr_err("v4l2_device_register failed\n"); 1505 dev_err(&udev->dev, "v4l2_device_register failed\n");
1491 goto err_v4l2; 1506 goto err_v4l2;
1492 } 1507 }
1493 1508
@@ -1504,7 +1519,8 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1504 /* compute alternate max packet sizes for TS1 */ 1519 /* compute alternate max packet sizes for TS1 */
1505 idx = dev->current_pcb_config.hs_config_info[0].interface_info.ts1_index + 1; 1520 idx = dev->current_pcb_config.hs_config_info[0].interface_info.ts1_index + 1;
1506 if (idx >= dev->max_iad_interface_count) { 1521 if (idx >= dev->max_iad_interface_count) {
1507 pr_err("TS1 PCB interface #%d doesn't exist\n", idx); 1522 dev_err(&udev->dev,
1523 "TS1 PCB interface #%d doesn't exist\n", idx);
1508 retval = -ENODEV; 1524 retval = -ENODEV;
1509 goto err_video_alt; 1525 goto err_video_alt;
1510 } 1526 }
@@ -1515,9 +1531,10 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1515 desc.bEndpointAddress; 1531 desc.bEndpointAddress;
1516 1532
1517 dev->ts1_mode.num_alt = uif->num_altsetting; 1533 dev->ts1_mode.num_alt = uif->num_altsetting;
1518 pr_info("TS EndPoint Addr 0x%x, Alternate settings: %i\n", 1534 dev_info(&udev->dev,
1519 dev->ts1_mode.end_point_addr, 1535 "TS EndPoint Addr 0x%x, Alternate settings: %i\n",
1520 dev->ts1_mode.num_alt); 1536 dev->ts1_mode.end_point_addr,
1537 dev->ts1_mode.num_alt);
1521 1538
1522 dev->ts1_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->ts1_mode.num_alt, GFP_KERNEL); 1539 dev->ts1_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->ts1_mode.num_alt, GFP_KERNEL);
1523 if (dev->ts1_mode.alt_max_pkt_size == NULL) { 1540 if (dev->ts1_mode.alt_max_pkt_size == NULL) {
@@ -1531,8 +1548,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
1531 wMaxPacketSize); 1548 wMaxPacketSize);
1532 dev->ts1_mode.alt_max_pkt_size[i] = 1549 dev->ts1_mode.alt_max_pkt_size[i] =
1533 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); 1550 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
1534 pr_debug("Alternate setting %i, max size= %i\n", i, 1551 dev_dbg(&udev->dev,
1535 dev->ts1_mode.alt_max_pkt_size[i]); 1552 "Alternate setting %i, max size= %i\n", i,
1553 dev->ts1_mode.alt_max_pkt_size[i]);
1536 } 1554 }
1537 } 1555 }
1538 1556
@@ -1596,8 +1614,9 @@ static void cx231xx_usb_disconnect(struct usb_interface *interface)
1596 wake_up_interruptible_all(&dev->open); 1614 wake_up_interruptible_all(&dev->open);
1597 1615
1598 if (dev->users) { 1616 if (dev->users) {
1599 pr_warn("device %s is open! Deregistration and memory deallocation are deferred on close.\n", 1617 dev_warn(&dev->udev->dev,
1600 video_device_node_name(dev->vdev)); 1618 "device %s is open! Deregistration and memory deallocation are deferred on close.\n",
1619 video_device_node_name(dev->vdev));
1601 1620
1602 /* Even having users, it is safe to remove the RC i2c driver */ 1621 /* Even having users, it is safe to remove the RC i2c driver */
1603 cx231xx_ir_exit(dev); 1622 cx231xx_ir_exit(dev);
diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
index 66e8f8ae9be4..36c3ecf204c1 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -25,7 +25,6 @@
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/usb.h>
29#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
30#include <media/v4l2-common.h> 29#include <media/v4l2-common.h>
31#include <media/tuner.h> 30#include <media/tuner.h>
@@ -228,7 +227,7 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
228 /* call common vendor command request */ 227 /* call common vendor command request */
229 status = cx231xx_send_vendor_cmd(dev, &ven_req); 228 status = cx231xx_send_vendor_cmd(dev, &ven_req);
230 if (status < 0 && !dev->i2c_scan_running) { 229 if (status < 0 && !dev->i2c_scan_running) {
231 pr_err("%s: failed with status -%d\n", 230 dev_err(&dev->udev->dev, "%s: failed with status -%d\n",
232 __func__, status); 231 __func__, status);
233 } 232 }
234 233
@@ -523,7 +522,8 @@ int cx231xx_set_video_alternate(struct cx231xx *dev)
523 usb_set_interface(dev->udev, usb_interface_index, 522 usb_set_interface(dev->udev, usb_interface_index,
524 dev->video_mode.alt); 523 dev->video_mode.alt);
525 if (errCode < 0) { 524 if (errCode < 0) {
526 pr_err("cannot change alt number to %d (error=%i)\n", 525 dev_err(&dev->udev->dev,
526 "cannot change alt number to %d (error=%i)\n",
527 dev->video_mode.alt, errCode); 527 dev->video_mode.alt, errCode);
528 return errCode; 528 return errCode;
529 } 529 }
@@ -598,7 +598,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt)
598 } 598 }
599 599
600 if (alt > 0 && max_pkt_size == 0) { 600 if (alt > 0 && max_pkt_size == 0) {
601 pr_err("can't change interface %d alt no. to %d: Max. Pkt size = 0\n", 601 dev_err(&dev->udev->dev,
602 "can't change interface %d alt no. to %d: Max. Pkt size = 0\n",
602 usb_interface_index, alt); 603 usb_interface_index, alt);
603 /*To workaround error number=-71 on EP0 for videograbber, 604 /*To workaround error number=-71 on EP0 for videograbber,
604 need add following codes.*/ 605 need add following codes.*/
@@ -613,7 +614,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt)
613 if (usb_interface_index > 0) { 614 if (usb_interface_index > 0) {
614 status = usb_set_interface(dev->udev, usb_interface_index, alt); 615 status = usb_set_interface(dev->udev, usb_interface_index, alt);
615 if (status < 0) { 616 if (status < 0) {
616 pr_err("can't change interface %d alt no. to %d (err=%i)\n", 617 dev_err(&dev->udev->dev,
618 "can't change interface %d alt no. to %d (err=%i)\n",
617 usb_interface_index, alt, status); 619 usb_interface_index, alt, status);
618 return status; 620 return status;
619 } 621 }
@@ -771,8 +773,9 @@ int cx231xx_ep5_bulkout(struct cx231xx *dev, u8 *firmware, u16 size)
771 buffer, 4096, &actlen, 2000); 773 buffer, 4096, &actlen, 2000);
772 774
773 if (ret) 775 if (ret)
774 pr_err("bulk message failed: %d (%d/%d)", ret, 776 dev_err(&dev->udev->dev,
775 size, actlen); 777 "bulk message failed: %d (%d/%d)", ret,
778 size, actlen);
776 else { 779 else {
777 errCode = actlen != size ? -1 : 0; 780 errCode = actlen != size ? -1 : 0;
778 } 781 }
@@ -1008,14 +1011,16 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
1008 dev->video_mode.isoc_ctl.urb = 1011 dev->video_mode.isoc_ctl.urb =
1009 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1012 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
1010 if (!dev->video_mode.isoc_ctl.urb) { 1013 if (!dev->video_mode.isoc_ctl.urb) {
1011 pr_err("cannot alloc memory for usb buffers\n"); 1014 dev_err(&dev->udev->dev,
1015 "cannot alloc memory for usb buffers\n");
1012 return -ENOMEM; 1016 return -ENOMEM;
1013 } 1017 }
1014 1018
1015 dev->video_mode.isoc_ctl.transfer_buffer = 1019 dev->video_mode.isoc_ctl.transfer_buffer =
1016 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1020 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
1017 if (!dev->video_mode.isoc_ctl.transfer_buffer) { 1021 if (!dev->video_mode.isoc_ctl.transfer_buffer) {
1018 pr_err("cannot allocate memory for usbtransfer\n"); 1022 dev_err(&dev->udev->dev,
1023 "cannot allocate memory for usbtransfer\n");
1019 kfree(dev->video_mode.isoc_ctl.urb); 1024 kfree(dev->video_mode.isoc_ctl.urb);
1020 return -ENOMEM; 1025 return -ENOMEM;
1021 } 1026 }
@@ -1035,7 +1040,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
1035 for (i = 0; i < dev->video_mode.isoc_ctl.num_bufs; i++) { 1040 for (i = 0; i < dev->video_mode.isoc_ctl.num_bufs; i++) {
1036 urb = usb_alloc_urb(max_packets, GFP_KERNEL); 1041 urb = usb_alloc_urb(max_packets, GFP_KERNEL);
1037 if (!urb) { 1042 if (!urb) {
1038 pr_err("cannot alloc isoc_ctl.urb %i\n", i); 1043 dev_err(&dev->udev->dev,
1044 "cannot alloc isoc_ctl.urb %i\n", i);
1039 cx231xx_uninit_isoc(dev); 1045 cx231xx_uninit_isoc(dev);
1040 return -ENOMEM; 1046 return -ENOMEM;
1041 } 1047 }
@@ -1045,7 +1051,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
1045 usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL, 1051 usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL,
1046 &urb->transfer_dma); 1052 &urb->transfer_dma);
1047 if (!dev->video_mode.isoc_ctl.transfer_buffer[i]) { 1053 if (!dev->video_mode.isoc_ctl.transfer_buffer[i]) {
1048 pr_err("unable to allocate %i bytes for transfer buffer %i%s\n", 1054 dev_err(&dev->udev->dev,
1055 "unable to allocate %i bytes for transfer buffer %i%s\n",
1049 sb_size, i, 1056 sb_size, i,
1050 in_interrupt() ? " while in int" : ""); 1057 in_interrupt() ? " while in int" : "");
1051 cx231xx_uninit_isoc(dev); 1058 cx231xx_uninit_isoc(dev);
@@ -1079,7 +1086,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
1079 rc = usb_submit_urb(dev->video_mode.isoc_ctl.urb[i], 1086 rc = usb_submit_urb(dev->video_mode.isoc_ctl.urb[i],
1080 GFP_ATOMIC); 1087 GFP_ATOMIC);
1081 if (rc) { 1088 if (rc) {
1082 pr_err("submit of urb %i failed (error=%i)\n", i, 1089 dev_err(&dev->udev->dev,
1090 "submit of urb %i failed (error=%i)\n", i,
1083 rc); 1091 rc);
1084 cx231xx_uninit_isoc(dev); 1092 cx231xx_uninit_isoc(dev);
1085 return rc; 1093 return rc;
@@ -1140,14 +1148,16 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
1140 dev->video_mode.bulk_ctl.urb = 1148 dev->video_mode.bulk_ctl.urb =
1141 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1149 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
1142 if (!dev->video_mode.bulk_ctl.urb) { 1150 if (!dev->video_mode.bulk_ctl.urb) {
1143 pr_err("cannot alloc memory for usb buffers\n"); 1151 dev_err(&dev->udev->dev,
1152 "cannot alloc memory for usb buffers\n");
1144 return -ENOMEM; 1153 return -ENOMEM;
1145 } 1154 }
1146 1155
1147 dev->video_mode.bulk_ctl.transfer_buffer = 1156 dev->video_mode.bulk_ctl.transfer_buffer =
1148 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1157 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
1149 if (!dev->video_mode.bulk_ctl.transfer_buffer) { 1158 if (!dev->video_mode.bulk_ctl.transfer_buffer) {
1150 pr_err("cannot allocate memory for usbtransfer\n"); 1159 dev_err(&dev->udev->dev,
1160 "cannot allocate memory for usbtransfer\n");
1151 kfree(dev->video_mode.bulk_ctl.urb); 1161 kfree(dev->video_mode.bulk_ctl.urb);
1152 return -ENOMEM; 1162 return -ENOMEM;
1153 } 1163 }
@@ -1167,7 +1177,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
1167 for (i = 0; i < dev->video_mode.bulk_ctl.num_bufs; i++) { 1177 for (i = 0; i < dev->video_mode.bulk_ctl.num_bufs; i++) {
1168 urb = usb_alloc_urb(0, GFP_KERNEL); 1178 urb = usb_alloc_urb(0, GFP_KERNEL);
1169 if (!urb) { 1179 if (!urb) {
1170 pr_err("cannot alloc bulk_ctl.urb %i\n", i); 1180 dev_err(&dev->udev->dev,
1181 "cannot alloc bulk_ctl.urb %i\n", i);
1171 cx231xx_uninit_bulk(dev); 1182 cx231xx_uninit_bulk(dev);
1172 return -ENOMEM; 1183 return -ENOMEM;
1173 } 1184 }
@@ -1178,7 +1189,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
1178 usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL, 1189 usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL,
1179 &urb->transfer_dma); 1190 &urb->transfer_dma);
1180 if (!dev->video_mode.bulk_ctl.transfer_buffer[i]) { 1191 if (!dev->video_mode.bulk_ctl.transfer_buffer[i]) {
1181 pr_err("unable to allocate %i bytes for transfer buffer %i%s\n", 1192 dev_err(&dev->udev->dev,
1193 "unable to allocate %i bytes for transfer buffer %i%s\n",
1182 sb_size, i, 1194 sb_size, i,
1183 in_interrupt() ? " while in int" : ""); 1195 in_interrupt() ? " while in int" : "");
1184 cx231xx_uninit_bulk(dev); 1196 cx231xx_uninit_bulk(dev);
@@ -1200,7 +1212,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
1200 rc = usb_submit_urb(dev->video_mode.bulk_ctl.urb[i], 1212 rc = usb_submit_urb(dev->video_mode.bulk_ctl.urb[i],
1201 GFP_ATOMIC); 1213 GFP_ATOMIC);
1202 if (rc) { 1214 if (rc) {
1203 pr_err("submit of urb %i failed (error=%i)\n", i,rc); 1215 dev_err(&dev->udev->dev,
1216 "submit of urb %i failed (error=%i)\n", i, rc);
1204 cx231xx_uninit_bulk(dev); 1217 cx231xx_uninit_bulk(dev);
1205 return rc; 1218 return rc;
1206 } 1219 }
@@ -1303,7 +1316,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
1303 errCode = cx231xx_set_power_mode(dev, 1316 errCode = cx231xx_set_power_mode(dev,
1304 POLARIS_AVMODE_ENXTERNAL_AV); 1317 POLARIS_AVMODE_ENXTERNAL_AV);
1305 if (errCode < 0) { 1318 if (errCode < 0) {
1306 pr_err("%s: Failed to set Power - errCode [%d]!\n", 1319 dev_err(&dev->udev->dev,
1320 "%s: Failed to set Power - errCode [%d]!\n",
1307 __func__, errCode); 1321 __func__, errCode);
1308 return errCode; 1322 return errCode;
1309 } 1323 }
@@ -1311,7 +1325,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
1311 errCode = cx231xx_set_power_mode(dev, 1325 errCode = cx231xx_set_power_mode(dev,
1312 POLARIS_AVMODE_ANALOGT_TV); 1326 POLARIS_AVMODE_ANALOGT_TV);
1313 if (errCode < 0) { 1327 if (errCode < 0) {
1314 pr_err("%s: Failed to set Power - errCode [%d]!\n", 1328 dev_err(&dev->udev->dev,
1329 "%s: Failed to set Power - errCode [%d]!\n",
1315 __func__, errCode); 1330 __func__, errCode);
1316 return errCode; 1331 return errCode;
1317 } 1332 }
@@ -1325,13 +1340,15 @@ int cx231xx_dev_init(struct cx231xx *dev)
1325 /* initialize Colibri block */ 1340 /* initialize Colibri block */
1326 errCode = cx231xx_afe_init_super_block(dev, 0x23c); 1341 errCode = cx231xx_afe_init_super_block(dev, 0x23c);
1327 if (errCode < 0) { 1342 if (errCode < 0) {
1328 pr_err("%s: cx231xx_afe init super block - errCode [%d]!\n", 1343 dev_err(&dev->udev->dev,
1344 "%s: cx231xx_afe init super block - errCode [%d]!\n",
1329 __func__, errCode); 1345 __func__, errCode);
1330 return errCode; 1346 return errCode;
1331 } 1347 }
1332 errCode = cx231xx_afe_init_channels(dev); 1348 errCode = cx231xx_afe_init_channels(dev);
1333 if (errCode < 0) { 1349 if (errCode < 0) {
1334 pr_err("%s: cx231xx_afe init channels - errCode [%d]!\n", 1350 dev_err(&dev->udev->dev,
1351 "%s: cx231xx_afe init channels - errCode [%d]!\n",
1335 __func__, errCode); 1352 __func__, errCode);
1336 return errCode; 1353 return errCode;
1337 } 1354 }
@@ -1339,7 +1356,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
1339 /* Set DIF in By pass mode */ 1356 /* Set DIF in By pass mode */
1340 errCode = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); 1357 errCode = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND);
1341 if (errCode < 0) { 1358 if (errCode < 0) {
1342 pr_err("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", 1359 dev_err(&dev->udev->dev,
1360 "%s: cx231xx_dif set to By pass mode - errCode [%d]!\n",
1343 __func__, errCode); 1361 __func__, errCode);
1344 return errCode; 1362 return errCode;
1345 } 1363 }
@@ -1347,7 +1365,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
1347 /* I2S block related functions */ 1365 /* I2S block related functions */
1348 errCode = cx231xx_i2s_blk_initialize(dev); 1366 errCode = cx231xx_i2s_blk_initialize(dev);
1349 if (errCode < 0) { 1367 if (errCode < 0) {
1350 pr_err("%s: cx231xx_i2s block initialize - errCode [%d]!\n", 1368 dev_err(&dev->udev->dev,
1369 "%s: cx231xx_i2s block initialize - errCode [%d]!\n",
1351 __func__, errCode); 1370 __func__, errCode);
1352 return errCode; 1371 return errCode;
1353 } 1372 }
@@ -1355,7 +1374,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
1355 /* init control pins */ 1374 /* init control pins */
1356 errCode = cx231xx_init_ctrl_pin_status(dev); 1375 errCode = cx231xx_init_ctrl_pin_status(dev);
1357 if (errCode < 0) { 1376 if (errCode < 0) {
1358 pr_err("%s: cx231xx_init ctrl pins - errCode [%d]!\n", 1377 dev_err(&dev->udev->dev,
1378 "%s: cx231xx_init ctrl pins - errCode [%d]!\n",
1359 __func__, errCode); 1379 __func__, errCode);
1360 return errCode; 1380 return errCode;
1361 } 1381 }
@@ -1381,7 +1401,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
1381 break; 1401 break;
1382 } 1402 }
1383 if (errCode < 0) { 1403 if (errCode < 0) {
1384 pr_err("%s: cx231xx_AGC mode to Analog - errCode [%d]!\n", 1404 dev_err(&dev->udev->dev,
1405 "%s: cx231xx_AGC mode to Analog - errCode [%d]!\n",
1385 __func__, errCode); 1406 __func__, errCode);
1386 return errCode; 1407 return errCode;
1387 } 1408 }
@@ -1457,7 +1478,7 @@ int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val,
1457 /* call common vendor command request */ 1478 /* call common vendor command request */
1458 status = cx231xx_send_vendor_cmd(dev, &ven_req); 1479 status = cx231xx_send_vendor_cmd(dev, &ven_req);
1459 if (status < 0) { 1480 if (status < 0) {
1460 pr_err("%s: failed with status -%d\n", 1481 dev_err(&dev->udev->dev, "%s: failed with status -%d\n",
1461 __func__, status); 1482 __func__, status);
1462 } 1483 }
1463 1484
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index b6af923eb5a3..044ad353d09b 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -22,7 +22,6 @@
22#include "cx231xx.h" 22#include "cx231xx.h"
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/usb.h>
26 25
27#include <media/v4l2-common.h> 26#include <media/v4l2-common.h>
28#include <media/videobuf-vmalloc.h> 27#include <media/videobuf-vmalloc.h>
@@ -265,7 +264,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)
265 struct cx231xx *dev = dvb->adapter.priv; 264 struct cx231xx *dev = dvb->adapter.priv;
266 265
267 if (dev->USE_ISO) { 266 if (dev->USE_ISO) {
268 pr_debug("DVB transfer mode is ISO.\n"); 267 dev_dbg(&dev->udev->dev, "DVB transfer mode is ISO.\n");
269 cx231xx_set_alt_setting(dev, INDEX_TS1, 4); 268 cx231xx_set_alt_setting(dev, INDEX_TS1, 4);
270 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE); 269 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
271 if (rc < 0) 270 if (rc < 0)
@@ -276,7 +275,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)
276 dev->ts1_mode.max_pkt_size, 275 dev->ts1_mode.max_pkt_size,
277 dvb_isoc_copy); 276 dvb_isoc_copy);
278 } else { 277 } else {
279 pr_debug("DVB transfer mode is BULK.\n"); 278 dev_dbg(&dev->udev->dev, "DVB transfer mode is BULK.\n");
280 cx231xx_set_alt_setting(dev, INDEX_TS1, 0); 279 cx231xx_set_alt_setting(dev, INDEX_TS1, 0);
281 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE); 280 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
282 if (rc < 0) 281 if (rc < 0)
@@ -430,14 +429,17 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev)
430 429
431 if (dops->init != NULL && !dev->xc_fw_load_done) { 430 if (dops->init != NULL && !dev->xc_fw_load_done) {
432 431
433 pr_debug("Reloading firmware for XC5000\n"); 432 dev_dbg(&dev->udev->dev,
433 "Reloading firmware for XC5000\n");
434 status = dops->init(dev->dvb->frontend); 434 status = dops->init(dev->dvb->frontend);
435 if (status == 0) { 435 if (status == 0) {
436 dev->xc_fw_load_done = 1; 436 dev->xc_fw_load_done = 1;
437 pr_debug("XC5000 firmware download completed\n"); 437 dev_dbg(&dev->udev->dev,
438 "XC5000 firmware download completed\n");
438 } else { 439 } else {
439 dev->xc_fw_load_done = 0; 440 dev->xc_fw_load_done = 0;
440 pr_debug("XC5000 firmware download failed !!!\n"); 441 dev_dbg(&dev->udev->dev,
442 "XC5000 firmware download failed !!!\n");
441 } 443 }
442 } 444 }
443 445
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index f99857e6c842..c4dc13afbe05 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -23,7 +23,6 @@
23#include "cx231xx.h" 23#include "cx231xx.h"
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/usb.h>
27#include <linux/i2c.h> 26#include <linux/i2c.h>
28#include <linux/i2c-mux.h> 27#include <linux/i2c-mux.h>
29#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
@@ -502,18 +501,20 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
502 memset(&client, 0, sizeof(client)); 501 memset(&client, 0, sizeof(client));
503 client.adapter = cx231xx_get_i2c_adap(dev, i2c_port); 502 client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
504 503
505 pr_info("i2c_scan: checking for I2C devices on port=%d ..\n", 504 dev_info(&dev->udev->dev,
505 "i2c_scan: checking for I2C devices on port=%d ..\n",
506 i2c_port); 506 i2c_port);
507 for (i = 0; i < 128; i++) { 507 for (i = 0; i < 128; i++) {
508 client.addr = i; 508 client.addr = i;
509 rc = i2c_master_recv(&client, &buf, 0); 509 rc = i2c_master_recv(&client, &buf, 0);
510 if (rc < 0) 510 if (rc < 0)
511 continue; 511 continue;
512 pr_info("i2c scan: found device @ 0x%x [%s]\n", 512 dev_info(&dev->udev->dev,
513 i << 1, 513 "i2c scan: found device @ 0x%x [%s]\n",
514 i2c_devs[i] ? i2c_devs[i] : "???"); 514 i << 1,
515 i2c_devs[i] ? i2c_devs[i] : "???");
515 } 516 }
516 pr_info("i2c scan: Completed Checking for I2C devices on port=%d.\n", 517 dev_info(&dev->udev->dev, "i2c scan: Completed Checking for I2C devices on port=%d.\n",
517 i2c_port); 518 i2c_port);
518 519
519 dev->i2c_scan_running = false; 520 dev->i2c_scan_running = false;
@@ -539,7 +540,8 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
539 i2c_add_adapter(&bus->i2c_adap); 540 i2c_add_adapter(&bus->i2c_adap);
540 541
541 if (0 != bus->i2c_rc) 542 if (0 != bus->i2c_rc)
542 pr_warn("i2c bus %d register FAILED\n", bus->nr); 543 dev_warn(&dev->udev->dev,
544 "i2c bus %d register FAILED\n", bus->nr);
543 545
544 return bus->i2c_rc; 546 return bus->i2c_rc;
545} 547}
@@ -582,7 +584,8 @@ int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no)
582 NULL); 584 NULL);
583 585
584 if (!dev->i2c_mux_adap[mux_no]) 586 if (!dev->i2c_mux_adap[mux_no])
585 pr_warn("i2c mux %d register FAILED\n", mux_no); 587 dev_warn(&dev->udev->dev,
588 "i2c mux %d register FAILED\n", mux_no);
586 589
587 return 0; 590 return 0;
588} 591}
diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c
index 5ae2ce3f51b1..f954da6abf31 100644
--- a/drivers/media/usb/cx231xx/cx231xx-input.c
+++ b/drivers/media/usb/cx231xx/cx231xx-input.c
@@ -19,7 +19,6 @@
19 */ 19 */
20 20
21#include "cx231xx.h" 21#include "cx231xx.h"
22#include <linux/usb.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/bitrev.h> 23#include <linux/bitrev.h>
25 24
diff --git a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c
index 2f8dc6afac54..ee9d6225236a 100644
--- a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c
+++ b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c
@@ -703,8 +703,8 @@ int initialize_cx231xx(struct cx231xx *dev)
703 _current_scenario_idx = INDEX_BUSPOWER_DIF_ONLY; 703 _current_scenario_idx = INDEX_BUSPOWER_DIF_ONLY;
704 break; 704 break;
705 default: 705 default:
706 pr_err("bad config in buspower!!!!\n"); 706 dev_err(&dev->udev->dev,
707 pr_err("config_info=%x\n", 707 "bad config in buspower!!!!\nconfig_info=%x\n",
708 config_info & BUSPOWER_MASK); 708 config_info & BUSPOWER_MASK);
709 return 1; 709 return 1;
710 } 710 }
@@ -768,8 +768,8 @@ int initialize_cx231xx(struct cx231xx *dev)
768 _current_scenario_idx = INDEX_SELFPOWER_COMPRESSOR; 768 _current_scenario_idx = INDEX_SELFPOWER_COMPRESSOR;
769 break; 769 break;
770 default: 770 default:
771 pr_err("bad senario!!!!!\n"); 771 dev_err(&dev->udev->dev,
772 pr_err("config_info=%x\n", 772 "bad senario!!!!!\nconfig_info=%x\n",
773 config_info & SELFPOWER_MASK); 773 config_info & SELFPOWER_MASK);
774 return -ENODEV; 774 return -ENODEV;
775 } 775 }
@@ -781,18 +781,29 @@ int initialize_cx231xx(struct cx231xx *dev)
781 sizeof(struct pcb_config)); 781 sizeof(struct pcb_config));
782 782
783 if (pcb_debug) { 783 if (pcb_debug) {
784 pr_info("SC(0x00) register = 0x%x\n", config_info); 784 dev_info(&dev->udev->dev,
785 pr_info("scenario %d\n", 785 "SC(0x00) register = 0x%x\n", config_info);
786 (dev->current_pcb_config.index) + 1); 786 dev_info(&dev->udev->dev,
787 pr_info("type=%x\n", dev->current_pcb_config.type); 787 "scenario %d\n",
788 pr_info("mode=%x\n", dev->current_pcb_config.mode); 788 (dev->current_pcb_config.index) + 1);
789 pr_info("speed=%x\n", dev->current_pcb_config.speed); 789 dev_info(&dev->udev->dev,
790 pr_info("ts1_source=%x\n", 790 "type=%x\n",
791 dev->current_pcb_config.ts1_source); 791 dev->current_pcb_config.type);
792 pr_info("ts2_source=%x\n", 792 dev_info(&dev->udev->dev,
793 dev->current_pcb_config.ts2_source); 793 "mode=%x\n",
794 pr_info("analog_source=%x\n", 794 dev->current_pcb_config.mode);
795 dev->current_pcb_config.analog_source); 795 dev_info(&dev->udev->dev,
796 "speed=%x\n",
797 dev->current_pcb_config.speed);
798 dev_info(&dev->udev->dev,
799 "ts1_source=%x\n",
800 dev->current_pcb_config.ts1_source);
801 dev_info(&dev->udev->dev,
802 "ts2_source=%x\n",
803 dev->current_pcb_config.ts2_source);
804 dev_info(&dev->udev->dev,
805 "analog_source=%x\n",
806 dev->current_pcb_config.analog_source);
796 } 807 }
797 808
798 return 0; 809 return 0;
diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c
index 14e1eb7f2128..9a562c80e0b1 100644
--- a/drivers/media/usb/cx231xx/cx231xx-vbi.c
+++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c
@@ -25,7 +25,6 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/bitmap.h> 27#include <linux/bitmap.h>
28#include <linux/usb.h>
29#include <linux/i2c.h> 28#include <linux/i2c.h>
30#include <linux/mm.h> 29#include <linux/mm.h>
31#include <linux/mutex.h> 30#include <linux/mutex.h>
@@ -69,9 +68,11 @@ static inline void print_err_status(struct cx231xx *dev, int packet, int status)
69 break; 68 break;
70 } 69 }
71 if (packet < 0) { 70 if (packet < 0) {
72 pr_err("URB status %d [%s].\n", status, errmsg); 71 dev_err(&dev->udev->dev,
72 "URB status %d [%s].\n", status, errmsg);
73 } else { 73 } else {
74 pr_err("URB packet %d, status %d [%s].\n", 74 dev_err(&dev->udev->dev,
75 "URB packet %d, status %d [%s].\n",
75 packet, status, errmsg); 76 packet, status, errmsg);
76 } 77 }
77} 78}
@@ -315,8 +316,8 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
315 case -ESHUTDOWN: 316 case -ESHUTDOWN:
316 return; 317 return;
317 default: /* error */ 318 default: /* error */
318 pr_err("urb completition error %d.\n", 319 dev_err(&dev->udev->dev,
319 urb->status); 320 "urb completition error %d.\n", urb->status);
320 break; 321 break;
321 } 322 }
322 323
@@ -330,7 +331,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
330 331
331 urb->status = usb_submit_urb(urb, GFP_ATOMIC); 332 urb->status = usb_submit_urb(urb, GFP_ATOMIC);
332 if (urb->status) { 333 if (urb->status) {
333 pr_err("urb resubmit failed (error=%i)\n", 334 dev_err(&dev->udev->dev, "urb resubmit failed (error=%i)\n",
334 urb->status); 335 urb->status);
335 } 336 }
336} 337}
@@ -343,7 +344,7 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)
343 struct urb *urb; 344 struct urb *urb;
344 int i; 345 int i;
345 346
346 pr_debug("called cx231xx_uninit_vbi_isoc\n"); 347 dev_dbg(&dev->udev->dev, "called cx231xx_uninit_vbi_isoc\n");
347 348
348 dev->vbi_mode.bulk_ctl.nfields = -1; 349 dev->vbi_mode.bulk_ctl.nfields = -1;
349 for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) { 350 for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
@@ -392,7 +393,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
392 struct urb *urb; 393 struct urb *urb;
393 int rc; 394 int rc;
394 395
395 pr_debug("called cx231xx_vbi_isoc\n"); 396 dev_dbg(&dev->udev->dev, "called cx231xx_vbi_isoc\n");
396 397
397 /* De-allocates all pending stuff */ 398 /* De-allocates all pending stuff */
398 cx231xx_uninit_vbi_isoc(dev); 399 cx231xx_uninit_vbi_isoc(dev);
@@ -418,14 +419,16 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
418 dev->vbi_mode.bulk_ctl.urb = kzalloc(sizeof(void *) * num_bufs, 419 dev->vbi_mode.bulk_ctl.urb = kzalloc(sizeof(void *) * num_bufs,
419 GFP_KERNEL); 420 GFP_KERNEL);
420 if (!dev->vbi_mode.bulk_ctl.urb) { 421 if (!dev->vbi_mode.bulk_ctl.urb) {
421 pr_err("cannot alloc memory for usb buffers\n"); 422 dev_err(&dev->udev->dev,
423 "cannot alloc memory for usb buffers\n");
422 return -ENOMEM; 424 return -ENOMEM;
423 } 425 }
424 426
425 dev->vbi_mode.bulk_ctl.transfer_buffer = 427 dev->vbi_mode.bulk_ctl.transfer_buffer =
426 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 428 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
427 if (!dev->vbi_mode.bulk_ctl.transfer_buffer) { 429 if (!dev->vbi_mode.bulk_ctl.transfer_buffer) {
428 pr_err("cannot allocate memory for usbtransfer\n"); 430 dev_err(&dev->udev->dev,
431 "cannot allocate memory for usbtransfer\n");
429 kfree(dev->vbi_mode.bulk_ctl.urb); 432 kfree(dev->vbi_mode.bulk_ctl.urb);
430 return -ENOMEM; 433 return -ENOMEM;
431 } 434 }
@@ -440,7 +443,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
440 443
441 urb = usb_alloc_urb(0, GFP_KERNEL); 444 urb = usb_alloc_urb(0, GFP_KERNEL);
442 if (!urb) { 445 if (!urb) {
443 pr_err("cannot alloc bulk_ctl.urb %i\n", i); 446 dev_err(&dev->udev->dev,
447 "cannot alloc bulk_ctl.urb %i\n", i);
444 cx231xx_uninit_vbi_isoc(dev); 448 cx231xx_uninit_vbi_isoc(dev);
445 return -ENOMEM; 449 return -ENOMEM;
446 } 450 }
@@ -450,7 +454,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
450 dev->vbi_mode.bulk_ctl.transfer_buffer[i] = 454 dev->vbi_mode.bulk_ctl.transfer_buffer[i] =
451 kzalloc(sb_size, GFP_KERNEL); 455 kzalloc(sb_size, GFP_KERNEL);
452 if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) { 456 if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) {
453 pr_err("unable to allocate %i bytes for transfer buffer %i%s\n", 457 dev_err(&dev->udev->dev,
458 "unable to allocate %i bytes for transfer buffer %i%s\n",
454 sb_size, i, 459 sb_size, i,
455 in_interrupt() ? " while in int" : ""); 460 in_interrupt() ? " while in int" : "");
456 cx231xx_uninit_vbi_isoc(dev); 461 cx231xx_uninit_vbi_isoc(dev);
@@ -469,7 +474,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
469 for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) { 474 for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
470 rc = usb_submit_urb(dev->vbi_mode.bulk_ctl.urb[i], GFP_ATOMIC); 475 rc = usb_submit_urb(dev->vbi_mode.bulk_ctl.urb[i], GFP_ATOMIC);
471 if (rc) { 476 if (rc) {
472 pr_err("submit of urb %i failed (error=%i)\n", i, rc); 477 dev_err(&dev->udev->dev,
478 "submit of urb %i failed (error=%i)\n", i, rc);
473 cx231xx_uninit_vbi_isoc(dev); 479 cx231xx_uninit_vbi_isoc(dev);
474 return rc; 480 return rc;
475 } 481 }
@@ -520,7 +526,7 @@ static inline void vbi_buffer_filled(struct cx231xx *dev,
520 struct cx231xx_buffer *buf) 526 struct cx231xx_buffer *buf)
521{ 527{
522 /* Advice that buffer was filled */ 528 /* Advice that buffer was filled */
523 /* pr_debug("[%p/%d] wakeup\n", buf, buf->vb.i); */ 529 /* dev_dbg(&dev->udev->dev, "[%p/%d] wakeup\n", buf, buf->vb.i); */
524 530
525 buf->vb.state = VIDEOBUF_DONE; 531 buf->vb.state = VIDEOBUF_DONE;
526 buf->vb.field_count++; 532 buf->vb.field_count++;
@@ -612,7 +618,7 @@ static inline void get_next_vbi_buf(struct cx231xx_dmaqueue *dma_q,
612 char *outp; 618 char *outp;
613 619
614 if (list_empty(&dma_q->active)) { 620 if (list_empty(&dma_q->active)) {
615 pr_err("No active queue to serve\n"); 621 dev_err(&dev->udev->dev, "No active queue to serve\n");
616 dev->vbi_mode.bulk_ctl.buf = NULL; 622 dev->vbi_mode.bulk_ctl.buf = NULL;
617 *buf = NULL; 623 *buf = NULL;
618 return; 624 return;
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index 4d1d750ab38d..5ea8124f5d20 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -28,7 +28,6 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/bitmap.h> 30#include <linux/bitmap.h>
31#include <linux/usb.h>
32#include <linux/i2c.h> 31#include <linux/i2c.h>
33#include <linux/mm.h> 32#include <linux/mm.h>
34#include <linux/mutex.h> 33#include <linux/mutex.h>
@@ -737,8 +736,9 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
737 if (!dev->video_mode.bulk_ctl.num_bufs) 736 if (!dev->video_mode.bulk_ctl.num_bufs)
738 urb_init = 1; 737 urb_init = 1;
739 } 738 }
740 /*pr_debug("urb_init=%d dev->video_mode.max_pkt_size=%d\n", 739 dev_dbg(&dev->udev->dev,
741 urb_init, dev->video_mode.max_pkt_size);*/ 740 "urb_init=%d dev->video_mode.max_pkt_size=%d\n",
741 urb_init, dev->video_mode.max_pkt_size);
742 if (urb_init) { 742 if (urb_init) {
743 dev->mode_tv = 0; 743 dev->mode_tv = 0;
744 if (dev->USE_ISO) 744 if (dev->USE_ISO)
@@ -809,7 +809,7 @@ void video_mux(struct cx231xx *dev, int index)
809 809
810 cx231xx_set_audio_input(dev, dev->ctl_ainput); 810 cx231xx_set_audio_input(dev, dev->ctl_ainput);
811 811
812 pr_debug("video_mux : %d\n", index); 812 dev_dbg(&dev->udev->dev, "video_mux : %d\n", index);
813 813
814 /* do mode control overrides if required */ 814 /* do mode control overrides if required */
815 cx231xx_do_mode_ctrl_overrides(dev); 815 cx231xx_do_mode_ctrl_overrides(dev);
@@ -861,7 +861,7 @@ static void res_free(struct cx231xx_fh *fh)
861static int check_dev(struct cx231xx *dev) 861static int check_dev(struct cx231xx *dev)
862{ 862{
863 if (dev->state & DEV_DISCONNECTED) { 863 if (dev->state & DEV_DISCONNECTED) {
864 pr_err("v4l2 ioctl: device not present\n"); 864 dev_err(&dev->udev->dev, "v4l2 ioctl: device not present\n");
865 return -ENODEV; 865 return -ENODEV;
866 } 866 }
867 return 0; 867 return 0;
@@ -953,12 +953,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
953 return -EINVAL; 953 return -EINVAL;
954 954
955 if (videobuf_queue_is_busy(&fh->vb_vidq)) { 955 if (videobuf_queue_is_busy(&fh->vb_vidq)) {
956 pr_err("%s: queue busy\n", __func__); 956 dev_err(&dev->udev->dev, "%s: queue busy\n", __func__);
957 return -EBUSY; 957 return -EBUSY;
958 } 958 }
959 959
960 if (dev->stream_on && !fh->stream_on) { 960 if (dev->stream_on && !fh->stream_on) {
961 pr_err("%s: device in use by another fh\n", __func__); 961 dev_err(&dev->udev->dev,
962 "%s: device in use by another fh\n", __func__);
962 return -EBUSY; 963 return -EBUSY;
963 } 964 }
964 965
@@ -1176,8 +1177,9 @@ int cx231xx_s_frequency(struct file *file, void *priv,
1176 int rc; 1177 int rc;
1177 u32 if_frequency = 5400000; 1178 u32 if_frequency = 5400000;
1178 1179
1179 pr_debug("Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", 1180 dev_dbg(&dev->udev->dev,
1180 f->frequency, f->type); 1181 "Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n",
1182 f->frequency, f->type);
1181 1183
1182 rc = check_dev(dev); 1184 rc = check_dev(dev);
1183 if (rc < 0) 1185 if (rc < 0)
@@ -1212,13 +1214,14 @@ int cx231xx_s_frequency(struct file *file, void *priv,
1212 else if (dev->norm & V4L2_STD_SECAM_LC) 1214 else if (dev->norm & V4L2_STD_SECAM_LC)
1213 if_frequency = 1250000; /*1.25MHz */ 1215 if_frequency = 1250000; /*1.25MHz */
1214 1216
1215 pr_debug("if_frequency is set to %d\n", if_frequency); 1217 dev_dbg(&dev->udev->dev,
1218 "if_frequency is set to %d\n", if_frequency);
1216 cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1); 1219 cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1);
1217 1220
1218 update_HH_register_after_set_DIF(dev); 1221 update_HH_register_after_set_DIF(dev);
1219 } 1222 }
1220 1223
1221 pr_debug("Set New FREQUENCY to %d\n", f->frequency); 1224 dev_dbg(&dev->udev->dev, "Set New FREQUENCY to %d\n", f->frequency);
1222 1225
1223 return rc; 1226 return rc;
1224} 1227}
@@ -1522,7 +1525,8 @@ static int vidioc_s_fmt_vbi_cap(struct file *file, void *priv,
1522 struct cx231xx *dev = fh->dev; 1525 struct cx231xx *dev = fh->dev;
1523 1526
1524 if (dev->vbi_stream_on && !fh->stream_on) { 1527 if (dev->vbi_stream_on && !fh->stream_on) {
1525 pr_err("%s device in use by another fh\n", __func__); 1528 dev_err(&dev->udev->dev,
1529 "%s device in use by another fh\n", __func__);
1526 return -EBUSY; 1530 return -EBUSY;
1527 } 1531 }
1528 return vidioc_try_fmt_vbi_cap(file, priv, f); 1532 return vidioc_try_fmt_vbi_cap(file, priv, f);
@@ -1641,16 +1645,15 @@ static int cx231xx_v4l2_open(struct file *filp)
1641#if 0 1645#if 0
1642 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); 1646 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE);
1643 if (errCode < 0) { 1647 if (errCode < 0) {
1644 pr_err("Device locked on digital mode. Can't open analog\n"); 1648 dev_err(&dev->udev->dev,
1649 "Device locked on digital mode. Can't open analog\n");
1645 return -EBUSY; 1650 return -EBUSY;
1646 } 1651 }
1647#endif 1652#endif
1648 1653
1649 fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL); 1654 fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL);
1650 if (!fh) { 1655 if (!fh)
1651 pr_err("cx231xx-video.c: Out of memory?!\n");
1652 return -ENOMEM; 1656 return -ENOMEM;
1653 }
1654 if (mutex_lock_interruptible(&dev->lock)) { 1657 if (mutex_lock_interruptible(&dev->lock)) {
1655 kfree(fh); 1658 kfree(fh);
1656 return -ERESTARTSYS; 1659 return -ERESTARTSYS;
@@ -1734,7 +1737,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
1734 dev->radio_dev = NULL; 1737 dev->radio_dev = NULL;
1735 } 1738 }
1736 if (dev->vbi_dev) { 1739 if (dev->vbi_dev) {
1737 pr_info("V4L2 device %s deregistered\n", 1740 dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n",
1738 video_device_node_name(dev->vbi_dev)); 1741 video_device_node_name(dev->vbi_dev));
1739 if (video_is_registered(dev->vbi_dev)) 1742 if (video_is_registered(dev->vbi_dev))
1740 video_unregister_device(dev->vbi_dev); 1743 video_unregister_device(dev->vbi_dev);
@@ -1743,7 +1746,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
1743 dev->vbi_dev = NULL; 1746 dev->vbi_dev = NULL;
1744 } 1747 }
1745 if (dev->vdev) { 1748 if (dev->vdev) {
1746 pr_info("V4L2 device %s deregistered\n", 1749 dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n",
1747 video_device_node_name(dev->vdev)); 1750 video_device_node_name(dev->vdev));
1748 1751
1749 if (dev->board.has_417) 1752 if (dev->board.has_417)
@@ -2078,7 +2081,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
2078{ 2081{
2079 int ret; 2082 int ret;
2080 2083
2081 pr_info("v4l2 driver version %s\n", CX231XX_VERSION); 2084 dev_info(&dev->udev->dev, "v4l2 driver version %s\n", CX231XX_VERSION);
2082 2085
2083 /* set default norm */ 2086 /* set default norm */
2084 dev->norm = V4L2_STD_PAL; 2087 dev->norm = V4L2_STD_PAL;
@@ -2116,7 +2119,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
2116 /* allocate and fill video video_device struct */ 2119 /* allocate and fill video video_device struct */
2117 dev->vdev = cx231xx_vdev_init(dev, &cx231xx_video_template, "video"); 2120 dev->vdev = cx231xx_vdev_init(dev, &cx231xx_video_template, "video");
2118 if (!dev->vdev) { 2121 if (!dev->vdev) {
2119 pr_err("cannot allocate video_device.\n"); 2122 dev_err(&dev->udev->dev, "cannot allocate video_device.\n");
2120 return -ENODEV; 2123 return -ENODEV;
2121 } 2124 }
2122 2125
@@ -2125,12 +2128,13 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
2125 ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER, 2128 ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER,
2126 video_nr[dev->devno]); 2129 video_nr[dev->devno]);
2127 if (ret) { 2130 if (ret) {
2128 pr_err("unable to register video device (error=%i).\n", 2131 dev_err(&dev->udev->dev,
2132 "unable to register video device (error=%i).\n",
2129 ret); 2133 ret);
2130 return ret; 2134 return ret;
2131 } 2135 }
2132 2136
2133 pr_info("Registered video device %s [v4l2]\n", 2137 dev_info(&dev->udev->dev, "Registered video device %s [v4l2]\n",
2134 video_device_node_name(dev->vdev)); 2138 video_device_node_name(dev->vdev));
2135 2139
2136 /* Initialize VBI template */ 2140 /* Initialize VBI template */
@@ -2141,7 +2145,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
2141 dev->vbi_dev = cx231xx_vdev_init(dev, &cx231xx_vbi_template, "vbi"); 2145 dev->vbi_dev = cx231xx_vdev_init(dev, &cx231xx_vbi_template, "vbi");
2142 2146
2143 if (!dev->vbi_dev) { 2147 if (!dev->vbi_dev) {
2144 pr_err("cannot allocate video_device.\n"); 2148 dev_err(&dev->udev->dev, "cannot allocate video_device.\n");
2145 return -ENODEV; 2149 return -ENODEV;
2146 } 2150 }
2147 dev->vbi_dev->ctrl_handler = &dev->ctrl_handler; 2151 dev->vbi_dev->ctrl_handler = &dev->ctrl_handler;
@@ -2149,28 +2153,30 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
2149 ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, 2153 ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
2150 vbi_nr[dev->devno]); 2154 vbi_nr[dev->devno]);
2151 if (ret < 0) { 2155 if (ret < 0) {
2152 pr_err("unable to register vbi device\n"); 2156 dev_err(&dev->udev->dev, "unable to register vbi device\n");
2153 return ret; 2157 return ret;
2154 } 2158 }
2155 2159
2156 pr_info("Registered VBI device %s\n", 2160 dev_info(&dev->udev->dev, "Registered VBI device %s\n",
2157 video_device_node_name(dev->vbi_dev)); 2161 video_device_node_name(dev->vbi_dev));
2158 2162
2159 if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { 2163 if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) {
2160 dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template, 2164 dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template,
2161 "radio"); 2165 "radio");
2162 if (!dev->radio_dev) { 2166 if (!dev->radio_dev) {
2163 pr_err("cannot allocate video_device.\n"); 2167 dev_err(&dev->udev->dev,
2168 "cannot allocate video_device.\n");
2164 return -ENODEV; 2169 return -ENODEV;
2165 } 2170 }
2166 dev->radio_dev->ctrl_handler = &dev->radio_ctrl_handler; 2171 dev->radio_dev->ctrl_handler = &dev->radio_ctrl_handler;
2167 ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO, 2172 ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO,
2168 radio_nr[dev->devno]); 2173 radio_nr[dev->devno]);
2169 if (ret < 0) { 2174 if (ret < 0) {
2170 pr_err("can't register radio device\n"); 2175 dev_err(&dev->udev->dev,
2176 "can't register radio device\n");
2171 return ret; 2177 return ret;
2172 } 2178 }
2173 pr_info("Registered radio device as %s\n", 2179 dev_info(&dev->udev->dev, "Registered radio device as %s\n",
2174 video_device_node_name(dev->radio_dev)); 2180 video_device_node_name(dev->radio_dev));
2175 } 2181 }
2176 2182
diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h
index 253f2437c0f1..1a850da4e8c0 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -22,14 +22,13 @@
22#ifndef _CX231XX_H 22#ifndef _CX231XX_H
23#define _CX231XX_H 23#define _CX231XX_H
24 24
25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26
27#include <linux/videodev2.h> 25#include <linux/videodev2.h>
28#include <linux/types.h> 26#include <linux/types.h>
29#include <linux/ioctl.h> 27#include <linux/ioctl.h>
30#include <linux/i2c.h> 28#include <linux/i2c.h>
31#include <linux/workqueue.h> 29#include <linux/workqueue.h>
32#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/usb.h>
33 32
34#include <media/cx2341x.h> 33#include <media/cx2341x.h>
35 34