Skip to content

Commit

Permalink
gigaset: reduce syslog clutter
Browse files Browse the repository at this point in the history
Improve readability of the Gigaset driver's kernel messages by
removing a few unnecessary messages and limiting the emission
of some debug messages more narrowly.

Impact: logging
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tilman Schmidt authored and David S. Miller committed Feb 26, 2010
1 parent 63e055d commit 1528b18
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 147 deletions.
4 changes: 2 additions & 2 deletions drivers/isdn/gigaset/asyncdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ static unsigned cmd_loop(unsigned numbytes, struct inbuf_t *inbuf)
/* --v-- fall through --v-- */
case '\r':
/* end of message line, pass to response handler */
gig_dbg(DEBUG_TRANSCMD, "%s: End of Message (%d Bytes)",
__func__, cbytes);
if (cbytes >= MAX_RESP_SIZE) {
dev_warn(cs->dev, "response too large (%d)\n",
cbytes);
cbytes = MAX_RESP_SIZE;
}
cs->cbytes = cbytes;
gigaset_dbg_buffer(DEBUG_TRANSCMD, "received response",
cbytes, cs->respdata);
gigaset_handle_modem_response(cs);
cbytes = 0;

Expand Down
18 changes: 6 additions & 12 deletions drivers/isdn/gigaset/bas-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,7 @@ static inline void error_hangup(struct bc_state *bcs)
{
struct cardstate *cs = bcs->cs;

gig_dbg(DEBUG_ANY, "%s: scheduling HUP for channel %d",
__func__, bcs->channel);

if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL))
dev_err(cs->dev, "event queue full\n");

gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL);
gigaset_schedule_event(cs);
}

Expand Down Expand Up @@ -1706,8 +1701,7 @@ static void complete_cb(struct cardstate *cs)

/* unqueue completed buffer */
cs->cmdbytes -= cs->curlen;
gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD,
"write_command: sent %u bytes, %u left",
gig_dbg(DEBUG_OUTPUT, "write_command: sent %u bytes, %u left",
cs->curlen, cs->cmdbytes);
if (cb->next != NULL) {
cs->cmdbuf = cb->next;
Expand Down Expand Up @@ -1881,13 +1875,13 @@ static int start_cbsend(struct cardstate *cs)

/* check if suspend requested */
if (ucs->basstate & BS_SUSPEND) {
gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "suspending");
gig_dbg(DEBUG_OUTPUT, "suspending");
return -EHOSTUNREACH;
}

/* check if AT channel is open */
if (!(ucs->basstate & BS_ATOPEN)) {
gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open");
gig_dbg(DEBUG_OUTPUT, "AT channel not open");
rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT);
if (rc < 0) {
/* flush command queue */
Expand Down Expand Up @@ -2251,15 +2245,15 @@ static int gigaset_probe(struct usb_interface *interface,
int i, j;
int rc;

gig_dbg(DEBUG_ANY,
gig_dbg(DEBUG_INIT,
"%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)",
__func__, le16_to_cpu(udev->descriptor.idVendor),
le16_to_cpu(udev->descriptor.idProduct));

/* set required alternate setting */
hostif = interface->cur_altsetting;
if (hostif->desc.bAlternateSetting != 3) {
gig_dbg(DEBUG_ANY,
gig_dbg(DEBUG_INIT,
"%s: wrong alternate setting %d - trying to switch",
__func__, hostif->desc.bAlternateSetting);
if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3)
Expand Down
15 changes: 4 additions & 11 deletions drivers/isdn/gigaset/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,9 +1427,10 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,

/* queue & schedule EV_DIAL event */
if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, commands,
bcs->at_state.seq_index, NULL))
goto oom;
gig_dbg(DEBUG_CMD, "scheduling DIAL");
bcs->at_state.seq_index, NULL)) {
info = CAPI_MSGOSRESOURCEERR;
goto error;
}
gigaset_schedule_event(cs);
ap->connected = APCONN_SETUP;
send_conf(iif, ap, skb, CapiSuccess);
Expand Down Expand Up @@ -1543,7 +1544,6 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state,
EV_ACCEPT, NULL, 0, NULL))
return;
gig_dbg(DEBUG_CMD, "scheduling ACCEPT");
gigaset_schedule_event(cs);
return;

