Commit 96d1d039 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Make array of drivers private to isdn_common.c

Currently, we need to provide a couple of helper functions to avoid
breaking isdn_tty with this change, as that gets cleaned up, the need
for those helpers should vanish as well.
parent 13c12068
......@@ -564,8 +564,7 @@ isdn_audio_eval_dtmf(modem_info * info)
cli();
di = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += 2;
isdn_drv_queue_tail(di, ch, skb, 2);
restore_flags(flags);
/* Schedule dequeuing */
if ((dev->modempoll) && (info->rcvsched))
......@@ -684,8 +683,7 @@ isdn_audio_put_dle_code(modem_info * info, u_char code)
cli();
di = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += 2;
isdn_drv_queue_tail(di, ch, skb, 2);
restore_flags(flags);
/* Schedule dequeuing */
if ((dev->modempoll) && (info->rcvsched))
......
This diff is collapsed.
......@@ -63,7 +63,6 @@ extern char *isdn_map_eaz2msn(char *msn, int di);
extern void isdn_timer_ctrl(int tf, int onoff);
extern int isdn_getnum(char **);
extern int isdn_msncmp( const char *, const char *);
extern int isdn_add_channels(driver *, int, int, int);
#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
extern void isdn_dumppkt(char *, u_char *, int, int);
#else
......@@ -99,3 +98,9 @@ extern void isdn_slot_set_m_idx(int slot, int midx);
extern void isdn_slot_set_priv(int sl, void *);
extern void *isdn_slot_priv(int sl);
extern int isdn_hard_header_len(void);
int isdn_drv_queue_empty(int di, int ch);
void isdn_drv_queue_tail(int di, int ch, struct sk_buff *skb, int len);
int isdn_drv_maxbufsize(int di);
int isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb);
int isdn_drv_hdrlen(int di);
......@@ -264,7 +264,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb)
/* Try to deliver directly via tty-flip-buf if queue is empty */
save_flags(flags);
cli();
if (skb_queue_empty(&dev->drv[di]->rpqueue[channel]))
if (isdn_drv_queue_empty(di, channel))
if (isdn_tty_try_read(info, skb)) {
restore_flags(flags);
return 1;
......@@ -272,9 +272,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb)
/* Direct deliver failed or queue wasn't empty.
* Queue up for later dequeueing via timer-irq.
*/
__skb_queue_tail(&dev->drv[di]->rpqueue[channel], skb);
dev->drv[di]->rcvcount[channel] +=
(skb->len
isdn_drv_queue_tail(di, channel, skb, skb->len
#ifdef CONFIG_ISDN_AUDIO
+ ISDN_AUDIO_SKB_DLECOUNT(skb)
#endif
......@@ -1109,8 +1107,8 @@ isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int co
if (c > info->xmit_size - info->xmit_count)
c = info->xmit_size - info->xmit_count;
di = isdn_slot_driver(info->isdn_slot);
if (di >= 0 && c > dev->drv[di]->maxbufsize)
c = dev->drv[di]->maxbufsize;
if (di >= 0 && c > isdn_drv_maxbufsize(di))
c = isdn_drv_maxbufsize(di);
if (c <= 0)
break;
if ((info->online > 1)
......@@ -2211,7 +2209,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
}
restore_flags(flags);
printk(KERN_INFO "isdn_tty: call from %s -> %s %s\n", nr, eaz,
((dev->drv[di]->flags & DRV_FLAG_REJBUS) && (wret != 2))? "rejected" : "ignored");
(wret != 2)? "rejected" : "ignored");
return (wret == 2)?3:0;
}
......@@ -2441,7 +2439,7 @@ isdn_tty_at_cout(char *msg, modem_info * info)
/* data is in queue or flip buffer is full */
di = isdn_slot_driver(info->isdn_slot); ch = isdn_slot_channel(info->isdn_slot);
if ((info->online) && (((tty->flip.count + strlen(msg)) >= TTY_FLIPBUF_SIZE) ||
(!skb_queue_empty(&dev->drv[di]->rpqueue[ch])))) {
(!isdn_drv_queue_empty(di, ch)))) {
skb = alloc_skb(strlen(msg)
#ifdef CONFIG_ISDN_AUDIO
+ sizeof(isdn_audio_skb)
......@@ -2484,8 +2482,7 @@ isdn_tty_at_cout(char *msg, modem_info * info)
}
}
if (skb) {
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += skb->len;
isdn_drv_queue_tail(di, ch, skb, skb->len);
restore_flags(flags);
/* Schedule dequeuing */
if ((dev->modempoll) && (info->rcvsched))
......
......@@ -13,6 +13,7 @@
#include <linux/isdn.h>
#include "isdn_v110.h"
#include "isdn_common.h"
#undef ISDN_V110_DEBUG
......@@ -542,7 +543,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
else
skb = isdn_v110_idle(v);
if (skb) {
if (dev->drv[c->driver]->interface->writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
if (isdn_drv_writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
dev_kfree_skb(skb);
break;
} else {
......@@ -569,8 +570,8 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
break;
case ISDN_STAT_BCONN:
if (iv110->v110emu && (iv110->v110 == NULL)) {
int hdrlen = dev->drv[c->driver]->interface->hl_hdrlen;
int maxsize = dev->drv[c->driver]->interface->maxbufsize;
int hdrlen = isdn_drv_hdrlen(c->driver);
int maxsize = isdn_drv_maxbufsize(c->driver);
atomic_inc(&iv110->v110use);
switch (iv110->v110emu) {
case ISDN_PROTO_L2_V11096:
......@@ -587,7 +588,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
if ((v = iv110->v110)) {
while (v->SyncInit) {
struct sk_buff *skb = isdn_v110_sync(v);
if (dev->drv[c->driver]->interface->writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
if (isdn_drv_writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
dev_kfree_skb(skb);
/* Unable to send, try later */
break;
......
......@@ -413,30 +413,6 @@ typedef struct {
char *private;
} infostruct;
#define DRV_FLAG_RUNNING 1
#define DRV_FLAG_REJBUS 2
#define DRV_FLAG_LOADED 4
/* Description of hardware-level-driver */
typedef struct {
ulong online; /* Channel-Online flags */
ulong flags; /* Misc driver Flags */
int locks; /* Number of locks for this driver */
int channels; /* Number of channels */
wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */
int maxbufsize; /* Maximum Buffersize supported */
unsigned long pktcount; /* Until now: unused */
int stavail; /* Chars avail on Status-device */
isdn_if *interface; /* Interface to driver */
int *rcverr; /* Error-counters for B-Ch.-receive */
int *rcvcount; /* Byte-counters for B-Ch.-receive */
#ifdef CONFIG_ISDN_AUDIO
unsigned long DLEflag; /* Flags: Insert DLE at next read */
#endif
struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
} driver;
/* Main driver-data */
typedef struct isdn_devt {
unsigned short flags; /* Bitmapped Flags: */
......@@ -451,7 +427,6 @@ typedef struct isdn_devt {
infostruct *infochain; /* List of open info-devs. */
wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
struct timer_list timer; /* Misc.-function Timer */
driver *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
struct task_struct *profd; /* For iprofd */
modem mdm; /* tty-driver-data */
......
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