aboutsummaryrefslogtreecommitdiff
path: root/drivers/isdn/gigaset/gigaset.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/gigaset/gigaset.h')
-rw-r--r--drivers/isdn/gigaset/gigaset.h199
1 files changed, 95 insertions, 104 deletions
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index bc5a6294f0c..d77588de7eb 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -106,10 +106,10 @@ 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
+ DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on
interrupt requests, not available as
run-time option */
DEBUG_CMD = 0x00020, /* sent/received LL commands */
@@ -120,66 +120,68 @@ enum debuglevel { /* up to 24 bits (atomic_t) */
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_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_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
+ DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when
MS_LOCKED */
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)
-#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,
- size_t len, const unsigned char *buf, int from_user);
+ size_t len, const unsigned char *buf, int from_user);
/* connection state */
#define ZSAU_NONE 0
@@ -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,36 +600,33 @@ 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 */
spinlock_t isoinlock;
struct urb *isoinurbs[BAS_INURBS];
unsigned char isoinbuf[BAS_INBUFSIZE * BAS_INURBS];
- 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) */
- unsigned seqlen; /* number of '1' bits not yet
- unstuffed */
- unsigned inbyte, inbits; /* collected bits for next byte
- */
+ 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) */
+ unsigned seqlen; /* number of '1' bits not yet
+ unstuffed */
+ unsigned inbyte, inbits; /* collected bits for next byte */
/* statistics */
- unsigned goodbytes; /* bytes correctly received */
- 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 goodbytes; /* bytes correctly received */
+ 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 */
struct tasklet_struct rcvd_tasklet;
};
@@ -644,8 +634,8 @@ struct gigaset_ops {
/* Called from ev-layer.c/interface.c for sending AT commands to the
device */
int (*write_cmd)(struct cardstate *cs,
- const unsigned char *buf, int len,
- struct tasklet_struct *wake_tasklet);
+ const unsigned char *buf, int len,
+ struct tasklet_struct *wake_tasklet);
/* Called from interface.c for additional device control */
int (*write_room)(struct cardstate *cs);
@@ -699,7 +689,7 @@ struct gigaset_ops {
* <DLE_FLAG>: 0x10
* <EVENT>: ((a-z)* | (A-Z)* | (0-10)*)+
*/
-#define DLE_FLAG 0x10
+#define DLE_FLAG 0x10
/* ===========================================================================
* Functions implemented in asyncdata.c
@@ -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;
@@ -797,7 +787,7 @@ void gigaset_free_dev_sysfs(struct usb_interface *interface);
void gigaset_bcs_reinit(struct bc_state *bcs);
void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
- struct cardstate *cs, int cid);
+ struct cardstate *cs, int cid);
int gigaset_get_channel(struct bc_state *bcs);
void gigaset_free_channel(struct bc_state *bcs);
int gigaset_get_channels(struct cardstate *cs);
@@ -806,11 +796,11 @@ void gigaset_block_channels(struct cardstate *cs);
/* Allocate and initialize driver structure. */
struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
- const char *procname,
- const char *devname,
- const char *devfsname,
- const struct gigaset_ops *ops,
- struct module *owner);
+ const char *procname,
+ const char *devname,
+ const char *devfsname,
+ const struct gigaset_ops *ops,
+ struct module *owner);
/* Deallocate driver structure. */
void gigaset_freedriver(struct gigaset_driver *drv);
@@ -850,8 +840,8 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
* ptr must be kmalloc()ed (and not be freed by the caller).
*/
struct event_t *gigaset_add_event(struct cardstate *cs,
- struct at_state_t *at_state, int type,
- void *ptr, int parameter, void *arg);
+ struct at_state_t *at_state, int type,
+ void *ptr, int parameter, void *arg);
/* Called on CONFIG1 command from frontend. */
int gigaset_enterconfigmode(struct cardstate *cs); //0: success <0: errorcode
@@ -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);
}
@@ -897,7 +887,7 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs)
* appropriate locks held only.
*/
static inline unsigned char *gigaset_skb_put_quick(struct sk_buff *skb,
- unsigned int len)
+ unsigned int len)
{
unsigned char *tmp = skb->tail;
/*SKB_LINEAR_ASSERT(skb);*/ /* not needed here */
@@ -910,8 +900,8 @@ static inline unsigned char *gigaset_skb_put_quick(struct sk_buff *skb,
* Warning: skb must not be accessed anymore!
*/
static inline void gigaset_rcv_skb(struct sk_buff *skb,
- struct cardstate *cs,
- struct bc_state *bcs)
+ struct cardstate *cs,
+ struct bc_state *bcs)
{
cs->iif.rcvcallb_skb(cs->myid, bcs->channel, skb);
bcs->trans_down++;
@@ -921,8 +911,8 @@ static inline void gigaset_rcv_skb(struct sk_buff *skb,
* Warning: skb must not be accessed anymore!
*/
static inline void gigaset_rcv_error(struct sk_buff *procskb,
- struct cardstate *cs,
- struct bc_state *bcs)
+ struct cardstate *cs,
+ struct bc_state *bcs)
{
if (procskb)
dev_kfree_skb(procskb);
@@ -942,12 +932,12 @@ extern __u8 gigaset_invtab[]; /* in common.c */
/* append received bytes to inbuf */
static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf,
- const unsigned char *src,
- unsigned numbytes)
+ const unsigned char *src,
+ unsigned numbytes)
{
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;
}
@@ -986,7 +977,7 @@ static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf,
/* initialize interface */
void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
- const char *devname, const char *devfsname);
+ const char *devname, const char *devfsname);
/* release interface */
void gigaset_if_freedriver(struct gigaset_driver *drv);
/* add minor */
@@ -995,6 +986,6 @@ void gigaset_if_init(struct cardstate *cs);
void gigaset_if_free(struct cardstate *cs);
/* device received data */
void gigaset_if_receive(struct cardstate *cs,
- unsigned char *buffer, size_t len);
+ unsigned char *buffer, size_t len);
#endif