[media] cx231xx: convert from pr_foo to dev_foo
[cascardo/linux.git] / drivers / media / usb / cx231xx / cx231xx-core.c
index 66e8f8a..36c3ecf 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/usb.h>
 #include <linux/vmalloc.h>
 #include <media/v4l2-common.h>
 #include <media/tuner.h>
@@ -228,7 +227,7 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
        /* call common vendor command request */
        status = cx231xx_send_vendor_cmd(dev, &ven_req);
        if (status < 0 && !dev->i2c_scan_running) {
-               pr_err("%s: failed with status -%d\n",
+               dev_err(&dev->udev->dev, "%s: failed with status -%d\n",
                        __func__, status);
        }
 
@@ -523,7 +522,8 @@ int cx231xx_set_video_alternate(struct cx231xx *dev)
                    usb_set_interface(dev->udev, usb_interface_index,
                                      dev->video_mode.alt);
                if (errCode < 0) {
-                       pr_err("cannot change alt number to %d (error=%i)\n",
+                       dev_err(&dev->udev->dev,
+                               "cannot change alt number to %d (error=%i)\n",
                                dev->video_mode.alt, errCode);
                        return errCode;
                }
@@ -598,7 +598,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt)
        }
 
        if (alt > 0 && max_pkt_size == 0) {
-               pr_err("can't change interface %d alt no. to %d: Max. Pkt size = 0\n",
+               dev_err(&dev->udev->dev,
+                       "can't change interface %d alt no. to %d: Max. Pkt size = 0\n",
                        usb_interface_index, alt);
                /*To workaround error number=-71 on EP0 for videograbber,
                 need add following codes.*/
@@ -613,7 +614,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt)
        if (usb_interface_index > 0) {
                status = usb_set_interface(dev->udev, usb_interface_index, alt);
                if (status < 0) {
-                       pr_err("can't change interface %d alt no. to %d (err=%i)\n",
+                       dev_err(&dev->udev->dev,
+                               "can't change interface %d alt no. to %d (err=%i)\n",
                                usb_interface_index, alt, status);
                        return status;
                }
@@ -771,8 +773,9 @@ int cx231xx_ep5_bulkout(struct cx231xx *dev, u8 *firmware, u16 size)
                        buffer, 4096, &actlen, 2000);
 
        if (ret)
-               pr_err("bulk message failed: %d (%d/%d)", ret,
-                               size, actlen);
+               dev_err(&dev->udev->dev,
+                       "bulk message failed: %d (%d/%d)", ret,
+                       size, actlen);
        else {
                errCode = actlen != size ? -1 : 0;
        }
@@ -1008,14 +1011,16 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
        dev->video_mode.isoc_ctl.urb =
            kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
        if (!dev->video_mode.isoc_ctl.urb) {
-               pr_err("cannot alloc memory for usb buffers\n");
+               dev_err(&dev->udev->dev,
+                       "cannot alloc memory for usb buffers\n");
                return -ENOMEM;
        }
 
        dev->video_mode.isoc_ctl.transfer_buffer =
            kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
        if (!dev->video_mode.isoc_ctl.transfer_buffer) {
-               pr_err("cannot allocate memory for usbtransfer\n");
+               dev_err(&dev->udev->dev,
+                       "cannot allocate memory for usbtransfer\n");
                kfree(dev->video_mode.isoc_ctl.urb);
                return -ENOMEM;
        }
@@ -1035,7 +1040,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
        for (i = 0; i < dev->video_mode.isoc_ctl.num_bufs; i++) {
                urb = usb_alloc_urb(max_packets, GFP_KERNEL);
                if (!urb) {
-                       pr_err("cannot alloc isoc_ctl.urb %i\n", i);
+                       dev_err(&dev->udev->dev,
+                               "cannot alloc isoc_ctl.urb %i\n", i);
                        cx231xx_uninit_isoc(dev);
                        return -ENOMEM;
                }
@@ -1045,7 +1051,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
                    usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL,
                                       &urb->transfer_dma);
                if (!dev->video_mode.isoc_ctl.transfer_buffer[i]) {
-                       pr_err("unable to allocate %i bytes for transfer buffer %i%s\n",
+                       dev_err(&dev->udev->dev,
+                               "unable to allocate %i bytes for transfer buffer %i%s\n",
                                sb_size, i,
                                in_interrupt() ? " while in int" : "");
                        cx231xx_uninit_isoc(dev);
@@ -1079,7 +1086,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
                rc = usb_submit_urb(dev->video_mode.isoc_ctl.urb[i],
                                    GFP_ATOMIC);
                if (rc) {
-                       pr_err("submit of urb %i failed (error=%i)\n", i,
+                       dev_err(&dev->udev->dev,
+                               "submit of urb %i failed (error=%i)\n", i,
                                rc);
                        cx231xx_uninit_isoc(dev);
                        return rc;
@@ -1140,14 +1148,16 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
        dev->video_mode.bulk_ctl.urb =
            kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
        if (!dev->video_mode.bulk_ctl.urb) {
-               pr_err("cannot alloc memory for usb buffers\n");
+               dev_err(&dev->udev->dev,
+                       "cannot alloc memory for usb buffers\n");
                return -ENOMEM;
        }
 
        dev->video_mode.bulk_ctl.transfer_buffer =
            kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
        if (!dev->video_mode.bulk_ctl.transfer_buffer) {
-               pr_err("cannot allocate memory for usbtransfer\n");
+               dev_err(&dev->udev->dev,
+                       "cannot allocate memory for usbtransfer\n");
                kfree(dev->video_mode.bulk_ctl.urb);
                return -ENOMEM;
        }
@@ -1167,7 +1177,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
        for (i = 0; i < dev->video_mode.bulk_ctl.num_bufs; i++) {
                urb = usb_alloc_urb(0, GFP_KERNEL);
                if (!urb) {
-                       pr_err("cannot alloc bulk_ctl.urb %i\n", i);
+                       dev_err(&dev->udev->dev,
+                               "cannot alloc bulk_ctl.urb %i\n", i);
                        cx231xx_uninit_bulk(dev);
                        return -ENOMEM;
                }
@@ -1178,7 +1189,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
                    usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL,
                                     &urb->transfer_dma);
                if (!dev->video_mode.bulk_ctl.transfer_buffer[i]) {
-                       pr_err("unable to allocate %i bytes for transfer buffer %i%s\n",
+                       dev_err(&dev->udev->dev,
+                               "unable to allocate %i bytes for transfer buffer %i%s\n",
                                sb_size, i,
                                in_interrupt() ? " while in int" : "");
                        cx231xx_uninit_bulk(dev);
@@ -1200,7 +1212,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
                rc = usb_submit_urb(dev->video_mode.bulk_ctl.urb[i],
                                    GFP_ATOMIC);
                if (rc) {
-                       pr_err("submit of urb %i failed (error=%i)\n", i,rc);
+                       dev_err(&dev->udev->dev,
+                               "submit of urb %i failed (error=%i)\n", i, rc);
                        cx231xx_uninit_bulk(dev);
                        return rc;
                }
@@ -1303,7 +1316,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
                errCode = cx231xx_set_power_mode(dev,
                                 POLARIS_AVMODE_ENXTERNAL_AV);
                if (errCode < 0) {
-                       pr_err("%s: Failed to set Power - errCode [%d]!\n",
+                       dev_err(&dev->udev->dev,
+                               "%s: Failed to set Power - errCode [%d]!\n",
                                __func__, errCode);
                        return errCode;
                }
@@ -1311,7 +1325,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
                errCode = cx231xx_set_power_mode(dev,
                                 POLARIS_AVMODE_ANALOGT_TV);
                if (errCode < 0) {
-                       pr_err("%s: Failed to set Power - errCode [%d]!\n",
+                       dev_err(&dev->udev->dev,
+                               "%s: Failed to set Power - errCode [%d]!\n",
                                __func__, errCode);
                        return errCode;
                }
@@ -1325,13 +1340,15 @@ int cx231xx_dev_init(struct cx231xx *dev)
        /* initialize Colibri block */
        errCode = cx231xx_afe_init_super_block(dev, 0x23c);
        if (errCode < 0) {
-               pr_err("%s: cx231xx_afe init super block - errCode [%d]!\n",
+               dev_err(&dev->udev->dev,
+                       "%s: cx231xx_afe init super block - errCode [%d]!\n",
                        __func__, errCode);
                return errCode;
        }
        errCode = cx231xx_afe_init_channels(dev);
        if (errCode < 0) {
-               pr_err("%s: cx231xx_afe init channels - errCode [%d]!\n",
+               dev_err(&dev->udev->dev,
+                       "%s: cx231xx_afe init channels - errCode [%d]!\n",
                        __func__, errCode);
                return errCode;
        }
@@ -1339,7 +1356,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
        /* Set DIF in By pass mode */
        errCode = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND);
        if (errCode < 0) {
-               pr_err("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n",
+               dev_err(&dev->udev->dev,
+                       "%s: cx231xx_dif set to By pass mode - errCode [%d]!\n",
                        __func__, errCode);
                return errCode;
        }
@@ -1347,7 +1365,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
        /* I2S block related functions */
        errCode = cx231xx_i2s_blk_initialize(dev);
        if (errCode < 0) {
-               pr_err("%s: cx231xx_i2s block initialize - errCode [%d]!\n",
+               dev_err(&dev->udev->dev,
+                       "%s: cx231xx_i2s block initialize - errCode [%d]!\n",
                        __func__, errCode);
                return errCode;
        }
@@ -1355,7 +1374,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
        /* init control pins */
        errCode = cx231xx_init_ctrl_pin_status(dev);
        if (errCode < 0) {
-               pr_err("%s: cx231xx_init ctrl pins - errCode [%d]!\n",
+               dev_err(&dev->udev->dev,
+                       "%s: cx231xx_init ctrl pins - errCode [%d]!\n",
                        __func__, errCode);
                return errCode;
        }
@@ -1381,7 +1401,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
                break;
        }
        if (errCode < 0) {
-               pr_err("%s: cx231xx_AGC mode to Analog - errCode [%d]!\n",
+               dev_err(&dev->udev->dev,
+                       "%s: cx231xx_AGC mode to Analog - errCode [%d]!\n",
                        __func__, errCode);
                return errCode;
        }
@@ -1457,7 +1478,7 @@ int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val,
        /* call common vendor command request */
        status = cx231xx_send_vendor_cmd(dev, &ven_req);
        if (status < 0) {
-               pr_err("%s: failed with status -%d\n",
+               dev_err(&dev->udev->dev, "%s: failed with status -%d\n",
                        __func__, status);
        }