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);
......
...@@ -205,7 +205,6 @@ static inline void dump_urb(enum debuglevel level, const char *tag, ...@@ -205,7 +205,6 @@ static inline void dump_urb(enum debuglevel level, const char *tag,
{ {
#ifdef CONFIG_GIGASET_DEBUG #ifdef CONFIG_GIGASET_DEBUG
int i; int i;
IFNULLRET(tag);
gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb); gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb);
if (urb) { if (urb) {
gig_dbg(level, gig_dbg(level,
...@@ -309,8 +308,6 @@ static void check_pending(struct bas_cardstate *ucs) ...@@ -309,8 +308,6 @@ static void check_pending(struct bas_cardstate *ucs)
{ {
unsigned long flags; unsigned long flags;
IFNULLRET(ucs);
spin_lock_irqsave(&ucs->lock, flags); spin_lock_irqsave(&ucs->lock, flags);
switch (ucs->pending) { switch (ucs->pending) {
case 0: case 0:
...@@ -366,13 +363,9 @@ static void check_pending(struct bas_cardstate *ucs) ...@@ -366,13 +363,9 @@ static void check_pending(struct bas_cardstate *ucs)
static void cmd_in_timeout(unsigned long data) static void cmd_in_timeout(unsigned long data)
{ {
struct cardstate *cs = (struct cardstate *) data; struct cardstate *cs = (struct cardstate *) data;
struct bas_cardstate *ucs; struct bas_cardstate *ucs = cs->hw.bas;
unsigned long flags; unsigned long flags;
IFNULLRET(cs);
ucs = cs->hw.bas;
IFNULLRET(ucs);
spin_lock_irqsave(&cs->lock, flags); spin_lock_irqsave(&cs->lock, flags);
if (unlikely(!atomic_read(&cs->connected))) { if (unlikely(!atomic_read(&cs->connected))) {
gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__); gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__);
...@@ -406,14 +399,9 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs); ...@@ -406,14 +399,9 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs);
*/ */
static int atread_submit(struct cardstate *cs, int timeout) static int atread_submit(struct cardstate *cs, int timeout)
{ {
struct bas_cardstate *ucs; struct bas_cardstate *ucs = cs->hw.bas;
int ret; int ret;
IFNULLRETVAL(cs, -EINVAL);
ucs = cs->hw.bas;
IFNULLRETVAL(ucs, -EINVAL);
IFNULLRETVAL(ucs->urb_cmd_in, -EINVAL);
gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)",
ucs->rcvbuf_size); ucs->rcvbuf_size);
...@@ -479,20 +467,14 @@ inline static void update_basstate(struct bas_cardstate *ucs, ...@@ -479,20 +467,14 @@ inline static void update_basstate(struct bas_cardstate *ucs,
*/ */
static void read_int_callback(struct urb *urb, struct pt_regs *regs) static void read_int_callback(struct urb *urb, struct pt_regs *regs)
{ {
struct cardstate *cs; struct cardstate *cs = urb->context;
struct bas_cardstate *ucs; struct bas_cardstate *ucs = cs->hw.bas;
struct bc_state *bcs; struct bc_state *bcs;
unsigned long flags; unsigned long flags;
int status; int status;
unsigned l; unsigned l;
int channel; int channel;
IFNULLRET(urb);
cs = (struct cardstate *) urb->context;
IFNULLRET(cs);
ucs = cs->hw.bas;
IFNULLRET(ucs);
if (unlikely(!atomic_read(&cs->connected))) { if (unlikely(!atomic_read(&cs->connected))) {
warn("%s: disconnected", __func__); warn("%s: disconnected", __func__);
return; return;
...@@ -638,20 +620,12 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) ...@@ -638,20 +620,12 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs)
*/ */
static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs)
{ {
struct cardstate *cs; struct inbuf_t *inbuf = urb->context;
struct bas_cardstate *ucs; struct cardstate *cs = inbuf->cs;
struct bas_cardstate *ucs = cs->hw.bas;
int have_data = 0;
unsigned numbytes; unsigned numbytes;
unsigned long flags; unsigned long flags;
struct inbuf_t *inbuf;
int have_data = 0;
IFNULLRET(urb);
inbuf = (struct inbuf_t *) urb->context;
IFNULLRET(inbuf);
cs = inbuf->cs;
IFNULLRET(cs);
ucs = cs->hw.bas;
IFNULLRET(ucs);
spin_lock_irqsave(&cs->lock, flags); spin_lock_irqsave(&cs->lock, flags);
if (unlikely(!atomic_read(&cs->connected))) { if (unlikely(!atomic_read(&cs->connected))) {
...@@ -747,10 +721,6 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) ...@@ -747,10 +721,6 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs)
unsigned long flags; unsigned long flags;
int i, rc; int i, rc;
IFNULLRET(urb);
IFNULLRET(urb->context);
IFNULLRET(cardstate);
/* status codes not worth bothering the tasklet with */ /* status codes not worth bothering the tasklet with */
if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET ||
urb->status == -EINPROGRESS)) { urb->status == -EINPROGRESS)) {
...@@ -759,9 +729,8 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) ...@@ -759,9 +729,8 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs)
return; return;
} }
bcs = (struct bc_state *) urb->context; bcs = urb->context;
ubc = bcs->hw.bas; ubc = bcs->hw.bas;
IFNULLRET(ubc);
spin_lock_irqsave(&ubc->isoinlock, flags); spin_lock_irqsave(&ubc->isoinlock, flags);
if (likely(ubc->isoindone == NULL)) { if (likely(ubc->isoindone == NULL)) {
...@@ -813,10 +782,6 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) ...@@ -813,10 +782,6 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs)
struct bas_bc_state *ubc; struct bas_bc_state *ubc;
unsigned long flags; unsigned long flags;
IFNULLRET(urb);
IFNULLRET(urb->context);
IFNULLRET(cardstate);
/* status codes not worth bothering the tasklet with */ /* status codes not worth bothering the tasklet with */
if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET ||
urb->status == -EINPROGRESS)) { urb->status == -EINPROGRESS)) {
...@@ -826,10 +791,8 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) ...@@ -826,10 +791,8 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs)
} }
/* pass URB context to tasklet */ /* pass URB context to tasklet */
ucx = (struct isow_urbctx_t *) urb->context; ucx = urb->context;
IFNULLRET(ucx->bcs);
ubc = ucx->bcs->hw.bas; ubc = ucx->bcs->hw.bas;
IFNULLRET(ubc);
spin_lock_irqsave(&ubc->isooutlock, flags); spin_lock_irqsave(&ubc->isooutlock, flags);
ubc->isooutovfl = ubc->isooutdone; ubc->isooutovfl = ubc->isooutdone;
...@@ -848,15 +811,11 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) ...@@ -848,15 +811,11 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs)
*/ */
static int starturbs(struct bc_state *bcs) static int starturbs(struct bc_state *bcs)
{ {
struct bas_bc_state *ubc = bcs->hw.bas;
struct urb *urb; struct urb *urb;
struct bas_bc_state *ubc;
int j, k; int j, k;
int rc; int rc;
IFNULLRETVAL(bcs, -EFAULT);
ubc = bcs->hw.bas;
IFNULLRETVAL(ubc, -EFAULT);
/* initialize L2 reception */ /* initialize L2 reception */
if (bcs->proto2 == ISDN_PROTO_L2_HDLC) if (bcs->proto2 == ISDN_PROTO_L2_HDLC)
bcs->inputstate |= INS_flag_hunt; bcs->inputstate |= INS_flag_hunt;
...@@ -955,8 +914,6 @@ static void stopurbs(struct bas_bc_state *ubc) ...@@ -955,8 +914,6 @@ static void stopurbs(struct bas_bc_state *ubc)
{ {
int k, rc; int k, rc;
IFNULLRET(ubc);
atomic_set(&ubc->running, 0); atomic_set(&ubc->running, 0);
for (k = 0; k < BAS_INURBS; ++k) { for (k = 0; k < BAS_INURBS; ++k) {
...@@ -988,18 +945,11 @@ static void stopurbs(struct bas_bc_state *ubc) ...@@ -988,18 +945,11 @@ static void stopurbs(struct bas_bc_state *ubc)
*/ */
static int submit_iso_write_urb(struct isow_urbctx_t *ucx) static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
{ {
struct urb *urb; struct urb *urb = ucx->urb;
struct bas_bc_state *ubc; struct bas_bc_state *ubc = ucx->bcs->hw.bas;
struct usb_iso_packet_descriptor *ifd; struct usb_iso_packet_descriptor *ifd;
int corrbytes, nframe, rc; int corrbytes, nframe, rc;
IFNULLRETVAL(ucx, -EFAULT);
urb = ucx->urb;
IFNULLRETVAL(urb, -EFAULT);
IFNULLRETVAL(ucx->bcs, -EFAULT);
ubc = ucx->bcs->hw.bas;
IFNULLRETVAL(ubc, -EFAULT);
/* urb->dev is clobbered by USB subsystem */ /* urb->dev is clobbered by USB subsystem */
urb->dev = ucx->bcs->cs->hw.bas->udev; urb->dev = ucx->bcs->cs->hw.bas->udev;
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
...@@ -1065,9 +1015,9 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) ...@@ -1065,9 +1015,9 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
*/ */
static void write_iso_tasklet(unsigned long data) static void write_iso_tasklet(unsigned long data)
{ {
struct bc_state *bcs; struct bc_state *bcs = (struct bc_state *) data;
struct bas_bc_state *ubc; struct bas_bc_state *ubc = bcs->hw.bas;
struct cardstate *cs; struct cardstate *cs = bcs->cs;
struct isow_urbctx_t *done, *next, *ovfl; struct isow_urbctx_t *done, *next, *ovfl;
struct urb *urb; struct urb *urb;
struct usb_iso_packet_descriptor *ifd; struct usb_iso_packet_descriptor *ifd;
...@@ -1077,13 +1027,6 @@ static void write_iso_tasklet(unsigned long data) ...@@ -1077,13 +1027,6 @@ static void write_iso_tasklet(unsigned long data)
struct sk_buff *skb; struct sk_buff *skb;
int len; int len;
bcs = (struct bc_state *) data;
IFNULLRET(bcs);
ubc = bcs->hw.bas;
IFNULLRET(ubc);
cs = bcs->cs;
IFNULLRET(cs);
/* loop while completed URBs arrive in time */ /* loop while completed URBs arrive in time */
for (;;) { for (;;) {
if (unlikely(!atomic_read(&cs->connected))) { if (unlikely(!atomic_read(&cs->connected))) {
...@@ -1237,21 +1180,14 @@ static void write_iso_tasklet(unsigned long data) ...@@ -1237,21 +1180,14 @@ static void write_iso_tasklet(unsigned long data)
*/ */
static void read_iso_tasklet(unsigned long data) static void read_iso_tasklet(unsigned long data)
{ {
struct bc_state *bcs; struct bc_state *bcs = (struct bc_state *) data;
struct bas_bc_state *ubc; struct bas_bc_state *ubc = bcs->hw.bas;
struct cardstate *cs; struct cardstate *cs = bcs->cs;
struct urb *urb; struct urb *urb;
char *rcvbuf; char *rcvbuf;
unsigned long flags; unsigned long flags;
int totleft, numbytes, offset, frame, rc; int totleft, numbytes, offset, frame, rc;
bcs = (struct bc_state *) data;
IFNULLRET(bcs);
ubc = bcs->hw.bas;
IFNULLRET(ubc);
cs = bcs->cs;
IFNULLRET(cs);
/* loop while more completed URBs arrive in the meantime */ /* loop while more completed URBs arrive in the meantime */
for (;;) { for (;;) {
if (unlikely(!atomic_read(&cs->connected))) { if (unlikely(!atomic_read(&cs->connected))) {
...@@ -1383,15 +1319,10 @@ static void read_iso_tasklet(unsigned long data) ...@@ -1383,15 +1319,10 @@ static void read_iso_tasklet(unsigned long data)
static void req_timeout(unsigned long data) static void req_timeout(unsigned long data)
{ {
struct bc_state *bcs = (struct bc_state *) data; struct bc_state *bcs = (struct bc_state *) data;
struct bas_cardstate *ucs; struct bas_cardstate *ucs = bcs->cs->hw.bas;
int pending; int pending;
unsigned long flags; unsigned long flags;
IFNULLRET(bcs);
IFNULLRET(bcs->cs);
ucs = bcs->cs->hw.bas;
IFNULLRET(ucs);
check_pending(ucs); check_pending(ucs);
spin_lock_irqsave(&ucs->lock, flags); spin_lock_irqsave(&ucs->lock, flags);
...@@ -1441,14 +1372,9 @@ static void req_timeout(unsigned long data) ...@@ -1441,14 +1372,9 @@ static void req_timeout(unsigned long data)
*/ */
static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs)
{ {
struct bas_cardstate *ucs; struct bas_cardstate *ucs = urb->context;
unsigned long flags; unsigned long flags;
IFNULLRET(urb);
IFNULLRET(urb->context);
IFNULLRET(cardstate);
ucs = (struct bas_cardstate *) urb->context;
spin_lock_irqsave(&ucs->lock, flags); spin_lock_irqsave(&ucs->lock, flags);
if (urb->status && ucs->pending) { if (urb->status && ucs->pending) {
dev_err(&ucs->interface->dev, dev_err(&ucs->interface->dev,
...@@ -1482,16 +1408,10 @@ static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) ...@@ -1482,16 +1408,10 @@ static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs)
*/ */
static int req_submit(struct bc_state *bcs, int req, int val, int timeout) static int req_submit(struct bc_state *bcs, int req, int val, int timeout)
{ {
struct bas_cardstate *ucs; struct bas_cardstate *ucs = bcs->cs->hw.bas;
int ret; int ret;
unsigned long flags; unsigned long flags;
IFNULLRETVAL(bcs, -EINVAL);
IFNULLRETVAL(bcs->cs, -EINVAL);
ucs = bcs->cs->hw.bas;
IFNULLRETVAL(ucs, -EINVAL);
IFNULLRETVAL(ucs->urb_ctrl, -EINVAL);
gig_dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val); gig_dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val);
spin_lock_irqsave(&ucs->lock, flags); spin_lock_irqsave(&ucs->lock, flags);
...@@ -1551,8 +1471,6 @@ static int gigaset_init_bchannel(struct bc_state *bcs) ...@@ -1551,8 +1471,6 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
{ {
int req, ret; int req, ret;
IFNULLRETVAL(bcs, -EINVAL);
if ((ret = starturbs(bcs)) < 0) { if ((ret = starturbs(bcs)) < 0) {
dev_err(bcs->cs->dev, dev_err(bcs->cs->dev,
"could not start isochronous I/O for channel %d\n", "could not start isochronous I/O for channel %d\n",
...@@ -1585,8 +1503,6 @@ static int gigaset_close_bchannel(struct bc_state *bcs) ...@@ -1585,8 +1503,6 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
{ {
int req, ret; int req, ret;
IFNULLRETVAL(bcs, -EINVAL);
if (!(atomic_read(&bcs->cs->hw.bas->basstate) & if (!(atomic_read(&bcs->cs->hw.bas->basstate) &
(bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) {
/* channel not running: just signal common.c */ /* channel not running: just signal common.c */
...@@ -1613,11 +1529,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs) ...@@ -1613,11 +1529,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
*/ */
static void complete_cb(struct cardstate *cs) static void complete_cb(struct cardstate *cs)
{ {
struct cmdbuf_t *cb; struct cmdbuf_t *cb = cs->cmdbuf;
IFNULLRET(cs);
cb = cs->cmdbuf;
IFNULLRET(cb);
/* unqueue completed buffer */ /* unqueue completed buffer */
cs->cmdbytes -= cs->curlen; cs->cmdbytes -= cs->curlen;
...@@ -1649,15 +1561,9 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len); ...@@ -1649,15 +1561,9 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len);
*/ */
static void write_command_callback(struct urb *urb, struct pt_regs *regs) static void write_command_callback(struct urb *urb, struct pt_regs *regs)
{ {
struct cardstate *cs; struct cardstate *cs = urb->context;
struct bas_cardstate *ucs = cs->hw.bas;
unsigned long flags; unsigned long flags;
struct bas_cardstate *ucs;
IFNULLRET(urb);
cs = (struct cardstate *) urb->context;
IFNULLRET(cs);
ucs = cs->hw.bas;
IFNULLRET(ucs);
/* check status */ /* check status */
switch (urb->status) { switch (urb->status) {
...@@ -1709,11 +1615,7 @@ static void write_command_callback(struct urb *urb, struct pt_regs *regs) ...@@ -1709,11 +1615,7 @@ static void write_command_callback(struct urb *urb, struct pt_regs *regs)
static void atrdy_timeout(unsigned long data) static void atrdy_timeout(unsigned long data)
{ {
struct cardstate *cs = (struct cardstate *) data; struct cardstate *cs = (struct cardstate *) data;
struct bas_cardstate *ucs; struct bas_cardstate *ucs = cs->hw.bas;
IFNULLRET(cs);
ucs = cs->hw.bas;
IFNULLRET(ucs);
dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n"); dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");
...@@ -1736,14 +1638,9 @@ static void atrdy_timeout(unsigned long data) ...@@ -1736,14 +1638,9 @@ static void atrdy_timeout(unsigned long data)
*/ */
static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
{ {
struct bas_cardstate *ucs; struct bas_cardstate *ucs = cs->hw.bas;
int ret; int ret;
IFNULLRETVAL(cs, -EFAULT);
ucs = cs->hw.bas;
IFNULLRETVAL(ucs, -EFAULT);
IFNULLRETVAL(ucs->urb_cmd_out, -EFAULT);
gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len);
if (ucs->urb_cmd_out->status == -EINPROGRESS) { if (ucs->urb_cmd_out->status == -EINPROGRESS) {
...@@ -1795,15 +1692,11 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) ...@@ -1795,15 +1692,11 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
static int start_cbsend(struct cardstate *cs) static int start_cbsend(struct cardstate *cs)
{ {
struct cmdbuf_t *cb; struct cmdbuf_t *cb;
struct bas_cardstate *ucs; struct bas_cardstate *ucs = cs->hw.bas;
unsigned long flags; unsigned long flags;
int rc; int rc;
int retval = 0; int retval = 0;
IFNULLRETVAL(cs, -EFAULT);
ucs = cs->hw.bas;
IFNULLRETVAL(ucs, -EFAULT);
/* check if AT channel is open */ /* check if AT channel is open */
if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) { if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) {
gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open");
...@@ -2084,17 +1977,12 @@ static int gigaset_initcshw(struct cardstate *cs) ...@@ -2084,17 +1977,12 @@ static int gigaset_initcshw(struct cardstate *cs)
*/ */
static void freeurbs(struct cardstate *cs) static void freeurbs(struct cardstate *cs)
{ {
struct bas_cardstate *ucs; struct bas_cardstate *ucs = cs->hw.bas;
struct bas_bc_state *ubc; struct bas_bc_state *ubc;
int i, j; int i, j;
IFNULLRET(cs);
ucs = cs->hw.bas;
IFNULLRET(ucs);
for (j = 0; j < 2; ++j) { for (j = 0; j < 2; ++j) {
ubc = cs->bcs[j].hw.bas; ubc = cs->bcs[j].hw.bas;
IFNULLCONT(ubc);
for (i = 0; i < BAS_OUTURBS; ++i) for (i = 0; i < BAS_OUTURBS; ++i)
if (ubc->isoouturbs[i].urb) { if (ubc->isoouturbs[i].urb) {
usb_kill_urb(ubc->isoouturbs[i].urb); usb_kill_urb(ubc->isoouturbs[i].urb);
...@@ -2160,8 +2048,6 @@ static int gigaset_probe(struct usb_interface *interface, ...@@ -2160,8 +2048,6 @@ static int gigaset_probe(struct usb_interface *interface,
int i, j; int i, j;
int ret; int ret;
IFNULLRETVAL(udev, -ENODEV);
gig_dbg(DEBUG_ANY, gig_dbg(DEBUG_ANY,
"%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)",
__func__, le16_to_cpu(udev->descriptor.idVendor), __func__, le16_to_cpu(udev->descriptor.idVendor),
...@@ -2314,9 +2200,7 @@ static void gigaset_disconnect(struct usb_interface *interface) ...@@ -2314,9 +2200,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
cs = usb_get_intfdata(interface); cs = usb_get_intfdata(interface);
IFNULLRET(cs);
ucs = cs->hw.bas; ucs = cs->hw.bas;
IFNULLRET(ucs);
dev_info(cs->dev, "disconnecting Gigaset base\n"); dev_info(cs->dev, "disconnecting Gigaset base\n");
gigaset_stop(cs); gigaset_stop(cs);
......
...@@ -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