[media] mceusb: add and use mce_dbg printk macro
Using dev_dbg is more complexity than many users are able to deal with. Make it easier to get debug spew feedback from them by adding an mce_dbg printk macro that spews using dev_info when debug=1 is set for the mceusb module. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
d364ee4fdb
Коммит
5ae8f9a375
|
@ -108,6 +108,12 @@ static int debug = 1;
|
|||
static int debug;
|
||||
#endif
|
||||
|
||||
#define mce_dbg(dev, fmt, ...) \
|
||||
do { \
|
||||
if (debug) \
|
||||
dev_info(dev, fmt, ## __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
/* general constants */
|
||||
#define SEND_FLAG_IN_PROGRESS 1
|
||||
#define SEND_FLAG_COMPLETE 2
|
||||
|
@ -606,7 +612,7 @@ static void mce_async_callback(struct urb *urb, struct pt_regs *regs)
|
|||
if (ir) {
|
||||
len = urb->actual_length;
|
||||
|
||||
dev_dbg(ir->dev, "callback called (status=%d len=%d)\n",
|
||||
mce_dbg(ir->dev, "callback called (status=%d len=%d)\n",
|
||||
urb->status, len);
|
||||
|
||||
mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true);
|
||||
|
@ -655,17 +661,17 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data,
|
|||
return;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "receive request called (size=%#x)\n", size);
|
||||
mce_dbg(dev, "receive request called (size=%#x)\n", size);
|
||||
|
||||
async_urb->transfer_buffer_length = size;
|
||||
async_urb->dev = ir->usbdev;
|
||||
|
||||
res = usb_submit_urb(async_urb, GFP_ATOMIC);
|
||||
if (res) {
|
||||
dev_dbg(dev, "receive request FAILED! (res=%d)\n", res);
|
||||
mce_dbg(dev, "receive request FAILED! (res=%d)\n", res);
|
||||
return;
|
||||
}
|
||||
dev_dbg(dev, "receive request complete (res=%d)\n", res);
|
||||
mce_dbg(dev, "receive request complete (res=%d)\n", res);
|
||||
}
|
||||
|
||||
static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size)
|
||||
|
@ -794,7 +800,7 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
|
|||
ir->carrier = carrier;
|
||||
cmdbuf[2] = MCE_CMD_SIG_END;
|
||||
cmdbuf[3] = MCE_IRDATA_TRAILER;
|
||||
dev_dbg(ir->dev, "%s: disabling carrier "
|
||||
mce_dbg(ir->dev, "%s: disabling carrier "
|
||||
"modulation\n", __func__);
|
||||
mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
|
||||
return carrier;
|
||||
|
@ -806,7 +812,7 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
|
|||
ir->carrier = carrier;
|
||||
cmdbuf[2] = prescaler;
|
||||
cmdbuf[3] = divisor;
|
||||
dev_dbg(ir->dev, "%s: requesting %u HZ "
|
||||
mce_dbg(ir->dev, "%s: requesting %u HZ "
|
||||
"carrier\n", __func__, carrier);
|
||||
|
||||
/* Transmit new carrier to mce device */
|
||||
|
@ -879,7 +885,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
|
|||
rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
|
||||
* US_TO_NS(MCE_TIME_UNIT);
|
||||
|
||||
dev_dbg(ir->dev, "Storing %s with duration %d\n",
|
||||
mce_dbg(ir->dev, "Storing %s with duration %d\n",
|
||||
rawir.pulse ? "pulse" : "space",
|
||||
rawir.duration);
|
||||
|
||||
|
@ -911,7 +917,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
|
|||
if (ir->parser_state != CMD_HEADER && !ir->rem)
|
||||
ir->parser_state = CMD_HEADER;
|
||||
}
|
||||
dev_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n");
|
||||
mce_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n");
|
||||
ir_raw_event_handle(ir->rc);
|
||||
}
|
||||
|
||||
|
@ -933,7 +939,7 @@ static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs)
|
|||
|
||||
if (ir->send_flags == RECV_FLAG_IN_PROGRESS) {
|
||||
ir->send_flags = SEND_FLAG_COMPLETE;
|
||||
dev_dbg(ir->dev, "setup answer received %d bytes\n",
|
||||
mce_dbg(ir->dev, "setup answer received %d bytes\n",
|
||||
buf_len);
|
||||
}
|
||||
|
||||
|
@ -951,7 +957,7 @@ static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs)
|
|||
|
||||
case -EPIPE:
|
||||
default:
|
||||
dev_dbg(ir->dev, "Error: urb status = %d\n", urb->status);
|
||||
mce_dbg(ir->dev, "Error: urb status = %d\n", urb->status);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -978,8 +984,8 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
|
|||
ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
|
||||
USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0,
|
||||
data, USB_CTRL_MSG_SZ, HZ * 3);
|
||||
dev_dbg(dev, "%s - ret = %d\n", __func__, ret);
|
||||
dev_dbg(dev, "%s - data[0] = %d, data[1] = %d\n",
|
||||
mce_dbg(dev, "%s - ret = %d\n", __func__, ret);
|
||||
mce_dbg(dev, "%s - data[0] = %d, data[1] = %d\n",
|
||||
__func__, data[0], data[1]);
|
||||
|
||||
/* set feature: bit rate 38400 bps */
|
||||
|
@ -987,19 +993,19 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
|
|||
USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
|
||||
0xc04e, 0x0000, NULL, 0, HZ * 3);
|
||||
|
||||
dev_dbg(dev, "%s - ret = %d\n", __func__, ret);
|
||||
mce_dbg(dev, "%s - ret = %d\n", __func__, ret);
|
||||
|
||||
/* bRequest 4: set char length to 8 bits */
|
||||
ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
|
||||
4, USB_TYPE_VENDOR,
|
||||
0x0808, 0x0000, NULL, 0, HZ * 3);
|
||||
dev_dbg(dev, "%s - retB = %d\n", __func__, ret);
|
||||
mce_dbg(dev, "%s - retB = %d\n", __func__, ret);
|
||||
|
||||
/* bRequest 2: set handshaking to use DTR/DSR */
|
||||
ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
|
||||
2, USB_TYPE_VENDOR,
|
||||
0x0000, 0x0100, NULL, 0, HZ * 3);
|
||||
dev_dbg(dev, "%s - retC = %d\n", __func__, ret);
|
||||
mce_dbg(dev, "%s - retC = %d\n", __func__, ret);
|
||||
|
||||
/* device reset */
|
||||
mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET));
|
||||
|
@ -1122,7 +1128,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
|
|||
bool tx_mask_normal;
|
||||
int ir_intfnum;
|
||||
|
||||
dev_dbg(&intf->dev, "%s called\n", __func__);
|
||||
mce_dbg(&intf->dev, "%s called\n", __func__);
|
||||
|
||||
idesc = intf->cur_altsetting;
|
||||
|
||||
|
@ -1150,7 +1156,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
|
|||
ep_in = ep;
|
||||
ep_in->bmAttributes = USB_ENDPOINT_XFER_INT;
|
||||
ep_in->bInterval = 1;
|
||||
dev_dbg(&intf->dev, "acceptable inbound endpoint "
|
||||
mce_dbg(&intf->dev, "acceptable inbound endpoint "
|
||||
"found\n");
|
||||
}
|
||||
|
||||
|
@ -1165,12 +1171,12 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
|
|||
ep_out = ep;
|
||||
ep_out->bmAttributes = USB_ENDPOINT_XFER_INT;
|
||||
ep_out->bInterval = 1;
|
||||
dev_dbg(&intf->dev, "acceptable outbound endpoint "
|
||||
mce_dbg(&intf->dev, "acceptable outbound endpoint "
|
||||
"found\n");
|
||||
}
|
||||
}
|
||||
if (ep_in == NULL) {
|
||||
dev_dbg(&intf->dev, "inbound and/or endpoint not found\n");
|
||||
mce_dbg(&intf->dev, "inbound and/or endpoint not found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче