USB-CDC: Use native debug printout macros
Replace Linux-like debug printout macros by native ones.
Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
Applied after removing dead code like '#define DEBUG/#undef DEBUG'
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index a07738f..5b2f6dd 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -31,14 +31,7 @@
#include "gadget_chips.h"
#define USB_NET_NAME "usb0"
-#define dprintf(x, ...)
-#undef INFO
-#define INFO(x, s...) printf(s)
-#define dev_err(x, stuff...) printf(stuff)
-#define dev_dbg dev_err
-#define dev_warn dev_err
-#define DEBUG dev_err
-#define VDEBUG DEBUG
+
#define atomic_read
extern struct platform_data brd;
#define spin_lock(x)
@@ -769,7 +762,7 @@
result = usb_ep_enable (dev->status_ep, dev->status);
if (result != 0) {
- printf ("enable %s --> %d\n",
+ debug("enable %s --> %d\n",
dev->status_ep->name, result);
goto done;
}
@@ -789,14 +782,14 @@
if (!cdc_active(dev)) {
result = usb_ep_enable (dev->in_ep, dev->in);
if (result != 0) {
- printf ("enable %s --> %d\n",
+ debug("enable %s --> %d\n",
dev->in_ep->name, result);
goto done;
}
result = usb_ep_enable (dev->out_ep, dev->out);
if (result != 0) {
- printf ("enable %s --> %d\n",
+ debug("enable %s --> %d\n",
dev->out_ep->name, result);
goto done;
}
@@ -827,6 +820,8 @@
if (dev->config == 0)
return;
+ debug("%s\n", __func__);
+
/* disable endpoints, forcing (synchronous) completion of
* pending i/o. then free the requests.
*/
@@ -864,7 +859,7 @@
&& dev->config
&& dev->tx_qlen != 0) {
/* tx fifo is full, but we can't clear it...*/
- INFO (dev, "can't change configurations\n");
+ error("can't change configurations");
return -ESPIPE;
}
eth_reset_config (dev);
@@ -901,7 +896,7 @@
}
dev->config = number;
- INFO (dev, "%s speed config #%d: %d mA, %s, using %s\n",
+ printf("%s speed config #%d: %d mA, %s, using %s\n",
speed, number, power, driver_desc,
(cdc_active(dev)? "CDC Ethernet"
: "CDC Ethernet Subset"));
@@ -941,11 +936,11 @@
req->length = STATUS_BYTECOUNT;
value = usb_ep_queue (ep, req, GFP_ATOMIC);
- dprintf ("send SPEED_CHANGE --> %d\n", value);
+ debug("send SPEED_CHANGE --> %d\n", value);
if (value == 0)
return;
} else if (value != -ECONNRESET) {
- dprintf("event %02x --> %d\n",
+ debug("event %02x --> %d\n",
event->bNotificationType, value);
if (event->bNotificationType==
USB_CDC_NOTIFY_SPEED_CHANGE)
@@ -991,7 +986,7 @@
value = usb_ep_queue (dev->status_ep, req, GFP_ATOMIC);
if (value < 0)
- printf ("status buf queue --> %d\n", value);
+ debug("status buf queue --> %d\n", value);
}
#endif
@@ -1001,8 +996,7 @@
static void eth_setup_complete (struct usb_ep *ep, struct usb_request *req)
{
if (req->status || req->actual != req->length)
- dprintf (/*(struct eth_dev *) ep->driver_data*/
- "setup complete --> %d, %d/%d\n",
+ debug("setup complete --> %d, %d/%d\n",
req->status, req->actual, req->length);
}
@@ -1029,7 +1023,7 @@
* while config change events may enable network traffic.
*/
- dprintf("eth_setup:...\n");
+ debug("%s\n", __func__);
req->complete = eth_setup_complete;
switch (ctrl->bRequest) {
@@ -1078,9 +1072,9 @@
if (ctrl->bRequestType != 0)
break;
if (gadget->a_hnp_support)
- DEBUG (dev, "HNP available\n");
+ debug("HNP available\n");
else if (gadget->a_alt_hnp_support)
- DEBUG (dev, "HNP needs a different root port\n");
+ debug("HNP needs a different root port\n");
value = eth_set_config (dev, wValue, GFP_ATOMIC);
break;
case USB_REQ_GET_CONFIGURATION:
@@ -1145,7 +1139,7 @@
/* FIXME this is wrong, as is the assumption that
* all non-PXA hardware talks real CDC ...
*/
- dev_warn (&gadget->dev, "set_interface ignored!\n");
+ debug("set_interface ignored!\n");
#endif /* DEV_CONFIG_CDC */
done_set_intf:
@@ -1179,7 +1173,7 @@
|| wLength != 0
|| wIndex > 1)
break;
- printf ("packet filter %02x\n", wValue);
+ debug("packet filter %02x\n", wValue);
dev->cdc_filter = wValue;
value = 0;
break;
@@ -1194,21 +1188,20 @@
#endif /* DEV_CONFIG_CDC */
default:
- printf (
- "unknown control req%02x.%02x v%04x i%04x l%d\n",
+ debug("unknown control req%02x.%02x v%04x i%04x l%d\n",
ctrl->bRequestType, ctrl->bRequest,
wValue, wIndex, wLength);
}
/* respond with data transfer before status phase? */
if (value >= 0) {
- dprintf("respond with data transfer before status phase\n");
+ debug("respond with data transfer before status phase\n");
req->length = value;
req->zero = value < wLength
&& (value % gadget->ep0->maxpacket) == 0;
value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);
if (value < 0) {
- DEBUG (dev, "ep_queue --> %d\n", value);
+ debug("ep_queue --> %d\n", value);
req->status = 0;
eth_setup_complete (gadget->ep0, req);
}
@@ -1237,7 +1230,7 @@
* byte off the end (to force hardware errors on overflow).
*/
- dprintf("%s\n", __func__);
+ debug("%s\n", __func__);
size = (ETHER_HDR_SIZE + dev->mtu + RX_EXTRA);
size += dev->out_ep->maxpacket - 1;
@@ -1255,7 +1248,7 @@
retval = usb_ep_queue (dev->out_ep, req, gfp_flags);
if (retval) {
- dprintf ("rx submit --> %d\n", retval);
+ error("rx submit --> %d", retval);
}
return retval;
}
@@ -1265,8 +1258,7 @@
{
struct eth_dev *dev = ep->driver_data;
- dprintf("%s\n", __func__);
- dprintf("rx status %d\n", req->status);
+ debug("%s: status %d\n", __func__, req->status);
packet_received=1;
@@ -1291,14 +1283,14 @@
return 0;
fail:
- DEBUG (dev, "can't alloc requests\n");
+ error("can't alloc requests");
return -1;
}
static void tx_complete (struct usb_ep *ep, struct usb_request *req)
{
- dprintf("%s, status: %s\n", __func__,(req->status) ? "failed":"ok");
+ debug("%s: status %s\n", __func__, (req->status)?"failed":"ok");
packet_sent=1;
}
@@ -1427,7 +1419,7 @@
{
struct eth_dev *dev = get_gadget_data (gadget);
- printf("eth_unbind:...\n");
+ debug("%s...\n", __func__);
if (dev->stat_req) {
usb_ep_free_request (dev->status_ep, dev->stat_req);
@@ -1567,8 +1559,7 @@
* anything less functional on CDC-capable hardware,
* so we fail in this case.
*/
- dev_err (&gadget->dev,
- "controller '%s' not recognized\n",
+ error("controller '%s' not recognized",
gadget->name);
return -ENODEV;
}
@@ -1605,8 +1596,7 @@
in_ep = usb_ep_autoconfig (gadget, &fs_source_desc);
if (!in_ep) {
autoconf_fail:
- dev_err (&gadget->dev,
- "can't autoconfigure on %s\n",
+ error("can't autoconfigure on %s\n",
gadget->name);
return -ENODEV;
}
@@ -1700,18 +1690,18 @@
dev->host_mac [2], dev->host_mac [3],
dev->host_mac [4], dev->host_mac [5]);
- INFO (dev, "using %s, OUT %s IN %s%s%s\n", gadget->name,
+ printf("using %s, OUT %s IN %s%s%s\n", gadget->name,
out_ep->name, in_ep->name,
status_ep ? " STATUS " : "",
status_ep ? status_ep->name : ""
);
- INFO (dev, "MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
+ printf("MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->net->enetaddr [0], dev->net->enetaddr [1],
dev->net->enetaddr [2], dev->net->enetaddr [3],
dev->net->enetaddr [4], dev->net->enetaddr [5]);
if (cdc) {
- INFO (dev, "HOST MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
+ printf("HOST MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->host_mac [0], dev->host_mac [1],
dev->host_mac [2], dev->host_mac [3],
dev->host_mac [4], dev->host_mac [5]);
@@ -1755,7 +1745,7 @@
return 0;
fail:
- dev_dbg(&gadget->dev, "register_netdev failed\n");
+ error("%s failed", __func__);
eth_unbind (gadget);
return -ENOMEM;
}
@@ -1768,7 +1758,7 @@
unsigned long timeout = USB_CONNECT_TIMEOUT;
if (!netdev) {
- printf("ERROR: received NULL ptr\n");
+ error("received NULL ptr");
goto fail;
}
@@ -1790,7 +1780,7 @@
{
/* Handle control-c and timeouts */
if (ctrlc() || (get_timer(ts) > timeout)) {
- printf("The remote end did not respond in time.\n");
+ error("The remote end did not respond in time.");
goto fail;
}
usb_gadget_handle_interrupts();
@@ -1806,9 +1796,9 @@
{
int retval;
struct usb_request *req = NULL;
+ struct eth_dev *dev = &l_ethdev;
- struct eth_dev *dev = &l_ethdev;
- dprintf("%s:...\n",__func__);
+ debug("%s:...\n", __func__);
req = dev->tx_req;
@@ -1836,7 +1826,7 @@
retval = usb_ep_queue (dev->in_ep, req, GFP_ATOMIC);
if (!retval)
- dprintf("%s: packet queued\n",__func__);
+ debug("%s: packet queued\n", __func__);
while(!packet_sent)
{
packet_sent=0;
@@ -1853,7 +1843,7 @@
if (packet_received)
{
- dprintf("%s: packet received \n",__func__);
+ debug("%s: packet received \n", __func__);
if (dev->rx_req)
{
NetReceive(NetRxPackets[0],dev->rx_req->length);
@@ -1862,7 +1852,7 @@
if (dev->rx_req)
rx_submit (dev, dev->rx_req, 0);
}
- else printf("dev->rx_req invalid\n");
+ else error("dev->rx_req invalid");
}
return 0;
}
@@ -1873,7 +1863,7 @@
if (!netdev)
{
- printf("ERROR: received NULL ptr\n");
+ error("received NULL ptr");
return;
}
@@ -1929,11 +1919,11 @@
host_addr[sizeof(host_addr)-1] = '\0';
if (!is_eth_addr_valid(dev_addr)) {
- printf("ERROR: Need valid 'usbnet_devaddr' to be set\n");
+ error("Need valid 'usbnet_devaddr' to be set");
status = -1;
}
if (!is_eth_addr_valid(host_addr)) {
- printf("ERROR: Need valid 'usbnet_hostaddr' to be set\n");
+ error("Need valid 'usbnet_hostaddr' to be set");
status = -1;
}
if (status)
@@ -1947,7 +1937,7 @@
return 0;
fail:
- printf("%s failed\n", __func__ );
+ error("%s failed. error = %d", __func__, status);
return status;
}