Commit 6b4a16c3 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] mceusb: improve error logging

A number of recent bug reports involve usb_submit_urb() failing which was
only reported with debug parameter on. In addition, remove custom debug
function.

[m.chehab@samsung.com: patch rebased, as one of the patches on this
 series need changes]
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 776eced0
...@@ -153,19 +153,6 @@ ...@@ -153,19 +153,6 @@
#define MCE_COMMAND_IRDATA 0x80 #define MCE_COMMAND_IRDATA 0x80
#define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ #define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */
/* module parameters */
#ifdef CONFIG_USB_DEBUG
static bool debug = 1;
#else
static bool debug;
#endif
#define mce_dbg(dev, fmt, ...) \
do { \
if (debug) \
dev_info(dev, fmt, ## __VA_ARGS__); \
} while (0)
/* general constants */ /* general constants */
#define SEND_FLAG_IN_PROGRESS 1 #define SEND_FLAG_IN_PROGRESS 1
#define SEND_FLAG_COMPLETE 2 #define SEND_FLAG_COMPLETE 2
...@@ -541,16 +528,13 @@ static int mceusb_cmd_datasize(u8 cmd, u8 subcmd) ...@@ -541,16 +528,13 @@ static int mceusb_cmd_datasize(u8 cmd, u8 subcmd)
static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
int offset, int len, bool out) int offset, int len, bool out)
{ {
char codes[USB_BUFLEN * 3 + 1]; #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
char inout[9]; char *inout;
u8 cmd, subcmd, data1, data2, data3, data4; u8 cmd, subcmd, data1, data2, data3, data4;
struct device *dev = ir->dev; struct device *dev = ir->dev;
int i, start, skip = 0; int start, skip = 0;
u32 carrier, period; u32 carrier, period;
if (!debug)
return;
/* skip meaningless 0xb1 0x60 header bytes on orig receiver */ /* skip meaningless 0xb1 0x60 header bytes on orig receiver */
if (ir->flags.microsoft_gen1 && !out && !offset) if (ir->flags.microsoft_gen1 && !out && !offset)
skip = 2; skip = 2;
...@@ -558,16 +542,10 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -558,16 +542,10 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
if (len <= skip) if (len <= skip)
return; return;
for (i = 0; i < len && i < USB_BUFLEN; i++) dev_dbg(dev, "%cx data: %*ph (length=%d)",
snprintf(codes + i * 3, 4, "%02x ", buf[i + offset] & 0xff); (out ? 't' : 'r'), min(len, USB_BUFLEN), buf, len);
dev_info(dev, "%sx data: %s(length=%d)\n",
(out ? "t" : "r"), codes, len);
if (out) inout = out ? "Request" : "Got";
strcpy(inout, "Request\0");
else
strcpy(inout, "Got\0");
start = offset + skip; start = offset + skip;
cmd = buf[start] & 0xff; cmd = buf[start] & 0xff;
...@@ -583,50 +561,50 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -583,50 +561,50 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
break; break;
if ((subcmd == MCE_CMD_PORT_SYS) && if ((subcmd == MCE_CMD_PORT_SYS) &&
(data1 == MCE_CMD_RESUME)) (data1 == MCE_CMD_RESUME))
dev_info(dev, "Device resume requested\n"); dev_dbg(dev, "Device resume requested");
else else
dev_info(dev, "Unknown command 0x%02x 0x%02x\n", dev_dbg(dev, "Unknown command 0x%02x 0x%02x",
cmd, subcmd); cmd, subcmd);
break; break;
case MCE_CMD_PORT_SYS: case MCE_CMD_PORT_SYS:
switch (subcmd) { switch (subcmd) {
case MCE_RSP_EQEMVER: case MCE_RSP_EQEMVER:
if (!out) if (!out)
dev_info(dev, "Emulator interface version %x\n", dev_dbg(dev, "Emulator interface version %x",
data1); data1);
break; break;
case MCE_CMD_G_REVISION: case MCE_CMD_G_REVISION:
if (len == 2) if (len == 2)
dev_info(dev, "Get hw/sw rev?\n"); dev_dbg(dev, "Get hw/sw rev?");
else else
dev_info(dev, "hw/sw rev 0x%02x 0x%02x " dev_dbg(dev, "hw/sw rev 0x%02x 0x%02x 0x%02x 0x%02x",
"0x%02x 0x%02x\n", data1, data2, data1, data2,
buf[start + 4], buf[start + 5]); buf[start + 4], buf[start + 5]);
break; break;
case MCE_CMD_RESUME: case MCE_CMD_RESUME:
dev_info(dev, "Device resume requested\n"); dev_dbg(dev, "Device resume requested");
break; break;
case MCE_RSP_CMD_ILLEGAL: case MCE_RSP_CMD_ILLEGAL:
dev_info(dev, "Illegal PORT_SYS command\n"); dev_dbg(dev, "Illegal PORT_SYS command");
break; break;
case MCE_RSP_EQWAKEVERSION: case MCE_RSP_EQWAKEVERSION:
if (!out) if (!out)
dev_info(dev, "Wake version, proto: 0x%02x, " dev_dbg(dev, "Wake version, proto: 0x%02x, "
"payload: 0x%02x, address: 0x%02x, " "payload: 0x%02x, address: 0x%02x, "
"version: 0x%02x\n", "version: 0x%02x",
data1, data2, data3, data4); data1, data2, data3, data4);
break; break;
case MCE_RSP_GETPORTSTATUS: case MCE_RSP_GETPORTSTATUS:
if (!out) if (!out)
/* We use data1 + 1 here, to match hw labels */ /* We use data1 + 1 here, to match hw labels */
dev_info(dev, "TX port %d: blaster is%s connected\n", dev_dbg(dev, "TX port %d: blaster is%s connected",
data1 + 1, data4 ? " not" : ""); data1 + 1, data4 ? " not" : "");
break; break;
case MCE_CMD_FLASHLED: case MCE_CMD_FLASHLED:
dev_info(dev, "Attempting to flash LED\n"); dev_dbg(dev, "Attempting to flash LED");
break; break;
default: default:
dev_info(dev, "Unknown command 0x%02x 0x%02x\n", dev_dbg(dev, "Unknown command 0x%02x 0x%02x",
cmd, subcmd); cmd, subcmd);
break; break;
} }
...@@ -634,13 +612,13 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -634,13 +612,13 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
case MCE_CMD_PORT_IR: case MCE_CMD_PORT_IR:
switch (subcmd) { switch (subcmd) {
case MCE_CMD_SIG_END: case MCE_CMD_SIG_END:
dev_info(dev, "End of signal\n"); dev_dbg(dev, "End of signal");
break; break;
case MCE_CMD_PING: case MCE_CMD_PING:
dev_info(dev, "Ping\n"); dev_dbg(dev, "Ping");
break; break;
case MCE_CMD_UNKNOWN: case MCE_CMD_UNKNOWN:
dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n", dev_dbg(dev, "Resp to 9f 05 of 0x%02x 0x%02x",
data1, data2); data1, data2);
break; break;
case MCE_RSP_EQIRCFS: case MCE_RSP_EQIRCFS:
...@@ -649,51 +627,51 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -649,51 +627,51 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
if (!period) if (!period)
break; break;
carrier = (1000 * 1000) / period; carrier = (1000 * 1000) / period;
dev_info(dev, "%s carrier of %u Hz (period %uus)\n", dev_dbg(dev, "%s carrier of %u Hz (period %uus)",
inout, carrier, period); inout, carrier, period);
break; break;
case MCE_CMD_GETIRCFS: case MCE_CMD_GETIRCFS:
dev_info(dev, "Get carrier mode and freq\n"); dev_dbg(dev, "Get carrier mode and freq");
break; break;
case MCE_RSP_EQIRTXPORTS: case MCE_RSP_EQIRTXPORTS:
dev_info(dev, "%s transmit blaster mask of 0x%02x\n", dev_dbg(dev, "%s transmit blaster mask of 0x%02x",
inout, data1); inout, data1);
break; break;
case MCE_RSP_EQIRTIMEOUT: case MCE_RSP_EQIRTIMEOUT:
/* value is in units of 50us, so x*50/1000 ms */ /* value is in units of 50us, so x*50/1000 ms */
period = ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000; period = ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000;
dev_info(dev, "%s receive timeout of %d ms\n", dev_dbg(dev, "%s receive timeout of %d ms",
inout, period); inout, period);
break; break;
case MCE_CMD_GETIRTIMEOUT: case MCE_CMD_GETIRTIMEOUT:
dev_info(dev, "Get receive timeout\n"); dev_dbg(dev, "Get receive timeout");
break; break;
case MCE_CMD_GETIRTXPORTS: case MCE_CMD_GETIRTXPORTS:
dev_info(dev, "Get transmit blaster mask\n"); dev_dbg(dev, "Get transmit blaster mask");
break; break;
case MCE_RSP_EQIRRXPORTEN: case MCE_RSP_EQIRRXPORTEN:
dev_info(dev, "%s %s-range receive sensor in use\n", dev_dbg(dev, "%s %s-range receive sensor in use",
inout, data1 == 0x02 ? "short" : "long"); inout, data1 == 0x02 ? "short" : "long");
break; break;
case MCE_CMD_GETIRRXPORTEN: case MCE_CMD_GETIRRXPORTEN:
/* aka MCE_RSP_EQIRRXCFCNT */ /* aka MCE_RSP_EQIRRXCFCNT */
if (out) if (out)
dev_info(dev, "Get receive sensor\n"); dev_dbg(dev, "Get receive sensor");
else if (ir->learning_enabled) else if (ir->learning_enabled)
dev_info(dev, "RX pulse count: %d\n", dev_dbg(dev, "RX pulse count: %d",
((data1 << 8) | data2)); ((data1 << 8) | data2));
break; break;
case MCE_RSP_EQIRNUMPORTS: case MCE_RSP_EQIRNUMPORTS:
if (out) if (out)
break; break;
dev_info(dev, "Num TX ports: %x, num RX ports: %x\n", dev_dbg(dev, "Num TX ports: %x, num RX ports: %x",
data1, data2); data1, data2);
break; break;
case MCE_RSP_CMD_ILLEGAL: case MCE_RSP_CMD_ILLEGAL:
dev_info(dev, "Illegal PORT_IR command\n"); dev_dbg(dev, "Illegal PORT_IR command");
break; break;
default: default:
dev_info(dev, "Unknown command 0x%02x 0x%02x\n", dev_dbg(dev, "Unknown command 0x%02x 0x%02x",
cmd, subcmd); cmd, subcmd);
break; break;
} }
...@@ -703,10 +681,11 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -703,10 +681,11 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
} }
if (cmd == MCE_IRDATA_TRAILER) if (cmd == MCE_IRDATA_TRAILER)
dev_info(dev, "End of raw IR data\n"); dev_dbg(dev, "End of raw IR data");
else if ((cmd != MCE_CMD_PORT_IR) && else if ((cmd != MCE_CMD_PORT_IR) &&
((cmd & MCE_PORT_MASK) == MCE_COMMAND_IRDATA)) ((cmd & MCE_PORT_MASK) == MCE_COMMAND_IRDATA))
dev_info(dev, "Raw IR data, %d pulse/space samples\n", ir->rem); dev_dbg(dev, "Raw IR data, %d pulse/space samples", ir->rem);
#endif
} }
static void mce_async_callback(struct urb *urb) static void mce_async_callback(struct urb *urb)
...@@ -718,10 +697,25 @@ static void mce_async_callback(struct urb *urb) ...@@ -718,10 +697,25 @@ static void mce_async_callback(struct urb *urb)
return; return;
ir = urb->context; ir = urb->context;
if (ir) {
switch (urb->status) {
/* success */
case 0:
len = urb->actual_length; len = urb->actual_length;
mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true); mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true);
break;
case -ECONNRESET:
case -ENOENT:
case -EILSEQ:
case -ESHUTDOWN:
break;
case -EPIPE:
default:
dev_err(ir->dev, "Error: request urb status = %d", urb->status);
break;
} }
/* the transfer buffer and urb were allocated in mce_request_packet */ /* the transfer buffer and urb were allocated in mce_request_packet */
...@@ -770,17 +764,17 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data, ...@@ -770,17 +764,17 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data,
return; return;
} }
mce_dbg(dev, "receive request called (size=%#x)\n", size); dev_dbg(dev, "receive request called (size=%#x)", size);
async_urb->transfer_buffer_length = size; async_urb->transfer_buffer_length = size;
async_urb->dev = ir->usbdev; async_urb->dev = ir->usbdev;
res = usb_submit_urb(async_urb, GFP_ATOMIC); res = usb_submit_urb(async_urb, GFP_ATOMIC);
if (res) { if (res) {
mce_dbg(dev, "receive request FAILED! (res=%d)\n", res); dev_err(dev, "receive request FAILED! (res=%d)", res);
return; return;
} }
mce_dbg(dev, "receive request complete (res=%d)\n", res); dev_dbg(dev, "receive request complete (res=%d)", res);
} }
static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size) static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size)
...@@ -895,8 +889,7 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier) ...@@ -895,8 +889,7 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
ir->carrier = carrier; ir->carrier = carrier;
cmdbuf[2] = MCE_CMD_SIG_END; cmdbuf[2] = MCE_CMD_SIG_END;
cmdbuf[3] = MCE_IRDATA_TRAILER; cmdbuf[3] = MCE_IRDATA_TRAILER;
mce_dbg(ir->dev, "%s: disabling carrier " dev_dbg(ir->dev, "disabling carrier modulation");
"modulation\n", __func__);
mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
return carrier; return carrier;
} }
...@@ -907,8 +900,8 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier) ...@@ -907,8 +900,8 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
ir->carrier = carrier; ir->carrier = carrier;
cmdbuf[2] = prescaler; cmdbuf[2] = prescaler;
cmdbuf[3] = divisor; cmdbuf[3] = divisor;
mce_dbg(ir->dev, "%s: requesting %u HZ " dev_dbg(ir->dev, "requesting %u HZ carrier",
"carrier\n", __func__, carrier); carrier);
/* Transmit new carrier to mce device */ /* Transmit new carrier to mce device */
mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
...@@ -998,7 +991,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) ...@@ -998,7 +991,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
* US_TO_NS(MCE_TIME_UNIT); * US_TO_NS(MCE_TIME_UNIT);
mce_dbg(ir->dev, "Storing %s with duration %d\n", dev_dbg(ir->dev, "Storing %s with duration %d",
rawir.pulse ? "pulse" : "space", rawir.pulse ? "pulse" : "space",
rawir.duration); rawir.duration);
...@@ -1032,7 +1025,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) ...@@ -1032,7 +1025,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
ir->parser_state = CMD_HEADER; ir->parser_state = CMD_HEADER;
} }
if (event) { if (event) {
mce_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n"); dev_dbg(ir->dev, "processed IR data");
ir_raw_event_handle(ir->rc); ir_raw_event_handle(ir->rc);
} }
} }
...@@ -1055,7 +1048,7 @@ static void mceusb_dev_recv(struct urb *urb) ...@@ -1055,7 +1048,7 @@ static void mceusb_dev_recv(struct urb *urb)
if (ir->send_flags == RECV_FLAG_IN_PROGRESS) { if (ir->send_flags == RECV_FLAG_IN_PROGRESS) {
ir->send_flags = SEND_FLAG_COMPLETE; ir->send_flags = SEND_FLAG_COMPLETE;
mce_dbg(ir->dev, "setup answer received %d bytes\n", dev_dbg(ir->dev, "setup answer received %d bytes\n",
buf_len); buf_len);
} }
...@@ -1067,13 +1060,14 @@ static void mceusb_dev_recv(struct urb *urb) ...@@ -1067,13 +1060,14 @@ static void mceusb_dev_recv(struct urb *urb)
case -ECONNRESET: case -ECONNRESET:
case -ENOENT: case -ENOENT:
case -EILSEQ:
case -ESHUTDOWN: case -ESHUTDOWN:
usb_unlink_urb(urb); usb_unlink_urb(urb);
return; return;
case -EPIPE: case -EPIPE:
default: default:
mce_dbg(ir->dev, "Error: urb status = %d\n", urb->status); dev_err(ir->dev, "Error: urb status = %d", urb->status);
break; break;
} }
...@@ -1095,7 +1089,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) ...@@ -1095,7 +1089,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL); data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL);
if (!data) { if (!data) {
dev_err(dev, "%s: memory allocation failed!\n", __func__); dev_err(dev, "%s: memory allocation failed!", __func__);
return; return;
} }
...@@ -1106,28 +1100,28 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) ...@@ -1106,28 +1100,28 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0,
data, USB_CTRL_MSG_SZ, HZ * 3); data, USB_CTRL_MSG_SZ, HZ * 3);
mce_dbg(dev, "%s - ret = %d\n", __func__, ret); dev_dbg(dev, "set address - ret = %d", ret);
mce_dbg(dev, "%s - data[0] = %d, data[1] = %d\n", dev_dbg(dev, "set address - data[0] = %d, data[1] = %d",
__func__, data[0], data[1]); data[0], data[1]);
/* set feature: bit rate 38400 bps */ /* set feature: bit rate 38400 bps */
ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
0xc04e, 0x0000, NULL, 0, HZ * 3); 0xc04e, 0x0000, NULL, 0, HZ * 3);
mce_dbg(dev, "%s - ret = %d\n", __func__, ret); dev_dbg(dev, "set feature - ret = %d", ret);
/* bRequest 4: set char length to 8 bits */ /* bRequest 4: set char length to 8 bits */
ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
4, USB_TYPE_VENDOR, 4, USB_TYPE_VENDOR,
0x0808, 0x0000, NULL, 0, HZ * 3); 0x0808, 0x0000, NULL, 0, HZ * 3);
mce_dbg(dev, "%s - retB = %d\n", __func__, ret); dev_dbg(dev, "set char length - retB = %d", ret);
/* bRequest 2: set handshaking to use DTR/DSR */ /* bRequest 2: set handshaking to use DTR/DSR */
ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
2, USB_TYPE_VENDOR, 2, USB_TYPE_VENDOR,
0x0000, 0x0100, NULL, 0, HZ * 3); 0x0000, 0x0100, NULL, 0, HZ * 3);
mce_dbg(dev, "%s - retC = %d\n", __func__, ret); dev_dbg(dev, "set handshake - retC = %d", ret);
/* device resume */ /* device resume */
mce_async_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME)); mce_async_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME));
...@@ -1198,7 +1192,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) ...@@ -1198,7 +1192,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
rc = rc_allocate_device(); rc = rc_allocate_device();
if (!rc) { if (!rc) {
dev_err(dev, "remote dev allocation failed\n"); dev_err(dev, "remote dev allocation failed");
goto out; goto out;
} }
...@@ -1230,7 +1224,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) ...@@ -1230,7 +1224,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
ret = rc_register_device(rc); ret = rc_register_device(rc);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "remote dev registration failed\n"); dev_err(dev, "remote dev registration failed");
goto out; goto out;
} }
...@@ -1258,7 +1252,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, ...@@ -1258,7 +1252,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
bool tx_mask_normal; bool tx_mask_normal;
int ir_intfnum; int ir_intfnum;
mce_dbg(&intf->dev, "%s called\n", __func__); dev_dbg(&intf->dev, "%s called", __func__);
idesc = intf->cur_altsetting; idesc = intf->cur_altsetting;
...@@ -1286,8 +1280,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, ...@@ -1286,8 +1280,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
ep_in = ep; ep_in = ep;
ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; ep_in->bmAttributes = USB_ENDPOINT_XFER_INT;
ep_in->bInterval = 1; ep_in->bInterval = 1;
mce_dbg(&intf->dev, "acceptable inbound endpoint " dev_dbg(&intf->dev, "acceptable inbound endpoint found");
"found\n");
} }
if ((ep_out == NULL) if ((ep_out == NULL)
...@@ -1301,12 +1294,11 @@ static int mceusb_dev_probe(struct usb_interface *intf, ...@@ -1301,12 +1294,11 @@ static int mceusb_dev_probe(struct usb_interface *intf,
ep_out = ep; ep_out = ep;
ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; ep_out->bmAttributes = USB_ENDPOINT_XFER_INT;
ep_out->bInterval = 1; ep_out->bInterval = 1;
mce_dbg(&intf->dev, "acceptable outbound endpoint " dev_dbg(&intf->dev, "acceptable outbound endpoint found");
"found\n");
} }
} }
if (ep_in == NULL) { if (ep_in == NULL) {
mce_dbg(&intf->dev, "inbound and/or endpoint not found\n"); dev_dbg(&intf->dev, "inbound and/or endpoint not found");
return -ENODEV; return -ENODEV;
} }
...@@ -1357,7 +1349,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, ...@@ -1357,7 +1349,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
/* flush buffers on the device */ /* flush buffers on the device */
mce_dbg(&intf->dev, "Flushing receive buffers\n"); dev_dbg(&intf->dev, "Flushing receive buffers\n");
mce_flush_rx_buffer(ir, maxp); mce_flush_rx_buffer(ir, maxp);
/* figure out which firmware/emulator version this hardware has */ /* figure out which firmware/emulator version this hardware has */
...@@ -1382,10 +1374,9 @@ static int mceusb_dev_probe(struct usb_interface *intf, ...@@ -1382,10 +1374,9 @@ static int mceusb_dev_probe(struct usb_interface *intf,
device_set_wakeup_capable(ir->dev, true); device_set_wakeup_capable(ir->dev, true);
device_set_wakeup_enable(ir->dev, true); device_set_wakeup_enable(ir->dev, true);
dev_info(&intf->dev, "Registered %s with mce emulator interface " dev_info(&intf->dev, "Registered %s with mce emulator interface version %x",
"version %x\n", name, ir->emver); name, ir->emver);
dev_info(&intf->dev, "%x tx ports (0x%x cabled) and " dev_info(&intf->dev, "%x tx ports (0x%x cabled) and %x rx sensors (0x%x active)",
"%x rx sensors (0x%x active)\n",
ir->num_txports, ir->txports_cabled, ir->num_txports, ir->txports_cabled,
ir->num_rxports, ir->rxports_active); ir->num_rxports, ir->rxports_active);
...@@ -1399,7 +1390,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, ...@@ -1399,7 +1390,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
buf_in_alloc_fail: buf_in_alloc_fail:
kfree(ir); kfree(ir);
mem_alloc_fail: mem_alloc_fail:
dev_err(&intf->dev, "%s: device setup failed!\n", __func__); dev_err(&intf->dev, "%s: device setup failed!", __func__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1427,7 +1418,7 @@ static void mceusb_dev_disconnect(struct usb_interface *intf) ...@@ -1427,7 +1418,7 @@ static void mceusb_dev_disconnect(struct usb_interface *intf)
static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message) static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message)
{ {
struct mceusb_dev *ir = usb_get_intfdata(intf); struct mceusb_dev *ir = usb_get_intfdata(intf);
dev_info(ir->dev, "suspend\n"); dev_info(ir->dev, "suspend");
usb_kill_urb(ir->urb_in); usb_kill_urb(ir->urb_in);
return 0; return 0;
} }
...@@ -1435,7 +1426,7 @@ static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -1435,7 +1426,7 @@ static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message)
static int mceusb_dev_resume(struct usb_interface *intf) static int mceusb_dev_resume(struct usb_interface *intf)
{ {
struct mceusb_dev *ir = usb_get_intfdata(intf); struct mceusb_dev *ir = usb_get_intfdata(intf);
dev_info(ir->dev, "resume\n"); dev_info(ir->dev, "resume");
if (usb_submit_urb(ir->urb_in, GFP_ATOMIC)) if (usb_submit_urb(ir->urb_in, GFP_ATOMIC))
return -EIO; return -EIO;
return 0; return 0;
...@@ -1457,6 +1448,3 @@ MODULE_DESCRIPTION(DRIVER_DESC); ...@@ -1457,6 +1448,3 @@ MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(usb, mceusb_dev_table); MODULE_DEVICE_TABLE(usb, mceusb_dev_table);
module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug enabled or not");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment