aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/i4l')
-rw-r--r--drivers/isdn/i4l/isdn_audio.c126
-rw-r--r--drivers/isdn/i4l/isdn_bsdcomp.c375
-rw-r--r--drivers/isdn/i4l/isdn_common.c1502
-rw-r--r--drivers/isdn/i4l/isdn_common.h18
-rw-r--r--drivers/isdn/i4l/isdn_concap.c36
-rw-r--r--drivers/isdn/i4l/isdn_concap.h4
-rw-r--r--drivers/isdn/i4l/isdn_net.c1500
-rw-r--r--drivers/isdn/i4l/isdn_net.h11
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c1446
-rw-r--r--drivers/isdn/i4l/isdn_ppp.h2
-rw-r--r--drivers/isdn/i4l/isdn_tty.c2447
-rw-r--r--drivers/isdn/i4l/isdn_tty.h10
-rw-r--r--drivers/isdn/i4l/isdn_ttyfax.c1092
-rw-r--r--drivers/isdn/i4l/isdn_ttyfax.h1
-rw-r--r--drivers/isdn/i4l/isdn_v110.c294
-rw-r--r--drivers/isdn/i4l/isdn_v110.h8
-rw-r--r--drivers/isdn/i4l/isdn_x25iface.c226
-rw-r--r--drivers/isdn/i4l/isdn_x25iface.h16
-rw-r--r--drivers/isdn/i4l/isdnhdlc.c54
19 files changed, 4575 insertions, 4593 deletions
diff --git a/drivers/isdn/i4l/isdn_audio.c b/drivers/isdn/i4l/isdn_audio.c
index d5013935ac62..78ce42214713 100644
--- a/drivers/isdn/i4l/isdn_audio.c
+++ b/drivers/isdn/i4l/isdn_audio.c
@@ -204,9 +204,9 @@ isdn_audio_tlookup(const u_char *table, u_char *buff, unsigned long n)
"xlatb\n\t"
"stosb\n\t"
"loop 1b\n\t"
- : "=&b"(d0), "=&c"(d1), "=&D"(d2), "=&S"(d3)
- : "0"((long) table), "1"(n), "2"((long) buff), "3"((long) buff)
- : "memory", "ax");
+ : "=&b"(d0), "=&c"(d1), "=&D"(d2), "=&S"(d3)
+ : "0"((long) table), "1"(n), "2"((long) buff), "3"((long) buff)
+ : "memory", "ax");
#else
while (n--)
*buff = table[*(unsigned char *)buff], buff++;
@@ -242,27 +242,27 @@ static unsigned char
isdn_audio_linear2ulaw(int sample)
{
static int exp_lut[256] =
- {
- 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
- };
+ {
+ 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
+ };
int sign,
- exponent,
- mantissa;
+ exponent,
+ mantissa;
unsigned char ulawbyte;
/* Get the sample into sign-magnitude. */
@@ -299,7 +299,7 @@ static int bitmask[9] =
};
static int
-isdn_audio_get_bits(adpcm_state * s, unsigned char **in, int *len)
+isdn_audio_get_bits(adpcm_state *s, unsigned char **in, int *len)
{
while (s->nleft < s->nbits) {
int d = *((*in)++);
@@ -312,7 +312,7 @@ isdn_audio_get_bits(adpcm_state * s, unsigned char **in, int *len)
}
static void
-isdn_audio_put_bits(int data, int nbits, adpcm_state * s,
+isdn_audio_put_bits(int data, int nbits, adpcm_state *s,
unsigned char **out, int *len)
{
s->word = (s->word << nbits) | (data & bitmask[nbits]);
@@ -326,7 +326,7 @@ isdn_audio_put_bits(int data, int nbits, adpcm_state * s,
}
adpcm_state *
-isdn_audio_adpcm_init(adpcm_state * s, int nbits)
+isdn_audio_adpcm_init(adpcm_state *s, int nbits)
{
if (!s)
s = kmalloc(sizeof(adpcm_state), GFP_ATOMIC);
@@ -341,7 +341,7 @@ isdn_audio_adpcm_init(adpcm_state * s, int nbits)
}
dtmf_state *
-isdn_audio_dtmf_init(dtmf_state * s)
+isdn_audio_dtmf_init(dtmf_state *s)
{
if (!s)
s = kmalloc(sizeof(dtmf_state), GFP_ATOMIC);
@@ -358,7 +358,7 @@ isdn_audio_dtmf_init(dtmf_state * s)
*/
int
-isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in,
+isdn_audio_adpcm2xlaw(adpcm_state *s, int fmt, unsigned char *in,
unsigned char *out, int len)
{
int a = s->a;
@@ -379,7 +379,7 @@ isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in,
a++;
if (fmt)
*out++ = isdn_audio_ulaw_to_alaw[
- isdn_audio_linear2ulaw(a << 2)];
+ isdn_audio_linear2ulaw(a << 2)];
else
*out++ = isdn_audio_linear2ulaw(a << 2);
olen++;
@@ -393,7 +393,7 @@ isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in,
}
int
-isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in,
+isdn_audio_xlaw2adpcm(adpcm_state *s, int fmt, unsigned char *in,
unsigned char *out, int len)
{
int a = s->a;
@@ -403,9 +403,9 @@ isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in,
while (len--) {
int e = 0,
- nmax = 1 << (nbits - 1);
+ nmax = 1 << (nbits - 1);
int sign,
- delta;
+ delta;
if (fmt)
delta = (isdn_audio_alaw_to_s16[*in++] >> 2) - a;
@@ -439,26 +439,26 @@ isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in,
/*
* Goertzel algorithm.
- * See http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/
+ * See http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/
* for more info.
* Result is stored into an sk_buff and queued up for later
* evaluation.
*/
static void
-isdn_audio_goertzel(int *sample, modem_info * info)
+isdn_audio_goertzel(int *sample, modem_info *info)
{
int sk,
- sk1,
- sk2;
+ sk1,
+ sk2;
int k,
- n;
+ n;
struct sk_buff *skb;
int *result;
skb = dev_alloc_skb(sizeof(int) * NCOEFF);
if (!skb) {
printk(KERN_WARNING
- "isdn_audio: Could not alloc DTMF result for ttyI%d\n",
+ "isdn_audio: Could not alloc DTMF result for ttyI%d\n",
info->line);
return;
}
@@ -483,16 +483,16 @@ isdn_audio_goertzel(int *sample, modem_info * info)
printk(KERN_DEBUG
"isdn_audio: dtmf goertzel overflow, sk2=%d\n", sk2);
result[k] =
- ((sk * sk) >> AMP_BITS) -
- ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) +
- ((sk2 * sk2) >> AMP_BITS);
+ ((sk * sk) >> AMP_BITS) -
+ ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) +
+ ((sk2 * sk2) >> AMP_BITS);
}
skb_queue_tail(&info->dtmf_queue, skb);
isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1);
}
void
-isdn_audio_eval_dtmf(modem_info * info)
+isdn_audio_eval_dtmf(modem_info *info)
{
struct sk_buff *skb;
int *result;
@@ -590,7 +590,7 @@ isdn_audio_eval_dtmf(modem_info * info)
* fmt = audio data format (0 = ulaw, 1 = alaw)
*/
void
-isdn_audio_calc_dtmf(modem_info * info, unsigned char *buf, int len, int fmt)
+isdn_audio_calc_dtmf(modem_info *info, unsigned char *buf, int len, int fmt)
{
dtmf_state *s = info->dtmf_state;
int i;
@@ -605,10 +605,10 @@ isdn_audio_calc_dtmf(modem_info * info, unsigned char *buf, int len, int fmt)
for (i = 0; i < c; i++) {
if (fmt)
s->buf[s->idx++] =
- isdn_audio_alaw_to_s16[*buf++] >> (15 - AMP_BITS);
+ isdn_audio_alaw_to_s16[*buf++] >> (15 - AMP_BITS);
else
s->buf[s->idx++] =
- isdn_audio_ulaw_to_s16[*buf++] >> (15 - AMP_BITS);
+ isdn_audio_ulaw_to_s16[*buf++] >> (15 - AMP_BITS);
}
if (s->idx == DTMF_NPOINTS) {
isdn_audio_goertzel(s->buf, info);
@@ -619,7 +619,7 @@ isdn_audio_calc_dtmf(modem_info * info, unsigned char *buf, int len, int fmt)
}
silence_state *
-isdn_audio_silence_init(silence_state * s)
+isdn_audio_silence_init(silence_state *s)
{
if (!s)
s = kmalloc(sizeof(silence_state), GFP_ATOMIC);
@@ -631,7 +631,7 @@ isdn_audio_silence_init(silence_state * s)
}
void
-isdn_audio_calc_silence(modem_info * info, unsigned char *buf, int len, int fmt)
+isdn_audio_calc_silence(modem_info *info, unsigned char *buf, int len, int fmt)
{
silence_state *s = info->silence_state;
int i;
@@ -641,24 +641,24 @@ isdn_audio_calc_silence(modem_info * info, unsigned char *buf, int len, int fmt)
for (i = 0; i < len; i++) {
if (fmt)
- c = isdn_audio_alaw_to_ulaw[*buf++];
- else
- c = *buf++;
+ c = isdn_audio_alaw_to_ulaw[*buf++];
+ else
+ c = *buf++;
if (c > 0) c -= 128;
c = abs(c);
- if (c > (info->emu.vpar[1] * 4)) {
+ if (c > (info->emu.vpar[1] * 4)) {
s->idx = 0;
- s->state = 1;
+ s->state = 1;
} else {
- if (s->idx < 210000) s->idx++;
+ if (s->idx < 210000) s->idx++;
}
}
}
void
-isdn_audio_put_dle_code(modem_info * info, u_char code)
+isdn_audio_put_dle_code(modem_info *info, u_char code)
{
struct sk_buff *skb;
int di;
@@ -668,7 +668,7 @@ isdn_audio_put_dle_code(modem_info * info, u_char code)
skb = dev_alloc_skb(2);
if (!skb) {
printk(KERN_WARNING
- "isdn_audio: Could not alloc skb for ttyI%d\n",
+ "isdn_audio: Could not alloc skb for ttyI%d\n",
info->line);
return;
}
@@ -688,24 +688,24 @@ isdn_audio_put_dle_code(modem_info * info, u_char code)
}
void
-isdn_audio_eval_silence(modem_info * info)
+isdn_audio_eval_silence(modem_info *info)
{
silence_state *s = info->silence_state;
char what;
what = ' ';
- if (s->idx > (info->emu.vpar[2] * 800)) {
+ if (s->idx > (info->emu.vpar[2] * 800)) {
s->idx = 0;
- if (!s->state) { /* silence from beginning of rec */
+ if (!s->state) { /* silence from beginning of rec */
what = 's';
} else {
what = 'q';
}
}
- if ((what == 's') || (what == 'q')) {
- printk(KERN_DEBUG "ttyI%d: %s\n", info->line,
- (what=='s') ? "silence":"quiet");
- isdn_audio_put_dle_code(info, what);
- }
+ if ((what == 's') || (what == 'q')) {
+ printk(KERN_DEBUG "ttyI%d: %s\n", info->line,
+ (what == 's') ? "silence" : "quiet");
+ isdn_audio_put_dle_code(info, what);
+ }
}
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c
index aa0b6a6f5ef4..c59e8d2c0675 100644
--- a/drivers/isdn/i4l/isdn_bsdcomp.c
+++ b/drivers/isdn/i4l/isdn_bsdcomp.c
@@ -7,7 +7,7 @@
*/
/*
- * Update: The Berkeley copyright was changed, and the change
+ * Update: The Berkeley copyright was changed, and the change
* is retroactive to all "true" BSD software (ie everything
* from UCB as opposed to other peoples code that just carried
* the same license). The new copyright doesn't clash with the
@@ -69,7 +69,6 @@
#include <linux/signal.h> /* used in new tty drivers */
#include <linux/bitops.h>
-#include <asm/system.h>
#include <asm/byteorder.h>
#include <asm/types.h>
@@ -121,7 +120,7 @@ struct bsd_db {
unsigned char maxbits; /* maximum bits/code */
unsigned char debug; /* non-zero if debug desired */
unsigned char unit; /* ppp unit number */
- u16 seqno; /* sequence # of next packet */
+ u16 seqno; /* sequence # of next packet */
unsigned int mru; /* size of receive (decompress) bufr */
unsigned int maxmaxcode; /* largest valid code */
unsigned int max_ent; /* largest code in use */
@@ -157,16 +156,16 @@ struct bsd_db {
#define MAXCODE(b) ((1 << (b)) - 1)
#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
-#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \
- ^ (unsigned long)(prefix))
-#define BSD_KEY(prefix,suffix) ((((unsigned long)(suffix)) << 16) \
+#define BSD_HASH(prefix, suffix, hshift) ((((unsigned long)(suffix)) << (hshift)) \
+ ^ (unsigned long)(prefix))
+#define BSD_KEY(prefix, suffix) ((((unsigned long)(suffix)) << 16) \
+ (unsigned long)(prefix))
#define CHECK_GAP 10000 /* Ratio check interval */
#define RATIO_SCALE_LOG 8
-#define RATIO_SCALE (1<<RATIO_SCALE_LOG)
-#define RATIO_MAX (0x7fffffff>>RATIO_SCALE_LOG)
+#define RATIO_SCALE (1 << RATIO_SCALE_LOG)
+#define RATIO_MAX (0x7fffffff >> RATIO_SCALE_LOG)
/*
* clear the dictionary
@@ -175,7 +174,7 @@ struct bsd_db {
static void bsd_clear(struct bsd_db *db)
{
db->clear_count++;
- db->max_ent = FIRST-1;
+ db->max_ent = FIRST - 1;
db->n_bits = BSD_INIT_BITS;
db->bytes_out = 0;
db->in_count = 0;
@@ -197,56 +196,56 @@ static void bsd_clear(struct bsd_db *db)
* the absence of CLEAR codes (while packets are incompressible), they
* must compute the same ratio.
*/
-static int bsd_check (struct bsd_db *db) /* 1=output CLEAR */
+static int bsd_check(struct bsd_db *db) /* 1=output CLEAR */
{
- unsigned int new_ratio;
-
- if (db->in_count >= db->checkpoint)
- {
- /* age the ratio by limiting the size of the counts */
- if (db->in_count >= RATIO_MAX || db->bytes_out >= RATIO_MAX)
- {
- db->in_count -= (db->in_count >> 2);
- db->bytes_out -= (db->bytes_out >> 2);
- }
-
- db->checkpoint = db->in_count + CHECK_GAP;
-
- if (db->max_ent >= db->maxmaxcode)
- {
- /* Reset the dictionary only if the ratio is worse,
- * or if it looks as if it has been poisoned
- * by incompressible data.
- *
- * This does not overflow, because
- * db->in_count <= RATIO_MAX.
- */
-
- new_ratio = db->in_count << RATIO_SCALE_LOG;
- if (db->bytes_out != 0)
- {
- new_ratio /= db->bytes_out;
- }
-
- if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE)
- {
- bsd_clear (db);
- return 1;
- }
- db->ratio = new_ratio;
- }
- }
- return 0;
+ unsigned int new_ratio;
+
+ if (db->in_count >= db->checkpoint)
+ {
+ /* age the ratio by limiting the size of the counts */
+ if (db->in_count >= RATIO_MAX || db->bytes_out >= RATIO_MAX)
+ {
+ db->in_count -= (db->in_count >> 2);
+ db->bytes_out -= (db->bytes_out >> 2);
+ }
+
+ db->checkpoint = db->in_count + CHECK_GAP;
+
+ if (db->max_ent >= db->maxmaxcode)
+ {
+ /* Reset the dictionary only if the ratio is worse,
+ * or if it looks as if it has been poisoned
+ * by incompressible data.
+ *
+ * This does not overflow, because
+ * db->in_count <= RATIO_MAX.
+ */
+
+ new_ratio = db->in_count << RATIO_SCALE_LOG;
+ if (db->bytes_out != 0)
+ {
+ new_ratio /= db->bytes_out;
+ }
+
+ if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE)
+ {
+ bsd_clear(db);
+ return 1;
+ }
+ db->ratio = new_ratio;
+ }
+ }
+ return 0;
}
/*
* Return statistics.
*/
-static void bsd_stats (void *state, struct compstat *stats)
+static void bsd_stats(void *state, struct compstat *stats)
{
struct bsd_db *db = (struct bsd_db *) state;
-
+
stats->unc_bytes = db->uncomp_bytes;
stats->unc_packets = db->uncomp_count;
stats->comp_bytes = db->comp_bytes;
@@ -260,9 +259,9 @@ static void bsd_stats (void *state, struct compstat *stats)
/*
* Reset state, as on a CCP ResetReq.
*/
-static void bsd_reset (void *state,unsigned char code, unsigned char id,
- unsigned char *data, unsigned len,
- struct isdn_ppp_resetparams *rsparm)
+static void bsd_reset(void *state, unsigned char code, unsigned char id,
+ unsigned char *data, unsigned len,
+ struct isdn_ppp_resetparams *rsparm)
{
struct bsd_db *db = (struct bsd_db *) state;
@@ -274,7 +273,7 @@ static void bsd_reset (void *state,unsigned char code, unsigned char id,
/*
* Release the compression structure
*/
-static void bsd_free (void *state)
+static void bsd_free(void *state)
{
struct bsd_db *db = (struct bsd_db *) state;
@@ -302,7 +301,7 @@ static void bsd_free (void *state)
/*
* Allocate space for a (de) compressor.
*/
-static void *bsd_alloc (struct isdn_ppp_comp_data *data)
+static void *bsd_alloc(struct isdn_ppp_comp_data *data)
{
int bits;
unsigned int hsize, hshift, maxmaxcode;
@@ -310,27 +309,27 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data)
int decomp;
static unsigned int htab[][2] = {
- { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } ,
- { 9001 , 5 } , { 18013 , 6 } , { 35023 , 7 } , { 69001 , 8 }
+ { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } ,
+ { 9001 , 5 } , { 18013 , 6 } , { 35023 , 7 } , { 69001 , 8 }
};
-
+
if (data->optlen != 1 || data->num != CI_BSD_COMPRESS
- || BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
+ || BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
return NULL;
bits = BSD_NBITS(data->options[0]);
- if(bits < 9 || bits > 15)
+ if (bits < 9 || bits > 15)
return NULL;
- hsize = htab[bits-9][0];
- hshift = htab[bits-9][1];
-
+ hsize = htab[bits - 9][0];
+ hshift = htab[bits - 9][1];
+
/*
* Allocate the main control structure for this instance.
*/
maxmaxcode = MAXCODE(bits);
- db = kzalloc (sizeof (struct bsd_db),GFP_KERNEL);
+ db = kzalloc(sizeof(struct bsd_db), GFP_KERNEL);
if (!db)
return NULL;
@@ -343,7 +342,7 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data)
*/
db->dict = vmalloc(hsize * sizeof(struct bsd_dict));
if (!db->dict) {
- bsd_free (db);
+ bsd_free(db);
return NULL;
}
@@ -356,7 +355,7 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data)
else {
db->lens = vmalloc((maxmaxcode + 1) * sizeof(db->lens[0]));
if (!db->lens) {
- bsd_free (db);
+ bsd_free(db);
return (NULL);
}
}
@@ -364,41 +363,41 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data)
/*
* Initialize the data information for the compression code
*/
- db->totlen = sizeof (struct bsd_db) + (sizeof (struct bsd_dict) * hsize);
- db->hsize = hsize;
- db->hshift = hshift;
+ db->totlen = sizeof(struct bsd_db) + (sizeof(struct bsd_dict) * hsize);
+ db->hsize = hsize;
+ db->hshift = hshift;
db->maxmaxcode = maxmaxcode;
- db->maxbits = bits;
+ db->maxbits = bits;
- return (void *) db;
+ return (void *)db;
}
/*
* Initialize the database.
*/
-static int bsd_init (void *state, struct isdn_ppp_comp_data *data, int unit, int debug)
+static int bsd_init(void *state, struct isdn_ppp_comp_data *data, int unit, int debug)
{
struct bsd_db *db = state;
int indx;
int decomp;
- if(!state || !data) {
- printk(KERN_ERR "isdn_bsd_init: [%d] ERR, state %lx data %lx\n",unit,(long)state,(long)data);
+ if (!state || !data) {
+ printk(KERN_ERR "isdn_bsd_init: [%d] ERR, state %lx data %lx\n", unit, (long)state, (long)data);
return 0;
}
decomp = db->xmit ? 0 : 1;
-
+
if (data->optlen != 1 || data->num != CI_BSD_COMPRESS
- || (BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
- || (BSD_NBITS(data->options[0]) != db->maxbits)
- || (decomp && db->lens == NULL)) {
- printk(KERN_ERR "isdn_bsd: %d %d %d %d %lx\n",data->optlen,data->num,data->options[0],decomp,(unsigned long)db->lens);
+ || (BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
+ || (BSD_NBITS(data->options[0]) != db->maxbits)
+ || (decomp && db->lens == NULL)) {
+ printk(KERN_ERR "isdn_bsd: %d %d %d %d %lx\n", data->optlen, data->num, data->options[0], decomp, (unsigned long)db->lens);
return 0;
}
if (decomp)
- for(indx=LAST;indx>=0;indx--)
+ for (indx = LAST; indx >= 0; indx--)
db->lens[indx] = 1;
indx = db->hsize;
@@ -411,9 +410,9 @@ static int bsd_init (void *state, struct isdn_ppp_comp_data *data, int unit, int
db->mru = 0;
db->debug = 1;
-
- bsd_reset(db,0,0,NULL,0,NULL);
-
+
+ bsd_reset(db, 0, 0, NULL, 0, NULL);
+
return 1;
}
@@ -421,37 +420,37 @@ static int bsd_init (void *state, struct isdn_ppp_comp_data *data, int unit, int
* Obtain pointers to the various structures in the compression tables
*/
-#define dict_ptrx(p,idx) &(p->dict[idx])
-#define lens_ptrx(p,idx) &(p->lens[idx])
+#define dict_ptrx(p, idx) &(p->dict[idx])
+#define lens_ptrx(p, idx) &(p->lens[idx])
#ifdef DEBUG
static unsigned short *lens_ptr(struct bsd_db *db, int idx)
{
if ((unsigned int) idx > (unsigned int) db->maxmaxcode) {
- printk (KERN_DEBUG "<9>ppp: lens_ptr(%d) > max\n", idx);
+ printk(KERN_DEBUG "<9>ppp: lens_ptr(%d) > max\n", idx);
idx = 0;
}
- return lens_ptrx (db, idx);
+ return lens_ptrx(db, idx);
}
static struct bsd_dict *dict_ptr(struct bsd_db *db, int idx)
{
if ((unsigned int) idx >= (unsigned int) db->hsize) {
- printk (KERN_DEBUG "<9>ppp: dict_ptr(%d) > max\n", idx);
+ printk(KERN_DEBUG "<9>ppp: dict_ptr(%d) > max\n", idx);
idx = 0;
}
- return dict_ptrx (db, idx);
+ return dict_ptrx(db, idx);
}
#else
-#define lens_ptr(db,idx) lens_ptrx(db,idx)
-#define dict_ptr(db,idx) dict_ptrx(db,idx)
+#define lens_ptr(db, idx) lens_ptrx(db, idx)
+#define dict_ptr(db, idx) dict_ptrx(db, idx)
#endif
/*
* compress a packet
*/
-static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *skb_out,int proto)
+static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, int proto)
{
struct bsd_db *db;
int hshift;
@@ -463,31 +462,31 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk
unsigned long fcode;
struct bsd_dict *dictp;
unsigned char c;
- int hval,disp,ilen,mxcode;
+ int hval, disp, ilen, mxcode;
unsigned char *rptr = skb_in->data;
int isize = skb_in->len;
-#define OUTPUT(ent) \
- { \
- bitno -= n_bits; \
- accm |= ((ent) << bitno); \
- do { \
- if(skb_out && skb_tailroom(skb_out) > 0) \
- *(skb_put(skb_out,1)) = (unsigned char) (accm>>24); \
- accm <<= 8; \
- bitno += 8; \
- } while (bitno <= 24); \
- }
+#define OUTPUT(ent) \
+ { \
+ bitno -= n_bits; \
+ accm |= ((ent) << bitno); \
+ do { \
+ if (skb_out && skb_tailroom(skb_out) > 0) \
+ *(skb_put(skb_out, 1)) = (unsigned char)(accm >> 24); \
+ accm <<= 8; \
+ bitno += 8; \
+ } while (bitno <= 24); \
+ }
/*
* If the protocol is not in the range we're interested in,
* just return without compressing the packet. If it is,
* the protocol becomes the first byte to compress.
*/
- printk(KERN_DEBUG "bsd_compress called with %x\n",proto);
-
+ printk(KERN_DEBUG "bsd_compress called with %x\n", proto);
+
ent = proto;
- if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) )
+ if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1))
return 0;
db = (struct bsd_db *) state;
@@ -496,25 +495,25 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk
n_bits = db->n_bits;
bitno = 32;
accm = 0;
- mxcode = MAXCODE (n_bits);
-
+ mxcode = MAXCODE(n_bits);
+
/* This is the PPP header information */
- if(skb_out && skb_tailroom(skb_out) >= 2) {
- char *v = skb_put(skb_out,2);
+ if (skb_out && skb_tailroom(skb_out) >= 2) {
+ char *v = skb_put(skb_out, 2);
/* we only push our own data on the header,
- AC,PC and protos is pushed by caller */
+ AC,PC and protos is pushed by caller */
v[0] = db->seqno >> 8;
v[1] = db->seqno;
}
- ilen = ++isize; /* This is off by one, but that is what is in draft! */
+ ilen = ++isize; /* This is off by one, but that is what is in draft! */
while (--ilen > 0) {
- c = *rptr++;
- fcode = BSD_KEY (ent, c);
- hval = BSD_HASH (ent, c, hshift);
- dictp = dict_ptr (db, hval);
-
+ c = *rptr++;
+ fcode = BSD_KEY(ent, c);
+ hval = BSD_HASH(ent, c, hshift);
+ dictp = dict_ptr(db, hval);
+
/* Validate and then check the entry. */
if (dictp->codem1 >= max_ent)
goto nomatch;
@@ -523,7 +522,7 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk
ent = dictp->codem1 + 1;
continue; /* found (prefix,suffix) */
}
-
+
/* continue probing until a match or invalid entry */
disp = (hval == 0) ? 1 : hval;
@@ -531,17 +530,17 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk
hval += disp;
if (hval >= db->hsize)
hval -= db->hsize;
- dictp = dict_ptr (db, hval);
+ dictp = dict_ptr(db, hval);
if (dictp->codem1 >= max_ent)
goto nomatch;
} while (dictp->fcode != fcode);
ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */
continue;
-
-nomatch:
+
+ nomatch:
OUTPUT(ent); /* output the prefix */
-
+
/* code -> hashtable */
if (max_ent < db->maxmaxcode) {
struct bsd_dict *dictp2;
@@ -551,16 +550,16 @@ nomatch:
/* expand code size if needed */
if (max_ent >= mxcode) {
db->n_bits = ++n_bits;
- mxcode = MAXCODE (n_bits);
+ mxcode = MAXCODE(n_bits);
}
-
- /*
+
+ /*
* Invalidate old hash table entry using
* this code, and then take it over.
*/
- dictp2 = dict_ptr (db, max_ent + 1);
+ dictp2 = dict_ptr(db, max_ent + 1);
indx = dictp2->cptr;
- dictp3 = dict_ptr (db, indx);
+ dictp3 = dict_ptr(db, indx);
if (dictp3->codem1 == max_ent)
dictp3->codem1 = BADCODEM1;
@@ -571,17 +570,17 @@ nomatch:
db->max_ent = ++max_ent;
if (db->lens) {
- unsigned short *len1 = lens_ptr (db, max_ent);
- unsigned short *len2 = lens_ptr (db, ent);
+ unsigned short *len1 = lens_ptr(db, max_ent);
+ unsigned short *len2 = lens_ptr(db, ent);
*len1 = *len2 + 1;
}
}
ent = c;
}
-
+
OUTPUT(ent); /* output the last code */
- if(skb_out)
+ if (skb_out)
db->bytes_out += skb_out->len; /* Do not count bytes from here */
db->uncomp_bytes += isize;
db->in_count += isize;
@@ -596,15 +595,15 @@ nomatch:
*/
if (bsd_check(db))
- OUTPUT (CLEAR);
+ OUTPUT(CLEAR);
/*
* Pad dribble bits of last code with ones.
* Do not emit a completely useless byte of ones.
*/
- if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0)
- *(skb_put(skb_out,1)) = (unsigned char) ((accm | (0xff << (bitno-8))) >> 24);
-
+ if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0)
+ *(skb_put(skb_out, 1)) = (unsigned char)((accm | (0xff << (bitno - 8))) >> 24);
+
/*
* Increase code size if we would have without the packet
* boundary because the decompressor will do so.
@@ -613,7 +612,7 @@ nomatch:
db->n_bits++;
/* If output length is too large then this is an incompressible frame. */
- if (!skb_out || (skb_out && skb_out->len >= skb_in->len) ) {
+ if (!skb_out || (skb_out && skb_out->len >= skb_in->len)) {
++db->incomp_count;
db->incomp_bytes += isize;
return 0;
@@ -631,16 +630,16 @@ nomatch:
* Update the "BSD Compress" dictionary on the receiver for
* incompressible data by pretending to compress the incoming data.
*/
-static void bsd_incomp (void *state, struct sk_buff *skb_in,int proto)
+static void bsd_incomp(void *state, struct sk_buff *skb_in, int proto)
{
- bsd_compress (state, skb_in, NULL, proto);
+ bsd_compress(state, skb_in, NULL, proto);
}
/*
* Decompress "BSD Compress".
*/
-static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *skb_out,
- struct isdn_ppp_resetparams *rsparm)
+static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out,
+ struct isdn_ppp_resetparams *rsparm)
{
struct bsd_db *db;
unsigned int max_ent;
@@ -653,7 +652,7 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
unsigned int incode;
unsigned int oldcode;
unsigned int finchar;
- unsigned char *p,*ibuf;
+ unsigned char *p, *ibuf;
int ilen;
int codelen;
int extra;
@@ -667,20 +666,20 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
printk(KERN_DEBUG "bsd_decompress called\n");
- if(!skb_in || !skb_out) {
+ if (!skb_in || !skb_out) {
printk(KERN_ERR "bsd_decompress called with NULL parameter\n");
return DECOMP_ERROR;
}
-
+
/*
* Get the sequence number.
*/
- if( (p = skb_pull(skb_in,2)) == NULL) {
+ if ((p = skb_pull(skb_in, 2)) == NULL) {
return DECOMP_ERROR;
}
- p-=2;
- seq = (p[0] << 8) + p[1];
- ilen = skb_in->len;
+ p -= 2;
+ seq = (p[0] << 8) + p[1];
+ ilen = skb_in->len;
ibuf = skb_in->data;
/*
@@ -690,7 +689,7 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
if (seq != db->seqno) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: bad sequence # %d, expected %d\n",
- db->unit, seq, db->seqno - 1);
+ db->unit, seq, db->seqno - 1);
}
return DECOMP_ERROR;
}
@@ -698,11 +697,11 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
++db->seqno;
db->bytes_out += ilen;
- if(skb_tailroom(skb_out) > 0)
- *(skb_put(skb_out,1)) = 0;
+ if (skb_tailroom(skb_out) > 0)
+ *(skb_put(skb_out, 1)) = 0;
else
return DECOMP_ERR_NOMEM;
-
+
oldcode = CLEAR;
/*
@@ -734,7 +733,7 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
/*
* The dictionary must only be cleared at the end of a packet.
*/
-
+
if (incode == CLEAR) {
if (ilen > 0) {
if (db->debug)
@@ -746,16 +745,16 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
}
if ((incode > max_ent + 2) || (incode > db->maxmaxcode)
- || (incode > max_ent && oldcode == CLEAR)) {
+ || (incode > max_ent && oldcode == CLEAR)) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: bad code 0x%x oldcode=0x%x ",
- db->unit, incode, oldcode);
+ db->unit, incode, oldcode);
printk(KERN_DEBUG "max_ent=0x%x skb->Len=%d seqno=%d\n",
- max_ent, skb_out->len, db->seqno);
+ max_ent, skb_out->len, db->seqno);
}
return DECOMP_FATALERROR; /* probably a bug */
}
-
+
/* Special case for KwKwK string. */
if (incode > max_ent) {
finchar = oldcode;
@@ -765,13 +764,13 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
extra = 0;
}
- codelen = *(lens_ptr (db, finchar));
- if( skb_tailroom(skb_out) < codelen + extra) {
+ codelen = *(lens_ptr(db, finchar));
+ if (skb_tailroom(skb_out) < codelen + extra) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: ran out of mru\n", db->unit);
#ifdef DEBUG
printk(KERN_DEBUG " len=%d, finchar=0x%x, codelen=%d,skblen=%d\n",
- ilen, finchar, codelen, skb_out->len);
+ ilen, finchar, codelen, skb_out->len);
#endif
}
return DECOMP_FATALERROR;
@@ -781,21 +780,21 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
* Decode this code and install it in the decompressed buffer.
*/
- p = skb_put(skb_out,codelen);
+ p = skb_put(skb_out, codelen);
p += codelen;
while (finchar > LAST) {
- struct bsd_dict *dictp2 = dict_ptr (db, finchar);
-
- dictp = dict_ptr (db, dictp2->cptr);
+ struct bsd_dict *dictp2 = dict_ptr(db, finchar);
+
+ dictp = dict_ptr(db, dictp2->cptr);
#ifdef DEBUG
- if (--codelen <= 0 || dictp->codem1 != finchar-1) {
+ if (--codelen <= 0 || dictp->codem1 != finchar - 1) {
if (codelen <= 0) {
printk(KERN_ERR "bsd_decomp%d: fell off end of chain ", db->unit);
printk(KERN_ERR "0x%x at 0x%x by 0x%x, max_ent=0x%x\n", incode, finchar, dictp2->cptr, max_ent);
} else {
- if (dictp->codem1 != finchar-1) {
- printk(KERN_ERR "bsd_decomp%d: bad code chain 0x%x finchar=0x%x ",db->unit, incode, finchar);
+ if (dictp->codem1 != finchar - 1) {
+ printk(KERN_ERR "bsd_decomp%d: bad code chain 0x%x finchar=0x%x ", db->unit, incode, finchar);
printk(KERN_ERR "oldcode=0x%x cptr=0x%x codem1=0x%x\n", oldcode, dictp2->cptr, dictp->codem1);
}
}
@@ -810,15 +809,15 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
}
}
*--p = finchar;
-
+
#ifdef DEBUG
if (--codelen != 0)
printk(KERN_ERR "bsd_decomp%d: short by %d after code 0x%x, max_ent=0x%x\n", db->unit, codelen, incode, max_ent);
#endif
-
+
if (extra) /* the KwKwK case again */
- *(skb_put(skb_out,1)) = finchar;
-
+ *(skb_put(skb_out, 1)) = finchar;
+
/*
* If not first code in a packet, and
* if not out of code space, then allocate a new code.
@@ -828,14 +827,14 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
*/
if (oldcode != CLEAR && max_ent < db->maxmaxcode) {
struct bsd_dict *dictp2, *dictp3;
- u16 *lens1, *lens2;
+ u16 *lens1, *lens2;
unsigned long fcode;
int hval, disp, indx;
-
- fcode = BSD_KEY(oldcode,finchar);
- hval = BSD_HASH(oldcode,finchar,db->hshift);
- dictp = dict_ptr (db, hval);
-
+
+ fcode = BSD_KEY(oldcode, finchar);
+ hval = BSD_HASH(oldcode, finchar, db->hshift);
+ dictp = dict_ptr(db, hval);
+
/* look for a free hash table entry */
if (dictp->codem1 < max_ent) {
disp = (hval == 0) ? 1 : hval;
@@ -843,18 +842,18 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
hval += disp;
if (hval >= db->hsize)
hval -= db->hsize;
- dictp = dict_ptr (db, hval);
+ dictp = dict_ptr(db, hval);
} while (dictp->codem1 < max_ent);
}
-
+
/*
* Invalidate previous hash table entry
* assigned this code, and then take it over
*/
- dictp2 = dict_ptr (db, max_ent + 1);
+ dictp2 = dict_ptr(db, max_ent + 1);
indx = dictp2->cptr;
- dictp3 = dict_ptr (db, indx);
+ dictp3 = dict_ptr(db, indx);
if (dictp3->codem1 == max_ent)
dictp3->codem1 = BADCODEM1;
@@ -865,10 +864,10 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
db->max_ent = ++max_ent;
/* Update the length of this string. */
- lens1 = lens_ptr (db, max_ent);
- lens2 = lens_ptr (db, oldcode);
+ lens1 = lens_ptr(db, max_ent);
+ lens2 = lens_ptr(db, oldcode);
*lens1 = *lens2 + 1;
-
+
/* Expand code size if needed. */
if (max_ent >= MAXCODE(n_bits) && max_ent < db->maxmaxcode) {
db->n_bits = ++n_bits;
@@ -886,7 +885,7 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *
if (bsd_check(db)) {
if (db->debug)
printk(KERN_DEBUG "bsd_decomp%d: peer should have cleared dictionary on %d\n",
- db->unit, db->seqno - 1);
+ db->unit, db->seqno - 1);
}
return skb_out->len;
}
@@ -914,15 +913,15 @@ static struct isdn_ppp_compressor ippp_bsd_compress = {
static int __init isdn_bsdcomp_init(void)
{
- int answer = isdn_ppp_register_compressor (&ippp_bsd_compress);
+ int answer = isdn_ppp_register_compressor(&ippp_bsd_compress);
if (answer == 0)
- printk (KERN_INFO "PPP BSD Compression module registered\n");
+ printk(KERN_INFO "PPP BSD Compression module registered\n");
return answer;
}
static void __exit isdn_bsdcomp_exit(void)
{
- isdn_ppp_unregister_compressor (&ippp_bsd_compress);
+ isdn_ppp_unregister_compressor(&ippp_bsd_compress);
}
module_init(isdn_bsdcomp_init);
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 6ddb795e31c5..d9f5524593fb 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -111,7 +111,7 @@ isdn_unlock_drivers(void)
#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
void
-isdn_dumppkt(char *s, u_char * p, int len, int dumplen)
+isdn_dumppkt(char *s, u_char *p, int len, int dumplen)
{
int dumpc;
@@ -163,58 +163,58 @@ isdn_wildmat(char *s, char *p)
register int nostar = 1;
if (!(*s) && !(*p))
- return(1);
+ return (1);
for (; *p; s++, p++)
switch (*p) {
- case '\\':
- /*
- * Literal match with following character,
- * fall through.
- */
+ case '\\':
+ /*
+ * Literal match with following character,
+ * fall through.
+ */
+ p++;
+ default:
+ if (*s != *p)
+ return (*s == '\0') ? 2 : 1;
+ continue;
+ case '?':
+ /* Match anything. */
+ if (*s == '\0')
+ return (2);
+ continue;
+ case '*':
+ nostar = 0;
+ /* Trailing star matches everything. */
+ return (*++p ? isdn_star(s, p) : 0);
+ case '[':
+ /* [^....] means inverse character class. */
+ if ((reverse = (p[1] == '^')))
p++;
- default:
- if (*s != *p)
- return (*s == '\0')?2:1;
- continue;
- case '?':
- /* Match anything. */
- if (*s == '\0')
- return (2);
- continue;
- case '*':
- nostar = 0;
- /* Trailing star matches everything. */
- return (*++p ? isdn_star(s, p) : 0);
- case '[':
- /* [^....] means inverse character class. */
- if ((reverse = (p[1] == '^')))
- p++;
- for (last = 0, matched = 0; *++p && (*p != ']'); last = *p)
- /* This next line requires a good C compiler. */
- if (*p == '-' ? *s <= *++p && *s >= last : *s == *p)
- matched = 1;
- if (matched == reverse)
- return (1);
- continue;
+ for (last = 0, matched = 0; *++p && (*p != ']'); last = *p)
+ /* This next line requires a good C compiler. */
+ if (*p == '-' ? *s <= *++p && *s >= last : *s == *p)
+ matched = 1;
+ if (matched == reverse)
+ return (1);
+ continue;
}
- return (*s == '\0')?0:nostar;
+ return (*s == '\0') ? 0 : nostar;
}
-int isdn_msncmp( const char * msn1, const char * msn2 )
+int isdn_msncmp(const char *msn1, const char *msn2)
{
- char TmpMsn1[ ISDN_MSNLEN ];
- char TmpMsn2[ ISDN_MSNLEN ];
+ char TmpMsn1[ISDN_MSNLEN];
+ char TmpMsn2[ISDN_MSNLEN];
char *p;
- for ( p = TmpMsn1; *msn1 && *msn1 != ':'; ) // Strip off a SPID
+ for (p = TmpMsn1; *msn1 && *msn1 != ':';) // Strip off a SPID
*p++ = *msn1++;
*p = '\0';
- for ( p = TmpMsn2; *msn2 && *msn2 != ':'; ) // Strip off a SPID
+ for (p = TmpMsn2; *msn2 && *msn2 != ':';) // Strip off a SPID
*p++ = *msn2++;
*p = '\0';
- return isdn_wildmat( TmpMsn1, TmpMsn2 );
+ return isdn_wildmat(TmpMsn1, TmpMsn2);
}
int
@@ -262,8 +262,8 @@ isdn_timer_funct(ulong dummy)
isdn_tty_carrier_timeout();
}
}
- if (tf)
- mod_timer(&dev->timer, jiffies+ISDN_TIMER_RES);
+ if (tf)
+ mod_timer(&dev->timer, jiffies + ISDN_TIMER_RES);
}
void
@@ -284,7 +284,7 @@ isdn_timer_ctrl(int tf, int onoff)
else
dev->tflags &= ~tf;
if (dev->tflags && !old_tflags)
- mod_timer(&dev->timer, jiffies+ISDN_TIMER_RES);
+ mod_timer(&dev->timer, jiffies + ISDN_TIMER_RES);
spin_unlock_irqrestore(&dev->timerlock, flags);
}
@@ -302,7 +302,7 @@ isdn_receive_skb_callback(int di, int channel, struct sk_buff *skb)
}
/* Update statistics */
dev->ibytes[i] += skb->len;
-
+
/* First, try to deliver data to network-device */
if (isdn_net_rcv_skb(i, skb))
return;
@@ -339,40 +339,40 @@ isdn_command(isdn_ctrl *cmd)
{
if (cmd->driver == -1) {
printk(KERN_WARNING "isdn_command command(%x) driver -1\n", cmd->command);
- return(1);
+ return (1);
}
if (!dev->drv[cmd->driver]) {
printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d] NULL\n",
- cmd->command, cmd->driver);
- return(1);
+ cmd->command, cmd->driver);
+ return (1);
}
if (!dev->drv[cmd->driver]->interface) {
printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d]->interface NULL\n",
- cmd->command, cmd->driver);
- return(1);
+ cmd->command, cmd->driver);
+ return (1);
}
if (cmd->command == ISDN_CMD_SETL2) {
int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255);
unsigned long l2prot = (cmd->arg >> 8) & 255;
unsigned long features = (dev->drv[cmd->driver]->interface->features
- >> ISDN_FEATURE_L2_SHIFT) &
- ISDN_FEATURE_L2_MASK;
+ >> ISDN_FEATURE_L2_SHIFT) &
+ ISDN_FEATURE_L2_MASK;
unsigned long l2_feature = (1 << l2prot);
switch (l2prot) {
- case ISDN_PROTO_L2_V11096:
- case ISDN_PROTO_L2_V11019:
- case ISDN_PROTO_L2_V11038:
+ case ISDN_PROTO_L2_V11096:
+ case ISDN_PROTO_L2_V11019:
+ case ISDN_PROTO_L2_V11038:
/* If V.110 requested, but not supported by
* HL-driver, set emulator-flag and change
* Layer-2 to transparent
*/
- if (!(features & l2_feature)) {
- dev->v110emu[idx] = l2prot;
- cmd->arg = (cmd->arg & 255) |
- (ISDN_PROTO_L2_TRANS << 8);
- } else
- dev->v110emu[idx] = 0;
+ if (!(features & l2_feature)) {
+ dev->v110emu[idx] = l2prot;
+ cmd->arg = (cmd->arg & 255) |
+ (ISDN_PROTO_L2_TRANS << 8);
+ } else
+ dev->v110emu[idx] = 0;
}
}
return dev->drv[cmd->driver]->interface->command(cmd);
@@ -393,7 +393,7 @@ isdn_all_eaz(int di, int ch)
}
/*
- * Begin of a CAPI like LL<->HL interface, currently used only for
+ * Begin of a CAPI like LL<->HL interface, currently used only for
* supplementary service (CAPI 2.0 part III)
*/
#include <linux/isdn/capicmd.h>
@@ -401,17 +401,17 @@ isdn_all_eaz(int di, int ch)
static int
isdn_capi_rec_hl_msg(capi_msg *cm)
{
- switch(cm->Command) {
- case CAPI_FACILITY:
- /* in the moment only handled in tty */
- return(isdn_tty_capi_facility(cm));
- default:
- return(-1);
+ switch (cm->Command) {
+ case CAPI_FACILITY:
+ /* in the moment only handled in tty */
+ return (isdn_tty_capi_facility(cm));
+ default:
+ return (-1);
}
}
static int
-isdn_status_callback(isdn_ctrl * c)
+isdn_status_callback(isdn_ctrl *c)
{
int di;
u_long flags;
@@ -424,314 +424,314 @@ isdn_status_callback(isdn_ctrl * c)
di = c->driver;
i = isdn_dc2minor(di, c->arg);
switch (c->command) {
- case ISDN_STAT_BSENT:
- if (i < 0)
- return -1;
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- if (isdn_net_stat_callback(i, c))
- return 0;
- if (isdn_v110_stat_callback(i, c))
- return 0;
- if (isdn_tty_stat_callback(i, c))
- return 0;
- wake_up_interruptible(&dev->drv[di]->snd_waitq[c->arg]);
- break;
- case ISDN_STAT_STAVAIL:
- dev->drv[di]->stavail += c->arg;
- wake_up_interruptible(&dev->drv[di]->st_waitq);
- break;
- case ISDN_STAT_RUN:
- dev->drv[di]->flags |= DRV_FLAG_RUNNING;
- for (i = 0; i < ISDN_MAX_CHANNELS; i++)
- if (dev->drvmap[i] == di)
- isdn_all_eaz(di, dev->chanmap[i]);
- set_global_features();
- break;
- case ISDN_STAT_STOP:
- dev->drv[di]->flags &= ~DRV_FLAG_RUNNING;
- break;
- case ISDN_STAT_ICALL:
- if (i < 0)
- return -1;
+ case ISDN_STAT_BSENT:
+ if (i < 0)
+ return -1;
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ if (isdn_net_stat_callback(i, c))
+ return 0;
+ if (isdn_v110_stat_callback(i, c))
+ return 0;
+ if (isdn_tty_stat_callback(i, c))
+ return 0;
+ wake_up_interruptible(&dev->drv[di]->snd_waitq[c->arg]);
+ break;
+ case ISDN_STAT_STAVAIL:
+ dev->drv[di]->stavail += c->arg;
+ wake_up_interruptible(&dev->drv[di]->st_waitq);
+ break;
+ case ISDN_STAT_RUN:
+ dev->drv[di]->flags |= DRV_FLAG_RUNNING;
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
+ if (dev->drvmap[i] == di)
+ isdn_all_eaz(di, dev->chanmap[i]);
+ set_global_features();
+ break;
+ case ISDN_STAT_STOP:
+ dev->drv[di]->flags &= ~DRV_FLAG_RUNNING;
+ break;
+ case ISDN_STAT_ICALL:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "ICALL (net): %d %ld %s\n", di, c->arg, c->parm.num);
+ printk(KERN_DEBUG "ICALL (net): %d %ld %s\n", di, c->arg, c->parm.num);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED) {
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED) {
+ cmd.driver = di;
+ cmd.arg = c->arg;
+ cmd.command = ISDN_CMD_HANGUP;
+ isdn_command(&cmd);
+ return 0;
+ }
+ /* Try to find a network-interface which will accept incoming call */
+ r = ((c->command == ISDN_STAT_ICALLW) ? 0 : isdn_net_find_icall(di, c->arg, i, &c->parm.setup));
+ switch (r) {
+ case 0:
+ /* No network-device replies.
+ * Try ttyI's.
+ * These return 0 on no match, 1 on match and
+ * 3 on eventually match, if CID is longer.
+ */
+ if (c->command == ISDN_STAT_ICALL)
+ if ((retval = isdn_tty_find_icall(di, c->arg, &c->parm.setup))) return (retval);
+#ifdef CONFIG_ISDN_DIVERSION
+ if (divert_if)
+ if ((retval = divert_if->stat_callback(c)))
+ return (retval); /* processed */
+#endif /* CONFIG_ISDN_DIVERSION */
+ if ((!retval) && (dev->drv[di]->flags & DRV_FLAG_REJBUS)) {
+ /* No tty responding */
cmd.driver = di;
cmd.arg = c->arg;
cmd.command = ISDN_CMD_HANGUP;
isdn_command(&cmd);
- return 0;
+ retval = 2;
}
- /* Try to find a network-interface which will accept incoming call */
- r = ((c->command == ISDN_STAT_ICALLW) ? 0 : isdn_net_find_icall(di, c->arg, i, &c->parm.setup));
- switch (r) {
- case 0:
- /* No network-device replies.
- * Try ttyI's.
- * These return 0 on no match, 1 on match and
- * 3 on eventually match, if CID is longer.
- */
- if (c->command == ISDN_STAT_ICALL)
- if ((retval = isdn_tty_find_icall(di, c->arg, &c->parm.setup))) return(retval);
-#ifdef CONFIG_ISDN_DIVERSION
- if (divert_if)
- if ((retval = divert_if->stat_callback(c)))
- return(retval); /* processed */
-#endif /* CONFIG_ISDN_DIVERSION */
- if ((!retval) && (dev->drv[di]->flags & DRV_FLAG_REJBUS)) {
- /* No tty responding */
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_HANGUP;
- isdn_command(&cmd);
- retval = 2;
- }
- break;
- case 1:
- /* Schedule connection-setup */
- isdn_net_dial();
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_ACCEPTD;
- for ( p = dev->netdev; p; p = p->next )
- if ( p->local->isdn_channel == cmd.arg )
- {
- strcpy( cmd.parm.setup.eazmsn, p->local->msn );
- isdn_command(&cmd);
- retval = 1;
- break;
- }
- break;
-
- case 2: /* For calling back, first reject incoming call ... */
- case 3: /* Interface found, but down, reject call actively */
- retval = 2;
- printk(KERN_INFO "isdn: Rejecting Call\n");
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_HANGUP;
+ break;
+ case 1:
+ /* Schedule connection-setup */
+ isdn_net_dial();
+ cmd.driver = di;
+ cmd.arg = c->arg;
+ cmd.command = ISDN_CMD_ACCEPTD;
+ for (p = dev->netdev; p; p = p->next)
+ if (p->local->isdn_channel == cmd.arg)
+ {
+ strcpy(cmd.parm.setup.eazmsn, p->local->msn);
isdn_command(&cmd);
- if (r == 3)
- break;
- /* Fall through */
- case 4:
- /* ... then start callback. */
- isdn_net_dial();
- break;
- case 5:
- /* Number would eventually match, if longer */
- retval = 3;
+ retval = 1;
break;
- }
+ }
+ break;
+
+ case 2: /* For calling back, first reject incoming call ... */
+ case 3: /* Interface found, but down, reject call actively */
+ retval = 2;
+ printk(KERN_INFO "isdn: Rejecting Call\n");
+ cmd.driver = di;
+ cmd.arg = c->arg;
+ cmd.command = ISDN_CMD_HANGUP;
+ isdn_command(&cmd);
+ if (r == 3)
+ break;
+ /* Fall through */
+ case 4:
+ /* ... then start callback. */
+ isdn_net_dial();
+ break;
+ case 5:
+ /* Number would eventually match, if longer */
+ retval = 3;
+ break;
+ }
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "ICALL: ret=%d\n", retval);
+ printk(KERN_DEBUG "ICALL: ret=%d\n", retval);
#endif
- return retval;
- break;
- case ISDN_STAT_CINF:
- if (i < 0)
- return -1;
+ return retval;
+ break;
+ case ISDN_STAT_CINF:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "CINF: %ld %s\n", c->arg, c->parm.num);
+ printk(KERN_DEBUG "CINF: %ld %s\n", c->arg, c->parm.num);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- if (strcmp(c->parm.num, "0"))
- isdn_net_stat_callback(i, c);
- isdn_tty_stat_callback(i, c);
- break;
- case ISDN_STAT_CAUSE:
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ if (strcmp(c->parm.num, "0"))
+ isdn_net_stat_callback(i, c);
+ isdn_tty_stat_callback(i, c);
+ break;
+ case ISDN_STAT_CAUSE:
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "CAUSE: %ld %s\n", c->arg, c->parm.num);
+ printk(KERN_DEBUG "CAUSE: %ld %s\n", c->arg, c->parm.num);
#endif
- printk(KERN_INFO "isdn: %s,ch%ld cause: %s\n",
- dev->drvid[di], c->arg, c->parm.num);
- isdn_tty_stat_callback(i, c);
+ printk(KERN_INFO "isdn: %s,ch%ld cause: %s\n",
+ dev->drvid[di], c->arg, c->parm.num);
+ isdn_tty_stat_callback(i, c);
#ifdef CONFIG_ISDN_DIVERSION
- if (divert_if)
- divert_if->stat_callback(c);
+ if (divert_if)
+ divert_if->stat_callback(c);
#endif /* CONFIG_ISDN_DIVERSION */
- break;
- case ISDN_STAT_DISPLAY:
+ break;
+ case ISDN_STAT_DISPLAY:
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "DISPLAY: %ld %s\n", c->arg, c->parm.display);
+ printk(KERN_DEBUG "DISPLAY: %ld %s\n", c->arg, c->parm.display);
#endif
- isdn_tty_stat_callback(i, c);
+ isdn_tty_stat_callback(i, c);
#ifdef CONFIG_ISDN_DIVERSION
- if (divert_if)
- divert_if->stat_callback(c);
+ if (divert_if)
+ divert_if->stat_callback(c);
#endif /* CONFIG_ISDN_DIVERSION */
- break;
- case ISDN_STAT_DCONN:
- if (i < 0)
- return -1;
+ break;
+ case ISDN_STAT_DCONN:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "DCONN: %ld\n", c->arg);
+ printk(KERN_DEBUG "DCONN: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- /* Find any net-device, waiting for D-channel setup */
- if (isdn_net_stat_callback(i, c))
- break;
- isdn_v110_stat_callback(i, c);
- /* Find any ttyI, waiting for D-channel setup */
- if (isdn_tty_stat_callback(i, c)) {
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_ACCEPTB;
- isdn_command(&cmd);
- break;
- }
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ /* Find any net-device, waiting for D-channel setup */
+ if (isdn_net_stat_callback(i, c))
break;
- case ISDN_STAT_DHUP:
- if (i < 0)
- return -1;
+ isdn_v110_stat_callback(i, c);
+ /* Find any ttyI, waiting for D-channel setup */
+ if (isdn_tty_stat_callback(i, c)) {
+ cmd.driver = di;
+ cmd.arg = c->arg;
+ cmd.command = ISDN_CMD_ACCEPTB;
+ isdn_command(&cmd);
+ break;
+ }
+ break;
+ case ISDN_STAT_DHUP:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "DHUP: %ld\n", c->arg);
+ printk(KERN_DEBUG "DHUP: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- dev->drv[di]->online &= ~(1 << (c->arg));
- isdn_info_update();
- /* Signal hangup to network-devices */
- if (isdn_net_stat_callback(i, c))
- break;
- isdn_v110_stat_callback(i, c);
- if (isdn_tty_stat_callback(i, c))
- break;
-#ifdef CONFIG_ISDN_DIVERSION
- if (divert_if)
- divert_if->stat_callback(c);
-#endif /* CONFIG_ISDN_DIVERSION */
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ dev->drv[di]->online &= ~(1 << (c->arg));
+ isdn_info_update();
+ /* Signal hangup to network-devices */
+ if (isdn_net_stat_callback(i, c))
break;
+ isdn_v110_stat_callback(i, c);
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_BCONN:
- if (i < 0)
- return -1;
+#ifdef CONFIG_ISDN_DIVERSION
+ if (divert_if)
+ divert_if->stat_callback(c);
+#endif /* CONFIG_ISDN_DIVERSION */
+ break;
+ break;
+ case ISDN_STAT_BCONN:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "BCONN: %ld\n", c->arg);
+ printk(KERN_DEBUG "BCONN: %ld\n", c->arg);
#endif
- /* Signal B-channel-connect to network-devices */
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- dev->drv[di]->online |= (1 << (c->arg));
- isdn_info_update();
- if (isdn_net_stat_callback(i, c))
- break;
- isdn_v110_stat_callback(i, c);
- if (isdn_tty_stat_callback(i, c))
- break;
+ /* Signal B-channel-connect to network-devices */
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ dev->drv[di]->online |= (1 << (c->arg));
+ isdn_info_update();
+ if (isdn_net_stat_callback(i, c))
+ break;
+ isdn_v110_stat_callback(i, c);
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_BHUP:
- if (i < 0)
- return -1;
+ break;
+ case ISDN_STAT_BHUP:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "BHUP: %ld\n", c->arg);
+ printk(KERN_DEBUG "BHUP: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- dev->drv[di]->online &= ~(1 << (c->arg));
- isdn_info_update();
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ dev->drv[di]->online &= ~(1 << (c->arg));
+ isdn_info_update();
#ifdef CONFIG_ISDN_X25
- /* Signal hangup to network-devices */
- if (isdn_net_stat_callback(i, c))
- break;
+ /* Signal hangup to network-devices */
+ if (isdn_net_stat_callback(i, c))
+ break;
#endif
- isdn_v110_stat_callback(i, c);
- if (isdn_tty_stat_callback(i, c))
- break;
+ isdn_v110_stat_callback(i, c);
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_NODCH:
- if (i < 0)
- return -1;
+ break;
+ case ISDN_STAT_NODCH:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "NODCH: %ld\n", c->arg);
+ printk(KERN_DEBUG "NODCH: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- if (isdn_net_stat_callback(i, c))
- break;
- if (isdn_tty_stat_callback(i, c))
- break;
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ if (isdn_net_stat_callback(i, c))
break;
- case ISDN_STAT_ADDCH:
- spin_lock_irqsave(&dev->lock, flags);
- if (isdn_add_channels(dev->drv[di], di, c->arg, 1)) {
- spin_unlock_irqrestore(&dev->lock, flags);
- return -1;
- }
- spin_unlock_irqrestore(&dev->lock, flags);
- isdn_info_update();
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_DISCH:
- spin_lock_irqsave(&dev->lock, flags);
- for (i = 0; i < ISDN_MAX_CHANNELS; i++)
- if ((dev->drvmap[i] == di) &&
- (dev->chanmap[i] == c->arg)) {
- if (c->parm.num[0])
- dev->usage[i] &= ~ISDN_USAGE_DISABLED;
- else
- if (USG_NONE(dev->usage[i])) {
- dev->usage[i] |= ISDN_USAGE_DISABLED;
- }
- else
- retval = -1;
- break;
- }
+ break;
+ case ISDN_STAT_ADDCH:
+ spin_lock_irqsave(&dev->lock, flags);
+ if (isdn_add_channels(dev->drv[di], di, c->arg, 1)) {
spin_unlock_irqrestore(&dev->lock, flags);
- isdn_info_update();
- break;
- case ISDN_STAT_UNLOAD:
- while (dev->drv[di]->locks > 0) {
- isdn_unlock_driver(dev->drv[di]);
- }
- spin_lock_irqsave(&dev->lock, flags);
- isdn_tty_stat_callback(i, c);
- for (i = 0; i < ISDN_MAX_CHANNELS; i++)
- if (dev->drvmap[i] == di) {
- dev->drvmap[i] = -1;
- dev->chanmap[i] = -1;
+ return -1;
+ }
+ spin_unlock_irqrestore(&dev->lock, flags);
+ isdn_info_update();
+ break;
+ case ISDN_STAT_DISCH:
+ spin_lock_irqsave(&dev->lock, flags);
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
+ if ((dev->drvmap[i] == di) &&
+ (dev->chanmap[i] == c->arg)) {
+ if (c->parm.num[0])
dev->usage[i] &= ~ISDN_USAGE_DISABLED;
- }
- dev->drivers--;
- dev->channels -= dev->drv[di]->channels;
- kfree(dev->drv[di]->rcverr);
- kfree(dev->drv[di]->rcvcount);
- for (i = 0; i < dev->drv[di]->channels; i++)
- skb_queue_purge(&dev->drv[di]->rpqueue[i]);
- kfree(dev->drv[di]->rpqueue);
- kfree(dev->drv[di]->rcv_waitq);
- kfree(dev->drv[di]);
- dev->drv[di] = NULL;
- dev->drvid[di][0] = '\0';
- isdn_info_update();
- set_global_features();
- spin_unlock_irqrestore(&dev->lock, flags);
- return 0;
- case ISDN_STAT_L1ERR:
- break;
- case CAPI_PUT_MESSAGE:
- return(isdn_capi_rec_hl_msg(&c->parm.cmsg));
+ else
+ if (USG_NONE(dev->usage[i])) {
+ dev->usage[i] |= ISDN_USAGE_DISABLED;
+ }
+ else
+ retval = -1;
+ break;
+ }
+ spin_unlock_irqrestore(&dev->lock, flags);
+ isdn_info_update();
+ break;
+ case ISDN_STAT_UNLOAD:
+ while (dev->drv[di]->locks > 0) {
+ isdn_unlock_driver(dev->drv[di]);
+ }
+ spin_lock_irqsave(&dev->lock, flags);
+ isdn_tty_stat_callback(i, c);
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
+ if (dev->drvmap[i] == di) {
+ dev->drvmap[i] = -1;
+ dev->chanmap[i] = -1;
+ dev->usage[i] &= ~ISDN_USAGE_DISABLED;
+ }
+ dev->drivers--;
+ dev->channels -= dev->drv[di]->channels;
+ kfree(dev->drv[di]->rcverr);
+ kfree(dev->drv[di]->rcvcount);
+ for (i = 0; i < dev->drv[di]->channels; i++)
+ skb_queue_purge(&dev->drv[di]->rpqueue[i]);
+ kfree(dev->drv[di]->rpqueue);
+ kfree(dev->drv[di]->rcv_waitq);
+ kfree(dev->drv[di]);
+ dev->drv[di] = NULL;
+ dev->drvid[di][0] = '\0';
+ isdn_info_update();
+ set_global_features();
+ spin_unlock_irqrestore(&dev->lock, flags);
+ return 0;
+ case ISDN_STAT_L1ERR:
+ break;
+ case CAPI_PUT_MESSAGE:
+ return (isdn_capi_rec_hl_msg(&c->parm.cmsg));
#ifdef CONFIG_ISDN_TTY_FAX
- case ISDN_STAT_FAXIND:
- isdn_tty_stat_callback(i, c);
- break;
+ case ISDN_STAT_FAXIND:
+ isdn_tty_stat_callback(i, c);
+ break;
#endif
#ifdef CONFIG_ISDN_AUDIO
- case ISDN_STAT_AUDIO:
- isdn_tty_stat_callback(i, c);
- break;
+ case ISDN_STAT_AUDIO:
+ isdn_tty_stat_callback(i, c);
+ break;
#endif
#ifdef CONFIG_ISDN_DIVERSION
- case ISDN_STAT_PROT:
- case ISDN_STAT_REDIR:
- if (divert_if)
- return(divert_if->stat_callback(c));
+ case ISDN_STAT_PROT:
+ case ISDN_STAT_REDIR:
+ if (divert_if)
+ return (divert_if->stat_callback(c));
#endif /* CONFIG_ISDN_DIVERSION */
- default:
- return -1;
+ default:
+ return -1;
}
return 0;
}
@@ -755,17 +755,17 @@ isdn_getnum(char **p)
* isdn_readbchan() tries to get data from the read-queue.
* It MUST be called with interrupts off.
*
- * Be aware that this is not an atomic operation when sleep != 0, even though
+ * Be aware that this is not an atomic operation when sleep != 0, even though
* interrupts are turned off! Well, like that we are currently only called
* on behalf of a read system call on raw device files (which are documented
* to be dangerous and for debugging purpose only). The inode semaphore
* takes care that this is not called for the same minor device number while
* we are sleeping, but access is not serialized against simultaneous read()
* from the corresponding ttyI device. Can other ugly events, like changes
- * of the mapping (di,ch)<->minor, happen during the sleep? --he
+ * of the mapping (di,ch)<->minor, happen during the sleep? --he
*/
int
-isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, wait_queue_head_t *sleep)
+isdn_readbchan(int di, int channel, u_char *buf, u_char *fp, int len, wait_queue_head_t *sleep)
{
int count;
int count_pull;
@@ -890,10 +890,10 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
if (!dev->drv[di])
return 0;
if (skb_queue_empty(&dev->drv[di]->rpqueue[channel]))
- return 0;
+ return 0;
len = tty_buffer_request_room(tty, dev->drv[di]->rcvcount[channel]);
- if(len == 0)
+ if (len == 0)
return len;
count = 0;
@@ -912,7 +912,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
count_pull = count_put = 0;
while ((count_pull < skb->len) && (len > 0)) {
/* push every character but the last to the tty buffer directly */
- if ( count_put )
+ if (count_put)
tty_insert_flip_char(tty, last, TTY_NORMAL);
len--;
if (dev->drv[di]->DLEflag & DLEmask) {
@@ -940,7 +940,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
dflag = 0;
}
count_put = count_pull;
- if(count_put > 1)
+ if (count_put > 1)
tty_insert_flip_string(tty, skb->data, count_put - 1);
last = skb->data[count_put - 1];
len -= count_put;
@@ -952,7 +952,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
/* We got all the data in this buff.
* Now we can dequeue it.
*/
- if(cisco_hack)
+ if (cisco_hack)
tty_insert_flip_char(tty, last, 0xFF);
else
tty_insert_flip_char(tty, last, TTY_NORMAL);
@@ -1057,7 +1057,7 @@ isdn_info_update(void)
}
static ssize_t
-isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
+isdn_read(struct file *file, char __user *buf, size_t count, loff_t *off)
{
uint minor = iminor(file->f_path.dentry->d_inode);
int len = 0;
@@ -1112,7 +1112,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
len = isdn_readbchan(drvidx, chidx, p, NULL, count,
&dev->drv[drvidx]->rcv_waitq[chidx]);
*off += len;
- if (copy_to_user(buf,p,len))
+ if (copy_to_user(buf, p, len))
len = -EFAULT;
kfree(p);
retval = len;
@@ -1135,7 +1135,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
if (count > dev->drv[drvidx]->stavail)
count = dev->drv[drvidx]->stavail;
len = dev->drv[drvidx]->interface->readstat(buf, count,
- drvidx, isdn_minor2chan(minor - ISDN_MINOR_CTRL));
+ drvidx, isdn_minor2chan(minor - ISDN_MINOR_CTRL));
if (len < 0) {
retval = len;
goto out;
@@ -1158,13 +1158,13 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
}
#endif
retval = -ENODEV;
- out:
+out:
mutex_unlock(&isdn_mutex);
return retval;
}
static ssize_t
-isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
+isdn_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
{
uint minor = iminor(file->f_path.dentry->d_inode);
int drvidx;
@@ -1204,11 +1204,11 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
*
if (!(dev->drv[drvidx]->flags & DRV_FLAG_RUNNING))
return -ENODEV;
- */
+ */
if (dev->drv[drvidx]->interface->writecmd)
retval = dev->drv[drvidx]->interface->
writecmd(buf, count, drvidx,
- isdn_minor2chan(minor - ISDN_MINOR_CTRL));
+ isdn_minor2chan(minor - ISDN_MINOR_CTRL));
else
retval = count;
goto out;
@@ -1220,13 +1220,13 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
}
#endif
retval = -ENODEV;
- out:
+out:
mutex_unlock(&isdn_mutex);
return retval;
}
static unsigned int
-isdn_poll(struct file *file, poll_table * wait)
+isdn_poll(struct file *file, poll_table *wait)
{
unsigned int mask = 0;
unsigned int minor = iminor(file->f_path.dentry->d_inode);
@@ -1261,7 +1261,7 @@ isdn_poll(struct file *file, poll_table * wait)
}
#endif
mask = POLLERR;
- out:
+out:
mutex_unlock(&isdn_mutex);
return mask;
}
@@ -1294,38 +1294,38 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
if (minor == ISDN_MINOR_STATUS) {
switch (cmd) {
- case IIOCGETDVR:
- return (TTY_DV +
- (NET_DV << 8) +
- (INF_DV << 16));
- case IIOCGETCPS:
- if (arg) {
- ulong __user *p = argp;
- int i;
- if (!access_ok(VERIFY_WRITE, p,
- sizeof(ulong) * ISDN_MAX_CHANNELS * 2))
- return -EFAULT;
- for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
- put_user(dev->ibytes[i], p++);
- put_user(dev->obytes[i], p++);
- }
- return 0;
- } else
- return -EINVAL;
- break;
+ case IIOCGETDVR:
+ return (TTY_DV +
+ (NET_DV << 8) +
+ (INF_DV << 16));
+ case IIOCGETCPS:
+ if (arg) {
+ ulong __user *p = argp;
+ int i;
+ if (!access_ok(VERIFY_WRITE, p,
+ sizeof(ulong) * ISDN_MAX_CHANNELS * 2))
+ return -EFAULT;
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ put_user(dev->ibytes[i], p++);
+ put_user(dev->obytes[i], p++);
+ }
+ return 0;
+ } else
+ return -EINVAL;
+ break;
#ifdef CONFIG_NETDEVICES
- case IIOCNETGPN:
- /* Get peer phone number of a connected
- * isdn network interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- return isdn_net_getpeer(&phone, argp);
- } else
- return -EINVAL;
-#endif
- default:
+ case IIOCNETGPN:
+ /* Get peer phone number of a connected
+ * isdn network interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
+ return -EFAULT;
+ return isdn_net_getpeer(&phone, argp);
+ } else
return -EINVAL;
+#endif
+ default:
+ return -EINVAL;
}
}
if (!dev->drivers)
@@ -1347,360 +1347,360 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
* are serialized by means of a semaphore.
*/
switch (cmd) {
- case IIOCNETDWRSET:
- printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n");
- return(-EINVAL);
- case IIOCNETLCR:
- printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
- return -ENODEV;
+ case IIOCNETDWRSET:
+ printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n");
+ return (-EINVAL);
+ case IIOCNETLCR:
+ printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
+ return -ENODEV;
#ifdef CONFIG_NETDEVICES
- case IIOCNETAIF:
- /* Add a network-interface */
- if (arg) {
- if (copy_from_user(name, argp, sizeof(name)))
- return -EFAULT;
- s = name;
+ case IIOCNETAIF:
+ /* Add a network-interface */
+ if (arg) {
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ s = name;
+ } else {
+ s = NULL;
+ }
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ if ((s = isdn_net_new(s, NULL))) {
+ if (copy_to_user(argp, s, strlen(s) + 1)) {
+ ret = -EFAULT;
+ } else {
+ ret = 0;
+ }
+ } else
+ ret = -ENODEV;
+ mutex_unlock(&dev->mtx);
+ return ret;
+ case IIOCNETASL:
+ /* Add a slave to a network-interface */
+ if (arg) {
+ if (copy_from_user(bname, argp, sizeof(bname) - 1))
+ return -EFAULT;
+ } else
+ return -EINVAL;
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ if ((s = isdn_net_newslave(bname))) {
+ if (copy_to_user(argp, s, strlen(s) + 1)) {
+ ret = -EFAULT;
} else {
- s = NULL;
+ ret = 0;
}
+ } else
+ ret = -ENODEV;
+ mutex_unlock(&dev->mtx);
+ return ret;
+ case IIOCNETDIF:
+ /* Delete a network-interface */
+ if (arg) {
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- if ((s = isdn_net_new(s, NULL))) {
- if (copy_to_user(argp, s, strlen(s) + 1)){
- ret = -EFAULT;
- } else {
- ret = 0;
- }
- } else
- ret = -ENODEV;
+ if (ret) return ret;
+ ret = isdn_net_rm(name);
mutex_unlock(&dev->mtx);
return ret;
- case IIOCNETASL:
- /* Add a slave to a network-interface */
- if (arg) {
- if (copy_from_user(bname, argp, sizeof(bname) - 1))
+ } else
+ return -EINVAL;
+ case IIOCNETSCF:
+ /* Set configurable parameters of a network-interface */
+ if (arg) {
+ if (copy_from_user(&cfg, argp, sizeof(cfg)))
+ return -EFAULT;
+ return isdn_net_setcfg(&cfg);
+ } else
+ return -EINVAL;
+ case IIOCNETGCF:
+ /* Get configurable parameters of a network-interface */
+ if (arg) {
+ if (copy_from_user(&cfg, argp, sizeof(cfg)))
+ return -EFAULT;
+ if (!(ret = isdn_net_getcfg(&cfg))) {
+ if (copy_to_user(argp, &cfg, sizeof(cfg)))
return -EFAULT;
- } else
- return -EINVAL;
+ }
+ return ret;
+ } else
+ return -EINVAL;
+ case IIOCNETANM:
+ /* Add a phone-number to a network-interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
+ return -EFAULT;
ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- if ((s = isdn_net_newslave(bname))) {
- if (copy_to_user(argp, s, strlen(s) + 1)){
- ret = -EFAULT;
- } else {
- ret = 0;
- }
- } else
- ret = -ENODEV;
+ if (ret) return ret;
+ ret = isdn_net_addphone(&phone);
mutex_unlock(&dev->mtx);
return ret;
- case IIOCNETDIF:
- /* Delete a network-interface */
- if (arg) {
- if (copy_from_user(name, argp, sizeof(name)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_rm(name);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETSCF:
- /* Set configurable parameters of a network-interface */
- if (arg) {
- if (copy_from_user(&cfg, argp, sizeof(cfg)))
- return -EFAULT;
- return isdn_net_setcfg(&cfg);
- } else
- return -EINVAL;
- case IIOCNETGCF:
- /* Get configurable parameters of a network-interface */
- if (arg) {
- if (copy_from_user(&cfg, argp, sizeof(cfg)))
- return -EFAULT;
- if (!(ret = isdn_net_getcfg(&cfg))) {
- if (copy_to_user(argp, &cfg, sizeof(cfg)))
- return -EFAULT;
- }
- return ret;
- } else
- return -EINVAL;
- case IIOCNETANM:
- /* Add a phone-number to a network-interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_addphone(&phone);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETGNM:
- /* Get list of phone-numbers of a network-interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_getphones(&phone, argp);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETDNM:
- /* Delete a phone-number of a network-interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_delphone(&phone);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETDIL:
- /* Force dialing of a network-interface */
- if (arg) {
- if (copy_from_user(name, argp, sizeof(name)))
- return -EFAULT;
- return isdn_net_force_dial(name);
- } else
- return -EINVAL;
-#ifdef CONFIG_ISDN_PPP
- case IIOCNETALN:
- if (!arg)
- return -EINVAL;
- if (copy_from_user(name, argp, sizeof(name)))
+ } else
+ return -EINVAL;
+ case IIOCNETGNM:
+ /* Get list of phone-numbers of a network-interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT;
- return isdn_ppp_dial_slave(name);
- case IIOCNETDLN:
- if (!arg)
- return -EINVAL;
- if (copy_from_user(name, argp, sizeof(name)))
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ ret = isdn_net_getphones(&phone, argp);
+ mutex_unlock(&dev->mtx);
+ return ret;
+ } else
+ return -EINVAL;
+ case IIOCNETDNM:
+ /* Delete a phone-number of a network-interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT;
- return isdn_ppp_hangup_slave(name);
-#endif
- case IIOCNETHUP:
- /* Force hangup of a network-interface */
- if (!arg)
- return -EINVAL;
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ ret = isdn_net_delphone(&phone);
+ mutex_unlock(&dev->mtx);
+ return ret;
+ } else
+ return -EINVAL;
+ case IIOCNETDIL:
+ /* Force dialing of a network-interface */
+ if (arg) {
if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT;
- return isdn_net_force_hangup(name);
- break;
+ return isdn_net_force_dial(name);
+ } else
+ return -EINVAL;
+#ifdef CONFIG_ISDN_PPP
+ case IIOCNETALN:
+ if (!arg)
+ return -EINVAL;
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ return isdn_ppp_dial_slave(name);
+ case IIOCNETDLN:
+ if (!arg)
+ return -EINVAL;
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ return isdn_ppp_hangup_slave(name);
+#endif
+ case IIOCNETHUP:
+ /* Force hangup of a network-interface */
+ if (!arg)
+ return -EINVAL;
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ return isdn_net_force_hangup(name);
+ break;
#endif /* CONFIG_NETDEVICES */
- case IIOCSETVER:
- dev->net_verbose = arg;
- printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
- return 0;
- case IIOCSETGST:
- if (arg)
- dev->global_flags |= ISDN_GLOBAL_STOPPED;
- else
- dev->global_flags &= ~ISDN_GLOBAL_STOPPED;
- printk(KERN_INFO "isdn: Global Mode %s\n",
- (dev->global_flags & ISDN_GLOBAL_STOPPED) ? "stopped" : "running");
- return 0;
- case IIOCSETBRJ:
- drvidx = -1;
- if (arg) {
- int i;
- char *p;
- if (copy_from_user(&iocts, argp,
- sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- iocts.drvid[sizeof(iocts.drvid)-1] = 0;
- if (strlen(iocts.drvid)) {
- if ((p = strchr(iocts.drvid, ',')))
- *p = 0;
- drvidx = -1;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- if (!(strcmp(dev->drvid[i], iocts.drvid))) {
- drvidx = i;
- break;
- }
- }
+ case IIOCSETVER:
+ dev->net_verbose = arg;
+ printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
+ return 0;
+ case IIOCSETGST:
+ if (arg)
+ dev->global_flags |= ISDN_GLOBAL_STOPPED;
+ else
+ dev->global_flags &= ~ISDN_GLOBAL_STOPPED;
+ printk(KERN_INFO "isdn: Global Mode %s\n",
+ (dev->global_flags & ISDN_GLOBAL_STOPPED) ? "stopped" : "running");
+ return 0;
+ case IIOCSETBRJ:
+ drvidx = -1;
+ if (arg) {
+ int i;
+ char *p;
+ if (copy_from_user(&iocts, argp,
+ sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ iocts.drvid[sizeof(iocts.drvid) - 1] = 0;
+ if (strlen(iocts.drvid)) {
+ if ((p = strchr(iocts.drvid, ',')))
+ *p = 0;
+ drvidx = -1;
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ if (!(strcmp(dev->drvid[i], iocts.drvid))) {
+ drvidx = i;
+ break;
+ }
}
- if (drvidx == -1)
- return -ENODEV;
- if (iocts.arg)
- dev->drv[drvidx]->flags |= DRV_FLAG_REJBUS;
- else
- dev->drv[drvidx]->flags &= ~DRV_FLAG_REJBUS;
- return 0;
- case IIOCSIGPRF:
- dev->profd = current;
- return 0;
- break;
- case IIOCGETPRF:
- /* Get all Modem-Profiles */
- if (arg) {
- char __user *p = argp;
- int i;
-
- if (!access_ok(VERIFY_WRITE, argp,
- (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
- * ISDN_MAX_CHANNELS))
+ }
+ if (drvidx == -1)
+ return -ENODEV;
+ if (iocts.arg)
+ dev->drv[drvidx]->flags |= DRV_FLAG_REJBUS;
+ else
+ dev->drv[drvidx]->flags &= ~DRV_FLAG_REJBUS;
+ return 0;
+ case IIOCSIGPRF:
+ dev->profd = current;
+ return 0;
+ break;
+ case IIOCGETPRF:
+ /* Get all Modem-Profiles */
+ if (arg) {
+ char __user *p = argp;
+ int i;
+
+ if (!access_ok(VERIFY_WRITE, argp,
+ (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
+ * ISDN_MAX_CHANNELS))
+ return -EFAULT;
+
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ if (copy_to_user(p, dev->mdm.info[i].emu.profile,
+ ISDN_MODEM_NUMREG))
+ return -EFAULT;
+ p += ISDN_MODEM_NUMREG;
+ if (copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN))
return -EFAULT;
+ p += ISDN_MSNLEN;
+ if (copy_to_user(p, dev->mdm.info[i].emu.plmsn, ISDN_LMSNLEN))
+ return -EFAULT;
+ p += ISDN_LMSNLEN;
+ }
+ return (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN) * ISDN_MAX_CHANNELS;
+ } else
+ return -EINVAL;
+ break;
+ case IIOCSETPRF:
+ /* Set all Modem-Profiles */
+ if (arg) {
+ char __user *p = argp;
+ int i;
+
+ if (!access_ok(VERIFY_READ, argp,
+ (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
+ * ISDN_MAX_CHANNELS))
+ return -EFAULT;
- for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
- if (copy_to_user(p, dev->mdm.info[i].emu.profile,
- ISDN_MODEM_NUMREG))
- return -EFAULT;
- p += ISDN_MODEM_NUMREG;
- if (copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN))
- return -EFAULT;
- p += ISDN_MSNLEN;
- if (copy_to_user(p, dev->mdm.info[i].emu.plmsn, ISDN_LMSNLEN))
- return -EFAULT;
- p += ISDN_LMSNLEN;
- }
- return (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN) * ISDN_MAX_CHANNELS;
- } else
- return -EINVAL;
- break;
- case IIOCSETPRF:
- /* Set all Modem-Profiles */
- if (arg) {
- char __user *p = argp;
- int i;
-
- if (!access_ok(VERIFY_READ, argp,
- (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
- * ISDN_MAX_CHANNELS))
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ if (copy_from_user(dev->mdm.info[i].emu.profile, p,
+ ISDN_MODEM_NUMREG))
+ return -EFAULT;
+ p += ISDN_MODEM_NUMREG;
+ if (copy_from_user(dev->mdm.info[i].emu.plmsn, p, ISDN_LMSNLEN))
return -EFAULT;
+ p += ISDN_LMSNLEN;
+ if (copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN))
+ return -EFAULT;
+ p += ISDN_MSNLEN;
+ }
+ return 0;
+ } else
+ return -EINVAL;
+ break;
+ case IIOCSETMAP:
+ case IIOCGETMAP:
+ /* Set/Get MSN->EAZ-Mapping for a driver */
+ if (arg) {
- for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
- if (copy_from_user(dev->mdm.info[i].emu.profile, p,
- ISDN_MODEM_NUMREG))
- return -EFAULT;
- p += ISDN_MODEM_NUMREG;
- if (copy_from_user(dev->mdm.info[i].emu.plmsn, p, ISDN_LMSNLEN))
- return -EFAULT;
- p += ISDN_LMSNLEN;
- if (copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN))
- return -EFAULT;
- p += ISDN_MSNLEN;
- }
- return 0;
+ if (copy_from_user(&iocts, argp,
+ sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ iocts.drvid[sizeof(iocts.drvid) - 1] = 0;
+ if (strlen(iocts.drvid)) {
+ drvidx = -1;
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ if (!(strcmp(dev->drvid[i], iocts.drvid))) {
+ drvidx = i;
+ break;
+ }
} else
- return -EINVAL;
- break;
- case IIOCSETMAP:
- case IIOCGETMAP:
- /* Set/Get MSN->EAZ-Mapping for a driver */
- if (arg) {
+ drvidx = 0;
+ if (drvidx == -1)
+ return -ENODEV;
+ if (cmd == IIOCSETMAP) {
+ int loop = 1;
- if (copy_from_user(&iocts, argp,
- sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- iocts.drvid[sizeof(iocts.drvid)-1] = 0;
- if (strlen(iocts.drvid)) {
- drvidx = -1;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- if (!(strcmp(dev->drvid[i], iocts.drvid))) {
- drvidx = i;
+ p = (char __user *) iocts.arg;
+ i = 0;
+ while (loop) {
+ int j = 0;
+
+ while (1) {
+ if (!access_ok(VERIFY_READ, p, 1))
+ return -EFAULT;
+ get_user(bname[j], p++);
+ switch (bname[j]) {
+ case '\0':
+ loop = 0;
+ /* Fall through */
+ case ',':
+ bname[j] = '\0';
+ strcpy(dev->drv[drvidx]->msn2eaz[i], bname);
+ j = ISDN_MSNLEN;
break;
+ default:
+ j++;
}
- } else
- drvidx = 0;
- if (drvidx == -1)
- return -ENODEV;
- if (cmd == IIOCSETMAP) {
- int loop = 1;
-
- p = (char __user *) iocts.arg;
- i = 0;
- while (loop) {
- int j = 0;
-
- while (1) {
- if (!access_ok(VERIFY_READ, p, 1))
- return -EFAULT;
- get_user(bname[j], p++);
- switch (bname[j]) {
- case '\0':
- loop = 0;
- /* Fall through */
- case ',':
- bname[j] = '\0';
- strcpy(dev->drv[drvidx]->msn2eaz[i], bname);
- j = ISDN_MSNLEN;
- break;
- default:
- j++;
- }
- if (j >= ISDN_MSNLEN)
- break;
- }
- if (++i > 9)
+ if (j >= ISDN_MSNLEN)
break;
}
- } else {
- p = (char __user *) iocts.arg;
- for (i = 0; i < 10; i++) {
- snprintf(bname, sizeof(bname), "%s%s",
- strlen(dev->drv[drvidx]->msn2eaz[i]) ?
- dev->drv[drvidx]->msn2eaz[i] : "_",
- (i < 9) ? "," : "\0");
- if (copy_to_user(p, bname, strlen(bname) + 1))
- return -EFAULT;
- p += strlen(bname);
- }
+ if (++i > 9)
+ break;
}
- return 0;
- } else
- return -EINVAL;
- case IIOCDBGVAR:
- if (arg) {
- if (copy_to_user(argp, &dev, sizeof(ulong)))
- return -EFAULT;
- return 0;
- } else
- return -EINVAL;
- break;
- default:
- if ((cmd & IIOCDRVCTL) == IIOCDRVCTL)
- cmd = ((cmd >> _IOC_NRSHIFT) & _IOC_NRMASK) & ISDN_DRVIOCTL_MASK;
- else
- return -EINVAL;
- if (arg) {
- int i;
- char *p;
- if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- iocts.drvid[sizeof(iocts.drvid)-1] = 0;
- if (strlen(iocts.drvid)) {
- if ((p = strchr(iocts.drvid, ',')))
- *p = 0;
- drvidx = -1;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- if (!(strcmp(dev->drvid[i], iocts.drvid))) {
- drvidx = i;
- break;
- }
- } else
- drvidx = 0;
- if (drvidx == -1)
- return -ENODEV;
- if (!access_ok(VERIFY_WRITE, argp,
- sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- c.driver = drvidx;
- c.command = ISDN_CMD_IOCTL;
- c.arg = cmd;
- memcpy(c.parm.num, &iocts.arg, sizeof(ulong));
- ret = isdn_command(&c);
- memcpy(&iocts.arg, c.parm.num, sizeof(ulong));
- if (copy_to_user(argp, &iocts, sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- return ret;
+ } else {
+ p = (char __user *) iocts.arg;
+ for (i = 0; i < 10; i++) {
+ snprintf(bname, sizeof(bname), "%s%s",
+ strlen(dev->drv[drvidx]->msn2eaz[i]) ?
+ dev->drv[drvidx]->msn2eaz[i] : "_",
+ (i < 9) ? "," : "\0");
+ if (copy_to_user(p, bname, strlen(bname) + 1))
+ return -EFAULT;
+ p += strlen(bname);
+ }
+ }
+ return 0;
+ } else
+ return -EINVAL;
+ case IIOCDBGVAR:
+ if (arg) {
+ if (copy_to_user(argp, &dev, sizeof(ulong)))
+ return -EFAULT;
+ return 0;
+ } else
+ return -EINVAL;
+ break;
+ default:
+ if ((cmd & IIOCDRVCTL) == IIOCDRVCTL)
+ cmd = ((cmd >> _IOC_NRSHIFT) & _IOC_NRMASK) & ISDN_DRVIOCTL_MASK;
+ else
+ return -EINVAL;
+ if (arg) {
+ int i;
+ char *p;
+ if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ iocts.drvid[sizeof(iocts.drvid) - 1] = 0;
+ if (strlen(iocts.drvid)) {
+ if ((p = strchr(iocts.drvid, ',')))
+ *p = 0;
+ drvidx = -1;
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ if (!(strcmp(dev->drvid[i], iocts.drvid))) {
+ drvidx = i;
+ break;
+ }
} else
- return -EINVAL;
+ drvidx = 0;
+ if (drvidx == -1)
+ return -ENODEV;
+ if (!access_ok(VERIFY_WRITE, argp,
+ sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ c.driver = drvidx;
+ c.command = ISDN_CMD_IOCTL;
+ c.arg = cmd;
+ memcpy(c.parm.num, &iocts.arg, sizeof(ulong));
+ ret = isdn_command(&c);
+ memcpy(&iocts.arg, c.parm.num, sizeof(ulong));
+ if (copy_to_user(argp, &iocts, sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ return ret;
+ } else
+ return -EINVAL;
}
}
#ifdef CONFIG_ISDN_PPP
@@ -1788,7 +1788,7 @@ isdn_open(struct inode *ino, struct file *filep)
goto out;
}
#endif
- out:
+out:
nonseekable_open(ino, filep);
mutex_unlock(&isdn_mutex);
return retval;
@@ -1832,7 +1832,7 @@ isdn_close(struct inode *ino, struct file *filep)
isdn_ppp_release(minor - ISDN_MINOR_PPP, filep);
#endif
- out:
+out:
mutex_unlock(&isdn_mutex);
return 0;
}
@@ -1868,14 +1868,14 @@ isdn_map_eaz2msn(char *msn, int di)
* Find an unused ISDN-channel, whose feature-flags match the
* given L2- and L3-protocols.
*/
-#define L2V (~(ISDN_FEATURE_L2_V11096|ISDN_FEATURE_L2_V11019|ISDN_FEATURE_L2_V11038))
+#define L2V (~(ISDN_FEATURE_L2_V11096 | ISDN_FEATURE_L2_V11019 | ISDN_FEATURE_L2_V11038))
/*
* This function must be called with holding the dev->lock.
*/
int
isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
- ,int pre_chan, char *msn)
+ , int pre_chan, char *msn)
{
int i;
ulong features;
@@ -1883,7 +1883,7 @@ isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
features = ((1 << l2_proto) | (0x10000 << l3_proto));
vfeatures = (((1 << l2_proto) | (0x10000 << l3_proto)) &
- ~(ISDN_FEATURE_L2_V11096|ISDN_FEATURE_L2_V11019|ISDN_FEATURE_L2_V11038));
+ ~(ISDN_FEATURE_L2_V11096 | ISDN_FEATURE_L2_V11019 | ISDN_FEATURE_L2_V11038));
/* If Layer-2 protocol is V.110, accept drivers with
* transparent feature even if these don't support V.110
* because we can emulate this in linklevel.
@@ -1893,12 +1893,12 @@ isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
(dev->drvmap[i] != -1)) {
int d = dev->drvmap[i];
if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) &&
- ((pre_dev != d) || (pre_chan != dev->chanmap[i])))
+ ((pre_dev != d) || (pre_chan != dev->chanmap[i])))
continue;
if (!strcmp(isdn_map_eaz2msn(msn, d), "-"))
continue;
if (dev->usage[i] & ISDN_USAGE_DISABLED)
- continue; /* usage not allowed */
+ continue; /* usage not allowed */
if (dev->drv[d]->flags & DRV_FLAG_RUNNING) {
if (((dev->drv[d]->interface->features & features) == features) ||
(((dev->drv[d]->interface->features & vfeatures) == vfeatures) &&
@@ -1932,7 +1932,7 @@ isdn_free_channel(int di, int ch, int usage)
if ((di < 0) || (ch < 0)) {
printk(KERN_WARNING "%s: called with invalid drv(%d) or channel(%d)\n",
- __func__, di, ch);
+ __func__, di, ch);
return;
}
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
@@ -1976,7 +1976,7 @@ isdn_unexclusive_channel(int di, int ch)
* writebuf replacement for SKB_ABLE drivers
*/
static int
-isdn_writebuf_stub(int drvidx, int chan, const u_char __user * buf, int len)
+isdn_writebuf_stub(int drvidx, int chan, const u_char __user *buf, int len)
{
int ret;
int hl = dev->drv[drvidx]->interface->hl_hdrlen;
@@ -2026,8 +2026,8 @@ isdn_writebuf_skb_stub(int drvidx, int chan, int ack, struct sk_buff *skb)
} else {
int hl = dev->drv[drvidx]->interface->hl_hdrlen;
- if( skb_headroom(skb) < hl ){
- /*
+ if (skb_headroom(skb) < hl) {
+ /*
* This should only occur when new HL driver with
* increased hl_hdrlen was loaded after netdevice
* was created and connected to the new driver.
@@ -2035,13 +2035,13 @@ isdn_writebuf_skb_stub(int drvidx, int chan, int ack, struct sk_buff *skb)
* The V.110 branch (re-allocates on its own) does
* not need this
*/
- struct sk_buff * skb_tmp;
+ struct sk_buff *skb_tmp;
skb_tmp = skb_realloc_headroom(skb, hl);
printk(KERN_DEBUG "isdn_writebuf_skb_stub: reallocating headroom%s\n", skb_tmp ? "" : " failed");
if (!skb_tmp) return -ENOMEM; /* 0 better? */
ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx, chan, ack, skb_tmp);
- if( ret > 0 ){
+ if (ret > 0) {
dev_kfree_skb(skb);
} else {
dev_kfree_skb(skb_tmp);
@@ -2059,7 +2059,7 @@ isdn_writebuf_skb_stub(int drvidx, int chan, int ack, struct sk_buff *skb)
/* For V.110 return unencoded data length */
ret = v110_ret;
/* if the complete frame was send we free the skb;
- if not upper function will requeue the skb */
+ if not upper function will requeue the skb */
if (ret == skb->len)
dev_kfree_skb(skb);
}
@@ -2077,7 +2077,7 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
init_waitqueue_head(&d->st_waitq);
if (d->flags & DRV_FLAG_RUNNING)
return -1;
- if (n < 1) return 0;
+ if (n < 1) return 0;
m = (adding) ? d->channels + n : n;
@@ -2114,7 +2114,7 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
kfree(d->rcvcount);
kfree(d->rcverr);
}
- return -1;
+ return -1;
}
for (j = 0; j < m; j++) {
skb_queue_head_init(&d->rpqueue[j]);
@@ -2172,45 +2172,45 @@ set_global_features(void)
static char *map_drvname(int di)
{
- if ((di < 0) || (di >= ISDN_MAX_DRIVERS))
- return(NULL);
- return(dev->drvid[di]); /* driver name */
+ if ((di < 0) || (di >= ISDN_MAX_DRIVERS))
+ return (NULL);
+ return (dev->drvid[di]); /* driver name */
} /* map_drvname */
static int map_namedrv(char *id)
{ int i;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- { if (!strcmp(dev->drvid[i],id))
- return(i);
- }
- return(-1);
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ { if (!strcmp(dev->drvid[i], id))
+ return (i);
+ }
+ return (-1);
} /* map_namedrv */
int DIVERT_REG_NAME(isdn_divert_if *i_div)
{
- if (i_div->if_magic != DIVERT_IF_MAGIC)
- return(DIVERT_VER_ERR);
- switch (i_div->cmd)
- {
- case DIVERT_CMD_REL:
- if (divert_if != i_div)
- return(DIVERT_REL_ERR);
- divert_if = NULL; /* free interface */
- return(DIVERT_NO_ERR);
-
- case DIVERT_CMD_REG:
- if (divert_if)
- return(DIVERT_REG_ERR);
- i_div->ll_cmd = isdn_command; /* set command function */
- i_div->drv_to_name = map_drvname;
- i_div->name_to_drv = map_namedrv;
- divert_if = i_div; /* remember interface */
- return(DIVERT_NO_ERR);
-
- default:
- return(DIVERT_CMD_ERR);
- }
+ if (i_div->if_magic != DIVERT_IF_MAGIC)
+ return (DIVERT_VER_ERR);
+ switch (i_div->cmd)
+ {
+ case DIVERT_CMD_REL:
+ if (divert_if != i_div)
+ return (DIVERT_REL_ERR);
+ divert_if = NULL; /* free interface */
+ return (DIVERT_NO_ERR);
+
+ case DIVERT_CMD_REG:
+ if (divert_if)
+ return (DIVERT_REG_ERR);
+ i_div->ll_cmd = isdn_command; /* set command function */
+ i_div->drv_to_name = map_drvname;
+ i_div->name_to_drv = map_namedrv;
+ divert_if = i_div; /* remember interface */
+ return (DIVERT_NO_ERR);
+
+ default:
+ return (DIVERT_CMD_ERR);
+ }
} /* DIVERT_REG_NAME */
EXPORT_SYMBOL(DIVERT_REG_NAME);
@@ -2225,7 +2225,7 @@ EXPORT_SYMBOL(isdn_ppp_unregister_compressor);
#endif
int
-register_isdn(isdn_if * i)
+register_isdn(isdn_if *i)
{
isdn_driver_t *d;
int j;
@@ -2280,10 +2280,10 @@ register_isdn(isdn_if * i)
}
/*
- *****************************************************************************
- * And now the modules code.
- *****************************************************************************
- */
+*****************************************************************************
+* And now the modules code.
+*****************************************************************************
+*/
static char *
isdn_getrev(const char *revision)
diff --git a/drivers/isdn/i4l/isdn_common.h b/drivers/isdn/i4l/isdn_common.h
index 082735dbb412..9a471f62e1d4 100644
--- a/drivers/isdn/i4l/isdn_common.h
+++ b/drivers/isdn/i4l/isdn_common.h
@@ -29,19 +29,19 @@ extern void isdn_lock_drivers(void);
extern void isdn_unlock_drivers(void);
extern void isdn_free_channel(int di, int ch, int usage);
extern void isdn_all_eaz(int di, int ch);
-extern int isdn_command(isdn_ctrl *);
-extern int isdn_dc2minor(int di, int ch);
+extern int isdn_command(isdn_ctrl *);
+extern int isdn_dc2minor(int di, int ch);
extern void isdn_info_update(void);
extern char *isdn_map_eaz2msn(char *msn, int di);
extern void isdn_timer_ctrl(int tf, int onoff);
extern void isdn_unexclusive_channel(int di, int ch);
-extern int isdn_getnum(char **);
-extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *);
-extern int isdn_readbchan_tty(int, int, struct tty_struct *, int);
-extern int isdn_get_free_channel(int, int, int, int, int, char *);
-extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
-extern int register_isdn(isdn_if * i);
-extern int isdn_msncmp( const char *, const char *);
+extern int isdn_getnum(char **);
+extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *);
+extern int isdn_readbchan_tty(int, int, struct tty_struct *, int);
+extern int isdn_get_free_channel(int, int, int, int, int, char *);
+extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
+extern int register_isdn(isdn_if *i);
+extern int isdn_msncmp(const char *, const char *);
#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
extern void isdn_dumppkt(char *, u_char *, int, int);
#endif
diff --git a/drivers/isdn/i4l/isdn_concap.c b/drivers/isdn/i4l/isdn_concap.c
index d568689669f8..91d57304d4d3 100644
--- a/drivers/isdn/i4l/isdn_concap.c
+++ b/drivers/isdn/i4l/isdn_concap.c
@@ -1,5 +1,5 @@
/* $Id: isdn_concap.c,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
- *
+ *
* Linux ISDN subsystem, protocol encapsulation
*
* This software may be used and distributed according to the terms
@@ -25,57 +25,57 @@
protocols that require for reliable datalink semantics. That means:
- before any data is to be submitted the connection must explicitly
- be set up.
+ be set up.
- after the successful set up of the connection is signalled the
- connection is considered to be reliably up.
+ connection is considered to be reliably up.
- Auto-dialing ist not compatible with this requirements. Thus, auto-dialing
+ Auto-dialing ist not compatible with this requirements. Thus, auto-dialing
is completely bypassed.
It might be possible to implement a (non standardized) datalink protocol
that provides a reliable data link service while using some auto dialing
mechanism. Such a protocol would need an auxiliary channel (i.e. user-user-
signaling on the D-channel) while the B-channel is down.
- */
+*/
static int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *skb)
{
- struct net_device *ndev = concap -> net_dev;
+ struct net_device *ndev = concap->net_dev;
isdn_net_dev *nd = ((isdn_net_local *) netdev_priv(ndev))->netdev;
isdn_net_local *lp = isdn_net_get_locked_lp(nd);
- IX25DEBUG( "isdn_concap_dl_data_req: %s \n", concap->net_dev->name);
+ IX25DEBUG("isdn_concap_dl_data_req: %s \n", concap->net_dev->name);
if (!lp) {
- IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap -> net_dev -> name, 1);
+ IX25DEBUG("isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap->net_dev->name, 1);
return 1;
}
lp->huptimer = 0;
isdn_net_writebuf_skb(lp, skb);
spin_unlock_bh(&lp->xmit_lock);
- IX25DEBUG( "isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap -> net_dev -> name, 0);
+ IX25DEBUG("isdn_concap_dl_data_req: %s : isdn_net_send_skb returned %d\n", concap->net_dev->name, 0);
return 0;
}
static int isdn_concap_dl_connect_req(struct concap_proto *concap)
{
- struct net_device *ndev = concap -> net_dev;
+ struct net_device *ndev = concap->net_dev;
isdn_net_local *lp = netdev_priv(ndev);
int ret;
- IX25DEBUG( "isdn_concap_dl_connect_req: %s \n", ndev -> name);
+ IX25DEBUG("isdn_concap_dl_connect_req: %s \n", ndev->name);
/* dial ... */
- ret = isdn_net_dial_req( lp );
- if ( ret ) IX25DEBUG("dialing failed\n");
+ ret = isdn_net_dial_req(lp);
+ if (ret) IX25DEBUG("dialing failed\n");
return ret;
}
static int isdn_concap_dl_disconn_req(struct concap_proto *concap)
{
- IX25DEBUG( "isdn_concap_dl_disconn_req: %s \n", concap -> net_dev -> name);
+ IX25DEBUG("isdn_concap_dl_disconn_req: %s \n", concap->net_dev->name);
- isdn_net_hangup( concap -> net_dev );
+ isdn_net_hangup(concap->net_dev);
return 0;
}
@@ -88,10 +88,10 @@ struct concap_device_ops isdn_concap_reliable_dl_dops = {
/* The following should better go into a dedicated source file such that
this sourcefile does not need to include any protocol specific header
files. For now:
- */
-struct concap_proto * isdn_concap_new( int encap )
+*/
+struct concap_proto *isdn_concap_new(int encap)
{
- switch ( encap ) {
+ switch (encap) {
case ISDN_NET_ENCAP_X25IFACE:
return isdn_x25iface_proto_new();
}
diff --git a/drivers/isdn/i4l/isdn_concap.h b/drivers/isdn/i4l/isdn_concap.h
index 6ac7e0445ea5..cd7e3ba74e25 100644
--- a/drivers/isdn/i4l/isdn_concap.h
+++ b/drivers/isdn/i4l/isdn_concap.h
@@ -8,6 +8,4 @@
*/
extern struct concap_device_ops isdn_concap_reliable_dl_dops;
-extern struct concap_proto * isdn_concap_new( int );
-
-
+extern struct concap_proto *isdn_concap_new(int);
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 2339d7396b9e..babc621a07fb 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -9,7 +9,7 @@
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
- * Data Over Voice (DOV) support added - Guy Ellis 23-Mar-02
+ * Data Over Voice (DOV) support added - Guy Ellis 23-Mar-02
* guy@traverse.com.au
* Outgoing calls - looks for a 'V' in first char of dialed number
* Incoming calls - checks first character of eaz as follows:
@@ -18,7 +18,7 @@
* 'B' - accept BOTH DATA and DOV types
*
* Jan 2001: fix CISCO HDLC Bjoern A. Zeeb <i4l@zabbadoz.net>
- * for info on the protocol, see
+ * for info on the protocol, see
* http://i4l.zabbadoz.net/i4l/cisco-hdlc.txt
*/
@@ -40,7 +40,7 @@
/*
- * Outline of new tbusy handling:
+ * Outline of new tbusy handling:
*
* Old method, roughly spoken, consisted of setting tbusy when entering
* isdn_net_start_xmit() and at several other locations and clearing
@@ -59,14 +59,14 @@
* Most of the changes were pretty obvious and basically done by HE already.
*
* One problem of the isdn net device code is that is uses struct net_device
- * for masters and slaves. However, only master interface are registered to
- * the network layer, and therefore, it only makes sense to call netif_*
+ * for masters and slaves. However, only master interface are registered to
+ * the network layer, and therefore, it only makes sense to call netif_*
* functions on them.
*
* --KG
*/
-/*
+/*
* Find out if the netdevice has been ifup-ed yet.
* For slaves, look at the corresponding master.
*/
@@ -74,8 +74,8 @@ static __inline__ int isdn_net_device_started(isdn_net_dev *n)
{
isdn_net_local *lp = n->local;
struct net_device *dev;
-
- if (lp->master)
+
+ if (lp->master)
dev = lp->master;
else
dev = n->dev;
@@ -88,7 +88,7 @@ static __inline__ int isdn_net_device_started(isdn_net_dev *n)
*/
static __inline__ void isdn_net_device_wake_queue(isdn_net_local *lp)
{
- if (lp->master)
+ if (lp->master)
netif_wake_queue(lp->master);
else
netif_wake_queue(lp->netdev->dev);
@@ -108,7 +108,7 @@ static __inline__ void isdn_net_device_stop_queue(isdn_net_local *lp)
/*
* find out if the net_device which this lp belongs to (lp can be
- * master or slave) is busy. It's busy iff all (master and slave)
+ * master or slave) is busy. It's busy iff all (master and slave)
* queues are busy
*/
static __inline__ int isdn_net_device_busy(isdn_net_local *lp)
@@ -124,7 +124,7 @@ static __inline__ int isdn_net_device_busy(isdn_net_local *lp)
nd = ISDN_MASTER_PRIV(lp)->netdev;
else
nd = lp->netdev;
-
+
spin_lock_irqsave(&nd->queue_lock, flags);
nlp = lp->next;
while (nlp != lp) {
@@ -155,7 +155,7 @@ static __inline__ void isdn_net_dec_frame_cnt(isdn_net_local *lp)
} else {
isdn_net_device_wake_queue(lp);
}
- }
+ }
}
static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
@@ -163,36 +163,36 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
atomic_set(&lp->frame_cnt, 0);
}
-/* For 2.2.x we leave the transmitter busy timeout at 2 secs, just
+/* For 2.2.x we leave the transmitter busy timeout at 2 secs, just
* to be safe.
* For 2.3.x we push it up to 20 secs, because call establishment
- * (in particular callback) may take such a long time, and we
+ * (in particular callback) may take such a long time, and we
* don't want confusing messages in the log. However, there is a slight
* possibility that this large timeout will break other things like MPPP,
* which might rely on the tx timeout. If so, we'll find out this way...
*/
-#define ISDN_NET_TX_TIMEOUT (20*HZ)
+#define ISDN_NET_TX_TIMEOUT (20 * HZ)
/* Prototypes */
static int isdn_net_force_dial_lp(isdn_net_local *);
static netdev_tx_t isdn_net_start_xmit(struct sk_buff *,
- struct net_device *);
+ struct net_device *);
static void isdn_net_ciscohdlck_connected(isdn_net_local *lp);
static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp);
char *isdn_net_revision = "$Revision: 1.1.2.2 $";
- /*
- * Code for raw-networking over ISDN
- */
+/*
+ * Code for raw-networking over ISDN
+ */
static void
isdn_net_unreachable(struct net_device *dev, struct sk_buff *skb, char *reason)
{
- if(skb) {
+ if (skb) {
u_short proto = ntohs(skb->protocol);
@@ -200,13 +200,13 @@ isdn_net_unreachable(struct net_device *dev, struct sk_buff *skb, char *reason)
dev->name,
(reason != NULL) ? reason : "unknown",
(proto != ETH_P_IP) ? "Protocol != ETH_P_IP" : "");
-
+
dst_link_failure(skb);
}
else { /* dial not triggered by rawIP packet */
printk(KERN_DEBUG "isdn_net: %s: %s\n",
- dev->name,
- (reason != NULL) ? reason : "reason unknown");
+ dev->name,
+ (reason != NULL) ? reason : "reason unknown");
}
}
@@ -214,14 +214,14 @@ static void
isdn_net_reset(struct net_device *dev)
{
#ifdef CONFIG_ISDN_X25
- struct concap_device_ops * dops =
- ((isdn_net_local *) netdev_priv(dev))->dops;
- struct concap_proto * cprot =
- ((isdn_net_local *) netdev_priv(dev))->netdev->cprot;
+ struct concap_device_ops *dops =
+ ((isdn_net_local *)netdev_priv(dev))->dops;
+ struct concap_proto *cprot =
+ ((isdn_net_local *)netdev_priv(dev))->netdev->cprot;
#endif
#ifdef CONFIG_ISDN_X25
- if( cprot && cprot -> pops && dops )
- cprot -> pops -> restart ( cprot, dev, dops );
+ if (cprot && cprot->pops && dops)
+ cprot->pops->restart(cprot, dev, dops);
#endif
}
@@ -248,7 +248,7 @@ isdn_net_open(struct net_device *dev)
*/
struct in_ifaddr *ifa = in_dev->ifa_list;
if (ifa != NULL)
- memcpy(dev->dev_addr+2, &ifa->ifa_local, 4);
+ memcpy(dev->dev_addr + 2, &ifa->ifa_local, 4);
}
/* If this interface has slaves, start them also */
@@ -267,7 +267,7 @@ isdn_net_open(struct net_device *dev)
* Assign an ISDN-channel to a net-interface
*/
static void
-isdn_net_bind_channel(isdn_net_local * lp, int idx)
+isdn_net_bind_channel(isdn_net_local *lp, int idx)
{
lp->flags |= ISDN_NET_CONNECTED;
lp->isdn_device = dev->drvmap[idx];
@@ -280,7 +280,7 @@ isdn_net_bind_channel(isdn_net_local * lp, int idx)
* unbind a net-interface (resets interface after an error)
*/
static void
-isdn_net_unbind_channel(isdn_net_local * lp)
+isdn_net_unbind_channel(isdn_net_local *lp)
{
skb_queue_purge(&lp->super_tx_queue);
@@ -288,7 +288,7 @@ isdn_net_unbind_channel(isdn_net_local * lp)
/* Moral equivalent of dev_purge_queues():
BEWARE! This chunk of code cannot be called from hardware
interrupt handler. I hope it is true. --ANK
- */
+ */
qdisc_reset_all_tx(lp->netdev->dev);
}
lp->dialstate = 0;
@@ -368,7 +368,7 @@ isdn_net_autohup(void)
isdn_net_hangup(p->dev);
}
- if(dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*l) == ISDN_NET_DM_OFF)) {
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*l) == ISDN_NET_DM_OFF)) {
isdn_net_hangup(p->dev);
break;
}
@@ -403,143 +403,143 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
struct concap_proto_ops *pops = cprot ? cprot->pops : NULL;
#endif
switch (cmd) {
- case ISDN_STAT_BSENT:
- /* A packet has successfully been sent out */
- if ((lp->flags & ISDN_NET_CONNECTED) &&
- (!lp->dialstate)) {
- isdn_net_dec_frame_cnt(lp);
- lp->stats.tx_packets++;
- lp->stats.tx_bytes += c->parm.length;
- }
+ case ISDN_STAT_BSENT:
+ /* A packet has successfully been sent out */
+ if ((lp->flags & ISDN_NET_CONNECTED) &&
+ (!lp->dialstate)) {
+ isdn_net_dec_frame_cnt(lp);
+ lp->stats.tx_packets++;
+ lp->stats.tx_bytes += c->parm.length;
+ }
+ return 1;
+ case ISDN_STAT_DCONN:
+ /* D-Channel is up */
+ switch (lp->dialstate) {
+ case 4:
+ case 7:
+ case 8:
+ lp->dialstate++;
return 1;
- case ISDN_STAT_DCONN:
- /* D-Channel is up */
- switch (lp->dialstate) {
- case 4:
- case 7:
- case 8:
- lp->dialstate++;
- return 1;
- case 12:
- lp->dialstate = 5;
- return 1;
- }
- break;
- case ISDN_STAT_DHUP:
- /* Either D-Channel-hangup or error during dialout */
+ case 12:
+ lp->dialstate = 5;
+ return 1;
+ }
+ break;
+ case ISDN_STAT_DHUP:
+ /* Either D-Channel-hangup or error during dialout */
#ifdef CONFIG_ISDN_X25
- /* If we are not connencted then dialing had
- failed. If there are generic encap protocol
- receiver routines signal the closure of
- the link*/
-
- if( !(lp->flags & ISDN_NET_CONNECTED)
- && pops && pops -> disconn_ind )
- pops -> disconn_ind(cprot);
+ /* If we are not connencted then dialing had
+ failed. If there are generic encap protocol
+ receiver routines signal the closure of
+ the link*/
+
+ if (!(lp->flags & ISDN_NET_CONNECTED)
+ && pops && pops->disconn_ind)
+ pops->disconn_ind(cprot);
#endif /* CONFIG_ISDN_X25 */
- if ((!lp->dialstate) && (lp->flags & ISDN_NET_CONNECTED)) {
- if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
- isdn_net_ciscohdlck_disconnected(lp);
+ if ((!lp->dialstate) && (lp->flags & ISDN_NET_CONNECTED)) {
+ if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
+ isdn_net_ciscohdlck_disconnected(lp);
#ifdef CONFIG_ISDN_PPP
- if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
- isdn_ppp_free(lp);
+ if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
+ isdn_ppp_free(lp);
#endif
- isdn_net_lp_disconnected(lp);
- isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
- printk(KERN_INFO "%s: remote hangup\n", p->dev->name);
- printk(KERN_INFO "%s: Chargesum is %d\n", p->dev->name,
- lp->charge);
- isdn_net_unbind_channel(lp);
- return 1;
- }
- break;
+ isdn_net_lp_disconnected(lp);
+ isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
+ printk(KERN_INFO "%s: remote hangup\n", p->dev->name);
+ printk(KERN_INFO "%s: Chargesum is %d\n", p->dev->name,
+ lp->charge);
+ isdn_net_unbind_channel(lp);
+ return 1;
+ }
+ break;
#ifdef CONFIG_ISDN_X25
- case ISDN_STAT_BHUP:
- /* B-Channel-hangup */
- /* try if there are generic encap protocol
- receiver routines and signal the closure of
- the link */
- if( pops && pops -> disconn_ind ){
- pops -> disconn_ind(cprot);
- return 1;
- }
- break;
+ case ISDN_STAT_BHUP:
+ /* B-Channel-hangup */
+ /* try if there are generic encap protocol
+ receiver routines and signal the closure of
+ the link */
+ if (pops && pops->disconn_ind) {
+ pops->disconn_ind(cprot);
+ return 1;
+ }
+ break;
#endif /* CONFIG_ISDN_X25 */
- case ISDN_STAT_BCONN:
- /* B-Channel is up */
- isdn_net_zero_frame_cnt(lp);
- switch (lp->dialstate) {
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 12:
- if (lp->dialstate <= 6) {
- dev->usage[idx] |= ISDN_USAGE_OUTGOING;
- isdn_info_update();
- } else
- dev->rx_netdev[idx] = p;
- lp->dialstate = 0;
- isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 1);
- if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
- isdn_net_ciscohdlck_connected(lp);
- if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) {
- if (lp->master) { /* is lp a slave? */
- isdn_net_dev *nd = ISDN_MASTER_PRIV(lp)->netdev;
- isdn_net_add_to_bundle(nd, lp);
- }
- }
- printk(KERN_INFO "isdn_net: %s connected\n", p->dev->name);
- /* If first Chargeinfo comes before B-Channel connect,
- * we correct the timestamp here.
- */
- lp->chargetime = jiffies;
+ case ISDN_STAT_BCONN:
+ /* B-Channel is up */
+ isdn_net_zero_frame_cnt(lp);
+ switch (lp->dialstate) {
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 12:
+ if (lp->dialstate <= 6) {
+ dev->usage[idx] |= ISDN_USAGE_OUTGOING;
+ isdn_info_update();
+ } else
+ dev->rx_netdev[idx] = p;
+ lp->dialstate = 0;
+ isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 1);
+ if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
+ isdn_net_ciscohdlck_connected(lp);
+ if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) {
+ if (lp->master) { /* is lp a slave? */
+ isdn_net_dev *nd = ISDN_MASTER_PRIV(lp)->netdev;
+ isdn_net_add_to_bundle(nd, lp);
+ }
+ }
+ printk(KERN_INFO "isdn_net: %s connected\n", p->dev->name);
+ /* If first Chargeinfo comes before B-Channel connect,
+ * we correct the timestamp here.
+ */
+ lp->chargetime = jiffies;
- /* reset dial-timeout */
- lp->dialstarted = 0;
- lp->dialwait_timer = 0;
+ /* reset dial-timeout */
+ lp->dialstarted = 0;
+ lp->dialwait_timer = 0;
#ifdef CONFIG_ISDN_PPP
- if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
- isdn_ppp_wakeup_daemon(lp);
+ if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
+ isdn_ppp_wakeup_daemon(lp);
#endif
#ifdef CONFIG_ISDN_X25
- /* try if there are generic concap receiver routines */
- if( pops )
- if( pops->connect_ind)
- pops->connect_ind(cprot);
+ /* try if there are generic concap receiver routines */
+ if (pops)
+ if (pops->connect_ind)
+ pops->connect_ind(cprot);
#endif /* CONFIG_ISDN_X25 */
- /* ppp needs to do negotiations first */
- if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP)
- isdn_net_device_wake_queue(lp);
- return 1;
- }
- break;
- case ISDN_STAT_NODCH:
- /* No D-Channel avail. */
- if (lp->dialstate == 4) {
- lp->dialstate--;
- return 1;
- }
- break;
- case ISDN_STAT_CINF:
- /* Charge-info from TelCo. Calculate interval between
- * charge-infos and set timestamp for last info for
- * usage by isdn_net_autohup()
- */
- lp->charge++;
- if (lp->hupflags & ISDN_HAVECHARGE) {
- lp->hupflags &= ~ISDN_WAITCHARGE;
- lp->chargeint = jiffies - lp->chargetime - (2 * HZ);
- }
- if (lp->hupflags & ISDN_WAITCHARGE)
- lp->hupflags |= ISDN_HAVECHARGE;
- lp->chargetime = jiffies;
- printk(KERN_DEBUG "isdn_net: Got CINF chargetime of %s now %lu\n",
- p->dev->name, lp->chargetime);
+ /* ppp needs to do negotiations first */
+ if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP)
+ isdn_net_device_wake_queue(lp);
return 1;
+ }
+ break;
+ case ISDN_STAT_NODCH:
+ /* No D-Channel avail. */
+ if (lp->dialstate == 4) {
+ lp->dialstate--;
+ return 1;
+ }
+ break;
+ case ISDN_STAT_CINF:
+ /* Charge-info from TelCo. Calculate interval between
+ * charge-infos and set timestamp for last info for
+ * usage by isdn_net_autohup()
+ */
+ lp->charge++;
+ if (lp->hupflags & ISDN_HAVECHARGE) {
+ lp->hupflags &= ~ISDN_WAITCHARGE;
+ lp->chargeint = jiffies - lp->chargetime - (2 * HZ);
+ }
+ if (lp->hupflags & ISDN_WAITCHARGE)
+ lp->hupflags |= ISDN_HAVECHARGE;
+ lp->chargetime = jiffies;
+ printk(KERN_DEBUG "isdn_net: Got CINF chargetime of %s now %lu\n",
+ p->dev->name, lp->chargetime);
+ return 1;
}
}
return 0;
@@ -562,7 +562,7 @@ isdn_net_dial(void)
int anymore = 0;
int i;
isdn_ctrl cmd;
- u_char *phone_number;
+ u_char *phone_number;
while (p) {
isdn_net_local *lp = p->local;
@@ -572,249 +572,249 @@ isdn_net_dial(void)
printk(KERN_DEBUG "%s: dialstate=%d\n", p->dev->name, lp->dialstate);
#endif
switch (lp->dialstate) {
- case 0:
- /* Nothing to do for this interface */
+ case 0:
+ /* Nothing to do for this interface */
+ break;
+ case 1:
+ /* Initiate dialout. Set phone-number-pointer to first number
+ * of interface.
+ */
+ lp->dial = lp->phone[1];
+ if (!lp->dial) {
+ printk(KERN_WARNING "%s: phone number deleted?\n",
+ p->dev->name);
+ isdn_net_hangup(p->dev);
break;
- case 1:
- /* Initiate dialout. Set phone-number-pointer to first number
- * of interface.
- */
- lp->dial = lp->phone[1];
- if (!lp->dial) {
- printk(KERN_WARNING "%s: phone number deleted?\n",
- p->dev->name);
- isdn_net_hangup(p->dev);
- break;
+ }
+ anymore = 1;
+
+ if (lp->dialtimeout > 0)
+ if (lp->dialstarted == 0 || time_after(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait)) {
+ lp->dialstarted = jiffies;
+ lp->dialwait_timer = 0;
}
- anymore = 1;
- if(lp->dialtimeout > 0)
- if(lp->dialstarted == 0 || time_after(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait)) {
- lp->dialstarted = jiffies;
- lp->dialwait_timer = 0;
+ lp->dialstate++;
+ /* Fall through */
+ case 2:
+ /* Prepare dialing. Clear EAZ, then set EAZ. */
+ cmd.driver = lp->isdn_device;
+ cmd.arg = lp->isdn_channel;
+ cmd.command = ISDN_CMD_CLREAZ;
+ isdn_command(&cmd);
+ sprintf(cmd.parm.num, "%s", isdn_map_eaz2msn(lp->msn, cmd.driver));
+ cmd.command = ISDN_CMD_SETEAZ;
+ isdn_command(&cmd);
+ lp->dialretry = 0;
+ anymore = 1;
+ lp->dialstate++;
+ /* Fall through */
+ case 3:
+ /* Setup interface, dial current phone-number, switch to next number.
+ * If list of phone-numbers is exhausted, increment
+ * retry-counter.
+ */
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF)) {
+ char *s;
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ s = "dial suppressed: isdn system stopped";
+ else
+ s = "dial suppressed: dialmode `off'";
+ isdn_net_unreachable(p->dev, NULL, s);
+ isdn_net_hangup(p->dev);
+ break;
+ }
+ cmd.driver = lp->isdn_device;
+ cmd.command = ISDN_CMD_SETL2;
+ cmd.arg = lp->isdn_channel + (lp->l2_proto << 8);
+ isdn_command(&cmd);
+ cmd.driver = lp->isdn_device;
+ cmd.command = ISDN_CMD_SETL3;
+ cmd.arg = lp->isdn_channel + (lp->l3_proto << 8);
+ isdn_command(&cmd);
+ cmd.driver = lp->isdn_device;
+ cmd.arg = lp->isdn_channel;
+ if (!lp->dial) {
+ printk(KERN_WARNING "%s: phone number deleted?\n",
+ p->dev->name);
+ isdn_net_hangup(p->dev);
+ break;
+ }
+ if (!strncmp(lp->dial->num, "LEASED", strlen("LEASED"))) {
+ lp->dialstate = 4;
+ printk(KERN_INFO "%s: Open leased line ...\n", p->dev->name);
+ } else {
+ if (lp->dialtimeout > 0)
+ if (time_after(jiffies, lp->dialstarted + lp->dialtimeout)) {
+ lp->dialwait_timer = jiffies + lp->dialwait;
+ lp->dialstarted = 0;
+ isdn_net_unreachable(p->dev, NULL, "dial: timed out");
+ isdn_net_hangup(p->dev);
+ break;
}
- lp->dialstate++;
- /* Fall through */
- case 2:
- /* Prepare dialing. Clear EAZ, then set EAZ. */
- cmd.driver = lp->isdn_device;
- cmd.arg = lp->isdn_channel;
- cmd.command = ISDN_CMD_CLREAZ;
- isdn_command(&cmd);
- sprintf(cmd.parm.num, "%s", isdn_map_eaz2msn(lp->msn, cmd.driver));
- cmd.command = ISDN_CMD_SETEAZ;
- isdn_command(&cmd);
- lp->dialretry = 0;
- anymore = 1;
- lp->dialstate++;
- /* Fall through */
- case 3:
- /* Setup interface, dial current phone-number, switch to next number.
- * If list of phone-numbers is exhausted, increment
- * retry-counter.
- */
- if(dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF)) {
- char *s;
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- s = "dial suppressed: isdn system stopped";
- else
- s = "dial suppressed: dialmode `off'";
- isdn_net_unreachable(p->dev, NULL, s);
- isdn_net_hangup(p->dev);
- break;
- }
- cmd.driver = lp->isdn_device;
- cmd.command = ISDN_CMD_SETL2;
- cmd.arg = lp->isdn_channel + (lp->l2_proto << 8);
- isdn_command(&cmd);
- cmd.driver = lp->isdn_device;
- cmd.command = ISDN_CMD_SETL3;
- cmd.arg = lp->isdn_channel + (lp->l3_proto << 8);
- isdn_command(&cmd);
cmd.driver = lp->isdn_device;
- cmd.arg = lp->isdn_channel;
- if (!lp->dial) {
- printk(KERN_WARNING "%s: phone number deleted?\n",
- p->dev->name);
- isdn_net_hangup(p->dev);
- break;
+ cmd.command = ISDN_CMD_DIAL;
+ cmd.parm.setup.si2 = 0;
+
+ /* check for DOV */
+ phone_number = lp->dial->num;
+ if ((*phone_number == 'v') ||
+ (*phone_number == 'V')) { /* DOV call */
+ cmd.parm.setup.si1 = 1;
+ } else { /* DATA call */
+ cmd.parm.setup.si1 = 7;
}
- if (!strncmp(lp->dial->num, "LEASED", strlen("LEASED"))) {
- lp->dialstate = 4;
- printk(KERN_INFO "%s: Open leased line ...\n", p->dev->name);
- } else {
- if(lp->dialtimeout > 0)
- if (time_after(jiffies, lp->dialstarted + lp->dialtimeout)) {
- lp->dialwait_timer = jiffies + lp->dialwait;
- lp->dialstarted = 0;
- isdn_net_unreachable(p->dev, NULL, "dial: timed out");
- isdn_net_hangup(p->dev);
- break;
- }
- cmd.driver = lp->isdn_device;
- cmd.command = ISDN_CMD_DIAL;
- cmd.parm.setup.si2 = 0;
-
- /* check for DOV */
- phone_number = lp->dial->num;
- if ((*phone_number == 'v') ||
- (*phone_number == 'V')) { /* DOV call */
- cmd.parm.setup.si1 = 1;
- } else { /* DATA call */
- cmd.parm.setup.si1 = 7;
- }
+ strcpy(cmd.parm.setup.phone, phone_number);
+ /*
+ * Switch to next number or back to start if at end of list.
+ */
+ if (!(lp->dial = (isdn_net_phone *) lp->dial->next)) {
+ lp->dial = lp->phone[1];
+ lp->dialretry++;
- strcpy(cmd.parm.setup.phone, phone_number);
- /*
- * Switch to next number or back to start if at end of list.
- */
- if (!(lp->dial = (isdn_net_phone *) lp->dial->next)) {
- lp->dial = lp->phone[1];
- lp->dialretry++;
-
- if (lp->dialretry > lp->dialmax) {
- if (lp->dialtimeout == 0) {
- lp->dialwait_timer = jiffies + lp->dialwait;
- lp->dialstarted = 0;
- isdn_net_unreachable(p->dev, NULL, "dial: tried all numbers dialmax times");
- }
- isdn_net_hangup(p->dev);
- break;
+ if (lp->dialretry > lp->dialmax) {
+ if (lp->dialtimeout == 0) {
+ lp->dialwait_timer = jiffies + lp->dialwait;
+ lp->dialstarted = 0;
+ isdn_net_unreachable(p->dev, NULL, "dial: tried all numbers dialmax times");
}
+ isdn_net_hangup(p->dev);
+ break;
}
- sprintf(cmd.parm.setup.eazmsn, "%s",
- isdn_map_eaz2msn(lp->msn, cmd.driver));
- i = isdn_dc2minor(lp->isdn_device, lp->isdn_channel);
- if (i >= 0) {
- strcpy(dev->num[i], cmd.parm.setup.phone);
- dev->usage[i] |= ISDN_USAGE_OUTGOING;
- isdn_info_update();
- }
- printk(KERN_INFO "%s: dialing %d %s... %s\n", p->dev->name,
- lp->dialretry, cmd.parm.setup.phone,
- (cmd.parm.setup.si1 == 1) ? "DOV" : "");
- lp->dtimer = 0;
-#ifdef ISDN_DEBUG_NET_DIAL
- printk(KERN_DEBUG "dial: d=%d c=%d\n", lp->isdn_device,
- lp->isdn_channel);
-#endif
- isdn_command(&cmd);
}
- lp->huptimer = 0;
- lp->outgoing = 1;
- if (lp->chargeint) {
- lp->hupflags |= ISDN_HAVECHARGE;
- lp->hupflags &= ~ISDN_WAITCHARGE;
- } else {
- lp->hupflags |= ISDN_WAITCHARGE;
- lp->hupflags &= ~ISDN_HAVECHARGE;
+ sprintf(cmd.parm.setup.eazmsn, "%s",
+ isdn_map_eaz2msn(lp->msn, cmd.driver));
+ i = isdn_dc2minor(lp->isdn_device, lp->isdn_channel);
+ if (i >= 0) {
+ strcpy(dev->num[i], cmd.parm.setup.phone);
+ dev->usage[i] |= ISDN_USAGE_OUTGOING;
+ isdn_info_update();
}
- anymore = 1;
- lp->dialstate =
- (lp->cbdelay &&
- (lp->flags & ISDN_NET_CBOUT)) ? 12 : 4;
- break;
- case 4:
- /* Wait for D-Channel-connect.
- * If timeout, switch back to state 3.
- * Dialmax-handling moved to state 3.
- */
- if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
- lp->dialstate = 3;
- anymore = 1;
- break;
- case 5:
- /* Got D-Channel-Connect, send B-Channel-request */
- cmd.driver = lp->isdn_device;
- cmd.arg = lp->isdn_channel;
- cmd.command = ISDN_CMD_ACCEPTB;
- anymore = 1;
+ printk(KERN_INFO "%s: dialing %d %s... %s\n", p->dev->name,
+ lp->dialretry, cmd.parm.setup.phone,
+ (cmd.parm.setup.si1 == 1) ? "DOV" : "");
lp->dtimer = 0;
- lp->dialstate++;
+#ifdef ISDN_DEBUG_NET_DIAL
+ printk(KERN_DEBUG "dial: d=%d c=%d\n", lp->isdn_device,
+ lp->isdn_channel);
+#endif
isdn_command(&cmd);
- break;
- case 6:
- /* Wait for B- or D-Channel-connect. If timeout,
- * switch back to state 3.
- */
+ }
+ lp->huptimer = 0;
+ lp->outgoing = 1;
+ if (lp->chargeint) {
+ lp->hupflags |= ISDN_HAVECHARGE;
+ lp->hupflags &= ~ISDN_WAITCHARGE;
+ } else {
+ lp->hupflags |= ISDN_WAITCHARGE;
+ lp->hupflags &= ~ISDN_HAVECHARGE;
+ }
+ anymore = 1;
+ lp->dialstate =
+ (lp->cbdelay &&
+ (lp->flags & ISDN_NET_CBOUT)) ? 12 : 4;
+ break;
+ case 4:
+ /* Wait for D-Channel-connect.
+ * If timeout, switch back to state 3.
+ * Dialmax-handling moved to state 3.
+ */
+ if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
+ lp->dialstate = 3;
+ anymore = 1;
+ break;
+ case 5:
+ /* Got D-Channel-Connect, send B-Channel-request */
+ cmd.driver = lp->isdn_device;
+ cmd.arg = lp->isdn_channel;
+ cmd.command = ISDN_CMD_ACCEPTB;
+ anymore = 1;
+ lp->dtimer = 0;
+ lp->dialstate++;
+ isdn_command(&cmd);
+ break;
+ case 6:
+ /* Wait for B- or D-Channel-connect. If timeout,
+ * switch back to state 3.
+ */
#ifdef ISDN_DEBUG_NET_DIAL
- printk(KERN_DEBUG "dialtimer2: %d\n", lp->dtimer);
+ printk(KERN_DEBUG "dialtimer2: %d\n", lp->dtimer);
#endif
- if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
- lp->dialstate = 3;
- anymore = 1;
- break;
- case 7:
- /* Got incoming Call, setup L2 and L3 protocols,
- * then wait for D-Channel-connect
- */
+ if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
+ lp->dialstate = 3;
+ anymore = 1;
+ break;
+ case 7:
+ /* Got incoming Call, setup L2 and L3 protocols,
+ * then wait for D-Channel-connect
+ */
#ifdef ISDN_DEBUG_NET_DIAL
- printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
+ printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
#endif
- cmd.driver = lp->isdn_device;
- cmd.command = ISDN_CMD_SETL2;
- cmd.arg = lp->isdn_channel + (lp->l2_proto << 8);
- isdn_command(&cmd);
- cmd.driver = lp->isdn_device;
- cmd.command = ISDN_CMD_SETL3;
- cmd.arg = lp->isdn_channel + (lp->l3_proto << 8);
- isdn_command(&cmd);
- if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT15)
- isdn_net_hangup(p->dev);
- else {
- anymore = 1;
- lp->dialstate++;
- }
- break;
- case 9:
- /* Got incoming D-Channel-Connect, send B-Channel-request */
- cmd.driver = lp->isdn_device;
- cmd.arg = lp->isdn_channel;
- cmd.command = ISDN_CMD_ACCEPTB;
- isdn_command(&cmd);
+ cmd.driver = lp->isdn_device;
+ cmd.command = ISDN_CMD_SETL2;
+ cmd.arg = lp->isdn_channel + (lp->l2_proto << 8);
+ isdn_command(&cmd);
+ cmd.driver = lp->isdn_device;
+ cmd.command = ISDN_CMD_SETL3;
+ cmd.arg = lp->isdn_channel + (lp->l3_proto << 8);
+ isdn_command(&cmd);
+ if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT15)
+ isdn_net_hangup(p->dev);
+ else {
anymore = 1;
- lp->dtimer = 0;
lp->dialstate++;
- break;
- case 8:
- case 10:
- /* Wait for B- or D-channel-connect */
+ }
+ break;
+ case 9:
+ /* Got incoming D-Channel-Connect, send B-Channel-request */
+ cmd.driver = lp->isdn_device;
+ cmd.arg = lp->isdn_channel;
+ cmd.command = ISDN_CMD_ACCEPTB;
+ isdn_command(&cmd);
+ anymore = 1;
+ lp->dtimer = 0;
+ lp->dialstate++;
+ break;
+ case 8:
+ case 10:
+ /* Wait for B- or D-channel-connect */
#ifdef ISDN_DEBUG_NET_DIAL
- printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
+ printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
#endif
- if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
- isdn_net_hangup(p->dev);
- else
- anymore = 1;
- break;
- case 11:
- /* Callback Delay */
- if (lp->dtimer++ > lp->cbdelay)
- lp->dialstate = 1;
- anymore = 1;
- break;
- case 12:
- /* Remote does callback. Hangup after cbdelay, then wait for incoming
- * call (in state 4).
- */
- if (lp->dtimer++ > lp->cbdelay)
- {
- printk(KERN_INFO "%s: hangup waiting for callback ...\n", p->dev->name);
- lp->dtimer = 0;
- lp->dialstate = 4;
- cmd.driver = lp->isdn_device;
- cmd.command = ISDN_CMD_HANGUP;
- cmd.arg = lp->isdn_channel;
- isdn_command(&cmd);
- isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
- }
+ if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
+ isdn_net_hangup(p->dev);
+ else
anymore = 1;
- break;
- default:
- printk(KERN_WARNING "isdn_net: Illegal dialstate %d for device %s\n",
- lp->dialstate, p->dev->name);
+ break;
+ case 11:
+ /* Callback Delay */
+ if (lp->dtimer++ > lp->cbdelay)
+ lp->dialstate = 1;
+ anymore = 1;
+ break;
+ case 12:
+ /* Remote does callback. Hangup after cbdelay, then wait for incoming
+ * call (in state 4).
+ */
+ if (lp->dtimer++ > lp->cbdelay)
+ {
+ printk(KERN_INFO "%s: hangup waiting for callback ...\n", p->dev->name);
+ lp->dtimer = 0;
+ lp->dialstate = 4;
+ cmd.driver = lp->isdn_device;
+ cmd.command = ISDN_CMD_HANGUP;
+ cmd.arg = lp->isdn_channel;
+ isdn_command(&cmd);
+ isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
+ }
+ anymore = 1;
+ break;
+ default:
+ printk(KERN_WARNING "isdn_net: Illegal dialstate %d for device %s\n",
+ lp->dialstate, p->dev->name);
}
p = (isdn_net_dev *) p->next;
}
@@ -839,8 +839,8 @@ isdn_net_hangup(struct net_device *d)
isdn_net_local *slp = ISDN_SLAVE_PRIV(lp);
if (slp->flags & ISDN_NET_CONNECTED) {
printk(KERN_INFO
- "isdn_net: hang up slave %s before %s\n",
- lp->slave->name, d->name);
+ "isdn_net: hang up slave %s before %s\n",
+ lp->slave->name, d->name);
isdn_net_hangup(lp->slave);
}
}
@@ -854,8 +854,8 @@ isdn_net_hangup(struct net_device *d)
/* try if there are generic encap protocol
receiver routines and signal the closure of
the link */
- if( pops && pops -> disconn_ind )
- pops -> disconn_ind(cprot);
+ if (pops && pops->disconn_ind)
+ pops->disconn_ind(cprot);
#endif /* CONFIG_ISDN_X25 */
cmd.driver = lp->isdn_device;
@@ -874,7 +874,7 @@ typedef struct {
} ip_ports;
static void
-isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
+isdn_net_log_skb(struct sk_buff *skb, isdn_net_local *lp)
{
/* hopefully, this was set correctly */
const u_char *p = skb_network_header(skb);
@@ -887,72 +887,72 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
/* This check stolen from 2.1.72 dev_queue_xmit_nit() */
if (p < skb->data || skb->network_header >= skb->tail) {
/* fall back to old isdn_net_log_packet method() */
- char * buf = skb->data;
+ char *buf = skb->data;
printk(KERN_DEBUG "isdn_net: protocol %04x is buggy, dev %s\n", skb->protocol, lp->netdev->dev->name);
p = buf;
proto = ETH_P_IP;
switch (lp->p_encap) {
- case ISDN_NET_ENCAP_IPTYP:
- proto = ntohs(*(__be16 *)&buf[0]);
- p = &buf[2];
- break;
- case ISDN_NET_ENCAP_ETHER:
- proto = ntohs(*(__be16 *)&buf[12]);
- p = &buf[14];
- break;
- case ISDN_NET_ENCAP_CISCOHDLC:
- proto = ntohs(*(__be16 *)&buf[2]);
- p = &buf[4];
- break;
+ case ISDN_NET_ENCAP_IPTYP:
+ proto = ntohs(*(__be16 *)&buf[0]);
+ p = &buf[2];
+ break;
+ case ISDN_NET_ENCAP_ETHER:
+ proto = ntohs(*(__be16 *)&buf[12]);
+ p = &buf[14];
+ break;
+ case ISDN_NET_ENCAP_CISCOHDLC:
+ proto = ntohs(*(__be16 *)&buf[2]);
+ p = &buf[4];
+ break;
#ifdef CONFIG_ISDN_PPP
- case ISDN_NET_ENCAP_SYNCPPP:
- proto = ntohs(skb->protocol);
- p = &buf[IPPP_MAX_HEADER];
- break;
+ case ISDN_NET_ENCAP_SYNCPPP:
+ proto = ntohs(skb->protocol);
+ p = &buf[IPPP_MAX_HEADER];
+ break;
#endif
}
}
data_ofs = ((p[0] & 15) * 4);
switch (proto) {
- case ETH_P_IP:
- switch (p[9]) {
- case 1:
- strcpy(addinfo, " ICMP");
- break;
- case 2:
- strcpy(addinfo, " IGMP");
- break;
- case 4:
- strcpy(addinfo, " IPIP");
- break;
- case 6:
- ipp = (ip_ports *) (&p[data_ofs]);
- sprintf(addinfo, " TCP, port: %d -> %d", ntohs(ipp->source),
- ntohs(ipp->dest));
- break;
- case 8:
- strcpy(addinfo, " EGP");
- break;
- case 12:
- strcpy(addinfo, " PUP");
- break;
- case 17:
- ipp = (ip_ports *) (&p[data_ofs]);
- sprintf(addinfo, " UDP, port: %d -> %d", ntohs(ipp->source),
- ntohs(ipp->dest));
- break;
- case 22:
- strcpy(addinfo, " IDP");
- break;
- }
- printk(KERN_INFO "OPEN: %pI4 -> %pI4%s\n",
- p + 12, p + 16, addinfo);
+ case ETH_P_IP:
+ switch (p[9]) {
+ case 1:
+ strcpy(addinfo, " ICMP");
+ break;
+ case 2:
+ strcpy(addinfo, " IGMP");
+ break;
+ case 4:
+ strcpy(addinfo, " IPIP");
+ break;
+ case 6:
+ ipp = (ip_ports *) (&p[data_ofs]);
+ sprintf(addinfo, " TCP, port: %d -> %d", ntohs(ipp->source),
+ ntohs(ipp->dest));
+ break;
+ case 8:
+ strcpy(addinfo, " EGP");
+ break;
+ case 12:
+ strcpy(addinfo, " PUP");
+ break;
+ case 17:
+ ipp = (ip_ports *) (&p[data_ofs]);
+ sprintf(addinfo, " UDP, port: %d -> %d", ntohs(ipp->source),
+ ntohs(ipp->dest));
break;
- case ETH_P_ARP:
- printk(KERN_INFO "OPEN: ARP %pI4 -> *.*.*.* ?%pI4\n",
- p + 14, p + 24);
+ case 22:
+ strcpy(addinfo, " IDP");
break;
+ }
+ printk(KERN_INFO "OPEN: %pI4 -> %pI4%s\n",
+ p + 12, p + 16, addinfo);
+ break;
+ case ETH_P_ARP:
+ printk(KERN_INFO "OPEN: ARP %pI4 -> *.*.*.* ?%pI4\n",
+ p + 14, p + 24);
+ break;
}
}
@@ -964,7 +964,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb)
{
if (in_irq()) {
- // we can't grab the lock from irq context,
+ // we can't grab the lock from irq context,
// so we just queue the packet
skb_queue_tail(&lp->super_tx_queue, skb);
schedule_work(&lp->tqueue);
@@ -993,12 +993,12 @@ static void isdn_net_softint(struct work_struct *work)
skb = skb_dequeue(&lp->super_tx_queue);
if (!skb)
break;
- isdn_net_writebuf_skb(lp, skb);
+ isdn_net_writebuf_skb(lp, skb);
}
spin_unlock_bh(&lp->xmit_lock);
}
-/*
+/*
* all frames sent from the (net) LL to a HL driver should go via this function
* it's serialized by the caller holding the lp->xmit_lock spinlock
*/
@@ -1024,12 +1024,12 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb)
printk(KERN_WARNING "%s: HL driver queue full\n", lp->netdev->dev->name);
goto error;
}
-
+
lp->transcount += len;
isdn_net_inc_frame_cnt(lp);
return;
- error:
+error:
dev_kfree_skb(skb);
lp->stats.tx_errors++;
@@ -1129,14 +1129,14 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
}
-static void isdn_net_tx_timeout(struct net_device * ndev)
+static void isdn_net_tx_timeout(struct net_device *ndev)
{
isdn_net_local *lp = netdev_priv(ndev);
printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", ndev->name, lp->dialstate);
- if (!lp->dialstate){
+ if (!lp->dialstate) {
lp->stats.tx_errors++;
- /*
+ /*
* There is a certain probability that this currently
* works at all because if we always wake up the interface,
* then upper layer will try to send the next packet
@@ -1149,7 +1149,7 @@ static void isdn_net_tx_timeout(struct net_device * ndev)
*
* actually, this may not matter at all, because ISDN hardware
* should not see transmitter hangs at all IMO
- * changed KERN_DEBUG to KERN_WARNING to find out if this is
+ * changed KERN_DEBUG to KERN_WARNING to find out if this is
* ever called --KG
*/
}
@@ -1167,27 +1167,27 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
isdn_net_local *lp = netdev_priv(ndev);
#ifdef CONFIG_ISDN_X25
- struct concap_proto * cprot = lp -> netdev -> cprot;
+ struct concap_proto *cprot = lp->netdev->cprot;
/* At this point hard_start_xmit() passes control to the encapsulation
protocol (if present).
For X.25 auto-dialing is completly bypassed because:
- It does not conform with the semantics of a reliable datalink
- service as needed by X.25 PLP.
+ service as needed by X.25 PLP.
- I don't want that the interface starts dialing when the network layer
- sends a message which requests to disconnect the lapb link (or if it
- sends any other message not resulting in data transmission).
+ sends a message which requests to disconnect the lapb link (or if it
+ sends any other message not resulting in data transmission).
Instead, dialing will be initiated by the encapsulation protocol entity
when a dl_establish request is received from the upper layer.
*/
- if (cprot && cprot -> pops) {
- int ret = cprot -> pops -> encap_and_xmit ( cprot , skb);
+ if (cprot && cprot->pops) {
+ int ret = cprot->pops->encap_and_xmit(cprot, skb);
if (ret)
netif_stop_queue(ndev);
return ret;
} else
#endif
- /* auto-dialing xmit function */
+ /* auto-dialing xmit function */
{
#ifdef ISDN_DEBUG_NET_DUMP
u_char *buf;
@@ -1209,12 +1209,12 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
if (lp->phone[1]) {
ulong flags;
- if(lp->dialwait_timer <= 0)
- if(lp->dialstarted > 0 && lp->dialtimeout > 0 && time_before(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait))
+ if (lp->dialwait_timer <= 0)
+ if (lp->dialstarted > 0 && lp->dialtimeout > 0 && time_before(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait))
lp->dialwait_timer = lp->dialstarted + lp->dialtimeout + lp->dialwait;
- if(lp->dialwait_timer > 0) {
- if(time_before(jiffies, lp->dialwait_timer)) {
+ if (lp->dialwait_timer > 0) {
+ if (time_before(jiffies, lp->dialwait_timer)) {
isdn_net_unreachable(ndev, skb, "dial rejected: retry-time not reached");
dev_kfree_skb(skb);
return NETDEV_TX_OK;
@@ -1224,26 +1224,26 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
/* Grab a free ISDN-Channel */
spin_lock_irqsave(&dev->lock, flags);
if (((chi =
- isdn_get_free_channel(
- ISDN_USAGE_NET,
- lp->l2_proto,
- lp->l3_proto,
- lp->pre_device,
- lp->pre_channel,
- lp->msn)
- ) < 0) &&
- ((chi =
- isdn_get_free_channel(
- ISDN_USAGE_NET,
- lp->l2_proto,
- lp->l3_proto,
- lp->pre_device,
- lp->pre_channel^1,
- lp->msn)
- ) < 0)) {
+ isdn_get_free_channel(
+ ISDN_USAGE_NET,
+ lp->l2_proto,
+ lp->l3_proto,
+ lp->pre_device,
+ lp->pre_channel,
+ lp->msn)
+ ) < 0) &&
+ ((chi =
+ isdn_get_free_channel(
+ ISDN_USAGE_NET,
+ lp->l2_proto,
+ lp->l3_proto,
+ lp->pre_device,
+ lp->pre_channel^1,
+ lp->msn)
+ ) < 0)) {
spin_unlock_irqrestore(&dev->lock, flags);
isdn_net_unreachable(ndev, skb,
- "No channel");
+ "No channel");
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
@@ -1290,13 +1290,13 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
return NETDEV_TX_OK;
}
} else {
- /* Device is connected to an ISDN channel */
+ /* Device is connected to an ISDN channel */
ndev->trans_start = jiffies;
if (!lp->dialstate) {
/* ISDN connection is established, try sending */
int ret;
ret = (isdn_net_xmit(ndev, skb));
- if(ret) netif_stop_queue(ndev);
+ if (ret) netif_stop_queue(ndev);
return ret;
} else
netif_stop_queue(ndev);
@@ -1313,13 +1313,13 @@ isdn_net_close(struct net_device *dev)
{
struct net_device *p;
#ifdef CONFIG_ISDN_X25
- struct concap_proto * cprot =
- ((isdn_net_local *) netdev_priv(dev))->netdev->cprot;
- /* printk(KERN_DEBUG "isdn_net_close %s\n" , dev-> name ); */
+ struct concap_proto *cprot =
+ ((isdn_net_local *)netdev_priv(dev))->netdev->cprot;
+ /* printk(KERN_DEBUG "isdn_net_close %s\n" , dev-> name); */
#endif
#ifdef CONFIG_ISDN_X25
- if( cprot && cprot -> pops ) cprot -> pops -> close( cprot );
+ if (cprot && cprot->pops) cprot->pops->close(cprot);
#endif
netif_stop_queue(dev);
p = MASTER_TO_SLAVE(dev);
@@ -1327,10 +1327,10 @@ isdn_net_close(struct net_device *dev)
/* If this interface has slaves, stop them also */
while (p) {
#ifdef CONFIG_ISDN_X25
- cprot = ((isdn_net_local *) netdev_priv(p))
- -> netdev -> cprot;
- if( cprot && cprot -> pops )
- cprot -> pops -> close( cprot );
+ cprot = ((isdn_net_local *)netdev_priv(p))
+ ->netdev->cprot;
+ if (cprot && cprot->pops)
+ cprot->pops->close(cprot);
#endif
isdn_net_hangup(p);
p = MASTER_TO_SLAVE(p);
@@ -1405,7 +1405,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev)
}
-/*
+/*
* CISCO HDLC keepalive specific stuff
*/
static struct sk_buff*
@@ -1417,7 +1417,7 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
skb = alloc_skb(hl + len, GFP_ATOMIC);
if (skb)
skb_reserve(skb, hl);
- else
+ else
printk("isdn out of mem at %s:%d!\n", __FILE__, __LINE__);
return skb;
}
@@ -1439,52 +1439,52 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
switch (cmd) {
/* get/set keepalive period */
- case SIOCGKEEPPERIOD:
- len = (unsigned long)sizeof(lp->cisco_keepalive_period);
- if (copy_to_user(ifr->ifr_data,
- &lp->cisco_keepalive_period, len))
- rc = -EFAULT;
- break;
- case SIOCSKEEPPERIOD:
- tmp = lp->cisco_keepalive_period;
- len = (unsigned long)sizeof(lp->cisco_keepalive_period);
- if (copy_from_user(&period, ifr->ifr_data, len))
- rc = -EFAULT;
- if ((period > 0) && (period <= 32767))
- lp->cisco_keepalive_period = period;
- else
- rc = -EINVAL;
- if (!rc && (tmp != lp->cisco_keepalive_period)) {
- expires = (unsigned long)(jiffies +
- lp->cisco_keepalive_period * HZ);
- mod_timer(&lp->cisco_timer, expires);
- printk(KERN_INFO "%s: Keepalive period set "
- "to %d seconds.\n",
- dev->name, lp->cisco_keepalive_period);
- }
- break;
+ case SIOCGKEEPPERIOD:
+ len = (unsigned long)sizeof(lp->cisco_keepalive_period);
+ if (copy_to_user(ifr->ifr_data,
+ &lp->cisco_keepalive_period, len))
+ rc = -EFAULT;
+ break;
+ case SIOCSKEEPPERIOD:
+ tmp = lp->cisco_keepalive_period;
+ len = (unsigned long)sizeof(lp->cisco_keepalive_period);
+ if (copy_from_user(&period, ifr->ifr_data, len))
+ rc = -EFAULT;
+ if ((period > 0) && (period <= 32767))
+ lp->cisco_keepalive_period = period;
+ else
+ rc = -EINVAL;
+ if (!rc && (tmp != lp->cisco_keepalive_period)) {
+ expires = (unsigned long)(jiffies +
+ lp->cisco_keepalive_period * HZ);
+ mod_timer(&lp->cisco_timer, expires);
+ printk(KERN_INFO "%s: Keepalive period set "
+ "to %d seconds.\n",
+ dev->name, lp->cisco_keepalive_period);
+ }
+ break;
/* get/set debugging */
- case SIOCGDEBSERINT:
- len = (unsigned long)sizeof(lp->cisco_debserint);
- if (copy_to_user(ifr->ifr_data,
- &lp->cisco_debserint, len))
- rc = -EFAULT;
- break;
- case SIOCSDEBSERINT:
- len = (unsigned long)sizeof(lp->cisco_debserint);
- if (copy_from_user(&debserint,
- ifr->ifr_data, len))
- rc = -EFAULT;
- if ((debserint >= 0) && (debserint <= 64))
- lp->cisco_debserint = debserint;
- else
- rc = -EINVAL;
- break;
-
- default:
+ case SIOCGDEBSERINT:
+ len = (unsigned long)sizeof(lp->cisco_debserint);
+ if (copy_to_user(ifr->ifr_data,
+ &lp->cisco_debserint, len))
+ rc = -EFAULT;
+ break;
+ case SIOCSDEBSERINT:
+ len = (unsigned long)sizeof(lp->cisco_debserint);
+ if (copy_from_user(&debserint,
+ ifr->ifr_data, len))
+ rc = -EFAULT;
+ if ((debserint >= 0) && (debserint <= 64))
+ lp->cisco_debserint = debserint;
+ else
rc = -EINVAL;
- break;
+ break;
+
+ default:
+ rc = -EINVAL;
+ break;
}
return (rc);
}
@@ -1524,30 +1524,30 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
lp->cisco_myseq++;
myseq_diff = (lp->cisco_myseq - lp->cisco_mineseen);
- if ((lp->cisco_line_state) && ((myseq_diff >= 3)||(myseq_diff <= -3))) {
+ if ((lp->cisco_line_state) && ((myseq_diff >= 3) || (myseq_diff <= -3))) {
/* line up -> down */
lp->cisco_line_state = 0;
- printk (KERN_WARNING
- "UPDOWN: Line protocol on Interface %s,"
- " changed state to down\n", lp->netdev->dev->name);
+ printk(KERN_WARNING
+ "UPDOWN: Line protocol on Interface %s,"
+ " changed state to down\n", lp->netdev->dev->name);
/* should stop routing higher-level data across */
} else if ((!lp->cisco_line_state) &&
- (myseq_diff >= 0) && (myseq_diff <= 2)) {
+ (myseq_diff >= 0) && (myseq_diff <= 2)) {
/* line down -> up */
lp->cisco_line_state = 1;
- printk (KERN_WARNING
- "UPDOWN: Line protocol on Interface %s,"
- " changed state to up\n", lp->netdev->dev->name);
+ printk(KERN_WARNING
+ "UPDOWN: Line protocol on Interface %s,"
+ " changed state to up\n", lp->netdev->dev->name);
/* restart routing higher-level data across */
}
if (lp->cisco_debserint)
- printk (KERN_DEBUG "%s: HDLC "
- "myseq %lu, mineseen %lu%c, yourseen %lu, %s\n",
- lp->netdev->dev->name, last_cisco_myseq, lp->cisco_mineseen,
- ((last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040),
- lp->cisco_yourseq,
- ((lp->cisco_line_state) ? "line up" : "line down"));
+ printk(KERN_DEBUG "%s: HDLC "
+ "myseq %lu, mineseen %lu%c, yourseen %lu, %s\n",
+ lp->netdev->dev->name, last_cisco_myseq, lp->cisco_mineseen,
+ ((last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040),
+ lp->cisco_yourseq,
+ ((lp->cisco_line_state) ? "line up" : "line down"));
skb = isdn_net_ciscohdlck_alloc_skb(lp, 4 + 14);
if (!skb)
@@ -1570,7 +1570,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
isdn_net_write_super(lp, skb);
lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ;
-
+
add_timer(&lp->cisco_timer);
}
@@ -1601,7 +1601,7 @@ isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp)
isdn_net_write_super(lp, skb);
}
-static void
+static void
isdn_net_ciscohdlck_connected(isdn_net_local *lp)
{
lp->cisco_myseq = 0;
@@ -1622,7 +1622,7 @@ isdn_net_ciscohdlck_connected(isdn_net_local *lp)
add_timer(&lp->cisco_timer);
}
-static void
+static void
isdn_net_ciscohdlck_disconnected(isdn_net_local *lp)
{
del_timer(&lp->cisco_timer);
@@ -1703,20 +1703,20 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
printk(KERN_INFO "%s: got slarp reply: remote ip: %pI4, local ip: %pI4 mask: %pI4\n",
lp->netdev->dev->name, addr, &local, mask);
break;
- slarp_reply_out:
+ slarp_reply_out:
printk(KERN_INFO "%s: got invalid slarp reply (%pI4/%pI4) - ignored\n",
lp->netdev->dev->name, addr, mask);
break;
case CISCO_SLARP_KEEPALIVE:
period = (int)((jiffies - lp->cisco_last_slarp_in
- + HZ/2 - 1) / HZ);
+ + HZ / 2 - 1) / HZ);
if (lp->cisco_debserint &&
- (period != lp->cisco_keepalive_period) &&
- lp->cisco_last_slarp_in) {
+ (period != lp->cisco_keepalive_period) &&
+ lp->cisco_last_slarp_in) {
printk(KERN_DEBUG "%s: Keepalive period mismatch - "
- "is %d but should be %d.\n",
- lp->netdev->dev->name, period,
- lp->cisco_keepalive_period);
+ "is %d but should be %d.\n",
+ lp->netdev->dev->name, period,
+ lp->cisco_keepalive_period);
}
lp->cisco_last_slarp_in = jiffies;
my_seq = be32_to_cpup((__be32 *)(p + 0));
@@ -1732,10 +1732,10 @@ static void
isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
{
unsigned char *p;
- u8 addr;
- u8 ctrl;
- u16 type;
-
+ u8 addr;
+ u8 ctrl;
+ u16 type;
+
if (skb->len < 4)
goto out_free;
@@ -1745,7 +1745,7 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
type = be16_to_cpup((__be16 *)(p + 2));
p += 4;
skb_pull(skb, 4);
-
+
if (addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) {
printk(KERN_WARNING "%s: Unknown Cisco addr 0x%02x\n",
lp->netdev->dev->name, addr);
@@ -1764,8 +1764,8 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
case CISCO_TYPE_CDP:
if (lp->cisco_debserint)
printk(KERN_DEBUG "%s: Received CDP packet. use "
- "\"no cdp enable\" on cisco.\n",
- lp->netdev->dev->name);
+ "\"no cdp enable\" on cisco.\n",
+ lp->netdev->dev->name);
goto out_free;
default:
/* no special cisco protocol */
@@ -1774,7 +1774,7 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
return;
}
- out_free:
+out_free:
kfree_skb(skb);
}
@@ -1787,7 +1787,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
isdn_net_local *lp = netdev_priv(ndev);
isdn_net_local *olp = lp; /* original 'lp' */
#ifdef CONFIG_ISDN_X25
- struct concap_proto *cprot = lp -> netdev -> cprot;
+ struct concap_proto *cprot = lp->netdev->cprot;
#endif
lp->transcount += skb->len;
@@ -1809,60 +1809,60 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
isdn_dumppkt("R:", skb->data, skb->len, 40);
#endif
switch (lp->p_encap) {
- case ISDN_NET_ENCAP_ETHER:
- /* Ethernet over ISDN */
- olp->huptimer = 0;
- lp->huptimer = 0;
- skb->protocol = isdn_net_type_trans(skb, ndev);
- break;
- case ISDN_NET_ENCAP_UIHDLC:
- /* HDLC with UI-frame (for ispa with -h1 option) */
- olp->huptimer = 0;
- lp->huptimer = 0;
- skb_pull(skb, 2);
- /* Fall through */
- case ISDN_NET_ENCAP_RAWIP:
- /* RAW-IP without MAC-Header */
- olp->huptimer = 0;
- lp->huptimer = 0;
- skb->protocol = htons(ETH_P_IP);
- break;
- case ISDN_NET_ENCAP_CISCOHDLCK:
- isdn_net_ciscohdlck_receive(lp, skb);
- return;
- case ISDN_NET_ENCAP_CISCOHDLC:
- /* CISCO-HDLC IP with type field and fake I-frame-header */
- skb_pull(skb, 2);
- /* Fall through */
- case ISDN_NET_ENCAP_IPTYP:
- /* IP with type field */
- olp->huptimer = 0;
- lp->huptimer = 0;
- skb->protocol = *(__be16 *)&(skb->data[0]);
- skb_pull(skb, 2);
- if (*(unsigned short *) skb->data == 0xFFFF)
- skb->protocol = htons(ETH_P_802_3);
- break;
+ case ISDN_NET_ENCAP_ETHER:
+ /* Ethernet over ISDN */
+ olp->huptimer = 0;
+ lp->huptimer = 0;
+ skb->protocol = isdn_net_type_trans(skb, ndev);
+ break;
+ case ISDN_NET_ENCAP_UIHDLC:
+ /* HDLC with UI-frame (for ispa with -h1 option) */
+ olp->huptimer = 0;
+ lp->huptimer = 0;
+ skb_pull(skb, 2);
+ /* Fall through */
+ case ISDN_NET_ENCAP_RAWIP:
+ /* RAW-IP without MAC-Header */
+ olp->huptimer = 0;
+ lp->huptimer = 0;
+ skb->protocol = htons(ETH_P_IP);
+ break;
+ case ISDN_NET_ENCAP_CISCOHDLCK:
+ isdn_net_ciscohdlck_receive(lp, skb);
+ return;
+ case ISDN_NET_ENCAP_CISCOHDLC:
+ /* CISCO-HDLC IP with type field and fake I-frame-header */
+ skb_pull(skb, 2);
+ /* Fall through */
+ case ISDN_NET_ENCAP_IPTYP:
+ /* IP with type field */
+ olp->huptimer = 0;
+ lp->huptimer = 0;
+ skb->protocol = *(__be16 *)&(skb->data[0]);
+ skb_pull(skb, 2);
+ if (*(unsigned short *) skb->data == 0xFFFF)
+ skb->protocol = htons(ETH_P_802_3);
+ break;
#ifdef CONFIG_ISDN_PPP
- case ISDN_NET_ENCAP_SYNCPPP:
- /* huptimer is done in isdn_ppp_push_higher */
- isdn_ppp_receive(lp->netdev, olp, skb);
- return;
+ case ISDN_NET_ENCAP_SYNCPPP:
+ /* huptimer is done in isdn_ppp_push_higher */
+ isdn_ppp_receive(lp->netdev, olp, skb);
+ return;
#endif
- default:
+ default:
#ifdef CONFIG_ISDN_X25
- /* try if there are generic sync_device receiver routines */
- if(cprot) if(cprot -> pops)
- if( cprot -> pops -> data_ind){
- cprot -> pops -> data_ind(cprot,skb);
- return;
- };
+ /* try if there are generic sync_device receiver routines */
+ if (cprot) if (cprot->pops)
+ if (cprot->pops->data_ind) {
+ cprot->pops->data_ind(cprot, skb);
+ return;
+ };
#endif /* CONFIG_ISDN_X25 */
- printk(KERN_WARNING "%s: unknown encapsulation, dropping\n",
- lp->netdev->dev->name);
- kfree_skb(skb);
- return;
+ printk(KERN_WARNING "%s: unknown encapsulation, dropping\n",
+ lp->netdev->dev->name);
+ kfree_skb(skb);
+ return;
}
netif_rx(skb);
@@ -1901,51 +1901,51 @@ static int isdn_net_header(struct sk_buff *skb, struct net_device *dev,
{
isdn_net_local *lp = netdev_priv(dev);
unsigned char *p;
- ushort len = 0;
+ int len = 0;
switch (lp->p_encap) {
- case ISDN_NET_ENCAP_ETHER:
- len = eth_header(skb, dev, type, daddr, saddr, plen);
- break;
+ case ISDN_NET_ENCAP_ETHER:
+ len = eth_header(skb, dev, type, daddr, saddr, plen);
+ break;
#ifdef CONFIG_ISDN_PPP
- case ISDN_NET_ENCAP_SYNCPPP:
- /* stick on a fake header to keep fragmentation code happy. */
- len = IPPP_MAX_HEADER;
- skb_push(skb,len);
- break;
+ case ISDN_NET_ENCAP_SYNCPPP:
+ /* stick on a fake header to keep fragmentation code happy. */
+ len = IPPP_MAX_HEADER;
+ skb_push(skb, len);
+ break;
#endif
- case ISDN_NET_ENCAP_RAWIP:
- printk(KERN_WARNING "isdn_net_header called with RAW_IP!\n");
- len = 0;
- break;
- case ISDN_NET_ENCAP_IPTYP:
- /* ethernet type field */
- *((__be16 *)skb_push(skb, 2)) = htons(type);
- len = 2;
- break;
- case ISDN_NET_ENCAP_UIHDLC:
- /* HDLC with UI-Frames (for ispa with -h1 option) */
- *((__be16 *)skb_push(skb, 2)) = htons(0x0103);
- len = 2;
- break;
- case ISDN_NET_ENCAP_CISCOHDLC:
- case ISDN_NET_ENCAP_CISCOHDLCK:
- p = skb_push(skb, 4);
- *(u8 *)(p + 0) = CISCO_ADDR_UNICAST;
- *(u8 *)(p + 1) = CISCO_CTRL;
- *(__be16 *)(p + 2) = cpu_to_be16(type);
- p += 4;
- len = 4;
- break;
+ case ISDN_NET_ENCAP_RAWIP:
+ printk(KERN_WARNING "isdn_net_header called with RAW_IP!\n");
+ len = 0;
+ break;
+ case ISDN_NET_ENCAP_IPTYP:
+ /* ethernet type field */
+ *((__be16 *)skb_push(skb, 2)) = htons(type);
+ len = 2;
+ break;
+ case ISDN_NET_ENCAP_UIHDLC:
+ /* HDLC with UI-Frames (for ispa with -h1 option) */
+ *((__be16 *)skb_push(skb, 2)) = htons(0x0103);
+ len = 2;
+ break;
+ case ISDN_NET_ENCAP_CISCOHDLC:
+ case ISDN_NET_ENCAP_CISCOHDLCK:
+ p = skb_push(skb, 4);
+ *(u8 *)(p + 0) = CISCO_ADDR_UNICAST;
+ *(u8 *)(p + 1) = CISCO_CTRL;
+ *(__be16 *)(p + 2) = cpu_to_be16(type);
+ p += 4;
+ len = 4;
+ break;
#ifdef CONFIG_ISDN_X25
- default:
- /* try if there are generic concap protocol routines */
- if( lp-> netdev -> cprot ){
- printk(KERN_WARNING "isdn_net_header called with concap_proto!\n");
- len = 0;
- break;
- }
+ default:
+ /* try if there are generic concap protocol routines */
+ if (lp->netdev->cprot) {
+ printk(KERN_WARNING "isdn_net_header called with concap_proto!\n");
+ len = 0;
break;
+ }
+ break;
#endif /* CONFIG_ISDN_X25 */
}
return len;
@@ -2045,12 +2045,12 @@ isdn_net_swapbind(int drvidx)
while (p) {
if (p->local->pre_device == drvidx)
switch (p->local->pre_channel) {
- case 0:
- p->local->pre_channel = 1;
- break;
- case 1:
- p->local->pre_channel = 0;
- break;
+ case 0:
+ p->local->pre_channel = 1;
+ break;
+ case 1:
+ p->local->pre_channel = 0;
+ break;
}
p = (isdn_net_dev *) p->next;
}
@@ -2134,7 +2134,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
ematch = wret = swapped = 0;
#ifdef ISDN_DEBUG_NET_ICALL
printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=%d\n", di, ch, idx,
- dev->usage[idx]);
+ dev->usage[idx]);
#endif
while (p) {
int matchret;
@@ -2142,32 +2142,32 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
/* If last check has triggered as binding-swap, revert it */
switch (swapped) {
- case 2:
- isdn_net_swap_usage(idx, sidx);
- /* fall through */
- case 1:
- isdn_net_swapbind(di);
- break;
+ case 2:
+ isdn_net_swap_usage(idx, sidx);
+ /* fall through */
+ case 1:
+ isdn_net_swapbind(di);
+ break;
}
swapped = 0;
- /* check acceptable call types for DOV */
- my_eaz = isdn_map_eaz2msn(lp->msn, di);
- if (si1 == 1) { /* it's a DOV call, check if we allow it */
- if (*my_eaz == 'v' || *my_eaz == 'V' ||
+ /* check acceptable call types for DOV */
+ my_eaz = isdn_map_eaz2msn(lp->msn, di);
+ if (si1 == 1) { /* it's a DOV call, check if we allow it */
+ if (*my_eaz == 'v' || *my_eaz == 'V' ||
*my_eaz == 'b' || *my_eaz == 'B')
- my_eaz++; /* skip to allow a match */
- else
- my_eaz = NULL; /* force non match */
- } else { /* it's a DATA call, check if we allow it */
- if (*my_eaz == 'b' || *my_eaz == 'B')
- my_eaz++; /* skip to allow a match */
- }
- if (my_eaz)
- matchret = isdn_msncmp(eaz, my_eaz);
- else
- matchret = 1;
- if (!matchret)
- ematch = 1;
+ my_eaz++; /* skip to allow a match */
+ else
+ my_eaz = NULL; /* force non match */
+ } else { /* it's a DATA call, check if we allow it */
+ if (*my_eaz == 'b' || *my_eaz == 'B')
+ my_eaz++; /* skip to allow a match */
+ }
+ if (my_eaz)
+ matchret = isdn_msncmp(eaz, my_eaz);
+ else
+ matchret = 1;
+ if (!matchret)
+ ematch = 1;
/* Remember if more numbers eventually can match */
if (matchret > wret)
@@ -2181,8 +2181,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
(USG_NONE(dev->usage[idx]))) || /* and ch. unused or */
((((lp->dialstate == 4) || (lp->dialstate == 12)) && /* if dialing */
(!(lp->flags & ISDN_NET_CALLBACK))) /* but no callback */
- )))
- {
+ )))
+ {
#ifdef ISDN_DEBUG_NET_ICALL
printk(KERN_DEBUG "n_fi: match1, pdev=%d pch=%d\n",
lp->pre_device, lp->pre_channel);
@@ -2312,7 +2312,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
p = (isdn_net_dev *) p->next;
continue;
}
- }
+ }
if (lp->flags & ISDN_NET_CALLBACK) {
int chi;
/*
@@ -2330,18 +2330,18 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
if (lp->phone[1]) {
/* Grab a free ISDN-Channel */
spin_lock_irqsave(&dev->lock, flags);
- if ((chi =
- isdn_get_free_channel(
- ISDN_USAGE_NET,
- lp->l2_proto,
- lp->l3_proto,
- lp->pre_device,
- lp->pre_channel,
- lp->msn)
- ) < 0) {
+ if ((chi =
+ isdn_get_free_channel(
+ ISDN_USAGE_NET,
+ lp->l2_proto,
+ lp->l3_proto,
+ lp->pre_device,
+ lp->pre_channel,
+ lp->msn)
+ ) < 0) {
printk(KERN_WARNING "isdn_net_find_icall: No channel for %s\n",
- p->dev->name);
+ p->dev->name);
spin_unlock_irqrestore(&dev->lock, flags);
return 0;
}
@@ -2363,11 +2363,11 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
return (lp->flags & ISDN_NET_CBHUP) ? 2 : 4;
} else
printk(KERN_WARNING "isdn_net: %s: No phone number\n",
- p->dev->name);
+ p->dev->name);
return 0;
} else {
printk(KERN_DEBUG "%s: call from %s -> %s accepted\n",
- p->dev->name, nr, eaz);
+ p->dev->name, nr, eaz);
/* if this interface is dialing, it does it probably on a different
device, so free this device */
if ((lp->dialstate == 4) || (lp->dialstate == 12)) {
@@ -2377,7 +2377,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
#endif
isdn_net_lp_disconnected(lp);
isdn_free_channel(lp->isdn_device, lp->isdn_channel,
- ISDN_USAGE_NET);
+ ISDN_USAGE_NET);
}
spin_lock_irqsave(&dev->lock, flags);
dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE;
@@ -2414,7 +2414,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
/* If none of configured EAZ/MSN matched and not verbose, be silent */
if (!ematch || dev->net_verbose)
printk(KERN_INFO "isdn_net: call from %s -> %d %s ignored\n", nr, di, eaz);
- return (wret == 2)?5:0;
+ return (wret == 2) ? 5 : 0;
}
/*
@@ -2439,7 +2439,7 @@ isdn_net_findif(char *name)
* from isdn_net_start_xmit().
*/
static int
-isdn_net_force_dial_lp(isdn_net_local * lp)
+isdn_net_force_dial_lp(isdn_net_local *lp)
{
if ((!(lp->flags & ISDN_NET_CONNECTED)) && !lp->dialstate) {
int chi;
@@ -2449,14 +2449,14 @@ isdn_net_force_dial_lp(isdn_net_local * lp)
/* Grab a free ISDN-Channel */
spin_lock_irqsave(&dev->lock, flags);
if ((chi = isdn_get_free_channel(
- ISDN_USAGE_NET,
- lp->l2_proto,
- lp->l3_proto,
- lp->pre_device,
- lp->pre_channel,
- lp->msn)) < 0) {
+ ISDN_USAGE_NET,
+ lp->l2_proto,
+ lp->l3_proto,
+ lp->pre_device,
+ lp->pre_channel,
+ lp->msn)) < 0) {
printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n",
- lp->netdev->dev->name);
+ lp->netdev->dev->name);
spin_unlock_irqrestore(&dev->lock, flags);
return -EAGAIN;
}
@@ -2487,7 +2487,7 @@ isdn_net_force_dial_lp(isdn_net_local * lp)
* themselves.
*/
int
-isdn_net_dial_req(isdn_net_local * lp)
+isdn_net_dial_req(isdn_net_local *lp)
{
/* is there a better error code? */
if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) return -EBUSY;
@@ -2531,7 +2531,7 @@ static void _isdn_setup(struct net_device *dev)
ether_setup(dev);
/* Setup the generic properties */
- dev->flags = IFF_NOARP|IFF_POINTOPOINT;
+ dev->flags = IFF_NOARP | IFF_POINTOPOINT;
/* isdn prepends a header in the tx path, can't share skbs */
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
@@ -2655,7 +2655,7 @@ isdn_net_newslave(char *parm)
if (n->local->master)
return NULL;
/* Master must not be started yet */
- if (isdn_net_device_started(n))
+ if (isdn_net_device_started(n))
return NULL;
return (isdn_net_new(newname, n->dev));
}
@@ -2669,7 +2669,7 @@ isdn_net_newslave(char *parm)
* setup first, if only selected parameters are to be changed.
*/
int
-isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
+isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
{
isdn_net_dev *p = isdn_net_findif(cfg->name);
ulong features;
@@ -2692,9 +2692,9 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
printk(KERN_WARNING "isdn_net: No driver with selected features\n");
return -ENODEV;
}
- if (lp->p_encap != cfg->p_encap){
+ if (lp->p_encap != cfg->p_encap) {
#ifdef CONFIG_ISDN_X25
- struct concap_proto * cprot = p -> cprot;
+ struct concap_proto *cprot = p->cprot;
#endif
if (isdn_net_device_started(p)) {
printk(KERN_WARNING "%s: cannot change encap when if is up\n",
@@ -2702,24 +2702,24 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
return -EBUSY;
}
#ifdef CONFIG_ISDN_X25
- if( cprot && cprot -> pops )
- cprot -> pops -> proto_del ( cprot );
- p -> cprot = NULL;
- lp -> dops = NULL;
+ if (cprot && cprot->pops)
+ cprot->pops->proto_del(cprot);
+ p->cprot = NULL;
+ lp->dops = NULL;
/* ... , prepare for configuration of new one ... */
- switch ( cfg -> p_encap ){
+ switch (cfg->p_encap) {
case ISDN_NET_ENCAP_X25IFACE:
- lp -> dops = &isdn_concap_reliable_dl_dops;
+ lp->dops = &isdn_concap_reliable_dl_dops;
}
/* ... and allocate new one ... */
- p -> cprot = isdn_concap_new( cfg -> p_encap );
+ p->cprot = isdn_concap_new(cfg->p_encap);
/* p -> cprot == NULL now if p_encap is not supported
by means of the concap_proto mechanism */
/* the protocol is not configured yet; this will
happen later when isdn_net_reset() is called */
#endif
}
- switch ( cfg->p_encap ) {
+ switch (cfg->p_encap) {
case ISDN_NET_ENCAP_SYNCPPP:
#ifndef CONFIG_ISDN_PPP
printk(KERN_WARNING "%s: SyncPPP support not configured\n",
@@ -2743,8 +2743,8 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
case ISDN_NET_ENCAP_CISCOHDLCK:
break;
default:
- if( cfg->p_encap >= 0 &&
- cfg->p_encap <= ISDN_NET_ENCAP_MAX_ENCAP )
+ if (cfg->p_encap >= 0 &&
+ cfg->p_encap <= ISDN_NET_ENCAP_MAX_ENCAP)
break;
printk(KERN_WARNING
"%s: encapsulation protocol %d not supported\n",
@@ -2754,10 +2754,10 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
if (strlen(cfg->drvid)) {
/* A bind has been requested ... */
char *c,
- *e;
+ *e;
if (strnlen(cfg->drvid, sizeof(cfg->drvid)) ==
- sizeof(cfg->drvid))
+ sizeof(cfg->drvid))
return -EINVAL;
drvidx = -1;
chidx = -1;
@@ -2789,8 +2789,8 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
/* If binding is exclusive, try to grab the channel */
spin_lock_irqsave(&dev->lock, flags);
if ((i = isdn_get_free_channel(ISDN_USAGE_NET,
- lp->l2_proto, lp->l3_proto, drvidx,
- chidx, lp->msn)) < 0) {
+ lp->l2_proto, lp->l3_proto, drvidx,
+ chidx, lp->msn)) < 0) {
/* Grab failed, because desired channel is in use */
lp->exclusive = -1;
spin_unlock_irqrestore(&dev->lock, flags);
@@ -2834,23 +2834,23 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
else
lp->flags &= ~ISDN_NET_CBHUP;
switch (cfg->callback) {
- case 0:
- lp->flags &= ~(ISDN_NET_CALLBACK | ISDN_NET_CBOUT);
- break;
- case 1:
- lp->flags |= ISDN_NET_CALLBACK;
- lp->flags &= ~ISDN_NET_CBOUT;
- break;
- case 2:
- lp->flags |= ISDN_NET_CBOUT;
- lp->flags &= ~ISDN_NET_CALLBACK;
- break;
+ case 0:
+ lp->flags &= ~(ISDN_NET_CALLBACK | ISDN_NET_CBOUT);
+ break;
+ case 1:
+ lp->flags |= ISDN_NET_CALLBACK;
+ lp->flags &= ~ISDN_NET_CBOUT;
+ break;
+ case 2:
+ lp->flags |= ISDN_NET_CBOUT;
+ lp->flags &= ~ISDN_NET_CALLBACK;
+ break;
}
lp->flags &= ~ISDN_NET_DIALMODE_MASK; /* first all bits off */
if (cfg->dialmode && !(cfg->dialmode & ISDN_NET_DIALMODE_MASK)) {
/* old isdnctrl version, where only 0 or 1 is given */
printk(KERN_WARNING
- "Old isdnctrl version detected! Please update.\n");
+ "Old isdnctrl version detected! Please update.\n");
lp->flags |= ISDN_NET_DM_OFF; /* turn on `off' bit */
}
else {
@@ -2871,13 +2871,13 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
if (cfg->p_encap != lp->p_encap) {
if (cfg->p_encap == ISDN_NET_ENCAP_RAWIP) {
p->dev->header_ops = NULL;
- p->dev->flags = IFF_NOARP|IFF_POINTOPOINT;
+ p->dev->flags = IFF_NOARP | IFF_POINTOPOINT;
} else {
p->dev->header_ops = &isdn_header_ops;
if (cfg->p_encap == ISDN_NET_ENCAP_ETHER)
p->dev->flags = IFF_BROADCAST | IFF_MULTICAST;
else
- p->dev->flags = IFF_NOARP|IFF_POINTOPOINT;
+ p->dev->flags = IFF_NOARP | IFF_POINTOPOINT;
}
}
lp->p_encap = cfg->p_encap;
@@ -2890,7 +2890,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
* Perform get-interface-parameters.ioctl
*/
int
-isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
+isdn_net_getcfg(isdn_net_ioctl_cfg *cfg)
{
isdn_net_dev *p = isdn_net_findif(cfg->name);
@@ -2924,7 +2924,7 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
cfg->triggercps = lp->triggercps;
cfg->slavedelay = lp->slavedelay / HZ;
cfg->chargeint = (lp->hupflags & ISDN_CHARGEHUP) ?
- (lp->chargeint / HZ) : 0;
+ (lp->chargeint / HZ) : 0;
cfg->pppbind = lp->pppbind;
cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1;
cfg->dialwait = lp->dialwait / HZ;
@@ -2951,7 +2951,7 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
* Add a phone-number to an interface.
*/
int
-isdn_net_addphone(isdn_net_ioctl_phone * phone)
+isdn_net_addphone(isdn_net_ioctl_phone *phone)
{
isdn_net_dev *p = isdn_net_findif(phone->name);
isdn_net_phone *n;
@@ -2972,7 +2972,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone)
* This might sleep and must be called with the isdn semaphore down.
*/
int
-isdn_net_getphones(isdn_net_ioctl_phone * phone, char __user *phones)
+isdn_net_getphones(isdn_net_ioctl_phone *phone, char __user *phones)
{
isdn_net_dev *p = isdn_net_findif(phone->name);
int inout = phone->outgoing & 1;
@@ -3015,15 +3015,15 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer)
/*
* Theoretical race: while this executes, the remote number might
* become invalid (hang up) or change (new connection), resulting
- * in (partially) wrong number copied to user. This race
+ * in (partially) wrong number copied to user. This race
* currently ignored.
*/
ch = p->local->isdn_channel;
dv = p->local->isdn_device;
- if(ch < 0 && dv < 0)
+ if (ch < 0 && dv < 0)
return -ENOTCONN;
idx = isdn_dc2minor(dv, ch);
- if (idx <0 )
+ if (idx < 0)
return -ENODEV;
/* for pre-bound channels, we need this extra check */
if (strncmp(dev->num[idx], "???", 3) == 0)
@@ -3038,7 +3038,7 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer)
* Delete a phone-number from an interface.
*/
int
-isdn_net_delphone(isdn_net_ioctl_phone * phone)
+isdn_net_delphone(isdn_net_ioctl_phone *phone)
{
isdn_net_dev *p = isdn_net_findif(phone->name);
int inout = phone->outgoing & 1;
@@ -3071,7 +3071,7 @@ isdn_net_delphone(isdn_net_ioctl_phone * phone)
* Delete all phone-numbers of an interface.
*/
static int
-isdn_net_rmallphone(isdn_net_dev * p)
+isdn_net_rmallphone(isdn_net_dev *p)
{
isdn_net_phone *n;
isdn_net_phone *m;
@@ -3118,7 +3118,7 @@ isdn_net_force_hangup(char *name)
* Helper-function for isdn_net_rm: Do the real work.
*/
static int
-isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
+isdn_net_realrm(isdn_net_dev *p, isdn_net_dev *q)
{
u_long flags;
@@ -3126,8 +3126,8 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
return -EBUSY;
}
#ifdef CONFIG_ISDN_X25
- if( p -> cprot && p -> cprot -> pops )
- p -> cprot -> pops -> proto_del ( p -> cprot );
+ if (p->cprot && p->cprot->pops)
+ p->cprot->pops->proto_del(p->cprot);
#endif
/* Free all phone-entries */
isdn_net_rmallphone(p);
diff --git a/drivers/isdn/i4l/isdn_net.h b/drivers/isdn/i4l/isdn_net.h
index 7511f08effa5..cca6d68da171 100644
--- a/drivers/isdn/i4l/isdn_net.h
+++ b/drivers/isdn/i4l/isdn_net.h
@@ -11,7 +11,7 @@
*
*/
- /* Definitions for hupflags: */
+/* Definitions for hupflags: */
#define ISDN_WAITCHARGE 1 /* did not get a charge info yet */
#define ISDN_HAVECHARGE 2 /* We know a charge info */
#define ISDN_CHARGEHUP 4 /* We want to use the charge mechanism */
@@ -58,8 +58,8 @@ extern void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb);
#define ISDN_MASTER_PRIV(lp) ((isdn_net_local *) netdev_priv(lp->master))
#define ISDN_SLAVE_PRIV(lp) ((isdn_net_local *) netdev_priv(lp->slave))
-#define MASTER_TO_SLAVE(master) \
- (((isdn_net_local *) netdev_priv(master))->slave)
+#define MASTER_TO_SLAVE(master) \
+ (((isdn_net_local *) netdev_priv(master))->slave)
/*
* is this particular channel busy?
@@ -68,7 +68,7 @@ static __inline__ int isdn_net_lp_busy(isdn_net_local *lp)
{
if (atomic_read(&lp->frame_cnt) < ISDN_NET_MAX_QUEUE_LENGTH)
return 0;
- else
+ else
return 1;
}
@@ -76,7 +76,7 @@ static __inline__ int isdn_net_lp_busy(isdn_net_local *lp)
* For the given net device, this will get a non-busy channel out of the
* corresponding bundle. The returned channel is locked.
*/
-static __inline__ isdn_net_local * isdn_net_get_locked_lp(isdn_net_dev *nd)
+static __inline__ isdn_net_local *isdn_net_get_locked_lp(isdn_net_dev *nd)
{
unsigned long flags;
isdn_net_local *lp;
@@ -149,4 +149,3 @@ static __inline__ void isdn_net_rm_from_bundle(isdn_net_local *lp)
// __func__, master_lp->netdev->queue);
spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags);
}
-
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index 1b002b0002a4..a1e760150821 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -28,18 +28,18 @@
/* Prototypes */
static int isdn_ppp_fill_rq(unsigned char *buf, int len, int proto, int slot);
static int isdn_ppp_closewait(int slot);
-static void isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp,
+static void isdn_ppp_push_higher(isdn_net_dev *net_dev, isdn_net_local *lp,
struct sk_buff *skb, int proto);
static int isdn_ppp_if_get_unit(char *namebuf);
-static int isdn_ppp_set_compressor(struct ippp_struct *is,struct isdn_ppp_comp_data *);
+static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_data *);
static struct sk_buff *isdn_ppp_decompress(struct sk_buff *,
- struct ippp_struct *,struct ippp_struct *,int *proto);
-static void isdn_ppp_receive_ccp(isdn_net_dev * net_dev, isdn_net_local * lp,
- struct sk_buff *skb,int proto);
-static struct sk_buff *isdn_ppp_compress(struct sk_buff *skb_in,int *proto,
- struct ippp_struct *is,struct ippp_struct *master,int type);
+ struct ippp_struct *, struct ippp_struct *, int *proto);
+static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
+ struct sk_buff *skb, int proto);
+static struct sk_buff *isdn_ppp_compress(struct sk_buff *skb_in, int *proto,
+ struct ippp_struct *is, struct ippp_struct *master, int type);
static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
- struct sk_buff *skb);
+ struct sk_buff *skb);
/* New CCP stuff */
static void isdn_ppp_ccp_kickup(struct ippp_struct *is);
@@ -52,7 +52,7 @@ static void isdn_ppp_ccp_reset_free_state(struct ippp_struct *is,
unsigned char id);
static void isdn_ppp_ccp_timer_callback(unsigned long closure);
static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_struct *is,
- unsigned char id);
+ unsigned char id);
static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
struct isdn_ppp_resetparams *rp);
static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
@@ -61,17 +61,17 @@ static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
#ifdef CONFIG_ISDN_MPP
-static ippp_bundle * isdn_ppp_bundle_arr = NULL;
-
+static ippp_bundle *isdn_ppp_bundle_arr = NULL;
+
static int isdn_ppp_mp_bundle_array_init(void);
-static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to );
-static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
- struct sk_buff *skb);
-static void isdn_ppp_mp_cleanup( isdn_net_local * lp );
+static int isdn_ppp_mp_init(isdn_net_local *lp, ippp_bundle *add_to);
+static void isdn_ppp_mp_receive(isdn_net_dev *net_dev, isdn_net_local *lp,
+ struct sk_buff *skb);
+static void isdn_ppp_mp_cleanup(isdn_net_local *lp);
static int isdn_ppp_bundle(struct ippp_struct *, int unit);
#endif /* CONFIG_ISDN_MPP */
-
+
char *isdn_ppp_revision = "$Revision: 1.1.2.3 $";
static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS];
@@ -82,11 +82,11 @@ static struct isdn_ppp_compressor *ipc_head = NULL;
* frame log (debug)
*/
static void
-isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,int unit,int slot)
+isdn_ppp_frame_log(char *info, char *data, int len, int maxlen, int unit, int slot)
{
int cnt,
- j,
- i;
+ j,
+ i;
char buf[80];
if (len < maxlen)
@@ -94,8 +94,8 @@ isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,int unit,int slot
for (i = 0, cnt = 0; cnt < maxlen; i++) {
for (j = 0; j < 16 && cnt < maxlen; j++, cnt++)
- sprintf(buf + j * 3, "%02x ", (unsigned char) data[cnt]);
- printk(KERN_DEBUG "[%d/%d].%s[%d]: %s\n",unit,slot, info, i, buf);
+ sprintf(buf + j * 3, "%02x ", (unsigned char)data[cnt]);
+ printk(KERN_DEBUG "[%d/%d].%s[%d]: %s\n", unit, slot, info, i, buf);
}
}
@@ -105,13 +105,13 @@ isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,int unit,int slot
* in this case we bind another lp to the master device
*/
int
-isdn_ppp_free(isdn_net_local * lp)
+isdn_ppp_free(isdn_net_local *lp)
{
struct ippp_struct *is;
if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
- __func__, lp->ppp_slot);
+ __func__, lp->ppp_slot);
return 0;
}
@@ -128,7 +128,7 @@ isdn_ppp_free(isdn_net_local * lp)
#endif /* CONFIG_ISDN_MPP */
if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n",
- __func__, lp->ppp_slot);
+ __func__, lp->ppp_slot);
return 0;
}
is = ippp_table[lp->ppp_slot];
@@ -153,7 +153,7 @@ isdn_ppp_free(isdn_net_local * lp)
* no additional lock is needed
*/
int
-isdn_ppp_bind(isdn_net_local * lp)
+isdn_ppp_bind(isdn_net_local *lp)
{
int i;
int unit = 0;
@@ -195,11 +195,11 @@ isdn_ppp_bind(isdn_net_local * lp)
unit = isdn_ppp_if_get_unit(lp->netdev->dev->name);
if (unit < 0) {
printk(KERN_ERR "isdn_ppp_bind: illegal interface name %s.\n",
- lp->netdev->dev->name);
+ lp->netdev->dev->name);
retval = -1;
goto out;
}
-
+
lp->ppp_slot = i;
is = ippp_table[i];
is->lp = lp;
@@ -213,7 +213,7 @@ isdn_ppp_bind(isdn_net_local * lp)
retval = lp->ppp_slot;
- out:
+out:
return retval;
}
@@ -223,11 +223,11 @@ isdn_ppp_bind(isdn_net_local * lp)
*/
void
-isdn_ppp_wakeup_daemon(isdn_net_local * lp)
+isdn_ppp_wakeup_daemon(isdn_net_local *lp)
{
if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
- __func__, lp->ppp_slot);
+ __func__, lp->ppp_slot);
return;
}
ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK;
@@ -246,7 +246,7 @@ isdn_ppp_closewait(int slot)
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: slot(%d) out of range\n",
- __func__, slot);
+ __func__, slot);
return 0;
}
is = ippp_table[slot];
@@ -289,7 +289,7 @@ isdn_ppp_open(int min, struct file *file)
return -EBUSY;
}
is = file->private_data = ippp_table[slot];
-
+
printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n",
slot, min, is->state);
@@ -385,21 +385,21 @@ isdn_ppp_release(int min, struct file *file)
#endif
/* TODO: if this was the previous master: link the stuff to the new master */
- if(is->comp_stat)
+ if (is->comp_stat)
is->compressor->free(is->comp_stat);
- if(is->link_comp_stat)
+ if (is->link_comp_stat)
is->link_compressor->free(is->link_comp_stat);
- if(is->link_decomp_stat)
+ if (is->link_decomp_stat)
is->link_decompressor->free(is->link_decomp_stat);
- if(is->decomp_stat)
+ if (is->decomp_stat)
is->decompressor->free(is->decomp_stat);
- is->compressor = is->link_compressor = NULL;
- is->decompressor = is->link_decompressor = NULL;
+ is->compressor = is->link_compressor = NULL;
+ is->decompressor = is->link_decompressor = NULL;
is->comp_stat = is->link_comp_stat = NULL;
- is->decomp_stat = is->link_decomp_stat = NULL;
+ is->decomp_stat = is->link_decomp_stat = NULL;
/* Clean up if necessary */
- if(is->reset)
+ if (is->reset)
isdn_ppp_ccp_reset_free(is);
/* this slot is ready for new connections */
@@ -423,9 +423,9 @@ get_arg(void __user *b, void *val, int len)
* set arg .. ioctl helper
*/
static int
-set_arg(void __user *b, void *val,int len)
+set_arg(void __user *b, void *val, int len)
{
- if(len <= 0)
+ if (len <= 0)
len = sizeof(void *);
if (copy_to_user(b, val, len))
return -EFAULT;
@@ -471,7 +471,7 @@ int
isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
{
unsigned long val;
- int r,i,j;
+ int r, i, j;
struct ippp_struct *is;
isdn_net_local *lp;
struct isdn_ppp_comp_data data;
@@ -487,177 +487,177 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
return -EINVAL;
switch (cmd) {
- case PPPIOCBUNDLE:
+ case PPPIOCBUNDLE:
#ifdef CONFIG_ISDN_MPP
- if (!(is->state & IPPP_CONNECT))
- return -EINVAL;
- if ((r = get_arg(argp, &val, sizeof(val) )))
- return r;
- printk(KERN_DEBUG "iPPP-bundle: minor: %d, slave unit: %d, master unit: %d\n",
- (int) min, (int) is->unit, (int) val);
- return isdn_ppp_bundle(is, val);
+ if (!(is->state & IPPP_CONNECT))
+ return -EINVAL;
+ if ((r = get_arg(argp, &val, sizeof(val))))
+ return r;
+ printk(KERN_DEBUG "iPPP-bundle: minor: %d, slave unit: %d, master unit: %d\n",
+ (int) min, (int) is->unit, (int) val);
+ return isdn_ppp_bundle(is, val);
#else
- return -1;
+ return -1;
#endif
- break;
- case PPPIOCGUNIT: /* get ppp/isdn unit number */
- if ((r = set_arg(argp, &is->unit, sizeof(is->unit) )))
- return r;
- break;
- case PPPIOCGIFNAME:
- if(!lp)
- return -EINVAL;
- if ((r = set_arg(argp, lp->netdev->dev->name,
- strlen(lp->netdev->dev->name))))
- return r;
- break;
- case PPPIOCGMPFLAGS: /* get configuration flags */
- if ((r = set_arg(argp, &is->mpppcfg, sizeof(is->mpppcfg) )))
- return r;
- break;
- case PPPIOCSMPFLAGS: /* set configuration flags */
- if ((r = get_arg(argp, &val, sizeof(val) )))
- return r;
- is->mpppcfg = val;
- break;
- case PPPIOCGFLAGS: /* get configuration flags */
- if ((r = set_arg(argp, &is->pppcfg,sizeof(is->pppcfg) )))
- return r;
- break;
- case PPPIOCSFLAGS: /* set configuration flags */
- if ((r = get_arg(argp, &val, sizeof(val) ))) {
- return r;
- }
- if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) {
- if (lp) {
- /* OK .. we are ready to send buffers */
- is->pppcfg = val; /* isdn_ppp_xmit test for SC_ENABLE_IP !!! */
- netif_wake_queue(lp->netdev->dev);
- break;
- }
- }
- is->pppcfg = val;
- break;
- case PPPIOCGIDLE: /* get idle time information */
+ break;
+ case PPPIOCGUNIT: /* get ppp/isdn unit number */
+ if ((r = set_arg(argp, &is->unit, sizeof(is->unit))))
+ return r;
+ break;
+ case PPPIOCGIFNAME:
+ if (!lp)
+ return -EINVAL;
+ if ((r = set_arg(argp, lp->netdev->dev->name,
+ strlen(lp->netdev->dev->name))))
+ return r;
+ break;
+ case PPPIOCGMPFLAGS: /* get configuration flags */
+ if ((r = set_arg(argp, &is->mpppcfg, sizeof(is->mpppcfg))))
+ return r;
+ break;
+ case PPPIOCSMPFLAGS: /* set configuration flags */
+ if ((r = get_arg(argp, &val, sizeof(val))))
+ return r;
+ is->mpppcfg = val;
+ break;
+ case PPPIOCGFLAGS: /* get configuration flags */
+ if ((r = set_arg(argp, &is->pppcfg, sizeof(is->pppcfg))))
+ return r;
+ break;
+ case PPPIOCSFLAGS: /* set configuration flags */
+ if ((r = get_arg(argp, &val, sizeof(val)))) {
+ return r;
+ }
+ if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) {
if (lp) {
- struct ppp_idle pidle;
- pidle.xmit_idle = pidle.recv_idle = lp->huptimer;
- if ((r = set_arg(argp, &pidle,sizeof(struct ppp_idle))))
- return r;
+ /* OK .. we are ready to send buffers */
+ is->pppcfg = val; /* isdn_ppp_xmit test for SC_ENABLE_IP !!! */
+ netif_wake_queue(lp->netdev->dev);
+ break;
}
- break;
- case PPPIOCSMRU: /* set receive unit size for PPP */
- if ((r = get_arg(argp, &val, sizeof(val) )))
- return r;
- is->mru = val;
- break;
- case PPPIOCSMPMRU:
- break;
- case PPPIOCSMPMTU:
- break;
- case PPPIOCSMAXCID: /* set the maximum compression slot id */
- if ((r = get_arg(argp, &val, sizeof(val) )))
+ }
+ is->pppcfg = val;
+ break;
+ case PPPIOCGIDLE: /* get idle time information */
+ if (lp) {
+ struct ppp_idle pidle;
+ pidle.xmit_idle = pidle.recv_idle = lp->huptimer;
+ if ((r = set_arg(argp, &pidle, sizeof(struct ppp_idle))))
return r;
- val++;
- if (is->maxcid != val) {
+ }
+ break;
+ case PPPIOCSMRU: /* set receive unit size for PPP */
+ if ((r = get_arg(argp, &val, sizeof(val))))
+ return r;
+ is->mru = val;
+ break;
+ case PPPIOCSMPMRU:
+ break;
+ case PPPIOCSMPMTU:
+ break;
+ case PPPIOCSMAXCID: /* set the maximum compression slot id */
+ if ((r = get_arg(argp, &val, sizeof(val))))
+ return r;
+ val++;
+ if (is->maxcid != val) {
#ifdef CONFIG_ISDN_PPP_VJ
- struct slcompress *sltmp;
+ struct slcompress *sltmp;
#endif
- if (is->debug & 0x1)
- printk(KERN_DEBUG "ippp, ioctl: changed MAXCID to %ld\n", val);
- is->maxcid = val;
+ if (is->debug & 0x1)
+ printk(KERN_DEBUG "ippp, ioctl: changed MAXCID to %ld\n", val);
+ is->maxcid = val;
#ifdef CONFIG_ISDN_PPP_VJ
- sltmp = slhc_init(16, val);
- if (!sltmp) {
- printk(KERN_ERR "ippp, can't realloc slhc struct\n");
- return -ENOMEM;
- }
- if (is->slcomp)
- slhc_free(is->slcomp);
- is->slcomp = sltmp;
-#endif
- }
- break;
- case PPPIOCGDEBUG:
- if ((r = set_arg(argp, &is->debug, sizeof(is->debug) )))
- return r;
- break;
- case PPPIOCSDEBUG:
- if ((r = get_arg(argp, &val, sizeof(val) )))
- return r;
- is->debug = val;
- break;
- case PPPIOCGCOMPRESSORS:
- {
- unsigned long protos[8] = {0,};
- struct isdn_ppp_compressor *ipc = ipc_head;
- while(ipc) {
- j = ipc->num / (sizeof(long)*8);
- i = ipc->num % (sizeof(long)*8);
- if(j < 8)
- protos[j] |= (0x1<<i);
- ipc = ipc->next;
- }
- if ((r = set_arg(argp,protos,8*sizeof(long) )))
- return r;
+ sltmp = slhc_init(16, val);
+ if (!sltmp) {
+ printk(KERN_ERR "ippp, can't realloc slhc struct\n");
+ return -ENOMEM;
}
- break;
- case PPPIOCSCOMPRESSOR:
- if ((r = get_arg(argp, &data, sizeof(struct isdn_ppp_comp_data))))
- return r;
- return isdn_ppp_set_compressor(is, &data);
- case PPPIOCGCALLINFO:
- {
- struct pppcallinfo pci;
- memset((char *) &pci,0,sizeof(struct pppcallinfo));
- if(lp)
- {
- strncpy(pci.local_num,lp->msn,63);
- if(lp->dial) {
- strncpy(pci.remote_num,lp->dial->num,63);
- }
- pci.charge_units = lp->charge;
- if(lp->outgoing)
- pci.calltype = CALLTYPE_OUTGOING;
- else
- pci.calltype = CALLTYPE_INCOMING;
- if(lp->flags & ISDN_NET_CALLBACK)
- pci.calltype |= CALLTYPE_CALLBACK;
- }
- return set_arg(argp,&pci,sizeof(struct pppcallinfo));
+ if (is->slcomp)
+ slhc_free(is->slcomp);
+ is->slcomp = sltmp;
+#endif
+ }
+ break;
+ case PPPIOCGDEBUG:
+ if ((r = set_arg(argp, &is->debug, sizeof(is->debug))))
+ return r;
+ break;
+ case PPPIOCSDEBUG:
+ if ((r = get_arg(argp, &val, sizeof(val))))
+ return r;
+ is->debug = val;
+ break;
+ case PPPIOCGCOMPRESSORS:
+ {
+ unsigned long protos[8] = {0,};
+ struct isdn_ppp_compressor *ipc = ipc_head;
+ while (ipc) {
+ j = ipc->num / (sizeof(long) * 8);
+ i = ipc->num % (sizeof(long) * 8);
+ if (j < 8)
+ protos[j] |= (0x1 << i);
+ ipc = ipc->next;
+ }
+ if ((r = set_arg(argp, protos, 8 * sizeof(long))))
+ return r;
+ }
+ break;
+ case PPPIOCSCOMPRESSOR:
+ if ((r = get_arg(argp, &data, sizeof(struct isdn_ppp_comp_data))))
+ return r;
+ return isdn_ppp_set_compressor(is, &data);
+ case PPPIOCGCALLINFO:
+ {
+ struct pppcallinfo pci;
+ memset((char *)&pci, 0, sizeof(struct pppcallinfo));
+ if (lp)
+ {
+ strncpy(pci.local_num, lp->msn, 63);
+ if (lp->dial) {
+ strncpy(pci.remote_num, lp->dial->num, 63);
}
+ pci.charge_units = lp->charge;
+ if (lp->outgoing)
+ pci.calltype = CALLTYPE_OUTGOING;
+ else
+ pci.calltype = CALLTYPE_INCOMING;
+ if (lp->flags & ISDN_NET_CALLBACK)
+ pci.calltype |= CALLTYPE_CALLBACK;
+ }
+ return set_arg(argp, &pci, sizeof(struct pppcallinfo));
+ }
#ifdef CONFIG_IPPP_FILTER
- case PPPIOCSPASS:
- {
- struct sock_filter *code;
- int len = get_filter(argp, &code);
- if (len < 0)
- return len;
- kfree(is->pass_filter);
- is->pass_filter = code;
- is->pass_len = len;
- break;
- }
- case PPPIOCSACTIVE:
- {
- struct sock_filter *code;
- int len = get_filter(argp, &code);
- if (len < 0)
- return len;
- kfree(is->active_filter);
- is->active_filter = code;
- is->active_len = len;
- break;
- }
+ case PPPIOCSPASS:
+ {
+ struct sock_filter *code;
+ int len = get_filter(argp, &code);
+ if (len < 0)
+ return len;
+ kfree(is->pass_filter);
+ is->pass_filter = code;
+ is->pass_len = len;
+ break;
+ }
+ case PPPIOCSACTIVE:
+ {
+ struct sock_filter *code;
+ int len = get_filter(argp, &code);
+ if (len < 0)
+ return len;
+ kfree(is->active_filter);
+ is->active_filter = code;
+ is->active_len = len;
+ break;
+ }
#endif /* CONFIG_IPPP_FILTER */
- default:
- break;
+ default:
+ break;
}
return 0;
}
unsigned int
-isdn_ppp_poll(struct file *file, poll_table * wait)
+isdn_ppp_poll(struct file *file, poll_table *wait)
{
u_int mask;
struct ippp_buf_queue *bf, *bl;
@@ -668,13 +668,13 @@ isdn_ppp_poll(struct file *file, poll_table * wait)
if (is->debug & 0x2)
printk(KERN_DEBUG "isdn_ppp_poll: minor: %d\n",
- iminor(file->f_path.dentry->d_inode));
+ iminor(file->f_path.dentry->d_inode));
/* just registers wait_queue hook. This doesn't really wait. */
poll_wait(file, &is->wq, wait);
if (!(is->state & IPPP_OPEN)) {
- if(is->state == IPPP_CLOSEWAIT)
+ if (is->state == IPPP_CLOSEWAIT)
return POLLHUP;
printk(KERN_DEBUG "isdn_ppp: device not open\n");
return POLLERR;
@@ -827,7 +827,7 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)
return 0;
if ((dev->drv[lp->isdn_device]->flags & DRV_FLAG_RUNNING) &&
- lp->dialstate == 0 &&
+ lp->dialstate == 0 &&
(lp->flags & ISDN_NET_CONNECTED)) {
unsigned short hl;
struct sk_buff *skb;
@@ -837,7 +837,7 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)
* 16 bytes, now we are looking what the driver want
*/
hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen;
- skb = alloc_skb(hl+count, GFP_ATOMIC);
+ skb = alloc_skb(hl + count, GFP_ATOMIC);
if (!skb) {
printk(KERN_WARNING "isdn_ppp_write: out of memory!\n");
return count;
@@ -850,10 +850,10 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)
}
if (is->debug & 0x40) {
printk(KERN_DEBUG "ppp xmit: len %d\n", (int) skb->len);
- isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
+ isdn_ppp_frame_log("xmit", skb->data, skb->len, 32, is->unit, lp->ppp_slot);
}
- isdn_ppp_send_ccp(lp->netdev,lp,skb); /* keeps CCP/compression states in sync */
+ isdn_ppp_send_ccp(lp->netdev, lp, skb); /* keeps CCP/compression states in sync */
isdn_net_write_super(lp, skb);
}
@@ -869,10 +869,10 @@ int
isdn_ppp_init(void)
{
int i,
- j;
-
+ j;
+
#ifdef CONFIG_ISDN_MPP
- if( isdn_ppp_mp_bundle_array_init() < 0 )
+ if (isdn_ppp_mp_bundle_array_init() < 0)
return -ENOMEM;
#endif /* CONFIG_ISDN_MPP */
@@ -891,7 +891,7 @@ isdn_ppp_init(void)
for (j = 0; j < NUM_RCV_BUFFS; j++) {
ippp_table[i]->rq[j].buf = NULL;
ippp_table[i]->rq[j].last = ippp_table[i]->rq +
- (NUM_RCV_BUFFS + j - 1) % NUM_RCV_BUFFS;
+ (NUM_RCV_BUFFS + j - 1) % NUM_RCV_BUFFS;
ippp_table[i]->rq[j].next = ippp_table[i]->rq + (j + 1) % NUM_RCV_BUFFS;
}
}
@@ -916,7 +916,7 @@ isdn_ppp_cleanup(void)
* check for address/control field and skip if allowed
* retval != 0 -> discard packet silently
*/
-static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
+static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
{
if (skb->len < 1)
return -1;
@@ -930,7 +930,7 @@ static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
// skip address/control (AC) field
skb_pull(skb, 2);
- } else {
+ } else {
if (is->pppcfg & SC_REJ_COMP_AC)
// if AC compression was not negotiated, but used, discard packet
return -1;
@@ -942,10 +942,10 @@ static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
* get the PPP protocol header and pull skb
* retval < 0 -> discard packet silently
*/
-static int isdn_ppp_strip_proto(struct sk_buff *skb)
+static int isdn_ppp_strip_proto(struct sk_buff *skb)
{
int proto;
-
+
if (skb->len < 1)
return -1;
@@ -966,7 +966,7 @@ static int isdn_ppp_strip_proto(struct sk_buff *skb)
/*
* handler for incoming packets on a syncPPP interface
*/
-void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb)
+void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb)
{
struct ippp_struct *is;
int slot;
@@ -977,7 +977,7 @@ void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buf
slot = lp->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot(%d)\n",
- lp->ppp_slot);
+ lp->ppp_slot);
kfree_skb(skb);
return;
}
@@ -985,35 +985,35 @@ void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buf
if (is->debug & 0x4) {
printk(KERN_DEBUG "ippp_receive: is:%08lx lp:%08lx slot:%d unit:%d len:%d\n",
- (long)is,(long)lp,lp->ppp_slot,is->unit,(int) skb->len);
- isdn_ppp_frame_log("receive", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
- }
-
- if (isdn_ppp_skip_ac(is, skb) < 0) {
- kfree_skb(skb);
- return;
- }
- proto = isdn_ppp_strip_proto(skb);
- if (proto < 0) {
- kfree_skb(skb);
- return;
- }
-
+ (long)is, (long)lp, lp->ppp_slot, is->unit, (int)skb->len);
+ isdn_ppp_frame_log("receive", skb->data, skb->len, 32, is->unit, lp->ppp_slot);
+ }
+
+ if (isdn_ppp_skip_ac(is, skb) < 0) {
+ kfree_skb(skb);
+ return;
+ }
+ proto = isdn_ppp_strip_proto(skb);
+ if (proto < 0) {
+ kfree_skb(skb);
+ return;
+ }
+
#ifdef CONFIG_ISDN_MPP
- if (is->compflags & SC_LINK_DECOMP_ON) {
- skb = isdn_ppp_decompress(skb, is, NULL, &proto);
- if (!skb) // decompression error
- return;
- }
-
- if (!(is->mpppcfg & SC_REJ_MP_PROT)) { // we agreed to receive MPPP
- if (proto == PPP_MP) {
- isdn_ppp_mp_receive(net_dev, lp, skb);
- return;
- }
- }
+ if (is->compflags & SC_LINK_DECOMP_ON) {
+ skb = isdn_ppp_decompress(skb, is, NULL, &proto);
+ if (!skb) // decompression error
+ return;
+ }
+
+ if (!(is->mpppcfg & SC_REJ_MP_PROT)) { // we agreed to receive MPPP
+ if (proto == PPP_MP) {
+ isdn_ppp_mp_receive(net_dev, lp, skb);
+ return;
+ }
+ }
#endif
- isdn_ppp_push_higher(net_dev, lp, skb, proto);
+ isdn_ppp_push_higher(net_dev, lp, skb, proto);
}
/*
@@ -1022,116 +1022,116 @@ void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buf
* note: net_dev has to be master net_dev
*/
static void
-isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb, int proto)
+isdn_ppp_push_higher(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb, int proto)
{
struct net_device *dev = net_dev->dev;
- struct ippp_struct *is, *mis;
+ struct ippp_struct *is, *mis;
isdn_net_local *mlp = NULL;
int slot;
slot = lp->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot(%d)\n",
- lp->ppp_slot);
+ lp->ppp_slot);
goto drop_packet;
}
is = ippp_table[slot];
-
- if (lp->master) { // FIXME?
+
+ if (lp->master) { // FIXME?
mlp = ISDN_MASTER_PRIV(lp);
- slot = mlp->ppp_slot;
- if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
- printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n",
- lp->ppp_slot);
+ slot = mlp->ppp_slot;
+ if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
+ printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n",
+ lp->ppp_slot);
goto drop_packet;
- }
- }
- mis = ippp_table[slot];
+ }
+ }
+ mis = ippp_table[slot];
if (is->debug & 0x10) {
printk(KERN_DEBUG "push, skb %d %04x\n", (int) skb->len, proto);
- isdn_ppp_frame_log("rpush", skb->data, skb->len, 32,is->unit,lp->ppp_slot);
+ isdn_ppp_frame_log("rpush", skb->data, skb->len, 32, is->unit, lp->ppp_slot);
}
if (mis->compflags & SC_DECOMP_ON) {
skb = isdn_ppp_decompress(skb, is, mis, &proto);
if (!skb) // decompression error
- return;
- }
+ return;
+ }
switch (proto) {
- case PPP_IPX: /* untested */
- if (is->debug & 0x20)
- printk(KERN_DEBUG "isdn_ppp: IPX\n");
- skb->protocol = htons(ETH_P_IPX);
- break;
- case PPP_IP:
- if (is->debug & 0x20)
- printk(KERN_DEBUG "isdn_ppp: IP\n");
- skb->protocol = htons(ETH_P_IP);
- break;
- case PPP_COMP:
- case PPP_COMPFRAG:
- printk(KERN_INFO "isdn_ppp: unexpected compressed frame dropped\n");
- goto drop_packet;
+ case PPP_IPX: /* untested */
+ if (is->debug & 0x20)
+ printk(KERN_DEBUG "isdn_ppp: IPX\n");
+ skb->protocol = htons(ETH_P_IPX);
+ break;
+ case PPP_IP:
+ if (is->debug & 0x20)
+ printk(KERN_DEBUG "isdn_ppp: IP\n");
+ skb->protocol = htons(ETH_P_IP);
+ break;
+ case PPP_COMP:
+ case PPP_COMPFRAG:
+ printk(KERN_INFO "isdn_ppp: unexpected compressed frame dropped\n");
+ goto drop_packet;
#ifdef CONFIG_ISDN_PPP_VJ
- case PPP_VJC_UNCOMP:
- if (is->debug & 0x20)
- printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n");
+ case PPP_VJC_UNCOMP:
+ if (is->debug & 0x20)
+ printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n");
+ if (net_dev->local->ppp_slot < 0) {
+ printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n",
+ __func__, net_dev->local->ppp_slot);
+ goto drop_packet;
+ }
+ if (slhc_remember(ippp_table[net_dev->local->ppp_slot]->slcomp, skb->data, skb->len) <= 0) {
+ printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n");
+ goto drop_packet;
+ }
+ skb->protocol = htons(ETH_P_IP);
+ break;
+ case PPP_VJC_COMP:
+ if (is->debug & 0x20)
+ printk(KERN_DEBUG "isdn_ppp: VJC_COMP\n");
+ {
+ struct sk_buff *skb_old = skb;
+ int pkt_len;
+ skb = dev_alloc_skb(skb_old->len + 128);
+
+ if (!skb) {
+ printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name);
+ skb = skb_old;
+ goto drop_packet;
+ }
+ skb_put(skb, skb_old->len + 128);
+ skb_copy_from_linear_data(skb_old, skb->data,
+ skb_old->len);
if (net_dev->local->ppp_slot < 0) {
printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n",
- __func__, net_dev->local->ppp_slot);
+ __func__, net_dev->local->ppp_slot);
goto drop_packet;
}
- if (slhc_remember(ippp_table[net_dev->local->ppp_slot]->slcomp, skb->data, skb->len) <= 0) {
- printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n");
+ pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp,
+ skb->data, skb_old->len);
+ kfree_skb(skb_old);
+ if (pkt_len < 0)
goto drop_packet;
- }
+
+ skb_trim(skb, pkt_len);
skb->protocol = htons(ETH_P_IP);
- break;
- case PPP_VJC_COMP:
- if (is->debug & 0x20)
- printk(KERN_DEBUG "isdn_ppp: VJC_COMP\n");
- {
- struct sk_buff *skb_old = skb;
- int pkt_len;
- skb = dev_alloc_skb(skb_old->len + 128);
-
- if (!skb) {
- printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name);
- skb = skb_old;
- goto drop_packet;
- }
- skb_put(skb, skb_old->len + 128);
- skb_copy_from_linear_data(skb_old, skb->data,
- skb_old->len);
- if (net_dev->local->ppp_slot < 0) {
- printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n",
- __func__, net_dev->local->ppp_slot);
- goto drop_packet;
- }
- pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp,
- skb->data, skb_old->len);
- kfree_skb(skb_old);
- if (pkt_len < 0)
- goto drop_packet;
-
- skb_trim(skb, pkt_len);
- skb->protocol = htons(ETH_P_IP);
- }
- break;
+ }
+ break;
#endif
- case PPP_CCP:
- case PPP_CCPFRAG:
- isdn_ppp_receive_ccp(net_dev,lp,skb,proto);
- /* Dont pop up ResetReq/Ack stuff to the daemon any
- longer - the job is done already */
- if(skb->data[0] == CCP_RESETREQ ||
- skb->data[0] == CCP_RESETACK)
- break;
- /* fall through */
- default:
- isdn_ppp_fill_rq(skb->data, skb->len, proto, lp->ppp_slot); /* push data to pppd device */
- kfree_skb(skb);
- return;
+ case PPP_CCP:
+ case PPP_CCPFRAG:
+ isdn_ppp_receive_ccp(net_dev, lp, skb, proto);
+ /* Dont pop up ResetReq/Ack stuff to the daemon any
+ longer - the job is done already */
+ if (skb->data[0] == CCP_RESETREQ ||
+ skb->data[0] == CCP_RESETACK)
+ break;
+ /* fall through */
+ default:
+ isdn_ppp_fill_rq(skb->data, skb->len, proto, lp->ppp_slot); /* push data to pppd device */
+ kfree_skb(skb);
+ return;
}
#ifdef CONFIG_IPPP_FILTER
@@ -1156,7 +1156,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
if (!(is->active_filter
&& sk_run_filter(skb, is->active_filter) == 0)) {
if (is->debug & 0x2)
- printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
+ printk(KERN_DEBUG "IPPP: link-active filter: resetting huptimer.\n");
lp->huptimer = 0;
if (mlp)
mlp->huptimer = 0;
@@ -1173,7 +1173,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
/* net_dev->local->stats.rx_packets++; done in isdn_net.c */
return;
- drop_packet:
+drop_packet:
net_dev->local->stats.rx_dropped++;
kfree_skb(skb);
}
@@ -1183,11 +1183,11 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
* checks whether we have enough space at the beginning of the skb
* and allocs a new SKB if necessary
*/
-static unsigned char *isdn_ppp_skb_push(struct sk_buff **skb_p,int len)
+static unsigned char *isdn_ppp_skb_push(struct sk_buff **skb_p, int len)
{
struct sk_buff *skb = *skb_p;
- if(skb_headroom(skb) < len) {
+ if (skb_headroom(skb) < len) {
struct sk_buff *nskb = skb_realloc_headroom(skb, len);
if (!nskb) {
@@ -1195,12 +1195,12 @@ static unsigned char *isdn_ppp_skb_push(struct sk_buff **skb_p,int len)
dev_kfree_skb(skb);
return NULL;
}
- printk(KERN_DEBUG "isdn_ppp_skb_push:under %d %d\n",skb_headroom(skb),len);
+ printk(KERN_DEBUG "isdn_ppp_skb_push:under %d %d\n", skb_headroom(skb), len);
dev_kfree_skb(skb);
*skb_p = nskb;
return skb_push(nskb, len);
}
- return skb_push(skb,len);
+ return skb_push(skb, len);
}
/*
@@ -1214,10 +1214,10 @@ static unsigned char *isdn_ppp_skb_push(struct sk_buff **skb_p,int len)
int
isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
{
- isdn_net_local *lp,*mlp;
+ isdn_net_local *lp, *mlp;
isdn_net_dev *nd;
unsigned int proto = PPP_IP; /* 0x21 */
- struct ippp_struct *ipt,*ipts;
+ struct ippp_struct *ipt, *ipts;
int slot, retval = NETDEV_TX_OK;
mlp = netdev_priv(netdev);
@@ -1226,7 +1226,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
slot = mlp->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
- mlp->ppp_slot);
+ mlp->ppp_slot);
kfree_skb(skb);
goto out;
}
@@ -1240,17 +1240,17 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
}
switch (ntohs(skb->protocol)) {
- case ETH_P_IP:
- proto = PPP_IP;
- break;
- case ETH_P_IPX:
- proto = PPP_IPX; /* untested */
- break;
- default:
- printk(KERN_ERR "isdn_ppp: skipped unsupported protocol: %#x.\n",
- skb->protocol);
- dev_kfree_skb(skb);
- goto out;
+ case ETH_P_IP:
+ proto = PPP_IP;
+ break;
+ case ETH_P_IPX:
+ proto = PPP_IPX; /* untested */
+ break;
+ default:
+ printk(KERN_ERR "isdn_ppp: skipped unsupported protocol: %#x.\n",
+ skb->protocol);
+ dev_kfree_skb(skb);
+ goto out;
}
lp = isdn_net_get_locked_lp(nd);
@@ -1264,7 +1264,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
slot = lp->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
- lp->ppp_slot);
+ lp->ppp_slot);
kfree_skb(skb);
goto unlock;
}
@@ -1277,7 +1277,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
/* Pull off the fake header we stuck on earlier to keep
* the fragmentation code happy.
*/
- skb_pull(skb,IPPP_MAX_HEADER);
+ skb_pull(skb, IPPP_MAX_HEADER);
#ifdef CONFIG_IPPP_FILTER
/* check if we should pass this packet
@@ -1302,7 +1302,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
if (!(ipt->active_filter
&& sk_run_filter(skb, ipt->active_filter) == 0)) {
if (ipt->debug & 0x4)
- printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
+ printk(KERN_DEBUG "IPPP: link-active filter: resetting huptimer.\n");
lp->huptimer = 0;
}
skb_pull(skb, 4);
@@ -1312,26 +1312,26 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
if (ipt->debug & 0x4)
printk(KERN_DEBUG "xmit skb, len %d\n", (int) skb->len);
- if (ipts->debug & 0x40)
- isdn_ppp_frame_log("xmit0", skb->data, skb->len, 32,ipts->unit,lp->ppp_slot);
+ if (ipts->debug & 0x40)
+ isdn_ppp_frame_log("xmit0", skb->data, skb->len, 32, ipts->unit, lp->ppp_slot);
#ifdef CONFIG_ISDN_PPP_VJ
if (proto == PPP_IP && ipts->pppcfg & SC_COMP_TCP) { /* ipts here? probably yes, but check this again */
struct sk_buff *new_skb;
- unsigned short hl;
+ unsigned short hl;
/*
* we need to reserve enough space in front of
* sk_buff. old call to dev_alloc_skb only reserved
* 16 bytes, now we are looking what the driver want.
*/
hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen + IPPP_MAX_HEADER;
- /*
+ /*
* Note: hl might still be insufficient because the method
* above does not account for a possibible MPPP slave channel
* which had larger HL header space requirements than the
* master.
*/
- new_skb = alloc_skb(hl+skb->len, GFP_ATOMIC);
+ new_skb = alloc_skb(hl + skb->len, GFP_ATOMIC);
if (new_skb) {
u_char *buf;
int pktlen;
@@ -1342,9 +1342,9 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
buf = skb->data;
pktlen = slhc_compress(ipts->slcomp, skb->data, skb->len, new_skb->data,
- &buf, !(ipts->pppcfg & SC_NO_TCP_CCID));
+ &buf, !(ipts->pppcfg & SC_NO_TCP_CCID));
- if (buf != skb->data) {
+ if (buf != skb->data) {
if (new_skb->data != buf)
printk(KERN_ERR "isdn_ppp: FATAL error after slhc_compress!!\n");
dev_kfree_skb(skb);
@@ -1369,11 +1369,11 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
/*
* normal (single link) or bundle compression
*/
- if(ipts->compflags & SC_COMP_ON) {
+ if (ipts->compflags & SC_COMP_ON) {
/* We send compressed only if both down- und upstream
compression is negotiated, that means, CCP is up */
- if(ipts->compflags & SC_DECOMP_ON) {
- skb = isdn_ppp_compress(skb,&proto,ipt,ipts,0);
+ if (ipts->compflags & SC_DECOMP_ON) {
+ skb = isdn_ppp_compress(skb, &proto, ipt, ipts, 0);
} else {
printk(KERN_DEBUG "isdn_ppp: CCP not yet up - sending as-is\n");
}
@@ -1389,7 +1389,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
ipts->mp_seqno++;
if (ipt->mpppcfg & SC_OUT_SHORT_SEQ) {
unsigned char *data = isdn_ppp_skb_push(&skb, 3);
- if(!data)
+ if (!data)
goto unlock;
mp_seqno &= 0xfff;
data[0] = MP_BEGIN_FRAG | MP_END_FRAG | ((mp_seqno >> 8) & 0xf); /* (B)egin & (E)ndbit .. */
@@ -1397,7 +1397,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
data[2] = proto; /* PID compression */
} else {
unsigned char *data = isdn_ppp_skb_push(&skb, 5);
- if(!data)
+ if (!data)
goto unlock;
data[0] = MP_BEGIN_FRAG | MP_END_FRAG; /* (B)egin & (E)ndbit .. */
data[1] = (mp_seqno >> 16) & 0xff; /* sequence number: 24bit */
@@ -1412,25 +1412,25 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
/*
* 'link in bundle' compression ...
*/
- if(ipt->compflags & SC_LINK_COMP_ON)
- skb = isdn_ppp_compress(skb,&proto,ipt,ipts,1);
+ if (ipt->compflags & SC_LINK_COMP_ON)
+ skb = isdn_ppp_compress(skb, &proto, ipt, ipts, 1);
- if( (ipt->pppcfg & SC_COMP_PROT) && (proto <= 0xff) ) {
- unsigned char *data = isdn_ppp_skb_push(&skb,1);
- if(!data)
+ if ((ipt->pppcfg & SC_COMP_PROT) && (proto <= 0xff)) {
+ unsigned char *data = isdn_ppp_skb_push(&skb, 1);
+ if (!data)
goto unlock;
data[0] = proto & 0xff;
}
else {
- unsigned char *data = isdn_ppp_skb_push(&skb,2);
- if(!data)
+ unsigned char *data = isdn_ppp_skb_push(&skb, 2);
+ if (!data)
goto unlock;
data[0] = (proto >> 8) & 0xff;
data[1] = proto & 0xff;
}
- if(!(ipt->pppcfg & SC_COMP_AC)) {
- unsigned char *data = isdn_ppp_skb_push(&skb,2);
- if(!data)
+ if (!(ipt->pppcfg & SC_COMP_AC)) {
+ unsigned char *data = isdn_ppp_skb_push(&skb, 2);
+ if (!data)
goto unlock;
data[0] = 0xff; /* All Stations */
data[1] = 0x03; /* Unnumbered information */
@@ -1440,14 +1440,14 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
if (ipts->debug & 0x40) {
printk(KERN_DEBUG "skb xmit: len: %d\n", (int) skb->len);
- isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,ipt->unit,lp->ppp_slot);
+ isdn_ppp_frame_log("xmit", skb->data, skb->len, 32, ipt->unit, lp->ppp_slot);
}
-
+
isdn_net_writebuf_skb(lp, skb);
- unlock:
+unlock:
spin_unlock_bh(&lp->xmit_lock);
- out:
+out:
return retval;
}
@@ -1488,12 +1488,12 @@ int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp)
p++;
*p = htons(proto);
}
-
+
drop |= is->pass_filter
- && sk_run_filter(skb, is->pass_filter) == 0;
+ && sk_run_filter(skb, is->pass_filter) == 0;
drop |= is->active_filter
- && sk_run_filter(skb, is->active_filter) == 0;
-
+ && sk_run_filter(skb, is->active_filter) == 0;
+
skb_push(skb, IPPP_MAX_HEADER - 4);
return drop;
}
@@ -1502,8 +1502,8 @@ int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp)
/* this is _not_ rfc1990 header, but something we convert both short and long
* headers to for convinience's sake:
- * byte 0 is flags as in rfc1990
- * bytes 1...4 is 24-bit seqence number converted to host byte order
+ * byte 0 is flags as in rfc1990
+ * bytes 1...4 is 24-bit seqence number converted to host byte order
*/
#define MP_HEADER_LEN 5
@@ -1511,51 +1511,51 @@ int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp)
#define MP_SHORTSEQ_MASK 0x00000fff
#define MP_LONGSEQ_MAX MP_LONGSEQ_MASK
#define MP_SHORTSEQ_MAX MP_SHORTSEQ_MASK
-#define MP_LONGSEQ_MAXBIT ((MP_LONGSEQ_MASK+1)>>1)
-#define MP_SHORTSEQ_MAXBIT ((MP_SHORTSEQ_MASK+1)>>1)
+#define MP_LONGSEQ_MAXBIT ((MP_LONGSEQ_MASK + 1) >> 1)
+#define MP_SHORTSEQ_MAXBIT ((MP_SHORTSEQ_MASK + 1) >> 1)
/* sequence-wrap safe comparisons (for long sequence)*/
-#define MP_LT(a,b) ((a-b)&MP_LONGSEQ_MAXBIT)
-#define MP_LE(a,b) !((b-a)&MP_LONGSEQ_MAXBIT)
-#define MP_GT(a,b) ((b-a)&MP_LONGSEQ_MAXBIT)
-#define MP_GE(a,b) !((a-b)&MP_LONGSEQ_MAXBIT)
+#define MP_LT(a, b) ((a - b) & MP_LONGSEQ_MAXBIT)
+#define MP_LE(a, b) !((b - a) & MP_LONGSEQ_MAXBIT)
+#define MP_GT(a, b) ((b - a) & MP_LONGSEQ_MAXBIT)
+#define MP_GE(a, b) !((a - b) & MP_LONGSEQ_MAXBIT)
-#define MP_SEQ(f) ((*(u32*)(f->data+1)))
+#define MP_SEQ(f) ((*(u32 *)(f->data + 1)))
#define MP_FLAGS(f) (f->data[0])
static int isdn_ppp_mp_bundle_array_init(void)
{
int i;
- int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle);
- if( (isdn_ppp_bundle_arr = kzalloc(sz, GFP_KERNEL)) == NULL )
+ int sz = ISDN_MAX_CHANNELS * sizeof(ippp_bundle);
+ if ((isdn_ppp_bundle_arr = kzalloc(sz, GFP_KERNEL)) == NULL)
return -ENOMEM;
- for( i = 0; i < ISDN_MAX_CHANNELS; i++ )
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
spin_lock_init(&isdn_ppp_bundle_arr[i].lock);
return 0;
}
-static ippp_bundle * isdn_ppp_mp_bundle_alloc(void)
+static ippp_bundle *isdn_ppp_mp_bundle_alloc(void)
{
int i;
- for( i = 0; i < ISDN_MAX_CHANNELS; i++ )
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (isdn_ppp_bundle_arr[i].ref_ct <= 0)
return (isdn_ppp_bundle_arr + i);
return NULL;
}
-static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to )
+static int isdn_ppp_mp_init(isdn_net_local *lp, ippp_bundle *add_to)
{
- struct ippp_struct * is;
+ struct ippp_struct *is;
if (lp->ppp_slot < 0) {
printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
- __func__, lp->ppp_slot);
- return(-EINVAL);
+ __func__, lp->ppp_slot);
+ return (-EINVAL);
}
is = ippp_table[lp->ppp_slot];
if (add_to) {
- if( lp->netdev->pb )
+ if (lp->netdev->pb)
lp->netdev->pb->ref_ct--;
lp->netdev->pb = add_to;
} else { /* first link in a bundle */
@@ -1568,76 +1568,76 @@ static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to )
lp->netdev->pb->seq = UINT_MAX;
}
lp->netdev->pb->ref_ct++;
-
+
is->last_link_seqno = 0;
return 0;
}
-static u32 isdn_ppp_mp_get_seq( int short_seq,
- struct sk_buff * skb, u32 last_seq );
-static struct sk_buff * isdn_ppp_mp_discard( ippp_bundle * mp,
- struct sk_buff * from, struct sk_buff * to );
-static void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp,
- struct sk_buff * from, struct sk_buff * to );
-static void isdn_ppp_mp_free_skb( ippp_bundle * mp, struct sk_buff * skb );
-static void isdn_ppp_mp_print_recv_pkt( int slot, struct sk_buff * skb );
-
-static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
- struct sk_buff *skb)
+static u32 isdn_ppp_mp_get_seq(int short_seq,
+ struct sk_buff *skb, u32 last_seq);
+static struct sk_buff *isdn_ppp_mp_discard(ippp_bundle *mp,
+ struct sk_buff *from, struct sk_buff *to);
+static void isdn_ppp_mp_reassembly(isdn_net_dev *net_dev, isdn_net_local *lp,
+ struct sk_buff *from, struct sk_buff *to);
+static void isdn_ppp_mp_free_skb(ippp_bundle *mp, struct sk_buff *skb);
+static void isdn_ppp_mp_print_recv_pkt(int slot, struct sk_buff *skb);
+
+static void isdn_ppp_mp_receive(isdn_net_dev *net_dev, isdn_net_local *lp,
+ struct sk_buff *skb)
{
struct ippp_struct *is;
- isdn_net_local * lpq;
- ippp_bundle * mp;
- isdn_mppp_stats * stats;
- struct sk_buff * newfrag, * frag, * start, *nextf;
+ isdn_net_local *lpq;
+ ippp_bundle *mp;
+ isdn_mppp_stats *stats;
+ struct sk_buff *newfrag, *frag, *start, *nextf;
u32 newseq, minseq, thisseq;
unsigned long flags;
int slot;
spin_lock_irqsave(&net_dev->pb->lock, flags);
- mp = net_dev->pb;
- stats = &mp->stats;
+ mp = net_dev->pb;
+ stats = &mp->stats;
slot = lp->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lp->ppp_slot(%d)\n",
- __func__, lp->ppp_slot);
+ __func__, lp->ppp_slot);
stats->frame_drops++;
dev_kfree_skb(skb);
spin_unlock_irqrestore(&mp->lock, flags);
return;
}
is = ippp_table[slot];
- if( ++mp->frames > stats->max_queue_len )
+ if (++mp->frames > stats->max_queue_len)
stats->max_queue_len = mp->frames;
-
+
if (is->debug & 0x8)
isdn_ppp_mp_print_recv_pkt(lp->ppp_slot, skb);
- newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ,
- skb, is->last_link_seqno);
+ newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ,
+ skb, is->last_link_seqno);
/* if this packet seq # is less than last already processed one,
- * toss it right away, but check for sequence start case first
+ * toss it right away, but check for sequence start case first
*/
- if( mp->seq > MP_LONGSEQ_MAX && (newseq & MP_LONGSEQ_MAXBIT) ) {
+ if (mp->seq > MP_LONGSEQ_MAX && (newseq & MP_LONGSEQ_MAXBIT)) {
mp->seq = newseq; /* the first packet: required for
* rfc1990 non-compliant clients --
* prevents constant packet toss */
- } else if( MP_LT(newseq, mp->seq) ) {
+ } else if (MP_LT(newseq, mp->seq)) {
stats->frame_drops++;
isdn_ppp_mp_free_skb(mp, skb);
spin_unlock_irqrestore(&mp->lock, flags);
return;
}
-
+
/* find the minimum received sequence number over all links */
is->last_link_seqno = minseq = newseq;
for (lpq = net_dev->queue;;) {
slot = lpq->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n",
- __func__, lpq->ppp_slot);
+ __func__, lpq->ppp_slot);
} else {
u32 lls = ippp_table[slot]->last_link_seqno;
if (MP_LT(lls, minseq))
@@ -1651,17 +1651,17 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
* packets */
newfrag = skb;
- /* if this new fragment is before the first one, then enqueue it now. */
- if ((frag = mp->frags) == NULL || MP_LT(newseq, MP_SEQ(frag))) {
+ /* if this new fragment is before the first one, then enqueue it now. */
+ if ((frag = mp->frags) == NULL || MP_LT(newseq, MP_SEQ(frag))) {
newfrag->next = frag;
- mp->frags = frag = newfrag;
- newfrag = NULL;
- }
+ mp->frags = frag = newfrag;
+ newfrag = NULL;
+ }
- start = MP_FLAGS(frag) & MP_BEGIN_FRAG &&
- MP_SEQ(frag) == mp->seq ? frag : NULL;
+ start = MP_FLAGS(frag) & MP_BEGIN_FRAG &&
+ MP_SEQ(frag) == mp->seq ? frag : NULL;
- /*
+ /*
* main fragment traversing loop
*
* try to accomplish several tasks:
@@ -1675,71 +1675,71 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
* come to complete such sequence and it should be discarded
*
* loop completes when we accomplished the following tasks:
- * - new fragment is inserted in the proper sequence ('newfrag' is
+ * - new fragment is inserted in the proper sequence ('newfrag' is
* set to NULL)
- * - we hit a gap in the sequence, so no reassembly/processing is
+ * - we hit a gap in the sequence, so no reassembly/processing is
* possible ('start' would be set to NULL)
*
* algorithm for this code is derived from code in the book
* 'PPP Design And Debugging' by James Carlson (Addison-Wesley)
*/
- while (start != NULL || newfrag != NULL) {
-
- thisseq = MP_SEQ(frag);
- nextf = frag->next;
-
- /* drop any duplicate fragments */
- if (newfrag != NULL && thisseq == newseq) {
- isdn_ppp_mp_free_skb(mp, newfrag);
- newfrag = NULL;
- }
-
- /* insert new fragment before next element if possible. */
- if (newfrag != NULL && (nextf == NULL ||
- MP_LT(newseq, MP_SEQ(nextf)))) {
- newfrag->next = nextf;
- frag->next = nextf = newfrag;
- newfrag = NULL;
- }
-
- if (start != NULL) {
- /* check for misplaced start */
- if (start != frag && (MP_FLAGS(frag) & MP_BEGIN_FRAG)) {
+ while (start != NULL || newfrag != NULL) {
+
+ thisseq = MP_SEQ(frag);
+ nextf = frag->next;
+
+ /* drop any duplicate fragments */
+ if (newfrag != NULL && thisseq == newseq) {
+ isdn_ppp_mp_free_skb(mp, newfrag);
+ newfrag = NULL;
+ }
+
+ /* insert new fragment before next element if possible. */
+ if (newfrag != NULL && (nextf == NULL ||
+ MP_LT(newseq, MP_SEQ(nextf)))) {
+ newfrag->next = nextf;
+ frag->next = nextf = newfrag;
+ newfrag = NULL;
+ }
+
+ if (start != NULL) {
+ /* check for misplaced start */
+ if (start != frag && (MP_FLAGS(frag) & MP_BEGIN_FRAG)) {
printk(KERN_WARNING"isdn_mppp(seq %d): new "
- "BEGIN flag with no prior END", thisseq);
+ "BEGIN flag with no prior END", thisseq);
stats->seqerrs++;
stats->frame_drops++;
- start = isdn_ppp_mp_discard(mp, start,frag);
+ start = isdn_ppp_mp_discard(mp, start, frag);
nextf = frag->next;
- }
- } else if (MP_LE(thisseq, minseq)) {
- if (MP_FLAGS(frag) & MP_BEGIN_FRAG)
+ }
+ } else if (MP_LE(thisseq, minseq)) {
+ if (MP_FLAGS(frag) & MP_BEGIN_FRAG)
start = frag;
- else {
+ else {
if (MP_FLAGS(frag) & MP_END_FRAG)
- stats->frame_drops++;
- if( mp->frags == frag )
- mp->frags = nextf;
+ stats->frame_drops++;
+ if (mp->frags == frag)
+ mp->frags = nextf;
isdn_ppp_mp_free_skb(mp, frag);
frag = nextf;
continue;
- }
+ }
}
-
+
/* if start is non-null and we have end fragment, then
- * we have full reassembly sequence -- reassemble
+ * we have full reassembly sequence -- reassemble
* and process packet now
*/
- if (start != NULL && (MP_FLAGS(frag) & MP_END_FRAG)) {
- minseq = mp->seq = (thisseq+1) & MP_LONGSEQ_MASK;
- /* Reassemble the packet then dispatch it */
+ if (start != NULL && (MP_FLAGS(frag) & MP_END_FRAG)) {
+ minseq = mp->seq = (thisseq + 1) & MP_LONGSEQ_MASK;
+ /* Reassemble the packet then dispatch it */
isdn_ppp_mp_reassembly(net_dev, lp, start, nextf);
-
- start = NULL;
- frag = NULL;
- mp->frags = nextf;
- }
+ start = NULL;
+ frag = NULL;
+
+ mp->frags = nextf;
+ }
/* check if need to update start pointer: if we just
* reassembled the packet and sequence is contiguous
@@ -1749,48 +1749,48 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
* if sequence is not contiguous, either clear everything
* below low watermark and set start to the next frag or
* clear start ptr.
- */
- if (nextf != NULL &&
- ((thisseq+1) & MP_LONGSEQ_MASK) == MP_SEQ(nextf)) {
- /* if we just reassembled and the next one is here,
+ */
+ if (nextf != NULL &&
+ ((thisseq + 1) & MP_LONGSEQ_MASK) == MP_SEQ(nextf)) {
+ /* if we just reassembled and the next one is here,
* then start another reassembly. */
- if (frag == NULL) {
+ if (frag == NULL) {
if (MP_FLAGS(nextf) & MP_BEGIN_FRAG)
- start = nextf;
+ start = nextf;
else
{
- printk(KERN_WARNING"isdn_mppp(seq %d):"
- " END flag with no following "
- "BEGIN", thisseq);
+ printk(KERN_WARNING"isdn_mppp(seq %d):"
+ " END flag with no following "
+ "BEGIN", thisseq);
stats->seqerrs++;
}
}
- } else {
- if ( nextf != NULL && frag != NULL &&
- MP_LT(thisseq, minseq)) {
+ } else {
+ if (nextf != NULL && frag != NULL &&
+ MP_LT(thisseq, minseq)) {
/* we've got a break in the sequence
* and we not at the end yet
* and we did not just reassembled
*(if we did, there wouldn't be anything before)
- * and we below the low watermark
- * discard all the frames below low watermark
+ * and we below the low watermark
+ * discard all the frames below low watermark
* and start over */
stats->frame_drops++;
- mp->frags = isdn_ppp_mp_discard(mp,start,nextf);
+ mp->frags = isdn_ppp_mp_discard(mp, start, nextf);
}
/* break in the sequence, no reassembly */
- start = NULL;
- }
-
- frag = nextf;
- } /* while -- main loop */
-
- if (mp->frags == NULL)
- mp->frags = frag;
-
- /* rather straighforward way to deal with (not very) possible
+ start = NULL;
+ }
+
+ frag = nextf;
+ } /* while -- main loop */
+
+ if (mp->frags == NULL)
+ mp->frags = frag;
+
+ /* rather straighforward way to deal with (not very) possible
* queue overflow */
if (mp->frames > MP_MAX_QUEUE_LEN) {
stats->overflows++;
@@ -1803,11 +1803,11 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
spin_unlock_irqrestore(&mp->lock, flags);
}
-static void isdn_ppp_mp_cleanup( isdn_net_local * lp )
+static void isdn_ppp_mp_cleanup(isdn_net_local *lp)
{
- struct sk_buff * frag = lp->netdev->pb->frags;
- struct sk_buff * nextfrag;
- while( frag ) {
+ struct sk_buff *frag = lp->netdev->pb->frags;
+ struct sk_buff *nextfrag;
+ while (frag) {
nextfrag = frag->next;
isdn_ppp_mp_free_skb(lp->netdev->pb, frag);
frag = nextfrag;
@@ -1815,117 +1815,117 @@ static void isdn_ppp_mp_cleanup( isdn_net_local * lp )
lp->netdev->pb->frags = NULL;
}
-static u32 isdn_ppp_mp_get_seq( int short_seq,
- struct sk_buff * skb, u32 last_seq )
+static u32 isdn_ppp_mp_get_seq(int short_seq,
+ struct sk_buff *skb, u32 last_seq)
{
u32 seq;
int flags = skb->data[0] & (MP_BEGIN_FRAG | MP_END_FRAG);
-
- if( !short_seq )
+
+ if (!short_seq)
{
seq = ntohl(*(__be32 *)skb->data) & MP_LONGSEQ_MASK;
- skb_push(skb,1);
+ skb_push(skb, 1);
}
else
{
- /* convert 12-bit short seq number to 24-bit long one
- */
+ /* convert 12-bit short seq number to 24-bit long one
+ */
seq = ntohs(*(__be16 *)skb->data) & MP_SHORTSEQ_MASK;
-
+
/* check for seqence wrap */
- if( !(seq & MP_SHORTSEQ_MAXBIT) &&
- (last_seq & MP_SHORTSEQ_MAXBIT) &&
- (unsigned long)last_seq <= MP_LONGSEQ_MAX )
- seq |= (last_seq + MP_SHORTSEQ_MAX+1) &
- (~MP_SHORTSEQ_MASK & MP_LONGSEQ_MASK);
+ if (!(seq & MP_SHORTSEQ_MAXBIT) &&
+ (last_seq & MP_SHORTSEQ_MAXBIT) &&
+ (unsigned long)last_seq <= MP_LONGSEQ_MAX)
+ seq |= (last_seq + MP_SHORTSEQ_MAX + 1) &
+ (~MP_SHORTSEQ_MASK & MP_LONGSEQ_MASK);
else
seq |= last_seq & (~MP_SHORTSEQ_MASK & MP_LONGSEQ_MASK);
-
+
skb_push(skb, 3); /* put converted seqence back in skb */
}
- *(u32*)(skb->data+1) = seq; /* put seqence back in _host_ byte
+ *(u32 *)(skb->data + 1) = seq; /* put seqence back in _host_ byte
* order */
skb->data[0] = flags; /* restore flags */
return seq;
}
-struct sk_buff * isdn_ppp_mp_discard( ippp_bundle * mp,
- struct sk_buff * from, struct sk_buff * to )
+struct sk_buff *isdn_ppp_mp_discard(ippp_bundle *mp,
+ struct sk_buff *from, struct sk_buff *to)
{
- if( from )
+ if (from)
while (from != to) {
- struct sk_buff * next = from->next;
+ struct sk_buff *next = from->next;
isdn_ppp_mp_free_skb(mp, from);
- from = next;
+ from = next;
}
return from;
}
-void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp,
- struct sk_buff * from, struct sk_buff * to )
+void isdn_ppp_mp_reassembly(isdn_net_dev *net_dev, isdn_net_local *lp,
+ struct sk_buff *from, struct sk_buff *to)
{
- ippp_bundle * mp = net_dev->pb;
+ ippp_bundle *mp = net_dev->pb;
int proto;
- struct sk_buff * skb;
+ struct sk_buff *skb;
unsigned int tot_len;
if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
- __func__, lp->ppp_slot);
+ __func__, lp->ppp_slot);
return;
}
- if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) {
- if( ippp_table[lp->ppp_slot]->debug & 0x40 )
+ if (MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG)) {
+ if (ippp_table[lp->ppp_slot]->debug & 0x40)
printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, "
- "len %d\n", MP_SEQ(from), from->len );
+ "len %d\n", MP_SEQ(from), from->len);
skb = from;
skb_pull(skb, MP_HEADER_LEN);
- mp->frames--;
+ mp->frames--;
} else {
- struct sk_buff * frag;
+ struct sk_buff *frag;
int n;
- for(tot_len=n=0, frag=from; frag != to; frag=frag->next, n++)
+ for (tot_len = n = 0, frag = from; frag != to; frag = frag->next, n++)
tot_len += frag->len - MP_HEADER_LEN;
- if( ippp_table[lp->ppp_slot]->debug & 0x40 )
+ if (ippp_table[lp->ppp_slot]->debug & 0x40)
printk(KERN_DEBUG"isdn_mppp: reassembling frames %d "
- "to %d, len %d\n", MP_SEQ(from),
- (MP_SEQ(from)+n-1) & MP_LONGSEQ_MASK, tot_len );
- if( (skb = dev_alloc_skb(tot_len)) == NULL ) {
+ "to %d, len %d\n", MP_SEQ(from),
+ (MP_SEQ(from) + n - 1) & MP_LONGSEQ_MASK, tot_len);
+ if ((skb = dev_alloc_skb(tot_len)) == NULL) {
printk(KERN_ERR "isdn_mppp: cannot allocate sk buff "
- "of size %d\n", tot_len);
+ "of size %d\n", tot_len);
isdn_ppp_mp_discard(mp, from, to);
return;
}
- while( from != to ) {
+ while (from != to) {
unsigned int len = from->len - MP_HEADER_LEN;
skb_copy_from_linear_data_offset(from, MP_HEADER_LEN,
- skb_put(skb,len),
+ skb_put(skb, len),
len);
frag = from->next;
isdn_ppp_mp_free_skb(mp, from);
- from = frag;
+ from = frag;
}
}
- proto = isdn_ppp_strip_proto(skb);
+ proto = isdn_ppp_strip_proto(skb);
isdn_ppp_push_higher(net_dev, lp, skb, proto);
}
-static void isdn_ppp_mp_free_skb(ippp_bundle * mp, struct sk_buff * skb)
+static void isdn_ppp_mp_free_skb(ippp_bundle *mp, struct sk_buff *skb)
{
dev_kfree_skb(skb);
mp->frames--;
}
-static void isdn_ppp_mp_print_recv_pkt( int slot, struct sk_buff * skb )
+static void isdn_ppp_mp_print_recv_pkt(int slot, struct sk_buff *skb)
{
- printk(KERN_DEBUG "mp_recv: %d/%d -> %02x %02x %02x %02x %02x %02x\n",
- slot, (int) skb->len,
- (int) skb->data[0], (int) skb->data[1], (int) skb->data[2],
- (int) skb->data[3], (int) skb->data[4], (int) skb->data[5]);
+ printk(KERN_DEBUG "mp_recv: %d/%d -> %02x %02x %02x %02x %02x %02x\n",
+ slot, (int) skb->len,
+ (int) skb->data[0], (int) skb->data[1], (int) skb->data[2],
+ (int) skb->data[3], (int) skb->data[4], (int) skb->data[5]);
}
static int
@@ -1944,18 +1944,18 @@ isdn_ppp_bundle(struct ippp_struct *is, int unit)
return -EINVAL;
}
- spin_lock_irqsave(&p->pb->lock, flags);
+ spin_lock_irqsave(&p->pb->lock, flags);
nlp = is->lp;
lp = p->queue;
- if( nlp->ppp_slot < 0 || nlp->ppp_slot >= ISDN_MAX_CHANNELS ||
- lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS ) {
+ if (nlp->ppp_slot < 0 || nlp->ppp_slot >= ISDN_MAX_CHANNELS ||
+ lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "ippp_bundle: binding to invalid slot %d\n",
- nlp->ppp_slot < 0 || nlp->ppp_slot >= ISDN_MAX_CHANNELS ?
- nlp->ppp_slot : lp->ppp_slot );
+ nlp->ppp_slot < 0 || nlp->ppp_slot >= ISDN_MAX_CHANNELS ?
+ nlp->ppp_slot : lp->ppp_slot);
rc = -EINVAL;
goto out;
- }
+ }
isdn_net_add_to_bundle(p, nlp);
@@ -1971,9 +1971,9 @@ out:
spin_unlock_irqrestore(&p->pb->lock, flags);
return rc;
}
-
+
#endif /* CONFIG_ISDN_MPP */
-
+
/*
* network device ioctl handlers
*/
@@ -2020,7 +2020,7 @@ isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct net_device *dev)
int
isdn_ppp_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
- int error=0;
+ int error = 0;
int len;
isdn_net_local *lp = netdev_priv(dev);
@@ -2030,18 +2030,18 @@ isdn_ppp_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
switch (cmd) {
#define PPP_VERSION "2.3.7"
- case SIOCGPPPVER:
- len = strlen(PPP_VERSION) + 1;
- if (copy_to_user(ifr->ifr_data, PPP_VERSION, len))
- error = -EFAULT;
- break;
+ case SIOCGPPPVER:
+ len = strlen(PPP_VERSION) + 1;
+ if (copy_to_user(ifr->ifr_data, PPP_VERSION, len))
+ error = -EFAULT;
+ break;
- case SIOCGPPPSTATS:
- error = isdn_ppp_dev_ioctl_stats(lp->ppp_slot, ifr, dev);
- break;
- default:
- error = -EINVAL;
- break;
+ case SIOCGPPPSTATS:
+ error = isdn_ppp_dev_ioctl_stats(lp->ppp_slot, ifr, dev);
+ break;
+ default:
+ error = -EINVAL;
+ break;
}
return error;
}
@@ -2050,9 +2050,9 @@ static int
isdn_ppp_if_get_unit(char *name)
{
int len,
- i,
- unit = 0,
- deci;
+ i,
+ unit = 0,
+ deci;
len = strlen(name);
@@ -2129,7 +2129,7 @@ isdn_ppp_hangup_slave(char *name)
break;
} else if (mlp->flags & ISDN_NET_CONNECTED)
break;
-
+
sdev = mlp->slave;
}
if (!sdev)
@@ -2202,8 +2202,8 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
/* Alloc large enough skb */
hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen;
- skb = alloc_skb(len + hl + 16,GFP_ATOMIC);
- if(!skb) {
+ skb = alloc_skb(len + hl + 16, GFP_ATOMIC);
+ if (!skb) {
printk(KERN_WARNING
"ippp: CCP cannot send reset - out of memory\n");
return;
@@ -2211,7 +2211,7 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
skb_reserve(skb, hl);
/* We may need to stuff an address and control field first */
- if(!(is->pppcfg & SC_COMP_AC)) {
+ if (!(is->pppcfg & SC_COMP_AC)) {
p = skb_put(skb, 2);
*p++ = 0xff;
*p++ = 0x03;
@@ -2228,14 +2228,14 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
*p++ = (cnt & 0xff);
/* Now stuff remaining bytes */
- if(len) {
+ if (len) {
p = skb_put(skb, len);
memcpy(p, data, len);
}
/* skb is now ready for xmit */
printk(KERN_DEBUG "Sending CCP Frame:\n");
- isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
+ isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit, lp->ppp_slot);
isdn_net_write_super(lp, skb);
}
@@ -2245,7 +2245,7 @@ static struct ippp_ccp_reset *isdn_ppp_ccp_reset_alloc(struct ippp_struct *is)
{
struct ippp_ccp_reset *r;
r = kzalloc(sizeof(struct ippp_ccp_reset), GFP_KERNEL);
- if(!r) {
+ if (!r) {
printk(KERN_ERR "ippp_ccp: failed to allocate reset data"
" structure - no mem\n");
return NULL;
@@ -2262,8 +2262,8 @@ static void isdn_ppp_ccp_reset_free(struct ippp_struct *is)
printk(KERN_DEBUG "ippp_ccp: freeing reset data structure %p\n",
is->reset);
- for(id = 0; id < 256; id++) {
- if(is->reset->rs[id]) {
+ for (id = 0; id < 256; id++) {
+ if (is->reset->rs[id]) {
isdn_ppp_ccp_reset_free_state(is, (unsigned char)id);
}
}
@@ -2277,11 +2277,11 @@ static void isdn_ppp_ccp_reset_free_state(struct ippp_struct *is,
{
struct ippp_ccp_reset_state *rs;
- if(is->reset->rs[id]) {
+ if (is->reset->rs[id]) {
printk(KERN_DEBUG "ippp_ccp: freeing state for id %d\n", id);
rs = is->reset->rs[id];
/* Make sure the kernel will not call back later */
- if(rs->ta)
+ if (rs->ta)
del_timer(&rs->timer);
is->reset->rs[id] = NULL;
kfree(rs);
@@ -2297,13 +2297,13 @@ static void isdn_ppp_ccp_timer_callback(unsigned long closure)
struct ippp_ccp_reset_state *rs =
(struct ippp_ccp_reset_state *)closure;
- if(!rs) {
+ if (!rs) {
printk(KERN_ERR "ippp_ccp: timer cb with zero closure.\n");
return;
}
- if(rs->ta && rs->state == CCPResetSentReq) {
+ if (rs->ta && rs->state == CCPResetSentReq) {
/* We are correct here */
- if(!rs->expra) {
+ if (!rs->expra) {
/* Hmm, there is no Ack really expected. We can clean
up the state now, it will be reallocated if the
decompressor insists on another reset */
@@ -2317,7 +2317,7 @@ static void isdn_ppp_ccp_timer_callback(unsigned long closure)
isdn_ppp_ccp_xmit_reset(rs->is, PPP_CCP, CCP_RESETREQ, rs->id,
rs->data, rs->dlen);
/* Restart timer */
- rs->timer.expires = jiffies + HZ*5;
+ rs->timer.expires = jiffies + HZ * 5;
add_timer(&rs->timer);
} else {
printk(KERN_WARNING "ippp_ccp: timer cb in wrong state %d\n",
@@ -2327,16 +2327,16 @@ static void isdn_ppp_ccp_timer_callback(unsigned long closure)
/* Allocate a new reset transaction state */
static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_struct *is,
- unsigned char id)
+ unsigned char id)
{
struct ippp_ccp_reset_state *rs;
- if(is->reset->rs[id]) {
+ if (is->reset->rs[id]) {
printk(KERN_WARNING "ippp_ccp: old state exists for id %d\n",
id);
return NULL;
} else {
rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL);
- if(!rs)
+ if (!rs)
return NULL;
rs->state = CCPResetIdle;
rs->is = is;
@@ -2357,21 +2357,21 @@ static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
{
struct ippp_ccp_reset_state *rs;
- if(rp->valid) {
+ if (rp->valid) {
/* The decompressor defines parameters by itself */
- if(rp->rsend) {
+ if (rp->rsend) {
/* And he wants us to send a request */
- if(!(rp->idval)) {
+ if (!(rp->idval)) {
printk(KERN_ERR "ippp_ccp: decompressor must"
" specify reset id\n");
return;
}
- if(is->reset->rs[rp->id]) {
+ if (is->reset->rs[rp->id]) {
/* There is already a transaction in existence
for this id. May be still waiting for a
Ack or may be wrong. */
rs = is->reset->rs[rp->id];
- if(rs->state == CCPResetSentReq && rs->ta) {
+ if (rs->state == CCPResetSentReq && rs->ta) {
printk(KERN_DEBUG "ippp_ccp: reset"
" trans still in progress"
" for id %d\n", rp->id);
@@ -2385,14 +2385,14 @@ static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
printk(KERN_DEBUG "ippp_ccp: new trans for id"
" %d to be started\n", rp->id);
rs = isdn_ppp_ccp_reset_alloc_state(is, rp->id);
- if(!rs) {
+ if (!rs) {
printk(KERN_ERR "ippp_ccp: out of mem"
" allocing ccp trans\n");
return;
}
rs->state = CCPResetSentReq;
rs->expra = rp->expra;
- if(rp->dtval) {
+ if (rp->dtval) {
rs->dlen = rp->dlen;
memcpy(rs->data, rp->data, rp->dlen);
}
@@ -2401,7 +2401,7 @@ static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
CCP_RESETREQ, rs->id,
rs->data, rs->dlen);
/* Start the timer */
- rs->timer.expires = jiffies + 5*HZ;
+ rs->timer.expires = jiffies + 5 * HZ;
add_timer(&rs->timer);
rs->ta = 1;
}
@@ -2413,12 +2413,12 @@ static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
care about them, so we just send the minimal requests
and increase ids only when an Ack is received for a
given id */
- if(is->reset->rs[is->reset->lastid]) {
+ if (is->reset->rs[is->reset->lastid]) {
/* There is already a transaction in existence
for this id. May be still waiting for a
Ack or may be wrong. */
rs = is->reset->rs[is->reset->lastid];
- if(rs->state == CCPResetSentReq && rs->ta) {
+ if (rs->state == CCPResetSentReq && rs->ta) {
printk(KERN_DEBUG "ippp_ccp: reset"
" trans still in progress"
" for id %d\n", rp->id);
@@ -2432,7 +2432,7 @@ static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
" %d to be started\n", is->reset->lastid);
rs = isdn_ppp_ccp_reset_alloc_state(is,
is->reset->lastid);
- if(!rs) {
+ if (!rs) {
printk(KERN_ERR "ippp_ccp: out of mem"
" allocing ccp trans\n");
return;
@@ -2446,7 +2446,7 @@ static void isdn_ppp_ccp_reset_trans(struct ippp_struct *is,
isdn_ppp_ccp_xmit_reset(is, PPP_CCP, CCP_RESETREQ,
rs->id, NULL, 0);
/* Start the timer */
- rs->timer.expires = jiffies + 5*HZ;
+ rs->timer.expires = jiffies + 5 * HZ;
add_timer(&rs->timer);
rs->ta = 1;
}
@@ -2460,17 +2460,17 @@ static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
{
struct ippp_ccp_reset_state *rs = is->reset->rs[id];
- if(rs) {
- if(rs->ta && rs->state == CCPResetSentReq) {
+ if (rs) {
+ if (rs->ta && rs->state == CCPResetSentReq) {
/* Great, we are correct */
- if(!rs->expra)
+ if (!rs->expra)
printk(KERN_DEBUG "ippp_ccp: ResetAck received"
" for id %d but not expected\n", id);
} else {
printk(KERN_INFO "ippp_ccp: ResetAck received out of"
"sync for id %d\n", id);
}
- if(rs->ta) {
+ if (rs->ta) {
rs->ta = 0;
del_timer(&rs->timer);
}
@@ -2483,7 +2483,7 @@ static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
is->reset->lastid++;
}
-/*
+/*
* decompress packet
*
* if master = 0, we're trying to uncompress an per-link compressed packet,
@@ -2495,8 +2495,8 @@ static void isdn_ppp_ccp_reset_ack_rcvd(struct ippp_struct *is,
* NULL if decompression error
*/
-static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struct *is,struct ippp_struct *master,
- int *proto)
+static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb, struct ippp_struct *is, struct ippp_struct *master,
+ int *proto)
{
void *stat = NULL;
struct isdn_ppp_compressor *ipc = NULL;
@@ -2506,8 +2506,8 @@ static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struc
struct isdn_ppp_resetparams rsparm;
unsigned char rsdata[IPPP_RESET_MAXDATABYTES];
- if(!master) {
- // per-link decompression
+ if (!master) {
+ // per-link decompression
stat = is->link_decomp_stat;
ipc = is->link_decompressor;
ri = is;
@@ -2524,28 +2524,28 @@ static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struc
}
BUG_ON(!stat); // if we have a compressor, stat has been set as well
- if((master && *proto == PPP_COMP) || (!master && *proto == PPP_COMPFRAG) ) {
+ if ((master && *proto == PPP_COMP) || (!master && *proto == PPP_COMPFRAG)) {
// compressed packets are compressed by their protocol type
// Set up reset params for the decompressor
- memset(&rsparm, 0, sizeof(rsparm));
- rsparm.data = rsdata;
- rsparm.maxdlen = IPPP_RESET_MAXDATABYTES;
-
- skb_out = dev_alloc_skb(is->mru + PPP_HDRLEN);
- if (!skb_out) {
- kfree_skb(skb);
- printk(KERN_ERR "ippp: decomp memory allocation failure\n");
+ memset(&rsparm, 0, sizeof(rsparm));
+ rsparm.data = rsdata;
+ rsparm.maxdlen = IPPP_RESET_MAXDATABYTES;
+
+ skb_out = dev_alloc_skb(is->mru + PPP_HDRLEN);
+ if (!skb_out) {
+ kfree_skb(skb);
+ printk(KERN_ERR "ippp: decomp memory allocation failure\n");
return NULL;
- }
+ }
len = ipc->decompress(stat, skb, skb_out, &rsparm);
kfree_skb(skb);
if (len <= 0) {
- switch(len) {
+ switch (len) {
case DECOMP_ERROR:
printk(KERN_INFO "ippp: decomp wants reset %s params\n",
rsparm.valid ? "with" : "without");
-
+
isdn_ppp_ccp_reset_trans(ri, &rsparm);
break;
case DECOMP_FATALERROR:
@@ -2563,7 +2563,7 @@ static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struc
return NULL;
}
return skb_out;
- } else {
+ } else {
// uncompressed packets are fed through the decompressor to
// update the decompressor state
ipc->incomp(stat, skb, *proto);
@@ -2572,31 +2572,31 @@ static struct sk_buff *isdn_ppp_decompress(struct sk_buff *skb,struct ippp_struc
}
/*
- * compress a frame
+ * compress a frame
* type=0: normal/bundle compression
* =1: link compression
* returns original skb if we haven't compressed the frame
* and a new skb pointer if we've done it
*/
-static struct sk_buff *isdn_ppp_compress(struct sk_buff *skb_in,int *proto,
- struct ippp_struct *is,struct ippp_struct *master,int type)
+static struct sk_buff *isdn_ppp_compress(struct sk_buff *skb_in, int *proto,
+ struct ippp_struct *is, struct ippp_struct *master, int type)
{
- int ret;
- int new_proto;
- struct isdn_ppp_compressor *compressor;
- void *stat;
- struct sk_buff *skb_out;
+ int ret;
+ int new_proto;
+ struct isdn_ppp_compressor *compressor;
+ void *stat;
+ struct sk_buff *skb_out;
/* we do not compress control protocols */
- if(*proto < 0 || *proto > 0x3fff) {
- return skb_in;
- }
+ if (*proto < 0 || *proto > 0x3fff) {
+ return skb_in;
+ }
- if(type) { /* type=1 => Link compression */
+ if (type) { /* type=1 => Link compression */
return skb_in;
}
else {
- if(!master) {
+ if (!master) {
compressor = is->compressor;
stat = is->comp_stat;
}
@@ -2607,90 +2607,90 @@ static struct sk_buff *isdn_ppp_compress(struct sk_buff *skb_in,int *proto,
new_proto = PPP_COMP;
}
- if(!compressor) {
+ if (!compressor) {
printk(KERN_ERR "isdn_ppp: No compressor set!\n");
return skb_in;
}
- if(!stat) {
+ if (!stat) {
printk(KERN_ERR "isdn_ppp: Compressor not initialized?\n");
return skb_in;
}
/* Allow for at least 150 % expansion (for now) */
- skb_out = alloc_skb(skb_in->len + skb_in->len/2 + 32 +
- skb_headroom(skb_in), GFP_ATOMIC);
- if(!skb_out)
+ skb_out = alloc_skb(skb_in->len + skb_in->len / 2 + 32 +
+ skb_headroom(skb_in), GFP_ATOMIC);
+ if (!skb_out)
return skb_in;
skb_reserve(skb_out, skb_headroom(skb_in));
- ret = (compressor->compress)(stat,skb_in,skb_out,*proto);
- if(!ret) {
+ ret = (compressor->compress)(stat, skb_in, skb_out, *proto);
+ if (!ret) {
dev_kfree_skb(skb_out);
return skb_in;
}
-
+
dev_kfree_skb(skb_in);
*proto = new_proto;
return skb_out;
}
/*
- * we received a CCP frame ..
+ * we received a CCP frame ..
* not a clean solution, but we MUST handle a few cases in the kernel
*/
static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
- struct sk_buff *skb,int proto)
+ struct sk_buff *skb, int proto)
{
struct ippp_struct *is;
struct ippp_struct *mis;
int len;
struct isdn_ppp_resetparams rsparm;
- unsigned char rsdata[IPPP_RESET_MAXDATABYTES];
+ unsigned char rsdata[IPPP_RESET_MAXDATABYTES];
printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n",
- lp->ppp_slot);
+ lp->ppp_slot);
if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
- __func__, lp->ppp_slot);
+ __func__, lp->ppp_slot);
return;
}
is = ippp_table[lp->ppp_slot];
- isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
+ isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit, lp->ppp_slot);
- if(lp->master) {
+ if (lp->master) {
int slot = ISDN_MASTER_PRIV(lp)->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: slot(%d) out of range\n",
- __func__, slot);
+ __func__, slot);
return;
- }
+ }
mis = ippp_table[slot];
} else
mis = is;
- switch(skb->data[0]) {
+ switch (skb->data[0]) {
case CCP_CONFREQ:
- if(is->debug & 0x10)
+ if (is->debug & 0x10)
printk(KERN_DEBUG "Disable compression here!\n");
- if(proto == PPP_CCP)
- mis->compflags &= ~SC_COMP_ON;
+ if (proto == PPP_CCP)
+ mis->compflags &= ~SC_COMP_ON;
else
- is->compflags &= ~SC_LINK_COMP_ON;
+ is->compflags &= ~SC_LINK_COMP_ON;
break;
case CCP_TERMREQ:
case CCP_TERMACK:
- if(is->debug & 0x10)
+ if (is->debug & 0x10)
printk(KERN_DEBUG "Disable (de)compression here!\n");
- if(proto == PPP_CCP)
- mis->compflags &= ~(SC_DECOMP_ON|SC_COMP_ON);
+ if (proto == PPP_CCP)
+ mis->compflags &= ~(SC_DECOMP_ON | SC_COMP_ON);
else
- is->compflags &= ~(SC_LINK_DECOMP_ON|SC_LINK_COMP_ON);
+ is->compflags &= ~(SC_LINK_DECOMP_ON | SC_LINK_COMP_ON);
break;
case CCP_CONFACK:
/* if we RECEIVE an ackowledge we enable the decompressor */
- if(is->debug & 0x10)
+ if (is->debug & 0x10)
printk(KERN_DEBUG "Enable decompression here!\n");
- if(proto == PPP_CCP) {
+ if (proto == PPP_CCP) {
if (!mis->decompressor)
break;
mis->compflags |= SC_DECOMP_ON;
@@ -2706,11 +2706,11 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
len = (skb->data[2] << 8) | skb->data[3];
len -= 4;
- if(proto == PPP_CCP) {
+ if (proto == PPP_CCP) {
/* If a reset Ack was outstanding for this id, then
clean up the state engine */
isdn_ppp_ccp_reset_ack_rcvd(mis, skb->data[1]);
- if(mis->decompressor && mis->decomp_stat)
+ if (mis->decompressor && mis->decomp_stat)
mis->decompressor->
reset(mis->decomp_stat,
skb->data[0],
@@ -2722,7 +2722,7 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
}
else {
isdn_ppp_ccp_reset_ack_rcvd(is, skb->data[1]);
- if(is->link_decompressor && is->link_decomp_stat)
+ if (is->link_decompressor && is->link_decomp_stat)
is->link_decompressor->
reset(is->link_decomp_stat,
skb->data[0],
@@ -2740,12 +2740,12 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
/* Set up reset params for the reset entry */
memset(&rsparm, 0, sizeof(rsparm));
rsparm.data = rsdata;
- rsparm.maxdlen = IPPP_RESET_MAXDATABYTES;
+ rsparm.maxdlen = IPPP_RESET_MAXDATABYTES;
/* Isolate data length */
len = (skb->data[2] << 8) | skb->data[3];
len -= 4;
- if(proto == PPP_CCP) {
- if(mis->compressor && mis->comp_stat)
+ if (proto == PPP_CCP) {
+ if (mis->compressor && mis->comp_stat)
mis->compressor->
reset(mis->comp_stat,
skb->data[0],
@@ -2754,7 +2754,7 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
len, &rsparm);
}
else {
- if(is->link_compressor && is->link_comp_stat)
+ if (is->link_compressor && is->link_comp_stat)
is->link_compressor->
reset(is->link_comp_stat,
skb->data[0],
@@ -2763,9 +2763,9 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
len, &rsparm);
}
/* Ack the Req as specified by rsparm */
- if(rsparm.valid) {
+ if (rsparm.valid) {
/* Compressor reset handler decided how to answer */
- if(rsparm.rsend) {
+ if (rsparm.rsend) {
/* We should send a Frame */
isdn_ppp_ccp_xmit_reset(is, proto, CCP_RESETACK,
rsparm.idval ? rsparm.id
@@ -2817,69 +2817,69 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb)
{
- struct ippp_struct *mis,*is;
+ struct ippp_struct *mis, *is;
int proto, slot = lp->ppp_slot;
unsigned char *data;
- if(!skb || skb->len < 3)
+ if (!skb || skb->len < 3)
return;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
- __func__, slot);
+ __func__, slot);
return;
- }
+ }
is = ippp_table[slot];
/* Daemon may send with or without address and control field comp */
data = skb->data;
- if(!(is->pppcfg & SC_COMP_AC) && data[0] == 0xff && data[1] == 0x03) {
+ if (!(is->pppcfg & SC_COMP_AC) && data[0] == 0xff && data[1] == 0x03) {
data += 2;
- if(skb->len < 5)
+ if (skb->len < 5)
return;
}
- proto = ((int)data[0]<<8)+data[1];
- if(proto != PPP_CCP && proto != PPP_CCPFRAG)
+ proto = ((int)data[0]<<8) + data[1];
+ if (proto != PPP_CCP && proto != PPP_CCPFRAG)
return;
printk(KERN_DEBUG "Received CCP frame from daemon:\n");
- isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
+ isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit, lp->ppp_slot);
if (lp->master) {
slot = ISDN_MASTER_PRIV(lp)->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: slot(%d) out of range\n",
- __func__, slot);
+ __func__, slot);
return;
- }
+ }
mis = ippp_table[slot];
} else
mis = is;
if (mis != is)
printk(KERN_DEBUG "isdn_ppp: Ouch! Master CCP sends on slave slot!\n");
-
- switch(data[2]) {
+
+ switch (data[2]) {
case CCP_CONFREQ:
- if(is->debug & 0x10)
+ if (is->debug & 0x10)
printk(KERN_DEBUG "Disable decompression here!\n");
- if(proto == PPP_CCP)
+ if (proto == PPP_CCP)
is->compflags &= ~SC_DECOMP_ON;
else
is->compflags &= ~SC_LINK_DECOMP_ON;
break;
case CCP_TERMREQ:
case CCP_TERMACK:
- if(is->debug & 0x10)
+ if (is->debug & 0x10)
printk(KERN_DEBUG "Disable (de)compression here!\n");
- if(proto == PPP_CCP)
- is->compflags &= ~(SC_DECOMP_ON|SC_COMP_ON);
+ if (proto == PPP_CCP)
+ is->compflags &= ~(SC_DECOMP_ON | SC_COMP_ON);
else
- is->compflags &= ~(SC_LINK_DECOMP_ON|SC_LINK_COMP_ON);
+ is->compflags &= ~(SC_LINK_DECOMP_ON | SC_LINK_COMP_ON);
break;
case CCP_CONFACK:
/* if we SEND an ackowledge we can/must enable the compressor */
- if(is->debug & 0x10)
+ if (is->debug & 0x10)
printk(KERN_DEBUG "Enable compression here!\n");
- if(proto == PPP_CCP) {
+ if (proto == PPP_CCP) {
if (!is->compressor)
break;
is->compflags |= SC_COMP_ON;
@@ -2891,21 +2891,21 @@ static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct
break;
case CCP_RESETACK:
/* If we send a ACK we should reset our compressor */
- if(is->debug & 0x10)
+ if (is->debug & 0x10)
printk(KERN_DEBUG "Reset decompression state here!\n");
printk(KERN_DEBUG "ResetAck from daemon passed by\n");
- if(proto == PPP_CCP) {
+ if (proto == PPP_CCP) {
/* link to master? */
- if(is->compressor && is->comp_stat)
+ if (is->compressor && is->comp_stat)
is->compressor->reset(is->comp_stat, 0, 0,
NULL, 0, NULL);
- is->compflags &= ~SC_COMP_DISCARD;
+ is->compflags &= ~SC_COMP_DISCARD;
}
else {
- if(is->link_compressor && is->link_comp_stat)
+ if (is->link_compressor && is->link_comp_stat)
is->link_compressor->reset(is->link_comp_stat,
0, 0, NULL, 0, NULL);
- is->compflags &= ~SC_LINK_COMP_DISCARD;
+ is->compflags &= ~SC_LINK_COMP_DISCARD;
}
break;
case CCP_RESETREQ:
@@ -2919,7 +2919,7 @@ int isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc)
{
ipc->next = ipc_head;
ipc->prev = NULL;
- if(ipc_head) {
+ if (ipc_head) {
ipc_head->prev = ipc;
}
ipc_head = ipc;
@@ -2928,11 +2928,11 @@ int isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc)
int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc)
{
- if(ipc->prev)
+ if (ipc->prev)
ipc->prev->next = ipc->next;
else
ipc_head = ipc->next;
- if(ipc->next)
+ if (ipc->next)
ipc->next->prev = ipc->prev;
ipc->prev = ipc->next = NULL;
return 0;
@@ -2945,26 +2945,26 @@ static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_
void *stat;
int num = data->num;
- if(is->debug & 0x10)
- printk(KERN_DEBUG "[%d] Set %s type %d\n",is->unit,
- (data->flags&IPPP_COMP_FLAG_XMIT)?"compressor":"decompressor",num);
+ if (is->debug & 0x10)
+ printk(KERN_DEBUG "[%d] Set %s type %d\n", is->unit,
+ (data->flags & IPPP_COMP_FLAG_XMIT) ? "compressor" : "decompressor", num);
/* If is has no valid reset state vector, we cannot allocate a
decompressor. The decompressor would cause reset transactions
sooner or later, and they need that vector. */
- if(!(data->flags & IPPP_COMP_FLAG_XMIT) && !is->reset) {
+ if (!(data->flags & IPPP_COMP_FLAG_XMIT) && !is->reset) {
printk(KERN_ERR "ippp_ccp: no reset data structure - can't"
" allow decompression.\n");
return -ENOMEM;
}
- while(ipc) {
- if(ipc->num == num) {
+ while (ipc) {
+ if (ipc->num == num) {
stat = ipc->alloc(data);
- if(stat) {
- ret = ipc->init(stat,data,is->unit,0);
- if(!ret) {
+ if (stat) {
+ ret = ipc->init(stat, data, is->unit, 0);
+ if (!ret) {
printk(KERN_ERR "Can't init (de)compression!\n");
ipc->free(stat);
stat = NULL;
@@ -2976,32 +2976,32 @@ static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_
break;
}
- if(data->flags & IPPP_COMP_FLAG_XMIT) {
- if(data->flags & IPPP_COMP_FLAG_LINK) {
- if(is->link_comp_stat)
+ if (data->flags & IPPP_COMP_FLAG_XMIT) {
+ if (data->flags & IPPP_COMP_FLAG_LINK) {
+ if (is->link_comp_stat)
is->link_compressor->free(is->link_comp_stat);
is->link_comp_stat = stat;
- is->link_compressor = ipc;
+ is->link_compressor = ipc;
}
else {
- if(is->comp_stat)
+ if (is->comp_stat)
is->compressor->free(is->comp_stat);
is->comp_stat = stat;
- is->compressor = ipc;
+ is->compressor = ipc;
}
}
- else {
- if(data->flags & IPPP_COMP_FLAG_LINK) {
- if(is->link_decomp_stat)
+ else {
+ if (data->flags & IPPP_COMP_FLAG_LINK) {
+ if (is->link_decomp_stat)
is->link_decompressor->free(is->link_decomp_stat);
is->link_decomp_stat = stat;
- is->link_decompressor = ipc;
+ is->link_decompressor = ipc;
}
else {
- if(is->decomp_stat)
+ if (is->decomp_stat)
is->decompressor->free(is->decomp_stat);
is->decomp_stat = stat;
- is->decompressor = ipc;
+ is->decompressor = ipc;
}
}
return 0;
diff --git a/drivers/isdn/i4l/isdn_ppp.h b/drivers/isdn/i4l/isdn_ppp.h
index 8cc05c7ccf78..4e9b8935a4eb 100644
--- a/drivers/isdn/i4l/isdn_ppp.h
+++ b/drivers/isdn/i4l/isdn_ppp.h
@@ -39,5 +39,3 @@ extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc);
#define IPPP_ASSIGNED 0x10
#define IPPP_MAX_HEADER 10
-
-
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 2c26b64ebbea..3831abdbc66f 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -61,7 +61,7 @@ char *isdn_tty_revision = "$Revision: 1.1.2.3 $";
* isdn_tty_readmodem().
*/
static int
-isdn_tty_try_read(modem_info * info, struct sk_buff *skb)
+isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
{
int c;
int len;
@@ -93,7 +93,7 @@ isdn_tty_try_read(modem_info * info, struct sk_buff *skb)
last = *dp;
} else {
#endif
- if(len > 1)
+ if (len > 1)
tty_insert_flip_string(tty, skb->data, len - 1);
last = skb->data[len - 1];
#ifdef CONFIG_ISDN_AUDIO
@@ -179,7 +179,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb)
info = &dev->mdm.info[midx];
#ifdef CONFIG_ISDN_AUDIO
ifmt = 1;
-
+
if ((info->vonline) && (!info->emu.vpar[4]))
isdn_audio_calc_dtmf(info, skb->data, skb->len, ifmt);
if ((info->vonline & 1) && (info->emu.vpar[1]))
@@ -213,29 +213,29 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb)
if (info->vonline & 1) {
/* voice conversion/compression */
switch (info->emu.vpar[3]) {
- case 2:
- case 3:
- case 4:
- /* adpcm
- * Since compressed data takes less
- * space, we can overwrite the buffer.
- */
- skb_trim(skb, isdn_audio_xlaw2adpcm(info->adpcmr,
- ifmt,
- skb->data,
- skb->data,
- skb->len));
- break;
- case 5:
- /* a-law */
- if (!ifmt)
- isdn_audio_ulaw2alaw(skb->data, skb->len);
- break;
- case 6:
- /* u-law */
- if (ifmt)
- isdn_audio_alaw2ulaw(skb->data, skb->len);
- break;
+ case 2:
+ case 3:
+ case 4:
+ /* adpcm
+ * Since compressed data takes less
+ * space, we can overwrite the buffer.
+ */
+ skb_trim(skb, isdn_audio_xlaw2adpcm(info->adpcmr,
+ ifmt,
+ skb->data,
+ skb->data,
+ skb->len));
+ break;
+ case 5:
+ /* a-law */
+ if (!ifmt)
+ isdn_audio_ulaw2alaw(skb->data, skb->len);
+ break;
+ case 6:
+ /* u-law */
+ if (ifmt)
+ isdn_audio_alaw2ulaw(skb->data, skb->len);
+ break;
}
ISDN_AUDIO_SKB_DLECOUNT(skb) =
isdn_tty_countDLE(skb->data, skb->len);
@@ -275,7 +275,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb)
}
static void
-isdn_tty_cleanup_xmit(modem_info * info)
+isdn_tty_cleanup_xmit(modem_info *info)
{
skb_queue_purge(&info->xmit_queue);
#ifdef CONFIG_ISDN_AUDIO
@@ -284,7 +284,7 @@ isdn_tty_cleanup_xmit(modem_info * info)
}
static void
-isdn_tty_tint(modem_info * info)
+isdn_tty_tint(modem_info *info)
{
struct sk_buff *skb = skb_dequeue(&info->xmit_queue);
int len, slen;
@@ -325,7 +325,7 @@ isdn_tty_countDLE(unsigned char *buf, int len)
* DLE-decoding when sending audio-data.
*/
static int
-isdn_tty_handleDLEdown(modem_info * info, atemu * m, int len)
+isdn_tty_handleDLEdown(modem_info *info, atemu *m, int len)
{
unsigned char *p = &info->xmit_buf[info->xmit_count];
int count = 0;
@@ -334,42 +334,42 @@ isdn_tty_handleDLEdown(modem_info * info, atemu * m, int len)
if (m->lastDLE) {
m->lastDLE = 0;
switch (*p) {
- case DLE:
- /* Escape code */
- if (len > 1)
- memmove(p, p + 1, len - 1);
- p--;
- count++;
- break;
- case ETX:
- /* End of data */
- info->vonline |= 4;
- return count;
- case DC4:
- /* Abort RX */
- info->vonline &= ~1;
+ case DLE:
+ /* Escape code */
+ if (len > 1)
+ memmove(p, p + 1, len - 1);
+ p--;
+ count++;
+ break;
+ case ETX:
+ /* End of data */
+ info->vonline |= 4;
+ return count;
+ case DC4:
+ /* Abort RX */
+ info->vonline &= ~1;
#ifdef ISDN_DEBUG_MODEM_VOICE
- printk(KERN_DEBUG
- "DLEdown: got DLE-DC4, send DLE-ETX on ttyI%d\n",
- info->line);
+ printk(KERN_DEBUG
+ "DLEdown: got DLE-DC4, send DLE-ETX on ttyI%d\n",
+ info->line);
#endif
- isdn_tty_at_cout("\020\003", info);
- if (!info->vonline) {
+ isdn_tty_at_cout("\020\003", info);
+ if (!info->vonline) {
#ifdef ISDN_DEBUG_MODEM_VOICE
- printk(KERN_DEBUG
- "DLEdown: send VCON on ttyI%d\n",
- info->line);
+ printk(KERN_DEBUG
+ "DLEdown: send VCON on ttyI%d\n",
+ info->line);
#endif
- isdn_tty_at_cout("\r\nVCON\r\n", info);
- }
- /* Fall through */
- case 'q':
- case 's':
- /* Silence */
- if (len > 1)
- memmove(p, p + 1, len - 1);
- p--;
- break;
+ isdn_tty_at_cout("\r\nVCON\r\n", info);
+ }
+ /* Fall through */
+ case 'q':
+ case 's':
+ /* Silence */
+ if (len > 1)
+ memmove(p, p + 1, len - 1);
+ p--;
+ break;
}
} else {
if (*p == DLE)
@@ -416,7 +416,7 @@ static int voice_cf[7] =
* T.70 if necessary, and finally queues it up for sending via isdn_tty_tint.
*/
static void
-isdn_tty_senddown(modem_info * info)
+isdn_tty_senddown(modem_info *info)
{
int buflen;
int skb_res;
@@ -440,9 +440,9 @@ isdn_tty_senddown(modem_info * info)
#endif
if (!(buflen = info->xmit_count))
return;
- if ((info->emu.mdmreg[REG_CTS] & BIT_CTS) != 0)
+ if ((info->emu.mdmreg[REG_CTS] & BIT_CTS) != 0)
info->msr &= ~UART_MSR_CTS;
- info->lsr &= ~UART_LSR_TEMT;
+ info->lsr &= ~UART_LSR_TEMT;
/* info->xmit_count is modified here and in isdn_tty_write().
* So we return here if isdn_tty_write() is in the
* critical section.
@@ -485,32 +485,32 @@ isdn_tty_senddown(modem_info * info)
/* voice conversion/decompression */
switch (info->emu.vpar[3]) {
- case 2:
- case 3:
- case 4:
- /* adpcm, compatible to ZyXel 1496 modem
- * with ROM revision 6.01
- */
- audio_len = isdn_audio_adpcm2xlaw(info->adpcms,
- ifmt,
- skb->data,
- skb_put(skb, audio_len),
- buflen);
- skb_pull(skb, buflen);
- skb_trim(skb, audio_len);
- break;
- case 5:
- /* a-law */
- if (!ifmt)
- isdn_audio_alaw2ulaw(skb->data,
- buflen);
- break;
- case 6:
- /* u-law */
- if (ifmt)
- isdn_audio_ulaw2alaw(skb->data,
- buflen);
- break;
+ case 2:
+ case 3:
+ case 4:
+ /* adpcm, compatible to ZyXel 1496 modem
+ * with ROM revision 6.01
+ */
+ audio_len = isdn_audio_adpcm2xlaw(info->adpcms,
+ ifmt,
+ skb->data,
+ skb_put(skb, audio_len),
+ buflen);
+ skb_pull(skb, buflen);
+ skb_trim(skb, audio_len);
+ break;
+ case 5:
+ /* a-law */
+ if (!ifmt)
+ isdn_audio_alaw2ulaw(skb->data,
+ buflen);
+ break;
+ case 6:
+ /* u-law */
+ if (ifmt)
+ isdn_audio_ulaw2alaw(skb->data,
+ buflen);
+ break;
}
}
#endif /* CONFIG_ISDN_AUDIO */
@@ -550,7 +550,7 @@ isdn_tty_modem_do_ncarrier(unsigned long data)
* low.
*/
static void
-isdn_tty_modem_ncarrier(modem_info * info)
+isdn_tty_modem_ncarrier(modem_info *info)
{
if (info->ncarrier) {
info->nc_timer.expires = jiffies + HZ;
@@ -568,30 +568,30 @@ isdn_calc_usage(int si, int l2)
#ifdef CONFIG_ISDN_AUDIO
if (si == 1) {
- switch(l2) {
- case ISDN_PROTO_L2_MODEM:
- usg = ISDN_USAGE_MODEM;
- break;
+ switch (l2) {
+ case ISDN_PROTO_L2_MODEM:
+ usg = ISDN_USAGE_MODEM;
+ break;
#ifdef CONFIG_ISDN_TTY_FAX
- case ISDN_PROTO_L2_FAX:
- usg = ISDN_USAGE_FAX;
- break;
+ case ISDN_PROTO_L2_FAX:
+ usg = ISDN_USAGE_FAX;
+ break;
#endif
- case ISDN_PROTO_L2_TRANS:
- default:
- usg = ISDN_USAGE_VOICE;
- break;
+ case ISDN_PROTO_L2_TRANS:
+ default:
+ usg = ISDN_USAGE_VOICE;
+ break;
}
}
#endif
- return(usg);
+ return (usg);
}
/* isdn_tty_dial() performs dialing of a tty an the necessary
* setup of the lower levels before that.
*/
static void
-isdn_tty_dial(char *n, modem_info * info, atemu * m)
+isdn_tty_dial(char *n, modem_info *info, atemu *m)
{
int usg = ISDN_USAGE_MODEM;
int si = 7;
@@ -608,10 +608,10 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
}
usg = isdn_calc_usage(si, l2);
#ifdef CONFIG_ISDN_AUDIO
- if ((si == 1) &&
- (l2 != ISDN_PROTO_L2_MODEM)
+ if ((si == 1) &&
+ (l2 != ISDN_PROTO_L2_MODEM)
#ifdef CONFIG_ISDN_TTY_FAX
- && (l2 != ISDN_PROTO_L2_FAX)
+ && (l2 != ISDN_PROTO_L2_FAX)
#endif
) {
l2 = ISDN_PROTO_L2_TRANS;
@@ -679,7 +679,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
* and some cleanup is done also.
*/
void
-isdn_tty_modem_hup(modem_info * info, int local)
+isdn_tty_modem_hup(modem_info *info, int local)
{
isdn_ctrl cmd;
int di, ch;
@@ -723,7 +723,7 @@ isdn_tty_modem_hup(modem_info * info, int local)
info->adpcmr = NULL;
#endif
if ((info->msr & UART_MSR_RI) &&
- (info->emu.mdmreg[REG_RUNG] & BIT_RUNG))
+ (info->emu.mdmreg[REG_RUNG] & BIT_RUNG))
isdn_tty_modem_result(RESULT_RUNG, info);
info->msr &= ~(UART_MSR_DCD | UART_MSR_RI);
info->lsr |= UART_LSR_TEMT;
@@ -746,7 +746,7 @@ isdn_tty_modem_hup(modem_info * info, int local)
}
/*
- * Begin of a CAPI like interface, currently used only for
+ * Begin of a CAPI like interface, currently used only for
* supplementary service (CAPI 2.0 part III)
*/
#include <linux/isdn/capicmd.h>
@@ -754,16 +754,16 @@ isdn_tty_modem_hup(modem_info * info, int local)
int
isdn_tty_capi_facility(capi_msg *cm) {
- return(-1); /* dummy */
+ return (-1); /* dummy */
}
/* isdn_tty_suspend() tries to suspend the current tty connection
*/
static void
-isdn_tty_suspend(char *id, modem_info * info, atemu * m)
+isdn_tty_suspend(char *id, modem_info *info, atemu *m)
{
isdn_ctrl cmd;
-
+
int l;
if (!info)
@@ -774,7 +774,7 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m)
#endif
l = strlen(id);
if ((info->isdn_driver >= 0)) {
- cmd.parm.cmsg.Length = l+18;
+ cmd.parm.cmsg.Length = l + 18;
cmd.parm.cmsg.Command = CAPI_FACILITY;
cmd.parm.cmsg.Subcommand = CAPI_REQ;
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
@@ -800,7 +800,7 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m)
*/
static void
-isdn_tty_resume(char *id, modem_info * info, atemu * m)
+isdn_tty_resume(char *id, modem_info *info, atemu *m)
{
int usg = ISDN_USAGE_MODEM;
int si = 7;
@@ -819,10 +819,10 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
}
usg = isdn_calc_usage(si, l2);
#ifdef CONFIG_ISDN_AUDIO
- if ((si == 1) &&
- (l2 != ISDN_PROTO_L2_MODEM)
+ if ((si == 1) &&
+ (l2 != ISDN_PROTO_L2_MODEM)
#ifdef CONFIG_ISDN_TTY_FAX
- && (l2 != ISDN_PROTO_L2_FAX)
+ && (l2 != ISDN_PROTO_L2_FAX)
#endif
) {
l2 = ISDN_PROTO_L2_TRANS;
@@ -864,18 +864,18 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
- cmd.parm.cmsg.Length = l+18;
+ cmd.parm.cmsg.Length = l + 18;
cmd.parm.cmsg.Command = CAPI_FACILITY;
cmd.parm.cmsg.Subcommand = CAPI_REQ;
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
cmd.parm.cmsg.para[0] = 3; /* 16 bit 0x0003 suplementary service */
cmd.parm.cmsg.para[1] = 0;
- cmd.parm.cmsg.para[2] = l+3;
+ cmd.parm.cmsg.para[2] = l + 3;
cmd.parm.cmsg.para[3] = 5; /* 16 bit 0x0005 Resume */
cmd.parm.cmsg.para[4] = 0;
cmd.parm.cmsg.para[5] = l;
strncpy(&cmd.parm.cmsg.para[6], id, l);
- cmd.command =CAPI_PUT_MESSAGE;
+ cmd.command = CAPI_PUT_MESSAGE;
info->dialing = 1;
// strcpy(dev->num[i], n);
isdn_info_update();
@@ -889,7 +889,7 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
*/
static void
-isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
+isdn_tty_send_msg(modem_info *info, atemu *m, char *msg)
{
int usg = ISDN_USAGE_MODEM;
int si = 7;
@@ -912,10 +912,10 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
}
usg = isdn_calc_usage(si, l2);
#ifdef CONFIG_ISDN_AUDIO
- if ((si == 1) &&
- (l2 != ISDN_PROTO_L2_MODEM)
+ if ((si == 1) &&
+ (l2 != ISDN_PROTO_L2_MODEM)
#ifdef CONFIG_ISDN_TTY_FAX
- && (l2 != ISDN_PROTO_L2_FAX)
+ && (l2 != ISDN_PROTO_L2_FAX)
#endif
) {
l2 = ISDN_PROTO_L2_TRANS;
@@ -956,14 +956,14 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
- cmd.parm.cmsg.Length = l+14;
+ cmd.parm.cmsg.Length = l + 14;
cmd.parm.cmsg.Command = CAPI_MANUFACTURER;
cmd.parm.cmsg.Subcommand = CAPI_REQ;
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
- cmd.parm.cmsg.para[0] = l+1;
+ cmd.parm.cmsg.para[0] = l + 1;
strncpy(&cmd.parm.cmsg.para[1], msg, l);
- cmd.parm.cmsg.para[l+1] = 0xd;
- cmd.command =CAPI_PUT_MESSAGE;
+ cmd.parm.cmsg.para[l + 1] = 0xd;
+ cmd.command = CAPI_PUT_MESSAGE;
/* info->dialing = 1;
strcpy(dev->num[i], n);
isdn_info_update();
@@ -978,7 +978,7 @@ isdn_tty_paranoia_check(modem_info *info, char *name, const char *routine)
#ifdef MODEM_PARANOIA_CHECK
if (!info) {
printk(KERN_WARNING "isdn_tty: null info_struct for %s in %s\n",
- name, routine);
+ name, routine);
return 1;
}
if (info->magic != ISDN_ASYNC_MAGIC) {
@@ -995,11 +995,11 @@ isdn_tty_paranoia_check(modem_info *info, char *name, const char *routine)
* the specified baud rate for a serial port.
*/
static void
-isdn_tty_change_speed(modem_info * info)
+isdn_tty_change_speed(modem_info *info)
{
uint cflag,
- cval,
- quot;
+ cval,
+ quot;
int i;
if (!info->tty || !info->tty->termios)
@@ -1051,7 +1051,7 @@ isdn_tty_change_speed(modem_info * info)
}
static int
-isdn_tty_startup(modem_info * info)
+isdn_tty_startup(modem_info *info)
{
if (info->flags & ISDN_ASYNC_INITIALIZED)
return 0;
@@ -1081,7 +1081,7 @@ isdn_tty_startup(modem_info * info)
* DTR is dropped if the hangup on close termio flag is on.
*/
static void
-isdn_tty_shutdown(modem_info * info)
+isdn_tty_shutdown(modem_info *info)
{
if (!(info->flags & ISDN_ASYNC_INITIALIZED))
return;
@@ -1116,7 +1116,7 @@ isdn_tty_shutdown(modem_info * info)
* - If dialing, abort dial.
*/
static int
-isdn_tty_write(struct tty_struct *tty, const u_char * buf, int count)
+isdn_tty_write(struct tty_struct *tty, const u_char *buf, int count)
{
int c;
int total = 0;
@@ -1176,27 +1176,27 @@ isdn_tty_write(struct tty_struct *tty, const u_char * buf, int count)
}
}
} else
- if (TTY_IS_FCLASS1(info)) {
- int cc = isdn_tty_handleDLEdown(info, m, c);
-
- if (info->vonline & 4) { /* ETX seen */
- isdn_ctrl c;
-
- c.command = ISDN_CMD_FAXCMD;
- c.driver = info->isdn_driver;
- c.arg = info->isdn_channel;
- c.parm.aux.cmd = ISDN_FAX_CLASS1_CTRL;
- c.parm.aux.subcmd = ETX;
- isdn_command(&c);
- }
- info->vonline = 0;
+ if (TTY_IS_FCLASS1(info)) {
+ int cc = isdn_tty_handleDLEdown(info, m, c);
+
+ if (info->vonline & 4) { /* ETX seen */
+ isdn_ctrl c;
+
+ c.command = ISDN_CMD_FAXCMD;
+ c.driver = info->isdn_driver;
+ c.arg = info->isdn_channel;
+ c.parm.aux.cmd = ISDN_FAX_CLASS1_CTRL;
+ c.parm.aux.subcmd = ETX;
+ isdn_command(&c);
+ }
+ info->vonline = 0;
#ifdef ISDN_DEBUG_MODEM_VOICE
- printk(KERN_DEBUG "fax dle cc/c %d/%d\n", cc, c);
+ printk(KERN_DEBUG "fax dle cc/c %d/%d\n", cc, c);
#endif
- info->xmit_count += cc;
- } else
+ info->xmit_count += cc;
+ } else
#endif
- info->xmit_count += c;
+ info->xmit_count += c;
} else {
info->msr |= UART_MSR_CTS;
info->lsr |= UART_LSR_TEMT;
@@ -1332,7 +1332,7 @@ isdn_tty_unthrottle(struct tty_struct *tty)
* allows RS485 driver to be written in user space.
*/
static int
-isdn_tty_get_lsr_info(modem_info * info, uint __user * value)
+isdn_tty_get_lsr_info(modem_info *info, uint __user *value)
{
u_char status;
uint result;
@@ -1363,16 +1363,16 @@ isdn_tty_tiocmget(struct tty_struct *tty)
status = info->msr;
mutex_unlock(&modem_info_mutex);
return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0)
- | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
- | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0)
- | ((status & UART_MSR_RI) ? TIOCM_RNG : 0)
- | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0)
- | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0);
+ | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
+ | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0)
+ | ((status & UART_MSR_RI) ? TIOCM_RNG : 0)
+ | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0)
+ | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0);
}
static int
isdn_tty_tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear)
+ unsigned int set, unsigned int clear)
{
modem_info *info = (modem_info *) tty->driver_data;
@@ -1422,34 +1422,34 @@ isdn_tty_ioctl(struct tty_struct *tty, uint cmd, ulong arg)
if (tty->flags & (1 << TTY_IO_ERROR))
return -EIO;
switch (cmd) {
- case TCSBRK: /* SVID version: non-zero arg --> no break */
+ case TCSBRK: /* SVID version: non-zero arg --> no break */
#ifdef ISDN_DEBUG_MODEM_IOCTL
- printk(KERN_DEBUG "ttyI%d ioctl TCSBRK\n", info->line);
-#endif
- retval = tty_check_change(tty);
- if (retval)
- return retval;
- tty_wait_until_sent(tty, 0);
- return 0;
- case TCSBRKP: /* support for POSIX tcsendbreak() */
+ printk(KERN_DEBUG "ttyI%d ioctl TCSBRK\n", info->line);
+#endif
+ retval = tty_check_change(tty);
+ if (retval)
+ return retval;
+ tty_wait_until_sent(tty, 0);
+ return 0;
+ case TCSBRKP: /* support for POSIX tcsendbreak() */
#ifdef ISDN_DEBUG_MODEM_IOCTL
- printk(KERN_DEBUG "ttyI%d ioctl TCSBRKP\n", info->line);
-#endif
- retval = tty_check_change(tty);
- if (retval)
- return retval;
- tty_wait_until_sent(tty, 0);
- return 0;
- case TIOCSERGETLSR: /* Get line status register */
+ printk(KERN_DEBUG "ttyI%d ioctl TCSBRKP\n", info->line);
+#endif
+ retval = tty_check_change(tty);
+ if (retval)
+ return retval;
+ tty_wait_until_sent(tty, 0);
+ return 0;
+ case TIOCSERGETLSR: /* Get line status register */
#ifdef ISDN_DEBUG_MODEM_IOCTL
- printk(KERN_DEBUG "ttyI%d ioctl TIOCSERGETLSR\n", info->line);
+ printk(KERN_DEBUG "ttyI%d ioctl TIOCSERGETLSR\n", info->line);
#endif
- return isdn_tty_get_lsr_info(info, (uint __user *) arg);
- default:
+ return isdn_tty_get_lsr_info(info, (uint __user *) arg);
+ default:
#ifdef ISDN_DEBUG_MODEM_IOCTL
- printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line);
+ printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line);
#endif
- return -ENOIOCTLCMD;
+ return -ENOIOCTLCMD;
}
return 0;
}
@@ -1479,7 +1479,7 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
* ------------------------------------------------------------
*/
static int
-isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info * info)
+isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *info)
{
DECLARE_WAITQUEUE(wait, NULL);
int do_clocal = 0;
@@ -1590,12 +1590,9 @@ static int
isdn_tty_open(struct tty_struct *tty, struct file *filp)
{
modem_info *info;
- int retval, line;
+ int retval;
- line = tty->index;
- if (line < 0 || line >= ISDN_MAX_CHANNELS)
- return -ENODEV;
- info = &dev->mdm.info[line];
+ info = &dev->mdm.info[tty->index];
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open"))
return -ENODEV;
if (!try_module_get(info->owner)) {
@@ -1603,7 +1600,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
return -ENODEV;
}
#ifdef ISDN_DEBUG_MODEM_OPEN
- printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name,
+ printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name,
info->count);
#endif
info->count++;
@@ -1703,7 +1700,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
timeout = jiffies + HZ;
while (!(info->lsr & UART_LSR_TEMT)) {
schedule_timeout_interruptible(20);
- if (time_after(jiffies,timeout))
+ if (time_after(jiffies, timeout))
break;
}
}
@@ -1746,7 +1743,7 @@ isdn_tty_hangup(struct tty_struct *tty)
/* This routine initializes all emulator-data.
*/
static void
-isdn_tty_reset_profile(atemu * m)
+isdn_tty_reset_profile(atemu *m)
{
m->profile[0] = 0;
m->profile[1] = 0;
@@ -1776,7 +1773,7 @@ isdn_tty_reset_profile(atemu * m)
#ifdef CONFIG_ISDN_AUDIO
static void
-isdn_tty_modem_reset_vpar(atemu * m)
+isdn_tty_modem_reset_vpar(atemu *m)
{
m->vpar[0] = 2; /* Voice-device (2 = phone line) */
m->vpar[1] = 0; /* Silence detection level (0 = none ) */
@@ -1789,7 +1786,7 @@ isdn_tty_modem_reset_vpar(atemu * m)
#ifdef CONFIG_ISDN_TTY_FAX
static void
-isdn_tty_modem_reset_faxpar(modem_info * info)
+isdn_tty_modem_reset_faxpar(modem_info *info)
{
T30_s *f = info->fax;
@@ -1822,7 +1819,7 @@ isdn_tty_modem_reset_faxpar(modem_info * info)
#endif
static void
-isdn_tty_modem_reset_regs(modem_info * info, int force)
+isdn_tty_modem_reset_regs(modem_info *info, int force)
{
atemu *m = &info->emu;
if ((m->mdmreg[REG_DTRR] & BIT_DTRR) || force) {
@@ -1841,7 +1838,7 @@ isdn_tty_modem_reset_regs(modem_info * info, int force)
}
static void
-modem_write_profile(atemu * m)
+modem_write_profile(atemu *m)
{
memcpy(m->profile, m->mdmreg, ISDN_MODEM_NUMREG);
memcpy(m->pmsn, m->msn, ISDN_MSNLEN);
@@ -1851,7 +1848,7 @@ modem_write_profile(atemu * m)
}
static const struct tty_operations modem_ops = {
- .open = isdn_tty_open,
+ .open = isdn_tty_open,
.close = isdn_tty_close,
.write = isdn_tty_write,
.flush_chars = isdn_tty_flush_chars,
@@ -1951,7 +1948,7 @@ err_unregister:
kfree(info->xmit_buf - 4);
}
tty_unregister_driver(m->tty_modem);
- err:
+err:
put_tty_driver(m->tty_modem);
m->tty_modem = NULL;
return retval;
@@ -2021,8 +2018,8 @@ isdn_tty_match_icall(char *cid, atemu *emu, int di)
int tmp;
tmp = isdn_msncmp(cid, isdn_map_eaz2msn(emu->msn, di));
#ifdef ISDN_DEBUG_MODEM_ICALL
- printk(KERN_DEBUG "m_fi: mmsn=%s -> tmp=%d\n",
- isdn_map_eaz2msn(emu->msn, di), tmp);
+ printk(KERN_DEBUG "m_fi: mmsn=%s -> tmp=%d\n",
+ isdn_map_eaz2msn(emu->msn, di), tmp);
#endif
return tmp;
}
@@ -2071,8 +2068,8 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
modem_info *info = &dev->mdm.info[i];
- if (info->count == 0)
- continue;
+ if (info->count == 0)
+ continue;
if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */
(info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */
idx = isdn_dc2minor(di, ch);
@@ -2099,7 +2096,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
info->drv_index = idx;
dev->m_idx[idx] = info->line;
dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE;
- dev->usage[idx] |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]);
+ dev->usage[idx] |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]);
strcpy(dev->num[idx], nr);
strcpy(info->emu.cpn, eaz);
info->emu.mdmreg[REG_SI1I] = si2bit[si1];
@@ -2119,11 +2116,11 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
}
spin_unlock_irqrestore(&dev->lock, 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");
- return (wret == 2)?3:0;
+ ((dev->drv[di]->flags & DRV_FLAG_REJBUS) && (wret != 2)) ? "rejected" : "ignored");
+ return (wret == 2) ? 3 : 0;
}
-#define TTY_IS_ACTIVE(info) \
+#define TTY_IS_ACTIVE(info) \
(info->flags & (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE))
int
@@ -2138,174 +2135,174 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
if ((mi = dev->m_idx[i]) >= 0) {
info = &dev->mdm.info[mi];
switch (c->command) {
- case ISDN_STAT_CINF:
- printk(KERN_DEBUG "CHARGEINFO on ttyI%d: %ld %s\n", info->line, c->arg, c->parm.num);
- info->emu.charge = (unsigned) simple_strtoul(c->parm.num, &e, 10);
- if (e == (char *)c->parm.num)
- info->emu.charge = 0;
-
- break;
- case ISDN_STAT_BSENT:
-#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line);
-#endif
- if ((info->isdn_driver == c->driver) &&
- (info->isdn_channel == c->arg)) {
- info->msr |= UART_MSR_CTS;
- if (info->send_outstanding)
- if (!(--info->send_outstanding))
- info->lsr |= UART_LSR_TEMT;
- isdn_tty_tint(info);
- return 1;
- }
- break;
- case ISDN_STAT_CAUSE:
+ case ISDN_STAT_CINF:
+ printk(KERN_DEBUG "CHARGEINFO on ttyI%d: %ld %s\n", info->line, c->arg, c->parm.num);
+ info->emu.charge = (unsigned) simple_strtoul(c->parm.num, &e, 10);
+ if (e == (char *)c->parm.num)
+ info->emu.charge = 0;
+
+ break;
+ case ISDN_STAT_BSENT:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_CAUSE ttyI%d\n", info->line);
+ printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line);
#endif
- /* Signal cause to tty-device */
- strncpy(info->last_cause, c->parm.num, 5);
+ if ((info->isdn_driver == c->driver) &&
+ (info->isdn_channel == c->arg)) {
+ info->msr |= UART_MSR_CTS;
+ if (info->send_outstanding)
+ if (!(--info->send_outstanding))
+ info->lsr |= UART_LSR_TEMT;
+ isdn_tty_tint(info);
return 1;
- case ISDN_STAT_DISPLAY:
+ }
+ break;
+ case ISDN_STAT_CAUSE:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_DISPLAY ttyI%d\n", info->line);
-#endif
- /* Signal display to tty-device */
- if ((info->emu.mdmreg[REG_DISPLAY] & BIT_DISPLAY) &&
- !(info->emu.mdmreg[REG_RESPNUM] & BIT_RESPNUM)) {
- isdn_tty_at_cout("\r\n", info);
- isdn_tty_at_cout("DISPLAY: ", info);
- isdn_tty_at_cout(c->parm.display, info);
- isdn_tty_at_cout("\r\n", info);
- }
- return 1;
- case ISDN_STAT_DCONN:
+ printk(KERN_DEBUG "tty_STAT_CAUSE ttyI%d\n", info->line);
+#endif
+ /* Signal cause to tty-device */
+ strncpy(info->last_cause, c->parm.num, 5);
+ return 1;
+ case ISDN_STAT_DISPLAY:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line);
+ printk(KERN_DEBUG "tty_STAT_DISPLAY ttyI%d\n", info->line);
#endif
- if (TTY_IS_ACTIVE(info)) {
- if (info->dialing == 1) {
- info->dialing = 2;
- return 1;
- }
+ /* Signal display to tty-device */
+ if ((info->emu.mdmreg[REG_DISPLAY] & BIT_DISPLAY) &&
+ !(info->emu.mdmreg[REG_RESPNUM] & BIT_RESPNUM)) {
+ isdn_tty_at_cout("\r\n", info);
+ isdn_tty_at_cout("DISPLAY: ", info);
+ isdn_tty_at_cout(c->parm.display, info);
+ isdn_tty_at_cout("\r\n", info);
+ }
+ return 1;
+ case ISDN_STAT_DCONN:
+#ifdef ISDN_TTY_STAT_DEBUG
+ printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line);
+#endif
+ if (TTY_IS_ACTIVE(info)) {
+ if (info->dialing == 1) {
+ info->dialing = 2;
+ return 1;
}
- break;
- case ISDN_STAT_DHUP:
+ }
+ break;
+ case ISDN_STAT_DHUP:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_DHUP ttyI%d\n", info->line);
+ printk(KERN_DEBUG "tty_STAT_DHUP ttyI%d\n", info->line);
#endif
- if (TTY_IS_ACTIVE(info)) {
- if (info->dialing == 1)
- isdn_tty_modem_result(RESULT_BUSY, info);
- if (info->dialing > 1)
- isdn_tty_modem_result(RESULT_NO_CARRIER, info);
- info->dialing = 0;
+ if (TTY_IS_ACTIVE(info)) {
+ if (info->dialing == 1)
+ isdn_tty_modem_result(RESULT_BUSY, info);
+ if (info->dialing > 1)
+ isdn_tty_modem_result(RESULT_NO_CARRIER, info);
+ info->dialing = 0;
#ifdef ISDN_DEBUG_MODEM_HUP
- printk(KERN_DEBUG "Mhup in ISDN_STAT_DHUP\n");
+ printk(KERN_DEBUG "Mhup in ISDN_STAT_DHUP\n");
#endif
- isdn_tty_modem_hup(info, 0);
- return 1;
- }
- break;
- case ISDN_STAT_BCONN:
+ isdn_tty_modem_hup(info, 0);
+ return 1;
+ }
+ break;
+ case ISDN_STAT_BCONN:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_BCONN ttyI%d\n", info->line);
-#endif
- /* Wake up any processes waiting
- * for incoming call of this device when
- * DCD follow the state of incoming carrier
- */
- if (info->blocked_open &&
- (info->emu.mdmreg[REG_DCD] & BIT_DCD)) {
- wake_up_interruptible(&info->open_wait);
- }
+ printk(KERN_DEBUG "tty_STAT_BCONN ttyI%d\n", info->line);
+#endif
+ /* Wake up any processes waiting
+ * for incoming call of this device when
+ * DCD follow the state of incoming carrier
+ */
+ if (info->blocked_open &&
+ (info->emu.mdmreg[REG_DCD] & BIT_DCD)) {
+ wake_up_interruptible(&info->open_wait);
+ }
- /* Schedule CONNECT-Message to any tty
- * waiting for it and
- * set DCD-bit of its modem-status.
- */
- if (TTY_IS_ACTIVE(info) ||
- (info->blocked_open && (info->emu.mdmreg[REG_DCD] & BIT_DCD))) {
- info->msr |= UART_MSR_DCD;
- info->emu.charge = 0;
- if (info->dialing & 0xf)
- info->last_dir = 1;
- else
- info->last_dir = 0;
- info->dialing = 0;
- info->rcvsched = 1;
- if (USG_MODEM(dev->usage[i])) {
- if (info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) {
- strcpy(info->emu.connmsg, c->parm.num);
- isdn_tty_modem_result(RESULT_CONNECT, info);
- } else
- isdn_tty_modem_result(RESULT_CONNECT64000, info);
- }
- if (USG_VOICE(dev->usage[i]))
- isdn_tty_modem_result(RESULT_VCON, info);
- return 1;
+ /* Schedule CONNECT-Message to any tty
+ * waiting for it and
+ * set DCD-bit of its modem-status.
+ */
+ if (TTY_IS_ACTIVE(info) ||
+ (info->blocked_open && (info->emu.mdmreg[REG_DCD] & BIT_DCD))) {
+ info->msr |= UART_MSR_DCD;
+ info->emu.charge = 0;
+ if (info->dialing & 0xf)
+ info->last_dir = 1;
+ else
+ info->last_dir = 0;
+ info->dialing = 0;
+ info->rcvsched = 1;
+ if (USG_MODEM(dev->usage[i])) {
+ if (info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) {
+ strcpy(info->emu.connmsg, c->parm.num);
+ isdn_tty_modem_result(RESULT_CONNECT, info);
+ } else
+ isdn_tty_modem_result(RESULT_CONNECT64000, info);
}
- break;
- case ISDN_STAT_BHUP:
+ if (USG_VOICE(dev->usage[i]))
+ isdn_tty_modem_result(RESULT_VCON, info);
+ return 1;
+ }
+ break;
+ case ISDN_STAT_BHUP:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_BHUP ttyI%d\n", info->line);
+ printk(KERN_DEBUG "tty_STAT_BHUP ttyI%d\n", info->line);
#endif
- if (TTY_IS_ACTIVE(info)) {
+ if (TTY_IS_ACTIVE(info)) {
#ifdef ISDN_DEBUG_MODEM_HUP
- printk(KERN_DEBUG "Mhup in ISDN_STAT_BHUP\n");
+ printk(KERN_DEBUG "Mhup in ISDN_STAT_BHUP\n");
#endif
- isdn_tty_modem_hup(info, 0);
- return 1;
- }
- break;
- case ISDN_STAT_NODCH:
+ isdn_tty_modem_hup(info, 0);
+ return 1;
+ }
+ break;
+ case ISDN_STAT_NODCH:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_NODCH ttyI%d\n", info->line);
-#endif
- if (TTY_IS_ACTIVE(info)) {
- if (info->dialing) {
- info->dialing = 0;
- info->last_l2 = -1;
- info->last_si = 0;
- sprintf(info->last_cause, "0000");
- isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
- }
- isdn_tty_modem_hup(info, 0);
- return 1;
+ printk(KERN_DEBUG "tty_STAT_NODCH ttyI%d\n", info->line);
+#endif
+ if (TTY_IS_ACTIVE(info)) {
+ if (info->dialing) {
+ info->dialing = 0;
+ info->last_l2 = -1;
+ info->last_si = 0;
+ sprintf(info->last_cause, "0000");
+ isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
}
- break;
- case ISDN_STAT_UNLOAD:
+ isdn_tty_modem_hup(info, 0);
+ return 1;
+ }
+ break;
+ case ISDN_STAT_UNLOAD:
#ifdef ISDN_TTY_STAT_DEBUG
- printk(KERN_DEBUG "tty_STAT_UNLOAD ttyI%d\n", info->line);
+ printk(KERN_DEBUG "tty_STAT_UNLOAD ttyI%d\n", info->line);
#endif
- for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
- info = &dev->mdm.info[i];
- if (info->isdn_driver == c->driver) {
- if (info->online)
- isdn_tty_modem_hup(info, 1);
- }
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ info = &dev->mdm.info[i];
+ if (info->isdn_driver == c->driver) {
+ if (info->online)
+ isdn_tty_modem_hup(info, 1);
}
- return 1;
+ }
+ return 1;
#ifdef CONFIG_ISDN_TTY_FAX
- case ISDN_STAT_FAXIND:
- if (TTY_IS_ACTIVE(info)) {
- isdn_tty_fax_command(info, c);
- }
- break;
+ case ISDN_STAT_FAXIND:
+ if (TTY_IS_ACTIVE(info)) {
+ isdn_tty_fax_command(info, c);
+ }
+ break;
#endif
#ifdef CONFIG_ISDN_AUDIO
- case ISDN_STAT_AUDIO:
- if (TTY_IS_ACTIVE(info)) {
- switch(c->parm.num[0]) {
- case ISDN_AUDIO_DTMF:
- if (info->vonline) {
- isdn_audio_put_dle_code(info,
+ case ISDN_STAT_AUDIO:
+ if (TTY_IS_ACTIVE(info)) {
+ switch (c->parm.num[0]) {
+ case ISDN_AUDIO_DTMF:
+ if (info->vonline) {
+ isdn_audio_put_dle_code(info,
c->parm.num[1]);
- }
- break;
}
+ break;
}
- break;
+ }
+ break;
#endif
}
}
@@ -2314,16 +2311,16 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
/*********************************************************************
Modem-Emulator-Routines
- *********************************************************************/
+*********************************************************************/
-#define cmdchar(c) ((c>=' ')&&(c<=0x7f))
+#define cmdchar(c) ((c >= ' ') && (c <= 0x7f))
/*
* Put a message from the AT-emulator into receive-buffer of tty,
* convert CR, LF, and BS to values in modem-registers 3, 4 and 5.
*/
void
-isdn_tty_at_cout(char *msg, modem_info * info)
+isdn_tty_at_cout(char *msg, modem_info *info)
{
struct tty_struct *tty;
atemu *m = &info->emu;
@@ -2351,7 +2348,7 @@ isdn_tty_at_cout(char *msg, modem_info * info)
/* use queue instead of direct, if online and */
/* data is in queue or buffer is full */
if (info->online && ((tty_buffer_request_room(tty, l) < l) ||
- !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) {
+ !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) {
skb = alloc_skb(l, GFP_ATOMIC);
if (!skb) {
spin_unlock_irqrestore(&info->readlock, flags);
@@ -2366,22 +2363,22 @@ isdn_tty_at_cout(char *msg, modem_info * info)
for (p = msg; *p; p++) {
switch (*p) {
- case '\r':
- c = m->mdmreg[REG_CR];
- break;
- case '\n':
- c = m->mdmreg[REG_LF];
- break;
- case '\b':
- c = m->mdmreg[REG_BS];
- break;
- default:
- c = *p;
+ case '\r':
+ c = m->mdmreg[REG_CR];
+ break;
+ case '\n':
+ c = m->mdmreg[REG_LF];
+ break;
+ case '\b':
+ c = m->mdmreg[REG_BS];
+ break;
+ default:
+ c = *p;
}
if (skb) {
*sp++ = c;
} else {
- if(tty_insert_flip_char(tty, c, TTY_NORMAL) == 0)
+ if (tty_insert_flip_char(tty, c, TTY_NORMAL) == 0)
break;
}
}
@@ -2403,7 +2400,7 @@ isdn_tty_at_cout(char *msg, modem_info * info)
* Perform ATH Hangup
*/
static void
-isdn_tty_on_hook(modem_info * info)
+isdn_tty_on_hook(modem_info *info)
{
if (info->isdn_channel >= 0) {
#ifdef ISDN_DEBUG_MODEM_HUP
@@ -2419,8 +2416,8 @@ isdn_tty_off_hook(void)
printk(KERN_DEBUG "isdn_tty_off_hook\n");
}
-#define PLUSWAIT1 (HZ/2) /* 0.5 sec. */
-#define PLUSWAIT2 (HZ*3/2) /* 1.5 sec */
+#define PLUSWAIT1 (HZ / 2) /* 0.5 sec. */
+#define PLUSWAIT2 (HZ * 3 / 2) /* 1.5 sec */
/*
* Check Buffer for Modem-escape-sequence, activate timer-callback to
@@ -2434,7 +2431,7 @@ isdn_tty_off_hook(void)
* lastplus timestamp of last character
*/
static void
-isdn_tty_check_esc(const u_char * p, u_char plus, int count, int *pluscount,
+isdn_tty_check_esc(const u_char *p, u_char plus, int count, int *pluscount,
u_long *lastplus)
{
if (plus > 127)
@@ -2474,69 +2471,69 @@ isdn_tty_check_esc(const u_char * p, u_char plus, int count, int *pluscount,
*/
static void
-isdn_tty_modem_result(int code, modem_info * info)
+isdn_tty_modem_result(int code, modem_info *info)
{
atemu *m = &info->emu;
static char *msg[] =
- {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR",
- "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER",
- "RINGING", "NO MSN/EAZ", "VCON", "RUNG"};
- char s[ISDN_MSNLEN+10];
+ {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR",
+ "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER",
+ "RINGING", "NO MSN/EAZ", "VCON", "RUNG"};
+ char s[ISDN_MSNLEN + 10];
switch (code) {
- case RESULT_RING:
- m->mdmreg[REG_RINGCNT]++;
- if (m->mdmreg[REG_RINGCNT] == m->mdmreg[REG_RINGATA])
- /* Automatically accept incoming call */
- isdn_tty_cmd_ATA(info);
- break;
- case RESULT_NO_CARRIER:
+ case RESULT_RING:
+ m->mdmreg[REG_RINGCNT]++;
+ if (m->mdmreg[REG_RINGCNT] == m->mdmreg[REG_RINGATA])
+ /* Automatically accept incoming call */
+ isdn_tty_cmd_ATA(info);
+ break;
+ case RESULT_NO_CARRIER:
#ifdef ISDN_DEBUG_MODEM_HUP
- printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n",
- (info->flags & ISDN_ASYNC_CLOSING),
- (!info->tty));
-#endif
- m->mdmreg[REG_RINGCNT] = 0;
- del_timer(&info->nc_timer);
- info->ncarrier = 0;
- if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
- return;
- }
+ printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n",
+ (info->flags & ISDN_ASYNC_CLOSING),
+ (!info->tty));
+#endif
+ m->mdmreg[REG_RINGCNT] = 0;
+ del_timer(&info->nc_timer);
+ info->ncarrier = 0;
+ if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
+ return;
+ }
#ifdef CONFIG_ISDN_AUDIO
- if (info->vonline & 1) {
+ if (info->vonline & 1) {
#ifdef ISDN_DEBUG_MODEM_VOICE
- printk(KERN_DEBUG "res3: send DLE-ETX on ttyI%d\n",
- info->line);
+ printk(KERN_DEBUG "res3: send DLE-ETX on ttyI%d\n",
+ info->line);
#endif
- /* voice-recording, add DLE-ETX */
- isdn_tty_at_cout("\020\003", info);
- }
- if (info->vonline & 2) {
+ /* voice-recording, add DLE-ETX */
+ isdn_tty_at_cout("\020\003", info);
+ }
+ if (info->vonline & 2) {
#ifdef ISDN_DEBUG_MODEM_VOICE
- printk(KERN_DEBUG "res3: send DLE-DC4 on ttyI%d\n",
- info->line);
+ printk(KERN_DEBUG "res3: send DLE-DC4 on ttyI%d\n",
+ info->line);
#endif
- /* voice-playing, add DLE-DC4 */
- isdn_tty_at_cout("\020\024", info);
- }
+ /* voice-playing, add DLE-DC4 */
+ isdn_tty_at_cout("\020\024", info);
+ }
#endif
- break;
- case RESULT_CONNECT:
- case RESULT_CONNECT64000:
- sprintf(info->last_cause, "0000");
- if (!info->online)
- info->online = 2;
- break;
- case RESULT_VCON:
+ break;
+ case RESULT_CONNECT:
+ case RESULT_CONNECT64000:
+ sprintf(info->last_cause, "0000");
+ if (!info->online)
+ info->online = 2;
+ break;
+ case RESULT_VCON:
#ifdef ISDN_DEBUG_MODEM_VOICE
- printk(KERN_DEBUG "res3: send VCON on ttyI%d\n",
- info->line);
+ printk(KERN_DEBUG "res3: send VCON on ttyI%d\n",
+ info->line);
#endif
- sprintf(info->last_cause, "0000");
- if (!info->online)
- info->online = 1;
- break;
- } /* switch(code) */
+ sprintf(info->last_cause, "0000");
+ if (!info->online)
+ info->online = 1;
+ break;
+ } /* switch (code) */
if (m->mdmreg[REG_RESP] & BIT_RESP) {
/* Show results */
@@ -2546,87 +2543,87 @@ isdn_tty_modem_result(int code, modem_info * info)
isdn_tty_at_cout(s, info);
} else {
if (code == RESULT_RING) {
- /* return if "show RUNG" and ringcounter>1 */
- if ((m->mdmreg[REG_RUNG] & BIT_RUNG) &&
+ /* return if "show RUNG" and ringcounter>1 */
+ if ((m->mdmreg[REG_RUNG] & BIT_RUNG) &&
(m->mdmreg[REG_RINGCNT] > 1))
- return;
- /* print CID, _before_ _every_ ring */
- if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) {
- isdn_tty_at_cout("\r\nCALLER NUMBER: ", info);
- isdn_tty_at_cout(dev->num[info->drv_index], info);
- if (m->mdmreg[REG_CDN] & BIT_CDN) {
- isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
- isdn_tty_at_cout(info->emu.cpn, info);
- }
- }
+ return;
+ /* print CID, _before_ _every_ ring */
+ if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) {
+ isdn_tty_at_cout("\r\nCALLER NUMBER: ", info);
+ isdn_tty_at_cout(dev->num[info->drv_index], info);
+ if (m->mdmreg[REG_CDN] & BIT_CDN) {
+ isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
+ isdn_tty_at_cout(info->emu.cpn, info);
+ }
+ }
}
isdn_tty_at_cout("\r\n", info);
isdn_tty_at_cout(msg[code], info);
switch (code) {
- case RESULT_CONNECT:
- switch (m->mdmreg[REG_L2PROT]) {
- case ISDN_PROTO_L2_MODEM:
- isdn_tty_at_cout(" ", info);
- isdn_tty_at_cout(m->connmsg, info);
- break;
- }
+ case RESULT_CONNECT:
+ switch (m->mdmreg[REG_L2PROT]) {
+ case ISDN_PROTO_L2_MODEM:
+ isdn_tty_at_cout(" ", info);
+ isdn_tty_at_cout(m->connmsg, info);
break;
- case RESULT_RING:
- /* Append CPN, if enabled */
- if ((m->mdmreg[REG_CPN] & BIT_CPN)) {
- sprintf(s, "/%s", m->cpn);
- isdn_tty_at_cout(s, info);
- }
- /* Print CID only once, _after_ 1st RING */
- if ((m->mdmreg[REG_CIDONCE] & BIT_CIDONCE) &&
- (m->mdmreg[REG_RINGCNT] == 1)) {
- isdn_tty_at_cout("\r\n", info);
- isdn_tty_at_cout("CALLER NUMBER: ", info);
- isdn_tty_at_cout(dev->num[info->drv_index], info);
- if (m->mdmreg[REG_CDN] & BIT_CDN) {
- isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
- isdn_tty_at_cout(info->emu.cpn, info);
- }
+ }
+ break;
+ case RESULT_RING:
+ /* Append CPN, if enabled */
+ if ((m->mdmreg[REG_CPN] & BIT_CPN)) {
+ sprintf(s, "/%s", m->cpn);
+ isdn_tty_at_cout(s, info);
+ }
+ /* Print CID only once, _after_ 1st RING */
+ if ((m->mdmreg[REG_CIDONCE] & BIT_CIDONCE) &&
+ (m->mdmreg[REG_RINGCNT] == 1)) {
+ isdn_tty_at_cout("\r\n", info);
+ isdn_tty_at_cout("CALLER NUMBER: ", info);
+ isdn_tty_at_cout(dev->num[info->drv_index], info);
+ if (m->mdmreg[REG_CDN] & BIT_CDN) {
+ isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
+ isdn_tty_at_cout(info->emu.cpn, info);
}
+ }
+ break;
+ case RESULT_NO_CARRIER:
+ case RESULT_NO_DIALTONE:
+ case RESULT_BUSY:
+ case RESULT_NO_ANSWER:
+ m->mdmreg[REG_RINGCNT] = 0;
+ /* Append Cause-Message if enabled */
+ if (m->mdmreg[REG_RESPXT] & BIT_RESPXT) {
+ sprintf(s, "/%s", info->last_cause);
+ isdn_tty_at_cout(s, info);
+ }
+ break;
+ case RESULT_CONNECT64000:
+ /* Append Protocol to CONNECT message */
+ switch (m->mdmreg[REG_L2PROT]) {
+ case ISDN_PROTO_L2_X75I:
+ case ISDN_PROTO_L2_X75UI:
+ case ISDN_PROTO_L2_X75BUI:
+ isdn_tty_at_cout("/X.75", info);
break;
- case RESULT_NO_CARRIER:
- case RESULT_NO_DIALTONE:
- case RESULT_BUSY:
- case RESULT_NO_ANSWER:
- m->mdmreg[REG_RINGCNT] = 0;
- /* Append Cause-Message if enabled */
- if (m->mdmreg[REG_RESPXT] & BIT_RESPXT) {
- sprintf(s, "/%s", info->last_cause);
- isdn_tty_at_cout(s, info);
- }
+ case ISDN_PROTO_L2_HDLC:
+ isdn_tty_at_cout("/HDLC", info);
break;
- case RESULT_CONNECT64000:
- /* Append Protocol to CONNECT message */
- switch (m->mdmreg[REG_L2PROT]) {
- case ISDN_PROTO_L2_X75I:
- case ISDN_PROTO_L2_X75UI:
- case ISDN_PROTO_L2_X75BUI:
- isdn_tty_at_cout("/X.75", info);
- break;
- case ISDN_PROTO_L2_HDLC:
- isdn_tty_at_cout("/HDLC", info);
- break;
- case ISDN_PROTO_L2_V11096:
- isdn_tty_at_cout("/V110/9600", info);
- break;
- case ISDN_PROTO_L2_V11019:
- isdn_tty_at_cout("/V110/19200", info);
- break;
- case ISDN_PROTO_L2_V11038:
- isdn_tty_at_cout("/V110/38400", info);
- break;
- }
- if (m->mdmreg[REG_T70] & BIT_T70) {
- isdn_tty_at_cout("/T.70", info);
- if (m->mdmreg[REG_T70] & BIT_T70_EXT)
- isdn_tty_at_cout("+", info);
- }
+ case ISDN_PROTO_L2_V11096:
+ isdn_tty_at_cout("/V110/9600", info);
break;
+ case ISDN_PROTO_L2_V11019:
+ isdn_tty_at_cout("/V110/19200", info);
+ break;
+ case ISDN_PROTO_L2_V11038:
+ isdn_tty_at_cout("/V110/38400", info);
+ break;
+ }
+ if (m->mdmreg[REG_T70] & BIT_T70) {
+ isdn_tty_at_cout("/T.70", info);
+ if (m->mdmreg[REG_T70] & BIT_T70_EXT)
+ isdn_tty_at_cout("+", info);
+ }
+ break;
}
isdn_tty_at_cout("\r\n", info);
}
@@ -2648,7 +2645,7 @@ isdn_tty_modem_result(int code, modem_info * info)
* Display a modem-register-value.
*/
static void
-isdn_tty_show_profile(int ridx, modem_info * info)
+isdn_tty_show_profile(int ridx, modem_info *info)
{
char v[6];
@@ -2667,7 +2664,7 @@ isdn_tty_get_msnstr(char *n, char **p)
while (((*p[0] >= '0' && *p[0] <= '9') ||
/* Why a comma ??? */
(*p[0] == ',') || (*p[0] == ':')) &&
- (limit--))
+ (limit--))
*n++ = *p[0]++;
*n = '\0';
}
@@ -2676,20 +2673,20 @@ isdn_tty_get_msnstr(char *n, char **p)
* Get phone-number from modem-commandbuffer
*/
static void
-isdn_tty_getdial(char *p, char *q,int cnt)
+isdn_tty_getdial(char *p, char *q, int cnt)
{
int first = 1;
int limit = ISDN_MSNLEN - 1; /* MUST match the size of interface var to avoid
- buffer overflow */
+ buffer overflow */
- while (strchr(" 0123456789,#.*WPTSR-", *p) && *p && --cnt>0) {
+ while (strchr(" 0123456789,#.*WPTSR-", *p) && *p && --cnt > 0) {
if ((*p >= '0' && *p <= '9') || ((*p == 'S') && first) ||
((*p == 'R') && first) ||
(*p == '*') || (*p == '#')) {
*q++ = *p;
limit--;
}
- if(!limit)
+ if (!limit)
break;
p++;
first = 0;
@@ -2701,7 +2698,7 @@ isdn_tty_getdial(char *p, char *q,int cnt)
#define PARSE_ERROR1 { isdn_tty_modem_result(RESULT_ERROR, info); return 1; }
static void
-isdn_tty_report(modem_info * info)
+isdn_tty_report(modem_info *info)
{
atemu *m = &info->emu;
char s[80];
@@ -2713,39 +2710,39 @@ isdn_tty_report(modem_info * info)
isdn_tty_at_cout(s, info);
isdn_tty_at_cout(" Layer-2 Protocol: ", info);
switch (info->last_l2) {
- case ISDN_PROTO_L2_X75I:
- isdn_tty_at_cout("X.75i", info);
- break;
- case ISDN_PROTO_L2_X75UI:
- isdn_tty_at_cout("X.75ui", info);
- break;
- case ISDN_PROTO_L2_X75BUI:
- isdn_tty_at_cout("X.75bui", info);
- break;
- case ISDN_PROTO_L2_HDLC:
- isdn_tty_at_cout("HDLC", info);
- break;
- case ISDN_PROTO_L2_V11096:
- isdn_tty_at_cout("V.110 9600 Baud", info);
- break;
- case ISDN_PROTO_L2_V11019:
- isdn_tty_at_cout("V.110 19200 Baud", info);
- break;
- case ISDN_PROTO_L2_V11038:
- isdn_tty_at_cout("V.110 38400 Baud", info);
- break;
- case ISDN_PROTO_L2_TRANS:
- isdn_tty_at_cout("transparent", info);
- break;
- case ISDN_PROTO_L2_MODEM:
- isdn_tty_at_cout("modem", info);
- break;
- case ISDN_PROTO_L2_FAX:
- isdn_tty_at_cout("fax", info);
- break;
- default:
- isdn_tty_at_cout("unknown", info);
- break;
+ case ISDN_PROTO_L2_X75I:
+ isdn_tty_at_cout("X.75i", info);
+ break;
+ case ISDN_PROTO_L2_X75UI:
+ isdn_tty_at_cout("X.75ui", info);
+ break;
+ case ISDN_PROTO_L2_X75BUI:
+ isdn_tty_at_cout("X.75bui", info);
+ break;
+ case ISDN_PROTO_L2_HDLC:
+ isdn_tty_at_cout("HDLC", info);
+ break;
+ case ISDN_PROTO_L2_V11096:
+ isdn_tty_at_cout("V.110 9600 Baud", info);
+ break;
+ case ISDN_PROTO_L2_V11019:
+ isdn_tty_at_cout("V.110 19200 Baud", info);
+ break;
+ case ISDN_PROTO_L2_V11038:
+ isdn_tty_at_cout("V.110 38400 Baud", info);
+ break;
+ case ISDN_PROTO_L2_TRANS:
+ isdn_tty_at_cout("transparent", info);
+ break;
+ case ISDN_PROTO_L2_MODEM:
+ isdn_tty_at_cout("modem", info);
+ break;
+ case ISDN_PROTO_L2_FAX:
+ isdn_tty_at_cout("fax", info);
+ break;
+ default:
+ isdn_tty_at_cout("unknown", info);
+ break;
}
if (m->mdmreg[REG_T70] & BIT_T70) {
isdn_tty_at_cout("/T.70", info);
@@ -2755,19 +2752,19 @@ isdn_tty_report(modem_info * info)
isdn_tty_at_cout("\r\n", info);
isdn_tty_at_cout(" Service: ", info);
switch (info->last_si) {
- case 1:
- isdn_tty_at_cout("audio\r\n", info);
- break;
- case 5:
- isdn_tty_at_cout("btx\r\n", info);
- break;
- case 7:
- isdn_tty_at_cout("data\r\n", info);
- break;
- default:
- sprintf(s, "%d\r\n", info->last_si);
- isdn_tty_at_cout(s, info);
- break;
+ case 1:
+ isdn_tty_at_cout("audio\r\n", info);
+ break;
+ case 5:
+ isdn_tty_at_cout("btx\r\n", info);
+ break;
+ case 7:
+ isdn_tty_at_cout("data\r\n", info);
+ break;
+ default:
+ sprintf(s, "%d\r\n", info->last_si);
+ isdn_tty_at_cout(s, info);
+ break;
}
sprintf(s, " Hangup location: %s\r\n", info->last_lhup ? "local" : "remote");
isdn_tty_at_cout(s, info);
@@ -2779,7 +2776,7 @@ isdn_tty_report(modem_info * info)
* Parse AT&.. commands.
*/
static int
-isdn_tty_cmd_ATand(char **p, modem_info * info)
+isdn_tty_cmd_ATand(char **p, modem_info *info)
{
atemu *m = &info->emu;
int i;
@@ -2788,224 +2785,224 @@ isdn_tty_cmd_ATand(char **p, modem_info * info)
#define MAXRB (sizeof(rb) - 1)
switch (*p[0]) {
- case 'B':
- /* &B - Set Buffersize */
- p[0]++;
- i = isdn_getnum(p);
- if ((i < 0) || (i > ISDN_SERIAL_XMIT_MAX))
- PARSE_ERROR1;
+ case 'B':
+ /* &B - Set Buffersize */
+ p[0]++;
+ i = isdn_getnum(p);
+ if ((i < 0) || (i > ISDN_SERIAL_XMIT_MAX))
+ PARSE_ERROR1;
#ifdef CONFIG_ISDN_AUDIO
- if ((m->mdmreg[REG_SI1] & 1) && (i > VBUF))
- PARSE_ERROR1;
+ if ((m->mdmreg[REG_SI1] & 1) && (i > VBUF))
+ PARSE_ERROR1;
#endif
- m->mdmreg[REG_PSIZE] = i / 16;
- info->xmit_size = m->mdmreg[REG_PSIZE] * 16;
- switch (m->mdmreg[REG_L2PROT]) {
- case ISDN_PROTO_L2_V11096:
- case ISDN_PROTO_L2_V11019:
- case ISDN_PROTO_L2_V11038:
- info->xmit_size /= 10;
- }
+ m->mdmreg[REG_PSIZE] = i / 16;
+ info->xmit_size = m->mdmreg[REG_PSIZE] * 16;
+ switch (m->mdmreg[REG_L2PROT]) {
+ case ISDN_PROTO_L2_V11096:
+ case ISDN_PROTO_L2_V11019:
+ case ISDN_PROTO_L2_V11038:
+ info->xmit_size /= 10;
+ }
+ break;
+ case 'C':
+ /* &C - DCD Status */
+ p[0]++;
+ switch (isdn_getnum(p)) {
+ case 0:
+ m->mdmreg[REG_DCD] &= ~BIT_DCD;
break;
- case 'C':
- /* &C - DCD Status */
- p[0]++;
- switch (isdn_getnum(p)) {
- case 0:
- m->mdmreg[REG_DCD] &= ~BIT_DCD;
- break;
- case 1:
- m->mdmreg[REG_DCD] |= BIT_DCD;
- break;
- default:
- PARSE_ERROR1
- }
+ case 1:
+ m->mdmreg[REG_DCD] |= BIT_DCD;
break;
- case 'D':
- /* &D - Set DTR-Low-behavior */
- p[0]++;
- switch (isdn_getnum(p)) {
- case 0:
- m->mdmreg[REG_DTRHUP] &= ~BIT_DTRHUP;
- m->mdmreg[REG_DTRR] &= ~BIT_DTRR;
- break;
- case 2:
- m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP;
- m->mdmreg[REG_DTRR] &= ~BIT_DTRR;
- break;
- case 3:
- m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP;
- m->mdmreg[REG_DTRR] |= BIT_DTRR;
- break;
- default:
- PARSE_ERROR1
- }
+ default:
+ PARSE_ERROR1
+ }
+ break;
+ case 'D':
+ /* &D - Set DTR-Low-behavior */
+ p[0]++;
+ switch (isdn_getnum(p)) {
+ case 0:
+ m->mdmreg[REG_DTRHUP] &= ~BIT_DTRHUP;
+ m->mdmreg[REG_DTRR] &= ~BIT_DTRR;
break;
- case 'E':
- /* &E -Set EAZ/MSN */
- p[0]++;
- isdn_tty_get_msnstr(m->msn, p);
+ case 2:
+ m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP;
+ m->mdmreg[REG_DTRR] &= ~BIT_DTRR;
break;
- case 'F':
- /* &F -Set Factory-Defaults */
- p[0]++;
- if (info->msr & UART_MSR_DCD)
- PARSE_ERROR1;
- isdn_tty_reset_profile(m);
- isdn_tty_modem_reset_regs(info, 1);
+ case 3:
+ m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP;
+ m->mdmreg[REG_DTRR] |= BIT_DTRR;
break;
+ default:
+ PARSE_ERROR1
+ }
+ break;
+ case 'E':
+ /* &E -Set EAZ/MSN */
+ p[0]++;
+ isdn_tty_get_msnstr(m->msn, p);
+ break;
+ case 'F':
+ /* &F -Set Factory-Defaults */
+ p[0]++;
+ if (info->msr & UART_MSR_DCD)
+ PARSE_ERROR1;
+ isdn_tty_reset_profile(m);
+ isdn_tty_modem_reset_regs(info, 1);
+ break;
#ifdef DUMMY_HAYES_AT
- case 'K':
- /* only for be compilant with common scripts */
- /* &K Flowcontrol - no function */
- p[0]++;
- isdn_getnum(p);
+ case 'K':
+ /* only for be compilant with common scripts */
+ /* &K Flowcontrol - no function */
+ p[0]++;
+ isdn_getnum(p);
+ break;
+#endif
+ case 'L':
+ /* &L -Set Numbers to listen on */
+ p[0]++;
+ i = 0;
+ while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) &&
+ (i < ISDN_LMSNLEN - 1))
+ m->lmsn[i++] = *p[0]++;
+ m->lmsn[i] = '\0';
+ break;
+ case 'R':
+ /* &R - Set V.110 bitrate adaption */
+ p[0]++;
+ i = isdn_getnum(p);
+ switch (i) {
+ case 0:
+ /* Switch off V.110, back to X.75 */
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
+ m->mdmreg[REG_SI2] = 0;
+ info->xmit_size = m->mdmreg[REG_PSIZE] * 16;
break;
-#endif
- case 'L':
- /* &L -Set Numbers to listen on */
- p[0]++;
- i = 0;
- while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) &&
- (i < ISDN_LMSNLEN - 1))
- m->lmsn[i++] = *p[0]++;
- m->lmsn[i] = '\0';
- break;
- case 'R':
- /* &R - Set V.110 bitrate adaption */
- p[0]++;
- i = isdn_getnum(p);
- switch (i) {
- case 0:
- /* Switch off V.110, back to X.75 */
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
- m->mdmreg[REG_SI2] = 0;
- info->xmit_size = m->mdmreg[REG_PSIZE] * 16;
- break;
- case 9600:
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11096;
- m->mdmreg[REG_SI2] = 197;
- info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10;
- break;
- case 19200:
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11019;
- m->mdmreg[REG_SI2] = 199;
- info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10;
- break;
- case 38400:
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11038;
- m->mdmreg[REG_SI2] = 198; /* no existing standard for this */
- info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10;
- break;
- default:
- PARSE_ERROR1;
- }
- /* Switch off T.70 */
- m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT);
- /* Set Service 7 */
- m->mdmreg[REG_SI1] |= 4;
+ case 9600:
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11096;
+ m->mdmreg[REG_SI2] = 197;
+ info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10;
break;
- case 'S':
- /* &S - Set Windowsize */
- p[0]++;
- i = isdn_getnum(p);
- if ((i > 0) && (i < 9))
- m->mdmreg[REG_WSIZE] = i;
- else
- PARSE_ERROR1;
+ case 19200:
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11019;
+ m->mdmreg[REG_SI2] = 199;
+ info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10;
break;
- case 'V':
- /* &V - Show registers */
- p[0]++;
- isdn_tty_at_cout("\r\n", info);
- for (i = 0; i < ISDN_MODEM_NUMREG; i++) {
- sprintf(rb, "S%02d=%03d%s", i,
- m->mdmreg[i], ((i + 1) % 10) ? " " : "\r\n");
- isdn_tty_at_cout(rb, info);
- }
- sprintf(rb, "\r\nEAZ/MSN: %.50s\r\n",
- strlen(m->msn) ? m->msn : "None");
- isdn_tty_at_cout(rb, info);
- if (strlen(m->lmsn)) {
- isdn_tty_at_cout("\r\nListen: ", info);
- isdn_tty_at_cout(m->lmsn, info);
- isdn_tty_at_cout("\r\n", info);
- }
+ case 38400:
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11038;
+ m->mdmreg[REG_SI2] = 198; /* no existing standard for this */
+ info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10;
break;
- case 'W':
- /* &W - Write Profile */
+ default:
+ PARSE_ERROR1;
+ }
+ /* Switch off T.70 */
+ m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT);
+ /* Set Service 7 */
+ m->mdmreg[REG_SI1] |= 4;
+ break;
+ case 'S':
+ /* &S - Set Windowsize */
+ p[0]++;
+ i = isdn_getnum(p);
+ if ((i > 0) && (i < 9))
+ m->mdmreg[REG_WSIZE] = i;
+ else
+ PARSE_ERROR1;
+ break;
+ case 'V':
+ /* &V - Show registers */
+ p[0]++;
+ isdn_tty_at_cout("\r\n", info);
+ for (i = 0; i < ISDN_MODEM_NUMREG; i++) {
+ sprintf(rb, "S%02d=%03d%s", i,
+ m->mdmreg[i], ((i + 1) % 10) ? " " : "\r\n");
+ isdn_tty_at_cout(rb, info);
+ }
+ sprintf(rb, "\r\nEAZ/MSN: %.50s\r\n",
+ strlen(m->msn) ? m->msn : "None");
+ isdn_tty_at_cout(rb, info);
+ if (strlen(m->lmsn)) {
+ isdn_tty_at_cout("\r\nListen: ", info);
+ isdn_tty_at_cout(m->lmsn, info);
+ isdn_tty_at_cout("\r\n", info);
+ }
+ break;
+ case 'W':
+ /* &W - Write Profile */
+ p[0]++;
+ switch (*p[0]) {
+ case '0':
p[0]++;
- switch (*p[0]) {
- case '0':
- p[0]++;
- modem_write_profile(m);
- break;
- default:
- PARSE_ERROR1;
- }
+ modem_write_profile(m);
break;
- case 'X':
- /* &X - Switch to BTX-Mode and T.70 */
- p[0]++;
- switch (isdn_getnum(p)) {
- case 0:
- m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT);
- info->xmit_size = m->mdmreg[REG_PSIZE] * 16;
- break;
- case 1:
- m->mdmreg[REG_T70] |= BIT_T70;
- m->mdmreg[REG_T70] &= ~BIT_T70_EXT;
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
- info->xmit_size = 112;
- m->mdmreg[REG_SI1] = 4;
- m->mdmreg[REG_SI2] = 0;
- break;
- case 2:
- m->mdmreg[REG_T70] |= (BIT_T70 | BIT_T70_EXT);
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
- info->xmit_size = 112;
- m->mdmreg[REG_SI1] = 4;
- m->mdmreg[REG_SI2] = 0;
- break;
- default:
- PARSE_ERROR1;
- }
+ default:
+ PARSE_ERROR1;
+ }
+ break;
+ case 'X':
+ /* &X - Switch to BTX-Mode and T.70 */
+ p[0]++;
+ switch (isdn_getnum(p)) {
+ case 0:
+ m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT);
+ info->xmit_size = m->mdmreg[REG_PSIZE] * 16;
+ break;
+ case 1:
+ m->mdmreg[REG_T70] |= BIT_T70;
+ m->mdmreg[REG_T70] &= ~BIT_T70_EXT;
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
+ info->xmit_size = 112;
+ m->mdmreg[REG_SI1] = 4;
+ m->mdmreg[REG_SI2] = 0;
+ break;
+ case 2:
+ m->mdmreg[REG_T70] |= (BIT_T70 | BIT_T70_EXT);
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
+ info->xmit_size = 112;
+ m->mdmreg[REG_SI1] = 4;
+ m->mdmreg[REG_SI2] = 0;
break;
default:
PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
static int
-isdn_tty_check_ats(int mreg, int mval, modem_info * info, atemu * m)
+isdn_tty_check_ats(int mreg, int mval, modem_info *info, atemu *m)
{
/* Some plausibility checks */
switch (mreg) {
- case REG_L2PROT:
- if (mval > ISDN_PROTO_L2_MAX)
- return 1;
- break;
- case REG_PSIZE:
- if ((mval * 16) > ISDN_SERIAL_XMIT_MAX)
- return 1;
+ case REG_L2PROT:
+ if (mval > ISDN_PROTO_L2_MAX)
+ return 1;
+ break;
+ case REG_PSIZE:
+ if ((mval * 16) > ISDN_SERIAL_XMIT_MAX)
+ return 1;
#ifdef CONFIG_ISDN_AUDIO
- if ((m->mdmreg[REG_SI1] & 1) && (mval > VBUFX))
- return 1;
-#endif
- info->xmit_size = mval * 16;
- switch (m->mdmreg[REG_L2PROT]) {
- case ISDN_PROTO_L2_V11096:
- case ISDN_PROTO_L2_V11019:
- case ISDN_PROTO_L2_V11038:
- info->xmit_size /= 10;
- }
- break;
- case REG_SI1I:
- case REG_PLAN:
- case REG_SCREEN:
- /* readonly registers */
+ if ((m->mdmreg[REG_SI1] & 1) && (mval > VBUFX))
return 1;
+#endif
+ info->xmit_size = mval * 16;
+ switch (m->mdmreg[REG_L2PROT]) {
+ case ISDN_PROTO_L2_V11096:
+ case ISDN_PROTO_L2_V11019:
+ case ISDN_PROTO_L2_V11038:
+ info->xmit_size /= 10;
+ }
+ break;
+ case REG_SI1I:
+ case REG_PLAN:
+ case REG_SCREEN:
+ /* readonly registers */
+ return 1;
}
return 0;
}
@@ -3014,7 +3011,7 @@ isdn_tty_check_ats(int mreg, int mval, modem_info * info, atemu * m)
* Perform ATS command
*/
static int
-isdn_tty_cmd_ATS(char **p, modem_info * info)
+isdn_tty_cmd_ATS(char **p, modem_info *info)
{
atemu *m = &info->emu;
int bitpos;
@@ -3026,52 +3023,52 @@ isdn_tty_cmd_ATS(char **p, modem_info * info)
if (mreg < 0 || mreg >= ISDN_MODEM_NUMREG)
PARSE_ERROR1;
switch (*p[0]) {
+ case '=':
+ p[0]++;
+ mval = isdn_getnum(p);
+ if (mval < 0 || mval > 255)
+ PARSE_ERROR1;
+ if (isdn_tty_check_ats(mreg, mval, info, m))
+ PARSE_ERROR1;
+ m->mdmreg[mreg] = mval;
+ break;
+ case '.':
+ /* Set/Clear a single bit */
+ p[0]++;
+ bitpos = isdn_getnum(p);
+ if ((bitpos < 0) || (bitpos > 7))
+ PARSE_ERROR1;
+ switch (*p[0]) {
case '=':
p[0]++;
- mval = isdn_getnum(p);
- if (mval < 0 || mval > 255)
+ bval = isdn_getnum(p);
+ if (bval < 0 || bval > 1)
PARSE_ERROR1;
+ if (bval)
+ mval = m->mdmreg[mreg] | (1 << bitpos);
+ else
+ mval = m->mdmreg[mreg] & ~(1 << bitpos);
if (isdn_tty_check_ats(mreg, mval, info, m))
PARSE_ERROR1;
m->mdmreg[mreg] = mval;
break;
- case '.':
- /* Set/Clear a single bit */
- p[0]++;
- bitpos = isdn_getnum(p);
- if ((bitpos < 0) || (bitpos > 7))
- PARSE_ERROR1;
- switch (*p[0]) {
- case '=':
- p[0]++;
- bval = isdn_getnum(p);
- if (bval < 0 || bval > 1)
- PARSE_ERROR1;
- if (bval)
- mval = m->mdmreg[mreg] | (1 << bitpos);
- else
- mval = m->mdmreg[mreg] & ~(1 << bitpos);
- if (isdn_tty_check_ats(mreg, mval, info, m))
- PARSE_ERROR1;
- m->mdmreg[mreg] = mval;
- break;
- case '?':
- p[0]++;
- isdn_tty_at_cout("\r\n", info);
- isdn_tty_at_cout((m->mdmreg[mreg] & (1 << bitpos)) ? "1" : "0",
- info);
- break;
- default:
- PARSE_ERROR1;
- }
- break;
case '?':
p[0]++;
- isdn_tty_show_profile(mreg, info);
+ isdn_tty_at_cout("\r\n", info);
+ isdn_tty_at_cout((m->mdmreg[mreg] & (1 << bitpos)) ? "1" : "0",
+ info);
break;
default:
PARSE_ERROR1;
- break;
+ }
+ break;
+ case '?':
+ p[0]++;
+ isdn_tty_show_profile(mreg, info);
+ break;
+ default:
+ PARSE_ERROR1;
+ break;
}
return 0;
}
@@ -3080,7 +3077,7 @@ isdn_tty_cmd_ATS(char **p, modem_info * info)
* Perform ATA command
*/
static void
-isdn_tty_cmd_ATA(modem_info * info)
+isdn_tty_cmd_ATA(modem_info *info)
{
atemu *m = &info->emu;
isdn_ctrl cmd;
@@ -3134,7 +3131,7 @@ isdn_tty_cmd_ATA(modem_info * info)
* Parse AT+F.. commands
*/
static int
-isdn_tty_cmd_PLUSF(char **p, modem_info * info)
+isdn_tty_cmd_PLUSF(char **p, modem_info *info)
{
atemu *m = &info->emu;
char rs[20];
@@ -3142,81 +3139,81 @@ isdn_tty_cmd_PLUSF(char **p, modem_info * info)
if (!strncmp(p[0], "CLASS", 5)) {
p[0] += 5;
switch (*p[0]) {
- case '?':
- p[0]++;
- sprintf(rs, "\r\n%d",
- (m->mdmreg[REG_SI1] & 1) ? 8 : 0);
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d",
+ (m->mdmreg[REG_SI1] & 1) ? 8 : 0);
#ifdef CONFIG_ISDN_TTY_FAX
- if (TTY_IS_FCLASS2(info))
- sprintf(rs, "\r\n2");
- else if (TTY_IS_FCLASS1(info))
- sprintf(rs, "\r\n1");
+ if (TTY_IS_FCLASS2(info))
+ sprintf(rs, "\r\n2");
+ else if (TTY_IS_FCLASS1(info))
+ sprintf(rs, "\r\n1");
#endif
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ switch (*p[0]) {
+ case '0':
p[0]++;
- switch (*p[0]) {
- case '0':
- p[0]++;
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
- m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS;
- m->mdmreg[REG_SI1] = 4;
- info->xmit_size =
- m->mdmreg[REG_PSIZE] * 16;
- break;
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
+ m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS;
+ m->mdmreg[REG_SI1] = 4;
+ info->xmit_size =
+ m->mdmreg[REG_PSIZE] * 16;
+ break;
#ifdef CONFIG_ISDN_TTY_FAX
- case '1':
- p[0]++;
- if (!(dev->global_features &
- ISDN_FEATURE_L3_FCLASS1))
- PARSE_ERROR1;
- m->mdmreg[REG_SI1] = 1;
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX;
- m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS1;
- info->xmit_size =
- m->mdmreg[REG_PSIZE] * 16;
- break;
- case '2':
- p[0]++;
- if (!(dev->global_features &
- ISDN_FEATURE_L3_FCLASS2))
- PARSE_ERROR1;
- m->mdmreg[REG_SI1] = 1;
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX;
- m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS2;
- info->xmit_size =
- m->mdmreg[REG_PSIZE] * 16;
- break;
+ case '1':
+ p[0]++;
+ if (!(dev->global_features &
+ ISDN_FEATURE_L3_FCLASS1))
+ PARSE_ERROR1;
+ m->mdmreg[REG_SI1] = 1;
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX;
+ m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS1;
+ info->xmit_size =
+ m->mdmreg[REG_PSIZE] * 16;
+ break;
+ case '2':
+ p[0]++;
+ if (!(dev->global_features &
+ ISDN_FEATURE_L3_FCLASS2))
+ PARSE_ERROR1;
+ m->mdmreg[REG_SI1] = 1;
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX;
+ m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS2;
+ info->xmit_size =
+ m->mdmreg[REG_PSIZE] * 16;
+ break;
#endif
- case '8':
- p[0]++;
- /* L2 will change on dialout with si=1 */
- m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
- m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS;
- m->mdmreg[REG_SI1] = 5;
- info->xmit_size = VBUF;
- break;
- case '?':
- p[0]++;
- strcpy(rs, "\r\n0,");
+ case '8':
+ p[0]++;
+ /* L2 will change on dialout with si=1 */
+ m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I;
+ m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS;
+ m->mdmreg[REG_SI1] = 5;
+ info->xmit_size = VBUF;
+ break;
+ case '?':
+ p[0]++;
+ strcpy(rs, "\r\n0,");
#ifdef CONFIG_ISDN_TTY_FAX
- if (dev->global_features &
- ISDN_FEATURE_L3_FCLASS1)
- strcat(rs, "1,");
- if (dev->global_features &
- ISDN_FEATURE_L3_FCLASS2)
- strcat(rs, "2,");
-#endif
- strcat(rs, "8");
- isdn_tty_at_cout(rs, info);
- break;
- default:
- PARSE_ERROR1;
- }
+ if (dev->global_features &
+ ISDN_FEATURE_L3_FCLASS1)
+ strcat(rs, "1,");
+ if (dev->global_features &
+ ISDN_FEATURE_L3_FCLASS2)
+ strcat(rs, "2,");
+#endif
+ strcat(rs, "8");
+ isdn_tty_at_cout(rs, info);
break;
default:
PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -3231,12 +3228,12 @@ isdn_tty_cmd_PLUSF(char **p, modem_info * info)
* Parse AT+V.. commands
*/
static int
-isdn_tty_cmd_PLUSV(char **p, modem_info * info)
+isdn_tty_cmd_PLUSV(char **p, modem_info *info)
{
atemu *m = &info->emu;
isdn_ctrl cmd;
static char *vcmd[] =
- {"NH", "IP", "LS", "RX", "SD", "SM", "TX", "DD", NULL};
+ {"NH", "IP", "LS", "RX", "SD", "SM", "TX", "DD", NULL};
int i;
int par1;
int par2;
@@ -3251,256 +3248,256 @@ isdn_tty_cmd_PLUSV(char **p, modem_info * info)
i++;
}
switch (i) {
- case 0:
- /* AT+VNH - Auto hangup feature */
+ case 0:
+ /* AT+VNH - Auto hangup feature */
+ switch (*p[0]) {
+ case '?':
+ p[0]++;
+ isdn_tty_at_cout("\r\n1", info);
+ break;
+ case '=':
+ p[0]++;
switch (*p[0]) {
- case '?':
- p[0]++;
- isdn_tty_at_cout("\r\n1", info);
- break;
- case '=':
- p[0]++;
- switch (*p[0]) {
- case '1':
- p[0]++;
- break;
- case '?':
- p[0]++;
- isdn_tty_at_cout("\r\n1", info);
- break;
- default:
- PARSE_ERROR1;
- }
- break;
- default:
- PARSE_ERROR1;
+ case '1':
+ p[0]++;
+ break;
+ case '?':
+ p[0]++;
+ isdn_tty_at_cout("\r\n1", info);
+ break;
+ default:
+ PARSE_ERROR1;
}
break;
- case 1:
- /* AT+VIP - Reset all voice parameters */
- isdn_tty_modem_reset_vpar(m);
+ default:
+ PARSE_ERROR1;
+ }
+ break;
+ case 1:
+ /* AT+VIP - Reset all voice parameters */
+ isdn_tty_modem_reset_vpar(m);
+ break;
+ case 2:
+ /* AT+VLS - Select device, accept incoming call */
+ switch (*p[0]) {
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", m->vpar[0]);
+ isdn_tty_at_cout(rs, info);
break;
- case 2:
- /* AT+VLS - Select device, accept incoming call */
+ case '=':
+ p[0]++;
switch (*p[0]) {
- case '?':
- p[0]++;
- sprintf(rs, "\r\n%d", m->vpar[0]);
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- switch (*p[0]) {
- case '0':
- p[0]++;
- m->vpar[0] = 0;
- break;
- case '2':
- p[0]++;
- m->vpar[0] = 2;
- break;
- case '?':
- p[0]++;
- isdn_tty_at_cout("\r\n0,2", info);
- break;
- default:
- PARSE_ERROR1;
- }
- break;
- default:
- PARSE_ERROR1;
- }
- break;
- case 3:
- /* AT+VRX - Start recording */
- if (!m->vpar[0])
- PARSE_ERROR1;
- if (info->online != 1) {
- isdn_tty_modem_result(RESULT_NO_ANSWER, info);
- return 1;
- }
- info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state);
- if (!info->dtmf_state) {
- printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n");
+ case '0':
+ p[0]++;
+ m->vpar[0] = 0;
+ break;
+ case '2':
+ p[0]++;
+ m->vpar[0] = 2;
+ break;
+ case '?':
+ p[0]++;
+ isdn_tty_at_cout("\r\n0,2", info);
+ break;
+ default:
PARSE_ERROR1;
}
- info->silence_state = isdn_audio_silence_init(info->silence_state);
- if (!info->silence_state) {
- printk(KERN_WARNING "isdn_tty: Couldn't malloc silence state\n");
+ break;
+ default:
+ PARSE_ERROR1;
+ }
+ break;
+ case 3:
+ /* AT+VRX - Start recording */
+ if (!m->vpar[0])
+ PARSE_ERROR1;
+ if (info->online != 1) {
+ isdn_tty_modem_result(RESULT_NO_ANSWER, info);
+ return 1;
+ }
+ info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state);
+ if (!info->dtmf_state) {
+ printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n");
+ PARSE_ERROR1;
+ }
+ info->silence_state = isdn_audio_silence_init(info->silence_state);
+ if (!info->silence_state) {
+ printk(KERN_WARNING "isdn_tty: Couldn't malloc silence state\n");
+ PARSE_ERROR1;
+ }
+ if (m->vpar[3] < 5) {
+ info->adpcmr = isdn_audio_adpcm_init(info->adpcmr, m->vpar[3]);
+ if (!info->adpcmr) {
+ printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n");
PARSE_ERROR1;
}
- if (m->vpar[3] < 5) {
- info->adpcmr = isdn_audio_adpcm_init(info->adpcmr, m->vpar[3]);
- if (!info->adpcmr) {
- printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n");
- PARSE_ERROR1;
- }
- }
+ }
#ifdef ISDN_DEBUG_AT
- printk(KERN_DEBUG "AT: +VRX\n");
+ printk(KERN_DEBUG "AT: +VRX\n");
#endif
- info->vonline |= 1;
- isdn_tty_modem_result(RESULT_CONNECT, info);
- return 0;
+ info->vonline |= 1;
+ isdn_tty_modem_result(RESULT_CONNECT, info);
+ return 0;
+ break;
+ case 4:
+ /* AT+VSD - Silence detection */
+ switch (*p[0]) {
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n<%d>,<%d>",
+ m->vpar[1],
+ m->vpar[2]);
+ isdn_tty_at_cout(rs, info);
break;
- case 4:
- /* AT+VSD - Silence detection */
- switch (*p[0]) {
- case '?':
- p[0]++;
- sprintf(rs, "\r\n<%d>,<%d>",
- m->vpar[1],
- m->vpar[2]);
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if ((*p[0]>='0') && (*p[0]<='9')) {
- par1 = isdn_getnum(p);
- if ((par1 < 0) || (par1 > 31))
- PARSE_ERROR1;
- if (*p[0] != ',')
- PARSE_ERROR1;
- p[0]++;
- par2 = isdn_getnum(p);
- if ((par2 < 0) || (par2 > 255))
- PARSE_ERROR1;
- m->vpar[1] = par1;
- m->vpar[2] = par2;
- break;
- } else
- if (*p[0] == '?') {
- p[0]++;
- isdn_tty_at_cout("\r\n<0-31>,<0-255>",
- info);
- break;
- } else
+ case '=':
+ p[0]++;
+ if ((*p[0] >= '0') && (*p[0] <= '9')) {
+ par1 = isdn_getnum(p);
+ if ((par1 < 0) || (par1 > 31))
PARSE_ERROR1;
- break;
- default:
+ if (*p[0] != ',')
PARSE_ERROR1;
- }
- break;
- case 5:
- /* AT+VSM - Select compression */
- switch (*p[0]) {
- case '?':
- p[0]++;
- sprintf(rs, "\r\n<%d>,<%d><8000>",
- m->vpar[3],
- m->vpar[1]);
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
+ p[0]++;
+ par2 = isdn_getnum(p);
+ if ((par2 < 0) || (par2 > 255))
+ PARSE_ERROR1;
+ m->vpar[1] = par1;
+ m->vpar[2] = par2;
+ break;
+ } else
+ if (*p[0] == '?') {
p[0]++;
- switch (*p[0]) {
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- par1 = isdn_getnum(p);
- if ((par1 < 2) || (par1 > 6))
- PARSE_ERROR1;
- m->vpar[3] = par1;
- break;
- case '?':
- p[0]++;
- isdn_tty_at_cout("\r\n2;ADPCM;2;0;(8000)\r\n",
- info);
- isdn_tty_at_cout("3;ADPCM;3;0;(8000)\r\n",
- info);
- isdn_tty_at_cout("4;ADPCM;4;0;(8000)\r\n",
- info);
- isdn_tty_at_cout("5;ALAW;8;0;(8000)\r\n",
- info);
- isdn_tty_at_cout("6;ULAW;8;0;(8000)\r\n",
- info);
- break;
- default:
- PARSE_ERROR1;
- }
+ isdn_tty_at_cout("\r\n<0-31>,<0-255>",
+ info);
break;
- default:
+ } else
PARSE_ERROR1;
- }
break;
- case 6:
- /* AT+VTX - Start sending */
- if (!m->vpar[0])
+ default:
+ PARSE_ERROR1;
+ }
+ break;
+ case 5:
+ /* AT+VSM - Select compression */
+ switch (*p[0]) {
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n<%d>,<%d><8000>",
+ m->vpar[3],
+ m->vpar[1]);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ switch (*p[0]) {
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ par1 = isdn_getnum(p);
+ if ((par1 < 2) || (par1 > 6))
+ PARSE_ERROR1;
+ m->vpar[3] = par1;
+ break;
+ case '?':
+ p[0]++;
+ isdn_tty_at_cout("\r\n2;ADPCM;2;0;(8000)\r\n",
+ info);
+ isdn_tty_at_cout("3;ADPCM;3;0;(8000)\r\n",
+ info);
+ isdn_tty_at_cout("4;ADPCM;4;0;(8000)\r\n",
+ info);
+ isdn_tty_at_cout("5;ALAW;8;0;(8000)\r\n",
+ info);
+ isdn_tty_at_cout("6;ULAW;8;0;(8000)\r\n",
+ info);
+ break;
+ default:
PARSE_ERROR1;
- if (info->online != 1) {
- isdn_tty_modem_result(RESULT_NO_ANSWER, info);
- return 1;
}
- info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state);
- if (!info->dtmf_state) {
- printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n");
+ break;
+ default:
+ PARSE_ERROR1;
+ }
+ break;
+ case 6:
+ /* AT+VTX - Start sending */
+ if (!m->vpar[0])
+ PARSE_ERROR1;
+ if (info->online != 1) {
+ isdn_tty_modem_result(RESULT_NO_ANSWER, info);
+ return 1;
+ }
+ info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state);
+ if (!info->dtmf_state) {
+ printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n");
+ PARSE_ERROR1;
+ }
+ if (m->vpar[3] < 5) {
+ info->adpcms = isdn_audio_adpcm_init(info->adpcms, m->vpar[3]);
+ if (!info->adpcms) {
+ printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n");
PARSE_ERROR1;
}
- if (m->vpar[3] < 5) {
- info->adpcms = isdn_audio_adpcm_init(info->adpcms, m->vpar[3]);
- if (!info->adpcms) {
- printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n");
- PARSE_ERROR1;
- }
- }
+ }
#ifdef ISDN_DEBUG_AT
- printk(KERN_DEBUG "AT: +VTX\n");
+ printk(KERN_DEBUG "AT: +VTX\n");
#endif
- m->lastDLE = 0;
- info->vonline |= 2;
- isdn_tty_modem_result(RESULT_CONNECT, info);
- return 0;
+ m->lastDLE = 0;
+ info->vonline |= 2;
+ isdn_tty_modem_result(RESULT_CONNECT, info);
+ return 0;
+ break;
+ case 7:
+ /* AT+VDD - DTMF detection */
+ switch (*p[0]) {
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n<%d>,<%d>",
+ m->vpar[4],
+ m->vpar[5]);
+ isdn_tty_at_cout(rs, info);
break;
- case 7:
- /* AT+VDD - DTMF detection */
- switch (*p[0]) {
- case '?':
- p[0]++;
- sprintf(rs, "\r\n<%d>,<%d>",
- m->vpar[4],
- m->vpar[5]);
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if ((*p[0]>='0') && (*p[0]<='9')) {
- if (info->online != 1)
- PARSE_ERROR1;
- par1 = isdn_getnum(p);
- if ((par1 < 0) || (par1 > 15))
- PARSE_ERROR1;
- if (*p[0] != ',')
- PARSE_ERROR1;
- p[0]++;
- par2 = isdn_getnum(p);
- if ((par2 < 0) || (par2 > 255))
- PARSE_ERROR1;
- m->vpar[4] = par1;
- m->vpar[5] = par2;
- cmd.driver = info->isdn_driver;
- cmd.command = ISDN_CMD_AUDIO;
- cmd.arg = info->isdn_channel + (ISDN_AUDIO_SETDD << 8);
- cmd.parm.num[0] = par1;
- cmd.parm.num[1] = par2;
- isdn_command(&cmd);
- break;
- } else
- if (*p[0] == '?') {
- p[0]++;
- isdn_tty_at_cout("\r\n<0-15>,<0-255>",
- info);
- break;
- } else
+ case '=':
+ p[0]++;
+ if ((*p[0] >= '0') && (*p[0] <= '9')) {
+ if (info->online != 1)
PARSE_ERROR1;
+ par1 = isdn_getnum(p);
+ if ((par1 < 0) || (par1 > 15))
+ PARSE_ERROR1;
+ if (*p[0] != ',')
+ PARSE_ERROR1;
+ p[0]++;
+ par2 = isdn_getnum(p);
+ if ((par2 < 0) || (par2 > 255))
+ PARSE_ERROR1;
+ m->vpar[4] = par1;
+ m->vpar[5] = par2;
+ cmd.driver = info->isdn_driver;
+ cmd.command = ISDN_CMD_AUDIO;
+ cmd.arg = info->isdn_channel + (ISDN_AUDIO_SETDD << 8);
+ cmd.parm.num[0] = par1;
+ cmd.parm.num[1] = par2;
+ isdn_command(&cmd);
+ break;
+ } else
+ if (*p[0] == '?') {
+ p[0]++;
+ isdn_tty_at_cout("\r\n<0-15>,<0-255>",
+ info);
break;
- default:
+ } else
PARSE_ERROR1;
- }
break;
default:
PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -3510,7 +3507,7 @@ isdn_tty_cmd_PLUSV(char **p, modem_info * info)
* Parse and perform an AT-command-line.
*/
static void
-isdn_tty_parse_at(modem_info * info)
+isdn_tty_parse_at(modem_info *info)
{
atemu *m = &info->emu;
char *p;
@@ -3521,188 +3518,188 @@ isdn_tty_parse_at(modem_info * info)
#endif
for (p = &m->mdmcmd[2]; *p;) {
switch (*p) {
- case ' ':
- p++;
+ case ' ':
+ p++;
+ break;
+ case 'A':
+ /* A - Accept incoming call */
+ p++;
+ isdn_tty_cmd_ATA(info);
+ return;
+ break;
+ case 'D':
+ /* D - Dial */
+ if (info->msr & UART_MSR_DCD)
+ PARSE_ERROR;
+ if (info->msr & UART_MSR_RI) {
+ isdn_tty_modem_result(RESULT_NO_CARRIER, info);
+ return;
+ }
+ isdn_tty_getdial(++p, ds, sizeof ds);
+ p += strlen(p);
+ if (!strlen(m->msn))
+ isdn_tty_modem_result(RESULT_NO_MSN_EAZ, info);
+ else if (strlen(ds))
+ isdn_tty_dial(ds, info, m);
+ else
+ PARSE_ERROR;
+ return;
+ case 'E':
+ /* E - Turn Echo on/off */
+ p++;
+ switch (isdn_getnum(&p)) {
+ case 0:
+ m->mdmreg[REG_ECHO] &= ~BIT_ECHO;
break;
- case 'A':
- /* A - Accept incoming call */
+ case 1:
+ m->mdmreg[REG_ECHO] |= BIT_ECHO;
+ break;
+ default:
+ PARSE_ERROR;
+ }
+ break;
+ case 'H':
+ /* H - On/Off-hook */
+ p++;
+ switch (*p) {
+ case '0':
p++;
- isdn_tty_cmd_ATA(info);
- return;
+ isdn_tty_on_hook(info);
break;
- case 'D':
- /* D - Dial */
- if (info->msr & UART_MSR_DCD)
- PARSE_ERROR;
- if (info->msr & UART_MSR_RI) {
- isdn_tty_modem_result(RESULT_NO_CARRIER, info);
- return;
- }
- isdn_tty_getdial(++p, ds, sizeof ds);
- p += strlen(p);
- if (!strlen(m->msn))
- isdn_tty_modem_result(RESULT_NO_MSN_EAZ, info);
- else if (strlen(ds))
- isdn_tty_dial(ds, info, m);
- else
- PARSE_ERROR;
- return;
- case 'E':
- /* E - Turn Echo on/off */
+ case '1':
p++;
- switch (isdn_getnum(&p)) {
- case 0:
- m->mdmreg[REG_ECHO] &= ~BIT_ECHO;
- break;
- case 1:
- m->mdmreg[REG_ECHO] |= BIT_ECHO;
- break;
- default:
- PARSE_ERROR;
- }
+ isdn_tty_off_hook();
break;
- case 'H':
- /* H - On/Off-hook */
+ default:
+ isdn_tty_on_hook(info);
+ break;
+ }
+ break;
+ case 'I':
+ /* I - Information */
+ p++;
+ isdn_tty_at_cout("\r\nLinux ISDN", info);
+ switch (*p) {
+ case '0':
+ case '1':
p++;
- switch (*p) {
- case '0':
- p++;
- isdn_tty_on_hook(info);
- break;
- case '1':
- p++;
- isdn_tty_off_hook();
- break;
- default:
- isdn_tty_on_hook(info);
- break;
- }
break;
- case 'I':
- /* I - Information */
+ case '2':
p++;
- isdn_tty_at_cout("\r\nLinux ISDN", info);
- switch (*p) {
- case '0':
- case '1':
- p++;
- break;
- case '2':
- p++;
- isdn_tty_report(info);
- break;
- case '3':
- p++;
- snprintf(ds, sizeof(ds), "\r\n%d", info->emu.charge);
- isdn_tty_at_cout(ds, info);
- break;
- default:;
- }
+ isdn_tty_report(info);
break;
-#ifdef DUMMY_HAYES_AT
- case 'L':
- case 'M':
- /* only for be compilant with common scripts */
- /* no function */
+ case '3':
p++;
- isdn_getnum(&p);
+ snprintf(ds, sizeof(ds), "\r\n%d", info->emu.charge);
+ isdn_tty_at_cout(ds, info);
break;
+ default:;
+ }
+ break;
+#ifdef DUMMY_HAYES_AT
+ case 'L':
+ case 'M':
+ /* only for be compilant with common scripts */
+ /* no function */
+ p++;
+ isdn_getnum(&p);
+ break;
#endif
- case 'O':
- /* O - Go online */
- p++;
- if (info->msr & UART_MSR_DCD)
- /* if B-Channel is up */
- isdn_tty_modem_result((m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) ? RESULT_CONNECT:RESULT_CONNECT64000, info);
- else
- isdn_tty_modem_result(RESULT_NO_CARRIER, info);
+ case 'O':
+ /* O - Go online */
+ p++;
+ if (info->msr & UART_MSR_DCD)
+ /* if B-Channel is up */
+ isdn_tty_modem_result((m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) ? RESULT_CONNECT : RESULT_CONNECT64000, info);
+ else
+ isdn_tty_modem_result(RESULT_NO_CARRIER, info);
+ return;
+ case 'Q':
+ /* Q - Turn Emulator messages on/off */
+ p++;
+ switch (isdn_getnum(&p)) {
+ case 0:
+ m->mdmreg[REG_RESP] |= BIT_RESP;
+ break;
+ case 1:
+ m->mdmreg[REG_RESP] &= ~BIT_RESP;
+ break;
+ default:
+ PARSE_ERROR;
+ }
+ break;
+ case 'S':
+ /* S - Set/Get Register */
+ p++;
+ if (isdn_tty_cmd_ATS(&p, info))
return;
- case 'Q':
- /* Q - Turn Emulator messages on/off */
- p++;
- switch (isdn_getnum(&p)) {
- case 0:
- m->mdmreg[REG_RESP] |= BIT_RESP;
- break;
- case 1:
- m->mdmreg[REG_RESP] &= ~BIT_RESP;
- break;
- default:
- PARSE_ERROR;
- }
+ break;
+ case 'V':
+ /* V - Numeric or ASCII Emulator-messages */
+ p++;
+ switch (isdn_getnum(&p)) {
+ case 0:
+ m->mdmreg[REG_RESP] |= BIT_RESPNUM;
+ break;
+ case 1:
+ m->mdmreg[REG_RESP] &= ~BIT_RESPNUM;
break;
- case 'S':
- /* S - Set/Get Register */
+ default:
+ PARSE_ERROR;
+ }
+ break;
+ case 'Z':
+ /* Z - Load Registers from Profile */
+ p++;
+ if (info->msr & UART_MSR_DCD) {
+ info->online = 0;
+ isdn_tty_on_hook(info);
+ }
+ isdn_tty_modem_reset_regs(info, 1);
+ break;
+ case '+':
+ p++;
+ switch (*p) {
+#ifdef CONFIG_ISDN_AUDIO
+ case 'F':
p++;
- if (isdn_tty_cmd_ATS(&p, info))
+ if (isdn_tty_cmd_PLUSF(&p, info))
return;
break;
case 'V':
- /* V - Numeric or ASCII Emulator-messages */
+ if ((!(m->mdmreg[REG_SI1] & 1)) ||
+ (m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM))
+ PARSE_ERROR;
p++;
- switch (isdn_getnum(&p)) {
- case 0:
- m->mdmreg[REG_RESP] |= BIT_RESPNUM;
- break;
- case 1:
- m->mdmreg[REG_RESP] &= ~BIT_RESPNUM;
- break;
- default:
- PARSE_ERROR;
- }
+ if (isdn_tty_cmd_PLUSV(&p, info))
+ return;
break;
- case 'Z':
- /* Z - Load Registers from Profile */
+#endif /* CONFIG_ISDN_AUDIO */
+ case 'S': /* SUSPEND */
p++;
- if (info->msr & UART_MSR_DCD) {
- info->online = 0;
- isdn_tty_on_hook(info);
- }
- isdn_tty_modem_reset_regs(info, 1);
+ isdn_tty_get_msnstr(ds, &p);
+ isdn_tty_suspend(ds, info, m);
break;
- case '+':
+ case 'R': /* RESUME */
p++;
- switch (*p) {
-#ifdef CONFIG_ISDN_AUDIO
- case 'F':
- p++;
- if (isdn_tty_cmd_PLUSF(&p, info))
- return;
- break;
- case 'V':
- if ((!(m->mdmreg[REG_SI1] & 1)) ||
- (m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM))
- PARSE_ERROR;
- p++;
- if (isdn_tty_cmd_PLUSV(&p, info))
- return;
- break;
-#endif /* CONFIG_ISDN_AUDIO */
- case 'S': /* SUSPEND */
- p++;
- isdn_tty_get_msnstr(ds, &p);
- isdn_tty_suspend(ds, info, m);
- break;
- case 'R': /* RESUME */
- p++;
- isdn_tty_get_msnstr(ds, &p);
- isdn_tty_resume(ds, info, m);
- break;
- case 'M': /* MESSAGE */
- p++;
- isdn_tty_send_msg(info, m, p);
- break;
- default:
- PARSE_ERROR;
- }
+ isdn_tty_get_msnstr(ds, &p);
+ isdn_tty_resume(ds, info, m);
break;
- case '&':
+ case 'M': /* MESSAGE */
p++;
- if (isdn_tty_cmd_ATand(&p, info))
- return;
+ isdn_tty_send_msg(info, m, p);
break;
default:
PARSE_ERROR;
+ }
+ break;
+ case '&':
+ p++;
+ if (isdn_tty_cmd_ATand(&p, info))
+ return;
+ break;
+ default:
+ PARSE_ERROR;
}
}
#ifdef CONFIG_ISDN_AUDIO
@@ -3714,7 +3711,7 @@ isdn_tty_parse_at(modem_info * info)
/* Need own toupper() because standard-toupper is not available
* within modules.
*/
-#define my_toupper(c) (((c>='a')&&(c<='z'))?(c&0xdf):c)
+#define my_toupper(c) (((c >= 'a') && (c <= 'z')) ? (c & 0xdf) : c)
/*
* Perform line-editing of AT-commands
@@ -3725,7 +3722,7 @@ isdn_tty_parse_at(modem_info * info)
* channel index to line (minor-device)
*/
static int
-isdn_tty_edit_at(const char *p, int count, modem_info * info)
+isdn_tty_edit_at(const char *p, int count, modem_info *info)
{
atemu *m = &info->emu;
int total = 0;
@@ -3768,23 +3765,23 @@ isdn_tty_edit_at(const char *p, int count, modem_info * info)
if (m->mdmcmdl < 255) {
c = my_toupper(c);
switch (m->mdmcmdl) {
- case 1:
- if (c == 'T') {
- m->mdmcmd[m->mdmcmdl] = c;
- m->mdmcmd[++m->mdmcmdl] = 0;
- break;
- } else
- m->mdmcmdl = 0;
- /* Fall through, check for 'A' */
- case 0:
- if (c == 'A') {
- m->mdmcmd[m->mdmcmdl] = c;
- m->mdmcmd[++m->mdmcmdl] = 0;
- }
+ case 1:
+ if (c == 'T') {
+ m->mdmcmd[m->mdmcmdl] = c;
+ m->mdmcmd[++m->mdmcmdl] = 0;
break;
- default:
+ } else
+ m->mdmcmdl = 0;
+ /* Fall through, check for 'A' */
+ case 0:
+ if (c == 'A') {
m->mdmcmd[m->mdmcmdl] = c;
m->mdmcmd[++m->mdmcmdl] = 0;
+ }
+ break;
+ default:
+ m->mdmcmd[m->mdmcmdl] = c;
+ m->mdmcmd[++m->mdmcmdl] = 0;
}
}
}
diff --git a/drivers/isdn/i4l/isdn_tty.h b/drivers/isdn/i4l/isdn_tty.h
index 692c74d6b749..a6f801d2263b 100644
--- a/drivers/isdn/i4l/isdn_tty.h
+++ b/drivers/isdn/i4l/isdn_tty.h
@@ -93,11 +93,11 @@
#define RESULT_VCON 11
#define RESULT_RUNG 12
-#define TTY_IS_FCLASS1(info) \
- ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
+#define TTY_IS_FCLASS1(info) \
+ ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
(info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS1))
-#define TTY_IS_FCLASS2(info) \
- ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
+#define TTY_IS_FCLASS2(info) \
+ ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
(info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2))
extern void isdn_tty_modem_escape(void);
@@ -110,7 +110,7 @@ extern void isdn_tty_readmodem(void);
extern int isdn_tty_find_icall(int, int, setup_parm *);
extern int isdn_tty_stat_callback(int, isdn_ctrl *);
extern int isdn_tty_rcv_skb(int, int, int, struct sk_buff *);
-extern int isdn_tty_capi_facility(capi_msg *cm);
+extern int isdn_tty_capi_facility(capi_msg *cm);
extern void isdn_tty_at_cout(char *, modem_info *);
extern void isdn_tty_modem_hup(modem_info *, int);
#ifdef CONFIG_ISDN_TTY_FAX
diff --git a/drivers/isdn/i4l/isdn_ttyfax.c b/drivers/isdn/i4l/isdn_ttyfax.c
index 4c41f191d4e2..47aae4916730 100644
--- a/drivers/isdn/i4l/isdn_ttyfax.c
+++ b/drivers/isdn/i4l/isdn_ttyfax.c
@@ -45,7 +45,7 @@ isdn_getrev(const char *revision)
*/
static void
-isdn_tty_fax_modem_result(int code, modem_info * info)
+isdn_tty_fax_modem_result(int code, modem_info *info)
{
atemu *m = &info->emu;
T30_s *f = info->fax;
@@ -54,9 +54,9 @@ isdn_tty_fax_modem_result(int code, modem_info * info)
char *rp;
int i;
static char *msg[] =
- {"OK", "ERROR", "+FCON", "+FCSI:", "+FDIS:",
- "+FHNG:", "+FDCS:", "CONNECT", "+FTSI:",
- "+FCFR", "+FPTS:", "+FET:"};
+ {"OK", "ERROR", "+FCON", "+FCSI:", "+FDIS:",
+ "+FHNG:", "+FDCS:", "CONNECT", "+FTSI:",
+ "+FCFR", "+FPTS:", "+FET:"};
isdn_tty_at_cout("\r\n", info);
@@ -64,95 +64,95 @@ isdn_tty_fax_modem_result(int code, modem_info * info)
#ifdef ISDN_TTY_FAX_CMD_DEBUG
printk(KERN_DEBUG "isdn_tty: Fax send %s on ttyI%d\n",
- msg[code], info->line);
+ msg[code], info->line);
#endif
switch (code) {
- case 0: /* OK */
- break;
- case 1: /* ERROR */
- break;
- case 2: /* +FCON */
- /* Append CPN, if enabled */
- if ((m->mdmreg[REG_CPNFCON] & BIT_CPNFCON) &&
- (!(dev->usage[info->isdn_channel] & ISDN_USAGE_OUTGOING))) {
- sprintf(rs, "/%s", m->cpn);
- isdn_tty_at_cout(rs, info);
- }
- info->online = 1;
- f->fet = 0;
- if (f->phase == ISDN_FAX_PHASE_A)
- f->phase = ISDN_FAX_PHASE_B;
- break;
- case 3: /* +FCSI */
- case 8: /* +FTSI */
- sprintf(rs, "\"%s\"", f->r_id);
- isdn_tty_at_cout(rs, info);
- break;
- case 4: /* +FDIS */
- rs[0] = 0;
- rp = &f->r_resolution;
- for (i = 0; i < 8; i++) {
- sprintf(rss, "%c%s", rp[i] + 48,
- (i < 7) ? "," : "");
- strcat(rs, rss);
- }
+ case 0: /* OK */
+ break;
+ case 1: /* ERROR */
+ break;
+ case 2: /* +FCON */
+ /* Append CPN, if enabled */
+ if ((m->mdmreg[REG_CPNFCON] & BIT_CPNFCON) &&
+ (!(dev->usage[info->isdn_channel] & ISDN_USAGE_OUTGOING))) {
+ sprintf(rs, "/%s", m->cpn);
isdn_tty_at_cout(rs, info);
+ }
+ info->online = 1;
+ f->fet = 0;
+ if (f->phase == ISDN_FAX_PHASE_A)
+ f->phase = ISDN_FAX_PHASE_B;
+ break;
+ case 3: /* +FCSI */
+ case 8: /* +FTSI */
+ sprintf(rs, "\"%s\"", f->r_id);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case 4: /* +FDIS */
+ rs[0] = 0;
+ rp = &f->r_resolution;
+ for (i = 0; i < 8; i++) {
+ sprintf(rss, "%c%s", rp[i] + 48,
+ (i < 7) ? "," : "");
+ strcat(rs, rss);
+ }
+ isdn_tty_at_cout(rs, info);
#ifdef ISDN_TTY_FAX_CMD_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax DIS=%s on ttyI%d\n",
- rs, info->line);
+ printk(KERN_DEBUG "isdn_tty: Fax DIS=%s on ttyI%d\n",
+ rs, info->line);
#endif
- break;
- case 5: /* +FHNG */
- sprintf(rs, "%d", f->code);
- isdn_tty_at_cout(rs, info);
- info->faxonline = 0;
- break;
- case 6: /* +FDCS */
- rs[0] = 0;
- rp = &f->r_resolution;
- for (i = 0; i < 8; i++) {
- sprintf(rss, "%c%s", rp[i] + 48,
- (i < 7) ? "," : "");
- strcat(rs, rss);
- }
- isdn_tty_at_cout(rs, info);
+ break;
+ case 5: /* +FHNG */
+ sprintf(rs, "%d", f->code);
+ isdn_tty_at_cout(rs, info);
+ info->faxonline = 0;
+ break;
+ case 6: /* +FDCS */
+ rs[0] = 0;
+ rp = &f->r_resolution;
+ for (i = 0; i < 8; i++) {
+ sprintf(rss, "%c%s", rp[i] + 48,
+ (i < 7) ? "," : "");
+ strcat(rs, rss);
+ }
+ isdn_tty_at_cout(rs, info);
#ifdef ISDN_TTY_FAX_CMD_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax DCS=%s on ttyI%d\n",
- rs, info->line);
+ printk(KERN_DEBUG "isdn_tty: Fax DCS=%s on ttyI%d\n",
+ rs, info->line);
#endif
- break;
- case 7: /* CONNECT */
- info->faxonline |= 2;
- break;
- case 9: /* FCFR */
- break;
- case 10: /* FPTS */
- isdn_tty_at_cout("1", info);
- break;
- case 11: /* FET */
- sprintf(rs, "%d", f->fet);
- isdn_tty_at_cout(rs, info);
- break;
+ break;
+ case 7: /* CONNECT */
+ info->faxonline |= 2;
+ break;
+ case 9: /* FCFR */
+ break;
+ case 10: /* FPTS */
+ isdn_tty_at_cout("1", info);
+ break;
+ case 11: /* FET */
+ sprintf(rs, "%d", f->fet);
+ isdn_tty_at_cout(rs, info);
+ break;
}
isdn_tty_at_cout("\r\n", info);
switch (code) {
- case 7: /* CONNECT */
- info->online = 2;
- if (info->faxonline & 1) {
- sprintf(rs, "%c", XON);
- isdn_tty_at_cout(rs, info);
- }
- break;
+ case 7: /* CONNECT */
+ info->online = 2;
+ if (info->faxonline & 1) {
+ sprintf(rs, "%c", XON);
+ isdn_tty_at_cout(rs, info);
+ }
+ break;
}
}
static int
-isdn_tty_fax_command1(modem_info * info, isdn_ctrl * c)
+isdn_tty_fax_command1(modem_info *info, isdn_ctrl *c)
{
static char *msg[] =
- {"OK", "CONNECT", "NO CARRIER", "ERROR", "FCERROR"};
+ {"OK", "CONNECT", "NO CARRIER", "ERROR", "FCERROR"};
#ifdef ISDN_TTY_FAX_CMD_DEBUG
printk(KERN_DEBUG "isdn_tty: FCLASS1 cmd(%d)\n", c->parm.aux.cmd);
@@ -165,30 +165,30 @@ isdn_tty_fax_command1(modem_info * info, isdn_ctrl * c)
isdn_tty_at_cout("\r\n", info);
}
switch (c->parm.aux.cmd) {
- case ISDN_FAX_CLASS1_CONNECT:
- info->online = 2;
- break;
- case ISDN_FAX_CLASS1_OK:
- case ISDN_FAX_CLASS1_FCERROR:
- case ISDN_FAX_CLASS1_ERROR:
- case ISDN_FAX_CLASS1_NOCARR:
- break;
- case ISDN_FAX_CLASS1_QUERY:
+ case ISDN_FAX_CLASS1_CONNECT:
+ info->online = 2;
+ break;
+ case ISDN_FAX_CLASS1_OK:
+ case ISDN_FAX_CLASS1_FCERROR:
+ case ISDN_FAX_CLASS1_ERROR:
+ case ISDN_FAX_CLASS1_NOCARR:
+ break;
+ case ISDN_FAX_CLASS1_QUERY:
+ isdn_tty_at_cout("\r\n", info);
+ if (!c->parm.aux.para[0]) {
+ isdn_tty_at_cout(msg[ISDN_FAX_CLASS1_ERROR], info);
isdn_tty_at_cout("\r\n", info);
- if (!c->parm.aux.para[0]) {
- isdn_tty_at_cout(msg[ISDN_FAX_CLASS1_ERROR], info);
- isdn_tty_at_cout("\r\n", info);
- } else {
- isdn_tty_at_cout(c->parm.aux.para, info);
- isdn_tty_at_cout("\r\nOK\r\n", info);
- }
- break;
+ } else {
+ isdn_tty_at_cout(c->parm.aux.para, info);
+ isdn_tty_at_cout("\r\nOK\r\n", info);
+ }
+ break;
}
return (0);
}
int
-isdn_tty_fax_command(modem_info * info, isdn_ctrl * c)
+isdn_tty_fax_command(modem_info *info, isdn_ctrl *c)
{
T30_s *f = info->fax;
char rs[10];
@@ -201,78 +201,78 @@ isdn_tty_fax_command(modem_info * info, isdn_ctrl * c)
f->r_code, info->line);
#endif
switch (f->r_code) {
- case ISDN_TTY_FAX_FCON:
- info->faxonline = 1;
- isdn_tty_fax_modem_result(2, info); /* +FCON */
- return (0);
- case ISDN_TTY_FAX_FCON_I:
- info->faxonline = 16;
- isdn_tty_fax_modem_result(2, info); /* +FCON */
- return (0);
- case ISDN_TTY_FAX_RID:
- if (info->faxonline & 1)
- isdn_tty_fax_modem_result(3, info); /* +FCSI */
- if (info->faxonline & 16)
- isdn_tty_fax_modem_result(8, info); /* +FTSI */
- return (0);
- case ISDN_TTY_FAX_DIS:
- isdn_tty_fax_modem_result(4, info); /* +FDIS */
- return (0);
- case ISDN_TTY_FAX_HNG:
- if (f->phase == ISDN_FAX_PHASE_C) {
- if (f->direction == ISDN_TTY_FAX_CONN_IN) {
- sprintf(rs, "%c%c", DLE, ETX);
- isdn_tty_at_cout(rs, info);
- } else {
- sprintf(rs, "%c", 0x18);
- isdn_tty_at_cout(rs, info);
- }
- info->faxonline &= ~2; /* leave data mode */
- info->online = 1;
- }
- f->phase = ISDN_FAX_PHASE_E;
- isdn_tty_fax_modem_result(5, info); /* +FHNG */
- isdn_tty_fax_modem_result(0, info); /* OK */
- return (0);
- case ISDN_TTY_FAX_DCS:
- isdn_tty_fax_modem_result(6, info); /* +FDCS */
- isdn_tty_fax_modem_result(7, info); /* CONNECT */
- f->phase = ISDN_FAX_PHASE_C;
- return (0);
- case ISDN_TTY_FAX_TRAIN_OK:
- isdn_tty_fax_modem_result(6, info); /* +FDCS */
- isdn_tty_fax_modem_result(0, info); /* OK */
- return (0);
- case ISDN_TTY_FAX_SENT:
- isdn_tty_fax_modem_result(0, info); /* OK */
- return (0);
- case ISDN_TTY_FAX_CFR:
- isdn_tty_fax_modem_result(9, info); /* +FCFR */
- return (0);
- case ISDN_TTY_FAX_ET:
- sprintf(rs, "%c%c", DLE, ETX);
- isdn_tty_at_cout(rs, info);
- isdn_tty_fax_modem_result(10, info); /* +FPTS */
- isdn_tty_fax_modem_result(11, info); /* +FET */
- isdn_tty_fax_modem_result(0, info); /* OK */
- info->faxonline &= ~2; /* leave data mode */
- info->online = 1;
- f->phase = ISDN_FAX_PHASE_D;
- return (0);
- case ISDN_TTY_FAX_PTS:
- isdn_tty_fax_modem_result(10, info); /* +FPTS */
- if (f->direction == ISDN_TTY_FAX_CONN_OUT) {
- if (f->fet == 1)
- f->phase = ISDN_FAX_PHASE_B;
- if (f->fet == 0)
- isdn_tty_fax_modem_result(0, info); /* OK */
+ case ISDN_TTY_FAX_FCON:
+ info->faxonline = 1;
+ isdn_tty_fax_modem_result(2, info); /* +FCON */
+ return (0);
+ case ISDN_TTY_FAX_FCON_I:
+ info->faxonline = 16;
+ isdn_tty_fax_modem_result(2, info); /* +FCON */
+ return (0);
+ case ISDN_TTY_FAX_RID:
+ if (info->faxonline & 1)
+ isdn_tty_fax_modem_result(3, info); /* +FCSI */
+ if (info->faxonline & 16)
+ isdn_tty_fax_modem_result(8, info); /* +FTSI */
+ return (0);
+ case ISDN_TTY_FAX_DIS:
+ isdn_tty_fax_modem_result(4, info); /* +FDIS */
+ return (0);
+ case ISDN_TTY_FAX_HNG:
+ if (f->phase == ISDN_FAX_PHASE_C) {
+ if (f->direction == ISDN_TTY_FAX_CONN_IN) {
+ sprintf(rs, "%c%c", DLE, ETX);
+ isdn_tty_at_cout(rs, info);
+ } else {
+ sprintf(rs, "%c", 0x18);
+ isdn_tty_at_cout(rs, info);
}
- return (0);
- case ISDN_TTY_FAX_EOP:
info->faxonline &= ~2; /* leave data mode */
info->online = 1;
- f->phase = ISDN_FAX_PHASE_D;
- return (0);
+ }
+ f->phase = ISDN_FAX_PHASE_E;
+ isdn_tty_fax_modem_result(5, info); /* +FHNG */
+ isdn_tty_fax_modem_result(0, info); /* OK */
+ return (0);
+ case ISDN_TTY_FAX_DCS:
+ isdn_tty_fax_modem_result(6, info); /* +FDCS */
+ isdn_tty_fax_modem_result(7, info); /* CONNECT */
+ f->phase = ISDN_FAX_PHASE_C;
+ return (0);
+ case ISDN_TTY_FAX_TRAIN_OK:
+ isdn_tty_fax_modem_result(6, info); /* +FDCS */
+ isdn_tty_fax_modem_result(0, info); /* OK */
+ return (0);
+ case ISDN_TTY_FAX_SENT:
+ isdn_tty_fax_modem_result(0, info); /* OK */
+ return (0);
+ case ISDN_TTY_FAX_CFR:
+ isdn_tty_fax_modem_result(9, info); /* +FCFR */
+ return (0);
+ case ISDN_TTY_FAX_ET:
+ sprintf(rs, "%c%c", DLE, ETX);
+ isdn_tty_at_cout(rs, info);
+ isdn_tty_fax_modem_result(10, info); /* +FPTS */
+ isdn_tty_fax_modem_result(11, info); /* +FET */
+ isdn_tty_fax_modem_result(0, info); /* OK */
+ info->faxonline &= ~2; /* leave data mode */
+ info->online = 1;
+ f->phase = ISDN_FAX_PHASE_D;
+ return (0);
+ case ISDN_TTY_FAX_PTS:
+ isdn_tty_fax_modem_result(10, info); /* +FPTS */
+ if (f->direction == ISDN_TTY_FAX_CONN_OUT) {
+ if (f->fet == 1)
+ f->phase = ISDN_FAX_PHASE_B;
+ if (f->fet == 0)
+ isdn_tty_fax_modem_result(0, info); /* OK */
+ }
+ return (0);
+ case ISDN_TTY_FAX_EOP:
+ info->faxonline &= ~2; /* leave data mode */
+ info->online = 1;
+ f->phase = ISDN_FAX_PHASE_D;
+ return (0);
}
return (-1);
@@ -280,7 +280,7 @@ isdn_tty_fax_command(modem_info * info, isdn_ctrl * c)
void
-isdn_tty_fax_bitorder(modem_info * info, struct sk_buff *skb)
+isdn_tty_fax_bitorder(modem_info *info, struct sk_buff *skb)
{
__u8 LeftMask;
__u8 RightMask;
@@ -292,10 +292,10 @@ isdn_tty_fax_bitorder(modem_info * info, struct sk_buff *skb)
for (i = 0; i < skb->len; i++) {
Data = skb->data[i];
for (
- LeftMask = 0x80, RightMask = 0x01;
- LeftMask > RightMask;
- LeftMask >>= 1, RightMask <<= 1
- ) {
+ LeftMask = 0x80, RightMask = 0x01;
+ LeftMask > RightMask;
+ LeftMask >>= 1, RightMask <<= 1
+ ) {
fBit = (Data & LeftMask);
if (Data & RightMask)
Data |= LeftMask;
@@ -317,10 +317,10 @@ isdn_tty_fax_bitorder(modem_info * info, struct sk_buff *skb)
*/
static int
-isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
+isdn_tty_cmd_FCLASS1(char **p, modem_info *info)
{
static char *cmd[] =
- {"AE", "TS", "RS", "TM", "RM", "TH", "RH"};
+ {"AE", "TS", "RS", "TM", "RM", "TH", "RH"};
isdn_ctrl c;
int par, i;
u_long flags;
@@ -337,28 +337,28 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
p[0] += 2;
switch (*p[0]) {
- case '?':
- p[0]++;
- c.parm.aux.subcmd = AT_QUERY;
- break;
- case '=':
+ case '?':
+ p[0]++;
+ c.parm.aux.subcmd = AT_QUERY;
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- c.parm.aux.subcmd = AT_EQ_QUERY;
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 255))
- PARSE_ERROR1;
- c.parm.aux.subcmd = AT_EQ_VALUE;
- c.parm.aux.para[0] = par;
- }
- break;
- case 0:
- c.parm.aux.subcmd = AT_COMMAND;
- break;
- default:
- PARSE_ERROR1;
+ c.parm.aux.subcmd = AT_EQ_QUERY;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 255))
+ PARSE_ERROR1;
+ c.parm.aux.subcmd = AT_EQ_VALUE;
+ c.parm.aux.para[0] = par;
+ }
+ break;
+ case 0:
+ c.parm.aux.subcmd = AT_COMMAND;
+ break;
+ default:
+ PARSE_ERROR1;
}
c.command = ISDN_CMD_FAXCMD;
#ifdef ISDN_TTY_FAX_CMD_DEBUG
@@ -409,7 +409,7 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
*/
static int
-isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
+isdn_tty_cmd_FCLASS2(char **p, modem_info *info)
{
atemu *m = &info->emu;
T30_s *f = info->fax;
@@ -418,25 +418,25 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
char rs[50];
char rss[50];
int maxdccval[] =
- {1, 5, 2, 2, 3, 2, 0, 7};
+ {1, 5, 2, 2, 3, 2, 0, 7};
/* FAA still unchanged */
if (!strncmp(p[0], "AA", 2)) { /* TODO */
p[0] += 2;
switch (*p[0]) {
- case '?':
- p[0]++;
- sprintf(rs, "\r\n%d", 0);
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- par = isdn_getnum(p);
- if ((par < 0) || (par > 255))
- PARSE_ERROR1;
- break;
- default:
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", 0);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 255))
PARSE_ERROR1;
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -444,29 +444,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "BADLIN", 6)) {
p[0] += 6;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->badlin);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->badlin);
+ sprintf(rs, "\r\n0-255");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0-255");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 255))
- PARSE_ERROR1;
- f->badlin = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 255))
+ PARSE_ERROR1;
+ f->badlin = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FBADLIN=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FBADLIN=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -474,29 +474,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "BADMUL", 6)) {
p[0] += 6;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->badmul);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->badmul);
+ sprintf(rs, "\r\n0-255");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0-255");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 255))
- PARSE_ERROR1;
- f->badmul = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 255))
+ PARSE_ERROR1;
+ f->badmul = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FBADMUL=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FBADMUL=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -504,29 +504,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "BOR", 3)) {
p[0] += 3;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->bor);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->bor);
+ sprintf(rs, "\r\n0,1");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0,1");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 1))
- PARSE_ERROR1;
- f->bor = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 1))
+ PARSE_ERROR1;
+ f->bor = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FBOR=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FBOR=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -534,29 +534,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "NBC", 3)) {
p[0] += 3;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->nbc);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->nbc);
+ sprintf(rs, "\r\n0,1");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0,1");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 1))
- PARSE_ERROR1;
- f->nbc = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 1))
+ PARSE_ERROR1;
+ f->nbc = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FNBC=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FNBC=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -576,36 +576,36 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
int i, r;
p[0] += 3;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n\"%s\"", f->pollid);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n\"%s\"", f->pollid);
+ sprintf(rs, "\r\n\"STRING\"");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
+ } else {
+ if (*p[0] == '"')
p[0]++;
- sprintf(rs, "\r\n\"STRING\"");
- isdn_tty_at_cout(rs, info);
- } else {
- if (*p[0] == '"')
- p[0]++;
- for (i = 0; (*p[0]) && i < (FAXIDLEN - 1) && (*p[0] != '"'); i++) {
- f->pollid[i] = *p[0]++;
- }
- if (*p[0] == '"')
- p[0]++;
- for (r = i; r < FAXIDLEN; r++) {
- f->pollid[r] = 32;
- }
- f->pollid[FAXIDLEN - 1] = 0;
+ for (i = 0; (*p[0]) && i < (FAXIDLEN - 1) && (*p[0] != '"'); i++) {
+ f->pollid[i] = *p[0]++;
+ }
+ if (*p[0] == '"')
+ p[0]++;
+ for (r = i; r < FAXIDLEN; r++) {
+ f->pollid[r] = 32;
+ }
+ f->pollid[FAXIDLEN - 1] = 0;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax local poll ID rx \"%s\"\n", f->pollid);
+ printk(KERN_DEBUG "isdn_tty: Fax local poll ID rx \"%s\"\n", f->pollid);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -613,29 +613,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "CQ", 2)) {
p[0] += 2;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->cq);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->cq);
+ sprintf(rs, "\r\n0,1,2");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0,1,2");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 2))
- PARSE_ERROR1;
- f->cq = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 2))
+ PARSE_ERROR1;
+ f->cq = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FCQ=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FCQ=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -643,29 +643,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "CR", 2)) {
p[0] += 2;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->cr); /* read actual value from struct and print */
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->cr); /* read actual value from struct and print */
+ sprintf(rs, "\r\n0,1"); /* display online help */
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0,1"); /* display online help */
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 1))
- PARSE_ERROR1;
- f->cr = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 1))
+ PARSE_ERROR1;
+ f->cr = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FCR=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FCR=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -673,29 +673,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "CTCRTY", 6)) {
p[0] += 6;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->ctcrty);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->ctcrty);
+ sprintf(rs, "\r\n0-255");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0-255");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 255))
- PARSE_ERROR1;
- f->ctcrty = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 255))
+ PARSE_ERROR1;
+ f->ctcrty = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FCTCRTY=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FCTCRTY=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -706,42 +706,42 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
p[0] += 3;
switch (*p[0]) {
- case '?':
- p[0]++;
- strcpy(rs, "\r\n");
- for (i = 0; i < 8; i++) {
- sprintf(rss, "%c%s", rp[i] + 48,
- (i < 7) ? "," : "");
- strcat(rs, rss);
- }
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
+ case '?':
+ p[0]++;
+ strcpy(rs, "\r\n");
+ for (i = 0; i < 8; i++) {
+ sprintf(rss, "%c%s", rp[i] + 48,
+ (i < 7) ? "," : "");
+ strcat(rs, rss);
+ }
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
+ isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info);
p[0]++;
- if (*p[0] == '?') {
- isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info);
- p[0]++;
- } else {
- for (i = 0; (((*p[0] >= '0') && (*p[0] <= '9')) || (*p[0] == ',')) && (i < 8); i++) {
- if (*p[0] != ',') {
- if ((*p[0] - 48) > maxdccval[i]) {
- PARSE_ERROR1;
- }
- rp[i] = *p[0] - 48;
- p[0]++;
- if (*p[0] == ',')
- p[0]++;
- } else
+ } else {
+ for (i = 0; (((*p[0] >= '0') && (*p[0] <= '9')) || (*p[0] == ',')) && (i < 8); i++) {
+ if (*p[0] != ',') {
+ if ((*p[0] - 48) > maxdccval[i]) {
+ PARSE_ERROR1;
+ }
+ rp[i] = *p[0] - 48;
+ p[0]++;
+ if (*p[0] == ',')
p[0]++;
- }
+ } else
+ p[0]++;
+ }
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FDCC capabilities DCE=%d,%d,%d,%d,%d,%d,%d,%d\n",
- rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7]);
+ printk(KERN_DEBUG "isdn_tty: Fax FDCC capabilities DCE=%d,%d,%d,%d,%d,%d,%d,%d\n",
+ rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7]);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -752,42 +752,42 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
p[0] += 3;
switch (*p[0]) {
- case '?':
- p[0]++;
- strcpy(rs, "\r\n");
- for (i = 0; i < 8; i++) {
- sprintf(rss, "%c%s", rp[i] + 48,
- (i < 7) ? "," : "");
- strcat(rs, rss);
- }
- isdn_tty_at_cout(rs, info);
- break;
- case '=':
+ case '?':
+ p[0]++;
+ strcpy(rs, "\r\n");
+ for (i = 0; i < 8; i++) {
+ sprintf(rss, "%c%s", rp[i] + 48,
+ (i < 7) ? "," : "");
+ strcat(rs, rss);
+ }
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
+ isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info);
p[0]++;
- if (*p[0] == '?') {
- isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info);
- p[0]++;
- } else {
- for (i = 0; (((*p[0] >= '0') && (*p[0] <= '9')) || (*p[0] == ',')) && (i < 8); i++) {
- if (*p[0] != ',') {
- if ((*p[0] - 48) > maxdccval[i]) {
- PARSE_ERROR1;
- }
- rp[i] = *p[0] - 48;
- p[0]++;
- if (*p[0] == ',')
- p[0]++;
- } else
+ } else {
+ for (i = 0; (((*p[0] >= '0') && (*p[0] <= '9')) || (*p[0] == ',')) && (i < 8); i++) {
+ if (*p[0] != ',') {
+ if ((*p[0] - 48) > maxdccval[i]) {
+ PARSE_ERROR1;
+ }
+ rp[i] = *p[0] - 48;
+ p[0]++;
+ if (*p[0] == ',')
p[0]++;
- }
+ } else
+ p[0]++;
+ }
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FDIS session parms=%d,%d,%d,%d,%d,%d,%d,%d\n",
- rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7]);
+ printk(KERN_DEBUG "isdn_tty: Fax FDIS session parms=%d,%d,%d,%d,%d,%d,%d,%d\n",
+ rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7]);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -808,18 +808,18 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
f->phase = ISDN_FAX_PHASE_C;
} else if (f->phase == ISDN_FAX_PHASE_D) {
switch (f->fet) {
- case 0: /* next page will be received */
- f->phase = ISDN_FAX_PHASE_C;
- isdn_tty_fax_modem_result(7, info); /* CONNECT */
- break;
- case 1: /* next doc will be received */
- f->phase = ISDN_FAX_PHASE_B;
- break;
- case 2: /* fax session is terminating */
- f->phase = ISDN_FAX_PHASE_E;
- break;
- default:
- PARSE_ERROR1;
+ case 0: /* next page will be received */
+ f->phase = ISDN_FAX_PHASE_C;
+ isdn_tty_fax_modem_result(7, info); /* CONNECT */
+ break;
+ case 1: /* next doc will be received */
+ f->phase = ISDN_FAX_PHASE_B;
+ break;
+ case 2: /* fax session is terminating */
+ f->phase = ISDN_FAX_PHASE_E;
+ break;
+ default:
+ PARSE_ERROR1;
}
}
} else {
@@ -830,7 +830,7 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
/* DT=df,vr,wd,ln - TX phase C data command (release DCE to proceed with negotiation) */
if (!strncmp(p[0], "DT", 2)) {
int i, val[] =
- {4, 0, 2, 3};
+ {4, 0, 2, 3};
char *rp = &f->resolution;
p[0] += 2;
@@ -872,29 +872,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "ECM", 3)) {
p[0] += 3;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->ecm);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->ecm);
+ sprintf(rs, "\r\n0,2");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0,2");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par != 0) && (par != 2))
- PARSE_ERROR1;
- f->ecm = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par != 0) && (par != 2))
+ PARSE_ERROR1;
+ f->ecm = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FECM=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FECM=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -938,36 +938,36 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
int i, r;
p[0] += 3;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n\"%s\"", f->id);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n\"%s\"", f->id);
+ sprintf(rs, "\r\n\"STRING\"");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
+ } else {
+ if (*p[0] == '"')
p[0]++;
- sprintf(rs, "\r\n\"STRING\"");
- isdn_tty_at_cout(rs, info);
- } else {
- if (*p[0] == '"')
- p[0]++;
- for (i = 0; (*p[0]) && i < (FAXIDLEN - 1) && (*p[0] != '"'); i++) {
- f->id[i] = *p[0]++;
- }
- if (*p[0] == '"')
- p[0]++;
- for (r = i; r < FAXIDLEN; r++) {
- f->id[r] = 32;
- }
- f->id[FAXIDLEN - 1] = 0;
+ for (i = 0; (*p[0]) && i < (FAXIDLEN - 1) && (*p[0] != '"'); i++) {
+ f->id[i] = *p[0]++;
+ }
+ if (*p[0] == '"')
+ p[0]++;
+ for (r = i; r < FAXIDLEN; r++) {
+ f->id[r] = 32;
+ }
+ f->id[FAXIDLEN - 1] = 0;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax local ID \"%s\"\n", f->id);
+ printk(KERN_DEBUG "isdn_tty: Fax local ID \"%s\"\n", f->id);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -994,29 +994,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "MINSP", 5)) {
p[0] += 5;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->minsp);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->minsp);
+ sprintf(rs, "\r\n0-5");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0-5");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 5))
- PARSE_ERROR1;
- f->minsp = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 5))
+ PARSE_ERROR1;
+ f->minsp = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FMINSP=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FMINSP=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -1024,29 +1024,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "PHCTO", 5)) {
p[0] += 5;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->phcto);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->phcto);
+ sprintf(rs, "\r\n0-255");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0-255");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 255))
- PARSE_ERROR1;
- f->phcto = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 255))
+ PARSE_ERROR1;
+ f->phcto = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FPHCTO=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FPHCTO=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -1055,29 +1055,29 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
if (!strncmp(p[0], "REL", 3)) {
p[0] += 3;
switch (*p[0]) {
- case '?':
+ case '?':
+ p[0]++;
+ sprintf(rs, "\r\n%d", f->rel);
+ isdn_tty_at_cout(rs, info);
+ break;
+ case '=':
+ p[0]++;
+ if (*p[0] == '?') {
p[0]++;
- sprintf(rs, "\r\n%d", f->rel);
+ sprintf(rs, "\r\n0,1");
isdn_tty_at_cout(rs, info);
- break;
- case '=':
- p[0]++;
- if (*p[0] == '?') {
- p[0]++;
- sprintf(rs, "\r\n0,1");
- isdn_tty_at_cout(rs, info);
- } else {
- par = isdn_getnum(p);
- if ((par < 0) || (par > 1))
- PARSE_ERROR1;
- f->rel = par;
+ } else {
+ par = isdn_getnum(p);
+ if ((par < 0) || (par > 1))
+ PARSE_ERROR1;
+ f->rel = par;
#ifdef ISDN_TTY_FAX_STAT_DEBUG
- printk(KERN_DEBUG "isdn_tty: Fax FREL=%d\n", par);
+ printk(KERN_DEBUG "isdn_tty: Fax FREL=%d\n", par);
#endif
- }
- break;
- default:
- PARSE_ERROR1;
+ }
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -1100,11 +1100,11 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
printk(KERN_DEBUG "isdn_tty: Fax FTBC=%c\n", *p[0]);
#endif
switch (*p[0]) {
- case '0':
- p[0]++;
- break;
- default:
- PARSE_ERROR1;
+ case '0':
+ p[0]++;
+ break;
+ default:
+ PARSE_ERROR1;
}
return 0;
}
@@ -1113,7 +1113,7 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
}
int
-isdn_tty_cmd_PLUSF_FAX(char **p, modem_info * info)
+isdn_tty_cmd_PLUSF_FAX(char **p, modem_info *info)
{
if (TTY_IS_FCLASS2(info))
return (isdn_tty_cmd_FCLASS2(p, info));
diff --git a/drivers/isdn/i4l/isdn_ttyfax.h b/drivers/isdn/i4l/isdn_ttyfax.h
index 757a89010020..ccda4fcf8f7b 100644
--- a/drivers/isdn/i4l/isdn_ttyfax.h
+++ b/drivers/isdn/i4l/isdn_ttyfax.h
@@ -15,4 +15,3 @@
#define XON 0x11
#define XOFF 0x13
#define DC2 0x12
-
diff --git a/drivers/isdn/i4l/isdn_v110.c b/drivers/isdn/i4l/isdn_v110.c
index c5d02b6aafab..52827a80c51f 100644
--- a/drivers/isdn/i4l/isdn_v110.c
+++ b/drivers/isdn/i4l/isdn_v110.c
@@ -26,8 +26,8 @@ char *isdn_v110_revision = "$Revision: 1.1.2.2 $";
#define V110_19200 15
#define V110_9600 3
-/*
- * The following data are precoded matrices, online and offline matrix
+/*
+ * The following data are precoded matrices, online and offline matrix
* for 9600, 19200 und 38400, respectively
*/
static unsigned char V110_OnMatrix_9600[] =
@@ -56,7 +56,7 @@ static unsigned char V110_OnMatrix_38400[] =
static unsigned char V110_OffMatrix_38400[] =
{0x00, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff};
-/*
+/*
* FlipBits reorders sequences of keylen bits in one byte.
* E.g. source order 7654321 will be converted to 45670123 when keylen = 4,
* and to 67452301 when keylen = 2. This is necessary because ordering on
@@ -103,18 +103,18 @@ isdn_v110_open(unsigned char key, int hdrlen, int maxsize)
v->decodelen = 0;
switch (key) {
- case V110_38400:
- v->OnlineFrame = V110_OnMatrix_38400;
- v->OfflineFrame = V110_OffMatrix_38400;
- break;
- case V110_19200:
- v->OnlineFrame = V110_OnMatrix_19200;
- v->OfflineFrame = V110_OffMatrix_19200;
- break;
- default:
- v->OnlineFrame = V110_OnMatrix_9600;
- v->OfflineFrame = V110_OffMatrix_9600;
- break;
+ case V110_38400:
+ v->OnlineFrame = V110_OnMatrix_38400;
+ v->OfflineFrame = V110_OffMatrix_38400;
+ break;
+ case V110_19200:
+ v->OnlineFrame = V110_OnMatrix_19200;
+ v->OfflineFrame = V110_OffMatrix_19200;
+ break;
+ default:
+ v->OnlineFrame = V110_OnMatrix_9600;
+ v->OfflineFrame = V110_OffMatrix_9600;
+ break;
}
v->framelen = v->nbytes * 10;
v->SyncInit = 5;
@@ -132,7 +132,7 @@ isdn_v110_open(unsigned char key, int hdrlen, int maxsize)
/* isdn_v110_close frees private V.110 data structures */
void
-isdn_v110_close(isdn_v110_stream * v)
+isdn_v110_close(isdn_v110_stream *v)
{
if (v == NULL)
return;
@@ -144,11 +144,11 @@ isdn_v110_close(isdn_v110_stream * v)
}
-/*
- * ValidHeaderBytes return the number of valid bytes in v->decodebuf
+/*
+ * ValidHeaderBytes return the number of valid bytes in v->decodebuf
*/
static int
-ValidHeaderBytes(isdn_v110_stream * v)
+ValidHeaderBytes(isdn_v110_stream *v)
{
int i;
for (i = 0; (i < v->decodelen) && (i < v->nbytes); i++)
@@ -157,11 +157,11 @@ ValidHeaderBytes(isdn_v110_stream * v)
return i;
}
-/*
- * SyncHeader moves the decodebuf ptr to the next valid header
+/*
+ * SyncHeader moves the decodebuf ptr to the next valid header
*/
static void
-SyncHeader(isdn_v110_stream * v)
+SyncHeader(isdn_v110_stream *v)
{
unsigned char *rbuf = v->decodebuf;
int len = v->decodelen;
@@ -185,9 +185,9 @@ SyncHeader(isdn_v110_stream * v)
only complete matices must be given.
From these, netto data is extracted and returned in buf. The return-value
is the bytecount of the decoded data.
- */
+*/
static int
-DecodeMatrix(isdn_v110_stream * v, unsigned char *m, int len, unsigned char *buf)
+DecodeMatrix(isdn_v110_stream *v, unsigned char *m, int len, unsigned char *buf)
{
int line = 0;
int buflen = 0;
@@ -203,7 +203,7 @@ DecodeMatrix(isdn_v110_stream * v, unsigned char *m, int len, unsigned char *buf
printk(KERN_DEBUG "isdn_v110: DecodeMatrix, V110 Bad Header\n");
/* returning now is not the right thing, though :-( */
#endif
- }
+ }
line++; /* next line of matrix */
continue;
} else if ((line % 10) == 5) { /* in line 5 there's only e-bits ! */
@@ -217,7 +217,7 @@ DecodeMatrix(isdn_v110_stream * v, unsigned char *m, int len, unsigned char *buf
continue;
} else if (!introducer) { /* every byte starts with 10 (stopbit, startbit) */
introducer = (m[line] & mbit) ? 0 : 1; /* current bit of the matrix */
- next_byte:
+ next_byte:
if (mbit > 2) { /* was it the last bit in this line ? */
mbit >>= 1; /* no -> take next */
continue;
@@ -246,13 +246,13 @@ DecodeMatrix(isdn_v110_stream * v, unsigned char *m, int len, unsigned char *buf
return buflen; /* return number of bytes in the output buffer */
}
-/*
- * DecodeStream receives V.110 coded data from the input stream. It recovers the
+/*
+ * DecodeStream receives V.110 coded data from the input stream. It recovers the
* original frames.
* The input stream doesn't need to be framed
*/
struct sk_buff *
-isdn_v110_decode(isdn_v110_stream * v, struct sk_buff *skb)
+isdn_v110_decode(isdn_v110_stream *v, struct sk_buff *skb)
{
int i;
int j;
@@ -283,7 +283,7 @@ isdn_v110_decode(isdn_v110_stream * v, struct sk_buff *skb)
/* copy new data to decode-buffer */
memcpy(&(v->decodebuf[v->decodelen]), rbuf, len);
v->decodelen += len;
- ReSync:
+ReSync:
if (v->decodelen < v->nbytes) { /* got a new header ? */
dev_kfree_skb(skb);
return NULL; /* no, try later */
@@ -320,7 +320,7 @@ isdn_v110_decode(isdn_v110_stream * v, struct sk_buff *skb)
/* EncodeMatrix takes input data in buf, len is the bytecount.
Data is encoded into v110 frames in m. Return value is the number of
matrix-lines generated.
- */
+*/
static int
EncodeMatrix(unsigned char *buf, int len, unsigned char *m, int mlen)
{
@@ -333,14 +333,14 @@ EncodeMatrix(unsigned char *buf, int len, unsigned char *m, int mlen)
while ((i < len) && (line < mlen)) { /* while we still have input data */
switch (line % 10) { /* in which line of the matrix are we? */
- case 0:
- m[line++] = 0x00; /* line 0 is always 0 */
- mbit = 128; /* go on with the 7th bit */
- break;
- case 5:
- m[line++] = 0xbf; /* line 5 is always 10111111 */
- mbit = 128; /* go on with the 7th bit */
- break;
+ case 0:
+ m[line++] = 0x00; /* line 0 is always 0 */
+ mbit = 128; /* go on with the 7th bit */
+ break;
+ case 5:
+ m[line++] = 0xbf; /* line 5 is always 10111111 */
+ mbit = 128; /* go on with the 7th bit */
+ break;
}
if (line >= mlen) {
printk(KERN_WARNING "isdn_v110 (EncodeMatrix): buffer full!\n");
@@ -348,16 +348,16 @@ EncodeMatrix(unsigned char *buf, int len, unsigned char *m, int mlen)
}
next_bit:
switch (mbit) { /* leftmost or rightmost bit ? */
- case 1:
- line++; /* rightmost -> go to next line */
- if (line >= mlen) {
- printk(KERN_WARNING "isdn_v110 (EncodeMatrix): buffer full!\n");
- return line;
- }
- case 128:
- m[line] = 128; /* leftmost -> set byte to 1000000 */
- mbit = 64; /* current bit in the matrix line */
- continue;
+ case 1:
+ line++; /* rightmost -> go to next line */
+ if (line >= mlen) {
+ printk(KERN_WARNING "isdn_v110 (EncodeMatrix): buffer full!\n");
+ return line;
+ }
+ case 128:
+ m[line] = 128; /* leftmost -> set byte to 1000000 */
+ mbit = 64; /* current bit in the matrix line */
+ continue;
}
if (introducer) { /* set 110 sequence ? */
introducer--; /* set on digit less */
@@ -384,24 +384,24 @@ EncodeMatrix(unsigned char *buf, int len, unsigned char *m, int mlen)
/* if necessary, generate remaining lines of the matrix... */
if ((line) && ((line + 10) < mlen))
switch (++line % 10) {
- case 1:
- m[line++] = 0xfe;
- case 2:
- m[line++] = 0xfe;
- case 3:
- m[line++] = 0xfe;
- case 4:
- m[line++] = 0xfe;
- case 5:
- m[line++] = 0xbf;
- case 6:
- m[line++] = 0xfe;
- case 7:
- m[line++] = 0xfe;
- case 8:
- m[line++] = 0xfe;
- case 9:
- m[line++] = 0xfe;
+ case 1:
+ m[line++] = 0xfe;
+ case 2:
+ m[line++] = 0xfe;
+ case 3:
+ m[line++] = 0xfe;
+ case 4:
+ m[line++] = 0xfe;
+ case 5:
+ m[line++] = 0xbf;
+ case 6:
+ m[line++] = 0xfe;
+ case 7:
+ m[line++] = 0xfe;
+ case 8:
+ m[line++] = 0xfe;
+ case 9:
+ m[line++] = 0xfe;
}
return line; /* that's how many lines we have */
}
@@ -447,7 +447,7 @@ isdn_v110_idle(isdn_v110_stream *v)
}
struct sk_buff *
-isdn_v110_encode(isdn_v110_stream * v, struct sk_buff *skb)
+isdn_v110_encode(isdn_v110_stream *v, struct sk_buff *skb)
{
int i;
int j;
@@ -524,93 +524,93 @@ isdn_v110_stat_callback(int idx, isdn_ctrl *c)
if (idx < 0)
return 0;
switch (c->command) {
- case ISDN_STAT_BSENT:
- /* Keep the send-queue of the driver filled
- * with frames:
- * If number of outstanding frames < 3,
- * send down an Idle-Frame (or an Sync-Frame, if
- * v->SyncInit != 0).
- */
- if (!(v = dev->v110[idx]))
- return 0;
- atomic_inc(&dev->v110use[idx]);
- for (i=0; i * v->framelen < c->parm.length; i++) {
- if (v->skbidle > 0) {
- v->skbidle--;
- ret = 1;
+ case ISDN_STAT_BSENT:
+ /* Keep the send-queue of the driver filled
+ * with frames:
+ * If number of outstanding frames < 3,
+ * send down an Idle-Frame (or an Sync-Frame, if
+ * v->SyncInit != 0).
+ */
+ if (!(v = dev->v110[idx]))
+ return 0;
+ atomic_inc(&dev->v110use[idx]);
+ for (i = 0; i * v->framelen < c->parm.length; i++) {
+ if (v->skbidle > 0) {
+ v->skbidle--;
+ ret = 1;
+ } else {
+ if (v->skbuser > 0)
+ v->skbuser--;
+ ret = 0;
+ }
+ }
+ for (i = v->skbuser + v->skbidle; i < 2; i++) {
+ struct sk_buff *skb;
+ if (v->SyncInit > 0)
+ skb = isdn_v110_sync(v);
+ else
+ skb = isdn_v110_idle(v);
+ if (skb) {
+ if (dev->drv[c->driver]->interface->writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
+ dev_kfree_skb(skb);
+ break;
} else {
- if (v->skbuser > 0)
- v->skbuser--;
- ret = 0;
+ if (v->SyncInit)
+ v->SyncInit--;
+ v->skbidle++;
}
+ } else
+ break;
+ }
+ atomic_dec(&dev->v110use[idx]);
+ return ret;
+ case ISDN_STAT_DHUP:
+ case ISDN_STAT_BHUP:
+ while (1) {
+ atomic_inc(&dev->v110use[idx]);
+ if (atomic_dec_and_test(&dev->v110use[idx])) {
+ isdn_v110_close(dev->v110[idx]);
+ dev->v110[idx] = NULL;
+ break;
+ }
+ mdelay(1);
+ }
+ break;
+ case ISDN_STAT_BCONN:
+ if (dev->v110emu[idx] && (dev->v110[idx] == NULL)) {
+ int hdrlen = dev->drv[c->driver]->interface->hl_hdrlen;
+ int maxsize = dev->drv[c->driver]->interface->maxbufsize;
+ atomic_inc(&dev->v110use[idx]);
+ switch (dev->v110emu[idx]) {
+ case ISDN_PROTO_L2_V11096:
+ dev->v110[idx] = isdn_v110_open(V110_9600, hdrlen, maxsize);
+ break;
+ case ISDN_PROTO_L2_V11019:
+ dev->v110[idx] = isdn_v110_open(V110_19200, hdrlen, maxsize);
+ break;
+ case ISDN_PROTO_L2_V11038:
+ dev->v110[idx] = isdn_v110_open(V110_38400, hdrlen, maxsize);
+ break;
+ default:;
}
- for (i = v->skbuser + v->skbidle; i < 2; i++) {
- struct sk_buff *skb;
- if (v->SyncInit > 0)
- skb = isdn_v110_sync(v);
- else
- skb = isdn_v110_idle(v);
- if (skb) {
+ if ((v = dev->v110[idx])) {
+ 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) {
dev_kfree_skb(skb);
+ /* Unable to send, try later */
break;
- } else {
- if (v->SyncInit)
- v->SyncInit--;
- v->skbidle++;
}
- } else
- break;
- }
- atomic_dec(&dev->v110use[idx]);
- return ret;
- case ISDN_STAT_DHUP:
- case ISDN_STAT_BHUP:
- while (1) {
- atomic_inc(&dev->v110use[idx]);
- if (atomic_dec_and_test(&dev->v110use[idx])) {
- isdn_v110_close(dev->v110[idx]);
- dev->v110[idx] = NULL;
- break;
+ v->SyncInit--;
+ v->skbidle++;
}
- mdelay(1);
- }
- break;
- case ISDN_STAT_BCONN:
- if (dev->v110emu[idx] && (dev->v110[idx] == NULL)) {
- int hdrlen = dev->drv[c->driver]->interface->hl_hdrlen;
- int maxsize = dev->drv[c->driver]->interface->maxbufsize;
- atomic_inc(&dev->v110use[idx]);
- switch (dev->v110emu[idx]) {
- case ISDN_PROTO_L2_V11096:
- dev->v110[idx] = isdn_v110_open(V110_9600, hdrlen, maxsize);
- break;
- case ISDN_PROTO_L2_V11019:
- dev->v110[idx] = isdn_v110_open(V110_19200, hdrlen, maxsize);
- break;
- case ISDN_PROTO_L2_V11038:
- dev->v110[idx] = isdn_v110_open(V110_38400, hdrlen, maxsize);
- break;
- default:;
- }
- if ((v = dev->v110[idx])) {
- 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) {
- dev_kfree_skb(skb);
- /* Unable to send, try later */
- break;
- }
- v->SyncInit--;
- v->skbidle++;
- }
- } else
- printk(KERN_WARNING "isdn_v110: Couldn't open stream for chan %d\n", idx);
- atomic_dec(&dev->v110use[idx]);
- }
- break;
- default:
- return 0;
+ } else
+ printk(KERN_WARNING "isdn_v110: Couldn't open stream for chan %d\n", idx);
+ atomic_dec(&dev->v110use[idx]);
+ }
+ break;
+ default:
+ return 0;
}
return 0;
}
diff --git a/drivers/isdn/i4l/isdn_v110.h b/drivers/isdn/i4l/isdn_v110.h
index 08f274bbc438..de774ab598c9 100644
--- a/drivers/isdn/i4l/isdn_v110.h
+++ b/drivers/isdn/i4l/isdn_v110.h
@@ -12,18 +12,18 @@
#ifndef _isdn_v110_h_
#define _isdn_v110_h_
-/*
- * isdn_v110_encode will take raw data and encode it using V.110
+/*
+ * isdn_v110_encode will take raw data and encode it using V.110
*/
extern struct sk_buff *isdn_v110_encode(isdn_v110_stream *, struct sk_buff *);
-/*
+/*
* isdn_v110_decode receives V.110 coded data from the stream and rebuilds
* frames from them. The source stream doesn't need to be framed.
*/
extern struct sk_buff *isdn_v110_decode(isdn_v110_stream *, struct sk_buff *);
extern int isdn_v110_stat_callback(int, isdn_ctrl *);
-extern void isdn_v110_close(isdn_v110_stream * v);
+extern void isdn_v110_close(isdn_v110_stream *v);
#endif
diff --git a/drivers/isdn/i4l/isdn_x25iface.c b/drivers/isdn/i4l/isdn_x25iface.c
index fd10d7c785d4..e2d4e58230f5 100644
--- a/drivers/isdn/i4l/isdn_x25iface.c
+++ b/drivers/isdn/i4l/isdn_x25iface.c
@@ -26,7 +26,7 @@
#include "isdn_x25iface.h"
/* for debugging messages not to cause an oops when device pointer is NULL*/
-#define MY_DEVNAME(dev) ( (dev) ? (dev)->name : "DEVICE UNSPECIFIED" )
+#define MY_DEVNAME(dev) ((dev) ? (dev)->name : "DEVICE UNSPECIFIED")
typedef struct isdn_x25iface_proto_data {
@@ -34,22 +34,22 @@ typedef struct isdn_x25iface_proto_data {
enum wan_states state;
/* Private stuff, not to be accessed via proto_data. We provide the
other storage for the concap_proto instance here as well,
- enabling us to allocate both with just one kmalloc(): */
+ enabling us to allocate both with just one kmalloc(): */
struct concap_proto priv;
} ix25_pdata_t;
/* is now in header file (extern): struct concap_proto * isdn_x25iface_proto_new(void); */
-static void isdn_x25iface_proto_del( struct concap_proto * );
-static int isdn_x25iface_proto_close( struct concap_proto * );
-static int isdn_x25iface_proto_restart( struct concap_proto *,
- struct net_device *,
- struct concap_device_ops *);
-static int isdn_x25iface_xmit( struct concap_proto *, struct sk_buff * );
-static int isdn_x25iface_receive( struct concap_proto *, struct sk_buff * );
-static int isdn_x25iface_connect_ind( struct concap_proto * );
-static int isdn_x25iface_disconn_ind( struct concap_proto * );
+static void isdn_x25iface_proto_del(struct concap_proto *);
+static int isdn_x25iface_proto_close(struct concap_proto *);
+static int isdn_x25iface_proto_restart(struct concap_proto *,
+ struct net_device *,
+ struct concap_device_ops *);
+static int isdn_x25iface_xmit(struct concap_proto *, struct sk_buff *);
+static int isdn_x25iface_receive(struct concap_proto *, struct sk_buff *);
+static int isdn_x25iface_connect_ind(struct concap_proto *);
+static int isdn_x25iface_disconn_ind(struct concap_proto *);
static struct concap_proto_ops ix25_pops = {
@@ -64,65 +64,65 @@ static struct concap_proto_ops ix25_pops = {
};
/* error message helper function */
-static void illegal_state_warn( unsigned state, unsigned char firstbyte)
+static void illegal_state_warn(unsigned state, unsigned char firstbyte)
{
- printk( KERN_WARNING "isdn_x25iface: firstbyte %x illegal in"
- "current state %d\n",firstbyte, state );
+ printk(KERN_WARNING "isdn_x25iface: firstbyte %x illegal in"
+ "current state %d\n", firstbyte, state);
}
/* check protocol data field for consistency */
-static int pdata_is_bad( ix25_pdata_t * pda ){
+static int pdata_is_bad(ix25_pdata_t *pda) {
- if( pda && pda -> magic == ISDN_X25IFACE_MAGIC ) return 0;
- printk( KERN_WARNING
- "isdn_x25iface_xxx: illegal pointer to proto data\n" );
+ if (pda && pda->magic == ISDN_X25IFACE_MAGIC) return 0;
+ printk(KERN_WARNING
+ "isdn_x25iface_xxx: illegal pointer to proto data\n");
return 1;
}
/* create a new x25 interface protocol instance
*/
-struct concap_proto * isdn_x25iface_proto_new(void)
+struct concap_proto *isdn_x25iface_proto_new(void)
{
- ix25_pdata_t * tmp = kmalloc(sizeof(ix25_pdata_t),GFP_KERNEL);
+ ix25_pdata_t *tmp = kmalloc(sizeof(ix25_pdata_t), GFP_KERNEL);
IX25DEBUG("isdn_x25iface_proto_new\n");
- if( tmp ){
- tmp -> magic = ISDN_X25IFACE_MAGIC;
- tmp -> state = WAN_UNCONFIGURED;
+ if (tmp) {
+ tmp->magic = ISDN_X25IFACE_MAGIC;
+ tmp->state = WAN_UNCONFIGURED;
/* private data space used to hold the concap_proto data.
Only to be accessed via the returned pointer */
spin_lock_init(&tmp->priv.lock);
- tmp -> priv.dops = NULL;
- tmp -> priv.net_dev = NULL;
- tmp -> priv.pops = &ix25_pops;
- tmp -> priv.flags = 0;
- tmp -> priv.proto_data = tmp;
- return( &(tmp -> priv) );
+ tmp->priv.dops = NULL;
+ tmp->priv.net_dev = NULL;
+ tmp->priv.pops = &ix25_pops;
+ tmp->priv.flags = 0;
+ tmp->priv.proto_data = tmp;
+ return (&(tmp->priv));
}
return NULL;
};
-/* close the x25iface encapsulation protocol
+/* close the x25iface encapsulation protocol
*/
-static int isdn_x25iface_proto_close(struct concap_proto *cprot){
+static int isdn_x25iface_proto_close(struct concap_proto *cprot) {
ix25_pdata_t *tmp;
- int ret = 0;
+ int ret = 0;
ulong flags;
- if( ! cprot ){
- printk( KERN_ERR "isdn_x25iface_proto_close: "
- "invalid concap_proto pointer\n" );
+ if (!cprot) {
+ printk(KERN_ERR "isdn_x25iface_proto_close: "
+ "invalid concap_proto pointer\n");
return -1;
}
- IX25DEBUG( "isdn_x25iface_proto_close %s \n", MY_DEVNAME(cprot -> net_dev) );
+ IX25DEBUG("isdn_x25iface_proto_close %s \n", MY_DEVNAME(cprot->net_dev));
spin_lock_irqsave(&cprot->lock, flags);
- cprot -> dops = NULL;
- cprot -> net_dev = NULL;
- tmp = cprot -> proto_data;
- if( pdata_is_bad( tmp ) ){
+ cprot->dops = NULL;
+ cprot->net_dev = NULL;
+ tmp = cprot->proto_data;
+ if (pdata_is_bad(tmp)) {
ret = -1;
} else {
- tmp -> state = WAN_UNCONFIGURED;
+ tmp->state = WAN_UNCONFIGURED;
}
spin_unlock_irqrestore(&cprot->lock, flags);
return ret;
@@ -130,100 +130,100 @@ static int isdn_x25iface_proto_close(struct concap_proto *cprot){
/* Delete the x25iface encapsulation protocol instance
*/
-static void isdn_x25iface_proto_del(struct concap_proto *cprot){
+static void isdn_x25iface_proto_del(struct concap_proto *cprot) {
+
+ ix25_pdata_t *tmp;
- ix25_pdata_t * tmp;
-
- IX25DEBUG( "isdn_x25iface_proto_del \n" );
- if( ! cprot ){
- printk( KERN_ERR "isdn_x25iface_proto_del: "
- "concap_proto pointer is NULL\n" );
+ IX25DEBUG("isdn_x25iface_proto_del \n");
+ if (!cprot) {
+ printk(KERN_ERR "isdn_x25iface_proto_del: "
+ "concap_proto pointer is NULL\n");
return;
}
- tmp = cprot -> proto_data;
- if( tmp == NULL ){
- printk( KERN_ERR "isdn_x25iface_proto_del: inconsistent "
- "proto_data pointer (maybe already deleted?)\n");
+ tmp = cprot->proto_data;
+ if (tmp == NULL) {
+ printk(KERN_ERR "isdn_x25iface_proto_del: inconsistent "
+ "proto_data pointer (maybe already deleted?)\n");
return;
}
/* close if the protocol is still open */
- if( cprot -> dops ) isdn_x25iface_proto_close(cprot);
+ if (cprot->dops) isdn_x25iface_proto_close(cprot);
/* freeing the storage should be sufficient now. But some additional
settings might help to catch wild pointer bugs */
- tmp -> magic = 0;
- cprot -> proto_data = NULL;
+ tmp->magic = 0;
+ cprot->proto_data = NULL;
- kfree( tmp );
+ kfree(tmp);
return;
}
/* (re-)initialize the data structures for x25iface encapsulation
*/
static int isdn_x25iface_proto_restart(struct concap_proto *cprot,
- struct net_device *ndev,
- struct concap_device_ops *dops)
+ struct net_device *ndev,
+ struct concap_device_ops *dops)
{
- ix25_pdata_t * pda = cprot -> proto_data ;
+ ix25_pdata_t *pda = cprot->proto_data;
ulong flags;
- IX25DEBUG( "isdn_x25iface_proto_restart %s \n", MY_DEVNAME(ndev) );
+ IX25DEBUG("isdn_x25iface_proto_restart %s \n", MY_DEVNAME(ndev));
- if ( pdata_is_bad( pda ) ) return -1;
+ if (pdata_is_bad(pda)) return -1;
- if( !( dops && dops -> data_req && dops -> connect_req
- && dops -> disconn_req ) ){
- printk( KERN_WARNING "isdn_x25iface_restart: required dops"
- " missing\n" );
+ if (!(dops && dops->data_req && dops->connect_req
+ && dops->disconn_req)) {
+ printk(KERN_WARNING "isdn_x25iface_restart: required dops"
+ " missing\n");
isdn_x25iface_proto_close(cprot);
return -1;
}
spin_lock_irqsave(&cprot->lock, flags);
- cprot -> net_dev = ndev;
- cprot -> pops = &ix25_pops;
- cprot -> dops = dops;
- pda -> state = WAN_DISCONNECTED;
+ cprot->net_dev = ndev;
+ cprot->pops = &ix25_pops;
+ cprot->dops = dops;
+ pda->state = WAN_DISCONNECTED;
spin_unlock_irqrestore(&cprot->lock, flags);
return 0;
}
-/* deliver a dl_data frame received from i4l HL driver to the network layer
+/* deliver a dl_data frame received from i4l HL driver to the network layer
*/
static int isdn_x25iface_receive(struct concap_proto *cprot, struct sk_buff *skb)
{
- IX25DEBUG( "isdn_x25iface_receive %s \n", MY_DEVNAME(cprot->net_dev) );
- if ( ( (ix25_pdata_t*) (cprot->proto_data) )
- -> state == WAN_CONNECTED ){
- if( skb_push(skb, 1)){
+ IX25DEBUG("isdn_x25iface_receive %s \n", MY_DEVNAME(cprot->net_dev));
+ if (((ix25_pdata_t *)(cprot->proto_data))
+ ->state == WAN_CONNECTED) {
+ if (skb_push(skb, 1)) {
skb->data[0] = X25_IFACE_DATA;
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
return 0;
}
}
- printk(KERN_WARNING "isdn_x25iface_receive %s: not connected, skb dropped\n", MY_DEVNAME(cprot->net_dev) );
+ printk(KERN_WARNING "isdn_x25iface_receive %s: not connected, skb dropped\n", MY_DEVNAME(cprot->net_dev));
dev_kfree_skb(skb);
return -1;
}
-/* a connection set up is indicated by lower layer
+/* a connection set up is indicated by lower layer
*/
static int isdn_x25iface_connect_ind(struct concap_proto *cprot)
{
- struct sk_buff * skb;
- enum wan_states *state_p
- = &( ( (ix25_pdata_t*) (cprot->proto_data) ) -> state);
- IX25DEBUG( "isdn_x25iface_connect_ind %s \n"
- , MY_DEVNAME(cprot->net_dev) );
- if( *state_p == WAN_UNCONFIGURED ){
- printk(KERN_WARNING
+ struct sk_buff *skb;
+ enum wan_states *state_p
+ = &(((ix25_pdata_t *)(cprot->proto_data))->state);
+ IX25DEBUG("isdn_x25iface_connect_ind %s \n"
+ , MY_DEVNAME(cprot->net_dev));
+ if (*state_p == WAN_UNCONFIGURED) {
+ printk(KERN_WARNING
"isdn_x25iface_connect_ind while unconfigured %s\n"
- , MY_DEVNAME(cprot->net_dev) );
+ , MY_DEVNAME(cprot->net_dev));
return -1;
}
*state_p = WAN_CONNECTED;
skb = dev_alloc_skb(1);
- if( skb ){
+ if (skb) {
*(skb_put(skb, 1)) = X25_IFACE_CONNECT;
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
@@ -231,28 +231,28 @@ static int isdn_x25iface_connect_ind(struct concap_proto *cprot)
} else {
printk(KERN_WARNING "isdn_x25iface_connect_ind: "
" out of memory -- disconnecting\n");
- cprot -> dops -> disconn_req(cprot);
+ cprot->dops->disconn_req(cprot);
return -1;
}
}
-
-/* a disconnect is indicated by lower layer
+
+/* a disconnect is indicated by lower layer
*/
static int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
{
struct sk_buff *skb;
- enum wan_states *state_p
- = &( ( (ix25_pdata_t*) (cprot->proto_data) ) -> state);
- IX25DEBUG( "isdn_x25iface_disconn_ind %s \n", MY_DEVNAME(cprot -> net_dev) );
- if( *state_p == WAN_UNCONFIGURED ){
- printk(KERN_WARNING
+ enum wan_states *state_p
+ = &(((ix25_pdata_t *)(cprot->proto_data))->state);
+ IX25DEBUG("isdn_x25iface_disconn_ind %s \n", MY_DEVNAME(cprot->net_dev));
+ if (*state_p == WAN_UNCONFIGURED) {
+ printk(KERN_WARNING
"isdn_x25iface_disconn_ind while unconfigured\n");
return -1;
}
- if(! cprot -> net_dev) return -1;
+ if (!cprot->net_dev) return -1;
*state_p = WAN_DISCONNECTED;
skb = dev_alloc_skb(1);
- if( skb ){
+ if (skb) {
*(skb_put(skb, 1)) = X25_IFACE_DISCONNECT;
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
@@ -266,57 +266,57 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
/* process a frame handed over to us from linux network layer. First byte
semantics as defined in Documentation/networking/x25-iface.txt
- */
+*/
static int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb)
{
unsigned char firstbyte = skb->data[0];
- enum wan_states *state = &((ix25_pdata_t*)cprot->proto_data)->state;
+ enum wan_states *state = &((ix25_pdata_t *)cprot->proto_data)->state;
int ret = 0;
IX25DEBUG("isdn_x25iface_xmit: %s first=%x state=%d\n",
- MY_DEVNAME(cprot->net_dev), firstbyte, *state);
- switch ( firstbyte ){
+ MY_DEVNAME(cprot->net_dev), firstbyte, *state);
+ switch (firstbyte) {
case X25_IFACE_DATA:
- if( *state == WAN_CONNECTED ){
+ if (*state == WAN_CONNECTED) {
skb_pull(skb, 1);
- cprot -> net_dev -> trans_start = jiffies;
- ret = ( cprot -> dops -> data_req(cprot, skb) );
+ cprot->net_dev->trans_start = jiffies;
+ ret = (cprot->dops->data_req(cprot, skb));
/* prepare for future retransmissions */
- if( ret ) skb_push(skb,1);
+ if (ret) skb_push(skb, 1);
return ret;
}
- illegal_state_warn( *state, firstbyte );
+ illegal_state_warn(*state, firstbyte);
break;
case X25_IFACE_CONNECT:
- if( *state == WAN_DISCONNECTED ){
+ if (*state == WAN_DISCONNECTED) {
*state = WAN_CONNECTING;
- ret = cprot -> dops -> connect_req(cprot);
- if(ret){
+ ret = cprot->dops->connect_req(cprot);
+ if (ret) {
/* reset state and notify upper layer about
* immidiatly failed attempts */
isdn_x25iface_disconn_ind(cprot);
}
} else {
- illegal_state_warn( *state, firstbyte );
+ illegal_state_warn(*state, firstbyte);
}
break;
case X25_IFACE_DISCONNECT:
- switch ( *state ){
- case WAN_DISCONNECTED:
+ switch (*state) {
+ case WAN_DISCONNECTED:
/* Should not happen. However, give upper layer a
chance to recover from inconstistency but don't
trust the lower layer sending the disconn_confirm
when already disconnected */
printk(KERN_WARNING "isdn_x25iface_xmit: disconnect "
- " requested while disconnected\n" );
+ " requested while disconnected\n");
isdn_x25iface_disconn_ind(cprot);
break; /* prevent infinite loops */
case WAN_CONNECTING:
case WAN_CONNECTED:
*state = WAN_DISCONNECTED;
- cprot -> dops -> disconn_req(cprot);
+ cprot->dops->disconn_req(cprot);
break;
default:
- illegal_state_warn( *state, firstbyte );
+ illegal_state_warn(*state, firstbyte);
}
break;
case X25_IFACE_PARAMS:
diff --git a/drivers/isdn/i4l/isdn_x25iface.h b/drivers/isdn/i4l/isdn_x25iface.h
index 41a3d4977466..0b26e3b336e7 100644
--- a/drivers/isdn/i4l/isdn_x25iface.h
+++ b/drivers/isdn/i4l/isdn_x25iface.h
@@ -13,9 +13,9 @@
#define ISDN_X25IFACE_MAGIC 0x1e75a2b9
/* #define DEBUG_ISDN_X25 if you want isdn_x25 debugging messages */
#ifdef DEBUG_ISDN_X25
-# define IX25DEBUG(fmt,args...) printk(KERN_DEBUG fmt , ## args)
+# define IX25DEBUG(fmt, args...) printk(KERN_DEBUG fmt, ##args)
#else
-# define IX25DEBUG(fmt,args...)
+# define IX25DEBUG(fmt, args...)
#endif
#include <linux/skbuff.h>
@@ -23,17 +23,9 @@
#include <linux/isdn.h>
#include <linux/concap.h>
-extern struct concap_proto_ops * isdn_x25iface_concap_proto_ops_pt;
-extern struct concap_proto * isdn_x25iface_proto_new(void);
+extern struct concap_proto_ops *isdn_x25iface_concap_proto_ops_pt;
+extern struct concap_proto *isdn_x25iface_proto_new(void);
#endif
-
-
-
-
-
-
-
-
diff --git a/drivers/isdn/i4l/isdnhdlc.c b/drivers/isdn/i4l/isdnhdlc.c
index c989aa35dc2f..027d1c590679 100644
--- a/drivers/isdn/i4l/isdnhdlc.c
+++ b/drivers/isdn/i4l/isdnhdlc.c
@@ -88,7 +88,7 @@ check_frame(struct isdnhdlc_vars *hdlc)
{
int status;
- if (hdlc->dstpos < 2) /* too small - framing error */
+ if (hdlc->dstpos < 2) /* too small - framing error */
status = -HDLC_FRAMING_ERROR;
else if (hdlc->crc != 0xf0b8) /* crc error */
status = -HDLC_CRC_ERROR;
@@ -127,9 +127,9 @@ check_frame(struct isdnhdlc_vars *hdlc)
dsize - destination buffer size
returns - number of decoded bytes in the destination buffer and status
flag.
- */
+*/
int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen,
- int *count, u8 *dst, int dsize)
+ int *count, u8 *dst, int dsize)
{
int status = 0;
@@ -145,28 +145,28 @@ int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen,
0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff
};
-#define handle_fast_flag(h) \
- do {\
- if (h->cbin == fast_flag[h->bit_shift]) {\
- h->ffvalue = fast_flag_value[h->bit_shift];\
- h->state = HDLC_FAST_FLAG;\
- h->ffbit_shift = h->bit_shift;\
- h->bit_shift = 1;\
- } else {\
- h->state = HDLC_GET_DATA;\
- h->data_received = 0;\
- } \
+#define handle_fast_flag(h) \
+ do { \
+ if (h->cbin == fast_flag[h->bit_shift]) { \
+ h->ffvalue = fast_flag_value[h->bit_shift]; \
+ h->state = HDLC_FAST_FLAG; \
+ h->ffbit_shift = h->bit_shift; \
+ h->bit_shift = 1; \
+ } else { \
+ h->state = HDLC_GET_DATA; \
+ h->data_received = 0; \
+ } \
} while (0)
-#define handle_abort(h) \
- do {\
- h->shift_reg = fast_abort[h->ffbit_shift - 1];\
- h->hdlc_bits1 = h->ffbit_shift - 2;\
- if (h->hdlc_bits1 < 0)\
- h->hdlc_bits1 = 0;\
- h->data_bits = h->ffbit_shift - 1;\
- h->state = HDLC_GET_DATA;\
- h->data_received = 0;\
+#define handle_abort(h) \
+ do { \
+ h->shift_reg = fast_abort[h->ffbit_shift - 1]; \
+ h->hdlc_bits1 = h->ffbit_shift - 2; \
+ if (h->hdlc_bits1 < 0) \
+ h->hdlc_bits1 = 0; \
+ h->data_bits = h->ffbit_shift - 1; \
+ h->state = HDLC_GET_DATA; \
+ h->data_received = 0; \
} while (0)
*count = slen;
@@ -204,7 +204,7 @@ int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen,
if ((!hdlc->do_adapt56) &&
(++hdlc->hdlc_bits1 >= 8) &&
(hdlc->bit_shift == 1))
- hdlc->state = HDLC_FAST_IDLE;
+ hdlc->state = HDLC_FAST_IDLE;
}
hdlc->cbin <<= 1;
hdlc->bit_shift--;
@@ -295,7 +295,7 @@ int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen,
hdlc->data_bits = 0;
hdlc->data_received = 1;
hdlc->crc = crc_ccitt_byte(hdlc->crc,
- hdlc->shift_reg);
+ hdlc->shift_reg);
/* good byte received */
if (hdlc->dstpos < dsize)
@@ -352,7 +352,7 @@ EXPORT_SYMBOL(isdnhdlc_decode);
returns - number of encoded bytes in the destination buffer
*/
int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen,
- int *count, u8 *dst, int dsize)
+ int *count, u8 *dst, int dsize)
{
static const unsigned char xfast_flag_value[] = {
0x7e, 0x3f, 0x9f, 0xcf, 0xe7, 0xf3, 0xf9, 0xfc, 0x7e
@@ -478,7 +478,7 @@ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen,
}
if (hdlc->bit_shift == 8)
hdlc->crc = crc_ccitt_byte(hdlc->crc,
- hdlc->shift_reg);
+ hdlc->shift_reg);
if (hdlc->shift_reg & 0x01) {
hdlc->hdlc_bits1++;
hdlc->cbin++;