aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/ircomm/ircomm_tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/ircomm/ircomm_tty.c')
-rw-r--r--net/irda/ircomm/ircomm_tty.c288
1 files changed, 144 insertions, 144 deletions
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 262bda808d96..3d241e415a2a 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_tty.c 3 * Filename: ircomm_tty.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: IrCOMM serial TTY driver 5 * Description: IrCOMM serial TTY driver
@@ -9,25 +9,25 @@
9 * Modified at: Wed Feb 23 00:09:02 2000 9 * Modified at: Wed Feb 23 00:09:02 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Sources: serial.c and previous IrCOMM work by Takahide Higuchi 11 * Sources: serial.c and previous IrCOMM work by Takahide Higuchi
12 * 12 *
13 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. 13 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * This program is distributed in the hope that it will be useful, 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 * 25 *
26 * You should have received a copy of the GNU General Public License 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software 27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA 29 * MA 02111-1307 USA
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <linux/init.h> 33#include <linux/init.h>
@@ -69,7 +69,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
69 struct sk_buff *skb); 69 struct sk_buff *skb);
70static int ircomm_tty_control_indication(void *instance, void *sap, 70static int ircomm_tty_control_indication(void *instance, void *sap,
71 struct sk_buff *skb); 71 struct sk_buff *skb);
72static void ircomm_tty_flow_indication(void *instance, void *sap, 72static void ircomm_tty_flow_indication(void *instance, void *sap,
73 LOCAL_FLOW cmd); 73 LOCAL_FLOW cmd);
74#ifdef CONFIG_PROC_FS 74#ifdef CONFIG_PROC_FS
75static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, 75static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
@@ -113,7 +113,7 @@ static int __init ircomm_tty_init(void)
113 driver = alloc_tty_driver(IRCOMM_TTY_PORTS); 113 driver = alloc_tty_driver(IRCOMM_TTY_PORTS);
114 if (!driver) 114 if (!driver)
115 return -ENOMEM; 115 return -ENOMEM;
116 ircomm_tty = hashbin_new(HB_LOCK); 116 ircomm_tty = hashbin_new(HB_LOCK);
117 if (ircomm_tty == NULL) { 117 if (ircomm_tty == NULL) {
118 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); 118 IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__);
119 put_tty_driver(driver); 119 put_tty_driver(driver);
@@ -163,11 +163,11 @@ static void __exit ircomm_tty_cleanup(void)
163{ 163{
164 int ret; 164 int ret;
165 165
166 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 166 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
167 167
168 ret = tty_unregister_driver(driver); 168 ret = tty_unregister_driver(driver);
169 if (ret) { 169 if (ret) {
170 IRDA_ERROR("%s(), failed to unregister driver\n", 170 IRDA_ERROR("%s(), failed to unregister driver\n",
171 __FUNCTION__); 171 __FUNCTION__);
172 return; 172 return;
173 } 173 }
@@ -179,7 +179,7 @@ static void __exit ircomm_tty_cleanup(void)
179/* 179/*
180 * Function ircomm_startup (self) 180 * Function ircomm_startup (self)
181 * 181 *
182 * 182 *
183 * 183 *
184 */ 184 */
185static int ircomm_tty_startup(struct ircomm_tty_cb *self) 185static int ircomm_tty_startup(struct ircomm_tty_cb *self)
@@ -203,17 +203,17 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self)
203 /* These callbacks we must handle ourselves */ 203 /* These callbacks we must handle ourselves */
204 notify.data_indication = ircomm_tty_data_indication; 204 notify.data_indication = ircomm_tty_data_indication;
205 notify.udata_indication = ircomm_tty_control_indication; 205 notify.udata_indication = ircomm_tty_control_indication;
206 notify.flow_indication = ircomm_tty_flow_indication; 206 notify.flow_indication = ircomm_tty_flow_indication;
207 207
208 /* Use the ircomm_tty interface for these ones */ 208 /* Use the ircomm_tty interface for these ones */
209 notify.disconnect_indication = ircomm_tty_disconnect_indication; 209 notify.disconnect_indication = ircomm_tty_disconnect_indication;
210 notify.connect_confirm = ircomm_tty_connect_confirm; 210 notify.connect_confirm = ircomm_tty_connect_confirm;
211 notify.connect_indication = ircomm_tty_connect_indication; 211 notify.connect_indication = ircomm_tty_connect_indication;
212 strlcpy(notify.name, "ircomm_tty", sizeof(notify.name)); 212 strlcpy(notify.name, "ircomm_tty", sizeof(notify.name));
213 notify.instance = self; 213 notify.instance = self;
214 214
215 if (!self->ircomm) { 215 if (!self->ircomm) {
216 self->ircomm = ircomm_open(&notify, self->service_type, 216 self->ircomm = ircomm_open(&notify, self->service_type,
217 self->line); 217 self->line);
218 } 218 }
219 if (!self->ircomm) 219 if (!self->ircomm)
@@ -237,10 +237,10 @@ err:
237/* 237/*
238 * Function ircomm_block_til_ready (self, filp) 238 * Function ircomm_block_til_ready (self, filp)
239 * 239 *
240 * 240 *
241 * 241 *
242 */ 242 */
243static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, 243static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
244 struct file *filp) 244 struct file *filp)
245{ 245{
246 DECLARE_WAITQUEUE(wait, current); 246 DECLARE_WAITQUEUE(wait, current);
@@ -248,7 +248,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
248 int do_clocal = 0, extra_count = 0; 248 int do_clocal = 0, extra_count = 0;
249 unsigned long flags; 249 unsigned long flags;
250 struct tty_struct *tty; 250 struct tty_struct *tty;
251 251
252 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 252 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
253 253
254 tty = self->tty; 254 tty = self->tty;
@@ -256,7 +256,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
256 /* 256 /*
257 * If non-blocking mode is set, or the port is not enabled, 257 * If non-blocking mode is set, or the port is not enabled,
258 * then make the check up front and then exit. 258 * then make the check up front and then exit.
259 */ 259 */
260 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ 260 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
261 /* nonblock mode is set or port is not enabled */ 261 /* nonblock mode is set or port is not enabled */
262 self->flags |= ASYNC_NORMAL_ACTIVE; 262 self->flags |= ASYNC_NORMAL_ACTIVE;
@@ -268,17 +268,17 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
268 IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ ); 268 IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ );
269 do_clocal = 1; 269 do_clocal = 1;
270 } 270 }
271 271
272 /* Wait for carrier detect and the line to become 272 /* Wait for carrier detect and the line to become
273 * free (i.e., not in use by the callout). While we are in 273 * free (i.e., not in use by the callout). While we are in
274 * this loop, self->open_count is dropped by one, so that 274 * this loop, self->open_count is dropped by one, so that
275 * mgsl_close() knows when to free things. We restore it upon 275 * mgsl_close() knows when to free things. We restore it upon
276 * exit, either normal or abnormal. 276 * exit, either normal or abnormal.
277 */ 277 */
278 278
279 retval = 0; 279 retval = 0;
280 add_wait_queue(&self->open_wait, &wait); 280 add_wait_queue(&self->open_wait, &wait);
281 281
282 IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", 282 IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n",
283 __FILE__,__LINE__, tty->driver->name, self->open_count ); 283 __FILE__,__LINE__, tty->driver->name, self->open_count );
284 284
@@ -290,7 +290,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
290 } 290 }
291 spin_unlock_irqrestore(&self->spinlock, flags); 291 spin_unlock_irqrestore(&self->spinlock, flags);
292 self->blocked_open++; 292 self->blocked_open++;
293 293
294 while (1) { 294 while (1) {
295 if (tty->termios->c_cflag & CBAUD) { 295 if (tty->termios->c_cflag & CBAUD) {
296 /* Here, we use to lock those two guys, but 296 /* Here, we use to lock those two guys, but
@@ -298,45 +298,45 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
298 * I don't see the point (and I see the deadlock). 298 * I don't see the point (and I see the deadlock).
299 * Jean II */ 299 * Jean II */
300 self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR; 300 self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR;
301 301
302 ircomm_param_request(self, IRCOMM_DTE, TRUE); 302 ircomm_param_request(self, IRCOMM_DTE, TRUE);
303 } 303 }
304 304
305 current->state = TASK_INTERRUPTIBLE; 305 current->state = TASK_INTERRUPTIBLE;
306 306
307 if (tty_hung_up_p(filp) || 307 if (tty_hung_up_p(filp) ||
308 !test_bit(ASYNC_B_INITIALIZED, &self->flags)) { 308 !test_bit(ASYNC_B_INITIALIZED, &self->flags)) {
309 retval = (self->flags & ASYNC_HUP_NOTIFY) ? 309 retval = (self->flags & ASYNC_HUP_NOTIFY) ?
310 -EAGAIN : -ERESTARTSYS; 310 -EAGAIN : -ERESTARTSYS;
311 break; 311 break;
312 } 312 }
313 313
314 /* 314 /*
315 * Check if link is ready now. Even if CLOCAL is 315 * Check if link is ready now. Even if CLOCAL is
316 * specified, we cannot return before the IrCOMM link is 316 * specified, we cannot return before the IrCOMM link is
317 * ready 317 * ready
318 */ 318 */
319 if (!test_bit(ASYNC_B_CLOSING, &self->flags) && 319 if (!test_bit(ASYNC_B_CLOSING, &self->flags) &&
320 (do_clocal || (self->settings.dce & IRCOMM_CD)) && 320 (do_clocal || (self->settings.dce & IRCOMM_CD)) &&
321 self->state == IRCOMM_TTY_READY) 321 self->state == IRCOMM_TTY_READY)
322 { 322 {
323 break; 323 break;
324 } 324 }
325 325
326 if (signal_pending(current)) { 326 if (signal_pending(current)) {
327 retval = -ERESTARTSYS; 327 retval = -ERESTARTSYS;
328 break; 328 break;
329 } 329 }
330 330
331 IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", 331 IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n",
332 __FILE__,__LINE__, tty->driver->name, self->open_count ); 332 __FILE__,__LINE__, tty->driver->name, self->open_count );
333 333
334 schedule(); 334 schedule();
335 } 335 }
336 336
337 __set_current_state(TASK_RUNNING); 337 __set_current_state(TASK_RUNNING);
338 remove_wait_queue(&self->open_wait, &wait); 338 remove_wait_queue(&self->open_wait, &wait);
339 339
340 if (extra_count) { 340 if (extra_count) {
341 /* ++ is not atomic, so this should be protected - Jean II */ 341 /* ++ is not atomic, so this should be protected - Jean II */
342 spin_lock_irqsave(&self->spinlock, flags); 342 spin_lock_irqsave(&self->spinlock, flags);
@@ -344,14 +344,14 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
344 spin_unlock_irqrestore(&self->spinlock, flags); 344 spin_unlock_irqrestore(&self->spinlock, flags);
345 } 345 }
346 self->blocked_open--; 346 self->blocked_open--;
347 347
348 IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", 348 IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n",
349 __FILE__,__LINE__, tty->driver->name, self->open_count); 349 __FILE__,__LINE__, tty->driver->name, self->open_count);
350 350
351 if (!retval) 351 if (!retval)
352 self->flags |= ASYNC_NORMAL_ACTIVE; 352 self->flags |= ASYNC_NORMAL_ACTIVE;
353 353
354 return retval; 354 return retval;
355} 355}
356 356
357/* 357/*
@@ -384,7 +384,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
384 IRDA_ERROR("%s(), kmalloc failed!\n", __FUNCTION__); 384 IRDA_ERROR("%s(), kmalloc failed!\n", __FUNCTION__);
385 return -ENOMEM; 385 return -ENOMEM;
386 } 386 }
387 387
388 self->magic = IRCOMM_TTY_MAGIC; 388 self->magic = IRCOMM_TTY_MAGIC;
389 self->flow = FLOW_STOP; 389 self->flow = FLOW_STOP;
390 390
@@ -398,13 +398,13 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
398 /* Init some important stuff */ 398 /* Init some important stuff */
399 init_timer(&self->watchdog_timer); 399 init_timer(&self->watchdog_timer);
400 init_waitqueue_head(&self->open_wait); 400 init_waitqueue_head(&self->open_wait);
401 init_waitqueue_head(&self->close_wait); 401 init_waitqueue_head(&self->close_wait);
402 spin_lock_init(&self->spinlock); 402 spin_lock_init(&self->spinlock);
403 403
404 /* 404 /*
405 * Force TTY into raw mode by default which is usually what 405 * Force TTY into raw mode by default which is usually what
406 * we want for IrCOMM and IrLPT. This way applications will 406 * we want for IrCOMM and IrLPT. This way applications will
407 * not have to twiddle with printcap etc. 407 * not have to twiddle with printcap etc.
408 */ 408 */
409 tty->termios->c_iflag = 0; 409 tty->termios->c_iflag = 0;
410 tty->termios->c_oflag = 0; 410 tty->termios->c_oflag = 0;
@@ -420,7 +420,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
420 self->tty = tty; 420 self->tty = tty;
421 spin_unlock_irqrestore(&self->spinlock, flags); 421 spin_unlock_irqrestore(&self->spinlock, flags);
422 422
423 IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name, 423 IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name,
424 self->line, self->open_count); 424 self->line, self->open_count);
425 425
426 /* Not really used by us, but lets do it anyway */ 426 /* Not really used by us, but lets do it anyway */
@@ -473,7 +473,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
473 473
474 ret = ircomm_tty_block_til_ready(self, filp); 474 ret = ircomm_tty_block_til_ready(self, filp);
475 if (ret) { 475 if (ret) {
476 IRDA_DEBUG(2, 476 IRDA_DEBUG(2,
477 "%s(), returning after block_til_ready with %d\n", __FUNCTION__ , 477 "%s(), returning after block_til_ready with %d\n", __FUNCTION__ ,
478 ret); 478 ret);
479 479
@@ -519,7 +519,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
519 * serial port won't be shutdown. 519 * serial port won't be shutdown.
520 */ 520 */
521 IRDA_DEBUG(0, "%s(), bad serial port count; " 521 IRDA_DEBUG(0, "%s(), bad serial port count; "
522 "tty->count is 1, state->count is %d\n", __FUNCTION__ , 522 "tty->count is 1, state->count is %d\n", __FUNCTION__ ,
523 self->open_count); 523 self->open_count);
524 self->open_count = 1; 524 self->open_count = 1;
525 } 525 }
@@ -546,7 +546,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
546 spin_unlock_irqrestore(&self->spinlock, flags); 546 spin_unlock_irqrestore(&self->spinlock, flags);
547 547
548 /* 548 /*
549 * Now we wait for the transmit buffer to clear; and we notify 549 * Now we wait for the transmit buffer to clear; and we notify
550 * the line discipline to only process XON/XOFF characters. 550 * the line discipline to only process XON/XOFF characters.
551 */ 551 */
552 tty->closing = 1; 552 tty->closing = 1;
@@ -576,7 +576,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
576/* 576/*
577 * Function ircomm_tty_flush_buffer (tty) 577 * Function ircomm_tty_flush_buffer (tty)
578 * 578 *
579 * 579 *
580 * 580 *
581 */ 581 */
582static void ircomm_tty_flush_buffer(struct tty_struct *tty) 582static void ircomm_tty_flush_buffer(struct tty_struct *tty)
@@ -586,9 +586,9 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty)
586 IRDA_ASSERT(self != NULL, return;); 586 IRDA_ASSERT(self != NULL, return;);
587 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); 587 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
588 588
589 /* 589 /*
590 * Let do_softint() do this to avoid race condition with 590 * Let do_softint() do this to avoid race condition with
591 * do_softint() ;-) 591 * do_softint() ;-)
592 */ 592 */
593 schedule_work(&self->tqueue); 593 schedule_work(&self->tqueue);
594} 594}
@@ -597,7 +597,7 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty)
597 * Function ircomm_tty_do_softint (work) 597 * Function ircomm_tty_do_softint (work)
598 * 598 *
599 * We use this routine to give the write wakeup to the user at at a 599 * We use this routine to give the write wakeup to the user at at a
600 * safe time (as fast as possible after write have completed). This 600 * safe time (as fast as possible after write have completed). This
601 * can be compared to the Tx interrupt. 601 * can be compared to the Tx interrupt.
602 */ 602 */
603static void ircomm_tty_do_softint(struct work_struct *work) 603static void ircomm_tty_do_softint(struct work_struct *work)
@@ -638,7 +638,7 @@ static void ircomm_tty_do_softint(struct work_struct *work)
638 638
639 /* Unlink transmit buffer */ 639 /* Unlink transmit buffer */
640 spin_lock_irqsave(&self->spinlock, flags); 640 spin_lock_irqsave(&self->spinlock, flags);
641 641
642 skb = self->tx_skb; 642 skb = self->tx_skb;
643 self->tx_skb = NULL; 643 self->tx_skb = NULL;
644 644
@@ -650,9 +650,9 @@ static void ircomm_tty_do_softint(struct work_struct *work)
650 /* Drop reference count - see ircomm_ttp_data_request(). */ 650 /* Drop reference count - see ircomm_ttp_data_request(). */
651 dev_kfree_skb(skb); 651 dev_kfree_skb(skb);
652 } 652 }
653 653
654 /* Check if user (still) wants to be waken up */ 654 /* Check if user (still) wants to be waken up */
655 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 655 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
656 tty->ldisc.write_wakeup) 656 tty->ldisc.write_wakeup)
657 { 657 {
658 (tty->ldisc.write_wakeup)(tty); 658 (tty->ldisc.write_wakeup)(tty);
@@ -717,12 +717,12 @@ static int ircomm_tty_write(struct tty_struct *tty,
717 /* Fetch current transmit buffer */ 717 /* Fetch current transmit buffer */
718 skb = self->tx_skb; 718 skb = self->tx_skb;
719 719
720 /* 720 /*
721 * Send out all the data we get, possibly as multiple fragmented 721 * Send out all the data we get, possibly as multiple fragmented
722 * frames, but this will only happen if the data is larger than the 722 * frames, but this will only happen if the data is larger than the
723 * max data size. The normal case however is just the opposite, and 723 * max data size. The normal case however is just the opposite, and
724 * this function may be called multiple times, and will then actually 724 * this function may be called multiple times, and will then actually
725 * defragment the data and send it out as one packet as soon as 725 * defragment the data and send it out as one packet as soon as
726 * possible, but at a safer point in time 726 * possible, but at a safer point in time
727 */ 727 */
728 while (count) { 728 while (count) {
@@ -731,16 +731,16 @@ static int ircomm_tty_write(struct tty_struct *tty,
731 /* Adjust data size to the max data size */ 731 /* Adjust data size to the max data size */
732 if (size > self->max_data_size) 732 if (size > self->max_data_size)
733 size = self->max_data_size; 733 size = self->max_data_size;
734 734
735 /* 735 /*
736 * Do we already have a buffer ready for transmit, or do 736 * Do we already have a buffer ready for transmit, or do
737 * we need to allocate a new frame 737 * we need to allocate a new frame
738 */ 738 */
739 if (skb) { 739 if (skb) {
740 /* 740 /*
741 * Any room for more data at the end of the current 741 * Any room for more data at the end of the current
742 * transmit buffer? Cannot use skb_tailroom, since 742 * transmit buffer? Cannot use skb_tailroom, since
743 * dev_alloc_skb gives us a larger skb than we 743 * dev_alloc_skb gives us a larger skb than we
744 * requested 744 * requested
745 * Note : use tx_data_size, because max_data_size 745 * Note : use tx_data_size, because max_data_size
746 * may have changed and we don't want to overwrite 746 * may have changed and we don't want to overwrite
@@ -751,8 +751,8 @@ static int ircomm_tty_write(struct tty_struct *tty,
751 if (size > tailroom) 751 if (size > tailroom)
752 size = tailroom; 752 size = tailroom;
753 } else { 753 } else {
754 /* 754 /*
755 * Current transmit frame is full, so break 755 * Current transmit frame is full, so break
756 * out, so we can send it as soon as possible 756 * out, so we can send it as soon as possible
757 */ 757 */
758 break; 758 break;
@@ -782,15 +782,15 @@ static int ircomm_tty_write(struct tty_struct *tty,
782 782
783 spin_unlock_irqrestore(&self->spinlock, flags); 783 spin_unlock_irqrestore(&self->spinlock, flags);
784 784
785 /* 785 /*
786 * Schedule a new thread which will transmit the frame as soon 786 * Schedule a new thread which will transmit the frame as soon
787 * as possible, but at a safe point in time. We do this so the 787 * as possible, but at a safe point in time. We do this so the
788 * "user" can give us data multiple times, as PPP does (because of 788 * "user" can give us data multiple times, as PPP does (because of
789 * its 256 byte tx buffer). We will then defragment and send out 789 * its 256 byte tx buffer). We will then defragment and send out
790 * all this data as one single packet. 790 * all this data as one single packet.
791 */ 791 */
792 schedule_work(&self->tqueue); 792 schedule_work(&self->tqueue);
793 793
794 return len; 794 return len;
795} 795}
796 796
@@ -846,7 +846,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
846 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; 846 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
847 unsigned long orig_jiffies, poll_time; 847 unsigned long orig_jiffies, poll_time;
848 unsigned long flags; 848 unsigned long flags;
849 849
850 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 850 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
851 851
852 IRDA_ASSERT(self != NULL, return;); 852 IRDA_ASSERT(self != NULL, return;);
@@ -876,7 +876,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
876 * 876 *
877 * This routine notifies the tty driver that input buffers for the line 877 * This routine notifies the tty driver that input buffers for the line
878 * discipline are close to full, and it should somehow signal that no 878 * discipline are close to full, and it should somehow signal that no
879 * more characters should be sent to the tty. 879 * more characters should be sent to the tty.
880 */ 880 */
881static void ircomm_tty_throttle(struct tty_struct *tty) 881static void ircomm_tty_throttle(struct tty_struct *tty)
882{ 882{
@@ -890,16 +890,16 @@ static void ircomm_tty_throttle(struct tty_struct *tty)
890 /* Software flow control? */ 890 /* Software flow control? */
891 if (I_IXOFF(tty)) 891 if (I_IXOFF(tty))
892 ircomm_tty_send_xchar(tty, STOP_CHAR(tty)); 892 ircomm_tty_send_xchar(tty, STOP_CHAR(tty));
893 893
894 /* Hardware flow control? */ 894 /* Hardware flow control? */
895 if (tty->termios->c_cflag & CRTSCTS) { 895 if (tty->termios->c_cflag & CRTSCTS) {
896 self->settings.dte &= ~IRCOMM_RTS; 896 self->settings.dte &= ~IRCOMM_RTS;
897 self->settings.dte |= IRCOMM_DELTA_RTS; 897 self->settings.dte |= IRCOMM_DELTA_RTS;
898 898
899 ircomm_param_request(self, IRCOMM_DTE, TRUE); 899 ircomm_param_request(self, IRCOMM_DTE, TRUE);
900 } 900 }
901 901
902 ircomm_flow_request(self->ircomm, FLOW_STOP); 902 ircomm_flow_request(self->ircomm, FLOW_STOP);
903} 903}
904 904
905/* 905/*
@@ -930,7 +930,7 @@ static void ircomm_tty_unthrottle(struct tty_struct *tty)
930 ircomm_param_request(self, IRCOMM_DTE, TRUE); 930 ircomm_param_request(self, IRCOMM_DTE, TRUE);
931 IRDA_DEBUG(1, "%s(), FLOW_START\n", __FUNCTION__ ); 931 IRDA_DEBUG(1, "%s(), FLOW_START\n", __FUNCTION__ );
932 } 932 }
933 ircomm_flow_request(self->ircomm, FLOW_START); 933 ircomm_flow_request(self->ircomm, FLOW_START);
934} 934}
935 935
936/* 936/*
@@ -975,7 +975,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self)
975 spin_lock_irqsave(&self->spinlock, flags); 975 spin_lock_irqsave(&self->spinlock, flags);
976 976
977 del_timer(&self->watchdog_timer); 977 del_timer(&self->watchdog_timer);
978 978
979 /* Free parameter buffer */ 979 /* Free parameter buffer */
980 if (self->ctrl_skb) { 980 if (self->ctrl_skb) {
981 dev_kfree_skb(self->ctrl_skb); 981 dev_kfree_skb(self->ctrl_skb);
@@ -1001,7 +1001,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self)
1001 * 1001 *
1002 * This routine notifies the tty driver that it should hangup the tty 1002 * This routine notifies the tty driver that it should hangup the tty
1003 * device. 1003 * device.
1004 * 1004 *
1005 */ 1005 */
1006static void ircomm_tty_hangup(struct tty_struct *tty) 1006static void ircomm_tty_hangup(struct tty_struct *tty)
1007{ 1007{
@@ -1044,7 +1044,7 @@ static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch)
1044 * Function ircomm_tty_start (tty) 1044 * Function ircomm_tty_start (tty)
1045 * 1045 *
1046 * This routine notifies the tty driver that it resume sending 1046 * This routine notifies the tty driver that it resume sending
1047 * characters to the tty device. 1047 * characters to the tty device.
1048 */ 1048 */
1049void ircomm_tty_start(struct tty_struct *tty) 1049void ircomm_tty_start(struct tty_struct *tty)
1050{ 1050{
@@ -1057,9 +1057,9 @@ void ircomm_tty_start(struct tty_struct *tty)
1057 * Function ircomm_tty_stop (tty) 1057 * Function ircomm_tty_stop (tty)
1058 * 1058 *
1059 * This routine notifies the tty driver that it should stop outputting 1059 * This routine notifies the tty driver that it should stop outputting
1060 * characters to the tty device. 1060 * characters to the tty device.
1061 */ 1061 */
1062static void ircomm_tty_stop(struct tty_struct *tty) 1062static void ircomm_tty_stop(struct tty_struct *tty)
1063{ 1063{
1064 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; 1064 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
1065 1065
@@ -1094,14 +1094,14 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
1094 /*wake_up_interruptible(&self->delta_msr_wait);*/ 1094 /*wake_up_interruptible(&self->delta_msr_wait);*/
1095 } 1095 }
1096 if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { 1096 if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) {
1097 IRDA_DEBUG(2, 1097 IRDA_DEBUG(2,
1098 "%s(), ircomm%d CD now %s...\n", __FUNCTION__ , self->line, 1098 "%s(), ircomm%d CD now %s...\n", __FUNCTION__ , self->line,
1099 (status & IRCOMM_CD) ? "on" : "off"); 1099 (status & IRCOMM_CD) ? "on" : "off");
1100 1100
1101 if (status & IRCOMM_CD) { 1101 if (status & IRCOMM_CD) {
1102 wake_up_interruptible(&self->open_wait); 1102 wake_up_interruptible(&self->open_wait);
1103 } else { 1103 } else {
1104 IRDA_DEBUG(2, 1104 IRDA_DEBUG(2,
1105 "%s(), Doing serial hangup..\n", __FUNCTION__ ); 1105 "%s(), Doing serial hangup..\n", __FUNCTION__ );
1106 if (tty) 1106 if (tty)
1107 tty_hangup(tty); 1107 tty_hangup(tty);
@@ -1113,10 +1113,10 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
1113 if (self->flags & ASYNC_CTS_FLOW) { 1113 if (self->flags & ASYNC_CTS_FLOW) {
1114 if (tty->hw_stopped) { 1114 if (tty->hw_stopped) {
1115 if (status & IRCOMM_CTS) { 1115 if (status & IRCOMM_CTS) {
1116 IRDA_DEBUG(2, 1116 IRDA_DEBUG(2,
1117 "%s(), CTS tx start...\n", __FUNCTION__ ); 1117 "%s(), CTS tx start...\n", __FUNCTION__ );
1118 tty->hw_stopped = 0; 1118 tty->hw_stopped = 0;
1119 1119
1120 /* Wake up processes blocked on open */ 1120 /* Wake up processes blocked on open */
1121 wake_up_interruptible(&self->open_wait); 1121 wake_up_interruptible(&self->open_wait);
1122 1122
@@ -1125,7 +1125,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
1125 } 1125 }
1126 } else { 1126 } else {
1127 if (!(status & IRCOMM_CTS)) { 1127 if (!(status & IRCOMM_CTS)) {
1128 IRDA_DEBUG(2, 1128 IRDA_DEBUG(2,
1129 "%s(), CTS tx stop...\n", __FUNCTION__ ); 1129 "%s(), CTS tx stop...\n", __FUNCTION__ );
1130 tty->hw_stopped = 1; 1130 tty->hw_stopped = 1;
1131 } 1131 }
@@ -1145,7 +1145,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1145 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 1145 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
1146 1146
1147 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 1147 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
1148 1148
1149 IRDA_ASSERT(self != NULL, return -1;); 1149 IRDA_ASSERT(self != NULL, return -1;);
1150 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 1150 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
1151 IRDA_ASSERT(skb != NULL, return -1;); 1151 IRDA_ASSERT(skb != NULL, return -1;);
@@ -1155,10 +1155,10 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1155 return 0; 1155 return 0;
1156 } 1156 }
1157 1157
1158 /* 1158 /*
1159 * If we receive data when hardware is stopped then something is wrong. 1159 * If we receive data when hardware is stopped then something is wrong.
1160 * We try to poll the peers line settings to check if we are up todate. 1160 * We try to poll the peers line settings to check if we are up todate.
1161 * Devices like WinCE can do this, and since they don't send any 1161 * Devices like WinCE can do this, and since they don't send any
1162 * params, we can just as well declare the hardware for running. 1162 * params, we can just as well declare the hardware for running.
1163 */ 1163 */
1164 if (self->tty->hw_stopped && (self->flow == FLOW_START)) { 1164 if (self->tty->hw_stopped && (self->flow == FLOW_START)) {
@@ -1170,9 +1170,9 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1170 ircomm_tty_link_established(self); 1170 ircomm_tty_link_established(self);
1171 } 1171 }
1172 1172
1173 /* 1173 /*
1174 * Just give it over to the line discipline. There is no need to 1174 * Just give it over to the line discipline. There is no need to
1175 * involve the flip buffers, since we are not running in an interrupt 1175 * involve the flip buffers, since we are not running in an interrupt
1176 * handler 1176 * handler
1177 */ 1177 */
1178 self->tty->ldisc.receive_buf(self->tty, skb->data, NULL, skb->len); 1178 self->tty->ldisc.receive_buf(self->tty, skb->data, NULL, skb->len);
@@ -1195,14 +1195,14 @@ static int ircomm_tty_control_indication(void *instance, void *sap,
1195 int clen; 1195 int clen;
1196 1196
1197 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 1197 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
1198 1198
1199 IRDA_ASSERT(self != NULL, return -1;); 1199 IRDA_ASSERT(self != NULL, return -1;);
1200 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 1200 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
1201 IRDA_ASSERT(skb != NULL, return -1;); 1201 IRDA_ASSERT(skb != NULL, return -1;);
1202 1202
1203 clen = skb->data[0]; 1203 clen = skb->data[0];
1204 1204
1205 irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen), 1205 irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen),
1206 &ircomm_param_info); 1206 &ircomm_param_info);
1207 1207
1208 /* No need to kfree_skb - see ircomm_control_indication() */ 1208 /* No need to kfree_skb - see ircomm_control_indication() */
@@ -1217,7 +1217,7 @@ static int ircomm_tty_control_indication(void *instance, void *sap,
1217 * transmission of data. We just mark the hardware as stopped, and wait 1217 * transmission of data. We just mark the hardware as stopped, and wait
1218 * for IrTTP to notify us that things are OK again. 1218 * for IrTTP to notify us that things are OK again.
1219 */ 1219 */
1220static void ircomm_tty_flow_indication(void *instance, void *sap, 1220static void ircomm_tty_flow_indication(void *instance, void *sap,
1221 LOCAL_FLOW cmd) 1221 LOCAL_FLOW cmd)
1222{ 1222{
1223 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 1223 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -1247,7 +1247,7 @@ static void ircomm_tty_flow_indication(void *instance, void *sap,
1247 1247
1248static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) 1248static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1249{ 1249{
1250 int ret=0; 1250 int ret=0;
1251 1251
1252 ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]); 1252 ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]);
1253 1253
@@ -1260,37 +1260,37 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1260 ret += sprintf(buf+ret, "3_WIRE_RAW"); 1260 ret += sprintf(buf+ret, "3_WIRE_RAW");
1261 else 1261 else
1262 ret += sprintf(buf+ret, "No common service type!\n"); 1262 ret += sprintf(buf+ret, "No common service type!\n");
1263 ret += sprintf(buf+ret, "\n"); 1263 ret += sprintf(buf+ret, "\n");
1264 1264
1265 ret += sprintf(buf+ret, "Port name: %s\n", self->settings.port_name); 1265 ret += sprintf(buf+ret, "Port name: %s\n", self->settings.port_name);
1266 1266
1267 ret += sprintf(buf+ret, "DTE status: "); 1267 ret += sprintf(buf+ret, "DTE status: ");
1268 if (self->settings.dte & IRCOMM_RTS) 1268 if (self->settings.dte & IRCOMM_RTS)
1269 ret += sprintf(buf+ret, "RTS|"); 1269 ret += sprintf(buf+ret, "RTS|");
1270 if (self->settings.dte & IRCOMM_DTR) 1270 if (self->settings.dte & IRCOMM_DTR)
1271 ret += sprintf(buf+ret, "DTR|"); 1271 ret += sprintf(buf+ret, "DTR|");
1272 if (self->settings.dte) 1272 if (self->settings.dte)
1273 ret--; /* remove the last | */ 1273 ret--; /* remove the last | */
1274 ret += sprintf(buf+ret, "\n"); 1274 ret += sprintf(buf+ret, "\n");
1275 1275
1276 ret += sprintf(buf+ret, "DCE status: "); 1276 ret += sprintf(buf+ret, "DCE status: ");
1277 if (self->settings.dce & IRCOMM_CTS) 1277 if (self->settings.dce & IRCOMM_CTS)
1278 ret += sprintf(buf+ret, "CTS|"); 1278 ret += sprintf(buf+ret, "CTS|");
1279 if (self->settings.dce & IRCOMM_DSR) 1279 if (self->settings.dce & IRCOMM_DSR)
1280 ret += sprintf(buf+ret, "DSR|"); 1280 ret += sprintf(buf+ret, "DSR|");
1281 if (self->settings.dce & IRCOMM_CD) 1281 if (self->settings.dce & IRCOMM_CD)
1282 ret += sprintf(buf+ret, "CD|"); 1282 ret += sprintf(buf+ret, "CD|");
1283 if (self->settings.dce & IRCOMM_RI) 1283 if (self->settings.dce & IRCOMM_RI)
1284 ret += sprintf(buf+ret, "RI|"); 1284 ret += sprintf(buf+ret, "RI|");
1285 if (self->settings.dce) 1285 if (self->settings.dce)
1286 ret--; /* remove the last | */ 1286 ret--; /* remove the last | */
1287 ret += sprintf(buf+ret, "\n"); 1287 ret += sprintf(buf+ret, "\n");
1288 1288
1289 ret += sprintf(buf+ret, "Configuration: "); 1289 ret += sprintf(buf+ret, "Configuration: ");
1290 if (!self->settings.null_modem) 1290 if (!self->settings.null_modem)
1291 ret += sprintf(buf+ret, "DTE <-> DCE\n"); 1291 ret += sprintf(buf+ret, "DTE <-> DCE\n");
1292 else 1292 else
1293 ret += sprintf(buf+ret, 1293 ret += sprintf(buf+ret,
1294 "DTE <-> DTE (null modem emulation)\n"); 1294 "DTE <-> DTE (null modem emulation)\n");
1295 1295
1296 ret += sprintf(buf+ret, "Data rate: %d\n", self->settings.data_rate); 1296 ret += sprintf(buf+ret, "Data rate: %d\n", self->settings.data_rate);
@@ -1314,7 +1314,7 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1314 ret += sprintf(buf+ret, "ENQ_ACK_OUT|"); 1314 ret += sprintf(buf+ret, "ENQ_ACK_OUT|");
1315 if (self->settings.flow_control) 1315 if (self->settings.flow_control)
1316 ret--; /* remove the last | */ 1316 ret--; /* remove the last | */
1317 ret += sprintf(buf+ret, "\n"); 1317 ret += sprintf(buf+ret, "\n");
1318 1318
1319 ret += sprintf(buf+ret, "Flags: "); 1319 ret += sprintf(buf+ret, "Flags: ");
1320 if (self->flags & ASYNC_CTS_FLOW) 1320 if (self->flags & ASYNC_CTS_FLOW)
@@ -1333,25 +1333,25 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
1333 ret--; /* remove the last | */ 1333 ret--; /* remove the last | */
1334 ret += sprintf(buf+ret, "\n"); 1334 ret += sprintf(buf+ret, "\n");
1335 1335
1336 ret += sprintf(buf+ret, "Role: %s\n", self->client ? 1336 ret += sprintf(buf+ret, "Role: %s\n", self->client ?
1337 "client" : "server"); 1337 "client" : "server");
1338 ret += sprintf(buf+ret, "Open count: %d\n", self->open_count); 1338 ret += sprintf(buf+ret, "Open count: %d\n", self->open_count);
1339 ret += sprintf(buf+ret, "Max data size: %d\n", self->max_data_size); 1339 ret += sprintf(buf+ret, "Max data size: %d\n", self->max_data_size);
1340 ret += sprintf(buf+ret, "Max header size: %d\n", self->max_header_size); 1340 ret += sprintf(buf+ret, "Max header size: %d\n", self->max_header_size);
1341 1341
1342 if (self->tty) 1342 if (self->tty)
1343 ret += sprintf(buf+ret, "Hardware: %s\n", 1343 ret += sprintf(buf+ret, "Hardware: %s\n",
1344 self->tty->hw_stopped ? "Stopped" : "Running"); 1344 self->tty->hw_stopped ? "Stopped" : "Running");
1345 1345
1346 ret += sprintf(buf+ret, "\n"); 1346 ret += sprintf(buf+ret, "\n");
1347 return ret; 1347 return ret;
1348} 1348}
1349 1349
1350 1350
1351/* 1351/*
1352 * Function ircomm_tty_read_proc (buf, start, offset, len, eof, unused) 1352 * Function ircomm_tty_read_proc (buf, start, offset, len, eof, unused)
1353 * 1353 *
1354 * 1354 *
1355 * 1355 *
1356 */ 1356 */
1357#ifdef CONFIG_PROC_FS 1357#ifdef CONFIG_PROC_FS
@@ -1359,8 +1359,8 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
1359 int *eof, void *unused) 1359 int *eof, void *unused)
1360{ 1360{
1361 struct ircomm_tty_cb *self; 1361 struct ircomm_tty_cb *self;
1362 int count = 0, l; 1362 int count = 0, l;
1363 off_t begin = 0; 1363 off_t begin = 0;
1364 unsigned long flags; 1364 unsigned long flags;
1365 1365
1366 spin_lock_irqsave(&ircomm_tty->hb_spinlock, flags); 1366 spin_lock_irqsave(&ircomm_tty->hb_spinlock, flags);
@@ -1370,25 +1370,25 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
1370 if (self->magic != IRCOMM_TTY_MAGIC) 1370 if (self->magic != IRCOMM_TTY_MAGIC)
1371 break; 1371 break;
1372 1372
1373 l = ircomm_tty_line_info(self, buf + count); 1373 l = ircomm_tty_line_info(self, buf + count);
1374 count += l; 1374 count += l;
1375 if (count+begin > offset+len) 1375 if (count+begin > offset+len)
1376 goto done; 1376 goto done;
1377 if (count+begin < offset) { 1377 if (count+begin < offset) {
1378 begin += count; 1378 begin += count;
1379 count = 0; 1379 count = 0;
1380 } 1380 }
1381 1381
1382 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty); 1382 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
1383 } 1383 }
1384 *eof = 1; 1384 *eof = 1;
1385done: 1385done:
1386 spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags); 1386 spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags);
1387 1387
1388 if (offset >= count+begin) 1388 if (offset >= count+begin)
1389 return 0; 1389 return 0;
1390 *start = buf + (offset-begin); 1390 *start = buf + (offset-begin);
1391 return ((len < begin+count-offset) ? len : begin+count-offset); 1391 return ((len < begin+count-offset) ? len : begin+count-offset);
1392} 1392}
1393#endif /* CONFIG_PROC_FS */ 1393#endif /* CONFIG_PROC_FS */
1394 1394