Commit 917f5085 authored by Tilman Schmidt's avatar Tilman Schmidt Committed by Linus Torvalds

[PATCH] isdn4linux: Siemens Gigaset drivers: code cleanup

With Hansjoerg Lipp <hjlipp@web.de>

Source code formatting cleanups for the Siemens Gigaset drivers, such as line
length, comments, removal of unused declarations, and typo corrections.  It
does not introduce any functional changes.
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 08a53cdc
......@@ -11,10 +11,6 @@
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* =====================================================================
* ToDo: ...
* =====================================================================
* Version: $Id: asyncdata.c,v 1.2.2.7 2005/11/13 23:05:18 hjlipp Exp $
* =====================================================================
*/
#include "gigaset.h"
......@@ -58,7 +54,8 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
__func__, cbytes);
cs->cbytes = cbytes;
gigaset_handle_modem_response(cs); /* can change cs->dle */
gigaset_handle_modem_response(cs); /* can change
cs->dle */
cbytes = 0;
if (cs->dle &&
......@@ -100,7 +97,8 @@ static inline int lock_loop(unsigned char *src, int numbytes,
{
struct cardstate *cs = inbuf->cs;
gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", numbytes, src, 0);
gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
numbytes, src, 0);
gigaset_if_receive(cs, src, numbytes);
return numbytes;
......@@ -392,8 +390,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
if (!(inbuf->inputstate & INS_DLE_char)) {
/* FIXME Einfach je nach Modus Funktionszeiger in cs setzen [hier+hdlc_loop]? */
/* FIXME Spart folgendes "if" und ermoeglicht andere Protokolle */
/* FIXME use function pointers? */
if (inbuf->inputstate & INS_command)
procbytes = cmd_loop(c, src, numbytes, inbuf);
else if (inbuf->bcs->proto2 == ISDN_PROTO_L2_HDLC)
......
......@@ -13,10 +13,6 @@
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* =====================================================================
* ToDo: ...
* =====================================================================
* Version: $Id: bas-gigaset.c,v 1.52.4.19 2006/02/04 18:28:16 hjlipp Exp $
* =====================================================================
*/
#include "gigaset.h"
......@@ -70,9 +66,6 @@ static struct usb_device_id gigaset_table [] = {
MODULE_DEVICE_TABLE(usb, gigaset_table);
/* Get a minor range for your devices from the usb maintainer */
#define USB_SKEL_MINOR_BASE 200
/*======================= local function prototypes =============================*/
/* This function is called if a new device is connected to the USB port. It
......@@ -240,7 +233,8 @@ static inline void dump_urb(enum debuglevel level, const char *tag,
(unsigned long) urb->context,
(unsigned long) urb->complete);
for (i = 0; i < urb->number_of_packets; i++) {
struct usb_iso_packet_descriptor *pifd = &urb->iso_frame_desc[i];
struct usb_iso_packet_descriptor *pifd
= &urb->iso_frame_desc[i];
dbg(level,
" {offset=%u, length=%u, actual_length=%u, "
"status=%u}",
......@@ -780,7 +774,8 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs)
urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */
urb->transfer_flags = URB_ISO_ASAP;
urb->number_of_packets = BAS_NUMFRAMES;
dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", __func__);
dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit",
__func__);
rc = usb_submit_urb(urb, SLAB_ATOMIC);
if (unlikely(rc != 0)) {
err("could not resubmit isochronous read URB: %s",
......@@ -1011,7 +1006,8 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
//dbg(DEBUG_ISO, "%s: frame %d length=%d", __func__, nframe, ifd->length);
/* retrieve block of data to send */
ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf, ifd->length);
ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf,
ifd->length);
if (ifd->offset < 0) {
if (ifd->offset == -EBUSY) {
dbg(DEBUG_ISO, "%s: buffer busy at frame %d",
......@@ -1123,7 +1119,8 @@ static void write_iso_tasklet(unsigned long data)
break;
case -EXDEV: /* inspect individual frames */
/* assumptions (for lack of documentation):
* - actual_length bytes of the frame in error are successfully sent
* - actual_length bytes of the frame in error are
* successfully sent
* - all following frames are not sent at all
*/
dbg(DEBUG_ISO, "%s: URB partially completed", __func__);
......@@ -1260,7 +1257,8 @@ static void read_iso_tasklet(unsigned long data)
switch (urb->status) {
case 0: /* normal completion */
break;
case -EXDEV: /* inspect individual frames (we do that anyway) */
case -EXDEV: /* inspect individual frames
(we do that anyway) */
dbg(DEBUG_ISO, "%s: URB partially completed", __func__);
break;
case -ENOENT:
......@@ -1284,8 +1282,8 @@ static void read_iso_tasklet(unsigned long data)
totleft = urb->actual_length;
for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) {
if (unlikely(urb->iso_frame_desc[frame].status)) {
warn("isochronous read: frame %d: %s",
frame, get_usb_statmsg(urb->iso_frame_desc[frame].status));
warn("isochronous read: frame %d: %s", frame,
get_usb_statmsg(urb->iso_frame_desc[frame].status));
break;
}
numbytes = urb->iso_frame_desc[frame].actual_length;
......@@ -1792,7 +1790,8 @@ static int start_cbsend(struct cardstate *cs)
* cs controller state structure
* buf command string to send
* len number of bytes to send (max. IF_WRITEBUF)
* wake_tasklet tasklet to run when transmission is completed (NULL if none)
* wake_tasklet tasklet to run when transmission is completed
* (NULL if none)
* return value:
* number of bytes queued on success
* error code < 0 on error
......@@ -1849,7 +1848,8 @@ static int gigaset_write_cmd(struct cardstate *cs,
/* gigaset_write_room
* tty_driver.write_room interface routine
* return number of characters the driver will accept to be written via gigaset_write_cmd
* return number of characters the driver will accept to be written via
* gigaset_write_cmd
* parameter:
* controller state structure
* return value:
......@@ -2299,7 +2299,8 @@ static int __init bas_gigaset_init(void)
goto error;
/* allocate memory for our device state and intialize it */
cardstate = gigaset_initcs(driver, 2, 0, 0, cidmode, GIGASET_MODULENAME);
cardstate = gigaset_initcs(driver, 2, 0, 0, cidmode,
GIGASET_MODULENAME);
if (!cardstate)
goto error;
......
......@@ -11,10 +11,6 @@
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* =====================================================================
* ToDo: ...
* =====================================================================
* Version: $Id: common.c,v 1.104.4.22 2006/02/04 18:28:16 hjlipp Exp $
* =====================================================================
*/
#include "gigaset.h"
......@@ -101,7 +97,8 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
} else {
numin = len < sizeof inbuf ? len : sizeof inbuf;
in = inbuf;
if (copy_from_user(inbuf, (const unsigned char __user *) buf, numin)) {
if (copy_from_user(inbuf, (const unsigned char __user *) buf,
numin)) {
strncpy(inbuf, "<FAULT>", sizeof inbuf);
numin = sizeof "<FAULT>" - 1;
}
......@@ -425,7 +422,8 @@ void gigaset_freecs(struct cardstate *cs)
spin_lock_irqsave(&cs->lock, flags);
atomic_set(&cs->running, 0);
spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are not rescheduled below */
spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are
not rescheduled below */
tasklet_kill(&cs->event_tasklet);
del_timer_sync(&cs->timer);
......@@ -563,7 +561,6 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
if (cs->ops->initbcshw(bcs))
return bcs;
//error:
dbg(DEBUG_INIT, " failed");
dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel);
......@@ -580,7 +577,8 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
* parameters:
* drv hardware driver the device belongs to
* channels number of B channels supported by device
* onechannel !=0: B channel data and AT commands share one communication channel
* onechannel !=0: B channel data and AT commands share one
* communication channel
* ==0: B channels have separate communication channels
* ignoreframes number of frames to ignore after setting up B channel
* cidmode !=0: start in CallID mode
......@@ -619,7 +617,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
atomic_set(&cs->ev_tail, 0);
atomic_set(&cs->ev_head, 0);
init_MUTEX_LOCKED(&cs->sem);
tasklet_init(&cs->event_tasklet, &gigaset_handle_event, (unsigned long) cs);
tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
(unsigned long) cs);
atomic_set(&cs->commands_pending, 0);
cs->cur_at_seq = 0;
cs->gotfwver = -1;
......@@ -669,14 +668,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
cs->curlen = 0;
cs->cmdbytes = 0;
/*
* Tell the ISDN4Linux subsystem (the LL) that
* a driver for a USB-Device is available !
* If this is done, "isdnctrl" is able to bind a device for this driver even
* if no physical usb-device is currently connected.
* But this device will just be accessable if a physical USB device is connected
* (via "gigaset_probe") .
*/
dbg(DEBUG_INIT, "setting up iif");
if (!gigaset_register_to_LL(cs, modulename)) {
err("register_isdn=>error");
......@@ -713,7 +704,8 @@ error: if (cs)
}
EXPORT_SYMBOL_GPL(gigaset_initcs);
/* ReInitialize the b-channel structure */ /* e.g. called on hangup, disconnect */
/* ReInitialize the b-channel structure */
/* e.g. called on hangup, disconnect */
void gigaset_bcs_reinit(struct bc_state *bcs)
{
struct sk_buff *skb;
......@@ -723,7 +715,7 @@ void gigaset_bcs_reinit(struct bc_state *bcs)
while ((skb = skb_dequeue(&bcs->squeue)) != NULL)
dev_kfree_skb(skb);
spin_lock_irqsave(&cs->lock, flags); //FIXME
spin_lock_irqsave(&cs->lock, flags);
clear_at_state(&bcs->at_state);
bcs->at_state.ConState = 0;
bcs->at_state.timer_active = 0;
......@@ -805,7 +797,6 @@ int gigaset_start(struct cardstate *cs)
{
if (down_interruptible(&cs->sem))
return 0;
//info("USB device for Gigaset 307x now attached to Dev %d", ucs->minor);
atomic_set(&cs->connected, 1);
......@@ -954,7 +945,8 @@ void gigaset_debugdrivers(void)
dbg(DEBUG_DRIVER, " flags 0x%02x", drv->flags[i]);
cs = drv->cs + i;
dbg(DEBUG_DRIVER, " cardstate %p", cs);
dbg(DEBUG_DRIVER, " minor_index %u", cs->minor_index);
dbg(DEBUG_DRIVER, " minor_index %u",
cs->minor_index);
dbg(DEBUG_DRIVER, " driver %p", cs->driver);
dbg(DEBUG_DRIVER, " i4l id %d", cs->myid);
}
......@@ -1016,7 +1008,7 @@ EXPORT_SYMBOL_GPL(gigaset_freedriver);
* parameters:
* minor First minor number
* minors Number of minors this driver can handle
* procname Name of the driver (e.g. for /proc/tty/drivers, path in /proc/driver)
* procname Name of the driver
* devname Name of the device files (prefix without minor number)
* devfsname Devfs name of the device files without %d
* return value:
......
......@@ -11,25 +11,21 @@
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* =====================================================================
* ToDo: ...
* =====================================================================
* Version: $Id: ev-layer.c,v 1.4.2.18 2006/02/04 18:28:16 hjlipp Exp $
* =====================================================================
*/
#include "gigaset.h"
/* ========================================================== */
/* bit masks for pending commands */
#define PC_DIAL 0x001
#define PC_HUP 0x002
#define PC_INIT 0x004
#define PC_DLE0 0x008
#define PC_DLE1 0x010
#define PC_SHUTDOWN 0x020
#define PC_ACCEPT 0x040
#define PC_CID 0x080
#define PC_NOCID 0x100
#define PC_HUP 0x002
#define PC_DIAL 0x001
#define PC_ACCEPT 0x040
#define PC_SHUTDOWN 0x020
#define PC_CIDMODE 0x200
#define PC_UMMODE 0x400
......@@ -393,7 +389,7 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
#if 0
static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen uebernehmen
static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME
{
/* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */
......@@ -401,7 +397,7 @@ static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen ueberne
{RSP_LAST,0,0,0,0,0,0}
};
static struct reply_t tab_cid[] = /* no dle mode */ //FIXME aenderungen uebernehmen
static struct reply_t tab_cid[] = /* no dle mode */ //FIXME
{
/* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */
......@@ -837,7 +833,8 @@ static void schedule_init(struct cardstate *cs, int state)
dbg(DEBUG_CMD, "Scheduling PC_INIT");
}
/* Add "AT" to a command, add the cid, dle encode it, send the result to the hardware. */
/* Add "AT" to a command, add the cid, dle encode it, send the result to the
hardware. */
static void send_command(struct cardstate *cs, const char *cmd, int cid,
int dle, gfp_t kmallocflags)
{
......@@ -966,19 +963,13 @@ static void start_dial(struct at_state_t *at_state, void *data, int seq_index)
at_state->pending_commands |= PC_CID;
dbg(DEBUG_CMD, "Scheduling PC_CID");
//#ifdef GIG_MAYINITONDIAL
// if (atomic_read(&cs->MState) == MS_UNKNOWN) {
// cs->at_state.pending_commands |= PC_INIT;
// dbg(DEBUG_CMD, "Scheduling PC_INIT");
// }
//#endif
atomic_set(&cs->commands_pending, 1); //FIXME
atomic_set(&cs->commands_pending, 1);
return;
error:
at_state->pending_commands |= PC_NOCID;
dbg(DEBUG_CMD, "Scheduling PC_NOCID");
atomic_set(&cs->commands_pending, 1); //FIXME
atomic_set(&cs->commands_pending, 1);
return;
}
......@@ -992,12 +983,12 @@ static void start_accept(struct at_state_t *at_state)
if (retval == 0) {
at_state->pending_commands |= PC_ACCEPT;
dbg(DEBUG_CMD, "Scheduling PC_ACCEPT");
atomic_set(&cs->commands_pending, 1); //FIXME
atomic_set(&cs->commands_pending, 1);
} else {
//FIXME
at_state->pending_commands |= PC_HUP;
dbg(DEBUG_CMD, "Scheduling PC_HUP");
atomic_set(&cs->commands_pending, 1); //FIXME
atomic_set(&cs->commands_pending, 1);
}
}
......@@ -1037,9 +1028,8 @@ static void do_shutdown(struct cardstate *cs)
if (atomic_read(&cs->mstate) == MS_READY) {
atomic_set(&cs->mstate, MS_SHUTDOWN);
cs->at_state.pending_commands |= PC_SHUTDOWN;
atomic_set(&cs->commands_pending, 1); //FIXME
dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN"); //FIXME
//gigaset_schedule_event(cs); //FIXME
atomic_set(&cs->commands_pending, 1);
dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN");
} else
finish_shutdown(cs);
}
......@@ -1160,7 +1150,6 @@ static int do_lock(struct cardstate *cs)
mode = atomic_read(&cs->mode);
atomic_set(&cs->mstate, MS_LOCKED);
atomic_set(&cs->mode, M_UNKNOWN);
//FIXME reset card state / at states / bcs states
return mode;
}
......@@ -1173,7 +1162,6 @@ static int do_unlock(struct cardstate *cs)
atomic_set(&cs->mstate, MS_UNINITIALIZED);
atomic_set(&cs->mode, M_UNKNOWN);
gigaset_free_channels(cs);
//FIXME reset card state / at states / bcs states
if (atomic_read(&cs->connected))
schedule_init(cs, MS_INIT);
......@@ -1203,7 +1191,6 @@ static void do_action(int action, struct cardstate *cs,
at_state->waiting = 1;
break;
case ACT_INIT:
//FIXME setup everything
cs->at_state.pending_commands &= ~PC_INIT;
cs->cur_at_seq = SEQ_NONE;
atomic_set(&cs->mode, M_UNIMODEM);
......@@ -1213,7 +1200,7 @@ static void do_action(int action, struct cardstate *cs,
break;
}
cs->at_state.pending_commands |= PC_CIDMODE;
atomic_set(&cs->commands_pending, 1); //FIXME
atomic_set(&cs->commands_pending, 1);
dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
break;
case ACT_FAILINIT:
......@@ -1428,7 +1415,8 @@ static void do_action(int action, struct cardstate *cs,
at_state->pending_commands |= PC_HUP;
atomic_set(&cs->commands_pending, 1);
break;
case ACT_GETSTRING: /* warning: RING, ZDLE, ... are not handled properly any more */
case ACT_GETSTRING: /* warning: RING, ZDLE, ...
are not handled properly any more */
at_state->getstring = 1;
break;
case ACT_SETVER:
......@@ -1522,7 +1510,7 @@ static void do_action(int action, struct cardstate *cs,
break;
case ACT_HUP:
at_state->pending_commands |= PC_HUP;
atomic_set(&cs->commands_pending, 1); //FIXME
atomic_set(&cs->commands_pending, 1);
dbg(DEBUG_CMD, "Scheduling PC_HUP");
break;
......@@ -1649,7 +1637,8 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
dbg(DEBUG_ANY, "stopped waiting");
}
/* if the response belongs to a variable in at_state->int_var[VAR_XXXX] or at_state->str_var[STR_XXXX], set it */
/* if the response belongs to a variable in at_state->int_var[VAR_XXXX]
or at_state->str_var[STR_XXXX], set it */
if (ev->type >= RSP_VAR && ev->type < RSP_VAR + VAR_NUM) {
index = ev->type - RSP_VAR;
at_state->int_var[index] = ev->parameter;
......@@ -1657,13 +1646,15 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
index = ev->type - RSP_STR;
kfree(at_state->str_var[index]);
at_state->str_var[index] = ev->ptr;
ev->ptr = NULL; /* prevent process_events() from deallocating ptr */
ev->ptr = NULL; /* prevent process_events() from
deallocating ptr */
}
if (ev->type == EV_TIMEOUT || ev->type == RSP_STRING)
at_state->getstring = 0;
/* Search row in dial array which matches modem response and current constate */
/* Search row in dial array which matches modem response and current
constate */
for (;; rep++) {
rcode = rep->resp_code;
/* dbg (DEBUG_ANY, "rcode %d", rcode); */
......@@ -1865,11 +1856,7 @@ static void process_command_flags(struct cardstate *cs)
if (cs->at_state.pending_commands & PC_CIDMODE) {
cs->at_state.pending_commands &= ~PC_CIDMODE;
if (atomic_read(&cs->mode) == M_UNIMODEM) {
#if 0
cs->retry_count = 2;
#else
cs->retry_count = 1;
#endif
schedule_sequence(cs, &cs->at_state, SEQ_CIDMODE);
return;
}
......
/* Siemens Gigaset 307x driver
/*
* Siemens Gigaset 307x driver
* Common header file for all connection variants
*
* Written by Stefan Eilers <Eilers.Stefan@epost.de>
* and Hansjoerg Lipp <hjlipp@web.de>
*
* Version: $Id: gigaset.h,v 1.97.4.26 2006/02/04 18:28:16 hjlipp Exp $
* ===========================================================================
* =====================================================================
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* =====================================================================
*/
#ifndef GIGASET_H
......@@ -15,7 +20,6 @@
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include <asm/atomic.h>
#include <linux/spinlock.h>
#include <linux/isdnif.h>
#include <linux/usb.h>
......@@ -27,6 +31,7 @@
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/list.h>
#include <asm/atomic.h>
#define GIG_VERSION {0,5,0,0}
#define GIG_COMPAT {0,4,0,0}
......@@ -40,8 +45,8 @@
#define RBUFSIZE 8192
#define SBUFSIZE 4096 /* sk_buff payload size */
#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */
#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */
#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */
/* compile time options */
#define GIG_MAJOR 0
......@@ -67,68 +72,108 @@
#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; }
#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) */
/* any combination of these can be given with the 'debug=' parameter to insmod, e.g.
* 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and DEBUG_INTR. */
/* any combination of these can be given with the 'debug=' parameter to insmod,
* e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and
* 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 interrupt
requests, not available as run-time option */
DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on
interrupt requests, not available as
run-time option */
DEBUG_CMD = 0x00020, /* sent/received LL commands */
DEBUG_STREAM = 0x00040, /* application data stream I/O events */
DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */
DEBUG_LLDATA = 0x00100, /* sent/received LL data */
DEBUG_INTR_0 = 0x00200, /* serial port output interrupt processing */
DEBUG_INTR_0 = 0x00200, /* serial port interrupt processing */
DEBUG_DRIVER = 0x00400, /* driver structure */
DEBUG_HDLC = 0x00800, /* M10x HDLC processing */
DEBUG_WRITE = 0x01000, /* M105 data write */
DEBUG_TRANSCMD = 0x02000, /*AT-COMMANDS+RESPONSES*/
DEBUG_MCMD = 0x04000, /*COMMANDS THAT ARE SENT VERY OFTEN*/
DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data structures */
DEBUG_TRANSCMD = 0x02000, /* AT-COMMANDS+RESPONSES */
DEBUG_MCMD = 0x04000, /* COMMANDS THAT ARE SENT VERY OFTEN */
DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data
structures */
DEBUG_LOCK = 0x10000, /* semaphore operations */
DEBUG_OUTPUT = 0x20000, /* output to device */
DEBUG_ISO = 0x40000, /* isochronous transfers */
DEBUG_IF = 0x80000, /* character device operations */
DEBUG_USBREQ = 0x100000, /* USB communication (except payload data) */
DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when MS_LOCKED */
DEBUG_USBREQ = 0x100000, /* USB communication (except payload
data) */
DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when
MS_LOCKED */
DEBUG_ANY = 0x3fffff, /* print message if any of the others is activated */
DEBUG_ANY = 0x3fffff, /* print message if any of the others is
activated */
};
#ifdef CONFIG_GIGASET_DEBUG
#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
//#define DEBUG_DEFAULT (DEBUG_LOCK | DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUF_IF | DEBUG_DRIVER | DEBUG_OUTPUT | DEBUG_INTR)
#else
#define DEBUG_DEFAULT 0
#endif
/* redefine syslog macros to prepend module name instead of entire source path */
/* The space before the comma in ", ##" is needed by gcc 2.95 */
/* redefine syslog macros to prepend module name instead of entire
* source path */
#undef info
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
#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)
#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)
#define warn(format, arg...) \
printk(KERN_WARNING "%s: " format "\n", \
THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
#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 "%s: " format "\n", \
THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
#undef dbg
#ifdef CONFIG_GIGASET_DEBUG
#define 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); } while (0)
#define 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); \
} while (0)