Commit 784d5858 authored by Tilman Schmidt's avatar Tilman Schmidt Committed by Linus Torvalds

[PATCH] isdn4linux: Siemens Gigaset drivers: logging usage

With Hansjoerg Lipp <hjlipp@web.de>

Improve error reporting of the Gigaset drivers, by using the
dev_err/dev_warn/dev_info macros from device.h instead of err/warn/info from
usb.h whereever possible.

Also rename the private dbg macro to gig_dbg in order to avoid confusion with
the macro of the same name in usb.h.
Signed-off-by: default avatarHansjoerg Lipp <hjlipp@web.de>
Signed-off-by: default avatarTilman Schmidt <tilman@imap.cc>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ec81b5e6
......@@ -51,7 +51,7 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
for (;;) {
cs->respdata[cbytes] = c;
if (c == 10 || c == 13) {
dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
gig_dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
__func__, cbytes);
cs->cbytes = cbytes;
gigaset_handle_modem_response(cs); /* can change
......@@ -68,7 +68,7 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
if (cbytes < MAX_RESP_SIZE - 1)
cbytes++;
else
warn("response too large");
dev_warn(cs->dev, "response too large\n");
}
if (!numbytes)
......@@ -154,39 +154,37 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
c ^= PPP_TRANS;
#ifdef CONFIG_GIGASET_DEBUG
if (unlikely(!muststuff(c)))
dbg(DEBUG_HDLC,
"byte stuffed: 0x%02x", c);
gig_dbg(DEBUG_HDLC, "byte stuffed: 0x%02x", c);
#endif
} else if (unlikely(c == PPP_FLAG)) {
if (unlikely(inputstate & INS_skip_frame)) {
if (!(inputstate & INS_have_data)) { /* 7E 7E */
//dbg(DEBUG_HDLC, "(7e)7e------------------------");
#ifdef CONFIG_GIGASET_DEBUG
++bcs->emptycount;
#endif
} else
dbg(DEBUG_HDLC,
gig_dbg(DEBUG_HDLC,
"7e----------------------------");
/* end of frame */
error = 1;
gigaset_rcv_error(NULL, cs, bcs);
} else if (!(inputstate & INS_have_data)) { /* 7E 7E */
//dbg(DEBUG_HDLC, "(7e)7e------------------------");
#ifdef CONFIG_GIGASET_DEBUG
++bcs->emptycount;
#endif
break;
} else {
dbg(DEBUG_HDLC,
gig_dbg(DEBUG_HDLC,
"7e----------------------------");
/* end of frame */
error = 0;
if (unlikely(fcs != PPP_GOODFCS)) {
err("Packet checksum at %lu failed, "
"packet is corrupted (%u bytes)!",
dev_err(cs->dev,
"Packet checksum at %lu failed, "
"packet is corrupted (%u bytes)!\n",
bcs->rcvbytes, skb->len);
compskb = NULL;
gigaset_rcv_error(compskb, cs, bcs);
......@@ -200,9 +198,11 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
skb = NULL;
inputstate |= INS_skip_frame;
if (l == 1) {
err("invalid packet size (1)!");
dev_err(cs->dev,
"invalid packet size (1)!\n");
error = 1;
gigaset_rcv_error(NULL, cs, bcs);
gigaset_rcv_error(NULL,
cs, bcs);
}
}
if (likely(!(error ||
......@@ -225,7 +225,8 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
} else if (likely((skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)) {
skb_reserve(skb, HW_HDR_LEN);
} else {
warn("could not allocate new skb");
dev_warn(cs->dev,
"could not allocate new skb\n");
inputstate |= INS_skip_frame;
}
......@@ -233,7 +234,7 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
#ifdef CONFIG_GIGASET_DEBUG
} else if (unlikely(muststuff(c))) {
/* Should not happen. Possible after ZDLE=1<CR><LF>. */
dbg(DEBUG_HDLC, "not byte stuffed: 0x%02x", c);
gig_dbg(DEBUG_HDLC, "not byte stuffed: 0x%02x", c);
#endif
}
......@@ -241,8 +242,8 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
#ifdef CONFIG_GIGASET_DEBUG
if (unlikely(!(inputstate & INS_have_data))) {
dbg(DEBUG_HDLC,
"7e (%d x) ================", bcs->emptycount);
gig_dbg(DEBUG_HDLC, "7e (%d x) ================",
bcs->emptycount);
bcs->emptycount = 0;
}
#endif
......@@ -251,7 +252,7 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
if (likely(!(inputstate & INS_skip_frame))) {
if (unlikely(skb->len == SBUFSIZE)) {
warn("received packet too long");
dev_warn(cs->dev, "received packet too long\n");
dev_kfree_skb_any(skb);
skb = NULL;
inputstate |= INS_skip_frame;
......@@ -307,7 +308,7 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
if (likely(!(inputstate & INS_skip_frame))) {
if (unlikely(skb->len == SBUFSIZE)) {
//FIXME just pass skb up and allocate a new one
warn("received packet too long");
dev_warn(cs->dev, "received packet too long\n");
dev_kfree_skb_any(skb);
skb = NULL;
inputstate |= INS_skip_frame;
......@@ -341,7 +342,7 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
!= NULL)) {
skb_reserve(skb, HW_HDR_LEN);
} else {
warn("could not allocate new skb");
dev_warn(cs->dev, "could not allocate new skb\n");
inputstate |= INS_skip_frame;
}
}
......@@ -362,13 +363,13 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
head = atomic_read(&inbuf->head);
tail = atomic_read(&inbuf->tail);
dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
if (head != tail) {
cs = inbuf->cs;
src = inbuf->data + head;
numbytes = (head > tail ? RBUFSIZE : tail) - head;
dbg(DEBUG_INTR, "processing %u bytes", numbytes);
gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);
while (numbytes) {
if (atomic_read(&cs->mstate) == MS_LOCKED) {
......@@ -400,13 +401,14 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
src += procbytes;
numbytes -= procbytes;
} else { /* DLE-char */
} else { /* DLE char */
inbuf->inputstate &= ~INS_DLE_char;
switch (c) {
case 'X': /*begin of command*/
#ifdef CONFIG_GIGASET_DEBUG
if (inbuf->inputstate & INS_command)
err("received <DLE> 'X' in command mode");
dev_err(cs->dev,
"received <DLE> 'X' in command mode\n");
#endif
inbuf->inputstate |=
INS_command | INS_DLE_command;
......@@ -414,7 +416,8 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
case '.': /*end of command*/
#ifdef CONFIG_GIGASET_DEBUG
if (!(inbuf->inputstate & INS_command))
err("received <DLE> '.' in hdlc mode");
dev_err(cs->dev,
"received <DLE> '.' in hdlc mode\n");
#endif
inbuf->inputstate &= cs->dle ?
~(INS_DLE_command|INS_command)
......@@ -422,7 +425,9 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
break;
//case DLE_FLAG: /*DLE_FLAG in data stream*/ /* schon oben behandelt! */
default:
err("received 0x10 0x%02x!", (int) c);
dev_err(cs->dev,
"received 0x10 0x%02x!\n",
(int) c);
/* FIXME: reset driver?? */
}
}
......@@ -441,7 +446,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
}
}
dbg(DEBUG_INTR, "setting head to %u", head);
gig_dbg(DEBUG_INTR, "setting head to %u", head);
atomic_set(&inbuf->head, head);
}
}
......@@ -483,7 +488,6 @@ static struct sk_buff *HDLC_Encode(struct sk_buff *skb, int head, int tail)
*/
hdlc_skb = dev_alloc_skb(skb->len + stuf_cnt + 6 + tail + head);
if (!hdlc_skb) {
err("unable to allocate memory for HDLC encoding!");
dev_kfree_skb(skb);
return NULL;
}
......@@ -543,7 +547,6 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail)
/* worst case: every byte must be stuffed */
iraw_skb = dev_alloc_skb(2*skb->len + tail + head);
if (!iraw_skb) {
err("unable to allocate memory for HDLC encoding!");
dev_kfree_skb(skb);
return NULL;
}
......@@ -584,8 +587,11 @@ int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
skb = HDLC_Encode(skb, HW_HDR_LEN, 0);
else
skb = iraw_encode(skb, HW_HDR_LEN, 0);
if (!skb)
if (!skb) {
dev_err(bcs->cs->dev,
"unable to allocate memory for encoding!\n");
return -ENOMEM;
}
skb_queue_tail(&bcs->squeue, skb);
tasklet_schedule(&bcs->cs->write_tasklet);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -106,7 +106,7 @@ extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */
* DEBUG_INTR.
*/
enum debuglevel { /* up to 24 bits (atomic_t) */
DEBUG_REG = 0x0002,/* serial port I/O register operations */
DEBUG_REG = 0x0002, /* serial port I/O register operations */
DEBUG_OPEN = 0x0004, /* open/close serial port */
DEBUG_INTR = 0x0008, /* interrupt processing */
DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on
......@@ -137,45 +137,47 @@ enum debuglevel { /* up to 24 bits (atomic_t) */
activated */
};
#ifdef CONFIG_GIGASET_DEBUG
#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
#else
#define DEBUG_DEFAULT 0
/* missing from linux/device.h ... */
#ifndef dev_notice
#define dev_notice(dev, format, arg...) \
dev_printk(KERN_NOTICE , dev , format , ## arg)
#endif
/* redefine syslog macros to prepend module name instead of entire
* source path */
/* Kernel message macros for situations where dev_printk and friends cannot be
* used for lack of reliable access to a device structure.
* linux/usb.h already contains these but in an obsolete form which clutters
* the log needlessly, and according to the USB maintainer those should be
* removed rather than fixed anyway.
*/
#undef err
#undef info
#define info(format, arg...) \
printk(KERN_INFO "%s: " format "\n", \
THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
#undef notice
#define notice(format, arg...) \
printk(KERN_NOTICE "%s: " format "\n", \
THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
#undef warn
#define warn(format, arg...) \
printk(KERN_WARNING "%s: " format "\n", \
THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
#undef notice
#undef err
#define err(format, arg...) \
printk(KERN_ERR "%s: " format "\n", \
THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
format "\n" , ## arg)
#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
format "\n" , ## arg)
#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
format "\n" , ## arg)
#define notice(format, arg...) printk(KERN_NOTICE KBUILD_MODNAME ": " \
format "\n" , ## arg)
#undef dbg
#ifdef CONFIG_GIGASET_DEBUG
#define dbg(level, format, arg...) \
#define gig_dbg(level, format, arg...) \
do { \
if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \
printk(KERN_DEBUG "%s: " format "\n", \
THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" \
, ## arg); \
printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \
## arg); \
} while (0)
#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
#else
#define dbg(level, format, arg...) do {} while (0)
#define gig_dbg(level, format, arg...) do {} while (0)
#define DEBUG_DEFAULT 0
#endif
void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
......@@ -368,16 +370,6 @@ struct inbuf_t {
* BAS_OUTBUFPAD bytes immediately before data[write] (if
* write>=BAS_OUTBUFPAD) or those of the pad area (if write<BAS_OUTBUFPAD)
* are also filled with that value
* - optionally, the following statistics on the buffer's usage can be
* collected:
* maxfill: maximum number of bytes occupied
* idlefills: number of times a frame of idle bytes is prepared
* emptygets: number of times the buffer was empty when a data frame was
* requested
* backtoback: number of times two data packets were entered into the buffer
* without intervening idle flags
* nakedback: set if no idle flags have been inserted since the last data
* packet
*/
struct isowbuf_t {
atomic_t read;
......@@ -471,7 +463,7 @@ struct bc_state {
int busy;
int use_count;
/* hardware drivers */
/* private data of hardware drivers */
union {
struct ser_bc_state *ser; /* serial hardware driver */
struct usb_bc_state *usb; /* usb hardware driver (m105) */
......@@ -482,6 +474,7 @@ struct bc_state {
struct cardstate {
struct gigaset_driver *driver;
unsigned minor_index;
struct device *dev;
const struct gigaset_ops *ops;
......@@ -531,11 +524,11 @@ struct cardstate {
int cs_init;
int ignoreframes; /* frames to ignore after setting up the
B channel */
struct semaphore sem; /* locks this structure: */
/* connected is not changed, */
/* hardware_up is not changed, */
/* MState is not changed to or from
MS_LOCKED */
struct semaphore sem; /* locks this structure:
* connected is not changed,
* hardware_up is not changed,
* MState is not changed to or from
* MS_LOCKED */
struct timer_list timer;
int retry_count;
......@@ -543,7 +536,7 @@ struct cardstate {
dle encoded */
int cur_at_seq; /* sequence of AT commands being
processed */
int curchannel; /* channel, those commands are meant
int curchannel; /* channel those commands are meant
for */
atomic_t commands_pending; /* flag(s) in xxx.commands_pending have
been set */
......@@ -551,7 +544,7 @@ struct cardstate {
/* tasklet for serializing AT commands.
* Scheduled
* -> for modem reponses (and
* incomming data for M10x)
* incoming data for M10x)
* -> on timeout
* -> after setting bits in
* xxx.at_state.pending_command
......@@ -569,7 +562,7 @@ struct cardstate {
unsigned char respdata[MAX_RESP_SIZE];
unsigned cbytes;
/* hardware drivers */
/* private data of hardware drivers */
union {
struct usb_cardstate *usb; /* USB hardware driver (m105) */
struct ser_cardstate *ser; /* serial hardware driver */
......@@ -607,8 +600,8 @@ struct bas_bc_state {
struct isow_urbctx_t isoouturbs[BAS_OUTURBS];
struct isow_urbctx_t *isooutdone, *isooutfree, *isooutovfl;
struct isowbuf_t *isooutbuf;
unsigned numsub; /* submitted URB counter (for
diagnostic messages only) */
unsigned numsub; /* submitted URB counter
(for diagnostic messages only) */
struct tasklet_struct sent_tasklet;
/* isochronous input state */
......@@ -618,25 +611,22 @@ struct bas_bc_state {
struct urb *isoindone; /* completed isoc read URB */
int loststatus; /* status of dropped URB */
unsigned isoinlost; /* number of bytes lost */
/* state of bit unstuffing algorithm (in addition to
BC_state.inputstate) */
/* state of bit unstuffing algorithm
(in addition to BC_state.inputstate) */
unsigned seqlen; /* number of '1' bits not yet
unstuffed */
unsigned inbyte, inbits; /* collected bits for next byte
*/
unsigned inbyte, inbits; /* collected bits for next byte */
/* statistics */
unsigned goodbytes; /* bytes correctly received */
unsigned alignerrs; /* frames with incomplete byte
at end */
unsigned alignerrs; /* frames with incomplete byte at end */
unsigned fcserrs; /* FCS errors */
unsigned frameerrs; /* framing errors */
unsigned giants; /* long frames */
unsigned runts; /* short frames */
unsigned aborts; /* HDLC aborts */
unsigned shared0s; /* '0' bits shared between flags
*/
unsigned stolen0s; /* '0' stuff bits also serving
as leading flag bits */
unsigned shared0s; /* '0' bits shared between flags */
unsigned stolen0s; /* '0' stuff bits also serving as
leading flag bits */
struct tasklet_struct rcvd_tasklet;
};
......@@ -764,7 +754,7 @@ static inline void gigaset_isdn_rcv_err(struct bc_state *bcs)
isdn_ctrl response;
/* error -> LL */
dbg(DEBUG_CMD, "sending L1ERR");
gig_dbg(DEBUG_CMD, "sending L1ERR");
response.driver = bcs->cs->myid;
response.command = ISDN_STAT_L1ERR;
response.arg = bcs->channel;
......@@ -872,7 +862,7 @@ static inline void gigaset_bchannel_down(struct bc_state *bcs)
{
gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_CLOSED, NULL, 0, NULL);
dbg(DEBUG_CMD, "scheduling BC_CLOSED");
gig_dbg(DEBUG_CMD, "scheduling BC_CLOSED");
gigaset_schedule_event(bcs->cs);
}
......@@ -882,7 +872,7 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs)
{
gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_OPEN, NULL, 0, NULL);
dbg(DEBUG_CMD, "scheduling BC_OPEN");
gig_dbg(DEBUG_CMD, "scheduling BC_OPEN");
gigaset_schedule_event(bcs->cs);
}
......@@ -947,7 +937,7 @@ static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf,
{
unsigned n, head, tail, bytesleft;
dbg(DEBUG_INTR, "received %u bytes", numbytes);
gig_dbg(DEBUG_INTR, "received %u bytes", numbytes);
if (!numbytes)
return 0;
......@@ -955,7 +945,7 @@ static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf,
bytesleft = numbytes;
tail = atomic_read(&inbuf->tail);
head = atomic_read(&inbuf->head);
dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
while (bytesleft) {
if (head > tail)
......@@ -965,7 +955,8 @@ static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf,
else
n = RBUFSIZE - tail;
if (!n) {
err("buffer overflow (%u bytes lost)", bytesleft);
dev_err(inbuf->cs->dev,
"buffer overflow (%u bytes lost)", bytesleft);
break;
}
if (n > bytesleft)
......@@ -975,7 +966,7 @@ static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf,
tail = (tail + n) % RBUFSIZE;
src += n;
}
dbg(DEBUG_INTR, "setting tail to %u", tail);
gig_dbg(DEBUG_INTR, "setting tail to %u", tail);
atomic_set(&inbuf->tail, tail);
return numbytes != bytesleft;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -83,12 +83,12 @@ static inline int isowbuf_startwrite(struct isowbuf_t *iwb)
{
if (!atomic_dec_and_test(&iwb->writesem)) {
atomic_inc(&iwb->writesem);
dbg(DEBUG_ISO,
"%s: couldn't acquire iso write semaphore", __func__);
gig_dbg(DEBUG_ISO, "%s: couldn't acquire iso write semaphore",
__func__);
return 0;
}
#ifdef CONFIG_GIGASET_DEBUG
dbg(DEBUG_ISO,
gig_dbg(DEBUG_ISO,
"%s: acquired iso write semaphore, data[write]=%02x, nbits=%d",
__func__, iwb->data[atomic_read(&iwb->write)], iwb->wbits);
#endif
......@@ -143,7 +143,7 @@ static inline void isowbuf_putflag(struct isowbuf_t *iwb)
/* recover the idle flag byte */
write = atomic_read(&iwb->write);
iwb->idle = iwb->data[write];
dbg(DEBUG_ISO, "idle fill byte %02x", iwb->idle);
gig_dbg(DEBUG_ISO, "idle fill byte %02x", iwb->idle);
/* mask extraneous bits in buffer */
iwb->data[write] &= (1 << iwb->wbits) - 1;
}
......@@ -162,15 +162,14 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
read = atomic_read(&iwb->nextread);
write = atomic_read(&iwb->write);
if (likely(read == write)) {
//dbg(DEBUG_STREAM, "%s: send buffer empty", __func__);
/* return idle frame */
return read < BAS_OUTBUFPAD ?
BAS_OUTBUFSIZE : read - BAS_OUTBUFPAD;
}
limit = read + size;
dbg(DEBUG_STREAM,
"%s: read=%d write=%d limit=%d", __func__, read, write, limit);
gig_dbg(DEBUG_STREAM, "%s: read=%d write=%d limit=%d",
__func__, read, write, limit);
#ifdef CONFIG_GIGASET_DEBUG
if (unlikely(size < 0 || size > BAS_OUTBUFPAD)) {
err("invalid size %d", size);
......@@ -195,7 +194,7 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
pbyte = iwb->data[write]; /* save
partial byte */
limit = write + BAS_OUTBUFPAD;
dbg(DEBUG_STREAM,
gig_dbg(DEBUG_STREAM,
"%s: filling %d->%d with %02x",
__func__, write, limit, iwb->idle);
if (write + BAS_OUTBUFPAD < BAS_OUTBUFSIZE)
......@@ -208,7 +207,8 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
- write);
limit = 0;
}
dbg(DEBUG_STREAM, "%s: restoring %02x at %d",
gig_dbg(DEBUG_STREAM,
"%s: restoring %02x at %d",
__func__, pbyte, limit);
iwb->data[limit] = pbyte; /* restore
partial byte */
......@@ -252,7 +252,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
while (count-- > 0) {
if (i > sizeof(dbgline) - 4) {
dbgline[i] = '\0';
dbg(level, "%s:%s", tag, dbgline);
gig_dbg(level, "%s:%s", tag, dbgline);
i = 0;
}
c = *bytes++;
......@@ -262,7 +262,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
dbgline[i++] = hexdigit[c & 0x0f];
}
dbgline[i] = '\0';
dbg(level, "%s:%s", tag, dbgline);
gig_dbg(level, "%s:%s", tag, dbgline);
#endif
}
......@@ -429,7 +429,7 @@ static inline int hdlc_buildframe(struct isowbuf_t *iwb,
if (isowbuf_freebytes(iwb) < count + count / 5 + 6 ||
!isowbuf_startwrite(iwb)) {
dbg(DEBUG_ISO, "%s: %d bytes free -> -EAGAIN",
gig_dbg(DEBUG_ISO, "%s: %d bytes free -> -EAGAIN",
__func__, isowbuf_freebytes(iwb));
return -EAGAIN;
}
......@@ -482,11 +482,11 @@ static inline int trans_buildframe(struct isowbuf_t *iwb,
if (isowbuf_freebytes(iwb) < count ||
!isowbuf_startwrite(iwb)) {
dbg(DEBUG_ISO, "can't put %d bytes", count);
gig_dbg(DEBUG_ISO, "can't put %d bytes", count);
return -EAGAIN;
}
dbg(DEBUG_STREAM, "put %d bytes", count);
gig_dbg(DEBUG_STREAM, "put %d bytes", count);
write = atomic_read(&iwb->write);
do {
c = gigaset_invtab[*in++];
......@@ -506,12 +506,12 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len)
switch (bcs->proto2) {
case ISDN_PROTO_L2_HDLC:
result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len);
dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d",
gig_dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d",
__func__, len, result);
break;
default: /* assume transparent */
result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len);
dbg(DEBUG_ISO, "%s: %d bytes trans -> %d",
gig_dbg(DEBUG_ISO, "%s: %d bytes trans -> %d",
__func__, len, result);
}
return result;
......@@ -528,7 +528,7 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
return;
}
if (unlikely(bcs->skb->len == SBUFSIZE)) {
warn("received oversized packet discarded");
dev_warn(bcs->cs->dev, "received oversized packet discarded\n");
bcs->hw.bas->giants++;
dev_kfree_skb_any(bcs->skb);
bcs->skb = NULL;
......@@ -549,7 +549,7 @@ static inline void hdlc_flush(struct bc_state *bcs)
if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
skb_reserve(bcs->skb, HW_HDR_LEN);
else
err("could not allocate skb");
dev_err(bcs->cs->dev, "could not allocate skb\n");
}
/* reset packet state */
......@@ -571,21 +571,23 @@ static inline void hdlc_done(struct bc_state *bcs)
if ((procskb = bcs->skb) == NULL) {
/* previous error */
dbg(DEBUG_ISO, "%s: skb=NULL", __func__);
gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__);
gigaset_rcv_error(NULL, bcs->cs, bcs);
} else if (procskb->len < 2) {
notice("received short frame (%d octets)", procskb->len);
dev_notice(bcs->cs->dev, "received short frame (%d octets)\n",
procskb->len);
bcs->hw.bas->runts++;
gigaset_rcv_error(procskb, bcs->cs, bcs);
} else if (bcs->fcs != PPP_GOODFCS) {
notice("frame check error (0x%04x)", bcs->fcs);
dev_notice(bcs->cs->dev, "frame check error (0x%04x)\n",
bcs->fcs);
bcs->hw.bas->fcserrs++;
gigaset_rcv_error(procskb, bcs->cs, bcs);
} else {
procskb->len -= 2; /* subtract FCS */
procskb->tail -= 2;
dbg(DEBUG_ISO,
"%s: good frame (%d octets)", __func__, procskb->len);
gig_dbg(DEBUG_ISO, "%s: good frame (%d octets)",
__func__, procskb->len);
dump_bytes(DEBUG_STREAM,
"rcv data", procskb->data, procskb->len);
bcs->hw.bas->goodbytes += procskb->len;
......@@ -595,7 +597,7 @@ static inline void hdlc_done(struct bc_state *bcs)
if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
skb_reserve(bcs->skb, HW_HDR_LEN);
else
err("could not allocate skb");
dev_err(bcs->cs->dev, "could not allocate skb\n");
bcs->fcs = PPP_INITFCS;
}
......@@ -610,14 +612,14 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
return;
}
notice("received partial byte (%d bits)", inbits);
dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits);
bcs->hw.bas->alignerrs++;
gigaset_rcv_error(bcs->skb, bcs->cs, bcs);
if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
skb_reserve(bcs->skb, HW_HDR_LEN);
else
err("could not allocate skb");
dev_err(bcs->cs->dev, "could not allocate skb\n");
bcs->fcs = PPP_INITFCS;
}
......@@ -870,7 +872,7 @@ static inline void trans_receive(unsigned char *src, unsigned count,
if (unlikely((skb = bcs->skb) == NULL)) {
bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
if (!skb) {
err("could not allocate skb");
dev_err(bcs->cs->dev, "could not allocate skb\n");
return;
}
skb_reserve(skb, HW_HDR_LEN);
......@@ -888,7 +890,8 @@ static inline void trans_receive(unsigned char *src, unsigned count,
gigaset_rcv_skb(skb, bcs->cs, bcs);
bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
if (!skb) {
err("could not allocate skb");
dev_err(bcs->cs->dev,
"could not allocate skb\n");
return;
}
skb_reserve(bcs->skb, HW_HDR_LEN);
......@@ -921,7 +924,7 @@ static void cmd_loop(unsigned char *src, int numbytes, struct inbuf_t *inbuf)
case '\r':
case '\n':
/* end of line */
dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
gig_dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
__func__, cbytes);
cs->cbytes = cbytes;
gigaset_handle_modem_response(cs);
......@@ -932,7 +935,7 @@ static void cmd_loop(unsigned char *src, int numbytes, struct inbuf_t *inbuf)
if (cbytes < MAX_RESP_SIZE - 1)
cbytes++;
else
warn("response too large");
dev_warn(cs->dev, "response too large\n");
}
}
......@@ -951,12 +954,12 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
head = atomic_read(&inbuf->head);
while (head != (tail = atomic_read(&inbuf->tail))) {
dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
if (head > tail)
tail = RBUFSIZE;
src = inbuf->data + head;
numbytes = tail - head;
dbg(DEBUG_INTR, "processing %u bytes", numbytes);
gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);
if (atomic_read(&cs->mstate) == MS_LOCKED) {
gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
......@@ -971,7 +974,7 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
head += numbytes;
if (head == RBUFSIZE)
head = 0;
dbg(DEBUG_INTR, "setting head to %u", head);
gig_dbg(DEBUG_INTR, "setting head to %u", head);
atomic_set(&inbuf->head, head);
}
}
......@@ -999,8 +1002,8 @@ int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb)
len = skb->len;
skb_queue_tail(&bcs->squeue, skb);
dbg(DEBUG_ISO,
"%s: skb queued, qlen=%d", __func__, skb_queue_len(&bcs->squeue));
gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d",
__func__, skb_queue_len(&bcs->squeue));
/* tasklet submits URB if necessary */
tasklet_schedule(&bcs->hw.bas->sent_tasklet);
......
......@@ -50,7 +50,7 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
return -ENOMEM;
}
dbg(DEBUG_CMD, "scheduling PROC_CIDMODE");
gig_dbg(DEBUG_CMD, "scheduling PROC_CIDMODE");
gigaset_schedule_event(cs);
wait_event(cs->waitqueue, !cs->waiting);
......@@ -65,7 +65,7 @@ static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode);
/* free sysfs for device */
void gigaset_free_dev_sysfs(struct usb_interface *interface)
{
dbg(DEBUG_INIT, "removing sysfs entries");
gig_dbg(DEBUG_INIT, "removing sysfs entries");
device_remove_file(&interface->dev, &dev_attr_cidmode);
}
EXPORT_SYMBOL_GPL(gigaset_free_dev_sysfs);
......@@ -73,7 +73,7 @@ EXPORT_SYMBOL_GPL(gigaset_free_dev_sysfs);
/* initialize sysfs for device */
void gigaset_init_dev_sysfs(struct usb_interface *interface)
{
dbg(DEBUG_INIT, "setting up sysfs");
gig_dbg(DEBUG_INIT, "setting up sysfs");
device_create_file(&interface->dev, &dev_attr_cidmode);
}
EXPORT_SYMBOL_GPL(gigaset_init_dev_sysfs);
This diff is collapsed.
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