USB: gtco.c: remove dbg() usage
[firefly-linux-kernel-4.4.55.git] / drivers / input / tablet / gtco.c
index 89a297801dce7e8d4c03abf98d851b898177f1ee..422b1a2ef30926bcc98b3eb126e86e8323465fc8 100644 (file)
@@ -2,8 +2,6 @@
 
 GTCO digitizer USB driver
 
-Use the err() and dbg() macros from usb.h for system logging
-
 TO CHECK:  Is pressure done right on report 5?
 
 Copyright (C) 2006  GTCO CalComp
@@ -202,6 +200,7 @@ struct hid_descriptor
 static void parse_hid_report_descriptor(struct gtco *device, char * report,
                                        int length)
 {
+       struct device *ddev = &device->inputdevice->dev;
        int   x, i = 0;
 
        /* Tag primitive vars */
@@ -228,7 +227,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
        char  indentstr[10] = "";
 
 
-       dbg("======>>>>>>PARSE<<<<<<======");
+       dev_dbg(ddev, "======>>>>>>PARSE<<<<<<======\n");
 
        /* Walk  this report and pull out the info we need */
        while (i < length) {
@@ -277,11 +276,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
                                else if (data == 3)
                                        strcpy(globtype, "Var|Const");
 
-                               dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits",
-                                   globalval[TAG_GLOB_REPORT_ID], inputnum,
-                                   globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],
-                                   globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],
-                                   globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);
+                               dev_dbg(ddev, "::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\n",
+                                       globalval[TAG_GLOB_REPORT_ID], inputnum,
+                                       globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],
+                                       globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],
+                                       globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);
 
 
                                /*
@@ -292,7 +291,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
                                 */
                                switch (inputnum) {
                                case 0:  /* X coord */
-                                       dbg("GER: X Usage: 0x%x", usage);
+                                       dev_dbg(ddev, "GER: X Usage: 0x%x\n", usage);
                                        if (device->max_X == 0) {
                                                device->max_X = globalval[TAG_GLOB_LOG_MAX];
                                                device->min_X = globalval[TAG_GLOB_LOG_MIN];
@@ -300,7 +299,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
                                        break;
 
                                case 1:  /* Y coord */
-                                       dbg("GER: Y Usage: 0x%x", usage);
+                                       dev_dbg(ddev, "GER: Y Usage: 0x%x\n", usage);
                                        if (device->max_Y == 0) {
                                                device->max_Y = globalval[TAG_GLOB_LOG_MAX];
                                                device->min_Y = globalval[TAG_GLOB_LOG_MIN];
@@ -350,10 +349,10 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
                                maintype = 'S';
 
                                if (data == 0) {
-                                       dbg("======>>>>>> Physical");
+                                       dev_dbg(ddev, "======>>>>>> Physical\n");
                                        strcpy(globtype, "Physical");
                                } else
-                                       dbg("======>>>>>>");
+                                       dev_dbg(ddev, "======>>>>>>\n");
 
                                /* Indent the debug output */
                                indent++;
@@ -368,7 +367,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
                                break;
 
                        case TAG_MAIN_COL_END:
-                               dbg("<<<<<<======");
+                               dev_dbg(ddev, "<<<<<<======\n");
                                maintype = 'E';
                                indent--;
                                for (x = 0; x < indent; x++)
@@ -384,18 +383,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
 
                        switch (size) {
                        case 1:
-                               dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x",
-                                   indentstr, tag, maintype, size, globtype, data);
+                               dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n",
+                                       indentstr, tag, maintype, size, globtype, data);
                                break;
 
                        case 2:
-                               dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x",
-                                   indentstr, tag, maintype, size, globtype, data16);
+                               dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n",
+                                       indentstr, tag, maintype, size, globtype, data16);
                                break;
 
                        case 4:
-                               dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x",
-                                   indentstr, tag, maintype, size, globtype, data32);
+                               dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n",
+                                       indentstr, tag, maintype, size, globtype, data32);
                                break;
                        }
                        break;
@@ -465,26 +464,26 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
                        if (tag < TAG_GLOB_MAX) {
                                switch (size) {
                                case 1:
-                                       dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",
-                                           indentstr, globtype, tag, size, data);
+                                       dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n",
+                                               indentstr, globtype, tag, size, data);
                                        globalval[tag] = data;
                                        break;
 
                                case 2:
-                                       dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",
-                                           indentstr, globtype, tag, size, data16);
+                                       dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n",
+                                               indentstr, globtype, tag, size, data16);
                                        globalval[tag] = data16;
                                        break;
 
                                case 4:
-                                       dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x",
-                                           indentstr, globtype, tag, size, data32);
+                                       dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n",
+                                               indentstr, globtype, tag, size, data32);
                                        globalval[tag] = data32;
                                        break;
                                }
                        } else {
-                               dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ",
-                                   indentstr, tag, size);
+                               dev_dbg(ddev, "%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\n",
+                                       indentstr, tag, size);
                        }
                        break;
 
@@ -511,18 +510,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
 
                        switch (size) {
                        case 1:
-                               dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x",
-                                   indentstr, tag, globtype, size, data);
+                               dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n",
+                                       indentstr, tag, globtype, size, data);
                                break;
 
                        case 2:
-                               dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x",
-                                   indentstr, tag, globtype, size, data16);
+                               dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n",
+                                       indentstr, tag, globtype, size, data16);
                                break;
 
                        case 4:
-                               dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x",
-                                   indentstr, tag, globtype, size, data32);
+                               dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n",
+                                       indentstr, tag, globtype, size, data32);
                                break;
                        }
 
@@ -714,8 +713,9 @@ static void gtco_urb_callback(struct urb *urbinfo)
                                 * the rest as 0
                                 */
                                val = device->buffer[5] & MASK_BUTTON;
-                               dbg("======>>>>>>REPORT 1: val 0x%X(%d)",
-                                   val, val);
+                               dev_dbg(&inputdev->dev,
+                                       "======>>>>>>REPORT 1: val 0x%X(%d)\n",
+                                       val, val);
 
                                /*
                                 * We don't apply any meaning to the button
@@ -808,7 +808,8 @@ static void gtco_urb_callback(struct urb *urbinfo)
  resubmit:
        rc = usb_submit_urb(urbinfo, GFP_ATOMIC);
        if (rc != 0)
-               err("usb_submit_urb failed rc=0x%x", rc);
+               dev_err(&inputdev->dev,
+                       "usb_submit_urb failed rc=0x%x\n", rc);
 }
 
 /*
@@ -838,7 +839,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
        gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!gtco || !input_dev) {
-               err("No more memory");
+               dev_err(&usbinterface->dev, "No more memory\n");
                error = -ENOMEM;
                goto err_free_devs;
        }
@@ -853,7 +854,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
        gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE,
                                          GFP_KERNEL, &gtco->buf_dma);
        if (!gtco->buffer) {
-               err("No more memory for us buffers");
+               dev_err(&usbinterface->dev, "No more memory for us buffers\n");
                error = -ENOMEM;
                goto err_free_devs;
        }
@@ -861,7 +862,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
        /* Allocate URB for reports */
        gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL);
        if (!gtco->urbinfo) {
-               err("Failed to allocate URB");
+               dev_err(&usbinterface->dev, "Failed to allocate URB\n");
                error = -ENOMEM;
                goto err_free_buf;
        }
@@ -873,14 +874,14 @@ static int gtco_probe(struct usb_interface *usbinterface,
        endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
 
        /* Some debug */
-       dbg("gtco # interfaces: %d", usbinterface->num_altsetting);
-       dbg("num endpoints:     %d", usbinterface->cur_altsetting->desc.bNumEndpoints);
-       dbg("interface class:   %d", usbinterface->cur_altsetting->desc.bInterfaceClass);
-       dbg("endpoint: attribute:0x%x type:0x%x", endpoint->bmAttributes, endpoint->bDescriptorType);
+       dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting);
+       dev_dbg(&usbinterface->dev, "num endpoints:     %d\n", usbinterface->cur_altsetting->desc.bNumEndpoints);
+       dev_dbg(&usbinterface->dev, "interface class:   %d\n", usbinterface->cur_altsetting->desc.bInterfaceClass);
+       dev_dbg(&usbinterface->dev, "endpoint: attribute:0x%x type:0x%x\n", endpoint->bmAttributes, endpoint->bDescriptorType);
        if (usb_endpoint_xfer_int(endpoint))
-               dbg("endpoint: we have interrupt endpoint\n");
+               dev_dbg(&usbinterface->dev, "endpoint: we have interrupt endpoint\n");
 
-       dbg("endpoint extra len:%d ", usbinterface->altsetting[0].extralen);
+       dev_dbg(&usbinterface->dev, "endpoint extra len:%d\n", usbinterface->altsetting[0].extralen);
 
        /*
         * Find the HID descriptor so we can find out the size of the
@@ -888,17 +889,19 @@ static int gtco_probe(struct usb_interface *usbinterface,
         */
        if (usb_get_extra_descriptor(usbinterface->cur_altsetting,
                                     HID_DEVICE_TYPE, &hid_desc) != 0){
-               err("Can't retrieve exta USB descriptor to get hid report descriptor length");
+               dev_err(&usbinterface->dev,
+                       "Can't retrieve exta USB descriptor to get hid report descriptor length\n");
                error = -EIO;
                goto err_free_urb;
        }
 
-       dbg("Extra descriptor success: type:%d  len:%d",
-           hid_desc->bDescriptorType,  hid_desc->wDescriptorLength);
+       dev_dbg(&usbinterface->dev,
+               "Extra descriptor success: type:%d  len:%d\n",
+               hid_desc->bDescriptorType,  hid_desc->wDescriptorLength);
 
        report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL);
        if (!report) {
-               err("No more memory for report");
+               dev_err(&usbinterface->dev, "No more memory for report\n");
                error = -ENOMEM;
                goto err_free_urb;
        }
@@ -915,7 +918,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
                                         le16_to_cpu(hid_desc->wDescriptorLength),
                                         5000); /* 5 secs */
 
-               dbg("usb_control_msg result: %d", result);
+               dev_dbg(&usbinterface->dev, "usb_control_msg result: %d\n", result);
                if (result == le16_to_cpu(hid_desc->wDescriptorLength)) {
                        parse_hid_report_descriptor(gtco, report, result);
                        break;
@@ -926,8 +929,9 @@ static int gtco_probe(struct usb_interface *usbinterface,
 
        /* If we didn't get the report, fail */
        if (result != le16_to_cpu(hid_desc->wDescriptorLength)) {
-               err("Failed to get HID Report Descriptor of size: %d",
-                   hid_desc->wDescriptorLength);
+               dev_err(&usbinterface->dev,
+                       "Failed to get HID Report Descriptor of size: %d\n",
+                       hid_desc->wDescriptorLength);
                error = -EIO;
                goto err_free_urb;
        }