Blame view

net/irda/ircomm/ircomm_tty_ioctl.c 11.5 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*********************************************************************
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
2
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
   * Filename:      ircomm_tty_ioctl.c
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
4
5
   * Version:
   * Description:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
8
9
10
   * Status:        Experimental.
   * Author:        Dag Brattli <dagb@cs.uit.no>
   * Created at:    Thu Jun 10 14:39:09 1999
   * Modified at:   Wed Jan  5 14:45:43 2000
   * Modified by:   Dag Brattli <dagb@cs.uit.no>
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
11
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
12
   *     Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
13
14
15
16
   *
   *     This program is free software; you can redistribute it and/or
   *     modify it under the terms of the GNU General Public License as
   *     published by the Free Software Foundation; either version 2 of
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
   *     the License, or (at your option) any later version.
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
18
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
20
21
22
   *     This program is distributed in the hope that it will be useful,
   *     but WITHOUT ANY WARRANTY; without even the implied warranty of
   *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   *     GNU General Public License for more details.
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
23
24
25
26
   *
   *     You should have received a copy of the GNU General Public License
   *     along with this program; if not, write to the Free Software
   *     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
   *     MA 02111-1307 USA
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
28
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
30
31
32
   ********************************************************************/
  
  #include <linux/init.h>
  #include <linux/fs.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  #include <linux/termios.h>
  #include <linux/tty.h>
  #include <linux/serial.h>
  
  #include <asm/uaccess.h>
  
  #include <net/irda/irda.h>
  #include <net/irda/irmod.h>
  
  #include <net/irda/ircomm_core.h>
  #include <net/irda/ircomm_param.h>
  #include <net/irda/ircomm_tty_attach.h>
  #include <net/irda/ircomm_tty.h>
  
  #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
  
  /*
   * Function ircomm_tty_change_speed (driver)
   *
   *    Change speed of the driver. If the remote device is a DCE, then this
   *    should make it change the speed of its serial port
   */
  static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
  {
  	unsigned cflag, cval;
  	int baud;
0dc47877a   Harvey Harrison   net: replace rema...
59
60
  	IRDA_DEBUG(2, "%s()
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  
  	if (!self->tty || !self->tty->termios || !self->ircomm)
  		return;
  
  	cflag = self->tty->termios->c_cflag;
  
  	/*  byte size and parity */
  	switch (cflag & CSIZE) {
  	case CS5: cval = IRCOMM_WSIZE_5; break;
  	case CS6: cval = IRCOMM_WSIZE_6; break;
  	case CS7: cval = IRCOMM_WSIZE_7; break;
  	case CS8: cval = IRCOMM_WSIZE_8; break;
  	default:  cval = IRCOMM_WSIZE_5; break;
  	}
  	if (cflag & CSTOPB)
  		cval |= IRCOMM_2_STOP_BIT;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
77

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
80
81
82
83
84
85
86
87
88
89
  	if (cflag & PARENB)
  		cval |= IRCOMM_PARITY_ENABLE;
  	if (!(cflag & PARODD))
  		cval |= IRCOMM_PARITY_EVEN;
  
  	/* Determine divisor based on baud rate */
  	baud = tty_get_baud_rate(self->tty);
  	if (!baud)
  		baud = 9600;	/* B0 transition handled in rs_set_termios */
  
  	self->settings.data_rate = baud;
  	ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
90

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
91
92
93
94
95
96
  	/* CTS flow control flag and modem status interrupts */
  	if (cflag & CRTSCTS) {
  		self->flags |= ASYNC_CTS_FLOW;
  		self->settings.flow_control |= IRCOMM_RTS_CTS_IN;
  		/* This got me. Bummer. Jean II */
  		if (self->service_type == IRCOMM_3_WIRE_RAW)
0dc47877a   Harvey Harrison   net: replace rema...
97
98
  			IRDA_WARNING("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)
  ", __func__);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
99
100
101
102
103
104
105
106
  	} else {
  		self->flags &= ~ASYNC_CTS_FLOW;
  		self->settings.flow_control &= ~IRCOMM_RTS_CTS_IN;
  	}
  	if (cflag & CLOCAL)
  		self->flags &= ~ASYNC_CHECK_CD;
  	else
  		self->flags |= ASYNC_CHECK_CD;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
107
  #if 0
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
109
110
111
112
113
114
115
  	/*
  	 * Set up parity check flag
  	 */
  
  	if (I_INPCK(self->tty))
  		driver->read_status_mask |= LSR_FE | LSR_PE;
  	if (I_BRKINT(driver->tty) || I_PARMRK(driver->tty))
  		driver->read_status_mask |= LSR_BI;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
116

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
118
119
120
121
122
123
124
125
126
  	/*
  	 * Characters to ignore
  	 */
  	driver->ignore_status_mask = 0;
  	if (I_IGNPAR(driver->tty))
  		driver->ignore_status_mask |= LSR_PE | LSR_FE;
  
  	if (I_IGNBRK(self->tty)) {
  		self->ignore_status_mask |= LSR_BI;
  		/*
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
127
  		 * If we're ignore parity and break indicators, ignore
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
129
  		 * overruns too. (For real raw support).
  		 */
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
130
  		if (I_IGNPAR(self->tty))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
131
132
133
134
135
136
  			self->ignore_status_mask |= LSR_OE;
  	}
  #endif
  	self->settings.data_format = cval;
  
  	ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE);
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
137
  	ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
138
139
140
141
142
143
144
145
146
147
  }
  
  /*
   * Function ircomm_tty_set_termios (tty, old_termios)
   *
   *    This routine allows the tty driver to be notified when device's
   *    termios settings have changed.  Note that a well-designed tty driver
   *    should be prepared to accept the case where old == NULL, and try to
   *    do something rational.
   */
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
148
  void ircomm_tty_set_termios(struct tty_struct *tty,
edc6afc54   Alan Cox   [PATCH] tty: swit...
149
  			    struct ktermios *old_termios)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150
151
152
  {
  	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
  	unsigned int cflag = tty->termios->c_cflag;
0dc47877a   Harvey Harrison   net: replace rema...
153
154
  	IRDA_DEBUG(2, "%s()
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
155

6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
156
157
  	if ((cflag == old_termios->c_cflag) &&
  	    (RELEVANT_IFLAG(tty->termios->c_iflag) ==
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
158
159
160
161
162
163
164
165
166
167
168
169
170
  	     RELEVANT_IFLAG(old_termios->c_iflag)))
  	{
  		return;
  	}
  
  	ircomm_tty_change_speed(self);
  
  	/* Handle transition to B0 status */
  	if ((old_termios->c_cflag & CBAUD) &&
  	    !(cflag & CBAUD)) {
  		self->settings.dte &= ~(IRCOMM_DTR|IRCOMM_RTS);
  		ircomm_param_request(self, IRCOMM_DTE, TRUE);
  	}
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
171

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
172
173
174
175
  	/* Handle transition away from B0 status */
  	if (!(old_termios->c_cflag & CBAUD) &&
  	    (cflag & CBAUD)) {
  		self->settings.dte |= IRCOMM_DTR;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
176
  		if (!(tty->termios->c_cflag & CRTSCTS) ||
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
177
178
179
180
181
  		    !test_bit(TTY_THROTTLED, &tty->flags)) {
  			self->settings.dte |= IRCOMM_RTS;
  		}
  		ircomm_param_request(self, IRCOMM_DTE, TRUE);
  	}
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
182

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
183
184
  	/* Handle turning off CRTSCTS */
  	if ((old_termios->c_cflag & CRTSCTS) &&
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
185
  	    !(tty->termios->c_cflag & CRTSCTS))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
186
187
188
189
190
191
192
193
194
  	{
  		tty->hw_stopped = 0;
  		ircomm_tty_start(tty);
  	}
  }
  
  /*
   * Function ircomm_tty_tiocmget (tty, file)
   *
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
195
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
196
197
198
199
200
201
   *
   */
  int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file)
  {
  	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
  	unsigned int result;
0dc47877a   Harvey Harrison   net: replace rema...
202
203
  	IRDA_DEBUG(2, "%s()
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
  
  	if (tty->flags & (1 << TTY_IO_ERROR))
  		return -EIO;
  
  	result =  ((self->settings.dte & IRCOMM_RTS) ? TIOCM_RTS : 0)
  		| ((self->settings.dte & IRCOMM_DTR) ? TIOCM_DTR : 0)
  		| ((self->settings.dce & IRCOMM_CD)  ? TIOCM_CAR : 0)
  		| ((self->settings.dce & IRCOMM_RI)  ? TIOCM_RNG : 0)
  		| ((self->settings.dce & IRCOMM_DSR) ? TIOCM_DSR : 0)
  		| ((self->settings.dce & IRCOMM_CTS) ? TIOCM_CTS : 0);
  	return result;
  }
  
  /*
   * Function ircomm_tty_tiocmset (tty, file, set, clear)
   *
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
220
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
221
222
223
224
   *
   */
  int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
  			unsigned int set, unsigned int clear)
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
225
  {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
226
  	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
0dc47877a   Harvey Harrison   net: replace rema...
227
228
  	IRDA_DEBUG(2, "%s()
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
  
  	if (tty->flags & (1 << TTY_IO_ERROR))
  		return -EIO;
  
  	IRDA_ASSERT(self != NULL, return -1;);
  	IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
  
  	if (set & TIOCM_RTS)
  		self->settings.dte |= IRCOMM_RTS;
  	if (set & TIOCM_DTR)
  		self->settings.dte |= IRCOMM_DTR;
  
  	if (clear & TIOCM_RTS)
  		self->settings.dte &= ~IRCOMM_RTS;
  	if (clear & TIOCM_DTR)
  		self->settings.dte &= ~IRCOMM_DTR;
  
  	if ((set|clear) & TIOCM_RTS)
  		self->settings.dte |= IRCOMM_DELTA_RTS;
  	if ((set|clear) & TIOCM_DTR)
  		self->settings.dte |= IRCOMM_DELTA_DTR;
  
  	ircomm_param_request(self, IRCOMM_DTE, TRUE);
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
252

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
253
254
255
256
257
258
  	return 0;
  }
  
  /*
   * Function get_serial_info (driver, retinfo)
   *
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
259
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
260
261
262
263
264
265
   *
   */
  static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self,
  				      struct serial_struct __user *retinfo)
  {
  	struct serial_struct info;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
266

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
267
268
  	if (!retinfo)
  		return -EFAULT;
0dc47877a   Harvey Harrison   net: replace rema...
269
270
  	IRDA_DEBUG(2, "%s()
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
271
272
273
274
275
276
277
278
279
  
  	memset(&info, 0, sizeof(info));
  	info.line = self->line;
  	info.flags = self->flags;
  	info.baud_base = self->settings.data_rate;
  	info.close_delay = self->close_delay;
  	info.closing_wait = self->closing_wait;
  
  	/* For compatibility  */
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
280
281
282
  	info.type = PORT_16550A;
  	info.port = 0;
  	info.irq = 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
283
  	info.xmit_fifo_size = 0;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
284
  	info.hub6 = 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
285
286
287
288
289
290
291
292
293
294
295
  	info.custom_divisor = 0;
  
  	if (copy_to_user(retinfo, &info, sizeof(*retinfo)))
  		return -EFAULT;
  
  	return 0;
  }
  
  /*
   * Function set_serial_info (driver, new_info)
   *
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
296
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
297
298
299
300
301
302
303
304
   *
   */
  static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self,
  				      struct serial_struct __user *new_info)
  {
  #if 0
  	struct serial_struct new_serial;
  	struct ircomm_tty_cb old_state, *state;
0dc47877a   Harvey Harrison   net: replace rema...
305
306
  	IRDA_DEBUG(0, "%s()
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
307
308
309
310
311
312
313
  
  	if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))
  		return -EFAULT;
  
  
  	state = self
  	old_state = *self;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
314

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
  	if (!capable(CAP_SYS_ADMIN)) {
  		if ((new_serial.baud_base != state->settings.data_rate) ||
  		    (new_serial.close_delay != state->close_delay) ||
  		    ((new_serial.flags & ~ASYNC_USR_MASK) !=
  		     (self->flags & ~ASYNC_USR_MASK)))
  			return -EPERM;
  		state->flags = ((state->flags & ~ASYNC_USR_MASK) |
  				 (new_serial.flags & ASYNC_USR_MASK));
  		self->flags = ((self->flags & ~ASYNC_USR_MASK) |
  			       (new_serial.flags & ASYNC_USR_MASK));
  		/* self->custom_divisor = new_serial.custom_divisor; */
  		goto check_and_exit;
  	}
  
  	/*
  	 * OK, past this point, all the error checking has been done.
  	 * At this point, we start making changes.....
  	 */
  
  	if (self->settings.data_rate != new_serial.baud_base) {
  		self->settings.data_rate = new_serial.baud_base;
  		ircomm_param_request(self, IRCOMM_DATA_RATE, TRUE);
  	}
  
  	self->close_delay = new_serial.close_delay * HZ/100;
  	self->closing_wait = new_serial.closing_wait * HZ/100;
  	/* self->custom_divisor = new_serial.custom_divisor; */
  
  	self->flags = ((self->flags & ~ASYNC_FLAGS) |
  		       (new_serial.flags & ASYNC_FLAGS));
  	self->tty->low_latency = (self->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
  
   check_and_exit:
  
  	if (self->flags & ASYNC_INITIALIZED) {
  		if (((old_state.flags & ASYNC_SPD_MASK) !=
  		     (self->flags & ASYNC_SPD_MASK)) ||
  		    (old_driver.custom_divisor != driver->custom_divisor)) {
  			if ((driver->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
  				driver->tty->alt_speed = 57600;
  			if ((driver->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
  				driver->tty->alt_speed = 115200;
  			if ((driver->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
  				driver->tty->alt_speed = 230400;
  			if ((driver->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
  				driver->tty->alt_speed = 460800;
  			ircomm_tty_change_speed(driver);
  		}
  	}
  #endif
  	return 0;
  }
  
  /*
   * Function ircomm_tty_ioctl (tty, file, cmd, arg)
   *
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
371
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
372
373
   *
   */
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
374
  int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
375
376
377
378
  		     unsigned int cmd, unsigned long arg)
  {
  	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
  	int ret = 0;
0dc47877a   Harvey Harrison   net: replace rema...
379
380
  	IRDA_DEBUG(2, "%s()
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
  
  	if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
  	    (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
  	    (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
  		if (tty->flags & (1 << TTY_IO_ERROR))
  		    return -EIO;
  	}
  
  	switch (cmd) {
  	case TIOCGSERIAL:
  		ret = ircomm_tty_get_serial_info(self, (struct serial_struct __user *) arg);
  		break;
  	case TIOCSSERIAL:
  		ret = ircomm_tty_set_serial_info(self, (struct serial_struct __user *) arg);
  		break;
  	case TIOCMIWAIT:
  		IRDA_DEBUG(0, "(), TIOCMIWAIT, not impl!
  ");
  		break;
  
  	case TIOCGICOUNT:
0dc47877a   Harvey Harrison   net: replace rema...
402
403
  		IRDA_DEBUG(0, "%s(), TIOCGICOUNT not impl!
  ", __func__ );
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
  #if 0
  		save_flags(flags); cli();
  		cnow = driver->icount;
  		restore_flags(flags);
  		p_cuser = (struct serial_icounter_struct __user *) arg;
  		if (put_user(cnow.cts, &p_cuser->cts) ||
  		    put_user(cnow.dsr, &p_cuser->dsr) ||
  		    put_user(cnow.rng, &p_cuser->rng) ||
  		    put_user(cnow.dcd, &p_cuser->dcd) ||
  		    put_user(cnow.rx, &p_cuser->rx) ||
  		    put_user(cnow.tx, &p_cuser->tx) ||
  		    put_user(cnow.frame, &p_cuser->frame) ||
  		    put_user(cnow.overrun, &p_cuser->overrun) ||
  		    put_user(cnow.parity, &p_cuser->parity) ||
  		    put_user(cnow.brk, &p_cuser->brk) ||
  		    put_user(cnow.buf_overrun, &p_cuser->buf_overrun))
  			return -EFAULT;
6819bc2e1   YOSHIFUJI Hideaki   [NET] IRDA: Fix w...
421
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
422
423
424
425
426
427
  		return 0;
  	default:
  		ret = -ENOIOCTLCMD;  /* ioctls which we must ignore */
  	}
  	return ret;
  }