diff options
Diffstat (limited to 'drivers/isdn/mISDN')
28 files changed, 1453 insertions, 1478 deletions
diff --git a/drivers/isdn/mISDN/clock.c b/drivers/isdn/mISDN/clock.c index 7418f2d811d8..693fb7c9b59a 100644 --- a/drivers/isdn/mISDN/clock.c +++ b/drivers/isdn/mISDN/clock.c | |||
@@ -13,11 +13,11 @@ | |||
13 | * Quick API description: | 13 | * Quick API description: |
14 | * | 14 | * |
15 | * A clock source registers using mISDN_register_clock: | 15 | * A clock source registers using mISDN_register_clock: |
16 | * name = text string to name clock source | 16 | * name = text string to name clock source |
17 | * priority = value to priorize clock sources (0 = default) | 17 | * priority = value to priorize clock sources (0 = default) |
18 | * ctl = callback function to enable/disable clock source | 18 | * ctl = callback function to enable/disable clock source |
19 | * priv = private pointer of clock source | 19 | * priv = private pointer of clock source |
20 | * return = pointer to clock source structure; | 20 | * return = pointer to clock source structure; |
21 | * | 21 | * |
22 | * Note: Callback 'ctl' can be called before mISDN_register_clock returns! | 22 | * Note: Callback 'ctl' can be called before mISDN_register_clock returns! |
23 | * Also it can be called during mISDN_unregister_clock. | 23 | * Also it can be called during mISDN_unregister_clock. |
@@ -74,14 +74,14 @@ select_iclock(void) | |||
74 | /* last used clock source still exists but changes, disable */ | 74 | /* last used clock source still exists but changes, disable */ |
75 | if (*debug & DEBUG_CLOCK) | 75 | if (*debug & DEBUG_CLOCK) |
76 | printk(KERN_DEBUG "Old clock source '%s' disable.\n", | 76 | printk(KERN_DEBUG "Old clock source '%s' disable.\n", |
77 | lastclock->name); | 77 | lastclock->name); |
78 | lastclock->ctl(lastclock->priv, 0); | 78 | lastclock->ctl(lastclock->priv, 0); |
79 | } | 79 | } |
80 | if (bestclock && bestclock != iclock_current) { | 80 | if (bestclock && bestclock != iclock_current) { |
81 | /* new clock source selected, enable */ | 81 | /* new clock source selected, enable */ |
82 | if (*debug & DEBUG_CLOCK) | 82 | if (*debug & DEBUG_CLOCK) |
83 | printk(KERN_DEBUG "New clock source '%s' enable.\n", | 83 | printk(KERN_DEBUG "New clock source '%s' enable.\n", |
84 | bestclock->name); | 84 | bestclock->name); |
85 | bestclock->ctl(bestclock->priv, 1); | 85 | bestclock->ctl(bestclock->priv, 1); |
86 | } | 86 | } |
87 | if (bestclock != iclock_current) { | 87 | if (bestclock != iclock_current) { |
@@ -104,7 +104,7 @@ struct mISDNclock | |||
104 | printk(KERN_ERR "%s: No memory for clock entry.\n", __func__); | 104 | printk(KERN_ERR "%s: No memory for clock entry.\n", __func__); |
105 | return NULL; | 105 | return NULL; |
106 | } | 106 | } |
107 | strncpy(iclock->name, name, sizeof(iclock->name)-1); | 107 | strncpy(iclock->name, name, sizeof(iclock->name) - 1); |
108 | iclock->pri = pri; | 108 | iclock->pri = pri; |
109 | iclock->priv = priv; | 109 | iclock->priv = priv; |
110 | iclock->ctl = ctl; | 110 | iclock->ctl = ctl; |
@@ -123,13 +123,13 @@ mISDN_unregister_clock(struct mISDNclock *iclock) | |||
123 | 123 | ||
124 | if (*debug & (DEBUG_CORE | DEBUG_CLOCK)) | 124 | if (*debug & (DEBUG_CORE | DEBUG_CLOCK)) |
125 | printk(KERN_DEBUG "%s: %s %d\n", __func__, iclock->name, | 125 | printk(KERN_DEBUG "%s: %s %d\n", __func__, iclock->name, |
126 | iclock->pri); | 126 | iclock->pri); |
127 | write_lock_irqsave(&iclock_lock, flags); | 127 | write_lock_irqsave(&iclock_lock, flags); |
128 | if (iclock_current == iclock) { | 128 | if (iclock_current == iclock) { |
129 | if (*debug & DEBUG_CLOCK) | 129 | if (*debug & DEBUG_CLOCK) |
130 | printk(KERN_DEBUG | 130 | printk(KERN_DEBUG |
131 | "Current clock source '%s' unregisters.\n", | 131 | "Current clock source '%s' unregisters.\n", |
132 | iclock->name); | 132 | iclock->name); |
133 | iclock->ctl(iclock->priv, 0); | 133 | iclock->ctl(iclock->priv, 0); |
134 | } | 134 | } |
135 | list_del(&iclock->list); | 135 | list_del(&iclock->list); |
@@ -149,9 +149,9 @@ mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv) | |||
149 | write_lock_irqsave(&iclock_lock, flags); | 149 | write_lock_irqsave(&iclock_lock, flags); |
150 | if (iclock_current != iclock) { | 150 | if (iclock_current != iclock) { |
151 | printk(KERN_ERR "%s: '%s' sends us clock updates, but we do " | 151 | printk(KERN_ERR "%s: '%s' sends us clock updates, but we do " |
152 | "listen to '%s'. This is a bug!\n", __func__, | 152 | "listen to '%s'. This is a bug!\n", __func__, |
153 | iclock->name, | 153 | iclock->name, |
154 | iclock_current ? iclock_current->name : "nothing"); | 154 | iclock_current ? iclock_current->name : "nothing"); |
155 | iclock->ctl(iclock->priv, 0); | 155 | iclock->ctl(iclock->priv, 0); |
156 | write_unlock_irqrestore(&iclock_lock, flags); | 156 | write_unlock_irqrestore(&iclock_lock, flags); |
157 | return; | 157 | return; |
@@ -185,7 +185,7 @@ mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv) | |||
185 | iclock_tv_valid = 1; | 185 | iclock_tv_valid = 1; |
186 | if (*debug & DEBUG_CLOCK) | 186 | if (*debug & DEBUG_CLOCK) |
187 | printk("Received first clock from source '%s'.\n", | 187 | printk("Received first clock from source '%s'.\n", |
188 | iclock_current ? iclock_current->name : "nothing"); | 188 | iclock_current ? iclock_current->name : "nothing"); |
189 | } | 189 | } |
190 | write_unlock_irqrestore(&iclock_lock, flags); | 190 | write_unlock_irqrestore(&iclock_lock, flags); |
191 | } | 191 | } |
@@ -215,4 +215,3 @@ mISDN_clock_get(void) | |||
215 | return count; | 215 | return count; |
216 | } | 216 | } |
217 | EXPORT_SYMBOL(mISDN_clock_get); | 217 | EXPORT_SYMBOL(mISDN_clock_get); |
218 | |||
diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c index afeebb00fe0b..a24530f05db0 100644 --- a/drivers/isdn/mISDN/core.c +++ b/drivers/isdn/mISDN/core.c | |||
@@ -38,7 +38,7 @@ static void mISDN_dev_release(struct device *dev) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | static ssize_t _show_id(struct device *dev, | 40 | static ssize_t _show_id(struct device *dev, |
41 | struct device_attribute *attr, char *buf) | 41 | struct device_attribute *attr, char *buf) |
42 | { | 42 | { |
43 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 43 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
44 | 44 | ||
@@ -48,7 +48,7 @@ static ssize_t _show_id(struct device *dev, | |||
48 | } | 48 | } |
49 | 49 | ||
50 | static ssize_t _show_nrbchan(struct device *dev, | 50 | static ssize_t _show_nrbchan(struct device *dev, |
51 | struct device_attribute *attr, char *buf) | 51 | struct device_attribute *attr, char *buf) |
52 | { | 52 | { |
53 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 53 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
54 | 54 | ||
@@ -58,7 +58,7 @@ static ssize_t _show_nrbchan(struct device *dev, | |||
58 | } | 58 | } |
59 | 59 | ||
60 | static ssize_t _show_d_protocols(struct device *dev, | 60 | static ssize_t _show_d_protocols(struct device *dev, |
61 | struct device_attribute *attr, char *buf) | 61 | struct device_attribute *attr, char *buf) |
62 | { | 62 | { |
63 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 63 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
64 | 64 | ||
@@ -68,7 +68,7 @@ static ssize_t _show_d_protocols(struct device *dev, | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static ssize_t _show_b_protocols(struct device *dev, | 70 | static ssize_t _show_b_protocols(struct device *dev, |
71 | struct device_attribute *attr, char *buf) | 71 | struct device_attribute *attr, char *buf) |
72 | { | 72 | { |
73 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 73 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
74 | 74 | ||
@@ -78,7 +78,7 @@ static ssize_t _show_b_protocols(struct device *dev, | |||
78 | } | 78 | } |
79 | 79 | ||
80 | static ssize_t _show_protocol(struct device *dev, | 80 | static ssize_t _show_protocol(struct device *dev, |
81 | struct device_attribute *attr, char *buf) | 81 | struct device_attribute *attr, char *buf) |
82 | { | 82 | { |
83 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 83 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
84 | 84 | ||
@@ -88,7 +88,7 @@ static ssize_t _show_protocol(struct device *dev, | |||
88 | } | 88 | } |
89 | 89 | ||
90 | static ssize_t _show_name(struct device *dev, | 90 | static ssize_t _show_name(struct device *dev, |
91 | struct device_attribute *attr, char *buf) | 91 | struct device_attribute *attr, char *buf) |
92 | { | 92 | { |
93 | strcpy(buf, dev_name(dev)); | 93 | strcpy(buf, dev_name(dev)); |
94 | return strlen(buf); | 94 | return strlen(buf); |
@@ -96,7 +96,7 @@ static ssize_t _show_name(struct device *dev, | |||
96 | 96 | ||
97 | #if 0 /* hangs */ | 97 | #if 0 /* hangs */ |
98 | static ssize_t _set_name(struct device *dev, struct device_attribute *attr, | 98 | static ssize_t _set_name(struct device *dev, struct device_attribute *attr, |
99 | const char *buf, size_t count) | 99 | const char *buf, size_t count) |
100 | { | 100 | { |
101 | int err = 0; | 101 | int err = 0; |
102 | char *out = kmalloc(count + 1, GFP_KERNEL); | 102 | char *out = kmalloc(count + 1, GFP_KERNEL); |
@@ -136,7 +136,7 @@ static struct device_attribute mISDN_dev_attrs[] = { | |||
136 | __ATTR(channelmap, S_IRUGO, _show_channelmap, NULL), | 136 | __ATTR(channelmap, S_IRUGO, _show_channelmap, NULL), |
137 | __ATTR(nrbchan, S_IRUGO, _show_nrbchan, NULL), | 137 | __ATTR(nrbchan, S_IRUGO, _show_nrbchan, NULL), |
138 | __ATTR(name, S_IRUGO, _show_name, NULL), | 138 | __ATTR(name, S_IRUGO, _show_name, NULL), |
139 | /* __ATTR(name, S_IRUGO|S_IWUSR, _show_name, _set_name), */ | 139 | /* __ATTR(name, S_IRUGO | S_IWUSR, _show_name, _set_name), */ |
140 | {} | 140 | {} |
141 | }; | 141 | }; |
142 | 142 | ||
@@ -187,7 +187,7 @@ struct mISDNdevice | |||
187 | *get_mdevice(u_int id) | 187 | *get_mdevice(u_int id) |
188 | { | 188 | { |
189 | return dev_to_mISDN(class_find_device(&mISDN_class, NULL, &id, | 189 | return dev_to_mISDN(class_find_device(&mISDN_class, NULL, &id, |
190 | _get_mdevice)); | 190 | _get_mdevice)); |
191 | } | 191 | } |
192 | 192 | ||
193 | static int | 193 | static int |
@@ -221,7 +221,7 @@ get_free_devid(void) | |||
221 | 221 | ||
222 | int | 222 | int |
223 | mISDN_register_device(struct mISDNdevice *dev, | 223 | mISDN_register_device(struct mISDNdevice *dev, |
224 | struct device *parent, char *name) | 224 | struct device *parent, char *name) |
225 | { | 225 | { |
226 | int err; | 226 | int err; |
227 | 227 | ||
@@ -237,7 +237,7 @@ mISDN_register_device(struct mISDNdevice *dev, | |||
237 | dev_set_name(&dev->dev, "mISDN%d", dev->id); | 237 | dev_set_name(&dev->dev, "mISDN%d", dev->id); |
238 | if (debug & DEBUG_CORE) | 238 | if (debug & DEBUG_CORE) |
239 | printk(KERN_DEBUG "mISDN_register %s %d\n", | 239 | printk(KERN_DEBUG "mISDN_register %s %d\n", |
240 | dev_name(&dev->dev), dev->id); | 240 | dev_name(&dev->dev), dev->id); |
241 | err = create_stack(dev); | 241 | err = create_stack(dev); |
242 | if (err) | 242 | if (err) |
243 | goto error1; | 243 | goto error1; |
@@ -265,7 +265,7 @@ void | |||
265 | mISDN_unregister_device(struct mISDNdevice *dev) { | 265 | mISDN_unregister_device(struct mISDNdevice *dev) { |
266 | if (debug & DEBUG_CORE) | 266 | if (debug & DEBUG_CORE) |
267 | printk(KERN_DEBUG "mISDN_unregister %s %d\n", | 267 | printk(KERN_DEBUG "mISDN_unregister %s %d\n", |
268 | dev_name(&dev->dev), dev->id); | 268 | dev_name(&dev->dev), dev->id); |
269 | /* sysfs_remove_link(&dev->dev.kobj, "device"); */ | 269 | /* sysfs_remove_link(&dev->dev.kobj, "device"); */ |
270 | device_del(&dev->dev); | 270 | device_del(&dev->dev); |
271 | dev_set_drvdata(&dev->dev, NULL); | 271 | dev_set_drvdata(&dev->dev, NULL); |
@@ -311,7 +311,7 @@ get_Bprotocol4id(u_int id) | |||
311 | 311 | ||
312 | if (id < ISDN_P_B_START || id > 63) { | 312 | if (id < ISDN_P_B_START || id > 63) { |
313 | printk(KERN_WARNING "%s id not in range %d\n", | 313 | printk(KERN_WARNING "%s id not in range %d\n", |
314 | __func__, id); | 314 | __func__, id); |
315 | return NULL; | 315 | return NULL; |
316 | } | 316 | } |
317 | m = 1 << (id & ISDN_P_B_MASK); | 317 | m = 1 << (id & ISDN_P_B_MASK); |
@@ -326,12 +326,12 @@ mISDN_register_Bprotocol(struct Bprotocol *bp) | |||
326 | 326 | ||
327 | if (debug & DEBUG_CORE) | 327 | if (debug & DEBUG_CORE) |
328 | printk(KERN_DEBUG "%s: %s/%x\n", __func__, | 328 | printk(KERN_DEBUG "%s: %s/%x\n", __func__, |
329 | bp->name, bp->Bprotocols); | 329 | bp->name, bp->Bprotocols); |
330 | old = get_Bprotocol4mask(bp->Bprotocols); | 330 | old = get_Bprotocol4mask(bp->Bprotocols); |
331 | if (old) { | 331 | if (old) { |
332 | printk(KERN_WARNING | 332 | printk(KERN_WARNING |
333 | "register duplicate protocol old %s/%x new %s/%x\n", | 333 | "register duplicate protocol old %s/%x new %s/%x\n", |
334 | old->name, old->Bprotocols, bp->name, bp->Bprotocols); | 334 | old->name, old->Bprotocols, bp->name, bp->Bprotocols); |
335 | return -EBUSY; | 335 | return -EBUSY; |
336 | } | 336 | } |
337 | write_lock_irqsave(&bp_lock, flags); | 337 | write_lock_irqsave(&bp_lock, flags); |
@@ -348,7 +348,7 @@ mISDN_unregister_Bprotocol(struct Bprotocol *bp) | |||
348 | 348 | ||
349 | if (debug & DEBUG_CORE) | 349 | if (debug & DEBUG_CORE) |
350 | printk(KERN_DEBUG "%s: %s/%x\n", __func__, bp->name, | 350 | printk(KERN_DEBUG "%s: %s/%x\n", __func__, bp->name, |
351 | bp->Bprotocols); | 351 | bp->Bprotocols); |
352 | write_lock_irqsave(&bp_lock, flags); | 352 | write_lock_irqsave(&bp_lock, flags); |
353 | list_del(&bp->list); | 353 | list_del(&bp->list); |
354 | write_unlock_irqrestore(&bp_lock, flags); | 354 | write_unlock_irqrestore(&bp_lock, flags); |
@@ -361,7 +361,7 @@ mISDNInit(void) | |||
361 | int err; | 361 | int err; |
362 | 362 | ||
363 | printk(KERN_INFO "Modular ISDN core version %d.%d.%d\n", | 363 | printk(KERN_INFO "Modular ISDN core version %d.%d.%d\n", |
364 | MISDN_MAJOR_VERSION, MISDN_MINOR_VERSION, MISDN_RELEASE); | 364 | MISDN_MAJOR_VERSION, MISDN_MINOR_VERSION, MISDN_RELEASE); |
365 | mISDN_init_clock(&debug); | 365 | mISDN_init_clock(&debug); |
366 | mISDN_initstack(&debug); | 366 | mISDN_initstack(&debug); |
367 | err = class_register(&mISDN_class); | 367 | err = class_register(&mISDN_class); |
@@ -406,4 +406,3 @@ static void mISDN_cleanup(void) | |||
406 | 406 | ||
407 | module_init(mISDNInit); | 407 | module_init(mISDNInit); |
408 | module_exit(mISDN_cleanup); | 408 | module_exit(mISDN_cleanup); |
409 | |||
diff --git a/drivers/isdn/mISDN/core.h b/drivers/isdn/mISDN/core.h index 7ac2f81a812b..52695bb81ee7 100644 --- a/drivers/isdn/mISDN/core.h +++ b/drivers/isdn/mISDN/core.h | |||
@@ -45,11 +45,11 @@ extern int get_mdevice_count(void); | |||
45 | #define MGR_OPT_NETWORK 25 | 45 | #define MGR_OPT_NETWORK 25 |
46 | 46 | ||
47 | extern int connect_Bstack(struct mISDNdevice *, struct mISDNchannel *, | 47 | extern int connect_Bstack(struct mISDNdevice *, struct mISDNchannel *, |
48 | u_int, struct sockaddr_mISDN *); | 48 | u_int, struct sockaddr_mISDN *); |
49 | extern int connect_layer1(struct mISDNdevice *, struct mISDNchannel *, | 49 | extern int connect_layer1(struct mISDNdevice *, struct mISDNchannel *, |
50 | u_int, struct sockaddr_mISDN *); | 50 | u_int, struct sockaddr_mISDN *); |
51 | extern int create_l2entity(struct mISDNdevice *, struct mISDNchannel *, | 51 | extern int create_l2entity(struct mISDNdevice *, struct mISDNchannel *, |
52 | u_int, struct sockaddr_mISDN *); | 52 | u_int, struct sockaddr_mISDN *); |
53 | 53 | ||
54 | extern int create_stack(struct mISDNdevice *); | 54 | extern int create_stack(struct mISDNdevice *); |
55 | extern int create_teimanager(struct mISDNdevice *); | 55 | extern int create_teimanager(struct mISDNdevice *); |
@@ -71,7 +71,7 @@ extern void mISDN_timer_cleanup(void); | |||
71 | 71 | ||
72 | extern int l1_init(u_int *); | 72 | extern int l1_init(u_int *); |
73 | extern void l1_cleanup(void); | 73 | extern void l1_cleanup(void); |
74 | extern int Isdnl2_Init(u_int *); | 74 | extern int Isdnl2_Init(u_int *); |
75 | extern void Isdnl2_cleanup(void); | 75 | extern void Isdnl2_cleanup(void); |
76 | 76 | ||
77 | extern void mISDN_init_clock(u_int *); | 77 | extern void mISDN_init_clock(u_int *); |
diff --git a/drivers/isdn/mISDN/dsp.h b/drivers/isdn/mISDN/dsp.h index 8549431430f0..afe4173ae007 100644 --- a/drivers/isdn/mISDN/dsp.h +++ b/drivers/isdn/mISDN/dsp.h | |||
@@ -24,8 +24,8 @@ | |||
24 | * bit 1 = enable hfc hardware acceleration for all channels | 24 | * bit 1 = enable hfc hardware acceleration for all channels |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #define DSP_OPT_ULAW (1<<0) | 27 | #define DSP_OPT_ULAW (1 << 0) |
28 | #define DSP_OPT_NOHARDWARE (1<<1) | 28 | #define DSP_OPT_NOHARDWARE (1 << 1) |
29 | 29 | ||
30 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
31 | #include <linux/workqueue.h> | 31 | #include <linux/workqueue.h> |
@@ -97,12 +97,12 @@ struct dsp_conf_member { | |||
97 | struct dsp_conf { | 97 | struct dsp_conf { |
98 | struct list_head list; | 98 | struct list_head list; |
99 | u32 id; | 99 | u32 id; |
100 | /* all cmx stacks with the same ID are | 100 | /* all cmx stacks with the same ID are |
101 | connected */ | 101 | connected */ |
102 | struct list_head mlist; | 102 | struct list_head mlist; |
103 | int software; /* conf is processed by software */ | 103 | int software; /* conf is processed by software */ |
104 | int hardware; /* conf is processed by hardware */ | 104 | int hardware; /* conf is processed by hardware */ |
105 | /* note: if both unset, has only one member */ | 105 | /* note: if both unset, has only one member */ |
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
@@ -122,7 +122,7 @@ struct dsp_dtmf { | |||
122 | int hardware; /* dtmf uses hardware decoding */ | 122 | int hardware; /* dtmf uses hardware decoding */ |
123 | int size; /* number of bytes in buffer */ | 123 | int size; /* number of bytes in buffer */ |
124 | signed short buffer[DSP_DTMF_NPOINTS]; | 124 | signed short buffer[DSP_DTMF_NPOINTS]; |
125 | /* buffers one full dtmf frame */ | 125 | /* buffers one full dtmf frame */ |
126 | u8 lastwhat, lastdigit; | 126 | u8 lastwhat, lastdigit; |
127 | int count; | 127 | int count; |
128 | u8 digits[16]; /* dtmf result */ | 128 | u8 digits[16]; /* dtmf result */ |
@@ -189,7 +189,7 @@ struct dsp { | |||
189 | u32 conf_id; | 189 | u32 conf_id; |
190 | struct dsp_conf *conf; | 190 | struct dsp_conf *conf; |
191 | struct dsp_conf_member | 191 | struct dsp_conf_member |
192 | *member; | 192 | *member; |
193 | 193 | ||
194 | /* buffer stuff */ | 194 | /* buffer stuff */ |
195 | int rx_W; /* current write pos for data without timestamp */ | 195 | int rx_W; /* current write pos for data without timestamp */ |
@@ -203,7 +203,7 @@ struct dsp { | |||
203 | u8 rx_buff[CMX_BUFF_SIZE]; | 203 | u8 rx_buff[CMX_BUFF_SIZE]; |
204 | int last_tx; /* if set, we transmitted last poll interval */ | 204 | int last_tx; /* if set, we transmitted last poll interval */ |
205 | int cmx_delay; /* initial delay of buffers, | 205 | int cmx_delay; /* initial delay of buffers, |
206 | or 0 for dynamic jitter buffer */ | 206 | or 0 for dynamic jitter buffer */ |
207 | int tx_dejitter; /* if set, dejitter tx buffer */ | 207 | int tx_dejitter; /* if set, dejitter tx buffer */ |
208 | int tx_data; /* enables tx-data of CMX to upper layer */ | 208 | int tx_data; /* enables tx-data of CMX to upper layer */ |
209 | 209 | ||
@@ -231,7 +231,7 @@ struct dsp { | |||
231 | int bf_sync; | 231 | int bf_sync; |
232 | 232 | ||
233 | struct dsp_pipeline | 233 | struct dsp_pipeline |
234 | pipeline; | 234 | pipeline; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | /* functions */ | 237 | /* functions */ |
@@ -253,7 +253,7 @@ extern int dsp_cmx_del_conf(struct dsp_conf *conf); | |||
253 | extern void dsp_dtmf_goertzel_init(struct dsp *dsp); | 253 | extern void dsp_dtmf_goertzel_init(struct dsp *dsp); |
254 | extern void dsp_dtmf_hardware(struct dsp *dsp); | 254 | extern void dsp_dtmf_hardware(struct dsp *dsp); |
255 | extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len, | 255 | extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len, |
256 | int fmt); | 256 | int fmt); |
257 | 257 | ||
258 | extern int dsp_tone(struct dsp *dsp, int tone); | 258 | extern int dsp_tone(struct dsp *dsp, int tone); |
259 | extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len); | 259 | extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len); |
@@ -270,7 +270,6 @@ extern int dsp_pipeline_init(struct dsp_pipeline *pipeline); | |||
270 | extern void dsp_pipeline_destroy(struct dsp_pipeline *pipeline); | 270 | extern void dsp_pipeline_destroy(struct dsp_pipeline *pipeline); |
271 | extern int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg); | 271 | extern int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg); |
272 | extern void dsp_pipeline_process_tx(struct dsp_pipeline *pipeline, u8 *data, | 272 | extern void dsp_pipeline_process_tx(struct dsp_pipeline *pipeline, u8 *data, |
273 | int len); | 273 | int len); |
274 | extern void dsp_pipeline_process_rx(struct dsp_pipeline *pipeline, u8 *data, | 274 | extern void dsp_pipeline_process_rx(struct dsp_pipeline *pipeline, u8 *data, |
275 | int len, unsigned int txlen); | 275 | int len, unsigned int txlen); |
276 | |||
diff --git a/drivers/isdn/mISDN/dsp_audio.c b/drivers/isdn/mISDN/dsp_audio.c index b8f18bd09e43..06022952a437 100644 --- a/drivers/isdn/mISDN/dsp_audio.c +++ b/drivers/isdn/mISDN/dsp_audio.c | |||
@@ -61,7 +61,7 @@ static inline unsigned char linear2alaw(short int linear) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | /* Convert the scaled magnitude to segment number. */ | 63 | /* Convert the scaled magnitude to segment number. */ |
64 | for (seg = 0; seg < 8; seg++) { | 64 | for (seg = 0; seg < 8; seg++) { |
65 | if (pcm_val <= seg_end[seg]) | 65 | if (pcm_val <= seg_end[seg]) |
66 | break; | 66 | break; |
67 | } | 67 | } |
@@ -263,7 +263,7 @@ dsp_audio_generate_mix_table(void) | |||
263 | sample = 32767; | 263 | sample = 32767; |
264 | if (sample < -32768) | 264 | if (sample < -32768) |
265 | sample = -32768; | 265 | sample = -32768; |
266 | dsp_audio_mix_law[(i<<8)|j] = | 266 | dsp_audio_mix_law[(i << 8) | j] = |
267 | dsp_audio_s16_to_law[sample & 0xffff]; | 267 | dsp_audio_s16_to_law[sample & 0xffff]; |
268 | j++; | 268 | j++; |
269 | } | 269 | } |
@@ -431,4 +431,3 @@ dsp_change_volume(struct sk_buff *skb, int volume) | |||
431 | i++; | 431 | i++; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | |||
diff --git a/drivers/isdn/mISDN/dsp_biquad.h b/drivers/isdn/mISDN/dsp_biquad.h index 038191bc45f5..c0c933a5d197 100644 --- a/drivers/isdn/mISDN/dsp_biquad.h +++ b/drivers/isdn/mISDN/dsp_biquad.h | |||
@@ -38,7 +38,7 @@ struct biquad2_state { | |||
38 | }; | 38 | }; |
39 | 39 | ||
40 | static inline void biquad2_init(struct biquad2_state *bq, | 40 | static inline void biquad2_init(struct biquad2_state *bq, |
41 | int32_t gain, int32_t a1, int32_t a2, int32_t b1, int32_t b2) | 41 | int32_t gain, int32_t a1, int32_t a2, int32_t b1, int32_t b2) |
42 | { | 42 | { |
43 | bq->gain = gain; | 43 | bq->gain = gain; |
44 | bq->a1 = a1; | 44 | bq->a1 = a1; |
@@ -55,8 +55,8 @@ static inline int16_t biquad2(struct biquad2_state *bq, int16_t sample) | |||
55 | int32_t y; | 55 | int32_t y; |
56 | int32_t z0; | 56 | int32_t z0; |
57 | 57 | ||
58 | z0 = sample*bq->gain + bq->z1*bq->a1 + bq->z2*bq->a2; | 58 | z0 = sample * bq->gain + bq->z1 * bq->a1 + bq->z2 * bq->a2; |
59 | y = z0 + bq->z1*bq->b1 + bq->z2*bq->b2; | 59 | y = z0 + bq->z1 * bq->b1 + bq->z2 * bq->b2; |
60 | 60 | ||
61 | bq->z2 = bq->z1; | 61 | bq->z2 = bq->z1; |
62 | bq->z1 = z0 >> 15; | 62 | bq->z1 = z0 >> 15; |
diff --git a/drivers/isdn/mISDN/dsp_blowfish.c b/drivers/isdn/mISDN/dsp_blowfish.c index 18e411e95bba..0aa572f3858d 100644 --- a/drivers/isdn/mISDN/dsp_blowfish.c +++ b/drivers/isdn/mISDN/dsp_blowfish.c | |||
@@ -354,8 +354,8 @@ static const u32 bf_sbox[256 * 4] = { | |||
354 | #define GET32_1(x) (((x) >> (16)) & (0xff)) | 354 | #define GET32_1(x) (((x) >> (16)) & (0xff)) |
355 | #define GET32_0(x) (((x) >> (24)) & (0xff)) | 355 | #define GET32_0(x) (((x) >> (24)) & (0xff)) |
356 | 356 | ||
357 | #define bf_F(x) (((S[GET32_0(x)] + S[256 + GET32_1(x)]) ^ \ | 357 | #define bf_F(x) (((S[GET32_0(x)] + S[256 + GET32_1(x)]) ^ \ |
358 | S[512 + GET32_2(x)]) + S[768 + GET32_3(x)]) | 358 | S[512 + GET32_2(x)]) + S[768 + GET32_3(x)]) |
359 | 359 | ||
360 | #define EROUND(a, b, n) do { b ^= P[n]; a ^= bf_F(b); } while (0) | 360 | #define EROUND(a, b, n) do { b ^= P[n]; a ^= bf_F(b); } while (0) |
361 | #define DROUND(a, b, n) do { a ^= bf_F(b); b ^= P[n]; } while (0) | 361 | #define DROUND(a, b, n) do { a ^= bf_F(b); b ^= P[n]; } while (0) |
@@ -388,17 +388,17 @@ dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len) | |||
388 | j = 0; | 388 | j = 0; |
389 | /* transcode 9 samples xlaw to 8 bytes */ | 389 | /* transcode 9 samples xlaw to 8 bytes */ |
390 | yl = dsp_audio_law2seven[bf_data_in[0]]; | 390 | yl = dsp_audio_law2seven[bf_data_in[0]]; |
391 | yl = (yl<<7) | dsp_audio_law2seven[bf_data_in[1]]; | 391 | yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[1]]; |
392 | yl = (yl<<7) | dsp_audio_law2seven[bf_data_in[2]]; | 392 | yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[2]]; |
393 | yl = (yl<<7) | dsp_audio_law2seven[bf_data_in[3]]; | 393 | yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[3]]; |
394 | nibble = dsp_audio_law2seven[bf_data_in[4]]; | 394 | nibble = dsp_audio_law2seven[bf_data_in[4]]; |
395 | yr = nibble; | 395 | yr = nibble; |
396 | yl = (yl<<4) | (nibble>>3); | 396 | yl = (yl << 4) | (nibble >> 3); |
397 | yr = (yr<<7) | dsp_audio_law2seven[bf_data_in[5]]; | 397 | yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[5]]; |
398 | yr = (yr<<7) | dsp_audio_law2seven[bf_data_in[6]]; | 398 | yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[6]]; |
399 | yr = (yr<<7) | dsp_audio_law2seven[bf_data_in[7]]; | 399 | yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[7]]; |
400 | yr = (yr<<7) | dsp_audio_law2seven[bf_data_in[8]]; | 400 | yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[8]]; |
401 | yr = (yr<<1) | (bf_data_in[0] & 1); | 401 | yr = (yr << 1) | (bf_data_in[0] & 1); |
402 | 402 | ||
403 | /* fill unused bit with random noise of audio input */ | 403 | /* fill unused bit with random noise of audio input */ |
404 | /* encrypt */ | 404 | /* encrypt */ |
@@ -423,24 +423,24 @@ dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len) | |||
423 | yr ^= P[17]; | 423 | yr ^= P[17]; |
424 | 424 | ||
425 | /* calculate 3-bit checksumme */ | 425 | /* calculate 3-bit checksumme */ |
426 | cs = yl ^ (yl>>3) ^ (yl>>6) ^ (yl>>9) ^ (yl>>12) ^ (yl>>15) | 426 | cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15) |
427 | ^ (yl>>18) ^ (yl>>21) ^ (yl>>24) ^ (yl>>27) ^ (yl>>30) | 427 | ^ (yl >> 18) ^ (yl >> 21) ^ (yl >> 24) ^ (yl >> 27) ^ (yl >> 30) |
428 | ^ (yr<<2) ^ (yr>>1) ^ (yr>>4) ^ (yr>>7) ^ (yr>>10) | 428 | ^ (yr << 2) ^ (yr >> 1) ^ (yr >> 4) ^ (yr >> 7) ^ (yr >> 10) |
429 | ^ (yr>>13) ^ (yr>>16) ^ (yr>>19) ^ (yr>>22) ^ (yr>>25) | 429 | ^ (yr >> 13) ^ (yr >> 16) ^ (yr >> 19) ^ (yr >> 22) ^ (yr >> 25) |
430 | ^ (yr>>28) ^ (yr>>31); | 430 | ^ (yr >> 28) ^ (yr >> 31); |
431 | 431 | ||
432 | /* | 432 | /* |
433 | * transcode 8 crypted bytes to 9 data bytes with sync | 433 | * transcode 8 crypted bytes to 9 data bytes with sync |
434 | * and checksum information | 434 | * and checksum information |
435 | */ | 435 | */ |
436 | bf_crypt_out[0] = (yl>>25) | 0x80; | 436 | bf_crypt_out[0] = (yl >> 25) | 0x80; |
437 | bf_crypt_out[1] = (yl>>18) & 0x7f; | 437 | bf_crypt_out[1] = (yl >> 18) & 0x7f; |
438 | bf_crypt_out[2] = (yl>>11) & 0x7f; | 438 | bf_crypt_out[2] = (yl >> 11) & 0x7f; |
439 | bf_crypt_out[3] = (yl>>4) & 0x7f; | 439 | bf_crypt_out[3] = (yl >> 4) & 0x7f; |
440 | bf_crypt_out[4] = ((yl<<3) & 0x78) | ((yr>>29) & 0x07); | 440 | bf_crypt_out[4] = ((yl << 3) & 0x78) | ((yr >> 29) & 0x07); |
441 | bf_crypt_out[5] = ((yr>>22) & 0x7f) | ((cs<<5) & 0x80); | 441 | bf_crypt_out[5] = ((yr >> 22) & 0x7f) | ((cs << 5) & 0x80); |
442 | bf_crypt_out[6] = ((yr>>15) & 0x7f) | ((cs<<6) & 0x80); | 442 | bf_crypt_out[6] = ((yr >> 15) & 0x7f) | ((cs << 6) & 0x80); |
443 | bf_crypt_out[7] = ((yr>>8) & 0x7f) | (cs<<7); | 443 | bf_crypt_out[7] = ((yr >> 8) & 0x7f) | (cs << 7); |
444 | bf_crypt_out[8] = yr; | 444 | bf_crypt_out[8] = yr; |
445 | } | 445 | } |
446 | 446 | ||
@@ -474,45 +474,45 @@ dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len) | |||
474 | * shift upper bit and rotate data to buffer ring | 474 | * shift upper bit and rotate data to buffer ring |
475 | * send current decrypted data | 475 | * send current decrypted data |
476 | */ | 476 | */ |
477 | sync = (sync<<1) | ((*data)>>7); | 477 | sync = (sync << 1) | ((*data) >> 7); |
478 | bf_crypt_inring[j++ & 15] = *data; | 478 | bf_crypt_inring[j++ & 15] = *data; |
479 | *data++ = bf_data_out[k++]; | 479 | *data++ = bf_data_out[k++]; |
480 | i++; | 480 | i++; |
481 | if (k == 9) | 481 | if (k == 9) |
482 | k = 0; /* repeat if no sync has been found */ | 482 | k = 0; /* repeat if no sync has been found */ |
483 | /* check if not in sync */ | 483 | /* check if not in sync */ |
484 | if ((sync&0x1f0) != 0x100) | 484 | if ((sync & 0x1f0) != 0x100) |
485 | continue; | 485 | continue; |
486 | j -= 9; | 486 | j -= 9; |
487 | /* transcode receive data to 64 bit block of encrypted data */ | 487 | /* transcode receive data to 64 bit block of encrypted data */ |
488 | yl = bf_crypt_inring[j++ & 15]; | 488 | yl = bf_crypt_inring[j++ & 15]; |
489 | yl = (yl<<7) | bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ | 489 | yl = (yl << 7) | bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ |
490 | yl = (yl<<7) | bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ | 490 | yl = (yl << 7) | bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ |
491 | yl = (yl<<7) | bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ | 491 | yl = (yl << 7) | bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ |
492 | nibble = bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ | 492 | nibble = bf_crypt_inring[j++ & 15]; /* bit7 = 0 */ |
493 | yr = nibble; | 493 | yr = nibble; |
494 | yl = (yl<<4) | (nibble>>3); | 494 | yl = (yl << 4) | (nibble >> 3); |
495 | cs2 = bf_crypt_inring[j++ & 15]; | 495 | cs2 = bf_crypt_inring[j++ & 15]; |
496 | yr = (yr<<7) | (cs2 & 0x7f); | 496 | yr = (yr << 7) | (cs2 & 0x7f); |
497 | cs1 = bf_crypt_inring[j++ & 15]; | 497 | cs1 = bf_crypt_inring[j++ & 15]; |
498 | yr = (yr<<7) | (cs1 & 0x7f); | 498 | yr = (yr << 7) | (cs1 & 0x7f); |
499 | cs0 = bf_crypt_inring[j++ & 15]; | 499 | cs0 = bf_crypt_inring[j++ & 15]; |
500 | yr = (yr<<7) | (cs0 & 0x7f); | 500 | yr = (yr << 7) | (cs0 & 0x7f); |
501 | yr = (yr<<8) | bf_crypt_inring[j++ & 15]; | 501 | yr = (yr << 8) | bf_crypt_inring[j++ & 15]; |
502 | 502 | ||
503 | /* calculate 3-bit checksumme */ | 503 | /* calculate 3-bit checksumme */ |
504 | cs = yl ^ (yl>>3) ^ (yl>>6) ^ (yl>>9) ^ (yl>>12) ^ (yl>>15) | 504 | cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15) |
505 | ^ (yl>>18) ^ (yl>>21) ^ (yl>>24) ^ (yl>>27) ^ (yl>>30) | 505 | ^ (yl >> 18) ^ (yl >> 21) ^ (yl >> 24) ^ (yl >> 27) ^ (yl >> 30) |
506 | ^ (yr<<2) ^ (yr>>1) ^ (yr>>4) ^ (yr>>7) ^ (yr>>10) | 506 | ^ (yr << 2) ^ (yr >> 1) ^ (yr >> 4) ^ (yr >> 7) ^ (yr >> 10) |
507 | ^ (yr>>13) ^ (yr>>16) ^ (yr>>19) ^ (yr>>22) ^ (yr>>25) | 507 | ^ (yr >> 13) ^ (yr >> 16) ^ (yr >> 19) ^ (yr >> 22) ^ (yr >> 25) |
508 | ^ (yr>>28) ^ (yr>>31); | 508 | ^ (yr >> 28) ^ (yr >> 31); |
509 | 509 | ||
510 | /* check if frame is valid */ | 510 | /* check if frame is valid */ |
511 | if ((cs&0x7) != (((cs2>>5)&4) | ((cs1>>6)&2) | (cs0 >> 7))) { | 511 | if ((cs & 0x7) != (((cs2 >> 5) & 4) | ((cs1 >> 6) & 2) | (cs0 >> 7))) { |
512 | if (dsp_debug & DEBUG_DSP_BLOWFISH) | 512 | if (dsp_debug & DEBUG_DSP_BLOWFISH) |
513 | printk(KERN_DEBUG | 513 | printk(KERN_DEBUG |
514 | "DSP BLOWFISH: received corrupt frame, " | 514 | "DSP BLOWFISH: received corrupt frame, " |
515 | "checksumme is not correct\n"); | 515 | "checksumme is not correct\n"); |
516 | continue; | 516 | continue; |
517 | } | 517 | } |
518 | 518 | ||
@@ -537,17 +537,17 @@ dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len) | |||
537 | DROUND(yr, yl, 0); | 537 | DROUND(yr, yl, 0); |
538 | 538 | ||
539 | /* transcode 8 crypted bytes to 9 sample bytes */ | 539 | /* transcode 8 crypted bytes to 9 sample bytes */ |
540 | bf_data_out[0] = dsp_audio_seven2law[(yl>>25) & 0x7f]; | 540 | bf_data_out[0] = dsp_audio_seven2law[(yl >> 25) & 0x7f]; |
541 | bf_data_out[1] = dsp_audio_seven2law[(yl>>18) & 0x7f]; | 541 | bf_data_out[1] = dsp_audio_seven2law[(yl >> 18) & 0x7f]; |
542 | bf_data_out[2] = dsp_audio_seven2law[(yl>>11) & 0x7f]; | 542 | bf_data_out[2] = dsp_audio_seven2law[(yl >> 11) & 0x7f]; |
543 | bf_data_out[3] = dsp_audio_seven2law[(yl>>4) & 0x7f]; | 543 | bf_data_out[3] = dsp_audio_seven2law[(yl >> 4) & 0x7f]; |
544 | bf_data_out[4] = dsp_audio_seven2law[((yl<<3) & 0x78) | | 544 | bf_data_out[4] = dsp_audio_seven2law[((yl << 3) & 0x78) | |
545 | ((yr>>29) & 0x07)]; | 545 | ((yr >> 29) & 0x07)]; |
546 | 546 | ||
547 | bf_data_out[5] = dsp_audio_seven2law[(yr>>22) & 0x7f]; | 547 | bf_data_out[5] = dsp_audio_seven2law[(yr >> 22) & 0x7f]; |
548 | bf_data_out[6] = dsp_audio_seven2law[(yr>>15) & 0x7f]; | 548 | bf_data_out[6] = dsp_audio_seven2law[(yr >> 15) & 0x7f]; |
549 | bf_data_out[7] = dsp_audio_seven2law[(yr>>8) & 0x7f]; | 549 | bf_data_out[7] = dsp_audio_seven2law[(yr >> 8) & 0x7f]; |
550 | bf_data_out[8] = dsp_audio_seven2law[(yr>>1) & 0x7f]; | 550 | bf_data_out[8] = dsp_audio_seven2law[(yr >> 1) & 0x7f]; |
551 | k = 0; /* start with new decoded frame */ | 551 | k = 0; /* start with new decoded frame */ |
552 | } | 552 | } |
553 | 553 | ||
@@ -631,9 +631,9 @@ dsp_bf_init(struct dsp *dsp, const u8 *key, uint keylen) | |||
631 | /* Actual subkey generation */ | 631 | /* Actual subkey generation */ |
632 | for (j = 0, i = 0; i < 16 + 2; i++) { | 632 | for (j = 0, i = 0; i < 16 + 2; i++) { |
633 | temp = (((u32)key[j] << 24) | | 633 | temp = (((u32)key[j] << 24) | |
634 | ((u32)key[(j + 1) % keylen] << 16) | | 634 | ((u32)key[(j + 1) % keylen] << 16) | |
635 | ((u32)key[(j + 2) % keylen] << 8) | | 635 | ((u32)key[(j + 2) % keylen] << 8) | |
636 | ((u32)key[(j + 3) % keylen])); | 636 | ((u32)key[(j + 3) % keylen])); |
637 | 637 | ||
638 | P[i] = P[i] ^ temp; | 638 | P[i] = P[i] ^ temp; |
639 | j = (j + 4) % keylen; | 639 | j = (j + 4) % keylen; |
diff --git a/drivers/isdn/mISDN/dsp_cmx.c b/drivers/isdn/mISDN/dsp_cmx.c index 4d395dea32f3..334feab060a1 100644 --- a/drivers/isdn/mISDN/dsp_cmx.c +++ b/drivers/isdn/mISDN/dsp_cmx.c | |||
@@ -165,8 +165,8 @@ dsp_cmx_debug(struct dsp *dsp) | |||
165 | printk(KERN_DEBUG "-----Current DSP\n"); | 165 | printk(KERN_DEBUG "-----Current DSP\n"); |
166 | list_for_each_entry(odsp, &dsp_ilist, list) { | 166 | list_for_each_entry(odsp, &dsp_ilist, list) { |
167 | printk(KERN_DEBUG "* %s hardecho=%d softecho=%d txmix=%d", | 167 | printk(KERN_DEBUG "* %s hardecho=%d softecho=%d txmix=%d", |
168 | odsp->name, odsp->echo.hardware, odsp->echo.software, | 168 | odsp->name, odsp->echo.hardware, odsp->echo.software, |
169 | odsp->tx_mix); | 169 | odsp->tx_mix); |
170 | if (odsp->conf) | 170 | if (odsp->conf) |
171 | printk(" (Conf %d)", odsp->conf->id); | 171 | printk(" (Conf %d)", odsp->conf->id); |
172 | if (dsp == odsp) | 172 | if (dsp == odsp) |
@@ -178,14 +178,14 @@ dsp_cmx_debug(struct dsp *dsp) | |||
178 | printk(KERN_DEBUG "* Conf %d (%p)\n", conf->id, conf); | 178 | printk(KERN_DEBUG "* Conf %d (%p)\n", conf->id, conf); |
179 | list_for_each_entry(member, &conf->mlist, list) { | 179 | list_for_each_entry(member, &conf->mlist, list) { |
180 | printk(KERN_DEBUG | 180 | printk(KERN_DEBUG |
181 | " - member = %s (slot_tx %d, bank_tx %d, " | 181 | " - member = %s (slot_tx %d, bank_tx %d, " |
182 | "slot_rx %d, bank_rx %d hfc_conf %d " | 182 | "slot_rx %d, bank_rx %d hfc_conf %d " |
183 | "tx_data %d rx_is_off %d)%s\n", | 183 | "tx_data %d rx_is_off %d)%s\n", |
184 | member->dsp->name, member->dsp->pcm_slot_tx, | 184 | member->dsp->name, member->dsp->pcm_slot_tx, |
185 | member->dsp->pcm_bank_tx, member->dsp->pcm_slot_rx, | 185 | member->dsp->pcm_bank_tx, member->dsp->pcm_slot_rx, |
186 | member->dsp->pcm_bank_rx, member->dsp->hfc_conf, | 186 | member->dsp->pcm_bank_rx, member->dsp->hfc_conf, |
187 | member->dsp->tx_data, member->dsp->rx_is_off, | 187 | member->dsp->tx_data, member->dsp->rx_is_off, |
188 | (member->dsp == dsp) ? " *this*" : ""); | 188 | (member->dsp == dsp) ? " *this*" : ""); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | printk(KERN_DEBUG "-----end\n"); | 191 | printk(KERN_DEBUG "-----end\n"); |
@@ -227,13 +227,13 @@ dsp_cmx_add_conf_member(struct dsp *dsp, struct dsp_conf *conf) | |||
227 | } | 227 | } |
228 | if (dsp->member) { | 228 | if (dsp->member) { |
229 | printk(KERN_WARNING "%s: dsp is already member in a conf.\n", | 229 | printk(KERN_WARNING "%s: dsp is already member in a conf.\n", |
230 | __func__); | 230 | __func__); |
231 | return -EINVAL; | 231 | return -EINVAL; |
232 | } | 232 | } |
233 | 233 | ||
234 | if (dsp->conf) { | 234 | if (dsp->conf) { |
235 | printk(KERN_WARNING "%s: dsp is already in a conf.\n", | 235 | printk(KERN_WARNING "%s: dsp is already in a conf.\n", |
236 | __func__); | 236 | __func__); |
237 | return -EINVAL; | 237 | return -EINVAL; |
238 | } | 238 | } |
239 | 239 | ||
@@ -268,19 +268,19 @@ dsp_cmx_del_conf_member(struct dsp *dsp) | |||
268 | 268 | ||
269 | if (!dsp) { | 269 | if (!dsp) { |
270 | printk(KERN_WARNING "%s: dsp is 0.\n", | 270 | printk(KERN_WARNING "%s: dsp is 0.\n", |
271 | __func__); | 271 | __func__); |
272 | return -EINVAL; | 272 | return -EINVAL; |
273 | } | 273 | } |
274 | 274 | ||
275 | if (!dsp->conf) { | 275 | if (!dsp->conf) { |
276 | printk(KERN_WARNING "%s: dsp is not in a conf.\n", | 276 | printk(KERN_WARNING "%s: dsp is not in a conf.\n", |
277 | __func__); | 277 | __func__); |
278 | return -EINVAL; | 278 | return -EINVAL; |
279 | } | 279 | } |
280 | 280 | ||
281 | if (list_empty(&dsp->conf->mlist)) { | 281 | if (list_empty(&dsp->conf->mlist)) { |
282 | printk(KERN_WARNING "%s: dsp has linked an empty conf.\n", | 282 | printk(KERN_WARNING "%s: dsp has linked an empty conf.\n", |
283 | __func__); | 283 | __func__); |
284 | return -EINVAL; | 284 | return -EINVAL; |
285 | } | 285 | } |
286 | 286 | ||
@@ -295,8 +295,8 @@ dsp_cmx_del_conf_member(struct dsp *dsp) | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | printk(KERN_WARNING | 297 | printk(KERN_WARNING |
298 | "%s: dsp is not present in its own conf_meber list.\n", | 298 | "%s: dsp is not present in its own conf_meber list.\n", |
299 | __func__); | 299 | __func__); |
300 | 300 | ||
301 | return -EINVAL; | 301 | return -EINVAL; |
302 | } | 302 | } |
@@ -312,7 +312,7 @@ static struct dsp_conf | |||
312 | 312 | ||
313 | if (!id) { | 313 | if (!id) { |
314 | printk(KERN_WARNING "%s: id is 0.\n", | 314 | printk(KERN_WARNING "%s: id is 0.\n", |
315 | __func__); | 315 | __func__); |
316 | return NULL; | 316 | return NULL; |
317 | } | 317 | } |
318 | 318 | ||
@@ -338,13 +338,13 @@ dsp_cmx_del_conf(struct dsp_conf *conf) | |||
338 | { | 338 | { |
339 | if (!conf) { | 339 | if (!conf) { |
340 | printk(KERN_WARNING "%s: conf is null.\n", | 340 | printk(KERN_WARNING "%s: conf is null.\n", |
341 | __func__); | 341 | __func__); |
342 | return -EINVAL; | 342 | return -EINVAL; |
343 | } | 343 | } |
344 | 344 | ||
345 | if (!list_empty(&conf->mlist)) { | 345 | if (!list_empty(&conf->mlist)) { |
346 | printk(KERN_WARNING "%s: conf not empty.\n", | 346 | printk(KERN_WARNING "%s: conf not empty.\n", |
347 | __func__); | 347 | __func__); |
348 | return -EINVAL; | 348 | return -EINVAL; |
349 | } | 349 | } |
350 | list_del(&conf->list); | 350 | list_del(&conf->list); |
@@ -359,7 +359,7 @@ dsp_cmx_del_conf(struct dsp_conf *conf) | |||
359 | */ | 359 | */ |
360 | static void | 360 | static void |
361 | dsp_cmx_hw_message(struct dsp *dsp, u32 message, u32 param1, u32 param2, | 361 | dsp_cmx_hw_message(struct dsp *dsp, u32 message, u32 param1, u32 param2, |
362 | u32 param3, u32 param4) | 362 | u32 param3, u32 param4) |
363 | { | 363 | { |
364 | struct mISDN_ctrl_req cq; | 364 | struct mISDN_ctrl_req cq; |
365 | 365 | ||
@@ -389,7 +389,7 @@ dsp_cmx_hardware(struct dsp_conf *conf, struct dsp *dsp) | |||
389 | int freeunits[8]; | 389 | int freeunits[8]; |
390 | u_char freeslots[256]; | 390 | u_char freeslots[256]; |
391 | int same_hfc = -1, same_pcm = -1, current_conf = -1, | 391 | int same_hfc = -1, same_pcm = -1, current_conf = -1, |
392 | all_conf = 1, tx_data = 0; | 392 | all_conf = 1, tx_data = 0; |
393 | 393 | ||
394 | /* dsp gets updated (no conf) */ | 394 | /* dsp gets updated (no conf) */ |
395 | if (!conf) { | 395 | if (!conf) { |
@@ -397,17 +397,17 @@ dsp_cmx_hardware(struct dsp_conf *conf, struct dsp *dsp) | |||
397 | return; | 397 | return; |
398 | if (dsp_debug & DEBUG_DSP_CMX) | 398 | if (dsp_debug & DEBUG_DSP_CMX) |
399 | printk(KERN_DEBUG "%s checking dsp %s\n", | 399 | printk(KERN_DEBUG "%s checking dsp %s\n", |
400 | __func__, dsp->name); | 400 | __func__, dsp->name); |
401 | one_member: | 401 | one_member: |
402 | /* remove HFC conference if enabled */ | 402 | /* remove HFC conference if enabled */ |
403 | if (dsp->hfc_conf >= 0) { | 403 | if (dsp->hfc_conf >= 0) { |
404 | if (dsp_debug & DEBUG_DSP_CMX) | 404 | if (dsp_debug & DEBUG_DSP_CMX) |
405 | printk(KERN_DEBUG | 405 | printk(KERN_DEBUG |
406 | "%s removing %s from HFC conf %d " | 406 | "%s removing %s from HFC conf %d " |
407 | "because dsp is split\n", __func__, | 407 | "because dsp is split\n", __func__, |
408 | dsp->name, dsp->hfc_conf); | 408 | dsp->name, dsp->hfc_conf); |
409 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_CONF_SPLIT, | 409 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_CONF_SPLIT, |
410 | 0, 0, 0, 0); | 410 | 0, 0, 0, 0); |
411 | dsp->hfc_conf = -1; | 411 | dsp->hfc_conf = -1; |
412 | } | 412 | } |
413 | /* process hw echo */ | 413 | /* process hw echo */ |
@@ -418,12 +418,12 @@ one_member: | |||
418 | if (dsp->pcm_slot_tx >= 0 || dsp->pcm_slot_rx >= 0) { | 418 | if (dsp->pcm_slot_tx >= 0 || dsp->pcm_slot_rx >= 0) { |
419 | if (dsp_debug & DEBUG_DSP_CMX) | 419 | if (dsp_debug & DEBUG_DSP_CMX) |
420 | printk(KERN_DEBUG "%s removing %s from" | 420 | printk(KERN_DEBUG "%s removing %s from" |
421 | " PCM slot %d (TX) %d (RX) because" | 421 | " PCM slot %d (TX) %d (RX) because" |
422 | " dsp is split (no echo)\n", | 422 | " dsp is split (no echo)\n", |
423 | __func__, dsp->name, | 423 | __func__, dsp->name, |
424 | dsp->pcm_slot_tx, dsp->pcm_slot_rx); | 424 | dsp->pcm_slot_tx, dsp->pcm_slot_rx); |
425 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_DISC, | 425 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_DISC, |
426 | 0, 0, 0, 0); | 426 | 0, 0, 0, 0); |
427 | dsp->pcm_slot_tx = -1; | 427 | dsp->pcm_slot_tx = -1; |
428 | dsp->pcm_bank_tx = -1; | 428 | dsp->pcm_bank_tx = -1; |
429 | dsp->pcm_slot_rx = -1; | 429 | dsp->pcm_slot_rx = -1; |
@@ -447,11 +447,11 @@ one_member: | |||
447 | dsp->pcm_bank_rx = 2; | 447 | dsp->pcm_bank_rx = 2; |
448 | if (dsp_debug & DEBUG_DSP_CMX) | 448 | if (dsp_debug & DEBUG_DSP_CMX) |
449 | printk(KERN_DEBUG | 449 | printk(KERN_DEBUG |
450 | "%s refresh %s for echo using slot %d\n", | 450 | "%s refresh %s for echo using slot %d\n", |
451 | __func__, dsp->name, | 451 | __func__, dsp->name, |
452 | dsp->pcm_slot_tx); | 452 | dsp->pcm_slot_tx); |
453 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_CONN, | 453 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_CONN, |
454 | dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); | 454 | dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); |
455 | dsp->echo.hardware = 1; | 455 | dsp->echo.hardware = 1; |
456 | return; | 456 | return; |
457 | } | 457 | } |
@@ -479,8 +479,8 @@ one_member: | |||
479 | if (i == ii) { | 479 | if (i == ii) { |
480 | if (dsp_debug & DEBUG_DSP_CMX) | 480 | if (dsp_debug & DEBUG_DSP_CMX) |
481 | printk(KERN_DEBUG | 481 | printk(KERN_DEBUG |
482 | "%s no slot available for echo\n", | 482 | "%s no slot available for echo\n", |
483 | __func__); | 483 | __func__); |
484 | /* no more slots available */ | 484 | /* no more slots available */ |
485 | dsp->echo.software = 1; | 485 | dsp->echo.software = 1; |
486 | return; | 486 | return; |
@@ -492,10 +492,10 @@ one_member: | |||
492 | dsp->pcm_bank_rx = 2; | 492 | dsp->pcm_bank_rx = 2; |
493 | if (dsp_debug & DEBUG_DSP_CMX) | 493 | if (dsp_debug & DEBUG_DSP_CMX) |
494 | printk(KERN_DEBUG | 494 | printk(KERN_DEBUG |
495 | "%s assign echo for %s using slot %d\n", | 495 | "%s assign echo for %s using slot %d\n", |
496 | __func__, dsp->name, dsp->pcm_slot_tx); | 496 | __func__, dsp->name, dsp->pcm_slot_tx); |
497 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_CONN, | 497 | dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_CONN, |
498 | dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); | 498 | dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); |
499 | dsp->echo.hardware = 1; | 499 | dsp->echo.hardware = 1; |
500 | return; | 500 | return; |
501 | } | 501 | } |
@@ -503,11 +503,11 @@ one_member: | |||
503 | /* conf gets updated (all members) */ | 503 | /* conf gets updated (all members) */ |
504 | if (dsp_debug & DEBUG_DSP_CMX) | 504 | if (dsp_debug & DEBUG_DSP_CMX) |
505 | printk(KERN_DEBUG "%s checking conference %d\n", | 505 | printk(KERN_DEBUG "%s checking conference %d\n", |
506 | __func__, conf->id); | 506 | __func__, conf->id); |
507 | 507 | ||
508 | if (list_empty(&conf->mlist)) { | 508 | if (list_empty(&conf->mlist)) { |
509 | printk(KERN_ERR "%s: conference whithout members\n", | 509 | printk(KERN_ERR "%s: conference whithout members\n", |
510 | __func__); | 510 | __func__); |
511 | return; | 511 | return; |
512 | } | 512 | } |
513 | member = list_entry(conf->mlist.next, struct dsp_conf_member, list); | 513 | member = list_entry(conf->mlist.next, struct dsp_conf_member, list); |
@@ -519,25 +519,25 @@ one_member: | |||
519 | if (member->dsp->tx_mix) { | 519 | if (member->dsp->tx_mix) { |
520 | if (dsp_debug & DEBUG_DSP_CMX) | 520 | if (dsp_debug & DEBUG_DSP_CMX) |
521 | printk(KERN_DEBUG | 521 | printk(KERN_DEBUG |
522 | "%s dsp %s cannot form a conf, because " | 522 | "%s dsp %s cannot form a conf, because " |
523 | "tx_mix is turned on\n", __func__, | 523 | "tx_mix is turned on\n", __func__, |
524 | member->dsp->name); | 524 | member->dsp->name); |
525 | conf_software: | 525 | conf_software: |
526 | list_for_each_entry(member, &conf->mlist, list) { | 526 | list_for_each_entry(member, &conf->mlist, list) { |
527 | dsp = member->dsp; | 527 | dsp = member->dsp; |
528 | /* remove HFC conference if enabled */ | 528 | /* remove HFC conference if enabled */ |
529 | if (dsp->hfc_conf >= 0) { | 529 | if (dsp->hfc_conf >= 0) { |
530 | if (dsp_debug & DEBUG_DSP_CMX) | 530 | if (dsp_debug & DEBUG_DSP_CMX) |
531 | printk(KERN_DEBUG | 531 | printk(KERN_DEBUG |
532 | "%s removing %s from HFC " | 532 | "%s removing %s from HFC " |
533 | "conf %d because not " | 533 | "conf %d because not " |
534 | "possible with hardware\n", | 534 | "possible with hardware\n", |
535 | __func__, | 535 | __func__, |
536 | dsp->name, | 536 | dsp->name, |
537 | dsp->hfc_conf); | 537 | dsp->hfc_conf); |
538 | dsp_cmx_hw_message(dsp, | 538 | dsp_cmx_hw_message(dsp, |
539 | MISDN_CTRL_HFC_CONF_SPLIT, | 539 | MISDN_CTRL_HFC_CONF_SPLIT, |
540 | 0, 0, 0, 0); | 540 | 0, 0, 0, 0); |
541 | dsp->hfc_conf = -1; | 541 | dsp->hfc_conf = -1; |
542 | } | 542 | } |
543 | /* remove PCM slot if assigned */ | 543 | /* remove PCM slot if assigned */ |
@@ -545,16 +545,16 @@ conf_software: | |||
545 | dsp->pcm_slot_rx >= 0) { | 545 | dsp->pcm_slot_rx >= 0) { |
546 | if (dsp_debug & DEBUG_DSP_CMX) | 546 | if (dsp_debug & DEBUG_DSP_CMX) |
547 | printk(KERN_DEBUG "%s removing " | 547 | printk(KERN_DEBUG "%s removing " |
548 | "%s from PCM slot %d (TX)" | 548 | "%s from PCM slot %d (TX)" |
549 | " slot %d (RX) because not" | 549 | " slot %d (RX) because not" |
550 | " possible with hardware\n", | 550 | " possible with hardware\n", |
551 | __func__, | 551 | __func__, |
552 | dsp->name, | 552 | dsp->name, |
553 | dsp->pcm_slot_tx, | 553 | dsp->pcm_slot_tx, |
554 | dsp->pcm_slot_rx); | 554 | dsp->pcm_slot_rx); |
555 | dsp_cmx_hw_message(dsp, | 555 | dsp_cmx_hw_message(dsp, |
556 | MISDN_CTRL_HFC_PCM_DISC, | 556 | MISDN_CTRL_HFC_PCM_DISC, |
557 | 0, 0, 0, 0); | 557 | 0, 0, 0, 0); |
558 | dsp->pcm_slot_tx = -1; | 558 | dsp->pcm_slot_tx = -1; |
559 | dsp->pcm_bank_tx = -1; | 559 | dsp->pcm_bank_tx = -1; |
560 | dsp->pcm_slot_rx = -1; | 560 | dsp->pcm_slot_rx = -1; |
@@ -569,79 +569,79 @@ conf_software: | |||
569 | if (member->dsp->echo.hardware || member->dsp->echo.software) { | 569 | if (member->dsp->echo.hardware || member->dsp->echo.software) { |
570 | if (dsp_debug & DEBUG_DSP_CMX) | 570 | if (dsp_debug & DEBUG_DSP_CMX) |
571 | printk(KERN_DEBUG | 571 | printk(KERN_DEBUG |
572 | "%s dsp %s cannot form a conf, because " | 572 | "%s dsp %s cannot form a conf, because " |
573 | "echo is turned on\n", __func__, | 573 | "echo is turned on\n", __func__, |
574 | member->dsp->name); | 574 | member->dsp->name); |
575 | goto conf_software; | 575 | goto conf_software; |
576 | } | 576 | } |
577 | /* check if member has tx_mix turned on */ | 577 | /* check if member has tx_mix turned on */ |
578 | if (member->dsp->tx_mix) { | 578 | if (member->dsp->tx_mix) { |
579 | if (dsp_debug & DEBUG_DSP_CMX) | 579 | if (dsp_debug & DEBUG_DSP_CMX) |
580 | printk(KERN_DEBUG | 580 | printk(KERN_DEBUG |
581 | "%s dsp %s cannot form a conf, because " | 581 | "%s dsp %s cannot form a conf, because " |
582 | "tx_mix is turned on\n", | 582 | "tx_mix is turned on\n", |
583 | __func__, member->dsp->name); | 583 | __func__, member->dsp->name); |
584 | goto conf_software; | 584 | goto conf_software; |
585 | } | 585 | } |
586 | /* check if member changes volume at an not suppoted level */ | 586 | /* check if member changes volume at an not suppoted level */ |
587 | if (member->dsp->tx_volume) { | 587 | if (member->dsp->tx_volume) { |
588 | if (dsp_debug & DEBUG_DSP_CMX) | 588 | if (dsp_debug & DEBUG_DSP_CMX) |
589 | printk(KERN_DEBUG | 589 | printk(KERN_DEBUG |
590 | "%s dsp %s cannot form a conf, because " | 590 | "%s dsp %s cannot form a conf, because " |
591 | "tx_volume is changed\n", | 591 | "tx_volume is changed\n", |
592 | __func__, member->dsp->name); | 592 | __func__, member->dsp->name); |
593 | goto conf_software; | 593 | goto conf_software; |
594 | } | 594 | } |
595 | if (member->dsp->rx_volume) { | 595 | if (member->dsp->rx_volume) { |
596 | if (dsp_debug & DEBUG_DSP_CMX) | 596 | if (dsp_debug & DEBUG_DSP_CMX) |
597 | printk(KERN_DEBUG | 597 | printk(KERN_DEBUG |
598 | "%s dsp %s cannot form a conf, because " | 598 | "%s dsp %s cannot form a conf, because " |
599 | "rx_volume is changed\n", | 599 | "rx_volume is changed\n", |
600 | __func__, member->dsp->name); | 600 | __func__, member->dsp->name); |
601 | goto conf_software; | 601 | goto conf_software; |
602 | } | 602 | } |
603 | /* check if tx-data turned on */ | 603 | /* check if tx-data turned on */ |
604 | if (member->dsp->tx_data) { | 604 | if (member->dsp->tx_data) { |
605 | if (dsp_debug & DEBUG_DSP_CMX) | 605 | if (dsp_debug & DEBUG_DSP_CMX) |
606 | printk(KERN_DEBUG | 606 | printk(KERN_DEBUG |
607 | "%s dsp %s tx_data is turned on\n", | 607 | "%s dsp %s tx_data is turned on\n", |
608 | __func__, member->dsp->name); | 608 | __func__, member->dsp->name); |
609 | tx_data = 1; | 609 | tx_data = 1; |
610 | } | 610 | } |
611 | /* check if pipeline exists */ | 611 | /* check if pipeline exists */ |
612 | if (member->dsp->pipeline.inuse) { | 612 | if (member->dsp->pipeline.inuse) { |
613 | if (dsp_debug & DEBUG_DSP_CMX) | 613 | if (dsp_debug & DEBUG_DSP_CMX) |
614 | printk(KERN_DEBUG | 614 | printk(KERN_DEBUG |
615 | "%s dsp %s cannot form a conf, because " | 615 | "%s dsp %s cannot form a conf, because " |
616 | "pipeline exists\n", __func__, | 616 | "pipeline exists\n", __func__, |
617 | member->dsp->name); | 617 | member->dsp->name); |
618 | goto conf_software; | 618 | goto conf_software; |
619 | } | 619 | } |
620 | /* check if encryption is enabled */ | 620 | /* check if encryption is enabled */ |
621 | if (member->dsp->bf_enable) { | 621 | if (member->dsp->bf_enable) { |
622 | if (dsp_debug & DEBUG_DSP_CMX) | 622 | if (dsp_debug & DEBUG_DSP_CMX) |
623 | printk(KERN_DEBUG "%s dsp %s cannot form a " | 623 | printk(KERN_DEBUG "%s dsp %s cannot form a " |
624 | "conf, because encryption is enabled\n", | 624 | "conf, because encryption is enabled\n", |
625 | __func__, member->dsp->name); | 625 | __func__, member->dsp->name); |
626 | goto conf_software; | 626 | goto conf_software; |
627 | } | 627 | } |
628 | /* check if member is on a card with PCM support */ | 628 | /* check if member is on a card with PCM support */ |
629 | if (member->dsp->features.pcm_id < 0) { | 629 | if (member->dsp->features.pcm_id < 0) { |
630 | if (dsp_debug & DEBUG_DSP_CMX) | 630 | if (dsp_debug & DEBUG_DSP_CMX) |
631 | printk(KERN_DEBUG | 631 | printk(KERN_DEBUG |
632 | "%s dsp %s cannot form a conf, because " | 632 | "%s dsp %s cannot form a conf, because " |
633 | "dsp has no PCM bus\n", | 633 | "dsp has no PCM bus\n", |
634 | __func__, member->dsp->name); | 634 | __func__, member->dsp->name); |
635 | goto conf_software; | 635 | goto conf_software; |
636 | } | 636 | } |
637 | /* check if relations are on the same PCM bus */ | 637 | /* check if relations are on the same PCM bus */ |
638 | if (member->dsp->features.pcm_id != same_pcm) { | 638 | if (member->dsp->features.pcm_id != same_pcm) { |
639 | if (dsp_debug & DEBUG_DSP_CMX) | 639 | if (dsp_debug & DEBUG_DSP_CMX) |
640 | printk(KERN_DEBUG | 640 | printk(KERN_DEBUG |
641 | "%s dsp %s cannot form a conf, because " | 641 | "%s dsp %s cannot form a conf, because " |
642 | "dsp is on a different PCM bus than the " | 642 | "dsp is on a different PCM bus than the " |
643 | "first dsp\n", | 643 | "first dsp\n", |
644 | __func__, member->dsp->name); | 644 | __func__, member->dsp->name); |
645 | goto conf_software; | 645 | goto conf_software; |
646 | } | 646 | } |
647 | /* determine if members are on the same hfc chip */ | 647 | /* determine if members are on the same hfc chip */ |
@@ -665,12 +665,12 @@ conf_software: | |||
665 | if (memb == 1) { | 665 | if (memb == 1) { |
666 | if (dsp_debug & DEBUG_DSP_CMX) | 666 | if (dsp_debug & DEBUG_DSP_CMX) |
667 | printk(KERN_DEBUG | 667 | printk(KERN_DEBUG |
668 | "%s conf %d cannot form a HW conference, " | 668 | "%s conf %d cannot form a HW conference, " |
669 | "because dsp is alone\n", __func__, conf->id); | 669 | "because dsp is alone\n", __func__, conf->id); |
670 | conf->hardware = 0; | 670 | conf->hardware = 0; |
671 | conf->software = 0; | 671 | conf->software = 0; |
672 | member = list_entry(conf->mlist.next, struct dsp_conf_member, | 672 | member = list_entry(conf->mlist.next, struct dsp_conf_member, |
673 | list); | 673 | list); |
674 | dsp = member->dsp; | 674 | dsp = member->dsp; |
675 | goto one_member; | 675 | goto one_member; |
676 | } | 676 | } |
@@ -684,30 +684,30 @@ conf_software: | |||
684 | /* if we have only two members */ | 684 | /* if we have only two members */ |
685 | if (memb == 2) { | 685 | if (memb == 2) { |
686 | member = list_entry(conf->mlist.next, struct dsp_conf_member, | 686 | member = list_entry(conf->mlist.next, struct dsp_conf_member, |
687 | list); | 687 | list); |
688 | nextm = list_entry(member->list.next, struct dsp_conf_member, | 688 | nextm = list_entry(member->list.next, struct dsp_conf_member, |
689 | list); | 689 | list); |
690 | /* remove HFC conference if enabled */ | 690 | /* remove HFC conference if enabled */ |
691 | if (member->dsp->hfc_conf >= 0) { | 691 | if (member->dsp->hfc_conf >= 0) { |
692 | if (dsp_debug & DEBUG_DSP_CMX) | 692 | if (dsp_debug & DEBUG_DSP_CMX) |
693 | printk(KERN_DEBUG | 693 | printk(KERN_DEBUG |
694 | "%s removing %s from HFC conf %d because " | 694 | "%s removing %s from HFC conf %d because " |
695 | "two parties require only a PCM slot\n", | 695 | "two parties require only a PCM slot\n", |
696 | __func__, member->dsp->name, | 696 | __func__, member->dsp->name, |
697 | member->dsp->hfc_conf); | 697 | member->dsp->hfc_conf); |
698 | dsp_cmx_hw_message(member->dsp, | 698 | dsp_cmx_hw_message(member->dsp, |
699 | MISDN_CTRL_HFC_CONF_SPLIT, 0, 0, 0, 0); | 699 | MISDN_CTRL_HFC_CONF_SPLIT, 0, 0, 0, 0); |
700 | member->dsp->hfc_conf = -1; | 700 | member->dsp->hfc_conf = -1; |
701 | } | 701 | } |
702 | if (nextm->dsp->hfc_conf >= 0) { | 702 | if (nextm->dsp->hfc_conf >= 0) { |
703 | if (dsp_debug & DEBUG_DSP_CMX) | 703 | if (dsp_debug & DEBUG_DSP_CMX) |
704 | printk(KERN_DEBUG | 704 | printk(KERN_DEBUG |
705 | "%s removing %s from HFC conf %d because " | 705 | "%s removing %s from HFC conf %d because " |
706 | "two parties require only a PCM slot\n", | 706 | "two parties require only a PCM slot\n", |
707 | __func__, nextm->dsp->name, | 707 | __func__, nextm->dsp->name, |
708 | nextm->dsp->hfc_conf); | 708 | nextm->dsp->hfc_conf); |
709 | dsp_cmx_hw_message(nextm->dsp, | 709 | dsp_cmx_hw_message(nextm->dsp, |
710 | MISDN_CTRL_HFC_CONF_SPLIT, 0, 0, 0, 0); | 710 | MISDN_CTRL_HFC_CONF_SPLIT, 0, 0, 0, 0); |
711 | nextm->dsp->hfc_conf = -1; | 711 | nextm->dsp->hfc_conf = -1; |
712 | } | 712 | } |
713 | /* if members have two banks (and not on the same chip) */ | 713 | /* if members have two banks (and not on the same chip) */ |
@@ -733,15 +733,15 @@ conf_software: | |||
733 | /* all members have same slot */ | 733 | /* all members have same slot */ |
734 | if (dsp_debug & DEBUG_DSP_CMX) | 734 | if (dsp_debug & DEBUG_DSP_CMX) |
735 | printk(KERN_DEBUG | 735 | printk(KERN_DEBUG |
736 | "%s dsp %s & %s stay joined on " | 736 | "%s dsp %s & %s stay joined on " |
737 | "PCM slot %d bank %d (TX) bank %d " | 737 | "PCM slot %d bank %d (TX) bank %d " |
738 | "(RX) (on different chips)\n", | 738 | "(RX) (on different chips)\n", |
739 | __func__, | 739 | __func__, |
740 | member->dsp->name, | 740 | member->dsp->name, |
741 | nextm->dsp->name, | 741 | nextm->dsp->name, |
742 | member->dsp->pcm_slot_tx, | 742 | member->dsp->pcm_slot_tx, |
743 | member->dsp->pcm_bank_tx, | 743 | member->dsp->pcm_bank_tx, |
744 | member->dsp->pcm_bank_rx); | 744 | member->dsp->pcm_bank_rx); |
745 | conf->hardware = 0; | 745 | conf->hardware = 0; |
746 | conf->software = 1; | 746 | conf->software = 1; |
747 | return; | 747 | return; |
@@ -773,10 +773,10 @@ conf_software: | |||
773 | if (i == ii) { | 773 | if (i == ii) { |
774 | if (dsp_debug & DEBUG_DSP_CMX) | 774 | if (dsp_debug & DEBUG_DSP_CMX) |
775 | printk(KERN_DEBUG | 775 | printk(KERN_DEBUG |
776 | "%s no slot available for " | 776 | "%s no slot available for " |
777 | "%s & %s\n", __func__, | 777 | "%s & %s\n", __func__, |
778 | member->dsp->name, | 778 | member->dsp->name, |
779 | nextm->dsp->name); | 779 | nextm->dsp->name); |
780 | /* no more slots available */ | 780 | /* no more slots available */ |
781 | goto conf_software; | 781 | goto conf_software; |
782 | } | 782 | } |
@@ -791,23 +791,23 @@ conf_software: | |||
791 | nextm->dsp->pcm_bank_tx = 0; | 791 | nextm->dsp->pcm_bank_tx = 0; |
792 | if (dsp_debug & DEBUG_DSP_CMX) | 792 | if (dsp_debug & DEBUG_DSP_CMX) |
793 | printk(KERN_DEBUG | 793 | printk(KERN_DEBUG |
794 | "%s adding %s & %s to new PCM slot %d " | 794 | "%s adding %s & %s to new PCM slot %d " |
795 | "(TX and RX on different chips) because " | 795 | "(TX and RX on different chips) because " |
796 | "both members have not same slots\n", | 796 | "both members have not same slots\n", |
797 | __func__, | 797 | __func__, |
798 | member->dsp->name, | 798 | member->dsp->name, |
799 | nextm->dsp->name, | 799 | nextm->dsp->name, |
800 | member->dsp->pcm_slot_tx); | 800 | member->dsp->pcm_slot_tx); |
801 | dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, | 801 | dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, |
802 | member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, | 802 | member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, |
803 | member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); | 803 | member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); |
804 | dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, | 804 | dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, |
805 | nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, | 805 | nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, |
806 | nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); | 806 | nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); |
807 | conf->hardware = 1; | 807 | conf->hardware = 1; |
808 | conf->software = tx_data; | 808 | conf->software = tx_data; |
809 | return; | 809 | return; |
810 | /* if members have one bank (or on the same chip) */ | 810 | /* if members have one bank (or on the same chip) */ |
811 | } else { | 811 | } else { |
812 | /* if both members have different crossed slots */ | 812 | /* if both members have different crossed slots */ |
813 | if (member->dsp->pcm_slot_tx >= 0 && | 813 | if (member->dsp->pcm_slot_tx >= 0 && |
@@ -827,13 +827,13 @@ conf_software: | |||
827 | /* all members have same slot */ | 827 | /* all members have same slot */ |
828 | if (dsp_debug & DEBUG_DSP_CMX) | 828 | if (dsp_debug & DEBUG_DSP_CMX) |
829 | printk(KERN_DEBUG | 829 | printk(KERN_DEBUG |
830 | "%s dsp %s & %s stay joined on PCM " | 830 | "%s dsp %s & %s stay joined on PCM " |
831 | "slot %d (TX) %d (RX) on same chip " | 831 | "slot %d (TX) %d (RX) on same chip " |
832 | "or one bank PCM)\n", __func__, | 832 | "or one bank PCM)\n", __func__, |
833 | member->dsp->name, | 833 | member->dsp->name, |
834 | nextm->dsp->name, | 834 | nextm->dsp->name, |
835 | member->dsp->pcm_slot_tx, | 835 | member->dsp->pcm_slot_tx, |
836 | member->dsp->pcm_slot_rx); | 836 | member->dsp->pcm_slot_rx); |
837 | conf->hardware = 0; | 837 | conf->hardware = 0; |
838 | conf->software = 1; | 838 | conf->software = 1; |
839 | return; | 839 | return; |
@@ -865,14 +865,14 @@ conf_software: | |||
865 | if (i1 == ii) { | 865 | if (i1 == ii) { |
866 | if (dsp_debug & DEBUG_DSP_CMX) | 866 | if (dsp_debug & DEBUG_DSP_CMX) |
867 | printk(KERN_DEBUG | 867 | printk(KERN_DEBUG |
868 | "%s no slot available " | 868 | "%s no slot available " |
869 | "for %s & %s\n", __func__, | 869 | "for %s & %s\n", __func__, |
870 | member->dsp->name, | 870 | member->dsp->name, |
871 | nextm->dsp->name); | 871 | nextm->dsp->name); |
872 | /* no more slots available */ | 872 | /* no more slots available */ |
873 | goto conf_software; | 873 | goto conf_software; |
874 | } | 874 | } |
875 | i2 = i1+1; | 875 | i2 = i1 + 1; |
876 | while (i2 < ii) { | 876 | while (i2 < ii) { |
877 | if (freeslots[i2]) | 877 | if (freeslots[i2]) |
878 | break; | 878 | break; |
@@ -881,11 +881,11 @@ conf_software: | |||
881 | if (i2 == ii) { | 881 | if (i2 == ii) { |
882 | if (dsp_debug & DEBUG_DSP_CMX) | 882 | if (dsp_debug & DEBUG_DSP_CMX) |
883 | printk(KERN_DEBUG | 883 | printk(KERN_DEBUG |
884 | "%s no slot available " | 884 | "%s no slot available " |
885 | "for %s & %s\n", | 885 | "for %s & %s\n", |
886 | __func__, | 886 | __func__, |
887 | member->dsp->name, | 887 | member->dsp->name, |
888 | nextm->dsp->name); | 888 | nextm->dsp->name); |
889 | /* no more slots available */ | 889 | /* no more slots available */ |
890 | goto conf_software; | 890 | goto conf_software; |
891 | } | 891 | } |
@@ -900,20 +900,20 @@ conf_software: | |||
900 | nextm->dsp->pcm_bank_tx = 0; | 900 | nextm->dsp->pcm_bank_tx = 0; |
901 | if (dsp_debug & DEBUG_DSP_CMX) | 901 | if (dsp_debug & DEBUG_DSP_CMX) |
902 | printk(KERN_DEBUG | 902 | printk(KERN_DEBUG |
903 | "%s adding %s & %s to new PCM slot %d " | 903 | "%s adding %s & %s to new PCM slot %d " |
904 | "(TX) %d (RX) on same chip or one bank " | 904 | "(TX) %d (RX) on same chip or one bank " |
905 | "PCM, because both members have not " | 905 | "PCM, because both members have not " |
906 | "crossed slots\n", __func__, | 906 | "crossed slots\n", __func__, |
907 | member->dsp->name, | 907 | member->dsp->name, |
908 | nextm->dsp->name, | 908 | nextm->dsp->name, |
909 | member->dsp->pcm_slot_tx, | 909 | member->dsp->pcm_slot_tx, |
910 | member->dsp->pcm_slot_rx); | 910 | member->dsp->pcm_slot_rx); |
911 | dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, | 911 | dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, |
912 | member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, | 912 | member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, |
913 | member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); | 913 | member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); |
914 | dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, | 914 | dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, |
915 | nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, | 915 | nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, |
916 | nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); | 916 | nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); |
917 | conf->hardware = 1; | 917 | conf->hardware = 1; |
918 | conf->software = tx_data; | 918 | conf->software = tx_data; |
919 | return; | 919 | return; |
@@ -929,10 +929,10 @@ conf_software: | |||
929 | if (same_hfc < 0) { | 929 | if (same_hfc < 0) { |
930 | if (dsp_debug & DEBUG_DSP_CMX) | 930 | if (dsp_debug & DEBUG_DSP_CMX) |
931 | printk(KERN_DEBUG | 931 | printk(KERN_DEBUG |
932 | "%s conference %d cannot be formed, because " | 932 | "%s conference %d cannot be formed, because " |
933 | "members are on different chips or not " | 933 | "members are on different chips or not " |
934 | "on HFC chip\n", | 934 | "on HFC chip\n", |
935 | __func__, conf->id); | 935 | __func__, conf->id); |
936 | goto conf_software; | 936 | goto conf_software; |
937 | } | 937 | } |
938 | 938 | ||
@@ -946,7 +946,7 @@ conf_software: | |||
946 | * if there is an existing conference, but not all members have joined | 946 | * if there is an existing conference, but not all members have joined |
947 | */ | 947 | */ |
948 | if (current_conf >= 0) { | 948 | if (current_conf >= 0) { |
949 | join_members: | 949 | join_members: |
950 | list_for_each_entry(member, &conf->mlist, list) { | 950 | list_for_each_entry(member, &conf->mlist, list) { |
951 | /* if no conference engine on our chip, change to | 951 | /* if no conference engine on our chip, change to |
952 | * software */ | 952 | * software */ |
@@ -966,10 +966,10 @@ join_members: | |||
966 | * slot will be overwritten. | 966 | * slot will be overwritten. |
967 | */ | 967 | */ |
968 | if ( | 968 | if ( |
969 | dsp != member->dsp && | 969 | dsp != member->dsp && |
970 | /* dsp must be on the same PCM */ | 970 | /* dsp must be on the same PCM */ |
971 | member->dsp->features.pcm_id == | 971 | member->dsp->features.pcm_id == |
972 | dsp->features.pcm_id) { | 972 | dsp->features.pcm_id) { |
973 | /* dsp must be on a slot */ | 973 | /* dsp must be on a slot */ |
974 | if (dsp->pcm_slot_tx >= 0 && | 974 | if (dsp->pcm_slot_tx >= 0 && |
975 | dsp->pcm_slot_tx < | 975 | dsp->pcm_slot_tx < |
@@ -992,16 +992,16 @@ join_members: | |||
992 | /* no more slots available */ | 992 | /* no more slots available */ |
993 | if (dsp_debug & DEBUG_DSP_CMX) | 993 | if (dsp_debug & DEBUG_DSP_CMX) |
994 | printk(KERN_DEBUG | 994 | printk(KERN_DEBUG |
995 | "%s conference %d cannot be formed," | 995 | "%s conference %d cannot be formed," |
996 | " because no slot free\n", | 996 | " because no slot free\n", |
997 | __func__, conf->id); | 997 | __func__, conf->id); |
998 | goto conf_software; | 998 | goto conf_software; |
999 | } | 999 | } |
1000 | if (dsp_debug & DEBUG_DSP_CMX) | 1000 | if (dsp_debug & DEBUG_DSP_CMX) |
1001 | printk(KERN_DEBUG | 1001 | printk(KERN_DEBUG |
1002 | "%s changing dsp %s to HW conference " | 1002 | "%s changing dsp %s to HW conference " |
1003 | "%d slot %d\n", __func__, | 1003 | "%d slot %d\n", __func__, |
1004 | member->dsp->name, current_conf, i); | 1004 | member->dsp->name, current_conf, i); |
1005 | /* assign free slot & set PCM & join conf */ | 1005 | /* assign free slot & set PCM & join conf */ |
1006 | member->dsp->pcm_slot_tx = i; | 1006 | member->dsp->pcm_slot_tx = i; |
1007 | member->dsp->pcm_slot_rx = i; | 1007 | member->dsp->pcm_slot_rx = i; |
@@ -1009,9 +1009,9 @@ join_members: | |||
1009 | member->dsp->pcm_bank_rx = 2; | 1009 | member->dsp->pcm_bank_rx = 2; |
1010 | member->dsp->hfc_conf = current_conf; | 1010 | member->dsp->hfc_conf = current_conf; |
1011 | dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, | 1011 | dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, |
1012 | i, 2, i, 2); | 1012 | i, 2, i, 2); |
1013 | dsp_cmx_hw_message(member->dsp, | 1013 | dsp_cmx_hw_message(member->dsp, |
1014 | MISDN_CTRL_HFC_CONF_JOIN, current_conf, 0, 0, 0); | 1014 | MISDN_CTRL_HFC_CONF_JOIN, current_conf, 0, 0, 0); |
1015 | } | 1015 | } |
1016 | return; | 1016 | return; |
1017 | } | 1017 | } |
@@ -1040,9 +1040,9 @@ join_members: | |||
1040 | /* no more conferences available */ | 1040 | /* no more conferences available */ |
1041 | if (dsp_debug & DEBUG_DSP_CMX) | 1041 | if (dsp_debug & DEBUG_DSP_CMX) |
1042 | printk(KERN_DEBUG | 1042 | printk(KERN_DEBUG |
1043 | "%s conference %d cannot be formed, because " | 1043 | "%s conference %d cannot be formed, because " |
1044 | "no conference number free\n", | 1044 | "no conference number free\n", |
1045 | __func__, conf->id); | 1045 | __func__, conf->id); |
1046 | goto conf_software; | 1046 | goto conf_software; |
1047 | } | 1047 | } |
1048 | /* join all members */ | 1048 | /* join all members */ |
@@ -1070,7 +1070,7 @@ dsp_cmx_conf(struct dsp *dsp, u32 conf_id) | |||
1070 | if (dsp->conf_id) { | 1070 | if (dsp->conf_id) { |
1071 | if (dsp_debug & DEBUG_DSP_CMX) | 1071 | if (dsp_debug & DEBUG_DSP_CMX) |
1072 | printk(KERN_DEBUG "removing us from conference %d\n", | 1072 | printk(KERN_DEBUG "removing us from conference %d\n", |
1073 | dsp->conf->id); | 1073 | dsp->conf->id); |
1074 | /* remove us from conf */ | 1074 | /* remove us from conf */ |
1075 | conf = dsp->conf; | 1075 | conf = dsp->conf; |
1076 | err = dsp_cmx_del_conf_member(dsp); | 1076 | err = dsp_cmx_del_conf_member(dsp); |
@@ -1085,7 +1085,7 @@ dsp_cmx_conf(struct dsp *dsp, u32 conf_id) | |||
1085 | if (list_empty(&conf->mlist)) { | 1085 | if (list_empty(&conf->mlist)) { |
1086 | if (dsp_debug & DEBUG_DSP_CMX) | 1086 | if (dsp_debug & DEBUG_DSP_CMX) |
1087 | printk(KERN_DEBUG | 1087 | printk(KERN_DEBUG |
1088 | "conference is empty, so we remove it.\n"); | 1088 | "conference is empty, so we remove it.\n"); |
1089 | err = dsp_cmx_del_conf(conf); | 1089 | err = dsp_cmx_del_conf(conf); |
1090 | if (err) | 1090 | if (err) |
1091 | return err; | 1091 | return err; |
@@ -1102,29 +1102,29 @@ dsp_cmx_conf(struct dsp *dsp, u32 conf_id) | |||
1102 | /* now add us to conf */ | 1102 | /* now add us to conf */ |
1103 | if (dsp_debug & DEBUG_DSP_CMX) | 1103 | if (dsp_debug & DEBUG_DSP_CMX) |
1104 | printk(KERN_DEBUG "searching conference %d\n", | 1104 | printk(KERN_DEBUG "searching conference %d\n", |
1105 | conf_id); | 1105 | conf_id); |
1106 | conf = dsp_cmx_search_conf(conf_id); | 1106 | conf = dsp_cmx_search_conf(conf_id); |
1107 | if (!conf) { | 1107 | if (!conf) { |
1108 | if (dsp_debug & DEBUG_DSP_CMX) | 1108 | if (dsp_debug & DEBUG_DSP_CMX) |
1109 | printk(KERN_DEBUG | 1109 | printk(KERN_DEBUG |
1110 | "conference doesn't exist yet, creating.\n"); | 1110 | "conference doesn't exist yet, creating.\n"); |
1111 | /* the conference doesn't exist, so we create */ | 1111 | /* the conference doesn't exist, so we create */ |
1112 | conf = dsp_cmx_new_conf(conf_id); | 1112 | conf = dsp_cmx_new_conf(conf_id); |
1113 | if (!conf) | 1113 | if (!conf) |
1114 | return -EINVAL; | 1114 | return -EINVAL; |
1115 | } else if (!list_empty(&conf->mlist)) { | 1115 | } else if (!list_empty(&conf->mlist)) { |
1116 | member = list_entry(conf->mlist.next, struct dsp_conf_member, | 1116 | member = list_entry(conf->mlist.next, struct dsp_conf_member, |
1117 | list); | 1117 | list); |
1118 | if (dsp->hdlc && !member->dsp->hdlc) { | 1118 | if (dsp->hdlc && !member->dsp->hdlc) { |
1119 | if (dsp_debug & DEBUG_DSP_CMX) | 1119 | if (dsp_debug & DEBUG_DSP_CMX) |
1120 | printk(KERN_DEBUG | 1120 | printk(KERN_DEBUG |
1121 | "cannot join transparent conference.\n"); | 1121 | "cannot join transparent conference.\n"); |
1122 | return -EINVAL; | 1122 | return -EINVAL; |
1123 | } | 1123 | } |
1124 | if (!dsp->hdlc && member->dsp->hdlc) { | 1124 | if (!dsp->hdlc && member->dsp->hdlc) { |
1125 | if (dsp_debug & DEBUG_DSP_CMX) | 1125 | if (dsp_debug & DEBUG_DSP_CMX) |
1126 | printk(KERN_DEBUG | 1126 | printk(KERN_DEBUG |
1127 | "cannot join hdlc conference.\n"); | 1127 | "cannot join hdlc conference.\n"); |
1128 | return -EINVAL; | 1128 | return -EINVAL; |
1129 | } | 1129 | } |
1130 | } | 1130 | } |
@@ -1138,7 +1138,7 @@ dsp_cmx_conf(struct dsp *dsp, u32 conf_id) | |||
1138 | if (list_empty(&conf->mlist)) { | 1138 | if (list_empty(&conf->mlist)) { |
1139 | if (dsp_debug & DEBUG_DSP_CMX) | 1139 | if (dsp_debug & DEBUG_DSP_CMX) |
1140 | printk(KERN_DEBUG | 1140 | printk(KERN_DEBUG |
1141 | "we are alone in this conference, so exit.\n"); | 1141 | "we are alone in this conference, so exit.\n"); |
1142 | /* update hardware */ | 1142 | /* update hardware */ |
1143 | dsp_cmx_hardware(NULL, dsp); | 1143 | dsp_cmx_hardware(NULL, dsp); |
1144 | return 0; | 1144 | return 0; |
@@ -1166,7 +1166,7 @@ showdelay(struct dsp *dsp, int samples, int delay) | |||
1166 | sdelay = delay * 50 / (dsp_poll << 2); | 1166 | sdelay = delay * 50 / (dsp_poll << 2); |
1167 | 1167 | ||
1168 | printk(KERN_DEBUG "DELAY (%s) %3d >%s\n", dsp->name, delay, | 1168 | printk(KERN_DEBUG "DELAY (%s) %3d >%s\n", dsp->name, delay, |
1169 | sdelay > 50 ? "..." : bar + 50 - sdelay); | 1169 | sdelay > 50 ? "..." : bar + 50 - sdelay); |
1170 | } | 1170 | } |
1171 | #endif | 1171 | #endif |
1172 | 1172 | ||
@@ -1188,9 +1188,9 @@ dsp_cmx_receive(struct dsp *dsp, struct sk_buff *skb) | |||
1188 | /* half of the buffer should be larger than maximum packet size */ | 1188 | /* half of the buffer should be larger than maximum packet size */ |
1189 | if (len >= CMX_BUFF_HALF) { | 1189 | if (len >= CMX_BUFF_HALF) { |
1190 | printk(KERN_ERR | 1190 | printk(KERN_ERR |
1191 | "%s line %d: packet from card is too large (%d bytes). " | 1191 | "%s line %d: packet from card is too large (%d bytes). " |
1192 | "please make card send smaller packets OR increase " | 1192 | "please make card send smaller packets OR increase " |
1193 | "CMX_BUFF_SIZE\n", __FILE__, __LINE__, len); | 1193 | "CMX_BUFF_SIZE\n", __FILE__, __LINE__, len); |
1194 | return; | 1194 | return; |
1195 | } | 1195 | } |
1196 | 1196 | ||
@@ -1228,9 +1228,9 @@ dsp_cmx_receive(struct dsp *dsp, struct sk_buff *skb) | |||
1228 | if (((dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK) >= CMX_BUFF_HALF) { | 1228 | if (((dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK) >= CMX_BUFF_HALF) { |
1229 | if (dsp_debug & DEBUG_DSP_CLOCK) | 1229 | if (dsp_debug & DEBUG_DSP_CLOCK) |
1230 | printk(KERN_DEBUG | 1230 | printk(KERN_DEBUG |
1231 | "cmx_receive(dsp=%lx): UNDERRUN (or overrun the " | 1231 | "cmx_receive(dsp=%lx): UNDERRUN (or overrun the " |
1232 | "maximum delay), adjusting read pointer! " | 1232 | "maximum delay), adjusting read pointer! " |
1233 | "(inst %s)\n", (u_long)dsp, dsp->name); | 1233 | "(inst %s)\n", (u_long)dsp, dsp->name); |
1234 | /* flush rx buffer and set delay to dsp_poll / 2 */ | 1234 | /* flush rx buffer and set delay to dsp_poll / 2 */ |
1235 | if (dsp->features.unordered) { | 1235 | if (dsp->features.unordered) { |
1236 | dsp->rx_R = (hh->id & CMX_BUFF_MASK); | 1236 | dsp->rx_R = (hh->id & CMX_BUFF_MASK); |
@@ -1255,27 +1255,27 @@ dsp_cmx_receive(struct dsp *dsp, struct sk_buff *skb) | |||
1255 | (dsp->cmx_delay << 1)) { | 1255 | (dsp->cmx_delay << 1)) { |
1256 | if (dsp_debug & DEBUG_DSP_CLOCK) | 1256 | if (dsp_debug & DEBUG_DSP_CLOCK) |
1257 | printk(KERN_DEBUG | 1257 | printk(KERN_DEBUG |
1258 | "cmx_receive(dsp=%lx): OVERRUN (because " | 1258 | "cmx_receive(dsp=%lx): OVERRUN (because " |
1259 | "twice the delay is reached), adjusting " | 1259 | "twice the delay is reached), adjusting " |
1260 | "read pointer! (inst %s)\n", | 1260 | "read pointer! (inst %s)\n", |
1261 | (u_long)dsp, dsp->name); | 1261 | (u_long)dsp, dsp->name); |
1262 | /* flush buffer */ | 1262 | /* flush buffer */ |
1263 | if (dsp->features.unordered) { | 1263 | if (dsp->features.unordered) { |
1264 | dsp->rx_R = (hh->id & CMX_BUFF_MASK); | 1264 | dsp->rx_R = (hh->id & CMX_BUFF_MASK); |
1265 | dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) | 1265 | dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) |
1266 | & CMX_BUFF_MASK; | 1266 | & CMX_BUFF_MASK; |
1267 | } else { | 1267 | } else { |
1268 | dsp->rx_R = 0; | 1268 | dsp->rx_R = 0; |
1269 | dsp->rx_W = dsp->cmx_delay; | 1269 | dsp->rx_W = dsp->cmx_delay; |
1270 | } | ||
1271 | memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); | ||
1270 | } | 1272 | } |
1271 | memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); | ||
1272 | } | ||
1273 | 1273 | ||
1274 | /* show where to write */ | 1274 | /* show where to write */ |
1275 | #ifdef CMX_DEBUG | 1275 | #ifdef CMX_DEBUG |
1276 | printk(KERN_DEBUG | 1276 | printk(KERN_DEBUG |
1277 | "cmx_receive(dsp=%lx): rx_R(dsp)=%05x rx_W(dsp)=%05x len=%d %s\n", | 1277 | "cmx_receive(dsp=%lx): rx_R(dsp)=%05x rx_W(dsp)=%05x len=%d %s\n", |
1278 | (u_long)dsp, dsp->rx_R, dsp->rx_W, len, dsp->name); | 1278 | (u_long)dsp, dsp->rx_R, dsp->rx_W, len, dsp->name); |
1279 | #endif | 1279 | #endif |
1280 | 1280 | ||
1281 | /* write data into rx_buffer */ | 1281 | /* write data into rx_buffer */ |
@@ -1290,7 +1290,7 @@ dsp_cmx_receive(struct dsp *dsp, struct sk_buff *skb) | |||
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | /* increase write-pointer */ | 1292 | /* increase write-pointer */ |
1293 | dsp->rx_W = ((dsp->rx_W+len) & CMX_BUFF_MASK); | 1293 | dsp->rx_W = ((dsp->rx_W + len) & CMX_BUFF_MASK); |
1294 | #ifdef CMX_DELAY_DEBUG | 1294 | #ifdef CMX_DELAY_DEBUG |
1295 | showdelay(dsp, len, (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK); | 1295 | showdelay(dsp, len, (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK); |
1296 | #endif | 1296 | #endif |
@@ -1319,7 +1319,7 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1319 | return; | 1319 | return; |
1320 | } | 1320 | } |
1321 | if (((dsp->conf && dsp->conf->hardware) || /* hardware conf */ | 1321 | if (((dsp->conf && dsp->conf->hardware) || /* hardware conf */ |
1322 | dsp->echo.hardware) && /* OR hardware echo */ | 1322 | dsp->echo.hardware) && /* OR hardware echo */ |
1323 | dsp->tx_R == dsp->tx_W && /* AND no tx-data */ | 1323 | dsp->tx_R == dsp->tx_W && /* AND no tx-data */ |
1324 | !(dsp->tone.tone && dsp->tone.software)) { /* AND not soft tones */ | 1324 | !(dsp->tone.tone && dsp->tone.software)) { /* AND not soft tones */ |
1325 | if (!dsp->tx_data) { /* no tx_data for user space required */ | 1325 | if (!dsp->tx_data) { /* no tx_data for user space required */ |
@@ -1334,8 +1334,8 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1334 | 1334 | ||
1335 | #ifdef CMX_DEBUG | 1335 | #ifdef CMX_DEBUG |
1336 | printk(KERN_DEBUG | 1336 | printk(KERN_DEBUG |
1337 | "SEND members=%d dsp=%s, conf=%p, rx_R=%05x rx_W=%05x\n", | 1337 | "SEND members=%d dsp=%s, conf=%p, rx_R=%05x rx_W=%05x\n", |
1338 | members, dsp->name, conf, dsp->rx_R, dsp->rx_W); | 1338 | members, dsp->name, conf, dsp->rx_R, dsp->rx_W); |
1339 | #endif | 1339 | #endif |
1340 | 1340 | ||
1341 | /* preload if we have delay set */ | 1341 | /* preload if we have delay set */ |
@@ -1349,8 +1349,8 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1349 | nskb = mI_alloc_skb(len + preload, GFP_ATOMIC); | 1349 | nskb = mI_alloc_skb(len + preload, GFP_ATOMIC); |
1350 | if (!nskb) { | 1350 | if (!nskb) { |
1351 | printk(KERN_ERR | 1351 | printk(KERN_ERR |
1352 | "FATAL ERROR in mISDN_dsp.o: cannot alloc %d bytes\n", | 1352 | "FATAL ERROR in mISDN_dsp.o: cannot alloc %d bytes\n", |
1353 | len + preload); | 1353 | len + preload); |
1354 | return; | 1354 | return; |
1355 | } | 1355 | } |
1356 | hh = mISDN_HEAD_P(nskb); | 1356 | hh = mISDN_HEAD_P(nskb); |
@@ -1386,22 +1386,22 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1386 | if (!dsp->tx_mix && t != tt) { | 1386 | if (!dsp->tx_mix && t != tt) { |
1387 | /* -> send tx-data and continue when not enough */ | 1387 | /* -> send tx-data and continue when not enough */ |
1388 | #ifdef CMX_TX_DEBUG | 1388 | #ifdef CMX_TX_DEBUG |
1389 | sprintf(debugbuf, "TX sending (%04x-%04x)%p: ", t, tt, p); | 1389 | sprintf(debugbuf, "TX sending (%04x-%04x)%p: ", t, tt, p); |
1390 | #endif | 1390 | #endif |
1391 | while (r != rr && t != tt) { | 1391 | while (r != rr && t != tt) { |
1392 | #ifdef CMX_TX_DEBUG | 1392 | #ifdef CMX_TX_DEBUG |
1393 | if (strlen(debugbuf) < 48) | 1393 | if (strlen(debugbuf) < 48) |
1394 | sprintf(debugbuf+strlen(debugbuf), " %02x", | 1394 | sprintf(debugbuf + strlen(debugbuf), " %02x", |
1395 | p[t]); | 1395 | p[t]); |
1396 | #endif | 1396 | #endif |
1397 | *d++ = p[t]; /* write tx_buff */ | 1397 | *d++ = p[t]; /* write tx_buff */ |
1398 | t = (t+1) & CMX_BUFF_MASK; | 1398 | t = (t + 1) & CMX_BUFF_MASK; |
1399 | r = (r+1) & CMX_BUFF_MASK; | 1399 | r = (r + 1) & CMX_BUFF_MASK; |
1400 | } | 1400 | } |
1401 | if (r == rr) { | 1401 | if (r == rr) { |
1402 | dsp->tx_R = t; | 1402 | dsp->tx_R = t; |
1403 | #ifdef CMX_TX_DEBUG | 1403 | #ifdef CMX_TX_DEBUG |
1404 | printk(KERN_DEBUG "%s\n", debugbuf); | 1404 | printk(KERN_DEBUG "%s\n", debugbuf); |
1405 | #endif | 1405 | #endif |
1406 | goto send_packet; | 1406 | goto send_packet; |
1407 | } | 1407 | } |
@@ -1417,29 +1417,29 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1417 | /* -> send tx-data if available or use 0-volume */ | 1417 | /* -> send tx-data if available or use 0-volume */ |
1418 | while (r != rr && t != tt) { | 1418 | while (r != rr && t != tt) { |
1419 | *d++ = p[t]; /* write tx_buff */ | 1419 | *d++ = p[t]; /* write tx_buff */ |
1420 | t = (t+1) & CMX_BUFF_MASK; | 1420 | t = (t + 1) & CMX_BUFF_MASK; |
1421 | r = (r+1) & CMX_BUFF_MASK; | 1421 | r = (r + 1) & CMX_BUFF_MASK; |
1422 | } | 1422 | } |
1423 | if (r != rr) { | 1423 | if (r != rr) { |
1424 | if (dsp_debug & DEBUG_DSP_CLOCK) | 1424 | if (dsp_debug & DEBUG_DSP_CLOCK) |
1425 | printk(KERN_DEBUG "%s: RX empty\n", | 1425 | printk(KERN_DEBUG "%s: RX empty\n", |
1426 | __func__); | 1426 | __func__); |
1427 | memset(d, dsp_silence, (rr-r)&CMX_BUFF_MASK); | 1427 | memset(d, dsp_silence, (rr - r) & CMX_BUFF_MASK); |
1428 | } | 1428 | } |
1429 | /* -> if echo is enabled */ | 1429 | /* -> if echo is enabled */ |
1430 | } else { | 1430 | } else { |
1431 | /* | 1431 | /* |
1432 | * -> mix tx-data with echo if available, | 1432 | * -> mix tx-data with echo if available, |
1433 | * or use echo only | 1433 | * or use echo only |
1434 | */ | 1434 | */ |
1435 | while (r != rr && t != tt) { | 1435 | while (r != rr && t != tt) { |
1436 | *d++ = dsp_audio_mix_law[(p[t]<<8)|q[r]]; | 1436 | *d++ = dsp_audio_mix_law[(p[t] << 8) | q[r]]; |
1437 | t = (t+1) & CMX_BUFF_MASK; | 1437 | t = (t + 1) & CMX_BUFF_MASK; |
1438 | r = (r+1) & CMX_BUFF_MASK; | 1438 | r = (r + 1) & CMX_BUFF_MASK; |
1439 | } | 1439 | } |
1440 | while (r != rr) { | 1440 | while (r != rr) { |
1441 | *d++ = q[r]; /* echo */ | 1441 | *d++ = q[r]; /* echo */ |
1442 | r = (r+1) & CMX_BUFF_MASK; | 1442 | r = (r + 1) & CMX_BUFF_MASK; |
1443 | } | 1443 | } |
1444 | } | 1444 | } |
1445 | dsp->tx_R = t; | 1445 | dsp->tx_R = t; |
@@ -1449,63 +1449,63 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1449 | #ifdef CMX_CONF_DEBUG | 1449 | #ifdef CMX_CONF_DEBUG |
1450 | if (0) { | 1450 | if (0) { |
1451 | #else | 1451 | #else |
1452 | if (members == 2) { | 1452 | if (members == 2) { |
1453 | #endif | 1453 | #endif |
1454 | /* "other" becomes other party */ | 1454 | /* "other" becomes other party */ |
1455 | other = (list_entry(conf->mlist.next, | 1455 | other = (list_entry(conf->mlist.next, |
1456 | struct dsp_conf_member, list))->dsp; | 1456 | struct dsp_conf_member, list))->dsp; |
1457 | if (other == member) | 1457 | if (other == member) |
1458 | other = (list_entry(conf->mlist.prev, | 1458 | other = (list_entry(conf->mlist.prev, |
1459 | struct dsp_conf_member, list))->dsp; | 1459 | struct dsp_conf_member, list))->dsp; |
1460 | o_q = other->rx_buff; /* received data */ | 1460 | o_q = other->rx_buff; /* received data */ |
1461 | o_rr = (other->rx_R + len) & CMX_BUFF_MASK; | 1461 | o_rr = (other->rx_R + len) & CMX_BUFF_MASK; |
1462 | /* end of rx-pointer */ | 1462 | /* end of rx-pointer */ |
1463 | o_r = (o_rr - rr + r) & CMX_BUFF_MASK; | 1463 | o_r = (o_rr - rr + r) & CMX_BUFF_MASK; |
1464 | /* start rx-pointer at current read position*/ | 1464 | /* start rx-pointer at current read position*/ |
1465 | /* -> if echo is NOT enabled */ | 1465 | /* -> if echo is NOT enabled */ |
1466 | if (!dsp->echo.software) { | 1466 | if (!dsp->echo.software) { |
1467 | /* | 1467 | /* |
1468 | * -> copy other member's rx-data, | 1468 | * -> copy other member's rx-data, |
1469 | * if tx-data is available, mix | 1469 | * if tx-data is available, mix |
1470 | */ | 1470 | */ |
1471 | while (o_r != o_rr && t != tt) { | 1471 | while (o_r != o_rr && t != tt) { |
1472 | *d++ = dsp_audio_mix_law[(p[t]<<8)|o_q[o_r]]; | 1472 | *d++ = dsp_audio_mix_law[(p[t] << 8) | o_q[o_r]]; |
1473 | t = (t+1) & CMX_BUFF_MASK; | 1473 | t = (t + 1) & CMX_BUFF_MASK; |
1474 | o_r = (o_r+1) & CMX_BUFF_MASK; | 1474 | o_r = (o_r + 1) & CMX_BUFF_MASK; |
1475 | } | 1475 | } |
1476 | while (o_r != o_rr) { | 1476 | while (o_r != o_rr) { |
1477 | *d++ = o_q[o_r]; | 1477 | *d++ = o_q[o_r]; |
1478 | o_r = (o_r+1) & CMX_BUFF_MASK; | 1478 | o_r = (o_r + 1) & CMX_BUFF_MASK; |
1479 | } | 1479 | } |
1480 | /* -> if echo is enabled */ | 1480 | /* -> if echo is enabled */ |
1481 | } else { | 1481 | } else { |
1482 | /* | 1482 | /* |
1483 | * -> mix other member's rx-data with echo, | 1483 | * -> mix other member's rx-data with echo, |
1484 | * if tx-data is available, mix | 1484 | * if tx-data is available, mix |
1485 | */ | 1485 | */ |
1486 | while (r != rr && t != tt) { | 1486 | while (r != rr && t != tt) { |
1487 | sample = dsp_audio_law_to_s32[p[t]] + | 1487 | sample = dsp_audio_law_to_s32[p[t]] + |
1488 | dsp_audio_law_to_s32[q[r]] + | 1488 | dsp_audio_law_to_s32[q[r]] + |
1489 | dsp_audio_law_to_s32[o_q[o_r]]; | 1489 | dsp_audio_law_to_s32[o_q[o_r]]; |
1490 | if (sample < -32768) | 1490 | if (sample < -32768) |
1491 | sample = -32768; | 1491 | sample = -32768; |
1492 | else if (sample > 32767) | 1492 | else if (sample > 32767) |
1493 | sample = 32767; | 1493 | sample = 32767; |
1494 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; | 1494 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; |
1495 | /* tx-data + rx_data + echo */ | 1495 | /* tx-data + rx_data + echo */ |
1496 | t = (t+1) & CMX_BUFF_MASK; | 1496 | t = (t + 1) & CMX_BUFF_MASK; |
1497 | r = (r+1) & CMX_BUFF_MASK; | 1497 | r = (r + 1) & CMX_BUFF_MASK; |
1498 | o_r = (o_r+1) & CMX_BUFF_MASK; | 1498 | o_r = (o_r + 1) & CMX_BUFF_MASK; |
1499 | } | 1499 | } |
1500 | while (r != rr) { | 1500 | while (r != rr) { |
1501 | *d++ = dsp_audio_mix_law[(q[r]<<8)|o_q[o_r]]; | 1501 | *d++ = dsp_audio_mix_law[(q[r] << 8) | o_q[o_r]]; |
1502 | r = (r+1) & CMX_BUFF_MASK; | 1502 | r = (r + 1) & CMX_BUFF_MASK; |
1503 | o_r = (o_r+1) & CMX_BUFF_MASK; | 1503 | o_r = (o_r + 1) & CMX_BUFF_MASK; |
1504 | } | ||
1504 | } | 1505 | } |
1506 | dsp->tx_R = t; | ||
1507 | goto send_packet; | ||
1505 | } | 1508 | } |
1506 | dsp->tx_R = t; | ||
1507 | goto send_packet; | ||
1508 | } | ||
1509 | #ifdef DSP_NEVER_DEFINED | 1509 | #ifdef DSP_NEVER_DEFINED |
1510 | } | 1510 | } |
1511 | #endif | 1511 | #endif |
@@ -1518,15 +1518,15 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1518 | */ | 1518 | */ |
1519 | while (r != rr && t != tt) { | 1519 | while (r != rr && t != tt) { |
1520 | sample = dsp_audio_law_to_s32[p[t]] + *c++ - | 1520 | sample = dsp_audio_law_to_s32[p[t]] + *c++ - |
1521 | dsp_audio_law_to_s32[q[r]]; | 1521 | dsp_audio_law_to_s32[q[r]]; |
1522 | if (sample < -32768) | 1522 | if (sample < -32768) |
1523 | sample = -32768; | 1523 | sample = -32768; |
1524 | else if (sample > 32767) | 1524 | else if (sample > 32767) |
1525 | sample = 32767; | 1525 | sample = 32767; |
1526 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; | 1526 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; |
1527 | /* conf-rx+tx */ | 1527 | /* conf-rx+tx */ |
1528 | r = (r+1) & CMX_BUFF_MASK; | 1528 | r = (r + 1) & CMX_BUFF_MASK; |
1529 | t = (t+1) & CMX_BUFF_MASK; | 1529 | t = (t + 1) & CMX_BUFF_MASK; |
1530 | } | 1530 | } |
1531 | while (r != rr) { | 1531 | while (r != rr) { |
1532 | sample = *c++ - dsp_audio_law_to_s32[q[r]]; | 1532 | sample = *c++ - dsp_audio_law_to_s32[q[r]]; |
@@ -1535,10 +1535,10 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1535 | else if (sample > 32767) | 1535 | else if (sample > 32767) |
1536 | sample = 32767; | 1536 | sample = 32767; |
1537 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; | 1537 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; |
1538 | /* conf-rx */ | 1538 | /* conf-rx */ |
1539 | r = (r+1) & CMX_BUFF_MASK; | 1539 | r = (r + 1) & CMX_BUFF_MASK; |
1540 | } | 1540 | } |
1541 | /* -> if echo is enabled */ | 1541 | /* -> if echo is enabled */ |
1542 | } else { | 1542 | } else { |
1543 | /* | 1543 | /* |
1544 | * -> encode conf-data, if tx-data | 1544 | * -> encode conf-data, if tx-data |
@@ -1551,9 +1551,9 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1551 | else if (sample > 32767) | 1551 | else if (sample > 32767) |
1552 | sample = 32767; | 1552 | sample = 32767; |
1553 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; | 1553 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; |
1554 | /* conf(echo)+tx */ | 1554 | /* conf(echo)+tx */ |
1555 | t = (t+1) & CMX_BUFF_MASK; | 1555 | t = (t + 1) & CMX_BUFF_MASK; |
1556 | r = (r+1) & CMX_BUFF_MASK; | 1556 | r = (r + 1) & CMX_BUFF_MASK; |
1557 | } | 1557 | } |
1558 | while (r != rr) { | 1558 | while (r != rr) { |
1559 | sample = *c++; | 1559 | sample = *c++; |
@@ -1562,8 +1562,8 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) | |||
1562 | else if (sample > 32767) | 1562 | else if (sample > 32767) |
1563 | sample = 32767; | 1563 | sample = 32767; |
1564 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; | 1564 | *d++ = dsp_audio_s16_to_law[sample & 0xffff]; |
1565 | /* conf(echo) */ | 1565 | /* conf(echo) */ |
1566 | r = (r+1) & CMX_BUFF_MASK; | 1566 | r = (r + 1) & CMX_BUFF_MASK; |
1567 | } | 1567 | } |
1568 | } | 1568 | } |
1569 | dsp->tx_R = t; | 1569 | dsp->tx_R = t; |
@@ -1587,14 +1587,14 @@ send_packet: | |||
1587 | txskb = mI_alloc_skb(len, GFP_ATOMIC); | 1587 | txskb = mI_alloc_skb(len, GFP_ATOMIC); |
1588 | if (!txskb) { | 1588 | if (!txskb) { |
1589 | printk(KERN_ERR | 1589 | printk(KERN_ERR |
1590 | "FATAL ERROR in mISDN_dsp.o: " | 1590 | "FATAL ERROR in mISDN_dsp.o: " |
1591 | "cannot alloc %d bytes\n", len); | 1591 | "cannot alloc %d bytes\n", len); |
1592 | } else { | 1592 | } else { |
1593 | thh = mISDN_HEAD_P(txskb); | 1593 | thh = mISDN_HEAD_P(txskb); |
1594 | thh->prim = DL_DATA_REQ; | 1594 | thh->prim = DL_DATA_REQ; |
1595 | thh->id = 0; | 1595 | thh->id = 0; |
1596 | memcpy(skb_put(txskb, len), nskb->data+preload, | 1596 | memcpy(skb_put(txskb, len), nskb->data + preload, |
1597 | len); | 1597 | len); |
1598 | /* queue (trigger later) */ | 1598 | /* queue (trigger later) */ |
1599 | skb_queue_tail(&dsp->sendq, txskb); | 1599 | skb_queue_tail(&dsp->sendq, txskb); |
1600 | } | 1600 | } |
@@ -1608,7 +1608,7 @@ send_packet: | |||
1608 | /* pipeline */ | 1608 | /* pipeline */ |
1609 | if (dsp->pipeline.inuse) | 1609 | if (dsp->pipeline.inuse) |
1610 | dsp_pipeline_process_tx(&dsp->pipeline, nskb->data, | 1610 | dsp_pipeline_process_tx(&dsp->pipeline, nskb->data, |
1611 | nskb->len); | 1611 | nskb->len); |
1612 | /* crypt */ | 1612 | /* crypt */ |
1613 | if (dsp->bf_enable) | 1613 | if (dsp->bf_enable) |
1614 | dsp_bf_encrypt(dsp, nskb->data, nskb->len); | 1614 | dsp_bf_encrypt(dsp, nskb->data, nskb->len); |
@@ -1621,7 +1621,7 @@ static u32 jittercount; /* counter for jitter check */ | |||
1621 | struct timer_list dsp_spl_tl; | 1621 | struct timer_list dsp_spl_tl; |
1622 | u32 dsp_spl_jiffies; /* calculate the next time to fire */ | 1622 | u32 dsp_spl_jiffies; /* calculate the next time to fire */ |
1623 | static u16 dsp_count; /* last sample count */ | 1623 | static u16 dsp_count; /* last sample count */ |
1624 | static int dsp_count_valid ; /* if we have last sample count */ | 1624 | static int dsp_count_valid; /* if we have last sample count */ |
1625 | 1625 | ||
1626 | void | 1626 | void |
1627 | dsp_cmx_send(void *arg) | 1627 | dsp_cmx_send(void *arg) |
@@ -1630,7 +1630,7 @@ dsp_cmx_send(void *arg) | |||
1630 | struct dsp_conf_member *member; | 1630 | struct dsp_conf_member *member; |
1631 | struct dsp *dsp; | 1631 | struct dsp *dsp; |
1632 | int mustmix, members; | 1632 | int mustmix, members; |
1633 | static s32 mixbuffer[MAX_POLL+100]; | 1633 | static s32 mixbuffer[MAX_POLL + 100]; |
1634 | s32 *c; | 1634 | s32 *c; |
1635 | u8 *p, *q; | 1635 | u8 *p, *q; |
1636 | int r, rr; | 1636 | int r, rr; |
@@ -1675,9 +1675,9 @@ dsp_cmx_send(void *arg) | |||
1675 | #ifdef CMX_CONF_DEBUG | 1675 | #ifdef CMX_CONF_DEBUG |
1676 | if (conf->software && members > 1) | 1676 | if (conf->software && members > 1) |
1677 | #else | 1677 | #else |
1678 | if (conf->software && members > 2) | 1678 | if (conf->software && members > 2) |
1679 | #endif | 1679 | #endif |
1680 | mustmix = 1; | 1680 | mustmix = 1; |
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | /* transmission required */ | 1683 | /* transmission required */ |
@@ -1698,265 +1698,263 @@ dsp_cmx_send(void *arg) | |||
1698 | #ifdef CMX_CONF_DEBUG | 1698 | #ifdef CMX_CONF_DEBUG |
1699 | if (conf->software && members > 1) { | 1699 | if (conf->software && members > 1) { |
1700 | #else | 1700 | #else |
1701 | if (conf->software && members > 2) { | 1701 | if (conf->software && members > 2) { |
1702 | #endif | 1702 | #endif |
1703 | /* check for hdlc conf */ | 1703 | /* check for hdlc conf */ |
1704 | member = list_entry(conf->mlist.next, | 1704 | member = list_entry(conf->mlist.next, |
1705 | struct dsp_conf_member, list); | 1705 | struct dsp_conf_member, list); |
1706 | if (member->dsp->hdlc) | 1706 | if (member->dsp->hdlc) |
1707 | continue; | 1707 | continue; |
1708 | /* mix all data */ | 1708 | /* mix all data */ |
1709 | memset(mixbuffer, 0, length*sizeof(s32)); | 1709 | memset(mixbuffer, 0, length * sizeof(s32)); |
1710 | list_for_each_entry(member, &conf->mlist, list) { | 1710 | list_for_each_entry(member, &conf->mlist, list) { |
1711 | dsp = member->dsp; | 1711 | dsp = member->dsp; |
1712 | /* get range of data to mix */ | 1712 | /* get range of data to mix */ |
1713 | c = mixbuffer; | 1713 | c = mixbuffer; |
1714 | q = dsp->rx_buff; | 1714 | q = dsp->rx_buff; |
1715 | r = dsp->rx_R; | 1715 | r = dsp->rx_R; |
1716 | rr = (r + length) & CMX_BUFF_MASK; | 1716 | rr = (r + length) & CMX_BUFF_MASK; |
1717 | /* add member's data */ | 1717 | /* add member's data */ |
1718 | while (r != rr) { | 1718 | while (r != rr) { |
1719 | *c++ += dsp_audio_law_to_s32[q[r]]; | 1719 | *c++ += dsp_audio_law_to_s32[q[r]]; |
1720 | r = (r+1) & CMX_BUFF_MASK; | 1720 | r = (r + 1) & CMX_BUFF_MASK; |
1721 | } | ||
1721 | } | 1722 | } |
1722 | } | ||
1723 | |||
1724 | /* process each member */ | ||
1725 | list_for_each_entry(member, &conf->mlist, list) { | ||
1726 | /* transmission */ | ||
1727 | dsp_cmx_send_member(member->dsp, length, | ||
1728 | mixbuffer, members); | ||
1729 | } | ||
1730 | } | ||
1731 | } | ||
1732 | 1723 | ||
1733 | /* delete rx-data, increment buffers, change pointers */ | 1724 | /* process each member */ |
1734 | list_for_each_entry(dsp, &dsp_ilist, list) { | 1725 | list_for_each_entry(member, &conf->mlist, list) { |
1735 | if (dsp->hdlc) | 1726 | /* transmission */ |
1736 | continue; | 1727 | dsp_cmx_send_member(member->dsp, length, |
1737 | p = dsp->rx_buff; | 1728 | mixbuffer, members); |
1738 | q = dsp->tx_buff; | 1729 | } |
1739 | r = dsp->rx_R; | ||
1740 | /* move receive pointer when receiving */ | ||
1741 | if (!dsp->rx_is_off) { | ||
1742 | rr = (r + length) & CMX_BUFF_MASK; | ||
1743 | /* delete rx-data */ | ||
1744 | while (r != rr) { | ||
1745 | p[r] = dsp_silence; | ||
1746 | r = (r+1) & CMX_BUFF_MASK; | ||
1747 | } | 1730 | } |
1748 | /* increment rx-buffer pointer */ | ||
1749 | dsp->rx_R = r; /* write incremented read pointer */ | ||
1750 | } | 1731 | } |
1751 | 1732 | ||
1752 | /* check current rx_delay */ | 1733 | /* delete rx-data, increment buffers, change pointers */ |
1753 | delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK; | 1734 | list_for_each_entry(dsp, &dsp_ilist, list) { |
1754 | if (delay >= CMX_BUFF_HALF) | 1735 | if (dsp->hdlc) |
1755 | delay = 0; /* will be the delay before next write */ | 1736 | continue; |
1756 | /* check for lower delay */ | 1737 | p = dsp->rx_buff; |
1757 | if (delay < dsp->rx_delay[0]) | 1738 | q = dsp->tx_buff; |
1758 | dsp->rx_delay[0] = delay; | 1739 | r = dsp->rx_R; |
1759 | /* check current tx_delay */ | 1740 | /* move receive pointer when receiving */ |
1760 | delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK; | 1741 | if (!dsp->rx_is_off) { |
1761 | if (delay >= CMX_BUFF_HALF) | 1742 | rr = (r + length) & CMX_BUFF_MASK; |
1762 | delay = 0; /* will be the delay before next write */ | ||
1763 | /* check for lower delay */ | ||
1764 | if (delay < dsp->tx_delay[0]) | ||
1765 | dsp->tx_delay[0] = delay; | ||
1766 | if (jittercheck) { | ||
1767 | /* find the lowest of all rx_delays */ | ||
1768 | delay = dsp->rx_delay[0]; | ||
1769 | i = 1; | ||
1770 | while (i < MAX_SECONDS_JITTER_CHECK) { | ||
1771 | if (delay > dsp->rx_delay[i]) | ||
1772 | delay = dsp->rx_delay[i]; | ||
1773 | i++; | ||
1774 | } | ||
1775 | /* | ||
1776 | * remove rx_delay only if we have delay AND we | ||
1777 | * have not preset cmx_delay AND | ||
1778 | * the delay is greater dsp_poll | ||
1779 | */ | ||
1780 | if (delay > dsp_poll && !dsp->cmx_delay) { | ||
1781 | if (dsp_debug & DEBUG_DSP_CLOCK) | ||
1782 | printk(KERN_DEBUG | ||
1783 | "%s lowest rx_delay of %d bytes for" | ||
1784 | " dsp %s are now removed.\n", | ||
1785 | __func__, delay, | ||
1786 | dsp->name); | ||
1787 | r = dsp->rx_R; | ||
1788 | rr = (r + delay - (dsp_poll >> 1)) | ||
1789 | & CMX_BUFF_MASK; | ||
1790 | /* delete rx-data */ | 1743 | /* delete rx-data */ |
1791 | while (r != rr) { | 1744 | while (r != rr) { |
1792 | p[r] = dsp_silence; | 1745 | p[r] = dsp_silence; |
1793 | r = (r+1) & CMX_BUFF_MASK; | 1746 | r = (r + 1) & CMX_BUFF_MASK; |
1794 | } | 1747 | } |
1795 | /* increment rx-buffer pointer */ | 1748 | /* increment rx-buffer pointer */ |
1796 | dsp->rx_R = r; | 1749 | dsp->rx_R = r; /* write incremented read pointer */ |
1797 | /* write incremented read pointer */ | ||
1798 | } | ||
1799 | /* find the lowest of all tx_delays */ | ||
1800 | delay = dsp->tx_delay[0]; | ||
1801 | i = 1; | ||
1802 | while (i < MAX_SECONDS_JITTER_CHECK) { | ||
1803 | if (delay > dsp->tx_delay[i]) | ||
1804 | delay = dsp->tx_delay[i]; | ||
1805 | i++; | ||
1806 | } | 1750 | } |
1807 | /* | 1751 | |
1808 | * remove delay only if we have delay AND we | 1752 | /* check current rx_delay */ |
1809 | * have enabled tx_dejitter | 1753 | delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK; |
1810 | */ | 1754 | if (delay >= CMX_BUFF_HALF) |
1811 | if (delay > dsp_poll && dsp->tx_dejitter) { | 1755 | delay = 0; /* will be the delay before next write */ |
1812 | if (dsp_debug & DEBUG_DSP_CLOCK) | 1756 | /* check for lower delay */ |
1813 | printk(KERN_DEBUG | 1757 | if (delay < dsp->rx_delay[0]) |
1814 | "%s lowest tx_delay of %d bytes for" | 1758 | dsp->rx_delay[0] = delay; |
1815 | " dsp %s are now removed.\n", | 1759 | /* check current tx_delay */ |
1816 | __func__, delay, | 1760 | delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK; |
1817 | dsp->name); | 1761 | if (delay >= CMX_BUFF_HALF) |
1818 | r = dsp->tx_R; | 1762 | delay = 0; /* will be the delay before next write */ |
1819 | rr = (r + delay - (dsp_poll >> 1)) | 1763 | /* check for lower delay */ |
1820 | & CMX_BUFF_MASK; | 1764 | if (delay < dsp->tx_delay[0]) |
1821 | /* delete tx-data */ | 1765 | dsp->tx_delay[0] = delay; |
1822 | while (r != rr) { | 1766 | if (jittercheck) { |
1823 | q[r] = dsp_silence; | 1767 | /* find the lowest of all rx_delays */ |
1824 | r = (r+1) & CMX_BUFF_MASK; | 1768 | delay = dsp->rx_delay[0]; |
1769 | i = 1; | ||
1770 | while (i < MAX_SECONDS_JITTER_CHECK) { | ||
1771 | if (delay > dsp->rx_delay[i]) | ||
1772 | delay = dsp->rx_delay[i]; | ||
1773 | i++; | ||
1825 | } | 1774 | } |
1826 | /* increment rx-buffer pointer */ | 1775 | /* |
1827 | dsp->tx_R = r; | 1776 | * remove rx_delay only if we have delay AND we |
1828 | /* write incremented read pointer */ | 1777 | * have not preset cmx_delay AND |
1829 | } | 1778 | * the delay is greater dsp_poll |
1830 | /* scroll up delays */ | 1779 | */ |
1831 | i = MAX_SECONDS_JITTER_CHECK - 1; | 1780 | if (delay > dsp_poll && !dsp->cmx_delay) { |
1832 | while (i) { | 1781 | if (dsp_debug & DEBUG_DSP_CLOCK) |
1833 | dsp->rx_delay[i] = dsp->rx_delay[i-1]; | 1782 | printk(KERN_DEBUG |
1834 | dsp->tx_delay[i] = dsp->tx_delay[i-1]; | 1783 | "%s lowest rx_delay of %d bytes for" |
1835 | i--; | 1784 | " dsp %s are now removed.\n", |
1785 | __func__, delay, | ||
1786 | dsp->name); | ||
1787 | r = dsp->rx_R; | ||
1788 | rr = (r + delay - (dsp_poll >> 1)) | ||
1789 | & CMX_BUFF_MASK; | ||
1790 | /* delete rx-data */ | ||
1791 | while (r != rr) { | ||
1792 | p[r] = dsp_silence; | ||
1793 | r = (r + 1) & CMX_BUFF_MASK; | ||
1794 | } | ||
1795 | /* increment rx-buffer pointer */ | ||
1796 | dsp->rx_R = r; | ||
1797 | /* write incremented read pointer */ | ||
1798 | } | ||
1799 | /* find the lowest of all tx_delays */ | ||
1800 | delay = dsp->tx_delay[0]; | ||
1801 | i = 1; | ||
1802 | while (i < MAX_SECONDS_JITTER_CHECK) { | ||
1803 | if (delay > dsp->tx_delay[i]) | ||
1804 | delay = dsp->tx_delay[i]; | ||
1805 | i++; | ||
1806 | } | ||
1807 | /* | ||
1808 | * remove delay only if we have delay AND we | ||
1809 | * have enabled tx_dejitter | ||
1810 | */ | ||
1811 | if (delay > dsp_poll && dsp->tx_dejitter) { | ||
1812 | if (dsp_debug & DEBUG_DSP_CLOCK) | ||
1813 | printk(KERN_DEBUG | ||
1814 | "%s lowest tx_delay of %d bytes for" | ||
1815 | " dsp %s are now removed.\n", | ||
1816 | __func__, delay, | ||
1817 | dsp->name); | ||
1818 | r = dsp->tx_R; | ||
1819 | rr = (r + delay - (dsp_poll >> 1)) | ||
1820 | & CMX_BUFF_MASK; | ||
1821 | /* delete tx-data */ | ||
1822 | while (r != rr) { | ||
1823 | q[r] = dsp_silence; | ||
1824 | r = (r + 1) & CMX_BUFF_MASK; | ||
1825 | } | ||
1826 | /* increment rx-buffer pointer */ | ||
1827 | dsp->tx_R = r; | ||
1828 | /* write incremented read pointer */ | ||
1829 | } | ||
1830 | /* scroll up delays */ | ||
1831 | i = MAX_SECONDS_JITTER_CHECK - 1; | ||
1832 | while (i) { | ||
1833 | dsp->rx_delay[i] = dsp->rx_delay[i - 1]; | ||
1834 | dsp->tx_delay[i] = dsp->tx_delay[i - 1]; | ||
1835 | i--; | ||
1836 | } | ||
1837 | dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ | ||
1838 | dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ | ||
1836 | } | 1839 | } |
1837 | dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ | ||
1838 | dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ | ||
1839 | } | 1840 | } |
1840 | } | ||
1841 | 1841 | ||
1842 | /* if next event would be in the past ... */ | 1842 | /* if next event would be in the past ... */ |
1843 | if ((s32)(dsp_spl_jiffies+dsp_tics-jiffies) <= 0) | 1843 | if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0) |
1844 | dsp_spl_jiffies = jiffies + 1; | 1844 | dsp_spl_jiffies = jiffies + 1; |
1845 | else | 1845 | else |
1846 | dsp_spl_jiffies += dsp_tics; | 1846 | dsp_spl_jiffies += dsp_tics; |
1847 | 1847 | ||
1848 | dsp_spl_tl.expires = dsp_spl_jiffies; | 1848 | dsp_spl_tl.expires = dsp_spl_jiffies; |
1849 | add_timer(&dsp_spl_tl); | 1849 | add_timer(&dsp_spl_tl); |
1850 | 1850 | ||
1851 | /* unlock */ | 1851 | /* unlock */ |
1852 | spin_unlock_irqrestore(&dsp_lock, flags); | 1852 | spin_unlock_irqrestore(&dsp_lock, flags); |
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | /* | 1855 | /* |
1856 | * audio data is transmitted from upper layer to the dsp | 1856 | * audio data is transmitted from upper layer to the dsp |
1857 | */ | 1857 | */ |
1858 | void | 1858 | void |
1859 | dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb) | 1859 | dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb) |
1860 | { | 1860 | { |
1861 | u_int w, ww; | 1861 | u_int w, ww; |
1862 | u8 *d, *p; | 1862 | u8 *d, *p; |
1863 | int space; /* todo: , l = skb->len; */ | 1863 | int space; /* todo: , l = skb->len; */ |
1864 | #ifdef CMX_TX_DEBUG | 1864 | #ifdef CMX_TX_DEBUG |
1865 | char debugbuf[256] = ""; | 1865 | char debugbuf[256] = ""; |
1866 | #endif | 1866 | #endif |
1867 | 1867 | ||
1868 | /* check if there is enough space, and then copy */ | 1868 | /* check if there is enough space, and then copy */ |
1869 | w = dsp->tx_W; | 1869 | w = dsp->tx_W; |
1870 | ww = dsp->tx_R; | 1870 | ww = dsp->tx_R; |
1871 | p = dsp->tx_buff; | 1871 | p = dsp->tx_buff; |
1872 | d = skb->data; | 1872 | d = skb->data; |
1873 | space = (ww - w - 1) & CMX_BUFF_MASK; | 1873 | space = (ww - w - 1) & CMX_BUFF_MASK; |
1874 | /* write-pointer should not overrun nor reach read pointer */ | 1874 | /* write-pointer should not overrun nor reach read pointer */ |
1875 | if (space < skb->len) { | 1875 | if (space < skb->len) { |
1876 | /* write to the space we have left */ | 1876 | /* write to the space we have left */ |
1877 | ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */ | 1877 | ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */ |
1878 | if (dsp_debug & DEBUG_DSP_CLOCK) | 1878 | if (dsp_debug & DEBUG_DSP_CLOCK) |
1879 | printk(KERN_DEBUG "%s: TX overflow space=%d skb->len=" | 1879 | printk(KERN_DEBUG "%s: TX overflow space=%d skb->len=" |
1880 | "%d, w=0x%04x, ww=0x%04x\n", __func__, space, | 1880 | "%d, w=0x%04x, ww=0x%04x\n", __func__, space, |
1881 | skb->len, w, ww); | 1881 | skb->len, w, ww); |
1882 | } else | 1882 | } else |
1883 | /* write until all byte are copied */ | 1883 | /* write until all byte are copied */ |
1884 | ww = (w + skb->len) & CMX_BUFF_MASK; | 1884 | ww = (w + skb->len) & CMX_BUFF_MASK; |
1885 | dsp->tx_W = ww; | 1885 | dsp->tx_W = ww; |
1886 | 1886 | ||
1887 | /* show current buffer */ | 1887 | /* show current buffer */ |
1888 | #ifdef CMX_DEBUG | 1888 | #ifdef CMX_DEBUG |
1889 | printk(KERN_DEBUG | 1889 | printk(KERN_DEBUG |
1890 | "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n", | 1890 | "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n", |
1891 | (u_long)dsp, (ww-w)&CMX_BUFF_MASK, w, ww, dsp->name); | 1891 | (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name); |
1892 | #endif | 1892 | #endif |
1893 | 1893 | ||
1894 | /* copy transmit data to tx-buffer */ | 1894 | /* copy transmit data to tx-buffer */ |
1895 | #ifdef CMX_TX_DEBUG | 1895 | #ifdef CMX_TX_DEBUG |
1896 | sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p); | 1896 | sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p); |
1897 | #endif | 1897 | #endif |
1898 | while (w != ww) { | 1898 | while (w != ww) { |
1899 | #ifdef CMX_TX_DEBUG | 1899 | #ifdef CMX_TX_DEBUG |
1900 | if (strlen(debugbuf) < 48) | 1900 | if (strlen(debugbuf) < 48) |
1901 | sprintf(debugbuf+strlen(debugbuf), " %02x", *d); | 1901 | sprintf(debugbuf + strlen(debugbuf), " %02x", *d); |
1902 | #endif | 1902 | #endif |
1903 | p[w] = *d++; | 1903 | p[w] = *d++; |
1904 | w = (w+1) & CMX_BUFF_MASK; | 1904 | w = (w + 1) & CMX_BUFF_MASK; |
1905 | } | 1905 | } |
1906 | #ifdef CMX_TX_DEBUG | 1906 | #ifdef CMX_TX_DEBUG |
1907 | printk(KERN_DEBUG "%s\n", debugbuf); | 1907 | printk(KERN_DEBUG "%s\n", debugbuf); |
1908 | #endif | 1908 | #endif |
1909 | 1909 | ||
1910 | } | 1910 | } |
1911 | 1911 | ||
1912 | /* | 1912 | /* |
1913 | * hdlc data is received from card and sent to all members. | 1913 | * hdlc data is received from card and sent to all members. |
1914 | */ | 1914 | */ |
1915 | void | 1915 | void |
1916 | dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb) | 1916 | dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb) |
1917 | { | 1917 | { |
1918 | struct sk_buff *nskb = NULL; | 1918 | struct sk_buff *nskb = NULL; |
1919 | struct dsp_conf_member *member; | 1919 | struct dsp_conf_member *member; |
1920 | struct mISDNhead *hh; | 1920 | struct mISDNhead *hh; |
1921 | 1921 | ||
1922 | /* not if not active */ | 1922 | /* not if not active */ |
1923 | if (!dsp->b_active) | 1923 | if (!dsp->b_active) |
1924 | return; | 1924 | return; |
1925 | 1925 | ||
1926 | /* check if we have sompen */ | 1926 | /* check if we have sompen */ |
1927 | if (skb->len < 1) | 1927 | if (skb->len < 1) |
1928 | return; | 1928 | return; |
1929 | 1929 | ||
1930 | /* no conf */ | 1930 | /* no conf */ |
1931 | if (!dsp->conf) { | 1931 | if (!dsp->conf) { |
1932 | /* in case of software echo */ | 1932 | /* in case of software echo */ |
1933 | if (dsp->echo.software) { | 1933 | if (dsp->echo.software) { |
1934 | nskb = skb_clone(skb, GFP_ATOMIC); | 1934 | nskb = skb_clone(skb, GFP_ATOMIC); |
1935 | if (nskb) { | 1935 | if (nskb) { |
1936 | hh = mISDN_HEAD_P(nskb); | 1936 | hh = mISDN_HEAD_P(nskb); |
1937 | hh->prim = PH_DATA_REQ; | 1937 | hh->prim = PH_DATA_REQ; |
1938 | hh->id = 0; | 1938 | hh->id = 0; |
1939 | skb_queue_tail(&dsp->sendq, nskb); | 1939 | skb_queue_tail(&dsp->sendq, nskb); |
1940 | schedule_work(&dsp->workq); | 1940 | schedule_work(&dsp->workq); |
1941 | } | ||
1941 | } | 1942 | } |
1943 | return; | ||
1942 | } | 1944 | } |
1943 | return; | 1945 | /* in case of hardware conference */ |
1944 | } | 1946 | if (dsp->conf->hardware) |
1945 | /* in case of hardware conference */ | 1947 | return; |
1946 | if (dsp->conf->hardware) | 1948 | list_for_each_entry(member, &dsp->conf->mlist, list) { |
1947 | return; | 1949 | if (dsp->echo.software || member->dsp != dsp) { |
1948 | list_for_each_entry(member, &dsp->conf->mlist, list) { | 1950 | nskb = skb_clone(skb, GFP_ATOMIC); |
1949 | if (dsp->echo.software || member->dsp != dsp) { | 1951 | if (nskb) { |
1950 | nskb = skb_clone(skb, GFP_ATOMIC); | 1952 | hh = mISDN_HEAD_P(nskb); |
1951 | if (nskb) { | 1953 | hh->prim = PH_DATA_REQ; |
1952 | hh = mISDN_HEAD_P(nskb); | 1954 | hh->id = 0; |
1953 | hh->prim = PH_DATA_REQ; | 1955 | skb_queue_tail(&member->dsp->sendq, nskb); |
1954 | hh->id = 0; | 1956 | schedule_work(&member->dsp->workq); |
1955 | skb_queue_tail(&member->dsp->sendq, nskb); | 1957 | } |
1956 | schedule_work(&member->dsp->workq); | ||
1957 | } | 1958 | } |
1958 | } | 1959 | } |
1959 | } | 1960 | } |
1960 | } | ||
1961 | |||
1962 | |||
diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c index 742f9f49668c..2ac2d7a25a9f 100644 --- a/drivers/isdn/mISDN/dsp_core.c +++ b/drivers/isdn/mISDN/dsp_core.c | |||
@@ -218,20 +218,20 @@ dsp_rx_off_member(struct dsp *dsp) | |||
218 | if (!dsp->ch.peer) { | 218 | if (!dsp->ch.peer) { |
219 | if (dsp_debug & DEBUG_DSP_CORE) | 219 | if (dsp_debug & DEBUG_DSP_CORE) |
220 | printk(KERN_DEBUG "%s: no peer, no rx_off\n", | 220 | printk(KERN_DEBUG "%s: no peer, no rx_off\n", |
221 | __func__); | 221 | __func__); |
222 | return; | 222 | return; |
223 | } | 223 | } |
224 | cq.op = MISDN_CTRL_RX_OFF; | 224 | cq.op = MISDN_CTRL_RX_OFF; |
225 | cq.p1 = rx_off; | 225 | cq.p1 = rx_off; |
226 | if (dsp->ch.peer->ctrl(dsp->ch.peer, CONTROL_CHANNEL, &cq)) { | 226 | if (dsp->ch.peer->ctrl(dsp->ch.peer, CONTROL_CHANNEL, &cq)) { |
227 | printk(KERN_DEBUG "%s: 2nd CONTROL_CHANNEL failed\n", | 227 | printk(KERN_DEBUG "%s: 2nd CONTROL_CHANNEL failed\n", |
228 | __func__); | 228 | __func__); |
229 | return; | 229 | return; |
230 | } | 230 | } |
231 | dsp->rx_is_off = rx_off; | 231 | dsp->rx_is_off = rx_off; |
232 | if (dsp_debug & DEBUG_DSP_CORE) | 232 | if (dsp_debug & DEBUG_DSP_CORE) |
233 | printk(KERN_DEBUG "%s: %s set rx_off = %d\n", | 233 | printk(KERN_DEBUG "%s: %s set rx_off = %d\n", |
234 | __func__, dsp->name, rx_off); | 234 | __func__, dsp->name, rx_off); |
235 | } | 235 | } |
236 | static void | 236 | static void |
237 | dsp_rx_off(struct dsp *dsp) | 237 | dsp_rx_off(struct dsp *dsp) |
@@ -263,19 +263,19 @@ dsp_fill_empty(struct dsp *dsp) | |||
263 | if (!dsp->ch.peer) { | 263 | if (!dsp->ch.peer) { |
264 | if (dsp_debug & DEBUG_DSP_CORE) | 264 | if (dsp_debug & DEBUG_DSP_CORE) |
265 | printk(KERN_DEBUG "%s: no peer, no fill_empty\n", | 265 | printk(KERN_DEBUG "%s: no peer, no fill_empty\n", |
266 | __func__); | 266 | __func__); |
267 | return; | 267 | return; |
268 | } | 268 | } |
269 | cq.op = MISDN_CTRL_FILL_EMPTY; | 269 | cq.op = MISDN_CTRL_FILL_EMPTY; |
270 | cq.p1 = 1; | 270 | cq.p1 = 1; |
271 | if (dsp->ch.peer->ctrl(dsp->ch.peer, CONTROL_CHANNEL, &cq)) { | 271 | if (dsp->ch.peer->ctrl(dsp->ch.peer, CONTROL_CHANNEL, &cq)) { |
272 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", | 272 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", |
273 | __func__); | 273 | __func__); |
274 | return; | 274 | return; |
275 | } | 275 | } |
276 | if (dsp_debug & DEBUG_DSP_CORE) | 276 | if (dsp_debug & DEBUG_DSP_CORE) |
277 | printk(KERN_DEBUG "%s: %s set fill_empty = 1\n", | 277 | printk(KERN_DEBUG "%s: %s set fill_empty = 1\n", |
278 | __func__, dsp->name); | 278 | __func__, dsp->name); |
279 | } | 279 | } |
280 | 280 | ||
281 | static int | 281 | static int |
@@ -304,7 +304,7 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb) | |||
304 | if (len == sizeof(int)) { | 304 | if (len == sizeof(int)) { |
305 | if (dsp_debug & DEBUG_DSP_CORE) | 305 | if (dsp_debug & DEBUG_DSP_CORE) |
306 | printk(KERN_NOTICE "changing DTMF Threshold " | 306 | printk(KERN_NOTICE "changing DTMF Threshold " |
307 | "to %d\n", *((int *)data)); | 307 | "to %d\n", *((int *)data)); |
308 | dsp->dtmf.treshold = (*(int *)data) * 10000; | 308 | dsp->dtmf.treshold = (*(int *)data) * 10000; |
309 | } | 309 | } |
310 | dsp->dtmf.enable = 1; | 310 | dsp->dtmf.enable = 1; |
@@ -331,19 +331,19 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb) | |||
331 | goto conf_split; | 331 | goto conf_split; |
332 | if (dsp_debug & DEBUG_DSP_CORE) | 332 | if (dsp_debug & DEBUG_DSP_CORE) |
333 | printk(KERN_DEBUG "%s: join conference %d\n", | 333 | printk(KERN_DEBUG "%s: join conference %d\n", |
334 | __func__, *((u32 *)data)); | 334 | __func__, *((u32 *)data)); |
335 | ret = dsp_cmx_conf(dsp, *((u32 *)data)); | 335 | ret = dsp_cmx_conf(dsp, *((u32 *)data)); |
336 | /* dsp_cmx_hardware will also be called here */ | 336 | /* dsp_cmx_hardware will also be called here */ |
337 | dsp_rx_off(dsp); | 337 | dsp_rx_off(dsp); |
338 | if (dsp_debug & DEBUG_DSP_CMX) | 338 | if (dsp_debug & DEBUG_DSP_CMX) |
339 | dsp_cmx_debug(dsp); | 339 | dsp_cmx_debug(dsp); |
340 | break; | 340 | break; |
341 | case DSP_CONF_SPLIT: /* remove from conference */ | 341 | case DSP_CONF_SPLIT: /* remove from conference */ |
342 | conf_split: | 342 | conf_split: |
343 | if (dsp_debug & DEBUG_DSP_CORE) | 343 | if (dsp_debug & DEBUG_DSP_CORE) |
344 | printk(KERN_DEBUG "%s: release conference\n", __func__); | 344 | printk(KERN_DEBUG "%s: release conference\n", __func__); |
345 | ret = dsp_cmx_conf(dsp, 0); | 345 | ret = dsp_cmx_conf(dsp, 0); |
346 | /* dsp_cmx_hardware will also be called here */ | 346 | /* dsp_cmx_hardware will also be called here */ |
347 | if (dsp_debug & DEBUG_DSP_CMX) | 347 | if (dsp_debug & DEBUG_DSP_CMX) |
348 | dsp_cmx_debug(dsp); | 348 | dsp_cmx_debug(dsp); |
349 | dsp_rx_off(dsp); | 349 | dsp_rx_off(dsp); |
@@ -359,7 +359,7 @@ conf_split: | |||
359 | } | 359 | } |
360 | if (dsp_debug & DEBUG_DSP_CORE) | 360 | if (dsp_debug & DEBUG_DSP_CORE) |
361 | printk(KERN_DEBUG "%s: turn tone 0x%x on\n", | 361 | printk(KERN_DEBUG "%s: turn tone 0x%x on\n", |
362 | __func__, *((int *)skb->data)); | 362 | __func__, *((int *)skb->data)); |
363 | ret = dsp_tone(dsp, *((int *)data)); | 363 | ret = dsp_tone(dsp, *((int *)data)); |
364 | if (!ret) { | 364 | if (!ret) { |
365 | dsp_cmx_hardware(dsp->conf, dsp); | 365 | dsp_cmx_hardware(dsp->conf, dsp); |
@@ -379,7 +379,7 @@ conf_split: | |||
379 | dsp_cmx_hardware(dsp->conf, dsp); | 379 | dsp_cmx_hardware(dsp->conf, dsp); |
380 | dsp_rx_off(dsp); | 380 | dsp_rx_off(dsp); |
381 | /* reset tx buffers (user space data) */ | 381 | /* reset tx buffers (user space data) */ |
382 | tone_off: | 382 | tone_off: |
383 | dsp->rx_W = 0; | 383 | dsp->rx_W = 0; |
384 | dsp->rx_R = 0; | 384 | dsp->rx_R = 0; |
385 | break; | 385 | break; |
@@ -395,7 +395,7 @@ tone_off: | |||
395 | dsp->tx_volume = *((int *)data); | 395 | dsp->tx_volume = *((int *)data); |
396 | if (dsp_debug & DEBUG_DSP_CORE) | 396 | if (dsp_debug & DEBUG_DSP_CORE) |
397 | printk(KERN_DEBUG "%s: change tx vol to %d\n", | 397 | printk(KERN_DEBUG "%s: change tx vol to %d\n", |
398 | __func__, dsp->tx_volume); | 398 | __func__, dsp->tx_volume); |
399 | dsp_cmx_hardware(dsp->conf, dsp); | 399 | dsp_cmx_hardware(dsp->conf, dsp); |
400 | dsp_dtmf_hardware(dsp); | 400 | dsp_dtmf_hardware(dsp); |
401 | dsp_rx_off(dsp); | 401 | dsp_rx_off(dsp); |
@@ -412,7 +412,7 @@ tone_off: | |||
412 | dsp->rx_volume = *((int *)data); | 412 | dsp->rx_volume = *((int *)data); |
413 | if (dsp_debug & DEBUG_DSP_CORE) | 413 | if (dsp_debug & DEBUG_DSP_CORE) |
414 | printk(KERN_DEBUG "%s: change rx vol to %d\n", | 414 | printk(KERN_DEBUG "%s: change rx vol to %d\n", |
415 | __func__, dsp->tx_volume); | 415 | __func__, dsp->tx_volume); |
416 | dsp_cmx_hardware(dsp->conf, dsp); | 416 | dsp_cmx_hardware(dsp->conf, dsp); |
417 | dsp_dtmf_hardware(dsp); | 417 | dsp_dtmf_hardware(dsp); |
418 | dsp_rx_off(dsp); | 418 | dsp_rx_off(dsp); |
@@ -439,14 +439,14 @@ tone_off: | |||
439 | case DSP_RECEIVE_ON: /* enable receive to user space */ | 439 | case DSP_RECEIVE_ON: /* enable receive to user space */ |
440 | if (dsp_debug & DEBUG_DSP_CORE) | 440 | if (dsp_debug & DEBUG_DSP_CORE) |
441 | printk(KERN_DEBUG "%s: enable receive to user " | 441 | printk(KERN_DEBUG "%s: enable receive to user " |
442 | "space\n", __func__); | 442 | "space\n", __func__); |
443 | dsp->rx_disabled = 0; | 443 | dsp->rx_disabled = 0; |
444 | dsp_rx_off(dsp); | 444 | dsp_rx_off(dsp); |
445 | break; | 445 | break; |
446 | case DSP_RECEIVE_OFF: /* disable receive to user space */ | 446 | case DSP_RECEIVE_OFF: /* disable receive to user space */ |
447 | if (dsp_debug & DEBUG_DSP_CORE) | 447 | if (dsp_debug & DEBUG_DSP_CORE) |
448 | printk(KERN_DEBUG "%s: disable receive to " | 448 | printk(KERN_DEBUG "%s: disable receive to " |
449 | "user space\n", __func__); | 449 | "user space\n", __func__); |
450 | dsp->rx_disabled = 1; | 450 | dsp->rx_disabled = 1; |
451 | dsp_rx_off(dsp); | 451 | dsp_rx_off(dsp); |
452 | break; | 452 | break; |
@@ -457,7 +457,7 @@ tone_off: | |||
457 | } | 457 | } |
458 | if (dsp_debug & DEBUG_DSP_CORE) | 458 | if (dsp_debug & DEBUG_DSP_CORE) |
459 | printk(KERN_DEBUG "%s: enable mixing of " | 459 | printk(KERN_DEBUG "%s: enable mixing of " |
460 | "tx-data with conf mebers\n", __func__); | 460 | "tx-data with conf mebers\n", __func__); |
461 | dsp->tx_mix = 1; | 461 | dsp->tx_mix = 1; |
462 | dsp_cmx_hardware(dsp->conf, dsp); | 462 | dsp_cmx_hardware(dsp->conf, dsp); |
463 | dsp_rx_off(dsp); | 463 | dsp_rx_off(dsp); |
@@ -471,7 +471,7 @@ tone_off: | |||
471 | } | 471 | } |
472 | if (dsp_debug & DEBUG_DSP_CORE) | 472 | if (dsp_debug & DEBUG_DSP_CORE) |
473 | printk(KERN_DEBUG "%s: disable mixing of " | 473 | printk(KERN_DEBUG "%s: disable mixing of " |
474 | "tx-data with conf mebers\n", __func__); | 474 | "tx-data with conf mebers\n", __func__); |
475 | dsp->tx_mix = 0; | 475 | dsp->tx_mix = 0; |
476 | dsp_cmx_hardware(dsp->conf, dsp); | 476 | dsp_cmx_hardware(dsp->conf, dsp); |
477 | dsp_rx_off(dsp); | 477 | dsp_rx_off(dsp); |
@@ -507,18 +507,18 @@ tone_off: | |||
507 | break; | 507 | break; |
508 | } | 508 | } |
509 | dsp->cmx_delay = (*((int *)data)) << 3; | 509 | dsp->cmx_delay = (*((int *)data)) << 3; |
510 | /* milliseconds to samples */ | 510 | /* milliseconds to samples */ |
511 | if (dsp->cmx_delay >= (CMX_BUFF_HALF>>1)) | 511 | if (dsp->cmx_delay >= (CMX_BUFF_HALF >> 1)) |
512 | /* clip to half of maximum usable buffer | 512 | /* clip to half of maximum usable buffer |
513 | (half of half buffer) */ | 513 | (half of half buffer) */ |
514 | dsp->cmx_delay = (CMX_BUFF_HALF>>1) - 1; | 514 | dsp->cmx_delay = (CMX_BUFF_HALF >> 1) - 1; |
515 | if (dsp_debug & DEBUG_DSP_CORE) | 515 | if (dsp_debug & DEBUG_DSP_CORE) |
516 | printk(KERN_DEBUG "%s: use delay algorithm to " | 516 | printk(KERN_DEBUG "%s: use delay algorithm to " |
517 | "compensate jitter (%d samples)\n", | 517 | "compensate jitter (%d samples)\n", |
518 | __func__, dsp->cmx_delay); | 518 | __func__, dsp->cmx_delay); |
519 | break; | 519 | break; |
520 | case DSP_JITTER: /* use dynamic jitter algorithm instead of | 520 | case DSP_JITTER: /* use dynamic jitter algorithm instead of |
521 | delay algorithm */ | 521 | delay algorithm */ |
522 | if (dsp->hdlc) { | 522 | if (dsp->hdlc) { |
523 | ret = -EINVAL; | 523 | ret = -EINVAL; |
524 | break; | 524 | break; |
@@ -526,7 +526,7 @@ tone_off: | |||
526 | dsp->cmx_delay = 0; | 526 | dsp->cmx_delay = 0; |
527 | if (dsp_debug & DEBUG_DSP_CORE) | 527 | if (dsp_debug & DEBUG_DSP_CORE) |
528 | printk(KERN_DEBUG "%s: use jitter algorithm to " | 528 | printk(KERN_DEBUG "%s: use jitter algorithm to " |
529 | "compensate jitter\n", __func__); | 529 | "compensate jitter\n", __func__); |
530 | break; | 530 | break; |
531 | case DSP_TX_DEJITTER: /* use dynamic jitter algorithm for tx-buffer */ | 531 | case DSP_TX_DEJITTER: /* use dynamic jitter algorithm for tx-buffer */ |
532 | if (dsp->hdlc) { | 532 | if (dsp->hdlc) { |
@@ -536,7 +536,7 @@ tone_off: | |||
536 | dsp->tx_dejitter = 1; | 536 | dsp->tx_dejitter = 1; |
537 | if (dsp_debug & DEBUG_DSP_CORE) | 537 | if (dsp_debug & DEBUG_DSP_CORE) |
538 | printk(KERN_DEBUG "%s: use dejitter on TX " | 538 | printk(KERN_DEBUG "%s: use dejitter on TX " |
539 | "buffer\n", __func__); | 539 | "buffer\n", __func__); |
540 | break; | 540 | break; |
541 | case DSP_TX_DEJ_OFF: /* use tx-buffer without dejittering*/ | 541 | case DSP_TX_DEJ_OFF: /* use tx-buffer without dejittering*/ |
542 | if (dsp->hdlc) { | 542 | if (dsp->hdlc) { |
@@ -546,7 +546,7 @@ tone_off: | |||
546 | dsp->tx_dejitter = 0; | 546 | dsp->tx_dejitter = 0; |
547 | if (dsp_debug & DEBUG_DSP_CORE) | 547 | if (dsp_debug & DEBUG_DSP_CORE) |
548 | printk(KERN_DEBUG "%s: use TX buffer without " | 548 | printk(KERN_DEBUG "%s: use TX buffer without " |
549 | "dejittering\n", __func__); | 549 | "dejittering\n", __func__); |
550 | break; | 550 | break; |
551 | case DSP_PIPELINE_CFG: | 551 | case DSP_PIPELINE_CFG: |
552 | if (dsp->hdlc) { | 552 | if (dsp->hdlc) { |
@@ -555,13 +555,13 @@ tone_off: | |||
555 | } | 555 | } |
556 | if (len > 0 && ((char *)data)[len - 1]) { | 556 | if (len > 0 && ((char *)data)[len - 1]) { |
557 | printk(KERN_DEBUG "%s: pipeline config string " | 557 | printk(KERN_DEBUG "%s: pipeline config string " |
558 | "is not NULL terminated!\n", __func__); | 558 | "is not NULL terminated!\n", __func__); |
559 | ret = -EINVAL; | 559 | ret = -EINVAL; |
560 | } else { | 560 | } else { |
561 | dsp->pipeline.inuse = 1; | 561 | dsp->pipeline.inuse = 1; |
562 | dsp_cmx_hardware(dsp->conf, dsp); | 562 | dsp_cmx_hardware(dsp->conf, dsp); |
563 | ret = dsp_pipeline_build(&dsp->pipeline, | 563 | ret = dsp_pipeline_build(&dsp->pipeline, |
564 | len > 0 ? data : NULL); | 564 | len > 0 ? data : NULL); |
565 | dsp_cmx_hardware(dsp->conf, dsp); | 565 | dsp_cmx_hardware(dsp->conf, dsp); |
566 | dsp_rx_off(dsp); | 566 | dsp_rx_off(dsp); |
567 | } | 567 | } |
@@ -577,7 +577,7 @@ tone_off: | |||
577 | } | 577 | } |
578 | if (dsp_debug & DEBUG_DSP_CORE) | 578 | if (dsp_debug & DEBUG_DSP_CORE) |
579 | printk(KERN_DEBUG "%s: turn blowfish on (key " | 579 | printk(KERN_DEBUG "%s: turn blowfish on (key " |
580 | "not shown)\n", __func__); | 580 | "not shown)\n", __func__); |
581 | ret = dsp_bf_init(dsp, (u8 *)data, len); | 581 | ret = dsp_bf_init(dsp, (u8 *)data, len); |
582 | /* set new cont */ | 582 | /* set new cont */ |
583 | if (!ret) | 583 | if (!ret) |
@@ -586,7 +586,7 @@ tone_off: | |||
586 | cont = DSP_BF_REJECT; | 586 | cont = DSP_BF_REJECT; |
587 | /* send indication if it worked to set it */ | 587 | /* send indication if it worked to set it */ |
588 | nskb = _alloc_mISDN_skb(PH_CONTROL_IND, MISDN_ID_ANY, | 588 | nskb = _alloc_mISDN_skb(PH_CONTROL_IND, MISDN_ID_ANY, |
589 | sizeof(int), &cont, GFP_ATOMIC); | 589 | sizeof(int), &cont, GFP_ATOMIC); |
590 | if (nskb) { | 590 | if (nskb) { |
591 | if (dsp->up) { | 591 | if (dsp->up) { |
592 | if (dsp->up->send(dsp->up, nskb)) | 592 | if (dsp->up->send(dsp->up, nskb)) |
@@ -615,7 +615,7 @@ tone_off: | |||
615 | default: | 615 | default: |
616 | if (dsp_debug & DEBUG_DSP_CORE) | 616 | if (dsp_debug & DEBUG_DSP_CORE) |
617 | printk(KERN_DEBUG "%s: ctrl req %x unhandled\n", | 617 | printk(KERN_DEBUG "%s: ctrl req %x unhandled\n", |
618 | __func__, cont); | 618 | __func__, cont); |
619 | ret = -EINVAL; | 619 | ret = -EINVAL; |
620 | } | 620 | } |
621 | return ret; | 621 | return ret; |
@@ -630,14 +630,14 @@ get_features(struct mISDNchannel *ch) | |||
630 | if (!ch->peer) { | 630 | if (!ch->peer) { |
631 | if (dsp_debug & DEBUG_DSP_CORE) | 631 | if (dsp_debug & DEBUG_DSP_CORE) |
632 | printk(KERN_DEBUG "%s: no peer, no features\n", | 632 | printk(KERN_DEBUG "%s: no peer, no features\n", |
633 | __func__); | 633 | __func__); |
634 | return; | 634 | return; |
635 | } | 635 | } |
636 | memset(&cq, 0, sizeof(cq)); | 636 | memset(&cq, 0, sizeof(cq)); |
637 | cq.op = MISDN_CTRL_GETOP; | 637 | cq.op = MISDN_CTRL_GETOP; |
638 | if (ch->peer->ctrl(ch->peer, CONTROL_CHANNEL, &cq) < 0) { | 638 | if (ch->peer->ctrl(ch->peer, CONTROL_CHANNEL, &cq) < 0) { |
639 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", | 639 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", |
640 | __func__); | 640 | __func__); |
641 | return; | 641 | return; |
642 | } | 642 | } |
643 | if (cq.op & MISDN_CTRL_RX_OFF) | 643 | if (cq.op & MISDN_CTRL_RX_OFF) |
@@ -651,12 +651,12 @@ get_features(struct mISDNchannel *ch) | |||
651 | *((u_long *)&cq.p1) = (u_long)&dsp->features; | 651 | *((u_long *)&cq.p1) = (u_long)&dsp->features; |
652 | if (ch->peer->ctrl(ch->peer, CONTROL_CHANNEL, &cq)) { | 652 | if (ch->peer->ctrl(ch->peer, CONTROL_CHANNEL, &cq)) { |
653 | printk(KERN_DEBUG "%s: 2nd CONTROL_CHANNEL failed\n", | 653 | printk(KERN_DEBUG "%s: 2nd CONTROL_CHANNEL failed\n", |
654 | __func__); | 654 | __func__); |
655 | } | 655 | } |
656 | } else | 656 | } else |
657 | if (dsp_debug & DEBUG_DSP_CORE) | 657 | if (dsp_debug & DEBUG_DSP_CORE) |
658 | printk(KERN_DEBUG "%s: features not supported for %s\n", | 658 | printk(KERN_DEBUG "%s: features not supported for %s\n", |
659 | __func__, dsp->name); | 659 | __func__, dsp->name); |
660 | } | 660 | } |
661 | 661 | ||
662 | static int | 662 | static int |
@@ -670,7 +670,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
670 | 670 | ||
671 | hh = mISDN_HEAD_P(skb); | 671 | hh = mISDN_HEAD_P(skb); |
672 | switch (hh->prim) { | 672 | switch (hh->prim) { |
673 | /* FROM DOWN */ | 673 | /* FROM DOWN */ |
674 | case (PH_DATA_CNF): | 674 | case (PH_DATA_CNF): |
675 | dsp->data_pending = 0; | 675 | dsp->data_pending = 0; |
676 | /* trigger next hdlc frame, if any */ | 676 | /* trigger next hdlc frame, if any */ |
@@ -690,8 +690,8 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
690 | if (dsp->rx_is_off) { | 690 | if (dsp->rx_is_off) { |
691 | if (dsp_debug & DEBUG_DSP_CORE) | 691 | if (dsp_debug & DEBUG_DSP_CORE) |
692 | printk(KERN_DEBUG "%s: rx-data during rx_off" | 692 | printk(KERN_DEBUG "%s: rx-data during rx_off" |
693 | " for %s\n", | 693 | " for %s\n", |
694 | __func__, dsp->name); | 694 | __func__, dsp->name); |
695 | } | 695 | } |
696 | if (dsp->hdlc) { | 696 | if (dsp->hdlc) { |
697 | /* hdlc */ | 697 | /* hdlc */ |
@@ -716,14 +716,14 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
716 | /* pipeline */ | 716 | /* pipeline */ |
717 | if (dsp->pipeline.inuse) | 717 | if (dsp->pipeline.inuse) |
718 | dsp_pipeline_process_rx(&dsp->pipeline, skb->data, | 718 | dsp_pipeline_process_rx(&dsp->pipeline, skb->data, |
719 | skb->len, hh->id); | 719 | skb->len, hh->id); |
720 | /* change volume if requested */ | 720 | /* change volume if requested */ |
721 | if (dsp->rx_volume) | 721 | if (dsp->rx_volume) |
722 | dsp_change_volume(skb, dsp->rx_volume); | 722 | dsp_change_volume(skb, dsp->rx_volume); |
723 | /* check if dtmf soft decoding is turned on */ | 723 | /* check if dtmf soft decoding is turned on */ |
724 | if (dsp->dtmf.software) { | 724 | if (dsp->dtmf.software) { |
725 | digits = dsp_dtmf_goertzel_decode(dsp, skb->data, | 725 | digits = dsp_dtmf_goertzel_decode(dsp, skb->data, |
726 | skb->len, (dsp_options&DSP_OPT_ULAW) ? 1 : 0); | 726 | skb->len, (dsp_options & DSP_OPT_ULAW) ? 1 : 0); |
727 | } | 727 | } |
728 | /* we need to process receive data if software */ | 728 | /* we need to process receive data if software */ |
729 | if (dsp->conf && dsp->conf->software) { | 729 | if (dsp->conf && dsp->conf->software) { |
@@ -740,16 +740,16 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
740 | struct sk_buff *nskb; | 740 | struct sk_buff *nskb; |
741 | if (dsp_debug & DEBUG_DSP_DTMF) | 741 | if (dsp_debug & DEBUG_DSP_DTMF) |
742 | printk(KERN_DEBUG "%s: digit" | 742 | printk(KERN_DEBUG "%s: digit" |
743 | "(%c) to layer %s\n", | 743 | "(%c) to layer %s\n", |
744 | __func__, *digits, dsp->name); | 744 | __func__, *digits, dsp->name); |
745 | k = *digits | DTMF_TONE_VAL; | 745 | k = *digits | DTMF_TONE_VAL; |
746 | nskb = _alloc_mISDN_skb(PH_CONTROL_IND, | 746 | nskb = _alloc_mISDN_skb(PH_CONTROL_IND, |
747 | MISDN_ID_ANY, sizeof(int), &k, | 747 | MISDN_ID_ANY, sizeof(int), &k, |
748 | GFP_ATOMIC); | 748 | GFP_ATOMIC); |
749 | if (nskb) { | 749 | if (nskb) { |
750 | if (dsp->up) { | 750 | if (dsp->up) { |
751 | if (dsp->up->send( | 751 | if (dsp->up->send( |
752 | dsp->up, nskb)) | 752 | dsp->up, nskb)) |
753 | dev_kfree_skb(nskb); | 753 | dev_kfree_skb(nskb); |
754 | } else | 754 | } else |
755 | dev_kfree_skb(nskb); | 755 | dev_kfree_skb(nskb); |
@@ -768,34 +768,34 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
768 | case (PH_CONTROL_IND): | 768 | case (PH_CONTROL_IND): |
769 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) | 769 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) |
770 | printk(KERN_DEBUG "%s: PH_CONTROL INDICATION " | 770 | printk(KERN_DEBUG "%s: PH_CONTROL INDICATION " |
771 | "received: %x (len %d) %s\n", __func__, | 771 | "received: %x (len %d) %s\n", __func__, |
772 | hh->id, skb->len, dsp->name); | 772 | hh->id, skb->len, dsp->name); |
773 | switch (hh->id) { | 773 | switch (hh->id) { |
774 | case (DTMF_HFC_COEF): /* getting coefficients */ | 774 | case (DTMF_HFC_COEF): /* getting coefficients */ |
775 | if (!dsp->dtmf.hardware) { | 775 | if (!dsp->dtmf.hardware) { |
776 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) | 776 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) |
777 | printk(KERN_DEBUG "%s: ignoring DTMF " | 777 | printk(KERN_DEBUG "%s: ignoring DTMF " |
778 | "coefficients from HFC\n", | 778 | "coefficients from HFC\n", |
779 | __func__); | 779 | __func__); |
780 | break; | 780 | break; |
781 | } | 781 | } |
782 | digits = dsp_dtmf_goertzel_decode(dsp, skb->data, | 782 | digits = dsp_dtmf_goertzel_decode(dsp, skb->data, |
783 | skb->len, 2); | 783 | skb->len, 2); |
784 | while (*digits) { | 784 | while (*digits) { |
785 | int k; | 785 | int k; |
786 | struct sk_buff *nskb; | 786 | struct sk_buff *nskb; |
787 | if (dsp_debug & DEBUG_DSP_DTMF) | 787 | if (dsp_debug & DEBUG_DSP_DTMF) |
788 | printk(KERN_DEBUG "%s: digit" | 788 | printk(KERN_DEBUG "%s: digit" |
789 | "(%c) to layer %s\n", | 789 | "(%c) to layer %s\n", |
790 | __func__, *digits, dsp->name); | 790 | __func__, *digits, dsp->name); |
791 | k = *digits | DTMF_TONE_VAL; | 791 | k = *digits | DTMF_TONE_VAL; |
792 | nskb = _alloc_mISDN_skb(PH_CONTROL_IND, | 792 | nskb = _alloc_mISDN_skb(PH_CONTROL_IND, |
793 | MISDN_ID_ANY, sizeof(int), &k, | 793 | MISDN_ID_ANY, sizeof(int), &k, |
794 | GFP_ATOMIC); | 794 | GFP_ATOMIC); |
795 | if (nskb) { | 795 | if (nskb) { |
796 | if (dsp->up) { | 796 | if (dsp->up) { |
797 | if (dsp->up->send( | 797 | if (dsp->up->send( |
798 | dsp->up, nskb)) | 798 | dsp->up, nskb)) |
799 | dev_kfree_skb(nskb); | 799 | dev_kfree_skb(nskb); |
800 | } else | 800 | } else |
801 | dev_kfree_skb(nskb); | 801 | dev_kfree_skb(nskb); |
@@ -812,7 +812,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
812 | dsp->tx_volume = *((int *)skb->data); | 812 | dsp->tx_volume = *((int *)skb->data); |
813 | if (dsp_debug & DEBUG_DSP_CORE) | 813 | if (dsp_debug & DEBUG_DSP_CORE) |
814 | printk(KERN_DEBUG "%s: change tx volume to " | 814 | printk(KERN_DEBUG "%s: change tx volume to " |
815 | "%d\n", __func__, dsp->tx_volume); | 815 | "%d\n", __func__, dsp->tx_volume); |
816 | dsp_cmx_hardware(dsp->conf, dsp); | 816 | dsp_cmx_hardware(dsp->conf, dsp); |
817 | dsp_dtmf_hardware(dsp); | 817 | dsp_dtmf_hardware(dsp); |
818 | dsp_rx_off(dsp); | 818 | dsp_rx_off(dsp); |
@@ -821,7 +821,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
821 | default: | 821 | default: |
822 | if (dsp_debug & DEBUG_DSP_CORE) | 822 | if (dsp_debug & DEBUG_DSP_CORE) |
823 | printk(KERN_DEBUG "%s: ctrl ind %x unhandled " | 823 | printk(KERN_DEBUG "%s: ctrl ind %x unhandled " |
824 | "%s\n", __func__, hh->id, dsp->name); | 824 | "%s\n", __func__, hh->id, dsp->name); |
825 | ret = -EINVAL; | 825 | ret = -EINVAL; |
826 | } | 826 | } |
827 | break; | 827 | break; |
@@ -829,13 +829,13 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
829 | case (PH_ACTIVATE_CNF): | 829 | case (PH_ACTIVATE_CNF): |
830 | if (dsp_debug & DEBUG_DSP_CORE) | 830 | if (dsp_debug & DEBUG_DSP_CORE) |
831 | printk(KERN_DEBUG "%s: b_channel is now active %s\n", | 831 | printk(KERN_DEBUG "%s: b_channel is now active %s\n", |
832 | __func__, dsp->name); | 832 | __func__, dsp->name); |
833 | /* bchannel now active */ | 833 | /* bchannel now active */ |
834 | spin_lock_irqsave(&dsp_lock, flags); | 834 | spin_lock_irqsave(&dsp_lock, flags); |
835 | dsp->b_active = 1; | 835 | dsp->b_active = 1; |
836 | dsp->data_pending = 0; | 836 | dsp->data_pending = 0; |
837 | dsp->rx_init = 1; | 837 | dsp->rx_init = 1; |
838 | /* rx_W and rx_R will be adjusted on first frame */ | 838 | /* rx_W and rx_R will be adjusted on first frame */ |
839 | dsp->rx_W = 0; | 839 | dsp->rx_W = 0; |
840 | dsp->rx_R = 0; | 840 | dsp->rx_R = 0; |
841 | memset(dsp->rx_buff, 0, sizeof(dsp->rx_buff)); | 841 | memset(dsp->rx_buff, 0, sizeof(dsp->rx_buff)); |
@@ -845,8 +845,8 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
845 | spin_unlock_irqrestore(&dsp_lock, flags); | 845 | spin_unlock_irqrestore(&dsp_lock, flags); |
846 | if (dsp_debug & DEBUG_DSP_CORE) | 846 | if (dsp_debug & DEBUG_DSP_CORE) |
847 | printk(KERN_DEBUG "%s: done with activation, sending " | 847 | printk(KERN_DEBUG "%s: done with activation, sending " |
848 | "confirm to user space. %s\n", __func__, | 848 | "confirm to user space. %s\n", __func__, |
849 | dsp->name); | 849 | dsp->name); |
850 | /* send activation to upper layer */ | 850 | /* send activation to upper layer */ |
851 | hh->prim = DL_ESTABLISH_CNF; | 851 | hh->prim = DL_ESTABLISH_CNF; |
852 | if (dsp->up) | 852 | if (dsp->up) |
@@ -856,7 +856,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
856 | case (PH_DEACTIVATE_CNF): | 856 | case (PH_DEACTIVATE_CNF): |
857 | if (dsp_debug & DEBUG_DSP_CORE) | 857 | if (dsp_debug & DEBUG_DSP_CORE) |
858 | printk(KERN_DEBUG "%s: b_channel is now inactive %s\n", | 858 | printk(KERN_DEBUG "%s: b_channel is now inactive %s\n", |
859 | __func__, dsp->name); | 859 | __func__, dsp->name); |
860 | /* bchannel now inactive */ | 860 | /* bchannel now inactive */ |
861 | spin_lock_irqsave(&dsp_lock, flags); | 861 | spin_lock_irqsave(&dsp_lock, flags); |
862 | dsp->b_active = 0; | 862 | dsp->b_active = 0; |
@@ -868,7 +868,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
868 | if (dsp->up) | 868 | if (dsp->up) |
869 | return dsp->up->send(dsp->up, skb); | 869 | return dsp->up->send(dsp->up, skb); |
870 | break; | 870 | break; |
871 | /* FROM UP */ | 871 | /* FROM UP */ |
872 | case (DL_DATA_REQ): | 872 | case (DL_DATA_REQ): |
873 | case (PH_DATA_REQ): | 873 | case (PH_DATA_REQ): |
874 | if (skb->len < 1) { | 874 | if (skb->len < 1) { |
@@ -904,7 +904,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
904 | case (PH_ACTIVATE_REQ): | 904 | case (PH_ACTIVATE_REQ): |
905 | if (dsp_debug & DEBUG_DSP_CORE) | 905 | if (dsp_debug & DEBUG_DSP_CORE) |
906 | printk(KERN_DEBUG "%s: activating b_channel %s\n", | 906 | printk(KERN_DEBUG "%s: activating b_channel %s\n", |
907 | __func__, dsp->name); | 907 | __func__, dsp->name); |
908 | if (dsp->dtmf.hardware || dsp->dtmf.software) | 908 | if (dsp->dtmf.hardware || dsp->dtmf.software) |
909 | dsp_dtmf_goertzel_init(dsp); | 909 | dsp_dtmf_goertzel_init(dsp); |
910 | get_features(ch); | 910 | get_features(ch); |
@@ -920,7 +920,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
920 | case (PH_DEACTIVATE_REQ): | 920 | case (PH_DEACTIVATE_REQ): |
921 | if (dsp_debug & DEBUG_DSP_CORE) | 921 | if (dsp_debug & DEBUG_DSP_CORE) |
922 | printk(KERN_DEBUG "%s: releasing b_channel %s\n", | 922 | printk(KERN_DEBUG "%s: releasing b_channel %s\n", |
923 | __func__, dsp->name); | 923 | __func__, dsp->name); |
924 | spin_lock_irqsave(&dsp_lock, flags); | 924 | spin_lock_irqsave(&dsp_lock, flags); |
925 | dsp->tone.tone = 0; | 925 | dsp->tone.tone = 0; |
926 | dsp->tone.hardware = 0; | 926 | dsp->tone.hardware = 0; |
@@ -939,7 +939,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) | |||
939 | default: | 939 | default: |
940 | if (dsp_debug & DEBUG_DSP_CORE) | 940 | if (dsp_debug & DEBUG_DSP_CORE) |
941 | printk(KERN_DEBUG "%s: msg %x unhandled %s\n", | 941 | printk(KERN_DEBUG "%s: msg %x unhandled %s\n", |
942 | __func__, hh->prim, dsp->name); | 942 | __func__, hh->prim, dsp->name); |
943 | ret = -EINVAL; | 943 | ret = -EINVAL; |
944 | } | 944 | } |
945 | if (!ret) | 945 | if (!ret) |
@@ -978,7 +978,7 @@ dsp_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
978 | skb_queue_purge(&dsp->sendq); | 978 | skb_queue_purge(&dsp->sendq); |
979 | if (dsp_debug & DEBUG_DSP_CTRL) | 979 | if (dsp_debug & DEBUG_DSP_CTRL) |
980 | printk(KERN_DEBUG "%s: releasing member %s\n", | 980 | printk(KERN_DEBUG "%s: releasing member %s\n", |
981 | __func__, dsp->name); | 981 | __func__, dsp->name); |
982 | dsp->b_active = 0; | 982 | dsp->b_active = 0; |
983 | dsp_cmx_conf(dsp, 0); /* dsp_cmx_hardware will also be called | 983 | dsp_cmx_conf(dsp, 0); /* dsp_cmx_hardware will also be called |
984 | here */ | 984 | here */ |
@@ -986,13 +986,13 @@ dsp_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
986 | 986 | ||
987 | if (dsp_debug & DEBUG_DSP_CTRL) | 987 | if (dsp_debug & DEBUG_DSP_CTRL) |
988 | printk(KERN_DEBUG "%s: remove & destroy object %s\n", | 988 | printk(KERN_DEBUG "%s: remove & destroy object %s\n", |
989 | __func__, dsp->name); | 989 | __func__, dsp->name); |
990 | list_del(&dsp->list); | 990 | list_del(&dsp->list); |
991 | spin_unlock_irqrestore(&dsp_lock, flags); | 991 | spin_unlock_irqrestore(&dsp_lock, flags); |
992 | 992 | ||
993 | if (dsp_debug & DEBUG_DSP_CTRL) | 993 | if (dsp_debug & DEBUG_DSP_CTRL) |
994 | printk(KERN_DEBUG "%s: dsp instance released\n", | 994 | printk(KERN_DEBUG "%s: dsp instance released\n", |
995 | __func__); | 995 | __func__); |
996 | vfree(dsp); | 996 | vfree(dsp); |
997 | module_put(THIS_MODULE); | 997 | module_put(THIS_MODULE); |
998 | break; | 998 | break; |
@@ -1016,7 +1016,7 @@ dsp_send_bh(struct work_struct *work) | |||
1016 | if (dsp->data_pending) { | 1016 | if (dsp->data_pending) { |
1017 | if (dsp_debug & DEBUG_DSP_CORE) | 1017 | if (dsp_debug & DEBUG_DSP_CORE) |
1018 | printk(KERN_DEBUG "%s: fifo full %s, this is " | 1018 | printk(KERN_DEBUG "%s: fifo full %s, this is " |
1019 | "no bug!\n", __func__, dsp->name); | 1019 | "no bug!\n", __func__, dsp->name); |
1020 | /* flush transparent data, if not acked */ | 1020 | /* flush transparent data, if not acked */ |
1021 | dev_kfree_skb(skb); | 1021 | dev_kfree_skb(skb); |
1022 | continue; | 1022 | continue; |
@@ -1050,7 +1050,7 @@ dspcreate(struct channel_req *crq) | |||
1050 | u_long flags; | 1050 | u_long flags; |
1051 | 1051 | ||
1052 | if (crq->protocol != ISDN_P_B_L2DSP | 1052 | if (crq->protocol != ISDN_P_B_L2DSP |
1053 | && crq->protocol != ISDN_P_B_L2DSPHDLC) | 1053 | && crq->protocol != ISDN_P_B_L2DSPHDLC) |
1054 | return -EPROTONOSUPPORT; | 1054 | return -EPROTONOSUPPORT; |
1055 | ndsp = vzalloc(sizeof(struct dsp)); | 1055 | ndsp = vzalloc(sizeof(struct dsp)); |
1056 | if (!ndsp) { | 1056 | if (!ndsp) { |
@@ -1076,7 +1076,7 @@ dspcreate(struct channel_req *crq) | |||
1076 | } | 1076 | } |
1077 | if (!try_module_get(THIS_MODULE)) | 1077 | if (!try_module_get(THIS_MODULE)) |
1078 | printk(KERN_WARNING "%s:cannot get module\n", | 1078 | printk(KERN_WARNING "%s:cannot get module\n", |
1079 | __func__); | 1079 | __func__); |
1080 | 1080 | ||
1081 | sprintf(ndsp->name, "DSP_C%x(0x%p)", | 1081 | sprintf(ndsp->name, "DSP_C%x(0x%p)", |
1082 | ndsp->up->st->dev->id + 1, ndsp); | 1082 | ndsp->up->st->dev->id + 1, ndsp); |
@@ -1095,7 +1095,7 @@ dspcreate(struct channel_req *crq) | |||
1095 | 1095 | ||
1096 | if (dtmfthreshold < 20 || dtmfthreshold > 500) | 1096 | if (dtmfthreshold < 20 || dtmfthreshold > 500) |
1097 | dtmfthreshold = 200; | 1097 | dtmfthreshold = 200; |
1098 | ndsp->dtmf.treshold = dtmfthreshold*10000; | 1098 | ndsp->dtmf.treshold = dtmfthreshold * 10000; |
1099 | 1099 | ||
1100 | /* init pipeline append to list */ | 1100 | /* init pipeline append to list */ |
1101 | spin_lock_irqsave(&dsp_lock, flags); | 1101 | spin_lock_irqsave(&dsp_lock, flags); |
@@ -1109,7 +1109,7 @@ dspcreate(struct channel_req *crq) | |||
1109 | 1109 | ||
1110 | static struct Bprotocol DSP = { | 1110 | static struct Bprotocol DSP = { |
1111 | .Bprotocols = (1 << (ISDN_P_B_L2DSP & ISDN_P_B_MASK)) | 1111 | .Bprotocols = (1 << (ISDN_P_B_L2DSP & ISDN_P_B_MASK)) |
1112 | | (1 << (ISDN_P_B_L2DSPHDLC & ISDN_P_B_MASK)), | 1112 | | (1 << (ISDN_P_B_L2DSPHDLC & ISDN_P_B_MASK)), |
1113 | .name = "dsp", | 1113 | .name = "dsp", |
1114 | .create = dspcreate | 1114 | .create = dspcreate |
1115 | }; | 1115 | }; |
@@ -1129,21 +1129,21 @@ static int __init dsp_init(void) | |||
1129 | if (dsp_poll) { | 1129 | if (dsp_poll) { |
1130 | if (dsp_poll > MAX_POLL) { | 1130 | if (dsp_poll > MAX_POLL) { |
1131 | printk(KERN_ERR "%s: Wrong poll value (%d), use %d " | 1131 | printk(KERN_ERR "%s: Wrong poll value (%d), use %d " |
1132 | "maximum.\n", __func__, poll, MAX_POLL); | 1132 | "maximum.\n", __func__, poll, MAX_POLL); |
1133 | err = -EINVAL; | 1133 | err = -EINVAL; |
1134 | return err; | 1134 | return err; |
1135 | } | 1135 | } |
1136 | if (dsp_poll < 8) { | 1136 | if (dsp_poll < 8) { |
1137 | printk(KERN_ERR "%s: Wrong poll value (%d), use 8 " | 1137 | printk(KERN_ERR "%s: Wrong poll value (%d), use 8 " |
1138 | "minimum.\n", __func__, dsp_poll); | 1138 | "minimum.\n", __func__, dsp_poll); |
1139 | err = -EINVAL; | 1139 | err = -EINVAL; |
1140 | return err; | 1140 | return err; |
1141 | } | 1141 | } |
1142 | dsp_tics = poll * HZ / 8000; | 1142 | dsp_tics = poll * HZ / 8000; |
1143 | if (dsp_tics * 8000 != poll * HZ) { | 1143 | if (dsp_tics * 8000 != poll * HZ) { |
1144 | printk(KERN_INFO "mISDN_dsp: Cannot clock every %d " | 1144 | printk(KERN_INFO "mISDN_dsp: Cannot clock every %d " |
1145 | "samples (0,125 ms). It is not a multiple of " | 1145 | "samples (0,125 ms). It is not a multiple of " |
1146 | "%d HZ.\n", poll, HZ); | 1146 | "%d HZ.\n", poll, HZ); |
1147 | err = -EINVAL; | 1147 | err = -EINVAL; |
1148 | return err; | 1148 | return err; |
1149 | } | 1149 | } |
@@ -1162,14 +1162,14 @@ static int __init dsp_init(void) | |||
1162 | } | 1162 | } |
1163 | if (dsp_poll == 0) { | 1163 | if (dsp_poll == 0) { |
1164 | printk(KERN_INFO "mISDN_dsp: There is no multiple of kernel " | 1164 | printk(KERN_INFO "mISDN_dsp: There is no multiple of kernel " |
1165 | "clock that equals exactly the duration of 8-256 " | 1165 | "clock that equals exactly the duration of 8-256 " |
1166 | "samples. (Choose kernel clock speed like 100, 250, " | 1166 | "samples. (Choose kernel clock speed like 100, 250, " |
1167 | "300, 1000)\n"); | 1167 | "300, 1000)\n"); |
1168 | err = -EINVAL; | 1168 | err = -EINVAL; |
1169 | return err; | 1169 | return err; |
1170 | } | 1170 | } |
1171 | printk(KERN_INFO "mISDN_dsp: DSP clocks every %d samples. This equals " | 1171 | printk(KERN_INFO "mISDN_dsp: DSP clocks every %d samples. This equals " |
1172 | "%d jiffies.\n", dsp_poll, dsp_tics); | 1172 | "%d jiffies.\n", dsp_poll, dsp_tics); |
1173 | 1173 | ||
1174 | spin_lock_init(&dsp_lock); | 1174 | spin_lock_init(&dsp_lock); |
1175 | INIT_LIST_HEAD(&dsp_ilist); | 1175 | INIT_LIST_HEAD(&dsp_ilist); |
@@ -1177,8 +1177,8 @@ static int __init dsp_init(void) | |||
1177 | 1177 | ||
1178 | /* init conversion tables */ | 1178 | /* init conversion tables */ |
1179 | dsp_audio_generate_law_tables(); | 1179 | dsp_audio_generate_law_tables(); |
1180 | dsp_silence = (dsp_options&DSP_OPT_ULAW) ? 0xff : 0x2a; | 1180 | dsp_silence = (dsp_options & DSP_OPT_ULAW) ? 0xff : 0x2a; |
1181 | dsp_audio_law_to_s32 = (dsp_options&DSP_OPT_ULAW) ? | 1181 | dsp_audio_law_to_s32 = (dsp_options & DSP_OPT_ULAW) ? |
1182 | dsp_audio_ulaw_to_s32 : dsp_audio_alaw_to_s32; | 1182 | dsp_audio_ulaw_to_s32 : dsp_audio_alaw_to_s32; |
1183 | dsp_audio_generate_s2law_table(); | 1183 | dsp_audio_generate_s2law_table(); |
1184 | dsp_audio_generate_seven(); | 1184 | dsp_audio_generate_seven(); |
@@ -1190,7 +1190,7 @@ static int __init dsp_init(void) | |||
1190 | err = dsp_pipeline_module_init(); | 1190 | err = dsp_pipeline_module_init(); |
1191 | if (err) { | 1191 | if (err) { |
1192 | printk(KERN_ERR "mISDN_dsp: Can't initialize pipeline, " | 1192 | printk(KERN_ERR "mISDN_dsp: Can't initialize pipeline, " |
1193 | "error(%d)\n", err); | 1193 | "error(%d)\n", err); |
1194 | return err; | 1194 | return err; |
1195 | } | 1195 | } |
1196 | 1196 | ||
@@ -1221,11 +1221,11 @@ static void __exit dsp_cleanup(void) | |||
1221 | 1221 | ||
1222 | if (!list_empty(&dsp_ilist)) { | 1222 | if (!list_empty(&dsp_ilist)) { |
1223 | printk(KERN_ERR "mISDN_dsp: Audio DSP object inst list not " | 1223 | printk(KERN_ERR "mISDN_dsp: Audio DSP object inst list not " |
1224 | "empty.\n"); | 1224 | "empty.\n"); |
1225 | } | 1225 | } |
1226 | if (!list_empty(&conf_ilist)) { | 1226 | if (!list_empty(&conf_ilist)) { |
1227 | printk(KERN_ERR "mISDN_dsp: Conference list not empty. Not " | 1227 | printk(KERN_ERR "mISDN_dsp: Conference list not empty. Not " |
1228 | "all memory freed.\n"); | 1228 | "all memory freed.\n"); |
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | dsp_pipeline_module_exit(); | 1231 | dsp_pipeline_module_exit(); |
@@ -1233,4 +1233,3 @@ static void __exit dsp_cleanup(void) | |||
1233 | 1233 | ||
1234 | module_init(dsp_init); | 1234 | module_init(dsp_init); |
1235 | module_exit(dsp_cleanup); | 1235 | module_exit(dsp_cleanup); |
1236 | |||
diff --git a/drivers/isdn/mISDN/dsp_dtmf.c b/drivers/isdn/mISDN/dsp_dtmf.c index 5b484c3f4af6..887860bdc63b 100644 --- a/drivers/isdn/mISDN/dsp_dtmf.c +++ b/drivers/isdn/mISDN/dsp_dtmf.c | |||
@@ -61,31 +61,31 @@ void dsp_dtmf_hardware(struct dsp *dsp) | |||
61 | if (dsp->tx_volume) { | 61 | if (dsp->tx_volume) { |
62 | if (dsp_debug & DEBUG_DSP_DTMF) | 62 | if (dsp_debug & DEBUG_DSP_DTMF) |
63 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " | 63 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " |
64 | "because tx_volume is changed\n", | 64 | "because tx_volume is changed\n", |
65 | __func__, dsp->name); | 65 | __func__, dsp->name); |
66 | hardware = 0; | 66 | hardware = 0; |
67 | } | 67 | } |
68 | if (dsp->rx_volume) { | 68 | if (dsp->rx_volume) { |
69 | if (dsp_debug & DEBUG_DSP_DTMF) | 69 | if (dsp_debug & DEBUG_DSP_DTMF) |
70 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " | 70 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " |
71 | "because rx_volume is changed\n", | 71 | "because rx_volume is changed\n", |
72 | __func__, dsp->name); | 72 | __func__, dsp->name); |
73 | hardware = 0; | 73 | hardware = 0; |
74 | } | 74 | } |
75 | /* check if encryption is enabled */ | 75 | /* check if encryption is enabled */ |
76 | if (dsp->bf_enable) { | 76 | if (dsp->bf_enable) { |
77 | if (dsp_debug & DEBUG_DSP_DTMF) | 77 | if (dsp_debug & DEBUG_DSP_DTMF) |
78 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " | 78 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " |
79 | "because encryption is enabled\n", | 79 | "because encryption is enabled\n", |
80 | __func__, dsp->name); | 80 | __func__, dsp->name); |
81 | hardware = 0; | 81 | hardware = 0; |
82 | } | 82 | } |
83 | /* check if pipeline exists */ | 83 | /* check if pipeline exists */ |
84 | if (dsp->pipeline.inuse) { | 84 | if (dsp->pipeline.inuse) { |
85 | if (dsp_debug & DEBUG_DSP_DTMF) | 85 | if (dsp_debug & DEBUG_DSP_DTMF) |
86 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " | 86 | printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " |
87 | "because pipeline exists.\n", | 87 | "because pipeline exists.\n", |
88 | __func__, dsp->name); | 88 | __func__, dsp->name); |
89 | hardware = 0; | 89 | hardware = 0; |
90 | } | 90 | } |
91 | 91 | ||
@@ -150,23 +150,23 @@ again: | |||
150 | if (len < 64) { | 150 | if (len < 64) { |
151 | if (len > 0) | 151 | if (len > 0) |
152 | printk(KERN_ERR "%s: coefficients have invalid " | 152 | printk(KERN_ERR "%s: coefficients have invalid " |
153 | "size. (is=%d < must=%d)\n", | 153 | "size. (is=%d < must=%d)\n", |
154 | __func__, len, 64); | 154 | __func__, len, 64); |
155 | return dsp->dtmf.digits; | 155 | return dsp->dtmf.digits; |
156 | } | 156 | } |
157 | hfccoeff = (s32 *)data; | 157 | hfccoeff = (s32 *)data; |
158 | for (k = 0; k < NCOEFF; k++) { | 158 | for (k = 0; k < NCOEFF; k++) { |
159 | sk2 = (*hfccoeff++)>>4; | 159 | sk2 = (*hfccoeff++) >> 4; |
160 | sk = (*hfccoeff++)>>4; | 160 | sk = (*hfccoeff++) >> 4; |
161 | if (sk > 32767 || sk < -32767 || sk2 > 32767 | 161 | if (sk > 32767 || sk < -32767 || sk2 > 32767 |
162 | || sk2 < -32767) | 162 | || sk2 < -32767) |
163 | printk(KERN_WARNING | 163 | printk(KERN_WARNING |
164 | "DTMF-Detection overflow\n"); | 164 | "DTMF-Detection overflow\n"); |
165 | /* compute |X(k)|**2 */ | 165 | /* compute |X(k)|**2 */ |
166 | result[k] = | 166 | result[k] = |
167 | (sk * sk) - | 167 | (sk * sk) - |
168 | (((cos2pik[k] * sk) >> 15) * sk2) + | 168 | (((cos2pik[k] * sk) >> 15) * sk2) + |
169 | (sk2 * sk2); | 169 | (sk2 * sk2); |
170 | } | 170 | } |
171 | data += 64; | 171 | data += 64; |
172 | len -= 64; | 172 | len -= 64; |
@@ -188,7 +188,7 @@ again: | |||
188 | buf = dsp->dtmf.buffer; | 188 | buf = dsp->dtmf.buffer; |
189 | cos2pik_ = cos2pik[k]; | 189 | cos2pik_ = cos2pik[k]; |
190 | for (n = 0; n < DSP_DTMF_NPOINTS; n++) { | 190 | for (n = 0; n < DSP_DTMF_NPOINTS; n++) { |
191 | sk = ((cos2pik_*sk1)>>15) - sk2 + (*buf++); | 191 | sk = ((cos2pik_ * sk1) >> 15) - sk2 + (*buf++); |
192 | sk2 = sk1; | 192 | sk2 = sk1; |
193 | sk1 = sk; | 193 | sk1 = sk; |
194 | } | 194 | } |
@@ -224,14 +224,14 @@ coefficients: | |||
224 | 224 | ||
225 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) | 225 | if (dsp_debug & DEBUG_DSP_DTMFCOEFF) |
226 | printk(KERN_DEBUG "a %3d %3d %3d %3d %3d %3d %3d %3d" | 226 | printk(KERN_DEBUG "a %3d %3d %3d %3d %3d %3d %3d %3d" |
227 | " tr:%3d r %3d %3d %3d %3d %3d %3d %3d %3d\n", | 227 | " tr:%3d r %3d %3d %3d %3d %3d %3d %3d %3d\n", |
228 | result[0]/10000, result[1]/10000, result[2]/10000, | 228 | result[0] / 10000, result[1] / 10000, result[2] / 10000, |
229 | result[3]/10000, result[4]/10000, result[5]/10000, | 229 | result[3] / 10000, result[4] / 10000, result[5] / 10000, |
230 | result[6]/10000, result[7]/10000, tresh/10000, | 230 | result[6] / 10000, result[7] / 10000, tresh / 10000, |
231 | result[0]/(tresh/100), result[1]/(tresh/100), | 231 | result[0] / (tresh / 100), result[1] / (tresh / 100), |
232 | result[2]/(tresh/100), result[3]/(tresh/100), | 232 | result[2] / (tresh / 100), result[3] / (tresh / 100), |
233 | result[4]/(tresh/100), result[5]/(tresh/100), | 233 | result[4] / (tresh / 100), result[5] / (tresh / 100), |
234 | result[6]/(tresh/100), result[7]/(tresh/100)); | 234 | result[6] / (tresh / 100), result[7] / (tresh / 100)); |
235 | 235 | ||
236 | /* calc digit (lowgroup/highgroup) */ | 236 | /* calc digit (lowgroup/highgroup) */ |
237 | lowgroup = -1; | 237 | lowgroup = -1; |
@@ -247,7 +247,7 @@ coefficients: | |||
247 | break; /* noise in between */ | 247 | break; /* noise in between */ |
248 | } | 248 | } |
249 | /* good level found. This is allowed only one time per group */ | 249 | /* good level found. This is allowed only one time per group */ |
250 | if (i < NCOEFF/2) { | 250 | if (i < NCOEFF / 2) { |
251 | /* lowgroup */ | 251 | /* lowgroup */ |
252 | if (lowgroup >= 0) { | 252 | if (lowgroup >= 0) { |
253 | /* Bad. Another tone found. */ | 253 | /* Bad. Another tone found. */ |
@@ -262,7 +262,7 @@ coefficients: | |||
262 | highgroup = -1; | 262 | highgroup = -1; |
263 | break; | 263 | break; |
264 | } else | 264 | } else |
265 | highgroup = i-(NCOEFF/2); | 265 | highgroup = i - (NCOEFF / 2); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
@@ -285,13 +285,13 @@ storedigit: | |||
285 | if (what) { | 285 | if (what) { |
286 | if (dsp_debug & DEBUG_DSP_DTMF) | 286 | if (dsp_debug & DEBUG_DSP_DTMF) |
287 | printk(KERN_DEBUG "DTMF digit: %c\n", | 287 | printk(KERN_DEBUG "DTMF digit: %c\n", |
288 | what); | 288 | what); |
289 | if ((strlen(dsp->dtmf.digits)+1) | 289 | if ((strlen(dsp->dtmf.digits) + 1) |
290 | < sizeof(dsp->dtmf.digits)) { | 290 | < sizeof(dsp->dtmf.digits)) { |
291 | dsp->dtmf.digits[strlen( | 291 | dsp->dtmf.digits[strlen( |
292 | dsp->dtmf.digits)+1] = '\0'; | 292 | dsp->dtmf.digits) + 1] = '\0'; |
293 | dsp->dtmf.digits[strlen( | 293 | dsp->dtmf.digits[strlen( |
294 | dsp->dtmf.digits)] = what; | 294 | dsp->dtmf.digits)] = what; |
295 | } | 295 | } |
296 | } | 296 | } |
297 | } | 297 | } |
@@ -302,5 +302,3 @@ storedigit: | |||
302 | 302 | ||
303 | goto again; | 303 | goto again; |
304 | } | 304 | } |
305 | |||
306 | |||
diff --git a/drivers/isdn/mISDN/dsp_ecdis.h b/drivers/isdn/mISDN/dsp_ecdis.h index 21dbd153ee26..fed99ac7f6a4 100644 --- a/drivers/isdn/mISDN/dsp_ecdis.h +++ b/drivers/isdn/mISDN/dsp_ecdis.h | |||
@@ -46,15 +46,15 @@ struct ec_disable_detector_state { | |||
46 | static inline void | 46 | static inline void |
47 | echo_can_disable_detector_init(struct ec_disable_detector_state *det) | 47 | echo_can_disable_detector_init(struct ec_disable_detector_state *det) |
48 | { | 48 | { |
49 | /* Elliptic notch */ | 49 | /* Elliptic notch */ |
50 | /* This is actually centred at 2095Hz, but gets the balance we want, due | 50 | /* This is actually centred at 2095Hz, but gets the balance we want, due |
51 | to the asymmetric walls of the notch */ | 51 | to the asymmetric walls of the notch */ |
52 | biquad2_init(&det->notch, | 52 | biquad2_init(&det->notch, |
53 | (int32_t) (-0.7600000*32768.0), | 53 | (int32_t)(-0.7600000 * 32768.0), |
54 | (int32_t) (-0.1183852*32768.0), | 54 | (int32_t)(-0.1183852 * 32768.0), |
55 | (int32_t) (-0.5104039*32768.0), | 55 | (int32_t)(-0.5104039 * 32768.0), |
56 | (int32_t) (0.1567596*32768.0), | 56 | (int32_t)(0.1567596 * 32768.0), |
57 | (int32_t) (1.0000000*32768.0)); | 57 | (int32_t)(1.0000000 * 32768.0)); |
58 | 58 | ||
59 | det->channel_level = 0; | 59 | det->channel_level = 0; |
60 | det->notch_level = 0; | 60 | det->notch_level = 0; |
@@ -67,7 +67,7 @@ echo_can_disable_detector_init(struct ec_disable_detector_state *det) | |||
67 | 67 | ||
68 | static inline int | 68 | static inline int |
69 | echo_can_disable_detector_update(struct ec_disable_detector_state *det, | 69 | echo_can_disable_detector_update(struct ec_disable_detector_state *det, |
70 | int16_t amp) | 70 | int16_t amp) |
71 | { | 71 | { |
72 | int16_t notched; | 72 | int16_t notched; |
73 | 73 | ||
@@ -82,13 +82,13 @@ int16_t amp) | |||
82 | det->notch_level += ((abs(notched) - det->notch_level) >> 4); | 82 | det->notch_level += ((abs(notched) - det->notch_level) >> 4); |
83 | if (det->channel_level > 280) { | 83 | if (det->channel_level > 280) { |
84 | /* There is adequate energy in the channel. | 84 | /* There is adequate energy in the channel. |
85 | Is it mostly at 2100Hz? */ | 85 | Is it mostly at 2100Hz? */ |
86 | if (det->notch_level*6 < det->channel_level) { | 86 | if (det->notch_level * 6 < det->channel_level) { |
87 | /* The notch says yes, so we have the tone. */ | 87 | /* The notch says yes, so we have the tone. */ |
88 | if (!det->tone_present) { | 88 | if (!det->tone_present) { |
89 | /* Do we get a kick every 450+-25ms? */ | 89 | /* Do we get a kick every 450+-25ms? */ |
90 | if (det->tone_cycle_duration >= 425*8 | 90 | if (det->tone_cycle_duration >= 425 * 8 |
91 | && det->tone_cycle_duration <= 475*8) { | 91 | && det->tone_cycle_duration <= 475 * 8) { |
92 | det->good_cycles++; | 92 | det->good_cycles++; |
93 | if (det->good_cycles > 2) | 93 | if (det->good_cycles > 2) |
94 | det->hit = TRUE; | 94 | det->hit = TRUE; |
diff --git a/drivers/isdn/mISDN/dsp_hwec.c b/drivers/isdn/mISDN/dsp_hwec.c index 806a997fe7cc..a6e87076acc2 100644 --- a/drivers/isdn/mISDN/dsp_hwec.c +++ b/drivers/isdn/mISDN/dsp_hwec.c | |||
@@ -56,7 +56,7 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg) | |||
56 | 56 | ||
57 | if (!dsp) { | 57 | if (!dsp) { |
58 | printk(KERN_ERR "%s: failed to enable hwec: dsp is NULL\n", | 58 | printk(KERN_ERR "%s: failed to enable hwec: dsp is NULL\n", |
59 | __func__); | 59 | __func__); |
60 | return; | 60 | return; |
61 | } | 61 | } |
62 | 62 | ||
@@ -93,13 +93,13 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg) | |||
93 | 93 | ||
94 | _do: | 94 | _do: |
95 | printk(KERN_DEBUG "%s: enabling hwec with deftaps=%d\n", | 95 | printk(KERN_DEBUG "%s: enabling hwec with deftaps=%d\n", |
96 | __func__, deftaps); | 96 | __func__, deftaps); |
97 | memset(&cq, 0, sizeof(cq)); | 97 | memset(&cq, 0, sizeof(cq)); |
98 | cq.op = MISDN_CTRL_HFC_ECHOCAN_ON; | 98 | cq.op = MISDN_CTRL_HFC_ECHOCAN_ON; |
99 | cq.p1 = deftaps; | 99 | cq.p1 = deftaps; |
100 | if (!dsp->ch.peer->ctrl(&dsp->ch, CONTROL_CHANNEL, &cq)) { | 100 | if (!dsp->ch.peer->ctrl(&dsp->ch, CONTROL_CHANNEL, &cq)) { |
101 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", | 101 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", |
102 | __func__); | 102 | __func__); |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | } | 105 | } |
@@ -110,7 +110,7 @@ void dsp_hwec_disable(struct dsp *dsp) | |||
110 | 110 | ||
111 | if (!dsp) { | 111 | if (!dsp) { |
112 | printk(KERN_ERR "%s: failed to disable hwec: dsp is NULL\n", | 112 | printk(KERN_ERR "%s: failed to disable hwec: dsp is NULL\n", |
113 | __func__); | 113 | __func__); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | 116 | ||
@@ -119,7 +119,7 @@ void dsp_hwec_disable(struct dsp *dsp) | |||
119 | cq.op = MISDN_CTRL_HFC_ECHOCAN_OFF; | 119 | cq.op = MISDN_CTRL_HFC_ECHOCAN_OFF; |
120 | if (!dsp->ch.peer->ctrl(&dsp->ch, CONTROL_CHANNEL, &cq)) { | 120 | if (!dsp->ch.peer->ctrl(&dsp->ch, CONTROL_CHANNEL, &cq)) { |
121 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", | 121 | printk(KERN_DEBUG "%s: CONTROL_CHANNEL failed\n", |
122 | __func__); | 122 | __func__); |
123 | return; | 123 | return; |
124 | } | 124 | } |
125 | } | 125 | } |
@@ -135,4 +135,3 @@ void dsp_hwec_exit(void) | |||
135 | { | 135 | { |
136 | mISDN_dsp_element_unregister(dsp_hwec); | 136 | mISDN_dsp_element_unregister(dsp_hwec); |
137 | } | 137 | } |
138 | |||
diff --git a/drivers/isdn/mISDN/dsp_hwec.h b/drivers/isdn/mISDN/dsp_hwec.h index eebe80c3f713..bbca1eb5a888 100644 --- a/drivers/isdn/mISDN/dsp_hwec.h +++ b/drivers/isdn/mISDN/dsp_hwec.h | |||
@@ -7,4 +7,3 @@ extern void dsp_hwec_enable(struct dsp *dsp, const char *arg); | |||
7 | extern void dsp_hwec_disable(struct dsp *dsp); | 7 | extern void dsp_hwec_disable(struct dsp *dsp); |
8 | extern int dsp_hwec_init(void); | 8 | extern int dsp_hwec_init(void); |
9 | extern void dsp_hwec_exit(void); | 9 | extern void dsp_hwec_exit(void); |
10 | |||
diff --git a/drivers/isdn/mISDN/dsp_pipeline.c b/drivers/isdn/mISDN/dsp_pipeline.c index b6c9a5889346..88305c9cbff5 100644 --- a/drivers/isdn/mISDN/dsp_pipeline.c +++ b/drivers/isdn/mISDN/dsp_pipeline.c | |||
@@ -63,11 +63,11 @@ attr_show_args(struct device *dev, struct device_attribute *attr, char *buf) | |||
63 | *buf = 0; | 63 | *buf = 0; |
64 | for (i = 0; i < elem->num_args; i++) | 64 | for (i = 0; i < elem->num_args; i++) |
65 | p += sprintf(p, "Name: %s\n%s%s%sDescription: %s\n\n", | 65 | p += sprintf(p, "Name: %s\n%s%s%sDescription: %s\n\n", |
66 | elem->args[i].name, | 66 | elem->args[i].name, |
67 | elem->args[i].def ? "Default: " : "", | 67 | elem->args[i].def ? "Default: " : "", |
68 | elem->args[i].def ? elem->args[i].def : "", | 68 | elem->args[i].def ? elem->args[i].def : "", |
69 | elem->args[i].def ? "\n" : "", | 69 | elem->args[i].def ? "\n" : "", |
70 | elem->args[i].desc); | 70 | elem->args[i].desc); |
71 | 71 | ||
72 | return p - buf; | 72 | return p - buf; |
73 | } | 73 | } |
@@ -106,17 +106,17 @@ int mISDN_dsp_element_register(struct mISDN_dsp_element *elem) | |||
106 | ret = device_register(&entry->dev); | 106 | ret = device_register(&entry->dev); |
107 | if (ret) { | 107 | if (ret) { |
108 | printk(KERN_ERR "%s: failed to register %s\n", | 108 | printk(KERN_ERR "%s: failed to register %s\n", |
109 | __func__, elem->name); | 109 | __func__, elem->name); |
110 | goto err1; | 110 | goto err1; |
111 | } | 111 | } |
112 | list_add_tail(&entry->list, &dsp_elements); | 112 | list_add_tail(&entry->list, &dsp_elements); |
113 | 113 | ||
114 | for (i = 0; i < ARRAY_SIZE(element_attributes); ++i) { | 114 | for (i = 0; i < ARRAY_SIZE(element_attributes); ++i) { |
115 | ret = device_create_file(&entry->dev, | 115 | ret = device_create_file(&entry->dev, |
116 | &element_attributes[i]); | 116 | &element_attributes[i]); |
117 | if (ret) { | 117 | if (ret) { |
118 | printk(KERN_ERR "%s: failed to create device file\n", | 118 | printk(KERN_ERR "%s: failed to create device file\n", |
119 | __func__); | 119 | __func__); |
120 | goto err2; | 120 | goto err2; |
121 | } | 121 | } |
122 | } | 122 | } |
@@ -148,7 +148,7 @@ void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem) | |||
148 | device_unregister(&entry->dev); | 148 | device_unregister(&entry->dev); |
149 | #ifdef PIPELINE_DEBUG | 149 | #ifdef PIPELINE_DEBUG |
150 | printk(KERN_DEBUG "%s: %s unregistered\n", | 150 | printk(KERN_DEBUG "%s: %s unregistered\n", |
151 | __func__, elem->name); | 151 | __func__, elem->name); |
152 | #endif | 152 | #endif |
153 | return; | 153 | return; |
154 | } | 154 | } |
@@ -182,7 +182,7 @@ void dsp_pipeline_module_exit(void) | |||
182 | list_for_each_entry_safe(entry, n, &dsp_elements, list) { | 182 | list_for_each_entry_safe(entry, n, &dsp_elements, list) { |
183 | list_del(&entry->list); | 183 | list_del(&entry->list); |
184 | printk(KERN_WARNING "%s: element was still registered: %s\n", | 184 | printk(KERN_WARNING "%s: element was still registered: %s\n", |
185 | __func__, entry->elem->name); | 185 | __func__, entry->elem->name); |
186 | kfree(entry); | 186 | kfree(entry); |
187 | } | 187 | } |
188 | 188 | ||
@@ -213,7 +213,7 @@ static inline void _dsp_pipeline_destroy(struct dsp_pipeline *pipeline) | |||
213 | list_del(&entry->list); | 213 | list_del(&entry->list); |
214 | if (entry->elem == dsp_hwec) | 214 | if (entry->elem == dsp_hwec) |
215 | dsp_hwec_disable(container_of(pipeline, struct dsp, | 215 | dsp_hwec_disable(container_of(pipeline, struct dsp, |
216 | pipeline)); | 216 | pipeline)); |
217 | else | 217 | else |
218 | entry->elem->free(entry->p); | 218 | entry->elem->free(entry->p); |
219 | kfree(entry); | 219 | kfree(entry); |
@@ -271,11 +271,11 @@ int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg) | |||
271 | elem = entry->elem; | 271 | elem = entry->elem; |
272 | 272 | ||
273 | pipeline_entry = kmalloc(sizeof(struct | 273 | pipeline_entry = kmalloc(sizeof(struct |
274 | dsp_pipeline_entry), GFP_ATOMIC); | 274 | dsp_pipeline_entry), GFP_ATOMIC); |
275 | if (!pipeline_entry) { | 275 | if (!pipeline_entry) { |
276 | printk(KERN_ERR "%s: failed to add " | 276 | printk(KERN_ERR "%s: failed to add " |
277 | "entry to pipeline: %s (out of " | 277 | "entry to pipeline: %s (out of " |
278 | "memory)\n", __func__, elem->name); | 278 | "memory)\n", __func__, elem->name); |
279 | incomplete = 1; | 279 | incomplete = 1; |
280 | goto _out; | 280 | goto _out; |
281 | } | 281 | } |
@@ -285,26 +285,26 @@ int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg) | |||
285 | /* This is a hack to make the hwec | 285 | /* This is a hack to make the hwec |
286 | available as a pipeline module */ | 286 | available as a pipeline module */ |
287 | dsp_hwec_enable(container_of(pipeline, | 287 | dsp_hwec_enable(container_of(pipeline, |
288 | struct dsp, pipeline), args); | 288 | struct dsp, pipeline), args); |
289 | list_add_tail(&pipeline_entry->list, | 289 | list_add_tail(&pipeline_entry->list, |
290 | &pipeline->list); | 290 | &pipeline->list); |
291 | } else { | 291 | } else { |
292 | pipeline_entry->p = elem->new(args); | 292 | pipeline_entry->p = elem->new(args); |
293 | if (pipeline_entry->p) { | 293 | if (pipeline_entry->p) { |
294 | list_add_tail(&pipeline_entry-> | 294 | list_add_tail(&pipeline_entry-> |
295 | list, &pipeline->list); | 295 | list, &pipeline->list); |
296 | #ifdef PIPELINE_DEBUG | 296 | #ifdef PIPELINE_DEBUG |
297 | printk(KERN_DEBUG "%s: created " | 297 | printk(KERN_DEBUG "%s: created " |
298 | "instance of %s%s%s\n", | 298 | "instance of %s%s%s\n", |
299 | __func__, name, args ? | 299 | __func__, name, args ? |
300 | " with args " : "", args ? | 300 | " with args " : "", args ? |
301 | args : ""); | 301 | args : ""); |
302 | #endif | 302 | #endif |
303 | } else { | 303 | } else { |
304 | printk(KERN_ERR "%s: failed " | 304 | printk(KERN_ERR "%s: failed " |
305 | "to add entry to pipeline: " | 305 | "to add entry to pipeline: " |
306 | "%s (new() returned NULL)\n", | 306 | "%s (new() returned NULL)\n", |
307 | __func__, elem->name); | 307 | __func__, elem->name); |
308 | kfree(pipeline_entry); | 308 | kfree(pipeline_entry); |
309 | incomplete = 1; | 309 | incomplete = 1; |
310 | } | 310 | } |
@@ -317,7 +317,7 @@ int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg) | |||
317 | found = 0; | 317 | found = 0; |
318 | else { | 318 | else { |
319 | printk(KERN_ERR "%s: element not found, skipping: " | 319 | printk(KERN_ERR "%s: element not found, skipping: " |
320 | "%s\n", __func__, name); | 320 | "%s\n", __func__, name); |
321 | incomplete = 1; | 321 | incomplete = 1; |
322 | } | 322 | } |
323 | } | 323 | } |
@@ -330,7 +330,7 @@ _out: | |||
330 | 330 | ||
331 | #ifdef PIPELINE_DEBUG | 331 | #ifdef PIPELINE_DEBUG |
332 | printk(KERN_DEBUG "%s: dsp pipeline built%s: %s\n", | 332 | printk(KERN_DEBUG "%s: dsp pipeline built%s: %s\n", |
333 | __func__, incomplete ? " incomplete" : "", cfg); | 333 | __func__, incomplete ? " incomplete" : "", cfg); |
334 | #endif | 334 | #endif |
335 | kfree(dup); | 335 | kfree(dup); |
336 | return 0; | 336 | return 0; |
@@ -349,7 +349,7 @@ void dsp_pipeline_process_tx(struct dsp_pipeline *pipeline, u8 *data, int len) | |||
349 | } | 349 | } |
350 | 350 | ||
351 | void dsp_pipeline_process_rx(struct dsp_pipeline *pipeline, u8 *data, int len, | 351 | void dsp_pipeline_process_rx(struct dsp_pipeline *pipeline, u8 *data, int len, |
352 | unsigned int txlen) | 352 | unsigned int txlen) |
353 | { | 353 | { |
354 | struct dsp_pipeline_entry *entry; | 354 | struct dsp_pipeline_entry *entry; |
355 | 355 | ||
@@ -360,5 +360,3 @@ void dsp_pipeline_process_rx(struct dsp_pipeline *pipeline, u8 *data, int len, | |||
360 | if (entry->elem->process_rx) | 360 | if (entry->elem->process_rx) |
361 | entry->elem->process_rx(entry->p, data, len, txlen); | 361 | entry->elem->process_rx(entry->p, data, len, txlen); |
362 | } | 362 | } |
363 | |||
364 | |||
diff --git a/drivers/isdn/mISDN/dsp_tones.c b/drivers/isdn/mISDN/dsp_tones.c index 4e4440e8bae5..057e0d6a369b 100644 --- a/drivers/isdn/mISDN/dsp_tones.c +++ b/drivers/isdn/mISDN/dsp_tones.c | |||
@@ -239,120 +239,120 @@ static struct pattern { | |||
239 | u32 seq[10]; | 239 | u32 seq[10]; |
240 | } pattern[] = { | 240 | } pattern[] = { |
241 | {TONE_GERMAN_DIALTONE, | 241 | {TONE_GERMAN_DIALTONE, |
242 | {DATA_GA, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 242 | {DATA_GA, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
243 | {SIZE_GA, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 243 | {SIZE_GA, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
244 | {1900, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, | 244 | {1900, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, |
245 | 245 | ||
246 | {TONE_GERMAN_OLDDIALTONE, | 246 | {TONE_GERMAN_OLDDIALTONE, |
247 | {DATA_GO, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 247 | {DATA_GO, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
248 | {SIZE_GO, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 248 | {SIZE_GO, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
249 | {1998, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, | 249 | {1998, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, |
250 | 250 | ||
251 | {TONE_AMERICAN_DIALTONE, | 251 | {TONE_AMERICAN_DIALTONE, |
252 | {DATA_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 252 | {DATA_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
253 | {SIZE_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 253 | {SIZE_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
254 | {8000, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, | 254 | {8000, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, |
255 | 255 | ||
256 | {TONE_GERMAN_DIALPBX, | 256 | {TONE_GERMAN_DIALPBX, |
257 | {DATA_GA, DATA_S, DATA_GA, DATA_S, DATA_GA, DATA_S, NULL, NULL, NULL, | 257 | {DATA_GA, DATA_S, DATA_GA, DATA_S, DATA_GA, DATA_S, NULL, NULL, NULL, |
258 | NULL}, | 258 | NULL}, |
259 | {SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, NULL, NULL, NULL, | 259 | {SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, NULL, NULL, NULL, |
260 | NULL}, | 260 | NULL}, |
261 | {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, | 261 | {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, |
262 | 262 | ||
263 | {TONE_GERMAN_OLDDIALPBX, | 263 | {TONE_GERMAN_OLDDIALPBX, |
264 | {DATA_GO, DATA_S, DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, | 264 | {DATA_GO, DATA_S, DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, |
265 | NULL}, | 265 | NULL}, |
266 | {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, | 266 | {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, |
267 | NULL}, | 267 | NULL}, |
268 | {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, | 268 | {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, |
269 | 269 | ||
270 | {TONE_AMERICAN_DIALPBX, | 270 | {TONE_AMERICAN_DIALPBX, |
271 | {DATA_DT, DATA_S, DATA_DT, DATA_S, DATA_DT, DATA_S, NULL, NULL, NULL, | 271 | {DATA_DT, DATA_S, DATA_DT, DATA_S, DATA_DT, DATA_S, NULL, NULL, NULL, |
272 | NULL}, | 272 | NULL}, |
273 | {SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, NULL, NULL, NULL, | 273 | {SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, NULL, NULL, NULL, |
274 | NULL}, | 274 | NULL}, |
275 | {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, | 275 | {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, |
276 | 276 | ||
277 | {TONE_GERMAN_RINGING, | 277 | {TONE_GERMAN_RINGING, |
278 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 278 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
279 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 279 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
280 | {8000, 32000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 280 | {8000, 32000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
281 | 281 | ||
282 | {TONE_GERMAN_OLDRINGING, | 282 | {TONE_GERMAN_OLDRINGING, |
283 | {DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 283 | {DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
284 | {SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 284 | {SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
285 | {8000, 40000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 285 | {8000, 40000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
286 | 286 | ||
287 | {TONE_AMERICAN_RINGING, | 287 | {TONE_AMERICAN_RINGING, |
288 | {DATA_RI, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 288 | {DATA_RI, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
289 | {SIZE_RI, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 289 | {SIZE_RI, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
290 | {8000, 32000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 290 | {8000, 32000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
291 | 291 | ||
292 | {TONE_GERMAN_RINGPBX, | 292 | {TONE_GERMAN_RINGPBX, |
293 | {DATA_GA, DATA_S, DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 293 | {DATA_GA, DATA_S, DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
294 | {SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 294 | {SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
295 | {4000, 4000, 4000, 28000, 0, 0, 0, 0, 0, 0} }, | 295 | {4000, 4000, 4000, 28000, 0, 0, 0, 0, 0, 0} }, |
296 | 296 | ||
297 | {TONE_GERMAN_OLDRINGPBX, | 297 | {TONE_GERMAN_OLDRINGPBX, |
298 | {DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 298 | {DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
299 | {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 299 | {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
300 | {4000, 4000, 4000, 28000, 0, 0, 0, 0, 0, 0} }, | 300 | {4000, 4000, 4000, 28000, 0, 0, 0, 0, 0, 0} }, |
301 | 301 | ||
302 | {TONE_AMERICAN_RINGPBX, | 302 | {TONE_AMERICAN_RINGPBX, |
303 | {DATA_RI, DATA_S, DATA_RI, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 303 | {DATA_RI, DATA_S, DATA_RI, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
304 | {SIZE_RI, SIZE_S, SIZE_RI, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 304 | {SIZE_RI, SIZE_S, SIZE_RI, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
305 | {4000, 4000, 4000, 28000, 0, 0, 0, 0, 0, 0} }, | 305 | {4000, 4000, 4000, 28000, 0, 0, 0, 0, 0, 0} }, |
306 | 306 | ||
307 | {TONE_GERMAN_BUSY, | 307 | {TONE_GERMAN_BUSY, |
308 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 308 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
309 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 309 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
310 | {4000, 4000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 310 | {4000, 4000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
311 | 311 | ||
312 | {TONE_GERMAN_OLDBUSY, | 312 | {TONE_GERMAN_OLDBUSY, |
313 | {DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 313 | {DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
314 | {SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 314 | {SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
315 | {1000, 5000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 315 | {1000, 5000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
316 | 316 | ||
317 | {TONE_AMERICAN_BUSY, | 317 | {TONE_AMERICAN_BUSY, |
318 | {DATA_BU, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 318 | {DATA_BU, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
319 | {SIZE_BU, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 319 | {SIZE_BU, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
320 | {4000, 4000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 320 | {4000, 4000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
321 | 321 | ||
322 | {TONE_GERMAN_HANGUP, | 322 | {TONE_GERMAN_HANGUP, |
323 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 323 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
324 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 324 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
325 | {4000, 4000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 325 | {4000, 4000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
326 | 326 | ||
327 | {TONE_GERMAN_OLDHANGUP, | 327 | {TONE_GERMAN_OLDHANGUP, |
328 | {DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 328 | {DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
329 | {SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 329 | {SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
330 | {1000, 5000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 330 | {1000, 5000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
331 | 331 | ||
332 | {TONE_AMERICAN_HANGUP, | 332 | {TONE_AMERICAN_HANGUP, |
333 | {DATA_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 333 | {DATA_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
334 | {SIZE_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 334 | {SIZE_DT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
335 | {8000, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, | 335 | {8000, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, |
336 | 336 | ||
337 | {TONE_SPECIAL_INFO, | 337 | {TONE_SPECIAL_INFO, |
338 | {DATA_S1, DATA_S2, DATA_S3, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 338 | {DATA_S1, DATA_S2, DATA_S3, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
339 | {SIZE_S1, SIZE_S2, SIZE_S3, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 339 | {SIZE_S1, SIZE_S2, SIZE_S3, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
340 | {2666, 2666, 2666, 8002, 0, 0, 0, 0, 0, 0} }, | 340 | {2666, 2666, 2666, 8002, 0, 0, 0, 0, 0, 0} }, |
341 | 341 | ||
342 | {TONE_GERMAN_GASSENBESETZT, | 342 | {TONE_GERMAN_GASSENBESETZT, |
343 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 343 | {DATA_GA, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
344 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 344 | {SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
345 | {2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0} }, | 345 | {2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0} }, |
346 | 346 | ||
347 | {TONE_GERMAN_AUFSCHALTTON, | 347 | {TONE_GERMAN_AUFSCHALTTON, |
348 | {DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 348 | {DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
349 | {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, | 349 | {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL, NULL, NULL}, |
350 | {1000, 5000, 1000, 17000, 0, 0, 0, 0, 0, 0} }, | 350 | {1000, 5000, 1000, 17000, 0, 0, 0, 0, 0, 0} }, |
351 | 351 | ||
352 | {0, | 352 | {0, |
353 | {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 353 | {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
354 | {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 354 | {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
355 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, | 355 | {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, |
356 | }; | 356 | }; |
357 | 357 | ||
358 | /****************** | 358 | /****************** |
@@ -386,7 +386,7 @@ void dsp_tone_copy(struct dsp *dsp, u8 *data, int len) | |||
386 | 386 | ||
387 | /* process pattern */ | 387 | /* process pattern */ |
388 | pat = (struct pattern *)tone->pattern; | 388 | pat = (struct pattern *)tone->pattern; |
389 | /* points to the current pattern */ | 389 | /* points to the current pattern */ |
390 | index = tone->index; /* gives current sequence index */ | 390 | index = tone->index; /* gives current sequence index */ |
391 | count = tone->count; /* gives current sample */ | 391 | count = tone->count; /* gives current sample */ |
392 | 392 | ||
@@ -404,19 +404,19 @@ void dsp_tone_copy(struct dsp *dsp, u8 *data, int len) | |||
404 | break; | 404 | break; |
405 | if (dsp_debug & DEBUG_DSP_TONE) | 405 | if (dsp_debug & DEBUG_DSP_TONE) |
406 | printk(KERN_DEBUG "%s: reaching next sequence " | 406 | printk(KERN_DEBUG "%s: reaching next sequence " |
407 | "(index=%d)\n", __func__, index); | 407 | "(index=%d)\n", __func__, index); |
408 | count -= pat->seq[index]; | 408 | count -= pat->seq[index]; |
409 | index++; | 409 | index++; |
410 | } | 410 | } |
411 | /* calculate start and number of samples */ | 411 | /* calculate start and number of samples */ |
412 | start = count % (*(pat->siz[index])); | 412 | start = count % (*(pat->siz[index])); |
413 | num = len; | 413 | num = len; |
414 | if (num+count > pat->seq[index]) | 414 | if (num + count > pat->seq[index]) |
415 | num = pat->seq[index] - count; | 415 | num = pat->seq[index] - count; |
416 | if (num+start > (*(pat->siz[index]))) | 416 | if (num + start > (*(pat->siz[index]))) |
417 | num = (*(pat->siz[index])) - start; | 417 | num = (*(pat->siz[index])) - start; |
418 | /* copy memory */ | 418 | /* copy memory */ |
419 | memcpy(data, pat->data[index]+start, num); | 419 | memcpy(data, pat->data[index] + start, num); |
420 | /* reduce length */ | 420 | /* reduce length */ |
421 | data += num; | 421 | data += num; |
422 | count += num; | 422 | count += num; |
@@ -441,8 +441,8 @@ dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len) | |||
441 | 441 | ||
442 | /* unlocking is not required, because we don't expect a response */ | 442 | /* unlocking is not required, because we don't expect a response */ |
443 | nskb = _alloc_mISDN_skb(PH_CONTROL_REQ, | 443 | nskb = _alloc_mISDN_skb(PH_CONTROL_REQ, |
444 | (len) ? HFC_SPL_LOOP_ON : HFC_SPL_LOOP_OFF, len, sample, | 444 | (len) ? HFC_SPL_LOOP_ON : HFC_SPL_LOOP_OFF, len, sample, |
445 | GFP_ATOMIC); | 445 | GFP_ATOMIC); |
446 | if (nskb) { | 446 | if (nskb) { |
447 | if (dsp->ch.peer) { | 447 | if (dsp->ch.peer) { |
448 | if (dsp->ch.recv(dsp->ch.peer, nskb)) | 448 | if (dsp->ch.recv(dsp->ch.peer, nskb)) |
@@ -528,7 +528,7 @@ dsp_tone(struct dsp *dsp, int tone) | |||
528 | } | 528 | } |
529 | if (dsp_debug & DEBUG_DSP_TONE) | 529 | if (dsp_debug & DEBUG_DSP_TONE) |
530 | printk(KERN_DEBUG "%s: now starting tone %d (index=%d)\n", | 530 | printk(KERN_DEBUG "%s: now starting tone %d (index=%d)\n", |
531 | __func__, tone, 0); | 531 | __func__, tone, 0); |
532 | tonet->tone = tone; | 532 | tonet->tone = tone; |
533 | tonet->pattern = pat; | 533 | tonet->pattern = pat; |
534 | tonet->index = 0; | 534 | tonet->index = 0; |
@@ -550,8 +550,3 @@ dsp_tone(struct dsp *dsp, int tone) | |||
550 | 550 | ||
551 | return 0; | 551 | return 0; |
552 | } | 552 | } |
553 | |||
554 | |||
555 | |||
556 | |||
557 | |||
diff --git a/drivers/isdn/mISDN/fsm.c b/drivers/isdn/mISDN/fsm.c index b5d6553f2dc8..26477d48bbda 100644 --- a/drivers/isdn/mISDN/fsm.c +++ b/drivers/isdn/mISDN/fsm.c | |||
@@ -28,23 +28,23 @@ | |||
28 | 28 | ||
29 | void | 29 | void |
30 | mISDN_FsmNew(struct Fsm *fsm, | 30 | mISDN_FsmNew(struct Fsm *fsm, |
31 | struct FsmNode *fnlist, int fncount) | 31 | struct FsmNode *fnlist, int fncount) |
32 | { | 32 | { |
33 | int i; | 33 | int i; |
34 | 34 | ||
35 | fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count * | 35 | fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count * |
36 | fsm->event_count, GFP_KERNEL); | 36 | fsm->event_count, GFP_KERNEL); |
37 | 37 | ||
38 | for (i = 0; i < fncount; i++) | 38 | for (i = 0; i < fncount; i++) |
39 | if ((fnlist[i].state >= fsm->state_count) || | 39 | if ((fnlist[i].state >= fsm->state_count) || |
40 | (fnlist[i].event >= fsm->event_count)) { | 40 | (fnlist[i].event >= fsm->event_count)) { |
41 | printk(KERN_ERR | 41 | printk(KERN_ERR |
42 | "mISDN_FsmNew Error: %d st(%ld/%ld) ev(%ld/%ld)\n", | 42 | "mISDN_FsmNew Error: %d st(%ld/%ld) ev(%ld/%ld)\n", |
43 | i, (long)fnlist[i].state, (long)fsm->state_count, | 43 | i, (long)fnlist[i].state, (long)fsm->state_count, |
44 | (long)fnlist[i].event, (long)fsm->event_count); | 44 | (long)fnlist[i].event, (long)fsm->event_count); |
45 | } else | 45 | } else |
46 | fsm->jumpmatrix[fsm->state_count * fnlist[i].event + | 46 | fsm->jumpmatrix[fsm->state_count * fnlist[i].event + |
47 | fnlist[i].state] = (FSMFNPTR) fnlist[i].routine; | 47 | fnlist[i].state] = (FSMFNPTR) fnlist[i].routine; |
48 | } | 48 | } |
49 | EXPORT_SYMBOL(mISDN_FsmNew); | 49 | EXPORT_SYMBOL(mISDN_FsmNew); |
50 | 50 | ||
@@ -63,24 +63,24 @@ mISDN_FsmEvent(struct FsmInst *fi, int event, void *arg) | |||
63 | if ((fi->state >= fi->fsm->state_count) || | 63 | if ((fi->state >= fi->fsm->state_count) || |
64 | (event >= fi->fsm->event_count)) { | 64 | (event >= fi->fsm->event_count)) { |
65 | printk(KERN_ERR | 65 | printk(KERN_ERR |
66 | "mISDN_FsmEvent Error st(%ld/%ld) ev(%d/%ld)\n", | 66 | "mISDN_FsmEvent Error st(%ld/%ld) ev(%d/%ld)\n", |
67 | (long)fi->state, (long)fi->fsm->state_count, event, | 67 | (long)fi->state, (long)fi->fsm->state_count, event, |
68 | (long)fi->fsm->event_count); | 68 | (long)fi->fsm->event_count); |
69 | return 1; | 69 | return 1; |
70 | } | 70 | } |
71 | r = fi->fsm->jumpmatrix[fi->fsm->state_count * event + fi->state]; | 71 | r = fi->fsm->jumpmatrix[fi->fsm->state_count * event + fi->state]; |
72 | if (r) { | 72 | if (r) { |
73 | if (fi->debug) | 73 | if (fi->debug) |
74 | fi->printdebug(fi, "State %s Event %s", | 74 | fi->printdebug(fi, "State %s Event %s", |
75 | fi->fsm->strState[fi->state], | 75 | fi->fsm->strState[fi->state], |
76 | fi->fsm->strEvent[event]); | 76 | fi->fsm->strEvent[event]); |
77 | r(fi, event, arg); | 77 | r(fi, event, arg); |
78 | return 0; | 78 | return 0; |
79 | } else { | 79 | } else { |
80 | if (fi->debug) | 80 | if (fi->debug) |
81 | fi->printdebug(fi, "State %s Event %s no action", | 81 | fi->printdebug(fi, "State %s Event %s no action", |
82 | fi->fsm->strState[fi->state], | 82 | fi->fsm->strState[fi->state], |
83 | fi->fsm->strEvent[event]); | 83 | fi->fsm->strEvent[event]); |
84 | return 1; | 84 | return 1; |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -92,7 +92,7 @@ mISDN_FsmChangeState(struct FsmInst *fi, int newstate) | |||
92 | fi->state = newstate; | 92 | fi->state = newstate; |
93 | if (fi->debug) | 93 | if (fi->debug) |
94 | fi->printdebug(fi, "ChangeState %s", | 94 | fi->printdebug(fi, "ChangeState %s", |
95 | fi->fsm->strState[newstate]); | 95 | fi->fsm->strState[newstate]); |
96 | } | 96 | } |
97 | EXPORT_SYMBOL(mISDN_FsmChangeState); | 97 | EXPORT_SYMBOL(mISDN_FsmChangeState); |
98 | 98 | ||
@@ -126,7 +126,7 @@ mISDN_FsmDelTimer(struct FsmTimer *ft, int where) | |||
126 | #if FSM_TIMER_DEBUG | 126 | #if FSM_TIMER_DEBUG |
127 | if (ft->fi->debug) | 127 | if (ft->fi->debug) |
128 | ft->fi->printdebug(ft->fi, "mISDN_FsmDelTimer %lx %d", | 128 | ft->fi->printdebug(ft->fi, "mISDN_FsmDelTimer %lx %d", |
129 | (long) ft, where); | 129 | (long) ft, where); |
130 | #endif | 130 | #endif |
131 | del_timer(&ft->tl); | 131 | del_timer(&ft->tl); |
132 | } | 132 | } |
@@ -134,21 +134,21 @@ EXPORT_SYMBOL(mISDN_FsmDelTimer); | |||
134 | 134 | ||
135 | int | 135 | int |
136 | mISDN_FsmAddTimer(struct FsmTimer *ft, | 136 | mISDN_FsmAddTimer(struct FsmTimer *ft, |
137 | int millisec, int event, void *arg, int where) | 137 | int millisec, int event, void *arg, int where) |
138 | { | 138 | { |
139 | 139 | ||
140 | #if FSM_TIMER_DEBUG | 140 | #if FSM_TIMER_DEBUG |
141 | if (ft->fi->debug) | 141 | if (ft->fi->debug) |
142 | ft->fi->printdebug(ft->fi, "mISDN_FsmAddTimer %lx %d %d", | 142 | ft->fi->printdebug(ft->fi, "mISDN_FsmAddTimer %lx %d %d", |
143 | (long) ft, millisec, where); | 143 | (long) ft, millisec, where); |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | if (timer_pending(&ft->tl)) { | 146 | if (timer_pending(&ft->tl)) { |
147 | if (ft->fi->debug) { | 147 | if (ft->fi->debug) { |
148 | printk(KERN_WARNING | 148 | printk(KERN_WARNING |
149 | "mISDN_FsmAddTimer: timer already active!\n"); | 149 | "mISDN_FsmAddTimer: timer already active!\n"); |
150 | ft->fi->printdebug(ft->fi, | 150 | ft->fi->printdebug(ft->fi, |
151 | "mISDN_FsmAddTimer already active!"); | 151 | "mISDN_FsmAddTimer already active!"); |
152 | } | 152 | } |
153 | return -1; | 153 | return -1; |
154 | } | 154 | } |
@@ -163,13 +163,13 @@ EXPORT_SYMBOL(mISDN_FsmAddTimer); | |||
163 | 163 | ||
164 | void | 164 | void |
165 | mISDN_FsmRestartTimer(struct FsmTimer *ft, | 165 | mISDN_FsmRestartTimer(struct FsmTimer *ft, |
166 | int millisec, int event, void *arg, int where) | 166 | int millisec, int event, void *arg, int where) |
167 | { | 167 | { |
168 | 168 | ||
169 | #if FSM_TIMER_DEBUG | 169 | #if FSM_TIMER_DEBUG |
170 | if (ft->fi->debug) | 170 | if (ft->fi->debug) |
171 | ft->fi->printdebug(ft->fi, "mISDN_FsmRestartTimer %lx %d %d", | 171 | ft->fi->printdebug(ft->fi, "mISDN_FsmRestartTimer %lx %d %d", |
172 | (long) ft, millisec, where); | 172 | (long) ft, millisec, where); |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | if (timer_pending(&ft->tl)) | 175 | if (timer_pending(&ft->tl)) |
diff --git a/drivers/isdn/mISDN/hwchannel.c b/drivers/isdn/mISDN/hwchannel.c index f6e108d0125f..c74c363554c4 100644 --- a/drivers/isdn/mISDN/hwchannel.c +++ b/drivers/isdn/mISDN/hwchannel.c | |||
@@ -206,7 +206,7 @@ recv_Bchannel(struct bchannel *bch, unsigned int id) | |||
206 | hh->id = id; | 206 | hh->id = id; |
207 | if (bch->rcount >= 64) { | 207 | if (bch->rcount >= 64) { |
208 | printk(KERN_WARNING "B-channel %p receive queue overflow, " | 208 | printk(KERN_WARNING "B-channel %p receive queue overflow, " |
209 | "flushing!\n", bch); | 209 | "flushing!\n", bch); |
210 | skb_queue_purge(&bch->rqueue); | 210 | skb_queue_purge(&bch->rqueue); |
211 | bch->rcount = 0; | 211 | bch->rcount = 0; |
212 | return; | 212 | return; |
@@ -231,7 +231,7 @@ recv_Bchannel_skb(struct bchannel *bch, struct sk_buff *skb) | |||
231 | { | 231 | { |
232 | if (bch->rcount >= 64) { | 232 | if (bch->rcount >= 64) { |
233 | printk(KERN_WARNING "B-channel %p receive queue overflow, " | 233 | printk(KERN_WARNING "B-channel %p receive queue overflow, " |
234 | "flushing!\n", bch); | 234 | "flushing!\n", bch); |
235 | skb_queue_purge(&bch->rqueue); | 235 | skb_queue_purge(&bch->rqueue); |
236 | bch->rcount = 0; | 236 | bch->rcount = 0; |
237 | } | 237 | } |
@@ -247,10 +247,10 @@ confirm_Dsend(struct dchannel *dch) | |||
247 | struct sk_buff *skb; | 247 | struct sk_buff *skb; |
248 | 248 | ||
249 | skb = _alloc_mISDN_skb(PH_DATA_CNF, mISDN_HEAD_ID(dch->tx_skb), | 249 | skb = _alloc_mISDN_skb(PH_DATA_CNF, mISDN_HEAD_ID(dch->tx_skb), |
250 | 0, NULL, GFP_ATOMIC); | 250 | 0, NULL, GFP_ATOMIC); |
251 | if (!skb) { | 251 | if (!skb) { |
252 | printk(KERN_ERR "%s: no skb id %x\n", __func__, | 252 | printk(KERN_ERR "%s: no skb id %x\n", __func__, |
253 | mISDN_HEAD_ID(dch->tx_skb)); | 253 | mISDN_HEAD_ID(dch->tx_skb)); |
254 | return; | 254 | return; |
255 | } | 255 | } |
256 | skb_queue_tail(&dch->rqueue, skb); | 256 | skb_queue_tail(&dch->rqueue, skb); |
@@ -279,15 +279,15 @@ confirm_Bsend(struct bchannel *bch) | |||
279 | 279 | ||
280 | if (bch->rcount >= 64) { | 280 | if (bch->rcount >= 64) { |
281 | printk(KERN_WARNING "B-channel %p receive queue overflow, " | 281 | printk(KERN_WARNING "B-channel %p receive queue overflow, " |
282 | "flushing!\n", bch); | 282 | "flushing!\n", bch); |
283 | skb_queue_purge(&bch->rqueue); | 283 | skb_queue_purge(&bch->rqueue); |
284 | bch->rcount = 0; | 284 | bch->rcount = 0; |
285 | } | 285 | } |
286 | skb = _alloc_mISDN_skb(PH_DATA_CNF, mISDN_HEAD_ID(bch->tx_skb), | 286 | skb = _alloc_mISDN_skb(PH_DATA_CNF, mISDN_HEAD_ID(bch->tx_skb), |
287 | 0, NULL, GFP_ATOMIC); | 287 | 0, NULL, GFP_ATOMIC); |
288 | if (!skb) { | 288 | if (!skb) { |
289 | printk(KERN_ERR "%s: no skb id %x\n", __func__, | 289 | printk(KERN_ERR "%s: no skb id %x\n", __func__, |
290 | mISDN_HEAD_ID(bch->tx_skb)); | 290 | mISDN_HEAD_ID(bch->tx_skb)); |
291 | return; | 291 | return; |
292 | } | 292 | } |
293 | bch->rcount++; | 293 | bch->rcount++; |
@@ -349,7 +349,7 @@ dchannel_senddata(struct dchannel *ch, struct sk_buff *skb) | |||
349 | } | 349 | } |
350 | if (skb->len > ch->maxlen) { | 350 | if (skb->len > ch->maxlen) { |
351 | printk(KERN_WARNING "%s: skb too large(%d/%d)\n", | 351 | printk(KERN_WARNING "%s: skb too large(%d/%d)\n", |
352 | __func__, skb->len, ch->maxlen); | 352 | __func__, skb->len, ch->maxlen); |
353 | return -EINVAL; | 353 | return -EINVAL; |
354 | } | 354 | } |
355 | /* HW lock must be obtained */ | 355 | /* HW lock must be obtained */ |
@@ -376,15 +376,15 @@ bchannel_senddata(struct bchannel *ch, struct sk_buff *skb) | |||
376 | } | 376 | } |
377 | if (skb->len > ch->maxlen) { | 377 | if (skb->len > ch->maxlen) { |
378 | printk(KERN_WARNING "%s: skb too large(%d/%d)\n", | 378 | printk(KERN_WARNING "%s: skb too large(%d/%d)\n", |
379 | __func__, skb->len, ch->maxlen); | 379 | __func__, skb->len, ch->maxlen); |
380 | return -EINVAL; | 380 | return -EINVAL; |
381 | } | 381 | } |
382 | /* HW lock must be obtained */ | 382 | /* HW lock must be obtained */ |
383 | /* check for pending next_skb */ | 383 | /* check for pending next_skb */ |
384 | if (ch->next_skb) { | 384 | if (ch->next_skb) { |
385 | printk(KERN_WARNING | 385 | printk(KERN_WARNING |
386 | "%s: next_skb exist ERROR (skb->len=%d next_skb->len=%d)\n", | 386 | "%s: next_skb exist ERROR (skb->len=%d next_skb->len=%d)\n", |
387 | __func__, skb->len, ch->next_skb->len); | 387 | __func__, skb->len, ch->next_skb->len); |
388 | return -EBUSY; | 388 | return -EBUSY; |
389 | } | 389 | } |
390 | if (test_and_set_bit(FLG_TX_BUSY, &ch->Flags)) { | 390 | if (test_and_set_bit(FLG_TX_BUSY, &ch->Flags)) { |
diff --git a/drivers/isdn/mISDN/l1oip.h b/drivers/isdn/mISDN/l1oip.h index bc26c890d9a2..661c060ada49 100644 --- a/drivers/isdn/mISDN/l1oip.h +++ b/drivers/isdn/mISDN/l1oip.h | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | /* enable to disorder received bchannels by sequence 2143658798... */ | 11 | /* enable to disorder received bchannels by sequence 2143658798... */ |
12 | /* | 12 | /* |
13 | #define REORDER_DEBUG | 13 | #define REORDER_DEBUG |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* frames */ | 16 | /* frames */ |
@@ -29,8 +29,8 @@ | |||
29 | 29 | ||
30 | /* channel structure */ | 30 | /* channel structure */ |
31 | struct l1oip_chan { | 31 | struct l1oip_chan { |
32 | struct dchannel *dch; | 32 | struct dchannel *dch; |
33 | struct bchannel *bch; | 33 | struct bchannel *bch; |
34 | u32 tx_counter; /* counts xmit bytes/packets */ | 34 | u32 tx_counter; /* counts xmit bytes/packets */ |
35 | u32 rx_counter; /* counts recv bytes/packets */ | 35 | u32 rx_counter; /* counts recv bytes/packets */ |
36 | u32 codecstate; /* used by codec to save data */ | 36 | u32 codecstate; /* used by codec to save data */ |
@@ -60,19 +60,19 @@ struct l1oip { | |||
60 | int limit; /* limit number of bchannels */ | 60 | int limit; /* limit number of bchannels */ |
61 | 61 | ||
62 | /* timer */ | 62 | /* timer */ |
63 | struct timer_list keep_tl; | 63 | struct timer_list keep_tl; |
64 | struct timer_list timeout_tl; | 64 | struct timer_list timeout_tl; |
65 | int timeout_on; | 65 | int timeout_on; |
66 | struct work_struct workq; | 66 | struct work_struct workq; |
67 | 67 | ||
68 | /* socket */ | 68 | /* socket */ |
69 | struct socket *socket; /* if set, socket is created */ | 69 | struct socket *socket; /* if set, socket is created */ |
70 | struct completion socket_complete;/* completion of sock thread */ | 70 | struct completion socket_complete;/* completion of sock thread */ |
71 | struct task_struct *socket_thread; | 71 | struct task_struct *socket_thread; |
72 | spinlock_t socket_lock; /* access sock outside thread */ | 72 | spinlock_t socket_lock; /* access sock outside thread */ |
73 | u32 remoteip; /* if all set, ip is assigned */ | 73 | u32 remoteip; /* if all set, ip is assigned */ |
74 | u16 localport; /* must always be set */ | 74 | u16 localport; /* must always be set */ |
75 | u16 remoteport; /* must always be set */ | 75 | u16 remoteport; /* must always be set */ |
76 | struct sockaddr_in sin_local; /* local socket name */ | 76 | struct sockaddr_in sin_local; /* local socket name */ |
77 | struct sockaddr_in sin_remote; /* remote socket name */ | 77 | struct sockaddr_in sin_remote; /* remote socket name */ |
78 | struct msghdr sendmsg; /* ip message to send */ | 78 | struct msghdr sendmsg; /* ip message to send */ |
@@ -88,4 +88,3 @@ extern int l1oip_alaw_to_ulaw(u8 *data, int len, u8 *result); | |||
88 | extern int l1oip_ulaw_to_alaw(u8 *data, int len, u8 *result); | 88 | extern int l1oip_ulaw_to_alaw(u8 *data, int len, u8 *result); |
89 | extern void l1oip_4bit_free(void); | 89 | extern void l1oip_4bit_free(void); |
90 | extern int l1oip_4bit_alloc(int ulaw); | 90 | extern int l1oip_4bit_alloc(int ulaw); |
91 | |||
diff --git a/drivers/isdn/mISDN/l1oip_codec.c b/drivers/isdn/mISDN/l1oip_codec.c index 5a89972624d8..a601c8472220 100644 --- a/drivers/isdn/mISDN/l1oip_codec.c +++ b/drivers/isdn/mISDN/l1oip_codec.c | |||
@@ -27,22 +27,22 @@ | |||
27 | 27 | ||
28 | /* | 28 | /* |
29 | 29 | ||
30 | How the codec works: | 30 | How the codec works: |
31 | -------------------- | 31 | -------------------- |
32 | 32 | ||
33 | The volume is increased to increase the dynamic range of the audio signal. | 33 | The volume is increased to increase the dynamic range of the audio signal. |
34 | Each sample is converted to a-LAW with only 16 steps of level resolution. | 34 | Each sample is converted to a-LAW with only 16 steps of level resolution. |
35 | A pair of two samples are stored in one byte. | 35 | A pair of two samples are stored in one byte. |
36 | 36 | ||
37 | The first byte is stored in the upper bits, the second byte is stored in the | 37 | The first byte is stored in the upper bits, the second byte is stored in the |
38 | lower bits. | 38 | lower bits. |
39 | 39 | ||
40 | To speed up compression and decompression, two lookup tables are formed: | 40 | To speed up compression and decompression, two lookup tables are formed: |
41 | 41 | ||
42 | - 16 bits index for two samples (law encoded) with 8 bit compressed result. | 42 | - 16 bits index for two samples (law encoded) with 8 bit compressed result. |
43 | - 8 bits index for one compressed data with 16 bits decompressed result. | 43 | - 8 bits index for one compressed data with 16 bits decompressed result. |
44 | 44 | ||
45 | NOTE: The bytes are handled as they are law-encoded. | 45 | NOTE: The bytes are handled as they are law-encoded. |
46 | 46 | ||
47 | */ | 47 | */ |
48 | 48 | ||
@@ -232,7 +232,7 @@ l1oip_law_to_4bit(u8 *data, int len, u8 *result, u32 *state) | |||
232 | 232 | ||
233 | /* send saved byte and first input byte */ | 233 | /* send saved byte and first input byte */ |
234 | if (*state) { | 234 | if (*state) { |
235 | *result++ = table_com[(((*state)<<8)&0xff00) | (*data++)]; | 235 | *result++ = table_com[(((*state) << 8) & 0xff00) | (*data++)]; |
236 | len--; | 236 | len--; |
237 | o++; | 237 | o++; |
238 | } | 238 | } |
@@ -267,7 +267,7 @@ l1oip_4bit_to_law(u8 *data, int len, u8 *result) | |||
267 | 267 | ||
268 | while (i < len) { | 268 | while (i < len) { |
269 | r = table_dec[*data++]; | 269 | r = table_dec[*data++]; |
270 | *result++ = r>>8; | 270 | *result++ = r >> 8; |
271 | *result++ = r; | 271 | *result++ = r; |
272 | i++; | 272 | i++; |
273 | } | 273 | } |
@@ -345,8 +345,8 @@ l1oip_4bit_alloc(int ulaw) | |||
345 | c = alaw_to_4bit[i1]; | 345 | c = alaw_to_4bit[i1]; |
346 | i2 = 0; | 346 | i2 = 0; |
347 | while (i2 < 256) { | 347 | while (i2 < 256) { |
348 | table_com[(i1<<8) | i2] |= (c<<4); | 348 | table_com[(i1 << 8) | i2] |= (c << 4); |
349 | table_com[(i2<<8) | i1] |= c; | 349 | table_com[(i2 << 8) | i1] |= c; |
350 | i2++; | 350 | i2++; |
351 | } | 351 | } |
352 | i1++; | 352 | i1++; |
@@ -361,8 +361,8 @@ l1oip_4bit_alloc(int ulaw) | |||
361 | sample = _4bit_to_alaw[i1]; | 361 | sample = _4bit_to_alaw[i1]; |
362 | i2 = 0; | 362 | i2 = 0; |
363 | while (i2 < 16) { | 363 | while (i2 < 16) { |
364 | table_dec[(i1<<4) | i2] |= (sample<<8); | 364 | table_dec[(i1 << 4) | i2] |= (sample << 8); |
365 | table_dec[(i2<<4) | i1] |= sample; | 365 | table_dec[(i2 << 4) | i1] |= sample; |
366 | i2++; | 366 | i2++; |
367 | } | 367 | } |
368 | i1++; | 368 | i1++; |
@@ -370,5 +370,3 @@ l1oip_4bit_alloc(int ulaw) | |||
370 | 370 | ||
371 | return 0; | 371 | return 0; |
372 | } | 372 | } |
373 | |||
374 | |||
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index 04f115a9c43e..0f88acf1185f 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c | |||
@@ -24,63 +24,63 @@ | |||
24 | 24 | ||
25 | /* module parameters: | 25 | /* module parameters: |
26 | * type: | 26 | * type: |
27 | Value 1 = BRI | 27 | Value 1 = BRI |
28 | Value 2 = PRI | 28 | Value 2 = PRI |
29 | Value 3 = BRI (multi channel frame, not supported yet) | 29 | Value 3 = BRI (multi channel frame, not supported yet) |
30 | Value 4 = PRI (multi channel frame, not supported yet) | 30 | Value 4 = PRI (multi channel frame, not supported yet) |
31 | A multi channel frame reduces overhead to a single frame for all | 31 | A multi channel frame reduces overhead to a single frame for all |
32 | b-channels, but increases delay. | 32 | b-channels, but increases delay. |
33 | (NOTE: Multi channel frames are not implemented yet.) | 33 | (NOTE: Multi channel frames are not implemented yet.) |
34 | 34 | ||
35 | * codec: | 35 | * codec: |
36 | Value 0 = transparent (default) | 36 | Value 0 = transparent (default) |
37 | Value 1 = transfer ALAW | 37 | Value 1 = transfer ALAW |
38 | Value 2 = transfer ULAW | 38 | Value 2 = transfer ULAW |
39 | Value 3 = transfer generic 4 bit compression. | 39 | Value 3 = transfer generic 4 bit compression. |
40 | 40 | ||
41 | * ulaw: | 41 | * ulaw: |
42 | 0 = we use a-Law (default) | 42 | 0 = we use a-Law (default) |
43 | 1 = we use u-Law | 43 | 1 = we use u-Law |
44 | 44 | ||
45 | * limit: | 45 | * limit: |
46 | limitation of B-channels to control bandwidth (1...126) | 46 | limitation of B-channels to control bandwidth (1...126) |
47 | BRI: 1 or 2 | 47 | BRI: 1 or 2 |
48 | PRI: 1-30, 31-126 (126, because dchannel ist not counted here) | 48 | PRI: 1-30, 31-126 (126, because dchannel ist not counted here) |
49 | Also limited ressources are used for stack, resulting in less channels. | 49 | Also limited ressources are used for stack, resulting in less channels. |
50 | It is possible to have more channels than 30 in PRI mode, this must | 50 | It is possible to have more channels than 30 in PRI mode, this must |
51 | be supported by the application. | 51 | be supported by the application. |
52 | 52 | ||
53 | * ip: | 53 | * ip: |
54 | byte representation of remote ip address (127.0.0.1 -> 127,0,0,1) | 54 | byte representation of remote ip address (127.0.0.1 -> 127,0,0,1) |
55 | If not given or four 0, no remote address is set. | 55 | If not given or four 0, no remote address is set. |
56 | For multiple interfaces, concat ip addresses. (127,0,0,1,127,0,0,1) | 56 | For multiple interfaces, concat ip addresses. (127,0,0,1,127,0,0,1) |
57 | 57 | ||
58 | * port: | 58 | * port: |
59 | port number (local interface) | 59 | port number (local interface) |
60 | If not given or 0, port 931 is used for fist instance, 932 for next... | 60 | If not given or 0, port 931 is used for fist instance, 932 for next... |
61 | For multiple interfaces, different ports must be given. | 61 | For multiple interfaces, different ports must be given. |
62 | 62 | ||
63 | * remoteport: | 63 | * remoteport: |
64 | port number (remote interface) | 64 | port number (remote interface) |
65 | If not given or 0, remote port equals local port | 65 | If not given or 0, remote port equals local port |
66 | For multiple interfaces on equal sites, different ports must be given. | 66 | For multiple interfaces on equal sites, different ports must be given. |
67 | 67 | ||
68 | * ondemand: | 68 | * ondemand: |
69 | 0 = fixed (always transmit packets, even when remote side timed out) | 69 | 0 = fixed (always transmit packets, even when remote side timed out) |
70 | 1 = on demand (only transmit packets, when remote side is detected) | 70 | 1 = on demand (only transmit packets, when remote side is detected) |
71 | the default is 0 | 71 | the default is 0 |
72 | NOTE: ID must also be set for on demand. | 72 | NOTE: ID must also be set for on demand. |
73 | 73 | ||
74 | * id: | 74 | * id: |
75 | optional value to identify frames. This value must be equal on both | 75 | optional value to identify frames. This value must be equal on both |
76 | peers and should be random. If omitted or 0, no ID is transmitted. | 76 | peers and should be random. If omitted or 0, no ID is transmitted. |
77 | 77 | ||
78 | * debug: | 78 | * debug: |
79 | NOTE: only one debug value must be given for all cards | 79 | NOTE: only one debug value must be given for all cards |
80 | enable debugging (see l1oip.h for debug options) | 80 | enable debugging (see l1oip.h for debug options) |
81 | 81 | ||
82 | 82 | ||
83 | Special mISDN controls: | 83 | Special mISDN controls: |
84 | 84 | ||
85 | op = MISDN_CTRL_SETPEER* | 85 | op = MISDN_CTRL_SETPEER* |
86 | p1 = bytes 0-3 : remote IP address in network order (left element first) | 86 | p1 = bytes 0-3 : remote IP address in network order (left element first) |
@@ -91,133 +91,133 @@ Special mISDN controls: | |||
91 | op = MISDN_CTRL_UNSETPEER* | 91 | op = MISDN_CTRL_UNSETPEER* |
92 | 92 | ||
93 | * Use l1oipctrl for comfortable setting or removing ip address. | 93 | * Use l1oipctrl for comfortable setting or removing ip address. |
94 | (Layer 1 Over IP CTRL) | 94 | (Layer 1 Over IP CTRL) |
95 | 95 | ||
96 | 96 | ||
97 | L1oIP-Protocol | 97 | L1oIP-Protocol |
98 | -------------- | 98 | -------------- |
99 | 99 | ||
100 | Frame Header: | 100 | Frame Header: |
101 | 101 | ||
102 | 7 6 5 4 3 2 1 0 | 102 | 7 6 5 4 3 2 1 0 |
103 | +---------------+ | 103 | +---------------+ |
104 | |Ver|T|I|Coding | | 104 | |Ver|T|I|Coding | |
105 | +---------------+ | 105 | +---------------+ |
106 | | ID byte 3 * | | 106 | | ID byte 3 * | |
107 | +---------------+ | 107 | +---------------+ |
108 | | ID byte 2 * | | 108 | | ID byte 2 * | |
109 | +---------------+ | 109 | +---------------+ |
110 | | ID byte 1 * | | 110 | | ID byte 1 * | |
111 | +---------------+ | 111 | +---------------+ |
112 | | ID byte 0 * | | 112 | | ID byte 0 * | |
113 | +---------------+ | 113 | +---------------+ |
114 | |M| Channel | | 114 | |M| Channel | |
115 | +---------------+ | 115 | +---------------+ |
116 | | Length * | | 116 | | Length * | |
117 | +---------------+ | 117 | +---------------+ |
118 | | Time Base MSB | | 118 | | Time Base MSB | |
119 | +---------------+ | 119 | +---------------+ |
120 | | Time Base LSB | | 120 | | Time Base LSB | |
121 | +---------------+ | 121 | +---------------+ |
122 | | Data.... | | 122 | | Data.... | |
123 | 123 | ||
124 | ... | 124 | ... |
125 | 125 | ||
126 | | | | 126 | | | |
127 | +---------------+ | 127 | +---------------+ |
128 | |M| Channel | | 128 | |M| Channel | |
129 | +---------------+ | 129 | +---------------+ |
130 | | Length * | | 130 | | Length * | |
131 | +---------------+ | 131 | +---------------+ |
132 | | Time Base MSB | | 132 | | Time Base MSB | |
133 | +---------------+ | 133 | +---------------+ |
134 | | Time Base LSB | | 134 | | Time Base LSB | |
135 | +---------------+ | 135 | +---------------+ |
136 | | Data.... | | 136 | | Data.... | |
137 | 137 | ||
138 | ... | 138 | ... |
139 | 139 | ||
140 | 140 | ||
141 | * Only included in some cases. | 141 | * Only included in some cases. |
142 | 142 | ||
143 | - Ver = Version | 143 | - Ver = Version |
144 | If version is missmatch, the frame must be ignored. | 144 | If version is missmatch, the frame must be ignored. |
145 | 145 | ||
146 | - T = Type of interface | 146 | - T = Type of interface |
147 | Must be 0 for S0 or 1 for E1. | 147 | Must be 0 for S0 or 1 for E1. |
148 | 148 | ||
149 | - I = Id present | 149 | - I = Id present |
150 | If bit is set, four ID bytes are included in frame. | 150 | If bit is set, four ID bytes are included in frame. |
151 | 151 | ||
152 | - ID = Connection ID | 152 | - ID = Connection ID |
153 | Additional ID to prevent Denial of Service attacs. Also it prevents hijacking | 153 | Additional ID to prevent Denial of Service attacs. Also it prevents hijacking |
154 | connections with dynamic IP. The ID should be random and must not be 0. | 154 | connections with dynamic IP. The ID should be random and must not be 0. |
155 | 155 | ||
156 | - Coding = Type of codec | 156 | - Coding = Type of codec |
157 | Must be 0 for no transcoding. Also for D-channel and other HDLC frames. | 157 | Must be 0 for no transcoding. Also for D-channel and other HDLC frames. |
158 | 1 and 2 are reserved for explicitly use of a-LAW or u-LAW codec. | 158 | 1 and 2 are reserved for explicitly use of a-LAW or u-LAW codec. |
159 | 3 is used for generic table compressor. | 159 | 3 is used for generic table compressor. |
160 | 160 | ||
161 | - M = More channels to come. If this flag is 1, the following byte contains | 161 | - M = More channels to come. If this flag is 1, the following byte contains |
162 | the length of the channel data. After the data block, the next channel will | 162 | the length of the channel data. After the data block, the next channel will |
163 | be defined. The flag for the last channel block (or if only one channel is | 163 | be defined. The flag for the last channel block (or if only one channel is |
164 | transmitted), must be 0 and no length is given. | 164 | transmitted), must be 0 and no length is given. |
165 | 165 | ||
166 | - Channel = Channel number | 166 | - Channel = Channel number |
167 | 0 reserved | 167 | 0 reserved |
168 | 1-3 channel data for S0 (3 is D-channel) | 168 | 1-3 channel data for S0 (3 is D-channel) |
169 | 1-31 channel data for E1 (16 is D-channel) | 169 | 1-31 channel data for E1 (16 is D-channel) |
170 | 32-127 channel data for extended E1 (16 is D-channel) | 170 | 32-127 channel data for extended E1 (16 is D-channel) |
171 | 171 | ||
172 | - The length is used if the M-flag is 1. It is used to find the next channel | 172 | - The length is used if the M-flag is 1. It is used to find the next channel |
173 | inside frame. | 173 | inside frame. |
174 | NOTE: A value of 0 equals 256 bytes of data. | 174 | NOTE: A value of 0 equals 256 bytes of data. |
175 | -> For larger data blocks, a single frame must be used. | 175 | -> For larger data blocks, a single frame must be used. |
176 | -> For larger streams, a single frame or multiple blocks with same channel ID | 176 | -> For larger streams, a single frame or multiple blocks with same channel ID |
177 | must be used. | 177 | must be used. |
178 | 178 | ||
179 | - Time Base = Timestamp of first sample in frame | 179 | - Time Base = Timestamp of first sample in frame |
180 | The "Time Base" is used to rearange packets and to detect packet loss. | 180 | The "Time Base" is used to rearange packets and to detect packet loss. |
181 | The 16 bits are sent in network order (MSB first) and count 1/8000 th of a | 181 | The 16 bits are sent in network order (MSB first) and count 1/8000 th of a |
182 | second. This causes a wrap around each 8,192 seconds. There is no requirement | 182 | second. This causes a wrap around each 8,192 seconds. There is no requirement |
183 | for the initial "Time Base", but 0 should be used for the first packet. | 183 | for the initial "Time Base", but 0 should be used for the first packet. |
184 | In case of HDLC data, this timestamp counts the packet or byte number. | 184 | In case of HDLC data, this timestamp counts the packet or byte number. |
185 | 185 | ||
186 | 186 | ||
187 | Two Timers: | 187 | Two Timers: |
188 | 188 | ||
189 | After initialisation, a timer of 15 seconds is started. Whenever a packet is | 189 | After initialisation, a timer of 15 seconds is started. Whenever a packet is |
190 | transmitted, the timer is reset to 15 seconds again. If the timer expires, an | 190 | transmitted, the timer is reset to 15 seconds again. If the timer expires, an |
191 | empty packet is transmitted. This keep the connection alive. | 191 | empty packet is transmitted. This keep the connection alive. |
192 | 192 | ||
193 | When a valid packet is received, a timer 65 seconds is started. The interface | 193 | When a valid packet is received, a timer 65 seconds is started. The interface |
194 | become ACTIVE. If the timer expires, the interface becomes INACTIVE. | 194 | become ACTIVE. If the timer expires, the interface becomes INACTIVE. |
195 | 195 | ||
196 | 196 | ||
197 | Dynamic IP handling: | 197 | Dynamic IP handling: |
198 | 198 | ||
199 | To allow dynamic IP, the ID must be non 0. In this case, any packet with the | 199 | To allow dynamic IP, the ID must be non 0. In this case, any packet with the |
200 | correct port number and ID will be accepted. If the remote side changes its IP | 200 | correct port number and ID will be accepted. If the remote side changes its IP |
201 | the new IP is used for all transmitted packets until it changes again. | 201 | the new IP is used for all transmitted packets until it changes again. |
202 | 202 | ||
203 | 203 | ||
204 | On Demand: | 204 | On Demand: |
205 | 205 | ||
206 | If the ondemand parameter is given, the remote IP is set to 0 on timeout. | 206 | If the ondemand parameter is given, the remote IP is set to 0 on timeout. |
207 | This will stop keepalive traffic to remote. If the remote is online again, | 207 | This will stop keepalive traffic to remote. If the remote is online again, |
208 | traffic will continue to the remote address. This is useful for road warriors. | 208 | traffic will continue to the remote address. This is useful for road warriors. |
209 | This feature only works with ID set, otherwhise it is highly unsecure. | 209 | This feature only works with ID set, otherwhise it is highly unsecure. |
210 | 210 | ||
211 | 211 | ||
212 | Socket and Thread | 212 | Socket and Thread |
213 | ----------------- | 213 | ----------------- |
214 | 214 | ||
215 | The complete socket opening and closing is done by a thread. | 215 | The complete socket opening and closing is done by a thread. |
216 | When the thread opened a socket, the hc->socket descriptor is set. Whenever a | 216 | When the thread opened a socket, the hc->socket descriptor is set. Whenever a |
217 | packet shall be sent to the socket, the hc->socket must be checked wheter not | 217 | packet shall be sent to the socket, the hc->socket must be checked wheter not |
218 | NULL. To prevent change in socket descriptor, the hc->socket_lock must be used. | 218 | NULL. To prevent change in socket descriptor, the hc->socket_lock must be used. |
219 | To change the socket, a recall of l1oip_socket_open() will safely kill the | 219 | To change the socket, a recall of l1oip_socket_open() will safely kill the |
220 | socket process and create a new one. | 220 | socket process and create a new one. |
221 | 221 | ||
222 | */ | 222 | */ |
223 | 223 | ||
@@ -247,7 +247,7 @@ static struct list_head l1oip_ilist; | |||
247 | #define MAX_CARDS 16 | 247 | #define MAX_CARDS 16 |
248 | static u_int type[MAX_CARDS]; | 248 | static u_int type[MAX_CARDS]; |
249 | static u_int codec[MAX_CARDS]; | 249 | static u_int codec[MAX_CARDS]; |
250 | static u_int ip[MAX_CARDS*4]; | 250 | static u_int ip[MAX_CARDS * 4]; |
251 | static u_int port[MAX_CARDS]; | 251 | static u_int port[MAX_CARDS]; |
252 | static u_int remoteport[MAX_CARDS]; | 252 | static u_int remoteport[MAX_CARDS]; |
253 | static u_int ondemand[MAX_CARDS]; | 253 | static u_int ondemand[MAX_CARDS]; |
@@ -274,26 +274,26 @@ module_param(debug, uint, S_IRUGO | S_IWUSR); | |||
274 | */ | 274 | */ |
275 | static int | 275 | static int |
276 | l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, | 276 | l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, |
277 | u16 timebase, u8 *buf, int len) | 277 | u16 timebase, u8 *buf, int len) |
278 | { | 278 | { |
279 | u8 *p; | 279 | u8 *p; |
280 | int multi = 0; | 280 | int multi = 0; |
281 | u8 frame[len+32]; | 281 | u8 frame[len + 32]; |
282 | struct socket *socket = NULL; | 282 | struct socket *socket = NULL; |
283 | 283 | ||
284 | if (debug & DEBUG_L1OIP_MSG) | 284 | if (debug & DEBUG_L1OIP_MSG) |
285 | printk(KERN_DEBUG "%s: sending data to socket (len = %d)\n", | 285 | printk(KERN_DEBUG "%s: sending data to socket (len = %d)\n", |
286 | __func__, len); | 286 | __func__, len); |
287 | 287 | ||
288 | p = frame; | 288 | p = frame; |
289 | 289 | ||
290 | /* restart timer */ | 290 | /* restart timer */ |
291 | if ((int)(hc->keep_tl.expires-jiffies) < 5*HZ) { | 291 | if ((int)(hc->keep_tl.expires-jiffies) < 5 * HZ) { |
292 | del_timer(&hc->keep_tl); | 292 | del_timer(&hc->keep_tl); |
293 | hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE*HZ; | 293 | hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ; |
294 | add_timer(&hc->keep_tl); | 294 | add_timer(&hc->keep_tl); |
295 | } else | 295 | } else |
296 | hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE*HZ; | 296 | hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ; |
297 | 297 | ||
298 | if (debug & DEBUG_L1OIP_MSG) | 298 | if (debug & DEBUG_L1OIP_MSG) |
299 | printk(KERN_DEBUG "%s: resetting timer\n", __func__); | 299 | printk(KERN_DEBUG "%s: resetting timer\n", __func__); |
@@ -302,25 +302,25 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, | |||
302 | if (!hc->sin_remote.sin_addr.s_addr || !hc->sin_remote.sin_port) { | 302 | if (!hc->sin_remote.sin_addr.s_addr || !hc->sin_remote.sin_port) { |
303 | if (debug & DEBUG_L1OIP_MSG) | 303 | if (debug & DEBUG_L1OIP_MSG) |
304 | printk(KERN_DEBUG "%s: dropping frame, because remote " | 304 | printk(KERN_DEBUG "%s: dropping frame, because remote " |
305 | "IP is not set.\n", __func__); | 305 | "IP is not set.\n", __func__); |
306 | return len; | 306 | return len; |
307 | } | 307 | } |
308 | 308 | ||
309 | /* assemble frame */ | 309 | /* assemble frame */ |
310 | *p++ = (L1OIP_VERSION<<6) /* version and coding */ | 310 | *p++ = (L1OIP_VERSION << 6) /* version and coding */ |
311 | | (hc->pri ? 0x20 : 0x00) /* type */ | 311 | | (hc->pri ? 0x20 : 0x00) /* type */ |
312 | | (hc->id ? 0x10 : 0x00) /* id */ | 312 | | (hc->id ? 0x10 : 0x00) /* id */ |
313 | | localcodec; | 313 | | localcodec; |
314 | if (hc->id) { | 314 | if (hc->id) { |
315 | *p++ = hc->id>>24; /* id */ | 315 | *p++ = hc->id >> 24; /* id */ |
316 | *p++ = hc->id>>16; | 316 | *p++ = hc->id >> 16; |
317 | *p++ = hc->id>>8; | 317 | *p++ = hc->id >> 8; |
318 | *p++ = hc->id; | 318 | *p++ = hc->id; |
319 | } | 319 | } |
320 | *p++ = (multi == 1) ? 0x80 : 0x00 + channel; /* m-flag, channel */ | 320 | *p++ = (multi == 1) ? 0x80 : 0x00 + channel; /* m-flag, channel */ |
321 | if (multi == 1) | 321 | if (multi == 1) |
322 | *p++ = len; /* length */ | 322 | *p++ = len; /* length */ |
323 | *p++ = timebase>>8; /* time base */ | 323 | *p++ = timebase >> 8; /* time base */ |
324 | *p++ = timebase; | 324 | *p++ = timebase; |
325 | 325 | ||
326 | if (buf && len) { /* add data to frame */ | 326 | if (buf && len) { /* add data to frame */ |
@@ -330,7 +330,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, | |||
330 | l1oip_alaw_to_ulaw(buf, len, p); | 330 | l1oip_alaw_to_ulaw(buf, len, p); |
331 | else if (localcodec == 3) | 331 | else if (localcodec == 3) |
332 | len = l1oip_law_to_4bit(buf, len, p, | 332 | len = l1oip_law_to_4bit(buf, len, p, |
333 | &hc->chan[channel].codecstate); | 333 | &hc->chan[channel].codecstate); |
334 | else | 334 | else |
335 | memcpy(p, buf, len); | 335 | memcpy(p, buf, len); |
336 | } | 336 | } |
@@ -349,7 +349,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, | |||
349 | /* send packet */ | 349 | /* send packet */ |
350 | if (debug & DEBUG_L1OIP_MSG) | 350 | if (debug & DEBUG_L1OIP_MSG) |
351 | printk(KERN_DEBUG "%s: sending packet to socket (len " | 351 | printk(KERN_DEBUG "%s: sending packet to socket (len " |
352 | "= %d)\n", __func__, len); | 352 | "= %d)\n", __func__, len); |
353 | hc->sendiov.iov_base = frame; | 353 | hc->sendiov.iov_base = frame; |
354 | hc->sendiov.iov_len = len; | 354 | hc->sendiov.iov_len = len; |
355 | len = kernel_sendmsg(socket, &hc->sendmsg, &hc->sendiov, 1, len); | 355 | len = kernel_sendmsg(socket, &hc->sendmsg, &hc->sendiov, 1, len); |
@@ -365,7 +365,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, | |||
365 | */ | 365 | */ |
366 | static void | 366 | static void |
367 | l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, | 367 | l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, |
368 | u8 *buf, int len) | 368 | u8 *buf, int len) |
369 | { | 369 | { |
370 | struct sk_buff *nskb; | 370 | struct sk_buff *nskb; |
371 | struct bchannel *bch; | 371 | struct bchannel *bch; |
@@ -376,34 +376,34 @@ l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, | |||
376 | if (len == 0) { | 376 | if (len == 0) { |
377 | if (debug & DEBUG_L1OIP_MSG) | 377 | if (debug & DEBUG_L1OIP_MSG) |
378 | printk(KERN_DEBUG "%s: received empty keepalive data, " | 378 | printk(KERN_DEBUG "%s: received empty keepalive data, " |
379 | "ignoring\n", __func__); | 379 | "ignoring\n", __func__); |
380 | return; | 380 | return; |
381 | } | 381 | } |
382 | 382 | ||
383 | if (debug & DEBUG_L1OIP_MSG) | 383 | if (debug & DEBUG_L1OIP_MSG) |
384 | printk(KERN_DEBUG "%s: received data, sending to mISDN (%d)\n", | 384 | printk(KERN_DEBUG "%s: received data, sending to mISDN (%d)\n", |
385 | __func__, len); | 385 | __func__, len); |
386 | 386 | ||
387 | if (channel < 1 || channel > 127) { | 387 | if (channel < 1 || channel > 127) { |
388 | printk(KERN_WARNING "%s: packet error - channel %d out of " | 388 | printk(KERN_WARNING "%s: packet error - channel %d out of " |
389 | "range\n", __func__, channel); | 389 | "range\n", __func__, channel); |
390 | return; | 390 | return; |
391 | } | 391 | } |
392 | dch = hc->chan[channel].dch; | 392 | dch = hc->chan[channel].dch; |
393 | bch = hc->chan[channel].bch; | 393 | bch = hc->chan[channel].bch; |
394 | if (!dch && !bch) { | 394 | if (!dch && !bch) { |
395 | printk(KERN_WARNING "%s: packet error - channel %d not in " | 395 | printk(KERN_WARNING "%s: packet error - channel %d not in " |
396 | "stack\n", __func__, channel); | 396 | "stack\n", __func__, channel); |
397 | return; | 397 | return; |
398 | } | 398 | } |
399 | 399 | ||
400 | /* prepare message */ | 400 | /* prepare message */ |
401 | nskb = mI_alloc_skb((remotecodec == 3) ? (len<<1) : len, GFP_ATOMIC); | 401 | nskb = mI_alloc_skb((remotecodec == 3) ? (len << 1) : len, GFP_ATOMIC); |
402 | if (!nskb) { | 402 | if (!nskb) { |
403 | printk(KERN_ERR "%s: No mem for skb.\n", __func__); | 403 | printk(KERN_ERR "%s: No mem for skb.\n", __func__); |
404 | return; | 404 | return; |
405 | } | 405 | } |
406 | p = skb_put(nskb, (remotecodec == 3) ? (len<<1) : len); | 406 | p = skb_put(nskb, (remotecodec == 3) ? (len << 1) : len); |
407 | 407 | ||
408 | if (remotecodec == 1 && ulaw) | 408 | if (remotecodec == 1 && ulaw) |
409 | l1oip_alaw_to_ulaw(buf, len, p); | 409 | l1oip_alaw_to_ulaw(buf, len, p); |
@@ -428,7 +428,7 @@ l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, | |||
428 | rx_counter = | 428 | rx_counter = |
429 | (rx_counter & 0xffff0000) | timebase; | 429 | (rx_counter & 0xffff0000) | timebase; |
430 | else | 430 | else |
431 | rx_counter = ((rx_counter & 0xffff0000)+0x10000) | 431 | rx_counter = ((rx_counter & 0xffff0000) + 0x10000) |
432 | | timebase; | 432 | | timebase; |
433 | } else { | 433 | } else { |
434 | /* time has changed backwards */ | 434 | /* time has changed backwards */ |
@@ -436,7 +436,7 @@ l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, | |||
436 | rx_counter = | 436 | rx_counter = |
437 | (rx_counter & 0xffff0000) | timebase; | 437 | (rx_counter & 0xffff0000) | timebase; |
438 | else | 438 | else |
439 | rx_counter = ((rx_counter & 0xffff0000)-0x10000) | 439 | rx_counter = ((rx_counter & 0xffff0000) - 0x10000) |
440 | | timebase; | 440 | | timebase; |
441 | } | 441 | } |
442 | hc->chan[channel].rx_counter = rx_counter; | 442 | hc->chan[channel].rx_counter = rx_counter; |
@@ -476,42 +476,42 @@ l1oip_socket_parse(struct l1oip *hc, struct sockaddr_in *sin, u8 *buf, int len) | |||
476 | 476 | ||
477 | if (debug & DEBUG_L1OIP_MSG) | 477 | if (debug & DEBUG_L1OIP_MSG) |
478 | printk(KERN_DEBUG "%s: received frame, parsing... (%d)\n", | 478 | printk(KERN_DEBUG "%s: received frame, parsing... (%d)\n", |
479 | __func__, len); | 479 | __func__, len); |
480 | 480 | ||
481 | /* check length */ | 481 | /* check length */ |
482 | if (len < 1+1+2) { | 482 | if (len < 1 + 1 + 2) { |
483 | printk(KERN_WARNING "%s: packet error - length %d below " | 483 | printk(KERN_WARNING "%s: packet error - length %d below " |
484 | "4 bytes\n", __func__, len); | 484 | "4 bytes\n", __func__, len); |
485 | return; | 485 | return; |
486 | } | 486 | } |
487 | 487 | ||
488 | /* check version */ | 488 | /* check version */ |
489 | if (((*buf)>>6) != L1OIP_VERSION) { | 489 | if (((*buf) >> 6) != L1OIP_VERSION) { |
490 | printk(KERN_WARNING "%s: packet error - unknown version %d\n", | 490 | printk(KERN_WARNING "%s: packet error - unknown version %d\n", |
491 | __func__, buf[0]>>6); | 491 | __func__, buf[0]>>6); |
492 | return; | 492 | return; |
493 | } | 493 | } |
494 | 494 | ||
495 | /* check type */ | 495 | /* check type */ |
496 | if (((*buf)&0x20) && !hc->pri) { | 496 | if (((*buf) & 0x20) && !hc->pri) { |
497 | printk(KERN_WARNING "%s: packet error - received E1 packet " | 497 | printk(KERN_WARNING "%s: packet error - received E1 packet " |
498 | "on S0 interface\n", __func__); | 498 | "on S0 interface\n", __func__); |
499 | return; | 499 | return; |
500 | } | 500 | } |
501 | if (!((*buf)&0x20) && hc->pri) { | 501 | if (!((*buf) & 0x20) && hc->pri) { |
502 | printk(KERN_WARNING "%s: packet error - received S0 packet " | 502 | printk(KERN_WARNING "%s: packet error - received S0 packet " |
503 | "on E1 interface\n", __func__); | 503 | "on E1 interface\n", __func__); |
504 | return; | 504 | return; |
505 | } | 505 | } |
506 | 506 | ||
507 | /* get id flag */ | 507 | /* get id flag */ |
508 | packet_id = (*buf>>4)&1; | 508 | packet_id = (*buf >> 4) & 1; |
509 | 509 | ||
510 | /* check coding */ | 510 | /* check coding */ |
511 | remotecodec = (*buf) & 0x0f; | 511 | remotecodec = (*buf) & 0x0f; |
512 | if (remotecodec > 3) { | 512 | if (remotecodec > 3) { |
513 | printk(KERN_WARNING "%s: packet error - remotecodec %d " | 513 | printk(KERN_WARNING "%s: packet error - remotecodec %d " |
514 | "unsupported\n", __func__, remotecodec); | 514 | "unsupported\n", __func__, remotecodec); |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | buf++; | 517 | buf++; |
@@ -521,12 +521,12 @@ l1oip_socket_parse(struct l1oip *hc, struct sockaddr_in *sin, u8 *buf, int len) | |||
521 | if (packet_id) { | 521 | if (packet_id) { |
522 | if (!hc->id) { | 522 | if (!hc->id) { |
523 | printk(KERN_WARNING "%s: packet error - packet has id " | 523 | printk(KERN_WARNING "%s: packet error - packet has id " |
524 | "0x%x, but we have not\n", __func__, packet_id); | 524 | "0x%x, but we have not\n", __func__, packet_id); |
525 | return; | 525 | return; |
526 | } | 526 | } |
527 | if (len < 4) { | 527 | if (len < 4) { |
528 | printk(KERN_WARNING "%s: packet error - packet too " | 528 | printk(KERN_WARNING "%s: packet error - packet too " |
529 | "short for ID value\n", __func__); | 529 | "short for ID value\n", __func__); |
530 | return; | 530 | return; |
531 | } | 531 | } |
532 | packet_id = (*buf++) << 24; | 532 | packet_id = (*buf++) << 24; |
@@ -537,14 +537,14 @@ l1oip_socket_parse(struct l1oip *hc, struct sockaddr_in *sin, u8 *buf, int len) | |||
537 | 537 | ||
538 | if (packet_id != hc->id) { | 538 | if (packet_id != hc->id) { |
539 | printk(KERN_WARNING "%s: packet error - ID mismatch, " | 539 | printk(KERN_WARNING "%s: packet error - ID mismatch, " |
540 | "got 0x%x, we 0x%x\n", | 540 | "got 0x%x, we 0x%x\n", |
541 | __func__, packet_id, hc->id); | 541 | __func__, packet_id, hc->id); |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | } else { | 544 | } else { |
545 | if (hc->id) { | 545 | if (hc->id) { |
546 | printk(KERN_WARNING "%s: packet error - packet has no " | 546 | printk(KERN_WARNING "%s: packet error - packet has no " |
547 | "ID, but we have\n", __func__); | 547 | "ID, but we have\n", __func__); |
548 | return; | 548 | return; |
549 | } | 549 | } |
550 | } | 550 | } |
@@ -552,13 +552,13 @@ l1oip_socket_parse(struct l1oip *hc, struct sockaddr_in *sin, u8 *buf, int len) | |||
552 | multiframe: | 552 | multiframe: |
553 | if (len < 1) { | 553 | if (len < 1) { |
554 | printk(KERN_WARNING "%s: packet error - packet too short, " | 554 | printk(KERN_WARNING "%s: packet error - packet too short, " |
555 | "channel expected at position %d.\n", | 555 | "channel expected at position %d.\n", |
556 | __func__, len-len_start+1); | 556 | __func__, len-len_start + 1); |
557 | return; | 557 | return; |
558 | } | 558 | } |
559 | 559 | ||
560 | /* get channel and multiframe flag */ | 560 | /* get channel and multiframe flag */ |
561 | channel = *buf&0x7f; | 561 | channel = *buf & 0x7f; |
562 | m = *buf >> 7; | 562 | m = *buf >> 7; |
563 | buf++; | 563 | buf++; |
564 | len--; | 564 | len--; |
@@ -567,8 +567,8 @@ multiframe: | |||
567 | if (m) { | 567 | if (m) { |
568 | if (len < 1) { | 568 | if (len < 1) { |
569 | printk(KERN_WARNING "%s: packet error - packet too " | 569 | printk(KERN_WARNING "%s: packet error - packet too " |
570 | "short, length expected at position %d.\n", | 570 | "short, length expected at position %d.\n", |
571 | __func__, len_start-len-1); | 571 | __func__, len_start - len - 1); |
572 | return; | 572 | return; |
573 | } | 573 | } |
574 | 574 | ||
@@ -576,26 +576,26 @@ multiframe: | |||
576 | len--; | 576 | len--; |
577 | if (mlen == 0) | 577 | if (mlen == 0) |
578 | mlen = 256; | 578 | mlen = 256; |
579 | if (len < mlen+3) { | 579 | if (len < mlen + 3) { |
580 | printk(KERN_WARNING "%s: packet error - length %d at " | 580 | printk(KERN_WARNING "%s: packet error - length %d at " |
581 | "position %d exceeds total length %d.\n", | 581 | "position %d exceeds total length %d.\n", |
582 | __func__, mlen, len_start-len-1, len_start); | 582 | __func__, mlen, len_start-len - 1, len_start); |
583 | return; | 583 | return; |
584 | } | 584 | } |
585 | if (len == mlen+3) { | 585 | if (len == mlen + 3) { |
586 | printk(KERN_WARNING "%s: packet error - length %d at " | 586 | printk(KERN_WARNING "%s: packet error - length %d at " |
587 | "position %d will not allow additional " | 587 | "position %d will not allow additional " |
588 | "packet.\n", | 588 | "packet.\n", |
589 | __func__, mlen, len_start-len+1); | 589 | __func__, mlen, len_start-len + 1); |
590 | return; | 590 | return; |
591 | } | 591 | } |
592 | } else | 592 | } else |
593 | mlen = len-2; /* single frame, subtract timebase */ | 593 | mlen = len - 2; /* single frame, subtract timebase */ |
594 | 594 | ||
595 | if (len < 2) { | 595 | if (len < 2) { |
596 | printk(KERN_WARNING "%s: packet error - packet too short, time " | 596 | printk(KERN_WARNING "%s: packet error - packet too short, time " |
597 | "base expected at position %d.\n", | 597 | "base expected at position %d.\n", |
598 | __func__, len-len_start+1); | 598 | __func__, len-len_start + 1); |
599 | return; | 599 | return; |
600 | } | 600 | } |
601 | 601 | ||
@@ -606,12 +606,12 @@ multiframe: | |||
606 | 606 | ||
607 | /* if inactive, we send up a PH_ACTIVATE and activate */ | 607 | /* if inactive, we send up a PH_ACTIVATE and activate */ |
608 | if (!test_bit(FLG_ACTIVE, &dch->Flags)) { | 608 | if (!test_bit(FLG_ACTIVE, &dch->Flags)) { |
609 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 609 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
610 | printk(KERN_DEBUG "%s: interface become active due to " | 610 | printk(KERN_DEBUG "%s: interface become active due to " |
611 | "received packet\n", __func__); | 611 | "received packet\n", __func__); |
612 | test_and_set_bit(FLG_ACTIVE, &dch->Flags); | 612 | test_and_set_bit(FLG_ACTIVE, &dch->Flags); |
613 | _queue_data(&dch->dev.D, PH_ACTIVATE_IND, MISDN_ID_ANY, 0, | 613 | _queue_data(&dch->dev.D, PH_ACTIVATE_IND, MISDN_ID_ANY, 0, |
614 | NULL, GFP_ATOMIC); | 614 | NULL, GFP_ATOMIC); |
615 | } | 615 | } |
616 | 616 | ||
617 | /* distribute packet */ | 617 | /* distribute packet */ |
@@ -624,24 +624,24 @@ multiframe: | |||
624 | goto multiframe; | 624 | goto multiframe; |
625 | 625 | ||
626 | /* restart timer */ | 626 | /* restart timer */ |
627 | if ((int)(hc->timeout_tl.expires-jiffies) < 5*HZ || !hc->timeout_on) { | 627 | if ((int)(hc->timeout_tl.expires-jiffies) < 5 * HZ || !hc->timeout_on) { |
628 | hc->timeout_on = 1; | 628 | hc->timeout_on = 1; |
629 | del_timer(&hc->timeout_tl); | 629 | del_timer(&hc->timeout_tl); |
630 | hc->timeout_tl.expires = jiffies + L1OIP_TIMEOUT*HZ; | 630 | hc->timeout_tl.expires = jiffies + L1OIP_TIMEOUT * HZ; |
631 | add_timer(&hc->timeout_tl); | 631 | add_timer(&hc->timeout_tl); |
632 | } else /* only adjust timer */ | 632 | } else /* only adjust timer */ |
633 | hc->timeout_tl.expires = jiffies + L1OIP_TIMEOUT*HZ; | 633 | hc->timeout_tl.expires = jiffies + L1OIP_TIMEOUT * HZ; |
634 | 634 | ||
635 | /* if ip or source port changes */ | 635 | /* if ip or source port changes */ |
636 | if ((hc->sin_remote.sin_addr.s_addr != sin->sin_addr.s_addr) | 636 | if ((hc->sin_remote.sin_addr.s_addr != sin->sin_addr.s_addr) |
637 | || (hc->sin_remote.sin_port != sin->sin_port)) { | 637 | || (hc->sin_remote.sin_port != sin->sin_port)) { |
638 | if (debug & DEBUG_L1OIP_SOCKET) | 638 | if (debug & DEBUG_L1OIP_SOCKET) |
639 | printk(KERN_DEBUG "%s: remote address changes from " | 639 | printk(KERN_DEBUG "%s: remote address changes from " |
640 | "0x%08x to 0x%08x (port %d to %d)\n", __func__, | 640 | "0x%08x to 0x%08x (port %d to %d)\n", __func__, |
641 | ntohl(hc->sin_remote.sin_addr.s_addr), | 641 | ntohl(hc->sin_remote.sin_addr.s_addr), |
642 | ntohl(sin->sin_addr.s_addr), | 642 | ntohl(sin->sin_addr.s_addr), |
643 | ntohs(hc->sin_remote.sin_port), | 643 | ntohs(hc->sin_remote.sin_port), |
644 | ntohs(sin->sin_port)); | 644 | ntohs(sin->sin_port)); |
645 | hc->sin_remote.sin_addr.s_addr = sin->sin_addr.s_addr; | 645 | hc->sin_remote.sin_addr.s_addr = sin->sin_addr.s_addr; |
646 | hc->sin_remote.sin_port = sin->sin_port; | 646 | hc->sin_remote.sin_port = sin->sin_port; |
647 | } | 647 | } |
@@ -694,9 +694,9 @@ l1oip_socket_thread(void *data) | |||
694 | 694 | ||
695 | /* bind to incomming port */ | 695 | /* bind to incomming port */ |
696 | if (socket->ops->bind(socket, (struct sockaddr *)&hc->sin_local, | 696 | if (socket->ops->bind(socket, (struct sockaddr *)&hc->sin_local, |
697 | sizeof(hc->sin_local))) { | 697 | sizeof(hc->sin_local))) { |
698 | printk(KERN_ERR "%s: Failed to bind socket to port %d.\n", | 698 | printk(KERN_ERR "%s: Failed to bind socket to port %d.\n", |
699 | __func__, hc->localport); | 699 | __func__, hc->localport); |
700 | ret = -EINVAL; | 700 | ret = -EINVAL; |
701 | goto fail; | 701 | goto fail; |
702 | } | 702 | } |
@@ -728,7 +728,7 @@ l1oip_socket_thread(void *data) | |||
728 | /* read loop */ | 728 | /* read loop */ |
729 | if (debug & DEBUG_L1OIP_SOCKET) | 729 | if (debug & DEBUG_L1OIP_SOCKET) |
730 | printk(KERN_DEBUG "%s: socket created and open\n", | 730 | printk(KERN_DEBUG "%s: socket created and open\n", |
731 | __func__); | 731 | __func__); |
732 | while (!signal_pending(current)) { | 732 | while (!signal_pending(current)) { |
733 | struct kvec iov = { | 733 | struct kvec iov = { |
734 | .iov_base = recvbuf, | 734 | .iov_base = recvbuf, |
@@ -741,7 +741,7 @@ l1oip_socket_thread(void *data) | |||
741 | } else { | 741 | } else { |
742 | if (debug & DEBUG_L1OIP_SOCKET) | 742 | if (debug & DEBUG_L1OIP_SOCKET) |
743 | printk(KERN_WARNING | 743 | printk(KERN_WARNING |
744 | "%s: broken pipe on socket\n", __func__); | 744 | "%s: broken pipe on socket\n", __func__); |
745 | } | 745 | } |
746 | } | 746 | } |
747 | 747 | ||
@@ -750,7 +750,7 @@ l1oip_socket_thread(void *data) | |||
750 | /* if hc->socket is NULL, it is in use until it is given back */ | 750 | /* if hc->socket is NULL, it is in use until it is given back */ |
751 | while (!hc->socket) { | 751 | while (!hc->socket) { |
752 | spin_unlock(&hc->socket_lock); | 752 | spin_unlock(&hc->socket_lock); |
753 | schedule_timeout(HZ/10); | 753 | schedule_timeout(HZ / 10); |
754 | spin_lock(&hc->socket_lock); | 754 | spin_lock(&hc->socket_lock); |
755 | } | 755 | } |
756 | hc->socket = NULL; | 756 | hc->socket = NULL; |
@@ -758,7 +758,7 @@ l1oip_socket_thread(void *data) | |||
758 | 758 | ||
759 | if (debug & DEBUG_L1OIP_SOCKET) | 759 | if (debug & DEBUG_L1OIP_SOCKET) |
760 | printk(KERN_DEBUG "%s: socket thread terminating\n", | 760 | printk(KERN_DEBUG "%s: socket thread terminating\n", |
761 | __func__); | 761 | __func__); |
762 | 762 | ||
763 | fail: | 763 | fail: |
764 | /* free recvbuf */ | 764 | /* free recvbuf */ |
@@ -774,7 +774,7 @@ fail: | |||
774 | 774 | ||
775 | if (debug & DEBUG_L1OIP_SOCKET) | 775 | if (debug & DEBUG_L1OIP_SOCKET) |
776 | printk(KERN_DEBUG "%s: socket thread terminated\n", | 776 | printk(KERN_DEBUG "%s: socket thread terminated\n", |
777 | __func__); | 777 | __func__); |
778 | return ret; | 778 | return ret; |
779 | } | 779 | } |
780 | 780 | ||
@@ -787,19 +787,19 @@ l1oip_socket_close(struct l1oip *hc) | |||
787 | if (hc->socket_thread) { | 787 | if (hc->socket_thread) { |
788 | if (debug & DEBUG_L1OIP_SOCKET) | 788 | if (debug & DEBUG_L1OIP_SOCKET) |
789 | printk(KERN_DEBUG "%s: socket thread exists, " | 789 | printk(KERN_DEBUG "%s: socket thread exists, " |
790 | "killing...\n", __func__); | 790 | "killing...\n", __func__); |
791 | send_sig(SIGTERM, hc->socket_thread, 0); | 791 | send_sig(SIGTERM, hc->socket_thread, 0); |
792 | wait_for_completion(&hc->socket_complete); | 792 | wait_for_completion(&hc->socket_complete); |
793 | } | 793 | } |
794 | 794 | ||
795 | /* if active, we send up a PH_DEACTIVATE and deactivate */ | 795 | /* if active, we send up a PH_DEACTIVATE and deactivate */ |
796 | if (test_bit(FLG_ACTIVE, &dch->Flags)) { | 796 | if (test_bit(FLG_ACTIVE, &dch->Flags)) { |
797 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 797 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
798 | printk(KERN_DEBUG "%s: interface become deactivated " | 798 | printk(KERN_DEBUG "%s: interface become deactivated " |
799 | "due to timeout\n", __func__); | 799 | "due to timeout\n", __func__); |
800 | test_and_clear_bit(FLG_ACTIVE, &dch->Flags); | 800 | test_and_clear_bit(FLG_ACTIVE, &dch->Flags); |
801 | _queue_data(&dch->dev.D, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0, | 801 | _queue_data(&dch->dev.D, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0, |
802 | NULL, GFP_ATOMIC); | 802 | NULL, GFP_ATOMIC); |
803 | } | 803 | } |
804 | } | 804 | } |
805 | 805 | ||
@@ -813,11 +813,11 @@ l1oip_socket_open(struct l1oip *hc) | |||
813 | 813 | ||
814 | /* create receive process */ | 814 | /* create receive process */ |
815 | hc->socket_thread = kthread_run(l1oip_socket_thread, hc, "l1oip_%s", | 815 | hc->socket_thread = kthread_run(l1oip_socket_thread, hc, "l1oip_%s", |
816 | hc->name); | 816 | hc->name); |
817 | if (IS_ERR(hc->socket_thread)) { | 817 | if (IS_ERR(hc->socket_thread)) { |
818 | int err = PTR_ERR(hc->socket_thread); | 818 | int err = PTR_ERR(hc->socket_thread); |
819 | printk(KERN_ERR "%s: Failed (%d) to create socket process.\n", | 819 | printk(KERN_ERR "%s: Failed (%d) to create socket process.\n", |
820 | __func__, err); | 820 | __func__, err); |
821 | hc->socket_thread = NULL; | 821 | hc->socket_thread = NULL; |
822 | sock_release(hc->socket); | 822 | sock_release(hc->socket); |
823 | return err; | 823 | return err; |
@@ -834,9 +834,9 @@ l1oip_send_bh(struct work_struct *work) | |||
834 | { | 834 | { |
835 | struct l1oip *hc = container_of(work, struct l1oip, workq); | 835 | struct l1oip *hc = container_of(work, struct l1oip, workq); |
836 | 836 | ||
837 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 837 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
838 | printk(KERN_DEBUG "%s: keepalive timer expired, sending empty " | 838 | printk(KERN_DEBUG "%s: keepalive timer expired, sending empty " |
839 | "frame on dchannel\n", __func__); | 839 | "frame on dchannel\n", __func__); |
840 | 840 | ||
841 | /* send an empty l1oip frame at D-channel */ | 841 | /* send an empty l1oip frame at D-channel */ |
842 | l1oip_socket_send(hc, 0, hc->d_idx, 0, 0, NULL, 0); | 842 | l1oip_socket_send(hc, 0, hc->d_idx, 0, 0, NULL, 0); |
@@ -862,25 +862,25 @@ l1oip_timeout(void *data) | |||
862 | 862 | ||
863 | if (debug & DEBUG_L1OIP_MSG) | 863 | if (debug & DEBUG_L1OIP_MSG) |
864 | printk(KERN_DEBUG "%s: timeout timer expired, turn layer one " | 864 | printk(KERN_DEBUG "%s: timeout timer expired, turn layer one " |
865 | "down.\n", __func__); | 865 | "down.\n", __func__); |
866 | 866 | ||
867 | hc->timeout_on = 0; /* state that timer must be initialized next time */ | 867 | hc->timeout_on = 0; /* state that timer must be initialized next time */ |
868 | 868 | ||
869 | /* if timeout, we send up a PH_DEACTIVATE and deactivate */ | 869 | /* if timeout, we send up a PH_DEACTIVATE and deactivate */ |
870 | if (test_bit(FLG_ACTIVE, &dch->Flags)) { | 870 | if (test_bit(FLG_ACTIVE, &dch->Flags)) { |
871 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 871 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
872 | printk(KERN_DEBUG "%s: interface become deactivated " | 872 | printk(KERN_DEBUG "%s: interface become deactivated " |
873 | "due to timeout\n", __func__); | 873 | "due to timeout\n", __func__); |
874 | test_and_clear_bit(FLG_ACTIVE, &dch->Flags); | 874 | test_and_clear_bit(FLG_ACTIVE, &dch->Flags); |
875 | _queue_data(&dch->dev.D, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0, | 875 | _queue_data(&dch->dev.D, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0, |
876 | NULL, GFP_ATOMIC); | 876 | NULL, GFP_ATOMIC); |
877 | } | 877 | } |
878 | 878 | ||
879 | /* if we have ondemand set, we remove ip address */ | 879 | /* if we have ondemand set, we remove ip address */ |
880 | if (hc->ondemand) { | 880 | if (hc->ondemand) { |
881 | if (debug & DEBUG_L1OIP_MSG) | 881 | if (debug & DEBUG_L1OIP_MSG) |
882 | printk(KERN_DEBUG "%s: on demand causes ip address to " | 882 | printk(KERN_DEBUG "%s: on demand causes ip address to " |
883 | "be removed\n", __func__); | 883 | "be removed\n", __func__); |
884 | hc->sin_remote.sin_addr.s_addr = 0; | 884 | hc->sin_remote.sin_addr.s_addr = 0; |
885 | } | 885 | } |
886 | } | 886 | } |
@@ -904,12 +904,12 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
904 | case PH_DATA_REQ: | 904 | case PH_DATA_REQ: |
905 | if (skb->len < 1) { | 905 | if (skb->len < 1) { |
906 | printk(KERN_WARNING "%s: skb too small\n", | 906 | printk(KERN_WARNING "%s: skb too small\n", |
907 | __func__); | 907 | __func__); |
908 | break; | 908 | break; |
909 | } | 909 | } |
910 | if (skb->len > MAX_DFRAME_LEN_L1 || skb->len > L1OIP_MAX_LEN) { | 910 | if (skb->len > MAX_DFRAME_LEN_L1 || skb->len > L1OIP_MAX_LEN) { |
911 | printk(KERN_WARNING "%s: skb too large\n", | 911 | printk(KERN_WARNING "%s: skb too large\n", |
912 | __func__); | 912 | __func__); |
913 | break; | 913 | break; |
914 | } | 914 | } |
915 | /* send frame */ | 915 | /* send frame */ |
@@ -918,7 +918,7 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
918 | while (l) { | 918 | while (l) { |
919 | ll = (l < L1OIP_MAX_PERFRAME) ? l : L1OIP_MAX_PERFRAME; | 919 | ll = (l < L1OIP_MAX_PERFRAME) ? l : L1OIP_MAX_PERFRAME; |
920 | l1oip_socket_send(hc, 0, dch->slot, 0, | 920 | l1oip_socket_send(hc, 0, dch->slot, 0, |
921 | hc->chan[dch->slot].tx_counter++, p, ll); | 921 | hc->chan[dch->slot].tx_counter++, p, ll); |
922 | p += ll; | 922 | p += ll; |
923 | l -= ll; | 923 | l -= ll; |
924 | } | 924 | } |
@@ -926,9 +926,9 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
926 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); | 926 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); |
927 | return 0; | 927 | return 0; |
928 | case PH_ACTIVATE_REQ: | 928 | case PH_ACTIVATE_REQ: |
929 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 929 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
930 | printk(KERN_DEBUG "%s: PH_ACTIVATE channel %d (1..%d)\n" | 930 | printk(KERN_DEBUG "%s: PH_ACTIVATE channel %d (1..%d)\n" |
931 | , __func__, dch->slot, hc->b_num+1); | 931 | , __func__, dch->slot, hc->b_num + 1); |
932 | skb_trim(skb, 0); | 932 | skb_trim(skb, 0); |
933 | if (test_bit(FLG_ACTIVE, &dch->Flags)) | 933 | if (test_bit(FLG_ACTIVE, &dch->Flags)) |
934 | queue_ch_frame(ch, PH_ACTIVATE_IND, hh->id, skb); | 934 | queue_ch_frame(ch, PH_ACTIVATE_IND, hh->id, skb); |
@@ -936,10 +936,10 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
936 | queue_ch_frame(ch, PH_DEACTIVATE_IND, hh->id, skb); | 936 | queue_ch_frame(ch, PH_DEACTIVATE_IND, hh->id, skb); |
937 | return 0; | 937 | return 0; |
938 | case PH_DEACTIVATE_REQ: | 938 | case PH_DEACTIVATE_REQ: |
939 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 939 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
940 | printk(KERN_DEBUG "%s: PH_DEACTIVATE channel %d " | 940 | printk(KERN_DEBUG "%s: PH_DEACTIVATE channel %d " |
941 | "(1..%d)\n", __func__, dch->slot, | 941 | "(1..%d)\n", __func__, dch->slot, |
942 | hc->b_num+1); | 942 | hc->b_num + 1); |
943 | skb_trim(skb, 0); | 943 | skb_trim(skb, 0); |
944 | if (test_bit(FLG_ACTIVE, &dch->Flags)) | 944 | if (test_bit(FLG_ACTIVE, &dch->Flags)) |
945 | queue_ch_frame(ch, PH_ACTIVATE_IND, hh->id, skb); | 945 | queue_ch_frame(ch, PH_ACTIVATE_IND, hh->id, skb); |
@@ -971,26 +971,26 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq) | |||
971 | hc->remoteport = hc->localport; | 971 | hc->remoteport = hc->localport; |
972 | if (debug & DEBUG_L1OIP_SOCKET) | 972 | if (debug & DEBUG_L1OIP_SOCKET) |
973 | printk(KERN_DEBUG "%s: got new ip address from user " | 973 | printk(KERN_DEBUG "%s: got new ip address from user " |
974 | "space.\n", __func__); | 974 | "space.\n", __func__); |
975 | l1oip_socket_open(hc); | 975 | l1oip_socket_open(hc); |
976 | break; | 976 | break; |
977 | case MISDN_CTRL_UNSETPEER: | 977 | case MISDN_CTRL_UNSETPEER: |
978 | if (debug & DEBUG_L1OIP_SOCKET) | 978 | if (debug & DEBUG_L1OIP_SOCKET) |
979 | printk(KERN_DEBUG "%s: removing ip address.\n", | 979 | printk(KERN_DEBUG "%s: removing ip address.\n", |
980 | __func__); | 980 | __func__); |
981 | hc->remoteip = 0; | 981 | hc->remoteip = 0; |
982 | l1oip_socket_open(hc); | 982 | l1oip_socket_open(hc); |
983 | break; | 983 | break; |
984 | case MISDN_CTRL_GETPEER: | 984 | case MISDN_CTRL_GETPEER: |
985 | if (debug & DEBUG_L1OIP_SOCKET) | 985 | if (debug & DEBUG_L1OIP_SOCKET) |
986 | printk(KERN_DEBUG "%s: getting ip address.\n", | 986 | printk(KERN_DEBUG "%s: getting ip address.\n", |
987 | __func__); | 987 | __func__); |
988 | cq->p1 = hc->remoteip; | 988 | cq->p1 = hc->remoteip; |
989 | cq->p2 = hc->remoteport | (hc->localport << 16); | 989 | cq->p2 = hc->remoteport | (hc->localport << 16); |
990 | break; | 990 | break; |
991 | default: | 991 | default: |
992 | printk(KERN_WARNING "%s: unknown Op %x\n", | 992 | printk(KERN_WARNING "%s: unknown Op %x\n", |
993 | __func__, cq->op); | 993 | __func__, cq->op); |
994 | ret = -EINVAL; | 994 | ret = -EINVAL; |
995 | break; | 995 | break; |
996 | } | 996 | } |
@@ -1002,21 +1002,21 @@ open_dchannel(struct l1oip *hc, struct dchannel *dch, struct channel_req *rq) | |||
1002 | { | 1002 | { |
1003 | if (debug & DEBUG_HW_OPEN) | 1003 | if (debug & DEBUG_HW_OPEN) |
1004 | printk(KERN_DEBUG "%s: dev(%d) open from %p\n", __func__, | 1004 | printk(KERN_DEBUG "%s: dev(%d) open from %p\n", __func__, |
1005 | dch->dev.id, __builtin_return_address(0)); | 1005 | dch->dev.id, __builtin_return_address(0)); |
1006 | if (rq->protocol == ISDN_P_NONE) | 1006 | if (rq->protocol == ISDN_P_NONE) |
1007 | return -EINVAL; | 1007 | return -EINVAL; |
1008 | if ((dch->dev.D.protocol != ISDN_P_NONE) && | 1008 | if ((dch->dev.D.protocol != ISDN_P_NONE) && |
1009 | (dch->dev.D.protocol != rq->protocol)) { | 1009 | (dch->dev.D.protocol != rq->protocol)) { |
1010 | if (debug & DEBUG_HW_OPEN) | 1010 | if (debug & DEBUG_HW_OPEN) |
1011 | printk(KERN_WARNING "%s: change protocol %x to %x\n", | 1011 | printk(KERN_WARNING "%s: change protocol %x to %x\n", |
1012 | __func__, dch->dev.D.protocol, rq->protocol); | 1012 | __func__, dch->dev.D.protocol, rq->protocol); |
1013 | } | 1013 | } |
1014 | if (dch->dev.D.protocol != rq->protocol) | 1014 | if (dch->dev.D.protocol != rq->protocol) |
1015 | dch->dev.D.protocol = rq->protocol; | 1015 | dch->dev.D.protocol = rq->protocol; |
1016 | 1016 | ||
1017 | if (test_bit(FLG_ACTIVE, &dch->Flags)) { | 1017 | if (test_bit(FLG_ACTIVE, &dch->Flags)) { |
1018 | _queue_data(&dch->dev.D, PH_ACTIVATE_IND, MISDN_ID_ANY, | 1018 | _queue_data(&dch->dev.D, PH_ACTIVATE_IND, MISDN_ID_ANY, |
1019 | 0, NULL, GFP_KERNEL); | 1019 | 0, NULL, GFP_KERNEL); |
1020 | } | 1020 | } |
1021 | rq->ch = &dch->dev.D; | 1021 | rq->ch = &dch->dev.D; |
1022 | if (!try_module_get(THIS_MODULE)) | 1022 | if (!try_module_get(THIS_MODULE)) |
@@ -1038,7 +1038,7 @@ open_bchannel(struct l1oip *hc, struct dchannel *dch, struct channel_req *rq) | |||
1038 | bch = hc->chan[ch].bch; | 1038 | bch = hc->chan[ch].bch; |
1039 | if (!bch) { | 1039 | if (!bch) { |
1040 | printk(KERN_ERR "%s:internal error ch %d has no bch\n", | 1040 | printk(KERN_ERR "%s:internal error ch %d has no bch\n", |
1041 | __func__, ch); | 1041 | __func__, ch); |
1042 | return -EINVAL; | 1042 | return -EINVAL; |
1043 | } | 1043 | } |
1044 | if (test_and_set_bit(FLG_OPEN, &bch->Flags)) | 1044 | if (test_and_set_bit(FLG_OPEN, &bch->Flags)) |
@@ -1061,7 +1061,7 @@ l1oip_dctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
1061 | 1061 | ||
1062 | if (dch->debug & DEBUG_HW) | 1062 | if (dch->debug & DEBUG_HW) |
1063 | printk(KERN_DEBUG "%s: cmd:%x %p\n", | 1063 | printk(KERN_DEBUG "%s: cmd:%x %p\n", |
1064 | __func__, cmd, arg); | 1064 | __func__, cmd, arg); |
1065 | switch (cmd) { | 1065 | switch (cmd) { |
1066 | case OPEN_CHANNEL: | 1066 | case OPEN_CHANNEL: |
1067 | rq = arg; | 1067 | rq = arg; |
@@ -1089,8 +1089,8 @@ l1oip_dctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
1089 | case CLOSE_CHANNEL: | 1089 | case CLOSE_CHANNEL: |
1090 | if (debug & DEBUG_HW_OPEN) | 1090 | if (debug & DEBUG_HW_OPEN) |
1091 | printk(KERN_DEBUG "%s: dev(%d) close from %p\n", | 1091 | printk(KERN_DEBUG "%s: dev(%d) close from %p\n", |
1092 | __func__, dch->dev.id, | 1092 | __func__, dch->dev.id, |
1093 | __builtin_return_address(0)); | 1093 | __builtin_return_address(0)); |
1094 | module_put(THIS_MODULE); | 1094 | module_put(THIS_MODULE); |
1095 | break; | 1095 | break; |
1096 | case CONTROL_CHANNEL: | 1096 | case CONTROL_CHANNEL: |
@@ -1099,7 +1099,7 @@ l1oip_dctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
1099 | default: | 1099 | default: |
1100 | if (dch->debug & DEBUG_HW) | 1100 | if (dch->debug & DEBUG_HW) |
1101 | printk(KERN_DEBUG "%s: unknown command %x\n", | 1101 | printk(KERN_DEBUG "%s: unknown command %x\n", |
1102 | __func__, cmd); | 1102 | __func__, cmd); |
1103 | err = -EINVAL; | 1103 | err = -EINVAL; |
1104 | } | 1104 | } |
1105 | return err; | 1105 | return err; |
@@ -1119,12 +1119,12 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1119 | case PH_DATA_REQ: | 1119 | case PH_DATA_REQ: |
1120 | if (skb->len <= 0) { | 1120 | if (skb->len <= 0) { |
1121 | printk(KERN_WARNING "%s: skb too small\n", | 1121 | printk(KERN_WARNING "%s: skb too small\n", |
1122 | __func__); | 1122 | __func__); |
1123 | break; | 1123 | break; |
1124 | } | 1124 | } |
1125 | if (skb->len > MAX_DFRAME_LEN_L1 || skb->len > L1OIP_MAX_LEN) { | 1125 | if (skb->len > MAX_DFRAME_LEN_L1 || skb->len > L1OIP_MAX_LEN) { |
1126 | printk(KERN_WARNING "%s: skb too large\n", | 1126 | printk(KERN_WARNING "%s: skb too large\n", |
1127 | __func__); | 1127 | __func__); |
1128 | break; | 1128 | break; |
1129 | } | 1129 | } |
1130 | /* check for AIS / ulaw-silence */ | 1130 | /* check for AIS / ulaw-silence */ |
@@ -1132,7 +1132,7 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1132 | if (!memchr_inv(skb->data, 0xff, l)) { | 1132 | if (!memchr_inv(skb->data, 0xff, l)) { |
1133 | if (debug & DEBUG_L1OIP_MSG) | 1133 | if (debug & DEBUG_L1OIP_MSG) |
1134 | printk(KERN_DEBUG "%s: got AIS, not sending, " | 1134 | printk(KERN_DEBUG "%s: got AIS, not sending, " |
1135 | "but counting\n", __func__); | 1135 | "but counting\n", __func__); |
1136 | hc->chan[bch->slot].tx_counter += l; | 1136 | hc->chan[bch->slot].tx_counter += l; |
1137 | skb_trim(skb, 0); | 1137 | skb_trim(skb, 0); |
1138 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); | 1138 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); |
@@ -1143,7 +1143,7 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1143 | if (!memchr_inv(skb->data, 0x2a, l)) { | 1143 | if (!memchr_inv(skb->data, 0x2a, l)) { |
1144 | if (debug & DEBUG_L1OIP_MSG) | 1144 | if (debug & DEBUG_L1OIP_MSG) |
1145 | printk(KERN_DEBUG "%s: got silence, not sending" | 1145 | printk(KERN_DEBUG "%s: got silence, not sending" |
1146 | ", but counting\n", __func__); | 1146 | ", but counting\n", __func__); |
1147 | hc->chan[bch->slot].tx_counter += l; | 1147 | hc->chan[bch->slot].tx_counter += l; |
1148 | skb_trim(skb, 0); | 1148 | skb_trim(skb, 0); |
1149 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); | 1149 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); |
@@ -1156,7 +1156,7 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1156 | while (l) { | 1156 | while (l) { |
1157 | ll = (l < L1OIP_MAX_PERFRAME) ? l : L1OIP_MAX_PERFRAME; | 1157 | ll = (l < L1OIP_MAX_PERFRAME) ? l : L1OIP_MAX_PERFRAME; |
1158 | l1oip_socket_send(hc, hc->codec, bch->slot, 0, | 1158 | l1oip_socket_send(hc, hc->codec, bch->slot, 0, |
1159 | hc->chan[bch->slot].tx_counter, p, ll); | 1159 | hc->chan[bch->slot].tx_counter, p, ll); |
1160 | hc->chan[bch->slot].tx_counter += ll; | 1160 | hc->chan[bch->slot].tx_counter += ll; |
1161 | p += ll; | 1161 | p += ll; |
1162 | l -= ll; | 1162 | l -= ll; |
@@ -1165,19 +1165,19 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1165 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); | 1165 | queue_ch_frame(ch, PH_DATA_CNF, hh->id, skb); |
1166 | return 0; | 1166 | return 0; |
1167 | case PH_ACTIVATE_REQ: | 1167 | case PH_ACTIVATE_REQ: |
1168 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 1168 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
1169 | printk(KERN_DEBUG "%s: PH_ACTIVATE channel %d (1..%d)\n" | 1169 | printk(KERN_DEBUG "%s: PH_ACTIVATE channel %d (1..%d)\n" |
1170 | , __func__, bch->slot, hc->b_num+1); | 1170 | , __func__, bch->slot, hc->b_num + 1); |
1171 | hc->chan[bch->slot].codecstate = 0; | 1171 | hc->chan[bch->slot].codecstate = 0; |
1172 | test_and_set_bit(FLG_ACTIVE, &bch->Flags); | 1172 | test_and_set_bit(FLG_ACTIVE, &bch->Flags); |
1173 | skb_trim(skb, 0); | 1173 | skb_trim(skb, 0); |
1174 | queue_ch_frame(ch, PH_ACTIVATE_IND, hh->id, skb); | 1174 | queue_ch_frame(ch, PH_ACTIVATE_IND, hh->id, skb); |
1175 | return 0; | 1175 | return 0; |
1176 | case PH_DEACTIVATE_REQ: | 1176 | case PH_DEACTIVATE_REQ: |
1177 | if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET)) | 1177 | if (debug & (DEBUG_L1OIP_MSG | DEBUG_L1OIP_SOCKET)) |
1178 | printk(KERN_DEBUG "%s: PH_DEACTIVATE channel %d " | 1178 | printk(KERN_DEBUG "%s: PH_DEACTIVATE channel %d " |
1179 | "(1..%d)\n", __func__, bch->slot, | 1179 | "(1..%d)\n", __func__, bch->slot, |
1180 | hc->b_num+1); | 1180 | hc->b_num + 1); |
1181 | test_and_clear_bit(FLG_ACTIVE, &bch->Flags); | 1181 | test_and_clear_bit(FLG_ACTIVE, &bch->Flags); |
1182 | skb_trim(skb, 0); | 1182 | skb_trim(skb, 0); |
1183 | queue_ch_frame(ch, PH_DEACTIVATE_IND, hh->id, skb); | 1183 | queue_ch_frame(ch, PH_DEACTIVATE_IND, hh->id, skb); |
@@ -1202,14 +1202,14 @@ channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) | |||
1202 | case MISDN_CTRL_HW_FEATURES: /* fill features structure */ | 1202 | case MISDN_CTRL_HW_FEATURES: /* fill features structure */ |
1203 | if (debug & DEBUG_L1OIP_MSG) | 1203 | if (debug & DEBUG_L1OIP_MSG) |
1204 | printk(KERN_DEBUG "%s: HW_FEATURE request\n", | 1204 | printk(KERN_DEBUG "%s: HW_FEATURE request\n", |
1205 | __func__); | 1205 | __func__); |
1206 | /* create confirm */ | 1206 | /* create confirm */ |
1207 | features->unclocked = 1; | 1207 | features->unclocked = 1; |
1208 | features->unordered = 1; | 1208 | features->unordered = 1; |
1209 | break; | 1209 | break; |
1210 | default: | 1210 | default: |
1211 | printk(KERN_WARNING "%s: unknown Op %x\n", | 1211 | printk(KERN_WARNING "%s: unknown Op %x\n", |
1212 | __func__, cq->op); | 1212 | __func__, cq->op); |
1213 | ret = -EINVAL; | 1213 | ret = -EINVAL; |
1214 | break; | 1214 | break; |
1215 | } | 1215 | } |
@@ -1224,7 +1224,7 @@ l1oip_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
1224 | 1224 | ||
1225 | if (bch->debug & DEBUG_HW) | 1225 | if (bch->debug & DEBUG_HW) |
1226 | printk(KERN_DEBUG "%s: cmd:%x %p\n", | 1226 | printk(KERN_DEBUG "%s: cmd:%x %p\n", |
1227 | __func__, cmd, arg); | 1227 | __func__, cmd, arg); |
1228 | switch (cmd) { | 1228 | switch (cmd) { |
1229 | case CLOSE_CHANNEL: | 1229 | case CLOSE_CHANNEL: |
1230 | test_and_clear_bit(FLG_OPEN, &bch->Flags); | 1230 | test_and_clear_bit(FLG_OPEN, &bch->Flags); |
@@ -1239,7 +1239,7 @@ l1oip_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
1239 | break; | 1239 | break; |
1240 | default: | 1240 | default: |
1241 | printk(KERN_WARNING "%s: unknown prim(%x)\n", | 1241 | printk(KERN_WARNING "%s: unknown prim(%x)\n", |
1242 | __func__, cmd); | 1242 | __func__, cmd); |
1243 | } | 1243 | } |
1244 | return err; | 1244 | return err; |
1245 | } | 1245 | } |
@@ -1330,18 +1330,18 @@ init_card(struct l1oip *hc, int pri, int bundle) | |||
1330 | break; | 1330 | break; |
1331 | default: | 1331 | default: |
1332 | printk(KERN_ERR "Codec(%d) not supported.\n", | 1332 | printk(KERN_ERR "Codec(%d) not supported.\n", |
1333 | codec[l1oip_cnt]); | 1333 | codec[l1oip_cnt]); |
1334 | return -EINVAL; | 1334 | return -EINVAL; |
1335 | } | 1335 | } |
1336 | hc->codec = codec[l1oip_cnt]; | 1336 | hc->codec = codec[l1oip_cnt]; |
1337 | if (debug & DEBUG_L1OIP_INIT) | 1337 | if (debug & DEBUG_L1OIP_INIT) |
1338 | printk(KERN_DEBUG "%s: using codec %d\n", | 1338 | printk(KERN_DEBUG "%s: using codec %d\n", |
1339 | __func__, hc->codec); | 1339 | __func__, hc->codec); |
1340 | 1340 | ||
1341 | if (id[l1oip_cnt] == 0) { | 1341 | if (id[l1oip_cnt] == 0) { |
1342 | printk(KERN_WARNING "Warning: No 'id' value given or " | 1342 | printk(KERN_WARNING "Warning: No 'id' value given or " |
1343 | "0, this is highly unsecure. Please use 32 " | 1343 | "0, this is highly unsecure. Please use 32 " |
1344 | "bit randmom number 0x...\n"); | 1344 | "bit randmom number 0x...\n"); |
1345 | } | 1345 | } |
1346 | hc->id = id[l1oip_cnt]; | 1346 | hc->id = id[l1oip_cnt]; |
1347 | if (debug & DEBUG_L1OIP_INIT) | 1347 | if (debug & DEBUG_L1OIP_INIT) |
@@ -1350,7 +1350,7 @@ init_card(struct l1oip *hc, int pri, int bundle) | |||
1350 | hc->ondemand = ondemand[l1oip_cnt]; | 1350 | hc->ondemand = ondemand[l1oip_cnt]; |
1351 | if (hc->ondemand && !hc->id) { | 1351 | if (hc->ondemand && !hc->id) { |
1352 | printk(KERN_ERR "%s: ondemand option only allowed in " | 1352 | printk(KERN_ERR "%s: ondemand option only allowed in " |
1353 | "conjunction with non 0 ID\n", __func__); | 1353 | "conjunction with non 0 ID\n", __func__); |
1354 | return -EINVAL; | 1354 | return -EINVAL; |
1355 | } | 1355 | } |
1356 | 1356 | ||
@@ -1358,37 +1358,37 @@ init_card(struct l1oip *hc, int pri, int bundle) | |||
1358 | hc->b_num = limit[l1oip_cnt]; | 1358 | hc->b_num = limit[l1oip_cnt]; |
1359 | if (!pri && hc->b_num > 2) { | 1359 | if (!pri && hc->b_num > 2) { |
1360 | printk(KERN_ERR "Maximum limit for BRI interface is 2 " | 1360 | printk(KERN_ERR "Maximum limit for BRI interface is 2 " |
1361 | "channels.\n"); | 1361 | "channels.\n"); |
1362 | return -EINVAL; | 1362 | return -EINVAL; |
1363 | } | 1363 | } |
1364 | if (pri && hc->b_num > 126) { | 1364 | if (pri && hc->b_num > 126) { |
1365 | printk(KERN_ERR "Maximum limit for PRI interface is 126 " | 1365 | printk(KERN_ERR "Maximum limit for PRI interface is 126 " |
1366 | "channels.\n"); | 1366 | "channels.\n"); |
1367 | return -EINVAL; | 1367 | return -EINVAL; |
1368 | } | 1368 | } |
1369 | if (pri && hc->b_num > 30) { | 1369 | if (pri && hc->b_num > 30) { |
1370 | printk(KERN_WARNING "Maximum limit for BRI interface is 30 " | 1370 | printk(KERN_WARNING "Maximum limit for BRI interface is 30 " |
1371 | "channels.\n"); | 1371 | "channels.\n"); |
1372 | printk(KERN_WARNING "Your selection of %d channels must be " | 1372 | printk(KERN_WARNING "Your selection of %d channels must be " |
1373 | "supported by application.\n", hc->limit); | 1373 | "supported by application.\n", hc->limit); |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | hc->remoteip = ip[l1oip_cnt<<2] << 24 | 1376 | hc->remoteip = ip[l1oip_cnt << 2] << 24 |
1377 | | ip[(l1oip_cnt<<2)+1] << 16 | 1377 | | ip[(l1oip_cnt << 2) + 1] << 16 |
1378 | | ip[(l1oip_cnt<<2)+2] << 8 | 1378 | | ip[(l1oip_cnt << 2) + 2] << 8 |
1379 | | ip[(l1oip_cnt<<2)+3]; | 1379 | | ip[(l1oip_cnt << 2) + 3]; |
1380 | hc->localport = port[l1oip_cnt]?:(L1OIP_DEFAULTPORT+l1oip_cnt); | 1380 | hc->localport = port[l1oip_cnt]?:(L1OIP_DEFAULTPORT + l1oip_cnt); |
1381 | if (remoteport[l1oip_cnt]) | 1381 | if (remoteport[l1oip_cnt]) |
1382 | hc->remoteport = remoteport[l1oip_cnt]; | 1382 | hc->remoteport = remoteport[l1oip_cnt]; |
1383 | else | 1383 | else |
1384 | hc->remoteport = hc->localport; | 1384 | hc->remoteport = hc->localport; |
1385 | if (debug & DEBUG_L1OIP_INIT) | 1385 | if (debug & DEBUG_L1OIP_INIT) |
1386 | printk(KERN_DEBUG "%s: using local port %d remote ip " | 1386 | printk(KERN_DEBUG "%s: using local port %d remote ip " |
1387 | "%d.%d.%d.%d port %d ondemand %d\n", __func__, | 1387 | "%d.%d.%d.%d port %d ondemand %d\n", __func__, |
1388 | hc->localport, hc->remoteip >> 24, | 1388 | hc->localport, hc->remoteip >> 24, |
1389 | (hc->remoteip >> 16) & 0xff, | 1389 | (hc->remoteip >> 16) & 0xff, |
1390 | (hc->remoteip >> 8) & 0xff, hc->remoteip & 0xff, | 1390 | (hc->remoteip >> 8) & 0xff, hc->remoteip & 0xff, |
1391 | hc->remoteport, hc->ondemand); | 1391 | hc->remoteport, hc->ondemand); |
1392 | 1392 | ||
1393 | dch = kzalloc(sizeof(struct dchannel), GFP_KERNEL); | 1393 | dch = kzalloc(sizeof(struct dchannel), GFP_KERNEL); |
1394 | if (!dch) | 1394 | if (!dch) |
@@ -1401,7 +1401,7 @@ init_card(struct l1oip *hc, int pri, int bundle) | |||
1401 | else | 1401 | else |
1402 | dch->dev.Dprotocols = (1 << ISDN_P_TE_S0) | (1 << ISDN_P_NT_S0); | 1402 | dch->dev.Dprotocols = (1 << ISDN_P_TE_S0) | (1 << ISDN_P_NT_S0); |
1403 | dch->dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | | 1403 | dch->dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | |
1404 | (1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK)); | 1404 | (1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK)); |
1405 | dch->dev.D.send = handle_dmsg; | 1405 | dch->dev.D.send = handle_dmsg; |
1406 | dch->dev.D.ctrl = l1oip_dctrl; | 1406 | dch->dev.D.ctrl = l1oip_dctrl; |
1407 | dch->dev.nrbchan = hc->b_num; | 1407 | dch->dev.nrbchan = hc->b_num; |
@@ -1414,7 +1414,7 @@ init_card(struct l1oip *hc, int pri, int bundle) | |||
1414 | bch = kzalloc(sizeof(struct bchannel), GFP_KERNEL); | 1414 | bch = kzalloc(sizeof(struct bchannel), GFP_KERNEL); |
1415 | if (!bch) { | 1415 | if (!bch) { |
1416 | printk(KERN_ERR "%s: no memory for bchannel\n", | 1416 | printk(KERN_ERR "%s: no memory for bchannel\n", |
1417 | __func__); | 1417 | __func__); |
1418 | return -ENOMEM; | 1418 | return -ENOMEM; |
1419 | } | 1419 | } |
1420 | bch->nr = i + ch; | 1420 | bch->nr = i + ch; |
@@ -1437,7 +1437,7 @@ init_card(struct l1oip *hc, int pri, int bundle) | |||
1437 | 1437 | ||
1438 | if (debug & DEBUG_L1OIP_INIT) | 1438 | if (debug & DEBUG_L1OIP_INIT) |
1439 | printk(KERN_DEBUG "%s: Setting up network card(%d)\n", | 1439 | printk(KERN_DEBUG "%s: Setting up network card(%d)\n", |
1440 | __func__, l1oip_cnt + 1); | 1440 | __func__, l1oip_cnt + 1); |
1441 | ret = l1oip_socket_open(hc); | 1441 | ret = l1oip_socket_open(hc); |
1442 | if (ret) | 1442 | if (ret) |
1443 | return ret; | 1443 | return ret; |
@@ -1445,7 +1445,7 @@ init_card(struct l1oip *hc, int pri, int bundle) | |||
1445 | hc->keep_tl.function = (void *)l1oip_keepalive; | 1445 | hc->keep_tl.function = (void *)l1oip_keepalive; |
1446 | hc->keep_tl.data = (ulong)hc; | 1446 | hc->keep_tl.data = (ulong)hc; |
1447 | init_timer(&hc->keep_tl); | 1447 | init_timer(&hc->keep_tl); |
1448 | hc->keep_tl.expires = jiffies + 2*HZ; /* two seconds first time */ | 1448 | hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */ |
1449 | add_timer(&hc->keep_tl); | 1449 | add_timer(&hc->keep_tl); |
1450 | 1450 | ||
1451 | hc->timeout_tl.function = (void *)l1oip_timeout; | 1451 | hc->timeout_tl.function = (void *)l1oip_timeout; |
@@ -1464,7 +1464,7 @@ l1oip_init(void) | |||
1464 | int ret; | 1464 | int ret; |
1465 | 1465 | ||
1466 | printk(KERN_INFO "mISDN: Layer-1-over-IP driver Rev. %s\n", | 1466 | printk(KERN_INFO "mISDN: Layer-1-over-IP driver Rev. %s\n", |
1467 | l1oip_revision); | 1467 | l1oip_revision); |
1468 | 1468 | ||
1469 | INIT_LIST_HEAD(&l1oip_ilist); | 1469 | INIT_LIST_HEAD(&l1oip_ilist); |
1470 | spin_lock_init(&l1oip_lock); | 1470 | spin_lock_init(&l1oip_lock); |
@@ -1493,16 +1493,16 @@ l1oip_init(void) | |||
1493 | break; | 1493 | break; |
1494 | default: | 1494 | default: |
1495 | printk(KERN_ERR "Card type(%d) not supported.\n", | 1495 | printk(KERN_ERR "Card type(%d) not supported.\n", |
1496 | type[l1oip_cnt] & 0xff); | 1496 | type[l1oip_cnt] & 0xff); |
1497 | l1oip_cleanup(); | 1497 | l1oip_cleanup(); |
1498 | return -EINVAL; | 1498 | return -EINVAL; |
1499 | } | 1499 | } |
1500 | 1500 | ||
1501 | if (debug & DEBUG_L1OIP_INIT) | 1501 | if (debug & DEBUG_L1OIP_INIT) |
1502 | printk(KERN_DEBUG "%s: interface %d is %s with %s.\n", | 1502 | printk(KERN_DEBUG "%s: interface %d is %s with %s.\n", |
1503 | __func__, l1oip_cnt, pri ? "PRI" : "BRI", | 1503 | __func__, l1oip_cnt, pri ? "PRI" : "BRI", |
1504 | bundle ? "bundled IP packet for all B-channels" : | 1504 | bundle ? "bundled IP packet for all B-channels" : |
1505 | "separate IP packets for every B-channel"); | 1505 | "separate IP packets for every B-channel"); |
1506 | 1506 | ||
1507 | hc = kzalloc(sizeof(struct l1oip), GFP_ATOMIC); | 1507 | hc = kzalloc(sizeof(struct l1oip), GFP_ATOMIC); |
1508 | if (!hc) { | 1508 | if (!hc) { |
@@ -1530,4 +1530,3 @@ l1oip_init(void) | |||
1530 | 1530 | ||
1531 | module_init(l1oip_init); | 1531 | module_init(l1oip_init); |
1532 | module_exit(l1oip_cleanup); | 1532 | module_exit(l1oip_cleanup); |
1533 | |||
diff --git a/drivers/isdn/mISDN/layer1.c b/drivers/isdn/mISDN/layer1.c index 5cc7c001c523..0fc49b375514 100644 --- a/drivers/isdn/mISDN/layer1.c +++ b/drivers/isdn/mISDN/layer1.c | |||
@@ -26,12 +26,12 @@ | |||
26 | static u_int *debug; | 26 | static u_int *debug; |
27 | 27 | ||
28 | struct layer1 { | 28 | struct layer1 { |
29 | u_long Flags; | 29 | u_long Flags; |
30 | struct FsmInst l1m; | 30 | struct FsmInst l1m; |
31 | struct FsmTimer timer; | 31 | struct FsmTimer timer; |
32 | int delay; | 32 | int delay; |
33 | struct dchannel *dch; | 33 | struct dchannel *dch; |
34 | dchannel_l1callback *dcb; | 34 | dchannel_l1callback *dcb; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #define TIMER3_VALUE 7000 | 37 | #define TIMER3_VALUE 7000 |
@@ -49,7 +49,7 @@ enum { | |||
49 | ST_L1_F8, | 49 | ST_L1_F8, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | #define L1S_STATE_COUNT (ST_L1_F8+1) | 52 | #define L1S_STATE_COUNT (ST_L1_F8 + 1) |
53 | 53 | ||
54 | static char *strL1SState[] = | 54 | static char *strL1SState[] = |
55 | { | 55 | { |
@@ -358,7 +358,7 @@ l1_event(struct layer1 *l1, u_int event) | |||
358 | default: | 358 | default: |
359 | if (*debug & DEBUG_L1) | 359 | if (*debug & DEBUG_L1) |
360 | printk(KERN_DEBUG "%s %x unhandled\n", | 360 | printk(KERN_DEBUG "%s %x unhandled\n", |
361 | __func__, event); | 361 | __func__, event); |
362 | err = -EINVAL; | 362 | err = -EINVAL; |
363 | } | 363 | } |
364 | return err; | 364 | return err; |
diff --git a/drivers/isdn/mISDN/layer1.h b/drivers/isdn/mISDN/layer1.h index 9c8125fd89af..d1d332ced05f 100644 --- a/drivers/isdn/mISDN/layer1.h +++ b/drivers/isdn/mISDN/layer1.h | |||
@@ -23,4 +23,3 @@ | |||
23 | #define FLG_L1_PULL_REQ 6 | 23 | #define FLG_L1_PULL_REQ 6 |
24 | #define FLG_L1_UINT 7 | 24 | #define FLG_L1_UINT 7 |
25 | #define FLG_L1_DBLOCKED 8 | 25 | #define FLG_L1_DBLOCKED 8 |
26 | |||
diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c index 5bc00156315e..39d7375fa551 100644 --- a/drivers/isdn/mISDN/layer2.c +++ b/drivers/isdn/mISDN/layer2.c | |||
@@ -63,7 +63,7 @@ enum { | |||
63 | EV_L2_FRAME_ERROR, | 63 | EV_L2_FRAME_ERROR, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | #define L2_EVENT_COUNT (EV_L2_FRAME_ERROR+1) | 66 | #define L2_EVENT_COUNT (EV_L2_FRAME_ERROR + 1) |
67 | 67 | ||
68 | static char *strL2Event[] = | 68 | static char *strL2Event[] = |
69 | { | 69 | { |
@@ -281,9 +281,9 @@ l2mgr(struct layer2 *l2, u_int prim, void *arg) { | |||
281 | long c = (long)arg; | 281 | long c = (long)arg; |
282 | 282 | ||
283 | printk(KERN_WARNING | 283 | printk(KERN_WARNING |
284 | "l2mgr: addr:%x prim %x %c\n", l2->id, prim, (char)c); | 284 | "l2mgr: addr:%x prim %x %c\n", l2->id, prim, (char)c); |
285 | if (test_bit(FLG_LAPD, &l2->flag) && | 285 | if (test_bit(FLG_LAPD, &l2->flag) && |
286 | !test_bit(FLG_FIXED_TEI, &l2->flag)) { | 286 | !test_bit(FLG_FIXED_TEI, &l2->flag)) { |
287 | switch (c) { | 287 | switch (c) { |
288 | case 'C': | 288 | case 'C': |
289 | case 'D': | 289 | case 'D': |
@@ -340,7 +340,7 @@ ReleaseWin(struct layer2 *l2) | |||
340 | 340 | ||
341 | if (cnt) | 341 | if (cnt) |
342 | printk(KERN_WARNING | 342 | printk(KERN_WARNING |
343 | "isdnl2 freed %d skbuffs in release\n", cnt); | 343 | "isdnl2 freed %d skbuffs in release\n", cnt); |
344 | } | 344 | } |
345 | 345 | ||
346 | inline unsigned int | 346 | inline unsigned int |
@@ -471,7 +471,7 @@ inline int | |||
471 | IsRNR(u_char *data, struct layer2 *l2) | 471 | IsRNR(u_char *data, struct layer2 *l2) |
472 | { | 472 | { |
473 | return test_bit(FLG_MOD128, &l2->flag) ? | 473 | return test_bit(FLG_MOD128, &l2->flag) ? |
474 | data[0] == RNR : (data[0] & 0xf) == RNR; | 474 | data[0] == RNR : (data[0] & 0xf) == RNR; |
475 | } | 475 | } |
476 | 476 | ||
477 | static int | 477 | static int |
@@ -543,15 +543,15 @@ FRMR_error(struct layer2 *l2, struct sk_buff *skb) | |||
543 | return 'N'; | 543 | return 'N'; |
544 | else if (*debug & DEBUG_L2) | 544 | else if (*debug & DEBUG_L2) |
545 | l2m_debug(&l2->l2m, | 545 | l2m_debug(&l2->l2m, |
546 | "FRMR information %2x %2x %2x %2x %2x", | 546 | "FRMR information %2x %2x %2x %2x %2x", |
547 | datap[0], datap[1], datap[2], datap[3], datap[4]); | 547 | datap[0], datap[1], datap[2], datap[3], datap[4]); |
548 | } else { | 548 | } else { |
549 | if (skb->len < headers + 3) | 549 | if (skb->len < headers + 3) |
550 | return 'N'; | 550 | return 'N'; |
551 | else if (*debug & DEBUG_L2) | 551 | else if (*debug & DEBUG_L2) |
552 | l2m_debug(&l2->l2m, | 552 | l2m_debug(&l2->l2m, |
553 | "FRMR information %2x %2x %2x", | 553 | "FRMR information %2x %2x %2x", |
554 | datap[0], datap[1], datap[2]); | 554 | datap[0], datap[1], datap[2]); |
555 | } | 555 | } |
556 | return 0; | 556 | return 0; |
557 | } | 557 | } |
@@ -604,7 +604,7 @@ send_uframe(struct layer2 *l2, struct sk_buff *skb, u_char cmd, u_char cr) | |||
604 | skb = mI_alloc_skb(i, GFP_ATOMIC); | 604 | skb = mI_alloc_skb(i, GFP_ATOMIC); |
605 | if (!skb) { | 605 | if (!skb) { |
606 | printk(KERN_WARNING "%s: can't alloc skbuff\n", | 606 | printk(KERN_WARNING "%s: can't alloc skbuff\n", |
607 | __func__); | 607 | __func__); |
608 | return; | 608 | return; |
609 | } | 609 | } |
610 | } | 610 | } |
@@ -1051,7 +1051,7 @@ l2_st5_dm_release(struct FsmInst *fi, int event, void *arg) | |||
1051 | skb_queue_purge(&l2->i_queue); | 1051 | skb_queue_purge(&l2->i_queue); |
1052 | if (test_bit(FLG_LAPB, &l2->flag)) | 1052 | if (test_bit(FLG_LAPB, &l2->flag)) |
1053 | l2down_create(l2, PH_DEACTIVATE_REQ, | 1053 | l2down_create(l2, PH_DEACTIVATE_REQ, |
1054 | l2_newid(l2), 0, NULL); | 1054 | l2_newid(l2), 0, NULL); |
1055 | st5_dl_release_l2l3(l2); | 1055 | st5_dl_release_l2l3(l2); |
1056 | mISDN_FsmChangeState(fi, ST_L2_4); | 1056 | mISDN_FsmChangeState(fi, ST_L2_4); |
1057 | if (l2->tm) | 1057 | if (l2->tm) |
@@ -1090,7 +1090,7 @@ enquiry_cr(struct layer2 *l2, u_char typ, u_char cr, u_char pf) | |||
1090 | skb = mI_alloc_skb(i, GFP_ATOMIC); | 1090 | skb = mI_alloc_skb(i, GFP_ATOMIC); |
1091 | if (!skb) { | 1091 | if (!skb) { |
1092 | printk(KERN_WARNING | 1092 | printk(KERN_WARNING |
1093 | "isdnl2 can't alloc sbbuff for enquiry_cr\n"); | 1093 | "isdnl2 can't alloc sbbuff for enquiry_cr\n"); |
1094 | return; | 1094 | return; |
1095 | } | 1095 | } |
1096 | memcpy(skb_put(skb, i), tmp, i); | 1096 | memcpy(skb_put(skb, i), tmp, i); |
@@ -1149,8 +1149,8 @@ invoke_retransmission(struct layer2 *l2, unsigned int nr) | |||
1149 | skb_queue_head(&l2->i_queue, l2->windowar[p1]); | 1149 | skb_queue_head(&l2->i_queue, l2->windowar[p1]); |
1150 | else | 1150 | else |
1151 | printk(KERN_WARNING | 1151 | printk(KERN_WARNING |
1152 | "%s: windowar[%d] is NULL\n", | 1152 | "%s: windowar[%d] is NULL\n", |
1153 | __func__, p1); | 1153 | __func__, p1); |
1154 | l2->windowar[p1] = NULL; | 1154 | l2->windowar[p1] = NULL; |
1155 | } | 1155 | } |
1156 | mISDN_FsmEvent(&l2->l2m, EV_L2_ACK_PULL, NULL); | 1156 | mISDN_FsmEvent(&l2->l2m, EV_L2_ACK_PULL, NULL); |
@@ -1199,13 +1199,13 @@ l2_st7_got_super(struct FsmInst *fi, int event, void *arg) | |||
1199 | invoke_retransmission(l2, nr); | 1199 | invoke_retransmission(l2, nr); |
1200 | stop_t200(l2, 10); | 1200 | stop_t200(l2, 10); |
1201 | if (mISDN_FsmAddTimer(&l2->t203, l2->T203, | 1201 | if (mISDN_FsmAddTimer(&l2->t203, l2->T203, |
1202 | EV_L2_T203, NULL, 6)) | 1202 | EV_L2_T203, NULL, 6)) |
1203 | l2m_debug(&l2->l2m, "Restart T203 ST7 REJ"); | 1203 | l2m_debug(&l2->l2m, "Restart T203 ST7 REJ"); |
1204 | } else if ((nr == l2->vs) && (typ == RR)) { | 1204 | } else if ((nr == l2->vs) && (typ == RR)) { |
1205 | setva(l2, nr); | 1205 | setva(l2, nr); |
1206 | stop_t200(l2, 11); | 1206 | stop_t200(l2, 11); |
1207 | mISDN_FsmRestartTimer(&l2->t203, l2->T203, | 1207 | mISDN_FsmRestartTimer(&l2->t203, l2->T203, |
1208 | EV_L2_T203, NULL, 7); | 1208 | EV_L2_T203, NULL, 7); |
1209 | } else if ((l2->va != nr) || (typ == RNR)) { | 1209 | } else if ((l2->va != nr) || (typ == RNR)) { |
1210 | setva(l2, nr); | 1210 | setva(l2, nr); |
1211 | if (typ != RR) | 1211 | if (typ != RR) |
@@ -1303,7 +1303,7 @@ l2_got_iframe(struct FsmInst *fi, int event, void *arg) | |||
1303 | if (nr == l2->vs) { | 1303 | if (nr == l2->vs) { |
1304 | stop_t200(l2, 13); | 1304 | stop_t200(l2, 13); |
1305 | mISDN_FsmRestartTimer(&l2->t203, l2->T203, | 1305 | mISDN_FsmRestartTimer(&l2->t203, l2->T203, |
1306 | EV_L2_T203, NULL, 7); | 1306 | EV_L2_T203, NULL, 7); |
1307 | } else if (nr != l2->va) | 1307 | } else if (nr != l2->va) |
1308 | restart_t200(l2, 14); | 1308 | restart_t200(l2, 14); |
1309 | } | 1309 | } |
@@ -1343,7 +1343,7 @@ l2_st5_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1343 | struct layer2 *l2 = fi->userdata; | 1343 | struct layer2 *l2 = fi->userdata; |
1344 | 1344 | ||
1345 | if (test_bit(FLG_LAPD, &l2->flag) && | 1345 | if (test_bit(FLG_LAPD, &l2->flag) && |
1346 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { | 1346 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { |
1347 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); | 1347 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); |
1348 | } else if (l2->rc == l2->N200) { | 1348 | } else if (l2->rc == l2->N200) { |
1349 | mISDN_FsmChangeState(fi, ST_L2_4); | 1349 | mISDN_FsmChangeState(fi, ST_L2_4); |
@@ -1352,7 +1352,7 @@ l2_st5_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1352 | l2mgr(l2, MDL_ERROR_IND, (void *) 'G'); | 1352 | l2mgr(l2, MDL_ERROR_IND, (void *) 'G'); |
1353 | if (test_bit(FLG_LAPB, &l2->flag)) | 1353 | if (test_bit(FLG_LAPB, &l2->flag)) |
1354 | l2down_create(l2, PH_DEACTIVATE_REQ, | 1354 | l2down_create(l2, PH_DEACTIVATE_REQ, |
1355 | l2_newid(l2), 0, NULL); | 1355 | l2_newid(l2), 0, NULL); |
1356 | st5_dl_release_l2l3(l2); | 1356 | st5_dl_release_l2l3(l2); |
1357 | if (l2->tm) | 1357 | if (l2->tm) |
1358 | l2_tei(l2, MDL_STATUS_DOWN_IND, 0); | 1358 | l2_tei(l2, MDL_STATUS_DOWN_IND, 0); |
@@ -1360,7 +1360,7 @@ l2_st5_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1360 | l2->rc++; | 1360 | l2->rc++; |
1361 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); | 1361 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); |
1362 | send_uframe(l2, NULL, (test_bit(FLG_MOD128, &l2->flag) ? | 1362 | send_uframe(l2, NULL, (test_bit(FLG_MOD128, &l2->flag) ? |
1363 | SABME : SABM) | 0x10, CMD); | 1363 | SABME : SABM) | 0x10, CMD); |
1364 | } | 1364 | } |
1365 | } | 1365 | } |
1366 | 1366 | ||
@@ -1370,7 +1370,7 @@ l2_st6_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1370 | struct layer2 *l2 = fi->userdata; | 1370 | struct layer2 *l2 = fi->userdata; |
1371 | 1371 | ||
1372 | if (test_bit(FLG_LAPD, &l2->flag) && | 1372 | if (test_bit(FLG_LAPD, &l2->flag) && |
1373 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { | 1373 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { |
1374 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); | 1374 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); |
1375 | } else if (l2->rc == l2->N200) { | 1375 | } else if (l2->rc == l2->N200) { |
1376 | mISDN_FsmChangeState(fi, ST_L2_4); | 1376 | mISDN_FsmChangeState(fi, ST_L2_4); |
@@ -1382,7 +1382,7 @@ l2_st6_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1382 | } else { | 1382 | } else { |
1383 | l2->rc++; | 1383 | l2->rc++; |
1384 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, | 1384 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, |
1385 | NULL, 9); | 1385 | NULL, 9); |
1386 | send_uframe(l2, NULL, DISC | 0x10, CMD); | 1386 | send_uframe(l2, NULL, DISC | 0x10, CMD); |
1387 | } | 1387 | } |
1388 | } | 1388 | } |
@@ -1393,7 +1393,7 @@ l2_st7_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1393 | struct layer2 *l2 = fi->userdata; | 1393 | struct layer2 *l2 = fi->userdata; |
1394 | 1394 | ||
1395 | if (test_bit(FLG_LAPD, &l2->flag) && | 1395 | if (test_bit(FLG_LAPD, &l2->flag) && |
1396 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { | 1396 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { |
1397 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); | 1397 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); |
1398 | return; | 1398 | return; |
1399 | } | 1399 | } |
@@ -1410,7 +1410,7 @@ l2_st8_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1410 | struct layer2 *l2 = fi->userdata; | 1410 | struct layer2 *l2 = fi->userdata; |
1411 | 1411 | ||
1412 | if (test_bit(FLG_LAPD, &l2->flag) && | 1412 | if (test_bit(FLG_LAPD, &l2->flag) && |
1413 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { | 1413 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { |
1414 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); | 1414 | mISDN_FsmAddTimer(&l2->t200, l2->T200, EV_L2_T200, NULL, 9); |
1415 | return; | 1415 | return; |
1416 | } | 1416 | } |
@@ -1431,7 +1431,7 @@ l2_st7_tout_203(struct FsmInst *fi, int event, void *arg) | |||
1431 | struct layer2 *l2 = fi->userdata; | 1431 | struct layer2 *l2 = fi->userdata; |
1432 | 1432 | ||
1433 | if (test_bit(FLG_LAPD, &l2->flag) && | 1433 | if (test_bit(FLG_LAPD, &l2->flag) && |
1434 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { | 1434 | test_bit(FLG_DCHAN_BUSY, &l2->flag)) { |
1435 | mISDN_FsmAddTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 9); | 1435 | mISDN_FsmAddTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 9); |
1436 | return; | 1436 | return; |
1437 | } | 1437 | } |
@@ -1462,7 +1462,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1462 | p1 = (p1 + l2->sow) % l2->window; | 1462 | p1 = (p1 + l2->sow) % l2->window; |
1463 | if (l2->windowar[p1]) { | 1463 | if (l2->windowar[p1]) { |
1464 | printk(KERN_WARNING "isdnl2 try overwrite ack queue entry %d\n", | 1464 | printk(KERN_WARNING "isdnl2 try overwrite ack queue entry %d\n", |
1465 | p1); | 1465 | p1); |
1466 | dev_kfree_skb(l2->windowar[p1]); | 1466 | dev_kfree_skb(l2->windowar[p1]); |
1467 | } | 1467 | } |
1468 | l2->windowar[p1] = skb; | 1468 | l2->windowar[p1] = skb; |
@@ -1482,7 +1482,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1482 | memcpy(skb_push(nskb, i), header, i); | 1482 | memcpy(skb_push(nskb, i), header, i); |
1483 | else { | 1483 | else { |
1484 | printk(KERN_WARNING | 1484 | printk(KERN_WARNING |
1485 | "isdnl2 pull_iqueue skb header(%d/%d) too short\n", i, p1); | 1485 | "isdnl2 pull_iqueue skb header(%d/%d) too short\n", i, p1); |
1486 | oskb = nskb; | 1486 | oskb = nskb; |
1487 | nskb = mI_alloc_skb(oskb->len + i, GFP_ATOMIC); | 1487 | nskb = mI_alloc_skb(oskb->len + i, GFP_ATOMIC); |
1488 | if (!nskb) { | 1488 | if (!nskb) { |
@@ -1537,7 +1537,7 @@ l2_st8_got_super(struct FsmInst *fi, int event, void *arg) | |||
1537 | } else { | 1537 | } else { |
1538 | stop_t200(l2, 16); | 1538 | stop_t200(l2, 16); |
1539 | mISDN_FsmAddTimer(&l2->t203, l2->T203, | 1539 | mISDN_FsmAddTimer(&l2->t203, l2->T203, |
1540 | EV_L2_T203, NULL, 5); | 1540 | EV_L2_T203, NULL, 5); |
1541 | setva(l2, nr); | 1541 | setva(l2, nr); |
1542 | } | 1542 | } |
1543 | invoke_retransmission(l2, nr); | 1543 | invoke_retransmission(l2, nr); |
@@ -1858,7 +1858,7 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) | |||
1858 | ptei = *datap++; | 1858 | ptei = *datap++; |
1859 | if ((psapi & 1) || !(ptei & 1)) { | 1859 | if ((psapi & 1) || !(ptei & 1)) { |
1860 | printk(KERN_WARNING | 1860 | printk(KERN_WARNING |
1861 | "l2 D-channel frame wrong EA0/EA1\n"); | 1861 | "l2 D-channel frame wrong EA0/EA1\n"); |
1862 | return ret; | 1862 | return ret; |
1863 | } | 1863 | } |
1864 | psapi >>= 2; | 1864 | psapi >>= 2; |
@@ -1867,7 +1867,7 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) | |||
1867 | /* not our business */ | 1867 | /* not our business */ |
1868 | if (*debug & DEBUG_L2) | 1868 | if (*debug & DEBUG_L2) |
1869 | printk(KERN_DEBUG "%s: sapi %d/%d mismatch\n", | 1869 | printk(KERN_DEBUG "%s: sapi %d/%d mismatch\n", |
1870 | __func__, psapi, l2->sapi); | 1870 | __func__, psapi, l2->sapi); |
1871 | dev_kfree_skb(skb); | 1871 | dev_kfree_skb(skb); |
1872 | return 0; | 1872 | return 0; |
1873 | } | 1873 | } |
@@ -1875,7 +1875,7 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) | |||
1875 | /* not our business */ | 1875 | /* not our business */ |
1876 | if (*debug & DEBUG_L2) | 1876 | if (*debug & DEBUG_L2) |
1877 | printk(KERN_DEBUG "%s: tei %d/%d mismatch\n", | 1877 | printk(KERN_DEBUG "%s: tei %d/%d mismatch\n", |
1878 | __func__, ptei, l2->tei); | 1878 | __func__, ptei, l2->tei); |
1879 | dev_kfree_skb(skb); | 1879 | dev_kfree_skb(skb); |
1880 | return 0; | 1880 | return 0; |
1881 | } | 1881 | } |
@@ -1927,11 +1927,11 @@ l2_send(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1927 | { | 1927 | { |
1928 | struct layer2 *l2 = container_of(ch, struct layer2, ch); | 1928 | struct layer2 *l2 = container_of(ch, struct layer2, ch); |
1929 | struct mISDNhead *hh = mISDN_HEAD_P(skb); | 1929 | struct mISDNhead *hh = mISDN_HEAD_P(skb); |
1930 | int ret = -EINVAL; | 1930 | int ret = -EINVAL; |
1931 | 1931 | ||
1932 | if (*debug & DEBUG_L2_RECV) | 1932 | if (*debug & DEBUG_L2_RECV) |
1933 | printk(KERN_DEBUG "%s: prim(%x) id(%x) sapi(%d) tei(%d)\n", | 1933 | printk(KERN_DEBUG "%s: prim(%x) id(%x) sapi(%d) tei(%d)\n", |
1934 | __func__, hh->prim, hh->id, l2->sapi, l2->tei); | 1934 | __func__, hh->prim, hh->id, l2->sapi, l2->tei); |
1935 | switch (hh->prim) { | 1935 | switch (hh->prim) { |
1936 | case PH_DATA_IND: | 1936 | case PH_DATA_IND: |
1937 | ret = ph_data_indication(l2, hh, skb); | 1937 | ret = ph_data_indication(l2, hh, skb); |
@@ -1944,7 +1944,7 @@ l2_send(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1944 | l2up_create(l2, MPH_ACTIVATE_IND, 0, NULL); | 1944 | l2up_create(l2, MPH_ACTIVATE_IND, 0, NULL); |
1945 | if (test_and_clear_bit(FLG_ESTAB_PEND, &l2->flag)) | 1945 | if (test_and_clear_bit(FLG_ESTAB_PEND, &l2->flag)) |
1946 | ret = mISDN_FsmEvent(&l2->l2m, | 1946 | ret = mISDN_FsmEvent(&l2->l2m, |
1947 | EV_L2_DL_ESTABLISH_REQ, skb); | 1947 | EV_L2_DL_ESTABLISH_REQ, skb); |
1948 | break; | 1948 | break; |
1949 | case PH_DEACTIVATE_IND: | 1949 | case PH_DEACTIVATE_IND: |
1950 | test_and_clear_bit(FLG_L1_ACTIV, &l2->flag); | 1950 | test_and_clear_bit(FLG_L1_ACTIV, &l2->flag); |
@@ -1967,30 +1967,30 @@ l2_send(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1967 | test_and_set_bit(FLG_ORIG, &l2->flag); | 1967 | test_and_set_bit(FLG_ORIG, &l2->flag); |
1968 | if (test_bit(FLG_L1_ACTIV, &l2->flag)) { | 1968 | if (test_bit(FLG_L1_ACTIV, &l2->flag)) { |
1969 | if (test_bit(FLG_LAPD, &l2->flag) || | 1969 | if (test_bit(FLG_LAPD, &l2->flag) || |
1970 | test_bit(FLG_ORIG, &l2->flag)) | 1970 | test_bit(FLG_ORIG, &l2->flag)) |
1971 | ret = mISDN_FsmEvent(&l2->l2m, | 1971 | ret = mISDN_FsmEvent(&l2->l2m, |
1972 | EV_L2_DL_ESTABLISH_REQ, skb); | 1972 | EV_L2_DL_ESTABLISH_REQ, skb); |
1973 | } else { | 1973 | } else { |
1974 | if (test_bit(FLG_LAPD, &l2->flag) || | 1974 | if (test_bit(FLG_LAPD, &l2->flag) || |
1975 | test_bit(FLG_ORIG, &l2->flag)) { | 1975 | test_bit(FLG_ORIG, &l2->flag)) { |
1976 | test_and_set_bit(FLG_ESTAB_PEND, | 1976 | test_and_set_bit(FLG_ESTAB_PEND, |
1977 | &l2->flag); | 1977 | &l2->flag); |
1978 | } | 1978 | } |
1979 | ret = l2down(l2, PH_ACTIVATE_REQ, l2_newid(l2), | 1979 | ret = l2down(l2, PH_ACTIVATE_REQ, l2_newid(l2), |
1980 | skb); | 1980 | skb); |
1981 | } | 1981 | } |
1982 | break; | 1982 | break; |
1983 | case DL_RELEASE_REQ: | 1983 | case DL_RELEASE_REQ: |
1984 | if (test_bit(FLG_LAPB, &l2->flag)) | 1984 | if (test_bit(FLG_LAPB, &l2->flag)) |
1985 | l2down_create(l2, PH_DEACTIVATE_REQ, | 1985 | l2down_create(l2, PH_DEACTIVATE_REQ, |
1986 | l2_newid(l2), 0, NULL); | 1986 | l2_newid(l2), 0, NULL); |
1987 | ret = mISDN_FsmEvent(&l2->l2m, EV_L2_DL_RELEASE_REQ, | 1987 | ret = mISDN_FsmEvent(&l2->l2m, EV_L2_DL_RELEASE_REQ, |
1988 | skb); | 1988 | skb); |
1989 | break; | 1989 | break; |
1990 | default: | 1990 | default: |
1991 | if (*debug & DEBUG_L2) | 1991 | if (*debug & DEBUG_L2) |
1992 | l2m_debug(&l2->l2m, "l2 unknown pr %04x", | 1992 | l2m_debug(&l2->l2m, "l2 unknown pr %04x", |
1993 | hh->prim); | 1993 | hh->prim); |
1994 | } | 1994 | } |
1995 | if (ret) { | 1995 | if (ret) { |
1996 | dev_kfree_skb(skb); | 1996 | dev_kfree_skb(skb); |
@@ -2038,7 +2038,7 @@ release_l2(struct layer2 *l2) | |||
2038 | TEIrelease(l2); | 2038 | TEIrelease(l2); |
2039 | if (l2->ch.st) | 2039 | if (l2->ch.st) |
2040 | l2->ch.st->dev->D.ctrl(&l2->ch.st->dev->D, | 2040 | l2->ch.st->dev->D.ctrl(&l2->ch.st->dev->D, |
2041 | CLOSE_CHANNEL, NULL); | 2041 | CLOSE_CHANNEL, NULL); |
2042 | } | 2042 | } |
2043 | kfree(l2); | 2043 | kfree(l2); |
2044 | } | 2044 | } |
@@ -2058,7 +2058,7 @@ l2_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
2058 | set_channel_address(&l2->ch, l2->sapi, l2->tei); | 2058 | set_channel_address(&l2->ch, l2->sapi, l2->tei); |
2059 | info = DL_INFO_L2_CONNECT; | 2059 | info = DL_INFO_L2_CONNECT; |
2060 | l2up_create(l2, DL_INFORMATION_IND, | 2060 | l2up_create(l2, DL_INFORMATION_IND, |
2061 | sizeof(info), &info); | 2061 | sizeof(info), &info); |
2062 | } | 2062 | } |
2063 | break; | 2063 | break; |
2064 | case CLOSE_CHANNEL: | 2064 | case CLOSE_CHANNEL: |
@@ -2072,7 +2072,7 @@ l2_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
2072 | 2072 | ||
2073 | struct layer2 * | 2073 | struct layer2 * |
2074 | create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, int tei, | 2074 | create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, int tei, |
2075 | int sapi) | 2075 | int sapi) |
2076 | { | 2076 | { |
2077 | struct layer2 *l2; | 2077 | struct layer2 *l2; |
2078 | struct channel_req rq; | 2078 | struct channel_req rq; |
@@ -2151,7 +2151,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, int tei, | |||
2151 | break; | 2151 | break; |
2152 | default: | 2152 | default: |
2153 | printk(KERN_ERR "layer2 create failed prt %x\n", | 2153 | printk(KERN_ERR "layer2 create failed prt %x\n", |
2154 | protocol); | 2154 | protocol); |
2155 | kfree(l2); | 2155 | kfree(l2); |
2156 | return NULL; | 2156 | return NULL; |
2157 | } | 2157 | } |
@@ -2162,8 +2162,8 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, int tei, | |||
2162 | InitWin(l2); | 2162 | InitWin(l2); |
2163 | l2->l2m.fsm = &l2fsm; | 2163 | l2->l2m.fsm = &l2fsm; |
2164 | if (test_bit(FLG_LAPB, &l2->flag) || | 2164 | if (test_bit(FLG_LAPB, &l2->flag) || |
2165 | test_bit(FLG_PTP, &l2->flag) || | 2165 | test_bit(FLG_PTP, &l2->flag) || |
2166 | test_bit(FLG_LAPD_NET, &l2->flag)) | 2166 | test_bit(FLG_LAPD_NET, &l2->flag)) |
2167 | l2->l2m.state = ST_L2_4; | 2167 | l2->l2m.state = ST_L2_4; |
2168 | else | 2168 | else |
2169 | l2->l2m.state = ST_L2_1; | 2169 | l2->l2m.state = ST_L2_1; |
@@ -2219,4 +2219,3 @@ Isdnl2_cleanup(void) | |||
2219 | TEIFree(); | 2219 | TEIFree(); |
2220 | mISDN_FsmFree(&l2fsm); | 2220 | mISDN_FsmFree(&l2fsm); |
2221 | } | 2221 | } |
2222 | |||
diff --git a/drivers/isdn/mISDN/layer2.h b/drivers/isdn/mISDN/layer2.h index 9547fb3707a3..fe68d94c1b73 100644 --- a/drivers/isdn/mISDN/layer2.h +++ b/drivers/isdn/mISDN/layer2.h | |||
@@ -87,18 +87,18 @@ enum { | |||
87 | ST_L2_8, | 87 | ST_L2_8, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | #define L2_STATE_COUNT (ST_L2_8+1) | 90 | #define L2_STATE_COUNT (ST_L2_8 + 1) |
91 | 91 | ||
92 | extern struct layer2 *create_l2(struct mISDNchannel *, u_int, | 92 | extern struct layer2 *create_l2(struct mISDNchannel *, u_int, |
93 | u_long, int, int); | 93 | u_long, int, int); |
94 | extern int tei_l2(struct layer2 *, u_int, u_long arg); | 94 | extern int tei_l2(struct layer2 *, u_int, u_long arg); |
95 | 95 | ||
96 | 96 | ||
97 | /* from tei.c */ | 97 | /* from tei.c */ |
98 | extern int l2_tei(struct layer2 *, u_int, u_long arg); | 98 | extern int l2_tei(struct layer2 *, u_int, u_long arg); |
99 | extern void TEIrelease(struct layer2 *); | 99 | extern void TEIrelease(struct layer2 *); |
100 | extern int TEIInit(u_int *); | 100 | extern int TEIInit(u_int *); |
101 | extern void TEIFree(void); | 101 | extern void TEIFree(void); |
102 | 102 | ||
103 | #define MAX_L2HEADER_LEN 4 | 103 | #define MAX_L2HEADER_LEN 4 |
104 | 104 | ||
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index 738ea8dd0adf..abe2d699b6f3 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c | |||
@@ -113,7 +113,7 @@ mISDN_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) | |||
113 | 113 | ||
114 | static int | 114 | static int |
115 | mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | 115 | mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
116 | struct msghdr *msg, size_t len, int flags) | 116 | struct msghdr *msg, size_t len, int flags) |
117 | { | 117 | { |
118 | struct sk_buff *skb; | 118 | struct sk_buff *skb; |
119 | struct sock *sk = sock->sk; | 119 | struct sock *sk = sock->sk; |
@@ -123,8 +123,8 @@ mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
123 | 123 | ||
124 | if (*debug & DEBUG_SOCKET) | 124 | if (*debug & DEBUG_SOCKET) |
125 | printk(KERN_DEBUG "%s: len %d, flags %x ch.nr %d, proto %x\n", | 125 | printk(KERN_DEBUG "%s: len %d, flags %x ch.nr %d, proto %x\n", |
126 | __func__, (int)len, flags, _pms(sk)->ch.nr, | 126 | __func__, (int)len, flags, _pms(sk)->ch.nr, |
127 | sk->sk_protocol); | 127 | sk->sk_protocol); |
128 | if (flags & (MSG_OOB)) | 128 | if (flags & (MSG_OOB)) |
129 | return -EOPNOTSUPP; | 129 | return -EOPNOTSUPP; |
130 | 130 | ||
@@ -153,7 +153,7 @@ mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
153 | } else { | 153 | } else { |
154 | if (msg->msg_namelen) | 154 | if (msg->msg_namelen) |
155 | printk(KERN_WARNING "%s: too small namelen %d\n", | 155 | printk(KERN_WARNING "%s: too small namelen %d\n", |
156 | __func__, msg->msg_namelen); | 156 | __func__, msg->msg_namelen); |
157 | msg->msg_namelen = 0; | 157 | msg->msg_namelen = 0; |
158 | } | 158 | } |
159 | 159 | ||
@@ -166,7 +166,7 @@ mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
166 | return -ENOSPC; | 166 | return -ENOSPC; |
167 | } | 167 | } |
168 | memcpy(skb_push(skb, MISDN_HEADER_LEN), mISDN_HEAD_P(skb), | 168 | memcpy(skb_push(skb, MISDN_HEADER_LEN), mISDN_HEAD_P(skb), |
169 | MISDN_HEADER_LEN); | 169 | MISDN_HEADER_LEN); |
170 | 170 | ||
171 | err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); | 171 | err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); |
172 | 172 | ||
@@ -179,7 +179,7 @@ mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
179 | 179 | ||
180 | static int | 180 | static int |
181 | mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | 181 | mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, |
182 | struct msghdr *msg, size_t len) | 182 | struct msghdr *msg, size_t len) |
183 | { | 183 | { |
184 | struct sock *sk = sock->sk; | 184 | struct sock *sk = sock->sk; |
185 | struct sk_buff *skb; | 185 | struct sk_buff *skb; |
@@ -188,13 +188,13 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
188 | 188 | ||
189 | if (*debug & DEBUG_SOCKET) | 189 | if (*debug & DEBUG_SOCKET) |
190 | printk(KERN_DEBUG "%s: len %d flags %x ch %d proto %x\n", | 190 | printk(KERN_DEBUG "%s: len %d flags %x ch %d proto %x\n", |
191 | __func__, (int)len, msg->msg_flags, _pms(sk)->ch.nr, | 191 | __func__, (int)len, msg->msg_flags, _pms(sk)->ch.nr, |
192 | sk->sk_protocol); | 192 | sk->sk_protocol); |
193 | 193 | ||
194 | if (msg->msg_flags & MSG_OOB) | 194 | if (msg->msg_flags & MSG_OOB) |
195 | return -EOPNOTSUPP; | 195 | return -EOPNOTSUPP; |
196 | 196 | ||
197 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_NOSIGNAL|MSG_ERRQUEUE)) | 197 | if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_NOSIGNAL | MSG_ERRQUEUE)) |
198 | return -EINVAL; | 198 | return -EINVAL; |
199 | 199 | ||
200 | if (len < MISDN_HEADER_LEN) | 200 | if (len < MISDN_HEADER_LEN) |
@@ -229,7 +229,7 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
229 | 229 | ||
230 | if (*debug & DEBUG_SOCKET) | 230 | if (*debug & DEBUG_SOCKET) |
231 | printk(KERN_DEBUG "%s: ID:%x\n", | 231 | printk(KERN_DEBUG "%s: ID:%x\n", |
232 | __func__, mISDN_HEAD_ID(skb)); | 232 | __func__, mISDN_HEAD_ID(skb)); |
233 | 233 | ||
234 | err = -ENODEV; | 234 | err = -ENODEV; |
235 | if (!_pms(sk)->ch.peer) | 235 | if (!_pms(sk)->ch.peer) |
@@ -312,16 +312,16 @@ data_sock_ioctl_bound(struct sock *sk, unsigned int cmd, void __user *p) | |||
312 | } | 312 | } |
313 | if ((sk->sk_protocol & ~ISDN_P_B_MASK) == ISDN_P_B_START) { | 313 | if ((sk->sk_protocol & ~ISDN_P_B_MASK) == ISDN_P_B_START) { |
314 | list_for_each_entry_safe(bchan, next, | 314 | list_for_each_entry_safe(bchan, next, |
315 | &_pms(sk)->dev->bchannels, list) { | 315 | &_pms(sk)->dev->bchannels, list) { |
316 | if (bchan->nr == cq.channel) { | 316 | if (bchan->nr == cq.channel) { |
317 | err = bchan->ctrl(bchan, | 317 | err = bchan->ctrl(bchan, |
318 | CONTROL_CHANNEL, &cq); | 318 | CONTROL_CHANNEL, &cq); |
319 | break; | 319 | break; |
320 | } | 320 | } |
321 | } | 321 | } |
322 | } else | 322 | } else |
323 | err = _pms(sk)->dev->D.ctrl(&_pms(sk)->dev->D, | 323 | err = _pms(sk)->dev->D.ctrl(&_pms(sk)->dev->D, |
324 | CONTROL_CHANNEL, &cq); | 324 | CONTROL_CHANNEL, &cq); |
325 | if (err) | 325 | if (err) |
326 | break; | 326 | break; |
327 | if (copy_to_user(p, &cq, sizeof(cq))) | 327 | if (copy_to_user(p, &cq, sizeof(cq))) |
@@ -338,11 +338,11 @@ data_sock_ioctl_bound(struct sock *sk, unsigned int cmd, void __user *p) | |||
338 | break; | 338 | break; |
339 | } | 339 | } |
340 | err = _pms(sk)->dev->teimgr->ctrl(_pms(sk)->dev->teimgr, | 340 | err = _pms(sk)->dev->teimgr->ctrl(_pms(sk)->dev->teimgr, |
341 | CONTROL_CHANNEL, val); | 341 | CONTROL_CHANNEL, val); |
342 | break; | 342 | break; |
343 | case IMHOLD_L1: | 343 | case IMHOLD_L1: |
344 | if (sk->sk_protocol != ISDN_P_LAPD_NT | 344 | if (sk->sk_protocol != ISDN_P_LAPD_NT |
345 | && sk->sk_protocol != ISDN_P_LAPD_TE) { | 345 | && sk->sk_protocol != ISDN_P_LAPD_TE) { |
346 | err = -EINVAL; | 346 | err = -EINVAL; |
347 | break; | 347 | break; |
348 | } | 348 | } |
@@ -352,7 +352,7 @@ data_sock_ioctl_bound(struct sock *sk, unsigned int cmd, void __user *p) | |||
352 | break; | 352 | break; |
353 | } | 353 | } |
354 | err = _pms(sk)->dev->teimgr->ctrl(_pms(sk)->dev->teimgr, | 354 | err = _pms(sk)->dev->teimgr->ctrl(_pms(sk)->dev->teimgr, |
355 | CONTROL_CHANNEL, val); | 355 | CONTROL_CHANNEL, val); |
356 | break; | 356 | break; |
357 | default: | 357 | default: |
358 | err = -EINVAL; | 358 | err = -EINVAL; |
@@ -366,7 +366,7 @@ done: | |||
366 | static int | 366 | static int |
367 | data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 367 | data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
368 | { | 368 | { |
369 | int err = 0, id; | 369 | int err = 0, id; |
370 | struct sock *sk = sock->sk; | 370 | struct sock *sk = sock->sk; |
371 | struct mISDNdevice *dev; | 371 | struct mISDNdevice *dev; |
372 | struct mISDNversion ver; | 372 | struct mISDNversion ver; |
@@ -399,7 +399,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
399 | di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); | 399 | di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); |
400 | di.protocol = dev->D.protocol; | 400 | di.protocol = dev->D.protocol; |
401 | memcpy(di.channelmap, dev->channelmap, | 401 | memcpy(di.channelmap, dev->channelmap, |
402 | sizeof(di.channelmap)); | 402 | sizeof(di.channelmap)); |
403 | di.nrbchan = dev->nrbchan; | 403 | di.nrbchan = dev->nrbchan; |
404 | strcpy(di.name, dev_name(&dev->dev)); | 404 | strcpy(di.name, dev_name(&dev->dev)); |
405 | if (copy_to_user((void __user *)arg, &di, sizeof(di))) | 405 | if (copy_to_user((void __user *)arg, &di, sizeof(di))) |
@@ -410,7 +410,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
410 | default: | 410 | default: |
411 | if (sk->sk_state == MISDN_BOUND) | 411 | if (sk->sk_state == MISDN_BOUND) |
412 | err = data_sock_ioctl_bound(sk, cmd, | 412 | err = data_sock_ioctl_bound(sk, cmd, |
413 | (void __user *)arg); | 413 | (void __user *)arg); |
414 | else | 414 | else |
415 | err = -ENOTCONN; | 415 | err = -ENOTCONN; |
416 | } | 416 | } |
@@ -418,14 +418,14 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
418 | } | 418 | } |
419 | 419 | ||
420 | static int data_sock_setsockopt(struct socket *sock, int level, int optname, | 420 | static int data_sock_setsockopt(struct socket *sock, int level, int optname, |
421 | char __user *optval, unsigned int len) | 421 | char __user *optval, unsigned int len) |
422 | { | 422 | { |
423 | struct sock *sk = sock->sk; | 423 | struct sock *sk = sock->sk; |
424 | int err = 0, opt = 0; | 424 | int err = 0, opt = 0; |
425 | 425 | ||
426 | if (*debug & DEBUG_SOCKET) | 426 | if (*debug & DEBUG_SOCKET) |
427 | printk(KERN_DEBUG "%s(%p, %d, %x, %p, %d)\n", __func__, sock, | 427 | printk(KERN_DEBUG "%s(%p, %d, %x, %p, %d)\n", __func__, sock, |
428 | level, optname, optval, len); | 428 | level, optname, optval, len); |
429 | 429 | ||
430 | lock_sock(sk); | 430 | lock_sock(sk); |
431 | 431 | ||
@@ -450,7 +450,7 @@ static int data_sock_setsockopt(struct socket *sock, int level, int optname, | |||
450 | } | 450 | } |
451 | 451 | ||
452 | static int data_sock_getsockopt(struct socket *sock, int level, int optname, | 452 | static int data_sock_getsockopt(struct socket *sock, int level, int optname, |
453 | char __user *optval, int __user *optlen) | 453 | char __user *optval, int __user *optlen) |
454 | { | 454 | { |
455 | struct sock *sk = sock->sk; | 455 | struct sock *sk = sock->sk; |
456 | int len, opt; | 456 | int len, opt; |
@@ -516,7 +516,7 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
516 | if (csk->sk_protocol >= ISDN_P_B_START) | 516 | if (csk->sk_protocol >= ISDN_P_B_START) |
517 | continue; | 517 | continue; |
518 | if (IS_ISDN_P_TE(csk->sk_protocol) | 518 | if (IS_ISDN_P_TE(csk->sk_protocol) |
519 | == IS_ISDN_P_TE(sk->sk_protocol)) | 519 | == IS_ISDN_P_TE(sk->sk_protocol)) |
520 | continue; | 520 | continue; |
521 | read_unlock_bh(&data_sockets.lock); | 521 | read_unlock_bh(&data_sockets.lock); |
522 | err = -EBUSY; | 522 | err = -EBUSY; |
@@ -535,14 +535,14 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
535 | case ISDN_P_NT_E1: | 535 | case ISDN_P_NT_E1: |
536 | mISDN_sock_unlink(&data_sockets, sk); | 536 | mISDN_sock_unlink(&data_sockets, sk); |
537 | err = connect_layer1(_pms(sk)->dev, &_pms(sk)->ch, | 537 | err = connect_layer1(_pms(sk)->dev, &_pms(sk)->ch, |
538 | sk->sk_protocol, maddr); | 538 | sk->sk_protocol, maddr); |
539 | if (err) | 539 | if (err) |
540 | mISDN_sock_link(&data_sockets, sk); | 540 | mISDN_sock_link(&data_sockets, sk); |
541 | break; | 541 | break; |
542 | case ISDN_P_LAPD_TE: | 542 | case ISDN_P_LAPD_TE: |
543 | case ISDN_P_LAPD_NT: | 543 | case ISDN_P_LAPD_NT: |
544 | err = create_l2entity(_pms(sk)->dev, &_pms(sk)->ch, | 544 | err = create_l2entity(_pms(sk)->dev, &_pms(sk)->ch, |
545 | sk->sk_protocol, maddr); | 545 | sk->sk_protocol, maddr); |
546 | break; | 546 | break; |
547 | case ISDN_P_B_RAW: | 547 | case ISDN_P_B_RAW: |
548 | case ISDN_P_B_HDLC: | 548 | case ISDN_P_B_HDLC: |
@@ -551,7 +551,7 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
551 | case ISDN_P_B_L2DSP: | 551 | case ISDN_P_B_L2DSP: |
552 | case ISDN_P_B_L2DSPHDLC: | 552 | case ISDN_P_B_L2DSPHDLC: |
553 | err = connect_Bstack(_pms(sk)->dev, &_pms(sk)->ch, | 553 | err = connect_Bstack(_pms(sk)->dev, &_pms(sk)->ch, |
554 | sk->sk_protocol, maddr); | 554 | sk->sk_protocol, maddr); |
555 | break; | 555 | break; |
556 | default: | 556 | default: |
557 | err = -EPROTONOSUPPORT; | 557 | err = -EPROTONOSUPPORT; |
@@ -568,9 +568,9 @@ done: | |||
568 | 568 | ||
569 | static int | 569 | static int |
570 | data_sock_getname(struct socket *sock, struct sockaddr *addr, | 570 | data_sock_getname(struct socket *sock, struct sockaddr *addr, |
571 | int *addr_len, int peer) | 571 | int *addr_len, int peer) |
572 | { | 572 | { |
573 | struct sockaddr_mISDN *maddr = (struct sockaddr_mISDN *) addr; | 573 | struct sockaddr_mISDN *maddr = (struct sockaddr_mISDN *) addr; |
574 | struct sock *sk = sock->sk; | 574 | struct sock *sk = sock->sk; |
575 | 575 | ||
576 | if (!_pms(sk)->dev) | 576 | if (!_pms(sk)->dev) |
@@ -651,7 +651,7 @@ base_sock_release(struct socket *sock) | |||
651 | static int | 651 | static int |
652 | base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 652 | base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
653 | { | 653 | { |
654 | int err = 0, id; | 654 | int err = 0, id; |
655 | struct mISDNdevice *dev; | 655 | struct mISDNdevice *dev; |
656 | struct mISDNversion ver; | 656 | struct mISDNversion ver; |
657 | 657 | ||
@@ -683,7 +683,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
683 | di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); | 683 | di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); |
684 | di.protocol = dev->D.protocol; | 684 | di.protocol = dev->D.protocol; |
685 | memcpy(di.channelmap, dev->channelmap, | 685 | memcpy(di.channelmap, dev->channelmap, |
686 | sizeof(di.channelmap)); | 686 | sizeof(di.channelmap)); |
687 | di.nrbchan = dev->nrbchan; | 687 | di.nrbchan = dev->nrbchan; |
688 | strcpy(di.name, dev_name(&dev->dev)); | 688 | strcpy(di.name, dev_name(&dev->dev)); |
689 | if (copy_to_user((void __user *)arg, &di, sizeof(di))) | 689 | if (copy_to_user((void __user *)arg, &di, sizeof(di))) |
@@ -692,20 +692,20 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
692 | err = -ENODEV; | 692 | err = -ENODEV; |
693 | break; | 693 | break; |
694 | case IMSETDEVNAME: | 694 | case IMSETDEVNAME: |
695 | { | 695 | { |
696 | struct mISDN_devrename dn; | 696 | struct mISDN_devrename dn; |
697 | if (copy_from_user(&dn, (void __user *)arg, | 697 | if (copy_from_user(&dn, (void __user *)arg, |
698 | sizeof(dn))) { | 698 | sizeof(dn))) { |
699 | err = -EFAULT; | 699 | err = -EFAULT; |
700 | break; | 700 | break; |
701 | } | ||
702 | dev = get_mdevice(dn.id); | ||
703 | if (dev) | ||
704 | err = device_rename(&dev->dev, dn.name); | ||
705 | else | ||
706 | err = -ENODEV; | ||
707 | } | 701 | } |
708 | break; | 702 | dev = get_mdevice(dn.id); |
703 | if (dev) | ||
704 | err = device_rename(&dev->dev, dn.name); | ||
705 | else | ||
706 | err = -ENODEV; | ||
707 | } | ||
708 | break; | ||
709 | default: | 709 | default: |
710 | err = -EINVAL; | 710 | err = -EINVAL; |
711 | } | 711 | } |
@@ -790,7 +790,7 @@ mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern) | |||
790 | { | 790 | { |
791 | int err = -EPROTONOSUPPORT; | 791 | int err = -EPROTONOSUPPORT; |
792 | 792 | ||
793 | switch (proto) { | 793 | switch (proto) { |
794 | case ISDN_P_BASE: | 794 | case ISDN_P_BASE: |
795 | err = base_sock_create(net, sock, proto); | 795 | err = base_sock_create(net, sock, proto); |
796 | break; | 796 | break; |
@@ -838,4 +838,3 @@ misdn_sock_cleanup(void) | |||
838 | { | 838 | { |
839 | sock_unregister(PF_ISDN); | 839 | sock_unregister(PF_ISDN); |
840 | } | 840 | } |
841 | |||
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index a5b632e67552..1a0ae4445ff2 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c | |||
@@ -29,7 +29,7 @@ _queue_message(struct mISDNstack *st, struct sk_buff *skb) | |||
29 | 29 | ||
30 | if (*debug & DEBUG_QUEUE_FUNC) | 30 | if (*debug & DEBUG_QUEUE_FUNC) |
31 | printk(KERN_DEBUG "%s prim(%x) id(%x) %p\n", | 31 | printk(KERN_DEBUG "%s prim(%x) id(%x) %p\n", |
32 | __func__, hh->prim, hh->id, skb); | 32 | __func__, hh->prim, hh->id, skb); |
33 | skb_queue_tail(&st->msgq, skb); | 33 | skb_queue_tail(&st->msgq, skb); |
34 | if (likely(!test_bit(mISDN_STACK_STOPPED, &st->status))) { | 34 | if (likely(!test_bit(mISDN_STACK_STOPPED, &st->status))) { |
35 | test_and_set_bit(mISDN_STACK_WORK, &st->status); | 35 | test_and_set_bit(mISDN_STACK_WORK, &st->status); |
@@ -109,15 +109,15 @@ send_layer2(struct mISDNstack *st, struct sk_buff *skb) | |||
109 | if (ret) { | 109 | if (ret) { |
110 | if (*debug & DEBUG_SEND_ERR) | 110 | if (*debug & DEBUG_SEND_ERR) |
111 | printk(KERN_DEBUG | 111 | printk(KERN_DEBUG |
112 | "%s ch%d prim(%x) addr(%x)" | 112 | "%s ch%d prim(%x) addr(%x)" |
113 | " err %d\n", | 113 | " err %d\n", |
114 | __func__, ch->nr, | 114 | __func__, ch->nr, |
115 | hh->prim, ch->addr, ret); | 115 | hh->prim, ch->addr, ret); |
116 | dev_kfree_skb(cskb); | 116 | dev_kfree_skb(cskb); |
117 | } | 117 | } |
118 | } else { | 118 | } else { |
119 | printk(KERN_WARNING "%s ch%d addr %x no mem\n", | 119 | printk(KERN_WARNING "%s ch%d addr %x no mem\n", |
120 | __func__, ch->nr, ch->addr); | 120 | __func__, ch->nr, ch->addr); |
121 | goto out; | 121 | goto out; |
122 | } | 122 | } |
123 | } | 123 | } |
@@ -135,8 +135,8 @@ send_layer2(struct mISDNstack *st, struct sk_buff *skb) | |||
135 | skb = NULL; | 135 | skb = NULL; |
136 | else if (*debug & DEBUG_SEND_ERR) | 136 | else if (*debug & DEBUG_SEND_ERR) |
137 | printk(KERN_DEBUG | 137 | printk(KERN_DEBUG |
138 | "%s ch%d mgr prim(%x) addr(%x) err %d\n", | 138 | "%s ch%d mgr prim(%x) addr(%x) err %d\n", |
139 | __func__, ch->nr, hh->prim, ch->addr, ret); | 139 | __func__, ch->nr, hh->prim, ch->addr, ret); |
140 | } | 140 | } |
141 | out: | 141 | out: |
142 | mutex_unlock(&st->lmutex); | 142 | mutex_unlock(&st->lmutex); |
@@ -154,7 +154,7 @@ send_msg_to_layer(struct mISDNstack *st, struct sk_buff *skb) | |||
154 | lm = hh->prim & MISDN_LAYERMASK; | 154 | lm = hh->prim & MISDN_LAYERMASK; |
155 | if (*debug & DEBUG_QUEUE_FUNC) | 155 | if (*debug & DEBUG_QUEUE_FUNC) |
156 | printk(KERN_DEBUG "%s prim(%x) id(%x) %p\n", | 156 | printk(KERN_DEBUG "%s prim(%x) id(%x) %p\n", |
157 | __func__, hh->prim, hh->id, skb); | 157 | __func__, hh->prim, hh->id, skb); |
158 | if (lm == 0x1) { | 158 | if (lm == 0x1) { |
159 | if (!hlist_empty(&st->l1sock.head)) { | 159 | if (!hlist_empty(&st->l1sock.head)) { |
160 | __net_timestamp(skb); | 160 | __net_timestamp(skb); |
@@ -172,9 +172,9 @@ send_msg_to_layer(struct mISDNstack *st, struct sk_buff *skb) | |||
172 | return ch->send(ch, skb); | 172 | return ch->send(ch, skb); |
173 | else | 173 | else |
174 | printk(KERN_WARNING | 174 | printk(KERN_WARNING |
175 | "%s: dev(%s) prim(%x) id(%x) no channel\n", | 175 | "%s: dev(%s) prim(%x) id(%x) no channel\n", |
176 | __func__, dev_name(&st->dev->dev), hh->prim, | 176 | __func__, dev_name(&st->dev->dev), hh->prim, |
177 | hh->id); | 177 | hh->id); |
178 | } else if (lm == 0x8) { | 178 | } else if (lm == 0x8) { |
179 | WARN_ON(lm == 0x8); | 179 | WARN_ON(lm == 0x8); |
180 | ch = get_channel4id(st, hh->id); | 180 | ch = get_channel4id(st, hh->id); |
@@ -182,13 +182,13 @@ send_msg_to_layer(struct mISDNstack *st, struct sk_buff *skb) | |||
182 | return ch->send(ch, skb); | 182 | return ch->send(ch, skb); |
183 | else | 183 | else |
184 | printk(KERN_WARNING | 184 | printk(KERN_WARNING |
185 | "%s: dev(%s) prim(%x) id(%x) no channel\n", | 185 | "%s: dev(%s) prim(%x) id(%x) no channel\n", |
186 | __func__, dev_name(&st->dev->dev), hh->prim, | 186 | __func__, dev_name(&st->dev->dev), hh->prim, |
187 | hh->id); | 187 | hh->id); |
188 | } else { | 188 | } else { |
189 | /* broadcast not handled yet */ | 189 | /* broadcast not handled yet */ |
190 | printk(KERN_WARNING "%s: dev(%s) prim %x not delivered\n", | 190 | printk(KERN_WARNING "%s: dev(%s) prim %x not delivered\n", |
191 | __func__, dev_name(&st->dev->dev), hh->prim); | 191 | __func__, dev_name(&st->dev->dev), hh->prim); |
192 | } | 192 | } |
193 | return -ESRCH; | 193 | return -ESRCH; |
194 | } | 194 | } |
@@ -207,7 +207,7 @@ mISDNStackd(void *data) | |||
207 | sigfillset(¤t->blocked); | 207 | sigfillset(¤t->blocked); |
208 | if (*debug & DEBUG_MSG_THREAD) | 208 | if (*debug & DEBUG_MSG_THREAD) |
209 | printk(KERN_DEBUG "mISDNStackd %s started\n", | 209 | printk(KERN_DEBUG "mISDNStackd %s started\n", |
210 | dev_name(&st->dev->dev)); | 210 | dev_name(&st->dev->dev)); |
211 | 211 | ||
212 | if (st->notify != NULL) { | 212 | if (st->notify != NULL) { |
213 | complete(st->notify); | 213 | complete(st->notify); |
@@ -226,13 +226,13 @@ mISDNStackd(void *data) | |||
226 | skb = skb_dequeue(&st->msgq); | 226 | skb = skb_dequeue(&st->msgq); |
227 | if (!skb) { | 227 | if (!skb) { |
228 | test_and_clear_bit(mISDN_STACK_WORK, | 228 | test_and_clear_bit(mISDN_STACK_WORK, |
229 | &st->status); | 229 | &st->status); |
230 | /* test if a race happens */ | 230 | /* test if a race happens */ |
231 | skb = skb_dequeue(&st->msgq); | 231 | skb = skb_dequeue(&st->msgq); |
232 | if (!skb) | 232 | if (!skb) |
233 | continue; | 233 | continue; |
234 | test_and_set_bit(mISDN_STACK_WORK, | 234 | test_and_set_bit(mISDN_STACK_WORK, |
235 | &st->status); | 235 | &st->status); |
236 | } | 236 | } |
237 | #ifdef MISDN_MSG_STATS | 237 | #ifdef MISDN_MSG_STATS |
238 | st->msg_cnt++; | 238 | st->msg_cnt++; |
@@ -241,20 +241,20 @@ mISDNStackd(void *data) | |||
241 | if (unlikely(err)) { | 241 | if (unlikely(err)) { |
242 | if (*debug & DEBUG_SEND_ERR) | 242 | if (*debug & DEBUG_SEND_ERR) |
243 | printk(KERN_DEBUG | 243 | printk(KERN_DEBUG |
244 | "%s: %s prim(%x) id(%x) " | 244 | "%s: %s prim(%x) id(%x) " |
245 | "send call(%d)\n", | 245 | "send call(%d)\n", |
246 | __func__, dev_name(&st->dev->dev), | 246 | __func__, dev_name(&st->dev->dev), |
247 | mISDN_HEAD_PRIM(skb), | 247 | mISDN_HEAD_PRIM(skb), |
248 | mISDN_HEAD_ID(skb), err); | 248 | mISDN_HEAD_ID(skb), err); |
249 | dev_kfree_skb(skb); | 249 | dev_kfree_skb(skb); |
250 | continue; | 250 | continue; |
251 | } | 251 | } |
252 | if (unlikely(test_bit(mISDN_STACK_STOPPED, | 252 | if (unlikely(test_bit(mISDN_STACK_STOPPED, |
253 | &st->status))) { | 253 | &st->status))) { |
254 | test_and_clear_bit(mISDN_STACK_WORK, | 254 | test_and_clear_bit(mISDN_STACK_WORK, |
255 | &st->status); | 255 | &st->status); |
256 | test_and_clear_bit(mISDN_STACK_RUNNING, | 256 | test_and_clear_bit(mISDN_STACK_RUNNING, |
257 | &st->status); | 257 | &st->status); |
258 | break; | 258 | break; |
259 | } | 259 | } |
260 | } | 260 | } |
@@ -270,7 +270,7 @@ mISDNStackd(void *data) | |||
270 | test_and_set_bit(mISDN_STACK_RUNNING, &st->status); | 270 | test_and_set_bit(mISDN_STACK_RUNNING, &st->status); |
271 | if (!skb_queue_empty(&st->msgq)) | 271 | if (!skb_queue_empty(&st->msgq)) |
272 | test_and_set_bit(mISDN_STACK_WORK, | 272 | test_and_set_bit(mISDN_STACK_WORK, |
273 | &st->status); | 273 | &st->status); |
274 | } | 274 | } |
275 | if (test_bit(mISDN_STACK_ABORT, &st->status)) | 275 | if (test_bit(mISDN_STACK_ABORT, &st->status)) |
276 | break; | 276 | break; |
@@ -283,10 +283,10 @@ mISDNStackd(void *data) | |||
283 | #endif | 283 | #endif |
284 | test_and_clear_bit(mISDN_STACK_ACTIVE, &st->status); | 284 | test_and_clear_bit(mISDN_STACK_ACTIVE, &st->status); |
285 | wait_event_interruptible(st->workq, (st->status & | 285 | wait_event_interruptible(st->workq, (st->status & |
286 | mISDN_STACK_ACTION_MASK)); | 286 | mISDN_STACK_ACTION_MASK)); |
287 | if (*debug & DEBUG_MSG_THREAD) | 287 | if (*debug & DEBUG_MSG_THREAD) |
288 | printk(KERN_DEBUG "%s: %s wake status %08lx\n", | 288 | printk(KERN_DEBUG "%s: %s wake status %08lx\n", |
289 | __func__, dev_name(&st->dev->dev), st->status); | 289 | __func__, dev_name(&st->dev->dev), st->status); |
290 | test_and_set_bit(mISDN_STACK_ACTIVE, &st->status); | 290 | test_and_set_bit(mISDN_STACK_ACTIVE, &st->status); |
291 | 291 | ||
292 | test_and_clear_bit(mISDN_STACK_WAKEUP, &st->status); | 292 | test_and_clear_bit(mISDN_STACK_WAKEUP, &st->status); |
@@ -300,17 +300,17 @@ mISDNStackd(void *data) | |||
300 | } | 300 | } |
301 | #ifdef MISDN_MSG_STATS | 301 | #ifdef MISDN_MSG_STATS |
302 | printk(KERN_DEBUG "mISDNStackd daemon for %s proceed %d " | 302 | printk(KERN_DEBUG "mISDNStackd daemon for %s proceed %d " |
303 | "msg %d sleep %d stopped\n", | 303 | "msg %d sleep %d stopped\n", |
304 | dev_name(&st->dev->dev), st->msg_cnt, st->sleep_cnt, | 304 | dev_name(&st->dev->dev), st->msg_cnt, st->sleep_cnt, |
305 | st->stopped_cnt); | 305 | st->stopped_cnt); |
306 | printk(KERN_DEBUG | 306 | printk(KERN_DEBUG |
307 | "mISDNStackd daemon for %s utime(%ld) stime(%ld)\n", | 307 | "mISDNStackd daemon for %s utime(%ld) stime(%ld)\n", |
308 | dev_name(&st->dev->dev), st->thread->utime, st->thread->stime); | 308 | dev_name(&st->dev->dev), st->thread->utime, st->thread->stime); |
309 | printk(KERN_DEBUG | 309 | printk(KERN_DEBUG |
310 | "mISDNStackd daemon for %s nvcsw(%ld) nivcsw(%ld)\n", | 310 | "mISDNStackd daemon for %s nvcsw(%ld) nivcsw(%ld)\n", |
311 | dev_name(&st->dev->dev), st->thread->nvcsw, st->thread->nivcsw); | 311 | dev_name(&st->dev->dev), st->thread->nvcsw, st->thread->nivcsw); |
312 | printk(KERN_DEBUG "mISDNStackd daemon for %s killed now\n", | 312 | printk(KERN_DEBUG "mISDNStackd daemon for %s killed now\n", |
313 | dev_name(&st->dev->dev)); | 313 | dev_name(&st->dev->dev)); |
314 | #endif | 314 | #endif |
315 | test_and_set_bit(mISDN_STACK_KILLED, &st->status); | 315 | test_and_set_bit(mISDN_STACK_KILLED, &st->status); |
316 | test_and_clear_bit(mISDN_STACK_RUNNING, &st->status); | 316 | test_and_clear_bit(mISDN_STACK_RUNNING, &st->status); |
@@ -401,15 +401,15 @@ create_stack(struct mISDNdevice *dev) | |||
401 | newst->own.recv = mISDN_queue_message; | 401 | newst->own.recv = mISDN_queue_message; |
402 | if (*debug & DEBUG_CORE_FUNC) | 402 | if (*debug & DEBUG_CORE_FUNC) |
403 | printk(KERN_DEBUG "%s: st(%s)\n", __func__, | 403 | printk(KERN_DEBUG "%s: st(%s)\n", __func__, |
404 | dev_name(&newst->dev->dev)); | 404 | dev_name(&newst->dev->dev)); |
405 | newst->notify = &done; | 405 | newst->notify = &done; |
406 | newst->thread = kthread_run(mISDNStackd, (void *)newst, "mISDN_%s", | 406 | newst->thread = kthread_run(mISDNStackd, (void *)newst, "mISDN_%s", |
407 | dev_name(&newst->dev->dev)); | 407 | dev_name(&newst->dev->dev)); |
408 | if (IS_ERR(newst->thread)) { | 408 | if (IS_ERR(newst->thread)) { |
409 | err = PTR_ERR(newst->thread); | 409 | err = PTR_ERR(newst->thread); |
410 | printk(KERN_ERR | 410 | printk(KERN_ERR |
411 | "mISDN:cannot create kernel thread for %s (%d)\n", | 411 | "mISDN:cannot create kernel thread for %s (%d)\n", |
412 | dev_name(&newst->dev->dev), err); | 412 | dev_name(&newst->dev->dev), err); |
413 | delete_teimanager(dev->teimgr); | 413 | delete_teimanager(dev->teimgr); |
414 | kfree(newst); | 414 | kfree(newst); |
415 | } else | 415 | } else |
@@ -419,7 +419,7 @@ create_stack(struct mISDNdevice *dev) | |||
419 | 419 | ||
420 | int | 420 | int |
421 | connect_layer1(struct mISDNdevice *dev, struct mISDNchannel *ch, | 421 | connect_layer1(struct mISDNdevice *dev, struct mISDNchannel *ch, |
422 | u_int protocol, struct sockaddr_mISDN *adr) | 422 | u_int protocol, struct sockaddr_mISDN *adr) |
423 | { | 423 | { |
424 | struct mISDN_sock *msk = container_of(ch, struct mISDN_sock, ch); | 424 | struct mISDN_sock *msk = container_of(ch, struct mISDN_sock, ch); |
425 | struct channel_req rq; | 425 | struct channel_req rq; |
@@ -428,8 +428,8 @@ connect_layer1(struct mISDNdevice *dev, struct mISDNchannel *ch, | |||
428 | 428 | ||
429 | if (*debug & DEBUG_CORE_FUNC) | 429 | if (*debug & DEBUG_CORE_FUNC) |
430 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", | 430 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", |
431 | __func__, dev_name(&dev->dev), protocol, adr->dev, | 431 | __func__, dev_name(&dev->dev), protocol, adr->dev, |
432 | adr->channel, adr->sapi, adr->tei); | 432 | adr->channel, adr->sapi, adr->tei); |
433 | switch (protocol) { | 433 | switch (protocol) { |
434 | case ISDN_P_NT_S0: | 434 | case ISDN_P_NT_S0: |
435 | case ISDN_P_NT_E1: | 435 | case ISDN_P_NT_E1: |
@@ -442,7 +442,7 @@ connect_layer1(struct mISDNdevice *dev, struct mISDNchannel *ch, | |||
442 | rq.adr.channel = adr->channel; | 442 | rq.adr.channel = adr->channel; |
443 | err = dev->D.ctrl(&dev->D, OPEN_CHANNEL, &rq); | 443 | err = dev->D.ctrl(&dev->D, OPEN_CHANNEL, &rq); |
444 | printk(KERN_DEBUG "%s: ret %d (dev %d)\n", __func__, err, | 444 | printk(KERN_DEBUG "%s: ret %d (dev %d)\n", __func__, err, |
445 | dev->id); | 445 | dev->id); |
446 | if (err) | 446 | if (err) |
447 | return err; | 447 | return err; |
448 | write_lock_bh(&dev->D.st->l1sock.lock); | 448 | write_lock_bh(&dev->D.st->l1sock.lock); |
@@ -457,7 +457,7 @@ connect_layer1(struct mISDNdevice *dev, struct mISDNchannel *ch, | |||
457 | 457 | ||
458 | int | 458 | int |
459 | connect_Bstack(struct mISDNdevice *dev, struct mISDNchannel *ch, | 459 | connect_Bstack(struct mISDNdevice *dev, struct mISDNchannel *ch, |
460 | u_int protocol, struct sockaddr_mISDN *adr) | 460 | u_int protocol, struct sockaddr_mISDN *adr) |
461 | { | 461 | { |
462 | struct channel_req rq, rq2; | 462 | struct channel_req rq, rq2; |
463 | int pmask, err; | 463 | int pmask, err; |
@@ -465,9 +465,9 @@ connect_Bstack(struct mISDNdevice *dev, struct mISDNchannel *ch, | |||
465 | 465 | ||
466 | if (*debug & DEBUG_CORE_FUNC) | 466 | if (*debug & DEBUG_CORE_FUNC) |
467 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", | 467 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", |
468 | __func__, dev_name(&dev->dev), protocol, | 468 | __func__, dev_name(&dev->dev), protocol, |
469 | adr->dev, adr->channel, adr->sapi, | 469 | adr->dev, adr->channel, adr->sapi, |
470 | adr->tei); | 470 | adr->tei); |
471 | ch->st = dev->D.st; | 471 | ch->st = dev->D.st; |
472 | pmask = 1 << (protocol & ISDN_P_B_MASK); | 472 | pmask = 1 << (protocol & ISDN_P_B_MASK); |
473 | if (pmask & dev->Bprotocols) { | 473 | if (pmask & dev->Bprotocols) { |
@@ -514,16 +514,16 @@ connect_Bstack(struct mISDNdevice *dev, struct mISDNchannel *ch, | |||
514 | 514 | ||
515 | int | 515 | int |
516 | create_l2entity(struct mISDNdevice *dev, struct mISDNchannel *ch, | 516 | create_l2entity(struct mISDNdevice *dev, struct mISDNchannel *ch, |
517 | u_int protocol, struct sockaddr_mISDN *adr) | 517 | u_int protocol, struct sockaddr_mISDN *adr) |
518 | { | 518 | { |
519 | struct channel_req rq; | 519 | struct channel_req rq; |
520 | int err; | 520 | int err; |
521 | 521 | ||
522 | if (*debug & DEBUG_CORE_FUNC) | 522 | if (*debug & DEBUG_CORE_FUNC) |
523 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", | 523 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", |
524 | __func__, dev_name(&dev->dev), protocol, | 524 | __func__, dev_name(&dev->dev), protocol, |
525 | adr->dev, adr->channel, adr->sapi, | 525 | adr->dev, adr->channel, adr->sapi, |
526 | adr->tei); | 526 | adr->tei); |
527 | rq.protocol = ISDN_P_TE_S0; | 527 | rq.protocol = ISDN_P_TE_S0; |
528 | if (dev->Dprotocols & (1 << ISDN_P_TE_E1)) | 528 | if (dev->Dprotocols & (1 << ISDN_P_TE_E1)) |
529 | rq.protocol = ISDN_P_TE_E1; | 529 | rq.protocol = ISDN_P_TE_E1; |
@@ -573,7 +573,7 @@ delete_channel(struct mISDNchannel *ch) | |||
573 | } | 573 | } |
574 | if (*debug & DEBUG_CORE_FUNC) | 574 | if (*debug & DEBUG_CORE_FUNC) |
575 | printk(KERN_DEBUG "%s: st(%s) protocol(%x)\n", __func__, | 575 | printk(KERN_DEBUG "%s: st(%s) protocol(%x)\n", __func__, |
576 | dev_name(&ch->st->dev->dev), ch->protocol); | 576 | dev_name(&ch->st->dev->dev), ch->protocol); |
577 | if (ch->protocol >= ISDN_P_B_START) { | 577 | if (ch->protocol >= ISDN_P_B_START) { |
578 | if (ch->peer) { | 578 | if (ch->peer) { |
579 | ch->peer->ctrl(ch->peer, CLOSE_CHANNEL, NULL); | 579 | ch->peer->ctrl(ch->peer, CLOSE_CHANNEL, NULL); |
@@ -602,7 +602,7 @@ delete_channel(struct mISDNchannel *ch) | |||
602 | pch->ctrl(pch, CLOSE_CHANNEL, NULL); | 602 | pch->ctrl(pch, CLOSE_CHANNEL, NULL); |
603 | } else | 603 | } else |
604 | printk(KERN_WARNING "%s: no l2 channel\n", | 604 | printk(KERN_WARNING "%s: no l2 channel\n", |
605 | __func__); | 605 | __func__); |
606 | break; | 606 | break; |
607 | case ISDN_P_LAPD_NT: | 607 | case ISDN_P_LAPD_NT: |
608 | pch = ch->st->dev->teimgr; | 608 | pch = ch->st->dev->teimgr; |
@@ -610,7 +610,7 @@ delete_channel(struct mISDNchannel *ch) | |||
610 | pch->ctrl(pch, CLOSE_CHANNEL, NULL); | 610 | pch->ctrl(pch, CLOSE_CHANNEL, NULL); |
611 | } else | 611 | } else |
612 | printk(KERN_WARNING "%s: no l2 channel\n", | 612 | printk(KERN_WARNING "%s: no l2 channel\n", |
613 | __func__); | 613 | __func__); |
614 | break; | 614 | break; |
615 | default: | 615 | default: |
616 | break; | 616 | break; |
@@ -626,14 +626,14 @@ delete_stack(struct mISDNdevice *dev) | |||
626 | 626 | ||
627 | if (*debug & DEBUG_CORE_FUNC) | 627 | if (*debug & DEBUG_CORE_FUNC) |
628 | printk(KERN_DEBUG "%s: st(%s)\n", __func__, | 628 | printk(KERN_DEBUG "%s: st(%s)\n", __func__, |
629 | dev_name(&st->dev->dev)); | 629 | dev_name(&st->dev->dev)); |
630 | if (dev->teimgr) | 630 | if (dev->teimgr) |
631 | delete_teimanager(dev->teimgr); | 631 | delete_teimanager(dev->teimgr); |
632 | if (st->thread) { | 632 | if (st->thread) { |
633 | if (st->notify) { | 633 | if (st->notify) { |
634 | printk(KERN_WARNING "%s: notifier in use\n", | 634 | printk(KERN_WARNING "%s: notifier in use\n", |
635 | __func__); | 635 | __func__); |
636 | complete(st->notify); | 636 | complete(st->notify); |
637 | } | 637 | } |
638 | st->notify = &done; | 638 | st->notify = &done; |
639 | test_and_set_bit(mISDN_STACK_ABORT, &st->status); | 639 | test_and_set_bit(mISDN_STACK_ABORT, &st->status); |
@@ -643,10 +643,10 @@ delete_stack(struct mISDNdevice *dev) | |||
643 | } | 643 | } |
644 | if (!list_empty(&st->layer2)) | 644 | if (!list_empty(&st->layer2)) |
645 | printk(KERN_WARNING "%s: layer2 list not empty\n", | 645 | printk(KERN_WARNING "%s: layer2 list not empty\n", |
646 | __func__); | 646 | __func__); |
647 | if (!hlist_empty(&st->l1sock.head)) | 647 | if (!hlist_empty(&st->l1sock.head)) |
648 | printk(KERN_WARNING "%s: layer1 list not empty\n", | 648 | printk(KERN_WARNING "%s: layer1 list not empty\n", |
649 | __func__); | 649 | __func__); |
650 | kfree(st); | 650 | kfree(st); |
651 | } | 651 | } |
652 | 652 | ||
diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c index 687c9b6264ab..ba2bc0c776e2 100644 --- a/drivers/isdn/mISDN/tei.c +++ b/drivers/isdn/mISDN/tei.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | #define DATIMER_VAL 10000 | 35 | #define DATIMER_VAL 10000 |
36 | 36 | ||
37 | static u_int *debug; | 37 | static u_int *debug; |
38 | 38 | ||
39 | static struct Fsm deactfsm = {NULL, 0, 0, NULL, NULL}; | 39 | static struct Fsm deactfsm = {NULL, 0, 0, NULL, NULL}; |
40 | static struct Fsm teifsmu = {NULL, 0, 0, NULL, NULL}; | 40 | static struct Fsm teifsmu = {NULL, 0, 0, NULL, NULL}; |
@@ -45,7 +45,7 @@ enum { | |||
45 | ST_L1_DEACT_PENDING, | 45 | ST_L1_DEACT_PENDING, |
46 | ST_L1_ACTIV, | 46 | ST_L1_ACTIV, |
47 | }; | 47 | }; |
48 | #define DEACT_STATE_COUNT (ST_L1_ACTIV+1) | 48 | #define DEACT_STATE_COUNT (ST_L1_ACTIV + 1) |
49 | 49 | ||
50 | static char *strDeactState[] = | 50 | static char *strDeactState[] = |
51 | { | 51 | { |
@@ -63,7 +63,7 @@ enum { | |||
63 | EV_DATIMER, | 63 | EV_DATIMER, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | #define DEACT_EVENT_COUNT (EV_DATIMER+1) | 66 | #define DEACT_EVENT_COUNT (EV_DATIMER + 1) |
67 | 67 | ||
68 | static char *strDeactEvent[] = | 68 | static char *strDeactEvent[] = |
69 | { | 69 | { |
@@ -130,7 +130,7 @@ da_deactivate(struct FsmInst *fi, int event, void *arg) | |||
130 | /* All TEI are inactiv */ | 130 | /* All TEI are inactiv */ |
131 | if (!test_bit(OPTION_L1_HOLD, &mgr->options)) { | 131 | if (!test_bit(OPTION_L1_HOLD, &mgr->options)) { |
132 | mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER, | 132 | mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER, |
133 | NULL, 1); | 133 | NULL, 1); |
134 | mISDN_FsmChangeState(fi, ST_L1_DEACT_PENDING); | 134 | mISDN_FsmChangeState(fi, ST_L1_DEACT_PENDING); |
135 | } | 135 | } |
136 | } | 136 | } |
@@ -144,7 +144,7 @@ da_ui(struct FsmInst *fi, int event, void *arg) | |||
144 | if (!test_bit(OPTION_L1_HOLD, &mgr->options)) { | 144 | if (!test_bit(OPTION_L1_HOLD, &mgr->options)) { |
145 | mISDN_FsmDelTimer(&mgr->datimer, 2); | 145 | mISDN_FsmDelTimer(&mgr->datimer, 2); |
146 | mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER, | 146 | mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER, |
147 | NULL, 2); | 147 | NULL, 2); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
@@ -169,7 +169,7 @@ da_timer(struct FsmInst *fi, int event, void *arg) | |||
169 | /* All TEI are inactiv */ | 169 | /* All TEI are inactiv */ |
170 | mISDN_FsmChangeState(fi, ST_L1_DEACT); | 170 | mISDN_FsmChangeState(fi, ST_L1_DEACT); |
171 | _queue_data(&mgr->ch, PH_DEACTIVATE_REQ, MISDN_ID_ANY, 0, NULL, | 171 | _queue_data(&mgr->ch, PH_DEACTIVATE_REQ, MISDN_ID_ANY, 0, NULL, |
172 | GFP_ATOMIC); | 172 | GFP_ATOMIC); |
173 | } | 173 | } |
174 | 174 | ||
175 | static struct FsmNode DeactFnList[] = | 175 | static struct FsmNode DeactFnList[] = |
@@ -188,7 +188,7 @@ enum { | |||
188 | ST_TEI_IDVERIFY, | 188 | ST_TEI_IDVERIFY, |
189 | }; | 189 | }; |
190 | 190 | ||
191 | #define TEI_STATE_COUNT (ST_TEI_IDVERIFY+1) | 191 | #define TEI_STATE_COUNT (ST_TEI_IDVERIFY + 1) |
192 | 192 | ||
193 | static char *strTeiState[] = | 193 | static char *strTeiState[] = |
194 | { | 194 | { |
@@ -209,7 +209,7 @@ enum { | |||
209 | EV_TIMER, | 209 | EV_TIMER, |
210 | }; | 210 | }; |
211 | 211 | ||
212 | #define TEI_EVENT_COUNT (EV_TIMER+1) | 212 | #define TEI_EVENT_COUNT (EV_TIMER + 1) |
213 | 213 | ||
214 | static char *strTeiEvent[] = | 214 | static char *strTeiEvent[] = |
215 | { | 215 | { |
@@ -257,8 +257,8 @@ get_free_id(struct manager *mgr) | |||
257 | list_for_each_entry(l2, &mgr->layer2, list) { | 257 | list_for_each_entry(l2, &mgr->layer2, list) { |
258 | if (l2->ch.nr > 63) { | 258 | if (l2->ch.nr > 63) { |
259 | printk(KERN_WARNING | 259 | printk(KERN_WARNING |
260 | "%s: more as 63 layer2 for one device\n", | 260 | "%s: more as 63 layer2 for one device\n", |
261 | __func__); | 261 | __func__); |
262 | return -EBUSY; | 262 | return -EBUSY; |
263 | } | 263 | } |
264 | test_and_set_bit(l2->ch.nr, (u_long *)&ids); | 264 | test_and_set_bit(l2->ch.nr, (u_long *)&ids); |
@@ -267,7 +267,7 @@ get_free_id(struct manager *mgr) | |||
267 | if (!test_bit(i, (u_long *)&ids)) | 267 | if (!test_bit(i, (u_long *)&ids)) |
268 | return i; | 268 | return i; |
269 | printk(KERN_WARNING "%s: more as 63 layer2 for one device\n", | 269 | printk(KERN_WARNING "%s: more as 63 layer2 for one device\n", |
270 | __func__); | 270 | __func__); |
271 | return -EBUSY; | 271 | return -EBUSY; |
272 | } | 272 | } |
273 | 273 | ||
@@ -294,7 +294,7 @@ get_free_tei(struct manager *mgr) | |||
294 | if (!test_bit(i, (u_long *)&ids)) | 294 | if (!test_bit(i, (u_long *)&ids)) |
295 | return i + 64; | 295 | return i + 64; |
296 | printk(KERN_WARNING "%s: more as 63 dynamic tei for one device\n", | 296 | printk(KERN_WARNING "%s: more as 63 dynamic tei for one device\n", |
297 | __func__); | 297 | __func__); |
298 | return -1; | 298 | return -1; |
299 | } | 299 | } |
300 | 300 | ||
@@ -385,7 +385,7 @@ mgr_send_down(struct manager *mgr, struct sk_buff *skb) | |||
385 | skb_queue_tail(&mgr->sendq, skb); | 385 | skb_queue_tail(&mgr->sendq, skb); |
386 | if (!test_bit(MGR_PH_ACTIVE, &mgr->options)) { | 386 | if (!test_bit(MGR_PH_ACTIVE, &mgr->options)) { |
387 | _queue_data(&mgr->ch, PH_ACTIVATE_REQ, MISDN_ID_ANY, 0, | 387 | _queue_data(&mgr->ch, PH_ACTIVATE_REQ, MISDN_ID_ANY, 0, |
388 | NULL, GFP_KERNEL); | 388 | NULL, GFP_KERNEL); |
389 | } else { | 389 | } else { |
390 | do_send(mgr); | 390 | do_send(mgr); |
391 | } | 391 | } |
@@ -398,7 +398,7 @@ dl_unit_data(struct manager *mgr, struct sk_buff *skb) | |||
398 | return -EINVAL; | 398 | return -EINVAL; |
399 | if (!test_bit(MGR_PH_ACTIVE, &mgr->options)) | 399 | if (!test_bit(MGR_PH_ACTIVE, &mgr->options)) |
400 | _queue_data(&mgr->ch, PH_ACTIVATE_REQ, MISDN_ID_ANY, 0, | 400 | _queue_data(&mgr->ch, PH_ACTIVATE_REQ, MISDN_ID_ANY, 0, |
401 | NULL, GFP_KERNEL); | 401 | NULL, GFP_KERNEL); |
402 | skb_push(skb, 3); | 402 | skb_push(skb, 3); |
403 | skb->data[0] = 0x02; /* SAPI 0 C/R = 1 */ | 403 | skb->data[0] = 0x02; /* SAPI 0 C/R = 1 */ |
404 | skb->data[1] = 0xff; /* TEI 127 */ | 404 | skb->data[1] = 0xff; /* TEI 127 */ |
@@ -468,14 +468,14 @@ tei_id_request(struct FsmInst *fi, int event, void *arg) | |||
468 | 468 | ||
469 | if (tm->l2->tei != GROUP_TEI) { | 469 | if (tm->l2->tei != GROUP_TEI) { |
470 | tm->tei_m.printdebug(&tm->tei_m, | 470 | tm->tei_m.printdebug(&tm->tei_m, |
471 | "assign request for already assigned tei %d", | 471 | "assign request for already assigned tei %d", |
472 | tm->l2->tei); | 472 | tm->l2->tei); |
473 | return; | 473 | return; |
474 | } | 474 | } |
475 | tm->ri = random_ri(); | 475 | tm->ri = random_ri(); |
476 | if (*debug & DEBUG_L2_TEI) | 476 | if (*debug & DEBUG_L2_TEI) |
477 | tm->tei_m.printdebug(&tm->tei_m, | 477 | tm->tei_m.printdebug(&tm->tei_m, |
478 | "assign request ri %d", tm->ri); | 478 | "assign request ri %d", tm->ri); |
479 | put_tei_msg(tm->mgr, ID_REQUEST, tm->ri, GROUP_TEI); | 479 | put_tei_msg(tm->mgr, ID_REQUEST, tm->ri, GROUP_TEI); |
480 | mISDN_FsmChangeState(fi, ST_TEI_IDREQ); | 480 | mISDN_FsmChangeState(fi, ST_TEI_IDREQ); |
481 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 1); | 481 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 1); |
@@ -496,12 +496,12 @@ tei_id_assign(struct FsmInst *fi, int event, void *arg) | |||
496 | tei = *dp >> 1; | 496 | tei = *dp >> 1; |
497 | if (*debug & DEBUG_L2_TEI) | 497 | if (*debug & DEBUG_L2_TEI) |
498 | tm->tei_m.printdebug(fi, "identity assign ri %d tei %d", | 498 | tm->tei_m.printdebug(fi, "identity assign ri %d tei %d", |
499 | ri, tei); | 499 | ri, tei); |
500 | l2 = findtei(tm->mgr, tei); | 500 | l2 = findtei(tm->mgr, tei); |
501 | if (l2) { /* same tei is in use */ | 501 | if (l2) { /* same tei is in use */ |
502 | if (ri != l2->tm->ri) { | 502 | if (ri != l2->tm->ri) { |
503 | tm->tei_m.printdebug(fi, | 503 | tm->tei_m.printdebug(fi, |
504 | "possible duplicate assignment tei %d", tei); | 504 | "possible duplicate assignment tei %d", tei); |
505 | tei_l2(l2, MDL_ERROR_RSP, 0); | 505 | tei_l2(l2, MDL_ERROR_RSP, 0); |
506 | } | 506 | } |
507 | } else if (ri == tm->ri) { | 507 | } else if (ri == tm->ri) { |
@@ -525,12 +525,12 @@ tei_id_test_dup(struct FsmInst *fi, int event, void *arg) | |||
525 | tei = *dp >> 1; | 525 | tei = *dp >> 1; |
526 | if (*debug & DEBUG_L2_TEI) | 526 | if (*debug & DEBUG_L2_TEI) |
527 | tm->tei_m.printdebug(fi, "foreign identity assign ri %d tei %d", | 527 | tm->tei_m.printdebug(fi, "foreign identity assign ri %d tei %d", |
528 | ri, tei); | 528 | ri, tei); |
529 | l2 = findtei(tm->mgr, tei); | 529 | l2 = findtei(tm->mgr, tei); |
530 | if (l2) { /* same tei is in use */ | 530 | if (l2) { /* same tei is in use */ |
531 | if (ri != l2->tm->ri) { /* and it wasn't our request */ | 531 | if (ri != l2->tm->ri) { /* and it wasn't our request */ |
532 | tm->tei_m.printdebug(fi, | 532 | tm->tei_m.printdebug(fi, |
533 | "possible duplicate assignment tei %d", tei); | 533 | "possible duplicate assignment tei %d", tei); |
534 | mISDN_FsmEvent(&l2->tm->tei_m, EV_VERIFY, NULL); | 534 | mISDN_FsmEvent(&l2->tm->tei_m, EV_VERIFY, NULL); |
535 | } | 535 | } |
536 | } | 536 | } |
@@ -549,7 +549,7 @@ tei_id_denied(struct FsmInst *fi, int event, void *arg) | |||
549 | tei = *dp >> 1; | 549 | tei = *dp >> 1; |
550 | if (*debug & DEBUG_L2_TEI) | 550 | if (*debug & DEBUG_L2_TEI) |
551 | tm->tei_m.printdebug(fi, "identity denied ri %d tei %d", | 551 | tm->tei_m.printdebug(fi, "identity denied ri %d tei %d", |
552 | ri, tei); | 552 | ri, tei); |
553 | } | 553 | } |
554 | 554 | ||
555 | static void | 555 | static void |
@@ -559,11 +559,11 @@ tei_id_chk_req(struct FsmInst *fi, int event, void *arg) | |||
559 | u_char *dp = arg; | 559 | u_char *dp = arg; |
560 | int tei; | 560 | int tei; |
561 | 561 | ||
562 | tei = *(dp+3) >> 1; | 562 | tei = *(dp + 3) >> 1; |
563 | if (*debug & DEBUG_L2_TEI) | 563 | if (*debug & DEBUG_L2_TEI) |
564 | tm->tei_m.printdebug(fi, "identity check req tei %d", tei); | 564 | tm->tei_m.printdebug(fi, "identity check req tei %d", tei); |
565 | if ((tm->l2->tei != GROUP_TEI) && ((tei == GROUP_TEI) || | 565 | if ((tm->l2->tei != GROUP_TEI) && ((tei == GROUP_TEI) || |
566 | (tei == tm->l2->tei))) { | 566 | (tei == tm->l2->tei))) { |
567 | mISDN_FsmDelTimer(&tm->timer, 4); | 567 | mISDN_FsmDelTimer(&tm->timer, 4); |
568 | mISDN_FsmChangeState(&tm->tei_m, ST_TEI_NOP); | 568 | mISDN_FsmChangeState(&tm->tei_m, ST_TEI_NOP); |
569 | put_tei_msg(tm->mgr, ID_CHK_RES, random_ri(), tm->l2->tei); | 569 | put_tei_msg(tm->mgr, ID_CHK_RES, random_ri(), tm->l2->tei); |
@@ -577,7 +577,7 @@ tei_id_remove(struct FsmInst *fi, int event, void *arg) | |||
577 | u_char *dp = arg; | 577 | u_char *dp = arg; |
578 | int tei; | 578 | int tei; |
579 | 579 | ||
580 | tei = *(dp+3) >> 1; | 580 | tei = *(dp + 3) >> 1; |
581 | if (*debug & DEBUG_L2_TEI) | 581 | if (*debug & DEBUG_L2_TEI) |
582 | tm->tei_m.printdebug(fi, "identity remove tei %d", tei); | 582 | tm->tei_m.printdebug(fi, "identity remove tei %d", tei); |
583 | if ((tm->l2->tei != GROUP_TEI) && | 583 | if ((tm->l2->tei != GROUP_TEI) && |
@@ -595,7 +595,7 @@ tei_id_verify(struct FsmInst *fi, int event, void *arg) | |||
595 | 595 | ||
596 | if (*debug & DEBUG_L2_TEI) | 596 | if (*debug & DEBUG_L2_TEI) |
597 | tm->tei_m.printdebug(fi, "id verify request for tei %d", | 597 | tm->tei_m.printdebug(fi, "id verify request for tei %d", |
598 | tm->l2->tei); | 598 | tm->l2->tei); |
599 | put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei); | 599 | put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei); |
600 | mISDN_FsmChangeState(&tm->tei_m, ST_TEI_IDVERIFY); | 600 | mISDN_FsmChangeState(&tm->tei_m, ST_TEI_IDVERIFY); |
601 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 2); | 601 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 2); |
@@ -611,7 +611,7 @@ tei_id_req_tout(struct FsmInst *fi, int event, void *arg) | |||
611 | tm->ri = random_ri(); | 611 | tm->ri = random_ri(); |
612 | if (*debug & DEBUG_L2_TEI) | 612 | if (*debug & DEBUG_L2_TEI) |
613 | tm->tei_m.printdebug(fi, "assign req(%d) ri %d", | 613 | tm->tei_m.printdebug(fi, "assign req(%d) ri %d", |
614 | 4 - tm->nval, tm->ri); | 614 | 4 - tm->nval, tm->ri); |
615 | put_tei_msg(tm->mgr, ID_REQUEST, tm->ri, GROUP_TEI); | 615 | put_tei_msg(tm->mgr, ID_REQUEST, tm->ri, GROUP_TEI); |
616 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 3); | 616 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 3); |
617 | } else { | 617 | } else { |
@@ -629,13 +629,13 @@ tei_id_ver_tout(struct FsmInst *fi, int event, void *arg) | |||
629 | if (--tm->nval) { | 629 | if (--tm->nval) { |
630 | if (*debug & DEBUG_L2_TEI) | 630 | if (*debug & DEBUG_L2_TEI) |
631 | tm->tei_m.printdebug(fi, | 631 | tm->tei_m.printdebug(fi, |
632 | "id verify req(%d) for tei %d", | 632 | "id verify req(%d) for tei %d", |
633 | 3 - tm->nval, tm->l2->tei); | 633 | 3 - tm->nval, tm->l2->tei); |
634 | put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei); | 634 | put_tei_msg(tm->mgr, ID_VERIFY, 0, tm->l2->tei); |
635 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 4); | 635 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 4); |
636 | } else { | 636 | } else { |
637 | tm->tei_m.printdebug(fi, "verify req for tei %d failed", | 637 | tm->tei_m.printdebug(fi, "verify req for tei %d failed", |
638 | tm->l2->tei); | 638 | tm->l2->tei); |
639 | tei_l2(tm->l2, MDL_REMOVE_REQ, 0); | 639 | tei_l2(tm->l2, MDL_REMOVE_REQ, 0); |
640 | mISDN_FsmChangeState(fi, ST_TEI_NOP); | 640 | mISDN_FsmChangeState(fi, ST_TEI_NOP); |
641 | } | 641 | } |
@@ -673,14 +673,14 @@ tei_assign_req(struct FsmInst *fi, int event, void *arg) | |||
673 | 673 | ||
674 | if (tm->l2->tei == GROUP_TEI) { | 674 | if (tm->l2->tei == GROUP_TEI) { |
675 | tm->tei_m.printdebug(&tm->tei_m, | 675 | tm->tei_m.printdebug(&tm->tei_m, |
676 | "net tei assign request without tei"); | 676 | "net tei assign request without tei"); |
677 | return; | 677 | return; |
678 | } | 678 | } |
679 | tm->ri = ((unsigned int) *dp++ << 8); | 679 | tm->ri = ((unsigned int) *dp++ << 8); |
680 | tm->ri += *dp++; | 680 | tm->ri += *dp++; |
681 | if (*debug & DEBUG_L2_TEI) | 681 | if (*debug & DEBUG_L2_TEI) |
682 | tm->tei_m.printdebug(&tm->tei_m, | 682 | tm->tei_m.printdebug(&tm->tei_m, |
683 | "net assign request ri %d teim %d", tm->ri, *dp); | 683 | "net assign request ri %d teim %d", tm->ri, *dp); |
684 | put_tei_msg(tm->mgr, ID_ASSIGNED, tm->ri, tm->l2->tei); | 684 | put_tei_msg(tm->mgr, ID_ASSIGNED, tm->ri, tm->l2->tei); |
685 | mISDN_FsmChangeState(fi, ST_TEI_NOP); | 685 | mISDN_FsmChangeState(fi, ST_TEI_NOP); |
686 | } | 686 | } |
@@ -692,7 +692,7 @@ tei_id_chk_req_net(struct FsmInst *fi, int event, void *arg) | |||
692 | 692 | ||
693 | if (*debug & DEBUG_L2_TEI) | 693 | if (*debug & DEBUG_L2_TEI) |
694 | tm->tei_m.printdebug(fi, "id check request for tei %d", | 694 | tm->tei_m.printdebug(fi, "id check request for tei %d", |
695 | tm->l2->tei); | 695 | tm->l2->tei); |
696 | tm->rcnt = 0; | 696 | tm->rcnt = 0; |
697 | put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei); | 697 | put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei); |
698 | mISDN_FsmChangeState(&tm->tei_m, ST_TEI_IDVERIFY); | 698 | mISDN_FsmChangeState(&tm->tei_m, ST_TEI_IDVERIFY); |
@@ -724,7 +724,7 @@ tei_id_verify_net(struct FsmInst *fi, int event, void *arg) | |||
724 | tei = dp[3] >> 1; | 724 | tei = dp[3] >> 1; |
725 | if (*debug & DEBUG_L2_TEI) | 725 | if (*debug & DEBUG_L2_TEI) |
726 | tm->tei_m.printdebug(fi, "identity verify req tei %d/%d", | 726 | tm->tei_m.printdebug(fi, "identity verify req tei %d/%d", |
727 | tei, tm->l2->tei); | 727 | tei, tm->l2->tei); |
728 | if (tei == tm->l2->tei) | 728 | if (tei == tm->l2->tei) |
729 | tei_id_chk_req_net(fi, event, arg); | 729 | tei_id_chk_req_net(fi, event, arg); |
730 | } | 730 | } |
@@ -737,7 +737,7 @@ tei_id_ver_tout_net(struct FsmInst *fi, int event, void *arg) | |||
737 | if (tm->rcnt == 1) { | 737 | if (tm->rcnt == 1) { |
738 | if (*debug & DEBUG_L2_TEI) | 738 | if (*debug & DEBUG_L2_TEI) |
739 | tm->tei_m.printdebug(fi, | 739 | tm->tei_m.printdebug(fi, |
740 | "check req for tei %d successful\n", tm->l2->tei); | 740 | "check req for tei %d successful\n", tm->l2->tei); |
741 | mISDN_FsmChangeState(fi, ST_TEI_NOP); | 741 | mISDN_FsmChangeState(fi, ST_TEI_NOP); |
742 | } else if (tm->rcnt > 1) { | 742 | } else if (tm->rcnt > 1) { |
743 | /* duplicate assignment; remove */ | 743 | /* duplicate assignment; remove */ |
@@ -745,13 +745,13 @@ tei_id_ver_tout_net(struct FsmInst *fi, int event, void *arg) | |||
745 | } else if (--tm->nval) { | 745 | } else if (--tm->nval) { |
746 | if (*debug & DEBUG_L2_TEI) | 746 | if (*debug & DEBUG_L2_TEI) |
747 | tm->tei_m.printdebug(fi, | 747 | tm->tei_m.printdebug(fi, |
748 | "id check req(%d) for tei %d", | 748 | "id check req(%d) for tei %d", |
749 | 3 - tm->nval, tm->l2->tei); | 749 | 3 - tm->nval, tm->l2->tei); |
750 | put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei); | 750 | put_tei_msg(tm->mgr, ID_CHK_REQ, 0, tm->l2->tei); |
751 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 4); | 751 | mISDN_FsmAddTimer(&tm->timer, tm->tval, EV_TIMER, NULL, 4); |
752 | } else { | 752 | } else { |
753 | tm->tei_m.printdebug(fi, "check req for tei %d failed", | 753 | tm->tei_m.printdebug(fi, "check req for tei %d failed", |
754 | tm->l2->tei); | 754 | tm->l2->tei); |
755 | mISDN_FsmChangeState(fi, ST_TEI_NOP); | 755 | mISDN_FsmChangeState(fi, ST_TEI_NOP); |
756 | tei_l2remove(tm->l2); | 756 | tei_l2remove(tm->l2); |
757 | } | 757 | } |
@@ -800,7 +800,7 @@ create_new_tei(struct manager *mgr, int tei, int sapi) | |||
800 | if ((tei >= 0) && (tei < 64)) | 800 | if ((tei >= 0) && (tei < 64)) |
801 | test_and_set_bit(OPTION_L2_FIXEDTEI, &opt); | 801 | test_and_set_bit(OPTION_L2_FIXEDTEI, &opt); |
802 | if (mgr->ch.st->dev->Dprotocols | 802 | if (mgr->ch.st->dev->Dprotocols |
803 | & ((1 << ISDN_P_TE_E1) | (1 << ISDN_P_NT_E1))) | 803 | & ((1 << ISDN_P_TE_E1) | (1 << ISDN_P_NT_E1))) |
804 | test_and_set_bit(OPTION_L2_PMX, &opt); | 804 | test_and_set_bit(OPTION_L2_PMX, &opt); |
805 | l2 = create_l2(mgr->up, ISDN_P_LAPD_NT, opt, tei, sapi); | 805 | l2 = create_l2(mgr->up, ISDN_P_LAPD_NT, opt, tei, sapi); |
806 | if (!l2) { | 806 | if (!l2) { |
@@ -880,7 +880,7 @@ ph_data_ind(struct manager *mgr, struct sk_buff *skb) | |||
880 | if (skb->len < 8) { | 880 | if (skb->len < 8) { |
881 | if (*debug & DEBUG_L2_TEI) | 881 | if (*debug & DEBUG_L2_TEI) |
882 | printk(KERN_DEBUG "%s: short mgr frame %d/8\n", | 882 | printk(KERN_DEBUG "%s: short mgr frame %d/8\n", |
883 | __func__, skb->len); | 883 | __func__, skb->len); |
884 | goto done; | 884 | goto done; |
885 | } | 885 | } |
886 | 886 | ||
@@ -979,15 +979,15 @@ static int | |||
979 | create_teimgr(struct manager *mgr, struct channel_req *crq) | 979 | create_teimgr(struct manager *mgr, struct channel_req *crq) |
980 | { | 980 | { |
981 | struct layer2 *l2; | 981 | struct layer2 *l2; |
982 | u_long opt = 0; | 982 | u_long opt = 0; |
983 | u_long flags; | 983 | u_long flags; |
984 | int id; | 984 | int id; |
985 | 985 | ||
986 | if (*debug & DEBUG_L2_TEI) | 986 | if (*debug & DEBUG_L2_TEI) |
987 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", | 987 | printk(KERN_DEBUG "%s: %s proto(%x) adr(%d %d %d %d)\n", |
988 | __func__, dev_name(&mgr->ch.st->dev->dev), | 988 | __func__, dev_name(&mgr->ch.st->dev->dev), |
989 | crq->protocol, crq->adr.dev, crq->adr.channel, | 989 | crq->protocol, crq->adr.dev, crq->adr.channel, |
990 | crq->adr.sapi, crq->adr.tei); | 990 | crq->adr.sapi, crq->adr.tei); |
991 | if (crq->adr.tei > GROUP_TEI) | 991 | if (crq->adr.tei > GROUP_TEI) |
992 | return -EINVAL; | 992 | return -EINVAL; |
993 | if (crq->adr.tei < 64) | 993 | if (crq->adr.tei < 64) |
@@ -1001,8 +1001,8 @@ create_teimgr(struct manager *mgr, struct channel_req *crq) | |||
1001 | return -EINVAL; | 1001 | return -EINVAL; |
1002 | if (mgr->up) { | 1002 | if (mgr->up) { |
1003 | printk(KERN_WARNING | 1003 | printk(KERN_WARNING |
1004 | "%s: only one network manager is allowed\n", | 1004 | "%s: only one network manager is allowed\n", |
1005 | __func__); | 1005 | __func__); |
1006 | return -EBUSY; | 1006 | return -EBUSY; |
1007 | } | 1007 | } |
1008 | } else if (test_bit(MGR_OPT_USER, &mgr->options)) { | 1008 | } else if (test_bit(MGR_OPT_USER, &mgr->options)) { |
@@ -1017,7 +1017,7 @@ create_teimgr(struct manager *mgr, struct channel_req *crq) | |||
1017 | test_and_set_bit(MGR_OPT_USER, &mgr->options); | 1017 | test_and_set_bit(MGR_OPT_USER, &mgr->options); |
1018 | } | 1018 | } |
1019 | if (mgr->ch.st->dev->Dprotocols | 1019 | if (mgr->ch.st->dev->Dprotocols |
1020 | & ((1 << ISDN_P_TE_E1) | (1 << ISDN_P_NT_E1))) | 1020 | & ((1 << ISDN_P_TE_E1) | (1 << ISDN_P_NT_E1))) |
1021 | test_and_set_bit(OPTION_L2_PMX, &opt); | 1021 | test_and_set_bit(OPTION_L2_PMX, &opt); |
1022 | if ((crq->protocol == ISDN_P_LAPD_NT) && (crq->adr.tei == 127)) { | 1022 | if ((crq->protocol == ISDN_P_LAPD_NT) && (crq->adr.tei == 127)) { |
1023 | mgr->up = crq->ch; | 1023 | mgr->up = crq->ch; |
@@ -1035,7 +1035,7 @@ create_teimgr(struct manager *mgr, struct channel_req *crq) | |||
1035 | return 0; | 1035 | return 0; |
1036 | } | 1036 | } |
1037 | l2 = create_l2(crq->ch, crq->protocol, opt, | 1037 | l2 = create_l2(crq->ch, crq->protocol, opt, |
1038 | crq->adr.tei, crq->adr.sapi); | 1038 | crq->adr.tei, crq->adr.sapi); |
1039 | if (!l2) | 1039 | if (!l2) |
1040 | return -ENOMEM; | 1040 | return -ENOMEM; |
1041 | l2->tm = kzalloc(sizeof(struct teimgr), GFP_KERNEL); | 1041 | l2->tm = kzalloc(sizeof(struct teimgr), GFP_KERNEL); |
@@ -1084,7 +1084,7 @@ mgr_send(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1084 | mgr = container_of(ch, struct manager, ch); | 1084 | mgr = container_of(ch, struct manager, ch); |
1085 | if (*debug & DEBUG_L2_RECV) | 1085 | if (*debug & DEBUG_L2_RECV) |
1086 | printk(KERN_DEBUG "%s: prim(%x) id(%x)\n", | 1086 | printk(KERN_DEBUG "%s: prim(%x) id(%x)\n", |
1087 | __func__, hh->prim, hh->id); | 1087 | __func__, hh->prim, hh->id); |
1088 | switch (hh->prim) { | 1088 | switch (hh->prim) { |
1089 | case PH_DATA_IND: | 1089 | case PH_DATA_IND: |
1090 | mISDN_FsmEvent(&mgr->deact, EV_UI, NULL); | 1090 | mISDN_FsmEvent(&mgr->deact, EV_UI, NULL); |
@@ -1181,7 +1181,7 @@ check_data(struct manager *mgr, struct sk_buff *skb) | |||
1181 | 1181 | ||
1182 | if (*debug & DEBUG_L2_CTRL) | 1182 | if (*debug & DEBUG_L2_CTRL) |
1183 | printk(KERN_DEBUG "%s: prim(%x) id(%x)\n", | 1183 | printk(KERN_DEBUG "%s: prim(%x) id(%x)\n", |
1184 | __func__, hh->prim, hh->id); | 1184 | __func__, hh->prim, hh->id); |
1185 | if (test_bit(MGR_OPT_USER, &mgr->options)) | 1185 | if (test_bit(MGR_OPT_USER, &mgr->options)) |
1186 | return -ENOTCONN; | 1186 | return -ENOTCONN; |
1187 | if (hh->prim != PH_DATA_IND) | 1187 | if (hh->prim != PH_DATA_IND) |
@@ -1201,12 +1201,12 @@ check_data(struct manager *mgr, struct sk_buff *skb) | |||
1201 | /* We got a SABME for a fixed TEI */ | 1201 | /* We got a SABME for a fixed TEI */ |
1202 | if (*debug & DEBUG_L2_CTRL) | 1202 | if (*debug & DEBUG_L2_CTRL) |
1203 | printk(KERN_DEBUG "%s: SABME sapi(%d) tei(%d)\n", | 1203 | printk(KERN_DEBUG "%s: SABME sapi(%d) tei(%d)\n", |
1204 | __func__, sapi, tei); | 1204 | __func__, sapi, tei); |
1205 | l2 = create_new_tei(mgr, tei, sapi); | 1205 | l2 = create_new_tei(mgr, tei, sapi); |
1206 | if (!l2) { | 1206 | if (!l2) { |
1207 | if (*debug & DEBUG_L2_CTRL) | 1207 | if (*debug & DEBUG_L2_CTRL) |
1208 | printk(KERN_DEBUG "%s: failed to create new tei\n", | 1208 | printk(KERN_DEBUG "%s: failed to create new tei\n", |
1209 | __func__); | 1209 | __func__); |
1210 | return -ENOMEM; | 1210 | return -ENOMEM; |
1211 | } | 1211 | } |
1212 | ret = l2->ch.send(&l2->ch, skb); | 1212 | ret = l2->ch.send(&l2->ch, skb); |
@@ -1285,15 +1285,15 @@ mgr_bcast(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1285 | if (ret) { | 1285 | if (ret) { |
1286 | if (*debug & DEBUG_SEND_ERR) | 1286 | if (*debug & DEBUG_SEND_ERR) |
1287 | printk(KERN_DEBUG | 1287 | printk(KERN_DEBUG |
1288 | "%s ch%d prim(%x) addr(%x)" | 1288 | "%s ch%d prim(%x) addr(%x)" |
1289 | " err %d\n", | 1289 | " err %d\n", |
1290 | __func__, l2->ch.nr, | 1290 | __func__, l2->ch.nr, |
1291 | hh->prim, l2->ch.addr, ret); | 1291 | hh->prim, l2->ch.addr, ret); |
1292 | } else | 1292 | } else |
1293 | cskb = NULL; | 1293 | cskb = NULL; |
1294 | } else { | 1294 | } else { |
1295 | printk(KERN_WARNING "%s ch%d addr %x no mem\n", | 1295 | printk(KERN_WARNING "%s ch%d addr %x no mem\n", |
1296 | __func__, ch->nr, ch->addr); | 1296 | __func__, ch->nr, ch->addr); |
1297 | goto out; | 1297 | goto out; |
1298 | } | 1298 | } |
1299 | } | 1299 | } |
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c index 859c81e9483b..1094667d8f31 100644 --- a/drivers/isdn/mISDN/timerdev.c +++ b/drivers/isdn/mISDN/timerdev.c | |||
@@ -98,13 +98,13 @@ mISDN_read(struct file *filep, char __user *buf, size_t count, loff_t *off) | |||
98 | 98 | ||
99 | if (*debug & DEBUG_TIMER) | 99 | if (*debug & DEBUG_TIMER) |
100 | printk(KERN_DEBUG "%s(%p, %p, %d, %p)\n", __func__, | 100 | printk(KERN_DEBUG "%s(%p, %p, %d, %p)\n", __func__, |
101 | filep, buf, (int)count, off); | 101 | filep, buf, (int)count, off); |
102 | 102 | ||
103 | if (list_empty(&dev->expired) && (dev->work == 0)) { | 103 | if (list_empty(&dev->expired) && (dev->work == 0)) { |
104 | if (filep->f_flags & O_NONBLOCK) | 104 | if (filep->f_flags & O_NONBLOCK) |
105 | return -EAGAIN; | 105 | return -EAGAIN; |
106 | wait_event_interruptible(dev->wait, (dev->work || | 106 | wait_event_interruptible(dev->wait, (dev->work || |
107 | !list_empty(&dev->expired))); | 107 | !list_empty(&dev->expired))); |
108 | if (signal_pending(current)) | 108 | if (signal_pending(current)) |
109 | return -ERESTARTSYS; | 109 | return -ERESTARTSYS; |
110 | } | 110 | } |
@@ -141,7 +141,7 @@ mISDN_poll(struct file *filep, poll_table *wait) | |||
141 | mask |= (POLLIN | POLLRDNORM); | 141 | mask |= (POLLIN | POLLRDNORM); |
142 | if (*debug & DEBUG_TIMER) | 142 | if (*debug & DEBUG_TIMER) |
143 | printk(KERN_DEBUG "%s work(%d) empty(%d)\n", __func__, | 143 | printk(KERN_DEBUG "%s work(%d) empty(%d)\n", __func__, |
144 | dev->work, list_empty(&dev->expired)); | 144 | dev->work, list_empty(&dev->expired)); |
145 | } | 145 | } |
146 | return mask; | 146 | return mask; |
147 | } | 147 | } |
@@ -161,7 +161,7 @@ dev_expire_timer(unsigned long data) | |||
161 | static int | 161 | static int |
162 | misdn_add_timer(struct mISDNtimerdev *dev, int timeout) | 162 | misdn_add_timer(struct mISDNtimerdev *dev, int timeout) |
163 | { | 163 | { |
164 | int id; | 164 | int id; |
165 | u_long flags; | 165 | u_long flags; |
166 | struct mISDNtimer *timer; | 166 | struct mISDNtimer *timer; |
167 | 167 | ||
@@ -224,7 +224,7 @@ mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | |||
224 | 224 | ||
225 | if (*debug & DEBUG_TIMER) | 225 | if (*debug & DEBUG_TIMER) |
226 | printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__, | 226 | printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__, |
227 | filep, cmd, arg); | 227 | filep, cmd, arg); |
228 | mutex_lock(&mISDN_mutex); | 228 | mutex_lock(&mISDN_mutex); |
229 | switch (cmd) { | 229 | switch (cmd) { |
230 | case IMADDTIMER: | 230 | case IMADDTIMER: |
@@ -235,7 +235,7 @@ mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | |||
235 | id = misdn_add_timer(dev, tout); | 235 | id = misdn_add_timer(dev, tout); |
236 | if (*debug & DEBUG_TIMER) | 236 | if (*debug & DEBUG_TIMER) |
237 | printk(KERN_DEBUG "%s add %d id %d\n", __func__, | 237 | printk(KERN_DEBUG "%s add %d id %d\n", __func__, |
238 | tout, id); | 238 | tout, id); |
239 | if (id < 0) { | 239 | if (id < 0) { |
240 | ret = id; | 240 | ret = id; |
241 | break; | 241 | break; |