Commit d48c7784 authored by Tilman Schmidt's avatar Tilman Schmidt Committed by Linus Torvalds

[PATCH] isdn4linux: Siemens Gigaset drivers: remove IFNULL macros

With Hansjoerg Lipp <hjlipp@web.de>

Remove the IFNULL debugging macros from the Gigaset drivers.
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 b1d47464
...@@ -117,20 +117,14 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes, ...@@ -117,20 +117,14 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
{ {
struct cardstate *cs = inbuf->cs; struct cardstate *cs = inbuf->cs;
struct bc_state *bcs = inbuf->bcs; struct bc_state *bcs = inbuf->bcs;
int inputstate; int inputstate = bcs->inputstate;
__u16 fcs; __u16 fcs = bcs->fcs;
struct sk_buff *skb; struct sk_buff *skb = bcs->skb;
unsigned char error; unsigned char error;
struct sk_buff *compskb; struct sk_buff *compskb;
int startbytes = numbytes; int startbytes = numbytes;
int l; int l;
IFNULLRETVAL(bcs, numbytes);
inputstate = bcs->inputstate;
fcs = bcs->fcs;
skb = bcs->skb;
IFNULLRETVAL(skb, numbytes);
if (unlikely(inputstate & INS_byte_stuff)) { if (unlikely(inputstate & INS_byte_stuff)) {
inputstate &= ~INS_byte_stuff; inputstate &= ~INS_byte_stuff;
goto byte_stuff; goto byte_stuff;
...@@ -292,15 +286,10 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes, ...@@ -292,15 +286,10 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
{ {
struct cardstate *cs = inbuf->cs; struct cardstate *cs = inbuf->cs;
struct bc_state *bcs = inbuf->bcs; struct bc_state *bcs = inbuf->bcs;
int inputstate; int inputstate = bcs->inputstate;
struct sk_buff *skb; struct sk_buff *skb = bcs->skb;
int startbytes = numbytes; int startbytes = numbytes;
IFNULLRETVAL(bcs, numbytes);
inputstate = bcs->inputstate;
skb = bcs->skb;
IFNULLRETVAL(skb, numbytes);
for (;;) { for (;;) {
/* add character */ /* add character */
inputstate |= INS_have_data; inputstate |= INS_have_data;
...@@ -577,11 +566,7 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail) ...@@ -577,11 +566,7 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail)
*/ */
int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb) int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
{ {
unsigned len; unsigned len = skb->len;
IFNULLRETVAL(bcs, -EFAULT);
IFNULLRETVAL(skb, -EFAULT);
len = skb->len;
if (bcs->proto2 == ISDN_PROTO_L2_HDLC) if (bcs->proto2 == ISDN_PROTO_L2_HDLC)
skb = HDLC_Encode(skb, HW_HDR_LEN, 0); skb = HDLC_Encode(skb, HW_HDR_LEN, 0);
......
This diff is collapsed.
...@@ -442,8 +442,6 @@ static int isdn_getnum(char *p) ...@@ -442,8 +442,6 @@ static int isdn_getnum(char *p)
{ {
int v = -1; int v = -1;
IFNULLRETVAL(p, -1);
gig_dbg(DEBUG_TRANSCMD, "string: %s", p); gig_dbg(DEBUG_TRANSCMD, "string: %s", p);
while (*p >= '0' && *p <= '9') while (*p >= '0' && *p <= '9')
...@@ -461,8 +459,6 @@ static int isdn_gethex(char *p) ...@@ -461,8 +459,6 @@ static int isdn_gethex(char *p)
int v = 0; int v = 0;
int c; int c;
IFNULLRETVAL(p, -1);
gig_dbg(DEBUG_TRANSCMD, "string: %s", p); gig_dbg(DEBUG_TRANSCMD, "string: %s", p);
if (!*p) if (!*p)
...@@ -532,8 +528,6 @@ void gigaset_handle_modem_response(struct cardstate *cs) ...@@ -532,8 +528,6 @@ void gigaset_handle_modem_response(struct cardstate *cs)
int cid; int cid;
int rawstring; int rawstring;
IFNULLRET(cs);
len = cs->cbytes; len = cs->cbytes;
if (!len) { if (!len) {
/* ignore additional LFs/CRs (M10x config mode or cx100) */ /* ignore additional LFs/CRs (M10x config mode or cx100) */
...@@ -737,14 +731,8 @@ EXPORT_SYMBOL_GPL(gigaset_handle_modem_response); ...@@ -737,14 +731,8 @@ EXPORT_SYMBOL_GPL(gigaset_handle_modem_response);
static void disconnect(struct at_state_t **at_state_p) static void disconnect(struct at_state_t **at_state_p)
{ {
unsigned long flags; unsigned long flags;
struct bc_state *bcs; struct bc_state *bcs = (*at_state_p)->bcs;
struct cardstate *cs; struct cardstate *cs = (*at_state_p)->cs;
IFNULLRET(at_state_p);
IFNULLRET(*at_state_p);
bcs = (*at_state_p)->bcs;
cs = (*at_state_p)->cs;
IFNULLRET(cs);
new_index(&(*at_state_p)->seq_index, MAX_SEQ_INDEX); new_index(&(*at_state_p)->seq_index, MAX_SEQ_INDEX);
...@@ -912,9 +900,6 @@ static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid) ...@@ -912,9 +900,6 @@ static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid)
static void bchannel_down(struct bc_state *bcs) static void bchannel_down(struct bc_state *bcs)
{ {
IFNULLRET(bcs);
IFNULLRET(bcs->cs);
if (bcs->chstate & CHS_B_UP) { if (bcs->chstate & CHS_B_UP) {
bcs->chstate &= ~CHS_B_UP; bcs->chstate &= ~CHS_B_UP;
gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP); gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP);
...@@ -932,8 +917,6 @@ static void bchannel_down(struct bc_state *bcs) ...@@ -932,8 +917,6 @@ static void bchannel_down(struct bc_state *bcs)
static void bchannel_up(struct bc_state *bcs) static void bchannel_up(struct bc_state *bcs)
{ {
IFNULLRET(bcs);
if (!(bcs->chstate & CHS_D_UP)) { if (!(bcs->chstate & CHS_D_UP)) {
dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__); dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__);
bcs->chstate |= CHS_D_UP; bcs->chstate |= CHS_D_UP;
...@@ -1607,9 +1590,6 @@ static void process_event(struct cardstate *cs, struct event_t *ev) ...@@ -1607,9 +1590,6 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
int curact; int curact;
unsigned long flags; unsigned long flags;
IFNULLRET(cs);
IFNULLRET(ev);
if (ev->cid >= 0) { if (ev->cid >= 0) {
at_state = at_state_from_cid(cs, ev->cid); at_state = at_state_from_cid(cs, ev->cid);
if (!at_state) { if (!at_state) {
...@@ -1634,7 +1614,6 @@ static void process_event(struct cardstate *cs, struct event_t *ev) ...@@ -1634,7 +1614,6 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
/* Setting the pointer to the dial array */ /* Setting the pointer to the dial array */
rep = at_state->replystruct; rep = at_state->replystruct;
IFNULLRET(rep);
if (ev->type == EV_TIMEOUT) { if (ev->type == EV_TIMEOUT) {
if (ev->parameter != atomic_read(&at_state->timer_index) if (ev->parameter != atomic_read(&at_state->timer_index)
...@@ -1746,8 +1725,6 @@ static void process_command_flags(struct cardstate *cs) ...@@ -1746,8 +1725,6 @@ static void process_command_flags(struct cardstate *cs)
int i; int i;
int sequence; int sequence;
IFNULLRET(cs);
atomic_set(&cs->commands_pending, 0); atomic_set(&cs->commands_pending, 0);
if (cs->cur_at_seq) { if (cs->cur_at_seq) {
...@@ -1968,9 +1945,6 @@ void gigaset_handle_event(unsigned long data) ...@@ -1968,9 +1945,6 @@ void gigaset_handle_event(unsigned long data)
{ {
struct cardstate *cs = (struct cardstate *) data; struct cardstate *cs = (struct cardstate *) data;
IFNULLRET(cs);
IFNULLRET(cs->inbuf);
/* handle incoming data on control/common channel */ /* handle incoming data on control/common channel */
if (atomic_read(&cs->inbuf->head) != atomic_read(&cs->inbuf->tail)) { if (atomic_read(&cs->inbuf->head) != atomic_read(&cs->inbuf->tail)) {
gig_dbg(DEBUG_INTR, "processing new data"); gig_dbg(DEBUG_INTR, "processing new data");
......
...@@ -72,33 +72,6 @@ ...@@ -72,33 +72,6 @@
#define MAXACT 3 #define MAXACT 3
#define IFNULL(a) \
if (unlikely(!(a)))
#define IFNULLRET(a) \
if (unlikely(!(a))) { \
err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
return; \
}
#define IFNULLRETVAL(a,b) \
if (unlikely(!(a))) { \
err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
return (b); \
}
#define IFNULLCONT(a) \
if (unlikely(!(a))) { \
err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
continue; \
}
#define IFNULLGOTO(a,b) \
if (unlikely(!(a))) { \
err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
goto b; \
}
extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */ extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */
/* any combination of these can be given with the 'debug=' parameter to insmod, /* any combination of these can be given with the 'debug=' parameter to insmod,
......
...@@ -247,8 +247,6 @@ static inline void dump_bytes(enum debuglevel level, const char *tag, ...@@ -247,8 +247,6 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
static char dbgline[3 * 32 + 1]; static char dbgline[3 * 32 + 1];
static const char hexdigit[] = "0123456789abcdef"; static const char hexdigit[] = "0123456789abcdef";
int i = 0; int i = 0;
IFNULLRET(tag);
IFNULLRET(bytes);
while (count-- > 0) { while (count-- > 0) {
if (i > sizeof(dbgline) - 4) { if (i > sizeof(dbgline) - 4) {
dbgline[i] = '\0'; dbgline[i] = '\0';
...@@ -663,14 +661,10 @@ static unsigned char bitcounts[256] = { ...@@ -663,14 +661,10 @@ static unsigned char bitcounts[256] = {
static inline void hdlc_unpack(unsigned char *src, unsigned count, static inline void hdlc_unpack(unsigned char *src, unsigned count,
struct bc_state *bcs) struct bc_state *bcs)
{ {
struct bas_bc_state *ubc; struct bas_bc_state *ubc = bcs->hw.bas;
int inputstate; int inputstate;
unsigned seqlen, inbyte, inbits; unsigned seqlen, inbyte, inbits;
IFNULLRET(bcs);
ubc = bcs->hw.bas;
IFNULLRET(ubc);
/* load previous state: /* load previous state:
* inputstate = set of flag bits: * inputstate = set of flag bits:
* - INS_flag_hunt: no complete opening flag received since connection setup or last abort * - INS_flag_hunt: no complete opening flag received since connection setup or last abort
...@@ -995,11 +989,7 @@ void gigaset_isoc_input(struct inbuf_t *inbuf) ...@@ -995,11 +989,7 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
*/ */
int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb) int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb)
{ {
int len; int len = skb->len;
IFNULLRETVAL(bcs, -EFAULT);
IFNULLRETVAL(skb, -EFAULT);
len = skb->len;
skb_queue_tail(&bcs->squeue, skb); skb_queue_tail(&bcs->squeue, skb);
gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d", gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d",
......
...@@ -365,18 +365,12 @@ static void gigaset_modem_fill(unsigned long data) ...@@ -365,18 +365,12 @@ static void gigaset_modem_fill(unsigned long data)
*/ */
static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs) static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
{ {
struct inbuf_t *inbuf = urb->context;
struct cardstate *cs = inbuf->cs;
int resubmit = 0; int resubmit = 0;
int r; int r;
struct cardstate *cs;
unsigned numbytes; unsigned numbytes;
unsigned char *src; unsigned char *src;
struct inbuf_t *inbuf;
IFNULLRET(urb);
inbuf = (struct inbuf_t *) urb->context;
IFNULLRET(inbuf);
cs = inbuf->cs;
IFNULLRET(cs);
if (!atomic_read(&cs->connected)) { if (!atomic_read(&cs->connected)) {
err("%s: disconnected", __func__); err("%s: disconnected", __func__);
...@@ -421,9 +415,8 @@ static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs) ...@@ -421,9 +415,8 @@ static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
/* This callback routine is called when data was transmitted to the device. */ /* This callback routine is called when data was transmitted to the device. */
static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs) static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
{ {
struct cardstate *cs = (struct cardstate *) urb->context; struct cardstate *cs = urb->context;
IFNULLRET(cs);
#ifdef CONFIG_GIGASET_DEBUG #ifdef CONFIG_GIGASET_DEBUG
if (!atomic_read(&cs->connected)) { if (!atomic_read(&cs->connected)) {
err("%s: not connected", __func__); err("%s: not connected", __func__);
...@@ -632,20 +625,13 @@ static int gigaset_initcshw(struct cardstate *cs) ...@@ -632,20 +625,13 @@ static int gigaset_initcshw(struct cardstate *cs)
/* Send data from current skb to the device. */ /* Send data from current skb to the device. */
static int write_modem(struct cardstate *cs) static int write_modem(struct cardstate *cs)
{ {
int ret; int ret = 0;
int count; int count;
struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
struct usb_cardstate *ucs = cs->hw.usb; struct usb_cardstate *ucs = cs->hw.usb;
IFNULLRETVAL(bcs->tx_skb, -EINVAL);
gig_dbg(DEBUG_WRITE, "len: %d...", bcs->tx_skb->len); gig_dbg(DEBUG_WRITE, "len: %d...", bcs->tx_skb->len);
ret = -ENODEV;
IFNULLGOTO(ucs->bulk_out_buffer, error);
IFNULLGOTO(ucs->bulk_out_urb, error);
ret = 0;
if (!bcs->tx_skb->len) { if (!bcs->tx_skb->len) {
dev_kfree_skb_any(bcs->tx_skb); dev_kfree_skb_any(bcs->tx_skb);
bcs->tx_skb = NULL; bcs->tx_skb = NULL;
...@@ -683,11 +669,6 @@ static int write_modem(struct cardstate *cs) ...@@ -683,11 +669,6 @@ static int write_modem(struct cardstate *cs)
} }
return ret; return ret;
error:
dev_kfree_skb_any(bcs->tx_skb);
bcs->tx_skb = NULL;
return ret;
} }
static int gigaset_probe(struct usb_interface *interface, static int gigaset_probe(struct usb_interface *interface,
......
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