Expand Down Expand Up @@ -1584,7 +1584,6 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state,
EV_HUP, NULL, 0, NULL))
return;
gig_dbg(DEBUG_CMD, "scheduling HUP");
gigaset_schedule_event(cs);
return;
}
Expand Down Expand Up @@ -1667,11 +1666,9 @@ static void do_connect_b3_resp(struct gigaset_capi_ctr *iif,
/* trigger hangup, causing eventual DISCONNECT_IND */
if (!gigaset_add_event(cs, &bcs->at_state,
EV_HUP, NULL, 0, NULL)) {
dev_err(cs->dev, "%s: out of memory\n", __func__);
dev_kfree_skb_any(skb);
return;
}
gig_dbg(DEBUG_CMD, "scheduling HUP");
gigaset_schedule_event(cs);

/* emit DISCONNECT_B3_IND */
Expand Down Expand Up @@ -1770,11 +1767,9 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,

/* trigger hangup, causing eventual DISCONNECT_IND */
if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) {
dev_err(cs->dev, "%s: out of memory\n", __func__);
send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
return;
}
gig_dbg(DEBUG_CMD, "scheduling HUP");
gigaset_schedule_event(cs);

/* emit reply */
Expand Down Expand Up @@ -1817,11 +1812,9 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif,
/* trigger hangup, causing eventual DISCONNECT_B3_IND */
if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state,
EV_HUP, NULL, 0, NULL)) {
dev_err(cs->dev, "%s: out of memory\n", __func__);
send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
return;
}
gig_dbg(DEBUG_CMD, "scheduling HUP");
gigaset_schedule_event(cs);

/* NCPI parameter: not applicable for B3 Transparent */
Expand Down
49 changes: 20 additions & 29 deletions drivers/isdn/gigaset/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ static int test_timeout(struct at_state_t *at_state)
return 0;
}

if (!gigaset_add_event(at_state->cs, at_state, EV_TIMEOUT, NULL,
at_state->timer_index, NULL))
dev_err(at_state->cs->dev, "%s: out of memory\n",
__func__);
gigaset_add_event(at_state->cs, at_state, EV_TIMEOUT, NULL,
at_state->timer_index, NULL);
return 1;
}

Expand Down Expand Up @@ -180,7 +178,7 @@ static void timer_tick(unsigned long data)
if (cs->running) {
mod_timer(&cs->timer, jiffies + msecs_to_jiffies(GIG_TICK));
if (timeout) {
gig_dbg(DEBUG_CMD, "scheduling timeout");
gig_dbg(DEBUG_EVENT, "scheduling timeout");
tasklet_schedule(&cs->event_tasklet);
}
}
Expand All @@ -194,14 +192,14 @@ int gigaset_get_channel(struct bc_state *bcs)

spin_lock_irqsave(&bcs->cs->lock, flags);
if (bcs->use_count || !try_module_get(bcs->cs->driver->owner)) {
gig_dbg(DEBUG_ANY, "could not allocate channel %d",
gig_dbg(DEBUG_CHANNEL, "could not allocate channel %d",
bcs->channel);
spin_unlock_irqrestore(&bcs->cs->lock, flags);
return 0;
}
++bcs->use_count;
bcs->busy = 1;
gig_dbg(DEBUG_ANY, "allocated channel %d", bcs->channel);
gig_dbg(DEBUG_CHANNEL, "allocated channel %d", bcs->channel);
spin_unlock_irqrestore(&bcs->cs->lock, flags);
return 1;
}
Expand All @@ -213,7 +211,7 @@ struct bc_state *gigaset_get_free_channel(struct cardstate *cs)

spin_lock_irqsave(&cs->lock, flags);
if (!try_module_get(cs->driver->owner)) {
gig_dbg(DEBUG_ANY,
gig_dbg(DEBUG_CHANNEL,
"could not get module for allocating channel");
spin_unlock_irqrestore(&cs->lock, flags);
return NULL;
Expand All @@ -223,12 +221,12 @@ struct bc_state *gigaset_get_free_channel(struct cardstate *cs)
++cs->bcs[i].use_count;
cs->bcs[i].busy = 1;
spin_unlock_irqrestore(&cs->lock, flags);
gig_dbg(DEBUG_ANY, "allocated channel %d", i);
gig_dbg(DEBUG_CHANNEL, "allocated channel %d", i);
return cs->bcs + i;
}
module_put(cs->driver->owner);
spin_unlock_irqrestore(&cs->lock, flags);
gig_dbg(DEBUG_ANY, "no free channel");
gig_dbg(DEBUG_CHANNEL, "no free channel");
return NULL;
}

Expand All @@ -238,14 +236,15 @@ void gigaset_free_channel(struct bc_state *bcs)

