aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/ircomm/ircomm_param.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
commitcb18eccff48ef3986d1072964590bce6fec705fb (patch)
tree777fb1d15e0281341e1e02c9803d989538d346f2 /net/irda/ircomm/ircomm_param.c
parentc827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff)
parent5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits) [IPV4]: Restore multipath routing after rt_next changes. [XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch. [NET]: Reorder fields of struct dst_entry [DECNET]: Convert decnet route to use the new dst_entry 'next' pointer [IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer [IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer [NET]: Introduce union in struct dst_entry to hold 'next' pointer [DECNET]: fix misannotation of linkinfo_dn [DECNET]: FRA_{DST,SRC} are le16 for decnet [UDP]: UDP can use sk_hash to speedup lookups [NET]: Fix whitespace errors. [NET] XFRM: Fix whitespace errors. [NET] X25: Fix whitespace errors. [NET] WANROUTER: Fix whitespace errors. [NET] UNIX: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] SCHED: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. ...
Diffstat (limited to 'net/irda/ircomm/ircomm_param.c')
-rw-r--r--net/irda/ircomm/ircomm_param.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index a39f5735a90b..fbac13e95b28 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_param.c 3 * Filename: ircomm_param.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: Parameter handling for the IrCOMM protocol 5 * Description: Parameter handling for the IrCOMM protocol
@@ -8,24 +8,24 @@
8 * Created at: Mon Jun 7 10:25:11 1999 8 * Created at: Mon Jun 7 10:25:11 1999
9 * Modified at: Sun Jan 30 14:32:03 2000 9 * Modified at: Sun Jan 30 14:32:03 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * 11 *
12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. 12 * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as 15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * This program is distributed in the hope that it will be useful, 19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details. 22 * GNU General Public License for more details.
23 * 23 *
24 * You should have received a copy of the GNU General Public License 24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software 25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA 27 * MA 02111-1307 USA
28 * 28 *
29 ********************************************************************/ 29 ********************************************************************/
30 30
31#include <linux/sched.h> 31#include <linux/sched.h>
@@ -41,23 +41,23 @@
41 41
42#include <net/irda/ircomm_param.h> 42#include <net/irda/ircomm_param.h>
43 43
44static int ircomm_param_service_type(void *instance, irda_param_t *param, 44static int ircomm_param_service_type(void *instance, irda_param_t *param,
45 int get); 45 int get);
46static int ircomm_param_port_type(void *instance, irda_param_t *param, 46static int ircomm_param_port_type(void *instance, irda_param_t *param,
47 int get); 47 int get);
48static int ircomm_param_port_name(void *instance, irda_param_t *param, 48static int ircomm_param_port_name(void *instance, irda_param_t *param,
49 int get); 49 int get);
50static int ircomm_param_service_type(void *instance, irda_param_t *param, 50static int ircomm_param_service_type(void *instance, irda_param_t *param,
51 int get); 51 int get);
52static int ircomm_param_data_rate(void *instance, irda_param_t *param, 52static int ircomm_param_data_rate(void *instance, irda_param_t *param,
53 int get); 53 int get);
54static int ircomm_param_data_format(void *instance, irda_param_t *param, 54static int ircomm_param_data_format(void *instance, irda_param_t *param,
55 int get); 55 int get);
56static int ircomm_param_flow_control(void *instance, irda_param_t *param, 56static int ircomm_param_flow_control(void *instance, irda_param_t *param,
57 int get); 57 int get);
58static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get); 58static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get);
59static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get); 59static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get);
60static int ircomm_param_line_status(void *instance, irda_param_t *param, 60static int ircomm_param_line_status(void *instance, irda_param_t *param,
61 int get); 61 int get);
62static int ircomm_param_dte(void *instance, irda_param_t *param, int get); 62static int ircomm_param_dte(void *instance, irda_param_t *param, int get);
63static int ircomm_param_dce(void *instance, irda_param_t *param, int get); 63static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
@@ -85,7 +85,7 @@ static pi_minor_info_t pi_minor_call_table_9_wire[] = {
85static pi_major_info_t pi_major_call_table[] = { 85static pi_major_info_t pi_major_call_table[] = {
86 { pi_minor_call_table_common, 3 }, 86 { pi_minor_call_table_common, 3 },
87 { pi_minor_call_table_non_raw, 6 }, 87 { pi_minor_call_table_non_raw, 6 },
88 { pi_minor_call_table_9_wire, 3 } 88 { pi_minor_call_table_9_wire, 3 }
89/* { pi_minor_call_table_centronics } */ 89/* { pi_minor_call_table_centronics } */
90}; 90};
91 91
@@ -119,20 +119,20 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
119 119
120 spin_lock_irqsave(&self->spinlock, flags); 120 spin_lock_irqsave(&self->spinlock, flags);
121 121
122 skb = self->ctrl_skb; 122 skb = self->ctrl_skb;
123 if (!skb) { 123 if (!skb) {
124 skb = alloc_skb(256, GFP_ATOMIC); 124 skb = alloc_skb(256, GFP_ATOMIC);
125 if (!skb) { 125 if (!skb) {
126 spin_unlock_irqrestore(&self->spinlock, flags); 126 spin_unlock_irqrestore(&self->spinlock, flags);
127 return -ENOMEM; 127 return -ENOMEM;
128 } 128 }
129 129
130 skb_reserve(skb, self->max_header_size); 130 skb_reserve(skb, self->max_header_size);
131 self->ctrl_skb = skb; 131 self->ctrl_skb = skb;
132 } 132 }
133 /* 133 /*
134 * Inserting is a little bit tricky since we don't know how much 134 * Inserting is a little bit tricky since we don't know how much
135 * room we will need. But this should hopefully work OK 135 * room we will need. But this should hopefully work OK
136 */ 136 */
137 count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), 137 count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb),
138 &ircomm_param_info); 138 &ircomm_param_info);
@@ -162,7 +162,7 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)
162 * query and then the remote device sends its initial parameters 162 * query and then the remote device sends its initial parameters
163 * 163 *
164 */ 164 */
165static int ircomm_param_service_type(void *instance, irda_param_t *param, 165static int ircomm_param_service_type(void *instance, irda_param_t *param,
166 int get) 166 int get)
167{ 167{
168 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 168 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -179,7 +179,7 @@ static int ircomm_param_service_type(void *instance, irda_param_t *param,
179 /* Find all common service types */ 179 /* Find all common service types */
180 service_type &= self->service_type; 180 service_type &= self->service_type;
181 if (!service_type) { 181 if (!service_type) {
182 IRDA_DEBUG(2, 182 IRDA_DEBUG(2,
183 "%s(), No common service type to use!\n", __FUNCTION__ ); 183 "%s(), No common service type to use!\n", __FUNCTION__ );
184 return -1; 184 return -1;
185 } 185 }
@@ -198,12 +198,12 @@ static int ircomm_param_service_type(void *instance, irda_param_t *param,
198 else if (service_type & IRCOMM_3_WIRE_RAW) 198 else if (service_type & IRCOMM_3_WIRE_RAW)
199 self->settings.service_type = IRCOMM_3_WIRE_RAW; 199 self->settings.service_type = IRCOMM_3_WIRE_RAW;
200 200
201 IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ , 201 IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ ,
202 self->settings.service_type); 202 self->settings.service_type);
203 203
204 /* 204 /*
205 * Now the line is ready for some communication. Check if we are a 205 * Now the line is ready for some communication. Check if we are a
206 * server, and send over some initial parameters. 206 * server, and send over some initial parameters.
207 * Client do it in ircomm_tty_state_setup(). 207 * Client do it in ircomm_tty_state_setup().
208 * Note : we may get called from ircomm_tty_getvalue_confirm(), 208 * Note : we may get called from ircomm_tty_getvalue_confirm(),
209 * therefore before we even have open any socket. And self->client 209 * therefore before we even have open any socket. And self->client
@@ -235,13 +235,13 @@ static int ircomm_param_port_type(void *instance, irda_param_t *param, int get)
235 235
236 IRDA_ASSERT(self != NULL, return -1;); 236 IRDA_ASSERT(self != NULL, return -1;);
237 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 237 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
238 238
239 if (get) 239 if (get)
240 param->pv.i = IRCOMM_SERIAL; 240 param->pv.i = IRCOMM_SERIAL;
241 else { 241 else {
242 self->settings.port_type = (__u8) param->pv.i; 242 self->settings.port_type = (__u8) param->pv.i;
243 243
244 IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ , 244 IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ ,
245 self->settings.port_type); 245 self->settings.port_type);
246 } 246 }
247 return 0; 247 return 0;
@@ -256,7 +256,7 @@ static int ircomm_param_port_type(void *instance, irda_param_t *param, int get)
256static int ircomm_param_port_name(void *instance, irda_param_t *param, int get) 256static int ircomm_param_port_name(void *instance, irda_param_t *param, int get)
257{ 257{
258 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 258 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
259 259
260 IRDA_ASSERT(self != NULL, return -1;); 260 IRDA_ASSERT(self != NULL, return -1;);
261 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 261 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
262 262
@@ -279,7 +279,7 @@ static int ircomm_param_port_name(void *instance, irda_param_t *param, int get)
279static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) 279static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
280{ 280{
281 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 281 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
282 282
283 IRDA_ASSERT(self != NULL, return -1;); 283 IRDA_ASSERT(self != NULL, return -1;);
284 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 284 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
285 285
@@ -287,7 +287,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
287 param->pv.i = self->settings.data_rate; 287 param->pv.i = self->settings.data_rate;
288 else 288 else
289 self->settings.data_rate = param->pv.i; 289 self->settings.data_rate = param->pv.i;
290 290
291 IRDA_DEBUG(2, "%s(), data rate = %d\n", __FUNCTION__ , param->pv.i); 291 IRDA_DEBUG(2, "%s(), data rate = %d\n", __FUNCTION__ , param->pv.i);
292 292
293 return 0; 293 return 0;
@@ -299,7 +299,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get)
299 * Exchange data format to be used in this settings 299 * Exchange data format to be used in this settings
300 * 300 *
301 */ 301 */
302static int ircomm_param_data_format(void *instance, irda_param_t *param, 302static int ircomm_param_data_format(void *instance, irda_param_t *param,
303 int get) 303 int get)
304{ 304{
305 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 305 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
@@ -311,7 +311,7 @@ static int ircomm_param_data_format(void *instance, irda_param_t *param,
311 param->pv.i = self->settings.data_format; 311 param->pv.i = self->settings.data_format;
312 else 312 else
313 self->settings.data_format = (__u8) param->pv.i; 313 self->settings.data_format = (__u8) param->pv.i;
314 314
315 return 0; 315 return 0;
316} 316}
317 317
@@ -321,14 +321,14 @@ static int ircomm_param_data_format(void *instance, irda_param_t *param,
321 * Exchange flow control settings to be used in this settings 321 * Exchange flow control settings to be used in this settings
322 * 322 *
323 */ 323 */
324static int ircomm_param_flow_control(void *instance, irda_param_t *param, 324static int ircomm_param_flow_control(void *instance, irda_param_t *param,
325 int get) 325 int get)
326{ 326{
327 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 327 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
328 328
329 IRDA_ASSERT(self != NULL, return -1;); 329 IRDA_ASSERT(self != NULL, return -1;);
330 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 330 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
331 331
332 if (get) 332 if (get)
333 param->pv.i = self->settings.flow_control; 333 param->pv.i = self->settings.flow_control;
334 else 334 else
@@ -351,7 +351,7 @@ static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get)
351 351
352 IRDA_ASSERT(self != NULL, return -1;); 352 IRDA_ASSERT(self != NULL, return -1;);
353 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 353 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
354 354
355 if (get) { 355 if (get) {
356 param->pv.i = self->settings.xonxoff[0]; 356 param->pv.i = self->settings.xonxoff[0];
357 param->pv.i |= self->settings.xonxoff[1] << 8; 357 param->pv.i |= self->settings.xonxoff[1] << 8;
@@ -360,7 +360,7 @@ static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get)
360 self->settings.xonxoff[1] = (__u16) param->pv.i >> 8; 360 self->settings.xonxoff[1] = (__u16) param->pv.i >> 8;
361 } 361 }
362 362
363 IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ , 363 IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ ,
364 param->pv.i & 0xff, param->pv.i >> 8); 364 param->pv.i & 0xff, param->pv.i >> 8);
365 365
366 return 0; 366 return 0;
@@ -378,7 +378,7 @@ static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get)
378 378
379 IRDA_ASSERT(self != NULL, return -1;); 379 IRDA_ASSERT(self != NULL, return -1;);
380 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 380 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
381 381
382 if (get) { 382 if (get) {
383 param->pv.i = self->settings.enqack[0]; 383 param->pv.i = self->settings.enqack[0];
384 param->pv.i |= self->settings.enqack[1] << 8; 384 param->pv.i |= self->settings.enqack[1] << 8;
@@ -396,10 +396,10 @@ static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get)
396/* 396/*
397 * Function ircomm_param_line_status (self, param) 397 * Function ircomm_param_line_status (self, param)
398 * 398 *
399 * 399 *
400 * 400 *
401 */ 401 */
402static int ircomm_param_line_status(void *instance, irda_param_t *param, 402static int ircomm_param_line_status(void *instance, irda_param_t *param,
403 int get) 403 int get)
404{ 404{
405 IRDA_DEBUG(2, "%s(), not impl.\n", __FUNCTION__ ); 405 IRDA_DEBUG(2, "%s(), not impl.\n", __FUNCTION__ );
@@ -427,7 +427,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
427 dte = (__u8) param->pv.i; 427 dte = (__u8) param->pv.i;
428 428
429 self->settings.dce = 0; 429 self->settings.dce = 0;
430 430
431 if (dte & IRCOMM_DELTA_DTR) 431 if (dte & IRCOMM_DELTA_DTR)
432 self->settings.dce |= (IRCOMM_DELTA_DSR| 432 self->settings.dce |= (IRCOMM_DELTA_DSR|
433 IRCOMM_DELTA_RI | 433 IRCOMM_DELTA_RI |
@@ -436,7 +436,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
436 self->settings.dce |= (IRCOMM_DSR| 436 self->settings.dce |= (IRCOMM_DSR|
437 IRCOMM_RI | 437 IRCOMM_RI |
438 IRCOMM_CD); 438 IRCOMM_CD);
439 439
440 if (dte & IRCOMM_DELTA_RTS) 440 if (dte & IRCOMM_DELTA_RTS)
441 self->settings.dce |= IRCOMM_DELTA_CTS; 441 self->settings.dce |= IRCOMM_DELTA_CTS;
442 if (dte & IRCOMM_RTS) 442 if (dte & IRCOMM_RTS)
@@ -455,7 +455,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get)
455/* 455/*
456 * Function ircomm_param_dce (instance, param) 456 * Function ircomm_param_dce (instance, param)
457 * 457 *
458 * 458 *
459 * 459 *
460 */ 460 */
461static int ircomm_param_dce(void *instance, irda_param_t *param, int get) 461static int ircomm_param_dce(void *instance, irda_param_t *param, int get)