spin_lock_irqsave(&bcs->cs->lock, flags);
if (!bcs->busy) {
gig_dbg(DEBUG_ANY, "could not free channel %d", bcs->channel);
gig_dbg(DEBUG_CHANNEL, "could not free channel %d",
bcs->channel);
spin_unlock_irqrestore(&bcs->cs->lock, flags);
return;
}
--bcs->use_count;
bcs->busy = 0;
module_put(bcs->cs->driver->owner);
gig_dbg(DEBUG_ANY, "freed channel %d", bcs->channel);
gig_dbg(DEBUG_CHANNEL, "freed channel %d", bcs->channel);
spin_unlock_irqrestore(&bcs->cs->lock, flags);
}

Expand All @@ -258,14 +257,15 @@ int gigaset_get_channels(struct cardstate *cs)
for (i = 0; i < cs->channels; ++i)
if (cs->bcs[i].use_count) {
spin_unlock_irqrestore(&cs->lock, flags);
gig_dbg(DEBUG_ANY, "could not allocate all channels");
gig_dbg(DEBUG_CHANNEL,
"could not allocate all channels");
return 0;
}
for (i = 0; i < cs->channels; ++i)
++cs->bcs[i].use_count;
spin_unlock_irqrestore(&cs->lock, flags);

gig_dbg(DEBUG_ANY, "allocated all channels");
gig_dbg(DEBUG_CHANNEL, "allocated all channels");

return 1;
}
Expand All @@ -275,7 +275,7 @@ void gigaset_free_channels(struct cardstate *cs)
unsigned long flags;
int i;

gig_dbg(DEBUG_ANY, "unblocking all channels");
gig_dbg(DEBUG_CHANNEL, "unblocking all channels");
spin_lock_irqsave(&cs->lock, flags);
for (i = 0; i < cs->channels; ++i)
--cs->bcs[i].use_count;
Expand All @@ -287,7 +287,7 @@ void gigaset_block_channels(struct cardstate *cs)
unsigned long flags;
int i;

gig_dbg(DEBUG_ANY, "blocking all channels");
gig_dbg(DEBUG_CHANNEL, "blocking all channels");
spin_lock_irqsave(&cs->lock, flags);
for (i = 0; i < cs->channels; ++i)
++cs->bcs[i].use_count;
Expand Down Expand Up @@ -338,6 +338,8 @@ struct event_t *gigaset_add_event(struct cardstate *cs,
unsigned next, tail;
struct event_t *event = NULL;

gig_dbg(DEBUG_EVENT, "queueing event %d", type);

spin_lock_irqsave(&cs->ev_lock, flags);

tail = cs->ev_tail;
Expand Down Expand Up @@ -934,11 +936,8 @@ int gigaset_start(struct cardstate *cs)

if (!gigaset_add_event(cs, &cs->at_state, EV_START, NULL, 0, NULL)) {
cs->waiting = 0;
dev_err(cs->dev, "%s: out of memory\n", __func__);
goto error;
}

gig_dbg(DEBUG_CMD, "scheduling START");
gigaset_schedule_event(cs);

wait_event(cs->waitqueue, !cs->waiting);
Expand Down Expand Up @@ -973,12 +972,8 @@ int gigaset_shutdown(struct cardstate *cs)

cs->waiting = 1;

if (!gigaset_add_event(cs, &cs->at_state, EV_SHUTDOWN, NULL, 0, NULL)) {
dev_err(cs->dev, "%s: out of memory\n", __func__);
if (!gigaset_add_event(cs, &cs->at_state, EV_SHUTDOWN, NULL, 0, NULL))
goto exit;
}

gig_dbg(DEBUG_CMD, "scheduling SHUTDOWN");
gigaset_schedule_event(cs);

wait_event(cs->waitqueue, !cs->waiting);
Expand All @@ -1004,12 +999,8 @@ void gigaset_stop(struct cardstate *cs)

cs->waiting = 1;

if (!gigaset_add_event(cs, &cs->at_state, EV_STOP, NULL, 0, NULL)) {
dev_err(cs->dev, "%s: out of memory\n", __func__);
if (!gigaset_add_event(cs, &cs->at_state, EV_STOP, NULL, 0, NULL))
goto exit;
}

gig_dbg(DEBUG_CMD, "scheduling STOP");
gigaset_schedule_event(cs);

wait_event(cs->waitqueue, !cs->waiting);
Expand Down
Loading

0 comments on commit 1528b18

Please sign in to comment.