diff options
author | YOSHIFUJI Hideaki | 2007-02-09 23:24:53 +0900 |
---|---|---|
committer | David S. Miller | 2007-02-10 23:19:47 -0800 |
commit | 6819bc2e1e46c71711a8dddf4040e706b02973c0 (patch) | |
tree | 6baa6c808fd70a01d5e95c77b02d0a6c5409cc9e | |
parent | 981c0ff6900c981668a798fe9e0bc5ba32ee3fd4 (diff) |
[NET] IRDA: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
40 files changed, 1441 insertions, 1441 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 7e1aea89ef05..eabd6838f50a 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -138,7 +138,7 @@ static void irda_disconnect_indication(void *instance, void *sap, sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); - sock_orphan(sk); + sock_orphan(sk); release_sock(sk); /* Close our TSAP. @@ -158,7 +158,7 @@ static void irda_disconnect_indication(void *instance, void *sap, irttp_close_tsap(self->tsap); self->tsap = NULL; } - } + } /* Note : once we are there, there is not much you want to do * with the socket anymore, apart from closing it. @@ -1211,7 +1211,7 @@ static int irda_release(struct socket *sock) IRDA_DEBUG(2, "%s()\n", __FUNCTION__); - if (sk == NULL) + if (sk == NULL) return 0; lock_sock(sk); @@ -1259,7 +1259,7 @@ static int irda_release(struct socket *sock) * memory leak is now gone... - Jean II */ - return 0; + return 0; } /* @@ -1312,7 +1312,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, len = self->max_data_size; } - skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, + skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) return -ENOBUFS; @@ -1714,7 +1714,7 @@ static int irda_shutdown(struct socket *sock, int how) self->daddr = DEV_ADDR_ANY; /* Until we get re-connected */ self->saddr = 0x0; /* so IrLMP assign us any link */ - return 0; + return 0; } /* diff --git a/net/irda/discovery.c b/net/irda/discovery.c index 89fd2a2cbca6..789478bc3009 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: discovery.c * Version: 0.1 * Description: Routines for handling discoveries at the IrLMP layer @@ -10,24 +10,24 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * Modified at: Fri May 28 3:11 CST 1999 * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/string.h> @@ -65,9 +65,9 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) spin_lock_irqsave(&cachelog->hb_spinlock, flags); - /* - * Remove all discoveries of devices that has previously been - * discovered on the same link with the same name (info), or the + /* + * Remove all discoveries of devices that has previously been + * discovered on the same link with the same name (info), or the * same daddr. We do this since some devices (mostly PDAs) change * their device address between every discovery. */ @@ -79,10 +79,10 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) discovery = (discovery_t *) hashbin_get_next(cachelog); if ((node->data.saddr == new->data.saddr) && - ((node->data.daddr == new->data.daddr) || + ((node->data.daddr == new->data.daddr) || (strcmp(node->data.info, new->data.info) == 0))) { - /* This discovery is a previous discovery + /* This discovery is a previous discovery * from the same device, so just remove it */ hashbin_remove_this(cachelog, (irda_queue_t *) node); @@ -134,7 +134,7 @@ void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log) discovery = (discovery_t *) hashbin_remove_first(log); } - + /* Delete the now empty log */ hashbin_delete(log, (FREE_FUNC) kfree); } @@ -232,7 +232,7 @@ void irlmp_dump_discoveries(hashbin_t *log) while (discovery != NULL) { IRDA_DEBUG(0, "Discovery:\n"); IRDA_DEBUG(0, " daddr=%08x\n", discovery->data.daddr); - IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr); + IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr); IRDA_DEBUG(0, " nickname=%s\n", discovery->data.info); discovery = (discovery_t *) hashbin_get_next(log); @@ -321,26 +321,26 @@ static inline discovery_t *discovery_seq_idx(loff_t pos) { discovery_t *discovery; - for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog); + for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog); discovery != NULL; discovery = (discovery_t *) hashbin_get_next(irlmp->cachelog)) { if (pos-- == 0) break; } - + return discovery; } static void *discovery_seq_start(struct seq_file *seq, loff_t *pos) { spin_lock_irq(&irlmp->cachelog->hb_spinlock); - return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN; + return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN; } static void *discovery_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) + return (v == SEQ_START_TOKEN) ? (void *) hashbin_get_first(irlmp->cachelog) : (void *) hashbin_get_next(irlmp->cachelog); } @@ -357,9 +357,9 @@ static int discovery_seq_show(struct seq_file *seq, void *v) else { const discovery_t *discovery = v; - seq_printf(seq, "nickname: %s, hint: 0x%02x%02x", + seq_printf(seq, "nickname: %s, hint: 0x%02x%02x", discovery->data.info, - discovery->data.hints[0], + discovery->data.hints[0], discovery->data.hints[1]); #if 0 if ( discovery->data.hints[0] & HINT_PNP) @@ -376,20 +376,20 @@ static int discovery_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "Fax "); if ( discovery->data.hints[0] & HINT_LAN) seq_puts(seq, "LAN Access "); - + if ( discovery->data.hints[1] & HINT_TELEPHONY) seq_puts(seq, "Telephony "); if ( discovery->data.hints[1] & HINT_FILE_SERVER) - seq_puts(seq, "File Server "); + seq_puts(seq, "File Server "); if ( discovery->data.hints[1] & HINT_COMM) seq_puts(seq, "IrCOMM "); if ( discovery->data.hints[1] & HINT_OBEX) seq_puts(seq, "IrOBEX "); -#endif +#endif seq_printf(seq,", saddr: 0x%08x, daddr: 0x%08x\n\n", discovery->data.saddr, discovery->data.daddr); - + seq_putc(seq, '\n'); } return 0; diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c index ad6b6af3dd97..c28ee7bce26a 100644 --- a/net/irda/ircomm/ircomm_core.c +++ b/net/irda/ircomm/ircomm_core.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_core.c * Version: 1.0 * Description: IrCOMM service interface @@ -8,25 +8,25 @@ * Created at: Sun Jun 6 20:37:34 1999 * Modified at: Tue Dec 21 13:26:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/module.h> @@ -49,7 +49,7 @@ #include <net/irda/ircomm_core.h> static int __ircomm_close(struct ircomm_cb *self); -static void ircomm_control_indication(struct ircomm_cb *self, +static void ircomm_control_indication(struct ircomm_cb *self, struct sk_buff *skb, int clen); #ifdef CONFIG_PROC_FS @@ -69,22 +69,22 @@ hashbin_t *ircomm = NULL; static int __init ircomm_init(void) { - ircomm = hashbin_new(HB_LOCK); + ircomm = hashbin_new(HB_LOCK); if (ircomm == NULL) { IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); return -ENOMEM; } - + #ifdef CONFIG_PROC_FS { struct proc_dir_entry *ent; ent = create_proc_entry("ircomm", 0, proc_irda); - if (ent) + if (ent) ent->proc_fops = &ircomm_proc_fops; } #endif /* CONFIG_PROC_FS */ - + IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n"); - + return 0; } @@ -139,7 +139,7 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line) hashbin_insert(ircomm, (irda_queue_t *) self, line, NULL); - ircomm_next_state(self, IRCOMM_IDLE); + ircomm_next_state(self, IRCOMM_IDLE); return self; } @@ -195,8 +195,8 @@ int ircomm_close(struct ircomm_cb *self) entry = hashbin_remove(ircomm, self->line, NULL); IRDA_ASSERT(entry == self, return -1;); - - return __ircomm_close(self); + + return __ircomm_close(self); } EXPORT_SYMBOL(ircomm_close); @@ -206,9 +206,9 @@ EXPORT_SYMBOL(ircomm_close); * * Impl. of this function is differ from one of the reference. This * function does discovery as well as sending connect request - * + * */ -int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, +int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, __u32 saddr, __u32 daddr, struct sk_buff *skb, __u8 service_type) { @@ -243,20 +243,20 @@ void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info) { int clen = 0; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); /* Check if the packet contains data on the control channel */ if (skb->len > 0) clen = skb->data[0]; - - /* - * If there are any data hiding in the control channel, we must - * deliver it first. The side effect is that the control channel + + /* + * If there are any data hiding in the control channel, we must + * deliver it first. The side effect is that the control channel * will be removed from the skb */ if (self->notify.connect_indication) - self->notify.connect_indication(self->notify.instance, self, + self->notify.connect_indication(self->notify.instance, self, info->qos, info->max_data_size, info->max_header_size, skb); else { @@ -282,7 +282,7 @@ int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata) ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL); return ret; -} +} EXPORT_SYMBOL(ircomm_connect_response); @@ -299,7 +299,7 @@ void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb, if (self->notify.connect_confirm ) self->notify.connect_confirm(self->notify.instance, - self, info->qos, + self, info->qos, info->max_data_size, info->max_header_size, skb); else { @@ -322,7 +322,7 @@ int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb) IRDA_ASSERT(self != NULL, return -EFAULT;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); IRDA_ASSERT(skb != NULL, return -EFAULT;); - + ret = ircomm_do_event(self, IRCOMM_DATA_REQUEST, skb, NULL); return ret; @@ -337,7 +337,7 @@ EXPORT_SYMBOL(ircomm_data_request); * */ void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb) -{ +{ IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(skb->len > 0, return;); @@ -363,9 +363,9 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb) clen = skb->data[0]; - /* - * If there are any data hiding in the control channel, we must - * deliver it first. The side effect is that the control channel + /* + * If there are any data hiding in the control channel, we must + * deliver it first. The side effect is that the control channel * will be removed from the skb */ if (clen > 0) @@ -375,7 +375,7 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb) skb_pull(skb, clen+1); if (skb->len) - ircomm_data_indication(self, skb); + ircomm_data_indication(self, skb); else { IRDA_DEBUG(4, "%s(), data was control info only!\n", __FUNCTION__ ); @@ -391,13 +391,13 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb) int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb) { int ret; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -EFAULT;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); IRDA_ASSERT(skb != NULL, return -EFAULT;); - + ret = ircomm_do_event(self, IRCOMM_CONTROL_REQUEST, skb, NULL); return ret; @@ -411,10 +411,10 @@ EXPORT_SYMBOL(ircomm_control_request); * Data has arrived on the control channel * */ -static void ircomm_control_indication(struct ircomm_cb *self, +static void ircomm_control_indication(struct ircomm_cb *self, struct sk_buff *skb, int clen) { - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); /* Use udata for delivering data on the control channel */ if (self->notify.udata_indication) { @@ -427,8 +427,8 @@ static void ircomm_control_indication(struct ircomm_cb *self, /* Remove data channel from control channel */ skb_trim(ctrl_skb, clen+1); - - self->notify.udata_indication(self->notify.instance, self, + + self->notify.udata_indication(self->notify.instance, self, ctrl_skb); /* Drop reference count - @@ -455,7 +455,7 @@ int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); - ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata, + ret = ircomm_do_event(self, IRCOMM_DISCONNECT_REQUEST, userdata, &info); return ret; } @@ -472,7 +472,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(info != NULL, return;); if (self->notify.disconnect_indication) { @@ -486,7 +486,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb, /* * Function ircomm_flow_request (self, flow) * - * + * * */ void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow) @@ -517,7 +517,7 @@ static void *ircomm_seq_start(struct seq_file *seq, loff_t *pos) self = (struct ircomm_cb *) hashbin_get_next(ircomm)) { if (off++ == *pos) break; - + } return self; } @@ -535,7 +535,7 @@ static void ircomm_seq_stop(struct seq_file *seq, void *v) } static int ircomm_seq_show(struct seq_file *seq, void *v) -{ +{ const struct ircomm_cb *self = v; IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -EINVAL; ); @@ -548,7 +548,7 @@ static int ircomm_seq_show(struct seq_file *seq, void *v) seq_printf(seq, " state: %s, slsap_sel: %#02x, dlsap_sel: %#02x, mode:", ircomm_state[ self->state], - self->slsap_sel, self->dlsap_sel); + self->slsap_sel, self->dlsap_sel); if(self->service_type & IRCOMM_3_WIRE_RAW) seq_printf(seq, " 3-wire-raw"); diff --git a/net/irda/ircomm/ircomm_event.c b/net/irda/ircomm/ircomm_event.c index 01f4e801a1ba..23d0468794e2 100644 --- a/net/irda/ircomm/ircomm_event.c +++ b/net/irda/ircomm/ircomm_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_event.c * Version: 1.0 * Description: IrCOMM layer state machine @@ -8,24 +8,24 @@ * Created at: Sun Jun 6 20:33:11 1999 * Modified at: Sun Dec 12 13:44:32 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -41,13 +41,13 @@ #include <net/irda/ircomm_core.h> #include <net/irda/ircomm_event.h> -static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); -static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); -static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); -static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); char *ircomm_state[] = { @@ -60,26 +60,26 @@ char *ircomm_state[] = { #ifdef CONFIG_IRDA_DEBUG static char *ircomm_event[] = { "IRCOMM_CONNECT_REQUEST", - "IRCOMM_CONNECT_RESPONSE", - "IRCOMM_TTP_CONNECT_INDICATION", + "IRCOMM_CONNECT_RESPONSE", + "IRCOMM_TTP_CONNECT_INDICATION", "IRCOMM_LMP_CONNECT_INDICATION", - "IRCOMM_TTP_CONNECT_CONFIRM", + "IRCOMM_TTP_CONNECT_CONFIRM", "IRCOMM_LMP_CONNECT_CONFIRM", - "IRCOMM_LMP_DISCONNECT_INDICATION", + "IRCOMM_LMP_DISCONNECT_INDICATION", "IRCOMM_TTP_DISCONNECT_INDICATION", - "IRCOMM_DISCONNECT_REQUEST", + "IRCOMM_DISCONNECT_REQUEST", - "IRCOMM_TTP_DATA_INDICATION", + "IRCOMM_TTP_DATA_INDICATION", "IRCOMM_LMP_DATA_INDICATION", - "IRCOMM_DATA_REQUEST", - "IRCOMM_CONTROL_REQUEST", - "IRCOMM_CONTROL_INDICATION", + "IRCOMM_DATA_REQUEST", + "IRCOMM_CONTROL_REQUEST", + "IRCOMM_CONTROL_INDICATION", }; #endif /* CONFIG_IRDA_DEBUG */ static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event, - struct sk_buff *skb, struct ircomm_info *info) = + struct sk_buff *skb, struct ircomm_info *info) = { ircomm_state_idle, ircomm_state_waiti, @@ -93,14 +93,14 @@ static int (*state[])(struct ircomm_cb *self, IRCOMM_EVENT event, * IrCOMM is currently idle * */ -static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; switch (event) { case IRCOMM_CONNECT_REQUEST: - ircomm_next_state(self, IRCOMM_WAITI); + ircomm_next_state(self, IRCOMM_WAITI); ret = self->issue.connect_request(self, skb, info); break; case IRCOMM_TTP_CONNECT_INDICATION: @@ -119,10 +119,10 @@ static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, /* * Function ircomm_state_waiti (self, event, skb) * - * The IrCOMM user has requested an IrCOMM connection to the remote + * The IrCOMM user has requested an IrCOMM connection to the remote * device and is awaiting confirmation */ -static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; @@ -152,8 +152,8 @@ static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, * IrCOMM has received an incoming connection request and is awaiting * response from the user */ -static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, - struct sk_buff *skb, struct ircomm_info *info) +static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, + struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; @@ -185,7 +185,7 @@ static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, * IrCOMM is connected to the peer IrCOMM device * */ -static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, +static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info) { int ret = 0; @@ -228,7 +228,7 @@ static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, * */ int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event, - struct sk_buff *skb, struct ircomm_info *info) + struct sk_buff *skb, struct ircomm_info *info) { IRDA_DEBUG(4, "%s: state=%s, event=%s\n", __FUNCTION__ , ircomm_state[self->state], ircomm_event[event]); @@ -245,7 +245,7 @@ int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event, void ircomm_next_state(struct ircomm_cb *self, IRCOMM_STATE state) { self->state = state; - - IRDA_DEBUG(4, "%s: next state=%s, service type=%d\n", __FUNCTION__ , + + IRDA_DEBUG(4, "%s: next state=%s, service type=%d\n", __FUNCTION__ , ircomm_state[self->state], self->service_type); } diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c index c8e0d89ee11f..22bd75299104 100644 --- a/net/irda/ircomm/ircomm_lmp.c +++ b/net/irda/ircomm/ircomm_lmp.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_lmp.c * Version: 1.0 * Description: Interface between IrCOMM and IrLMP @@ -9,25 +9,25 @@ * Modified at: Sun Dec 12 13:44:17 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: Previous IrLPT work by Thomas Davis - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -45,11 +45,11 @@ /* * Function ircomm_lmp_connect_request (self, userdata) * - * + * * */ -static int ircomm_lmp_connect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_lmp_connect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { int ret = 0; @@ -61,14 +61,14 @@ static int ircomm_lmp_connect_request(struct ircomm_cb *self, skb_get(userdata); ret = irlmp_connect_request(self->lsap, info->dlsap_sel, - info->saddr, info->daddr, NULL, userdata); + info->saddr, info->daddr, NULL, userdata); return ret; -} +} /* * Function ircomm_lmp_connect_response (self, skb) * - * + * * */ static int ircomm_lmp_connect_response(struct ircomm_cb *self, @@ -78,7 +78,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, int ret; IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - + /* Any userdata supplied? */ if (userdata == NULL) { tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); @@ -88,8 +88,8 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, /* Reserve space for MUX and LAP header */ skb_reserve(tx_skb, LMP_MAX_HEADER); } else { - /* - * Check that the client has reserved enough space for + /* + * Check that the client has reserved enough space for * headers */ IRDA_ASSERT(skb_headroom(userdata) >= LMP_MAX_HEADER, @@ -105,22 +105,22 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, return 0; } -static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { - struct sk_buff *tx_skb; + struct sk_buff *tx_skb; int ret; IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - if (!userdata) { + if (!userdata) { tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); if (!tx_skb) return -ENOMEM; - + /* Reserve space for MUX and LAP header */ - skb_reserve(tx_skb, LMP_MAX_HEADER); + skb_reserve(tx_skb, LMP_MAX_HEADER); userdata = tx_skb; } else { /* Don't forget to refcount it - should be NULL anyway */ @@ -136,7 +136,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, * Function ircomm_lmp_flow_control (skb) * * This function is called when a data frame we have sent to IrLAP has - * been deallocated. We do this to make sure we don't flood IrLAP with + * been deallocated. We do this to make sure we don't flood IrLAP with * frames, since we are not using the IrTTP flow control mechanism */ static void ircomm_lmp_flow_control(struct sk_buff *skb) @@ -150,29 +150,29 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb) cb = (struct irda_skb_cb *) skb->cb; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - - line = cb->line; + + line = cb->line; self = (struct ircomm_cb *) hashbin_lock_find(ircomm, line, NULL); - if (!self) { + if (!self) { IRDA_DEBUG(2, "%s(), didn't find myself\n", __FUNCTION__ ); - return; + return; } - IRDA_ASSERT(self != NULL, return;); + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); self->pkt_count--; - if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) { - IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ ); - self->flow_status = FLOW_START; - if (self->notify.flow_indication) - self->notify.flow_indication(self->notify.instance, + if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) { + IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ ); + self->flow_status = FLOW_START; + if (self->notify.flow_indication) + self->notify.flow_indication(self->notify.instance, self, FLOW_START); - } + } } - + /* * Function ircomm_lmp_data_request (self, userdata) * @@ -180,7 +180,7 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb) * */ static int ircomm_lmp_data_request(struct ircomm_cb *self, - struct sk_buff *skb, + struct sk_buff *skb, int not_used) { struct irda_skb_cb *cb; @@ -189,8 +189,8 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self, IRDA_ASSERT(skb != NULL, return -1;); cb = (struct irda_skb_cb *) skb->cb; - - cb->line = self->line; + + cb->line = self->line; IRDA_DEBUG(4, "%s(), sending frame\n", __FUNCTION__ ); @@ -199,13 +199,13 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self, skb->destructor = ircomm_lmp_flow_control; - if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { + if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { IRDA_DEBUG(2, "%s(), asking TTY to slow down!\n", __FUNCTION__ ); - self->flow_status = FLOW_STOP; - if (self->notify.flow_indication) - self->notify.flow_indication(self->notify.instance, - self, FLOW_STOP); - } + self->flow_status = FLOW_STOP; + if (self->notify.flow_indication) + self->notify.flow_indication(self->notify.instance, + self, FLOW_STOP); + } ret = irlmp_data_request(self->lsap, skb); if (ret) { IRDA_ERROR("%s(), failed\n", __FUNCTION__); @@ -227,11 +227,11 @@ static int ircomm_lmp_data_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); - + ircomm_do_event(self, IRCOMM_LMP_DATA_INDICATION, skb, NULL); /* Drop reference count - see ircomm_tty_data_indication(). */ @@ -241,15 +241,15 @@ static int ircomm_lmp_data_indication(void *instance, void *sap, } /* - * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size, + * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size, * max_header_size, skb) * * Connection has been confirmed by peer device * */ static void ircomm_lmp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_seg_size, + struct qos_info *qos, + __u32 max_seg_size, __u8 max_header_size, struct sk_buff *skb) { @@ -312,7 +312,7 @@ static void ircomm_lmp_connect_indication(void *instance, void *sap, * Peer device has closed the connection, or the link went down for some * other reason */ -static void ircomm_lmp_disconnect_indication(void *instance, void *sap, +static void ircomm_lmp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { 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 @@ /********************************************************************* - * + * * Filename: ircomm_param.c * Version: 1.0 * Description: Parameter handling for the IrCOMM protocol @@ -8,24 +8,24 @@ * Created at: Mon Jun 7 10:25:11 1999 * Modified at: Sun Jan 30 14:32:03 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -41,23 +41,23 @@ #include <net/irda/ircomm_param.h> -static int ircomm_param_service_type(void *instance, irda_param_t *param, +static int ircomm_param_service_type(void *instance, irda_param_t *param, int get); -static int ircomm_param_port_type(void *instance, irda_param_t *param, +static int ircomm_param_port_type(void *instance, irda_param_t *param, int get); -static int ircomm_param_port_name(void *instance, irda_param_t *param, +static int ircomm_param_port_name(void *instance, irda_param_t *param, int get); -static int ircomm_param_service_type(void *instance, irda_param_t *param, +static int ircomm_param_service_type(void *instance, irda_param_t *param, int get); -static int ircomm_param_data_rate(void *instance, irda_param_t *param, +static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get); -static int ircomm_param_data_format(void *instance, irda_param_t *param, +static int ircomm_param_data_format(void *instance, irda_param_t *param, int get); -static int ircomm_param_flow_control(void *instance, irda_param_t *param, +static int ircomm_param_flow_control(void *instance, irda_param_t *param, int get); static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get); static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get); -static int ircomm_param_line_status(void *instance, irda_param_t *param, +static int ircomm_param_line_status(void *instance, irda_param_t *param, int get); static int ircomm_param_dte(void *instance, irda_param_t *param, int get); static 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[] = { static pi_major_info_t pi_major_call_table[] = { { pi_minor_call_table_common, 3 }, { pi_minor_call_table_non_raw, 6 }, - { pi_minor_call_table_9_wire, 3 } + { pi_minor_call_table_9_wire, 3 } /* { pi_minor_call_table_centronics } */ }; @@ -119,20 +119,20 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) spin_lock_irqsave(&self->spinlock, flags); - skb = self->ctrl_skb; + skb = self->ctrl_skb; if (!skb) { skb = alloc_skb(256, GFP_ATOMIC); if (!skb) { spin_unlock_irqrestore(&self->spinlock, flags); return -ENOMEM; } - + skb_reserve(skb, self->max_header_size); self->ctrl_skb = skb; } - /* + /* * Inserting is a little bit tricky since we don't know how much - * room we will need. But this should hopefully work OK + * room we will need. But this should hopefully work OK */ count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), &ircomm_param_info); @@ -162,7 +162,7 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) * query and then the remote device sends its initial parameters * */ -static int ircomm_param_service_type(void *instance, irda_param_t *param, +static int ircomm_param_service_type(void *instance, irda_param_t *param, int get) { 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, /* Find all common service types */ service_type &= self->service_type; if (!service_type) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), No common service type to use!\n", __FUNCTION__ ); return -1; } @@ -198,12 +198,12 @@ static int ircomm_param_service_type(void *instance, irda_param_t *param, else if (service_type & IRCOMM_3_WIRE_RAW) self->settings.service_type = IRCOMM_3_WIRE_RAW; - IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ , + IRDA_DEBUG(0, "%s(), resulting service type=0x%02x\n", __FUNCTION__ , self->settings.service_type); - /* + /* * Now the line is ready for some communication. Check if we are a - * server, and send over some initial parameters. + * server, and send over some initial parameters. * Client do it in ircomm_tty_state_setup(). * Note : we may get called from ircomm_tty_getvalue_confirm(), * 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) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) param->pv.i = IRCOMM_SERIAL; else { self->settings.port_type = (__u8) param->pv.i; - IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ , + IRDA_DEBUG(0, "%s(), port type=%d\n", __FUNCTION__ , self->settings.port_type); } return 0; @@ -256,7 +256,7 @@ static int ircomm_param_port_type(void *instance, irda_param_t *param, int get) static int ircomm_param_port_name(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -279,7 +279,7 @@ static int ircomm_param_port_name(void *instance, irda_param_t *param, int get) static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -287,7 +287,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) param->pv.i = self->settings.data_rate; else self->settings.data_rate = param->pv.i; - + IRDA_DEBUG(2, "%s(), data rate = %d\n", __FUNCTION__ , param->pv.i); return 0; @@ -299,7 +299,7 @@ static int ircomm_param_data_rate(void *instance, irda_param_t *param, int get) * Exchange data format to be used in this settings * */ -static int ircomm_param_data_format(void *instance, irda_param_t *param, +static int ircomm_param_data_format(void *instance, irda_param_t *param, int get) { 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, param->pv.i = self->settings.data_format; else self->settings.data_format = (__u8) param->pv.i; - + return 0; } @@ -321,14 +321,14 @@ static int ircomm_param_data_format(void *instance, irda_param_t *param, * Exchange flow control settings to be used in this settings * */ -static int ircomm_param_flow_control(void *instance, irda_param_t *param, +static int ircomm_param_flow_control(void *instance, irda_param_t *param, int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) param->pv.i = self->settings.flow_control; else @@ -351,7 +351,7 @@ static int ircomm_param_xon_xoff(void *instance, irda_param_t *param, int get) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) { param->pv.i = self->settings.xonxoff[0]; 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) self->settings.xonxoff[1] = (__u16) param->pv.i >> 8; } - IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ , + IRDA_DEBUG(0, "%s(), XON/XOFF = 0x%02x,0x%02x\n", __FUNCTION__ , param->pv.i & 0xff, param->pv.i >> 8); return 0; @@ -378,7 +378,7 @@ static int ircomm_param_enq_ack(void *instance, irda_param_t *param, int get) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - + if (get) { param->pv.i = self->settings.enqack[0]; 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) /* * Function ircomm_param_line_status (self, param) * - * + * * */ -static int ircomm_param_line_status(void *instance, irda_param_t *param, +static int ircomm_param_line_status(void *instance, irda_param_t *param, int get) { 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) dte = (__u8) param->pv.i; self->settings.dce = 0; - + if (dte & IRCOMM_DELTA_DTR) self->settings.dce |= (IRCOMM_DELTA_DSR| IRCOMM_DELTA_RI | @@ -436,7 +436,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get) self->settings.dce |= (IRCOMM_DSR| IRCOMM_RI | IRCOMM_CD); - + if (dte & IRCOMM_DELTA_RTS) self->settings.dce |= IRCOMM_DELTA_CTS; if (dte & IRCOMM_RTS) @@ -455,7 +455,7 @@ static int ircomm_param_dte(void *instance, irda_param_t *param, int get) /* * Function ircomm_param_dce (instance, param) * - * + * * */ static int ircomm_param_dce(void *instance, irda_param_t *param, int get) diff --git a/net/irda/ircomm/ircomm_ttp.c b/net/irda/ircomm/ircomm_ttp.c index d98bf3570d29..bb06ebaadd16 100644 --- a/net/irda/ircomm/ircomm_ttp.c +++ b/net/irda/ircomm/ircomm_ttp.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_ttp.c * Version: 1.0 * Description: Interface between IrCOMM and IrTTP @@ -8,25 +8,25 @@ * Created at: Sun Jun 6 20:48:27 1999 * Modified at: Mon Dec 13 11:35:13 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -43,8 +43,8 @@ static int ircomm_ttp_data_indication(void *instance, void *sap, struct sk_buff *skb); static void ircomm_ttp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_sdu_size, + struct qos_info *qos, + __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb); static void ircomm_ttp_connect_indication(void *instance, void *sap, @@ -54,25 +54,25 @@ static void ircomm_ttp_connect_indication(void *instance, void *sap, struct sk_buff *skb); static void ircomm_ttp_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd); -static void ircomm_ttp_disconnect_indication(void *instance, void *sap, +static void ircomm_ttp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb); static int ircomm_ttp_data_request(struct ircomm_cb *self, - struct sk_buff *skb, + struct sk_buff *skb, int clen); -static int ircomm_ttp_connect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_connect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info); static int ircomm_ttp_connect_response(struct ircomm_cb *self, struct sk_buff *userdata); -static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info); /* * Function ircomm_open_tsap (self) * - * + * * */ int ircomm_open_tsap(struct ircomm_cb *self) @@ -113,11 +113,11 @@ int ircomm_open_tsap(struct ircomm_cb *self) /* * Function ircomm_ttp_connect_request (self, userdata) * - * + * * */ -static int ircomm_ttp_connect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_connect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { int ret = 0; @@ -129,16 +129,16 @@ static int ircomm_ttp_connect_request(struct ircomm_cb *self, skb_get(userdata); ret = irttp_connect_request(self->tsap, info->dlsap_sel, - info->saddr, info->daddr, NULL, - TTP_SAR_DISABLE, userdata); + info->saddr, info->daddr, NULL, + TTP_SAR_DISABLE, userdata); return ret; -} +} /* * Function ircomm_ttp_connect_response (self, skb) * - * + * * */ static int ircomm_ttp_connect_response(struct ircomm_cb *self, @@ -147,7 +147,7 @@ static int ircomm_ttp_connect_response(struct ircomm_cb *self, int ret; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + /* Don't forget to refcount it - should be NULL anyway */ if(userdata) skb_get(userdata); @@ -160,14 +160,14 @@ static int ircomm_ttp_connect_response(struct ircomm_cb *self, /* * Function ircomm_ttp_data_request (self, userdata) * - * Send IrCOMM data to IrTTP layer. Currently we do not try to combine - * control data with pure data, so they will be sent as separate frames. + * Send IrCOMM data to IrTTP layer. Currently we do not try to combine + * control data with pure data, so they will be sent as separate frames. * Should not be a big problem though, since control frames are rare. But - * some of them are sent after connection establishment, so this can + * some of them are sent after connection establishment, so this can * increase the latency a bit. */ static int ircomm_ttp_data_request(struct ircomm_cb *self, - struct sk_buff *skb, + struct sk_buff *skb, int clen) { int ret; @@ -176,7 +176,7 @@ static int ircomm_ttp_data_request(struct ircomm_cb *self, IRDA_DEBUG(2, "%s(), clen=%d\n", __FUNCTION__ , clen); - /* + /* * Insert clen field, currently we either send data only, or control * only frames, to make things easier and avoid queueing */ @@ -210,7 +210,7 @@ static int ircomm_ttp_data_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); @@ -224,8 +224,8 @@ static int ircomm_ttp_data_indication(void *instance, void *sap, } static void ircomm_ttp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_sdu_size, + struct qos_info *qos, + __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { @@ -261,7 +261,7 @@ out: * Function ircomm_ttp_connect_indication (instance, sap, qos, max_sdu_size, * max_header_size, skb) * - * + * * */ static void ircomm_ttp_connect_indication(void *instance, void *sap, @@ -301,11 +301,11 @@ out: /* * Function ircomm_ttp_disconnect_request (self, userdata, info) * - * + * * */ -static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, - struct sk_buff *userdata, +static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, + struct sk_buff *userdata, struct ircomm_info *info) { int ret; @@ -322,10 +322,10 @@ static int ircomm_ttp_disconnect_request(struct ircomm_cb *self, /* * Function ircomm_ttp_disconnect_indication (instance, sap, reason, skb) * - * + * * */ -static void ircomm_ttp_disconnect_indication(void *instance, void *sap, +static void ircomm_ttp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { @@ -361,7 +361,7 @@ static void ircomm_ttp_flow_indication(void *instance, void *sap, IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); - + if (self->notify.flow_indication) self->notify.flow_indication(self->notify.instance, self, cmd); } 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 @@ /********************************************************************* - * + * * Filename: ircomm_tty.c * Version: 1.0 * Description: IrCOMM serial TTY driver @@ -9,25 +9,25 @@ * Modified at: Wed Feb 23 00:09:02 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: serial.c and previous IrCOMM work by Takahide Higuchi - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/init.h> @@ -69,7 +69,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap, struct sk_buff *skb); static int ircomm_tty_control_indication(void *instance, void *sap, struct sk_buff *skb); -static void ircomm_tty_flow_indication(void *instance, void *sap, +static void ircomm_tty_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd); #ifdef CONFIG_PROC_FS static 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) driver = alloc_tty_driver(IRCOMM_TTY_PORTS); if (!driver) return -ENOMEM; - ircomm_tty = hashbin_new(HB_LOCK); + ircomm_tty = hashbin_new(HB_LOCK); if (ircomm_tty == NULL) { IRDA_ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__); put_tty_driver(driver); @@ -163,11 +163,11 @@ static void __exit ircomm_tty_cleanup(void) { int ret; - IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); ret = tty_unregister_driver(driver); - if (ret) { - IRDA_ERROR("%s(), failed to unregister driver\n", + if (ret) { + IRDA_ERROR("%s(), failed to unregister driver\n", __FUNCTION__); return; } @@ -179,7 +179,7 @@ static void __exit ircomm_tty_cleanup(void) /* * Function ircomm_startup (self) * - * + * * */ static int ircomm_tty_startup(struct ircomm_tty_cb *self) @@ -203,17 +203,17 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) /* These callbacks we must handle ourselves */ notify.data_indication = ircomm_tty_data_indication; notify.udata_indication = ircomm_tty_control_indication; - notify.flow_indication = ircomm_tty_flow_indication; + notify.flow_indication = ircomm_tty_flow_indication; /* Use the ircomm_tty interface for these ones */ - notify.disconnect_indication = ircomm_tty_disconnect_indication; + notify.disconnect_indication = ircomm_tty_disconnect_indication; notify.connect_confirm = ircomm_tty_connect_confirm; - notify.connect_indication = ircomm_tty_connect_indication; + notify.connect_indication = ircomm_tty_connect_indication; strlcpy(notify.name, "ircomm_tty", sizeof(notify.name)); notify.instance = self; if (!self->ircomm) { - self->ircomm = ircomm_open(¬ify, self->service_type, + self->ircomm = ircomm_open(¬ify, self->service_type, self->line); } if (!self->ircomm) @@ -237,10 +237,10 @@ err: /* * Function ircomm_block_til_ready (self, filp) * - * + * * */ -static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, +static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, struct file *filp) { DECLARE_WAITQUEUE(wait, current); @@ -248,7 +248,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, int do_clocal = 0, extra_count = 0; unsigned long flags; struct tty_struct *tty; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); tty = self->tty; @@ -256,7 +256,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, /* * If non-blocking mode is set, or the port is not enabled, * then make the check up front and then exit. - */ + */ if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ /* nonblock mode is set or port is not enabled */ self->flags |= ASYNC_NORMAL_ACTIVE; @@ -268,17 +268,17 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ ); do_clocal = 1; } - + /* Wait for carrier detect and the line to become * free (i.e., not in use by the callout). While we are in * this loop, self->open_count is dropped by one, so that * mgsl_close() knows when to free things. We restore it upon * exit, either normal or abnormal. */ - + retval = 0; add_wait_queue(&self->open_wait, &wait); - + IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", __FILE__,__LINE__, tty->driver->name, self->open_count ); @@ -290,7 +290,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, } spin_unlock_irqrestore(&self->spinlock, flags); self->blocked_open++; - + while (1) { if (tty->termios->c_cflag & CBAUD) { /* 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, * I don't see the point (and I see the deadlock). * Jean II */ self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR; - + ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + current->state = TASK_INTERRUPTIBLE; - + if (tty_hung_up_p(filp) || !test_bit(ASYNC_B_INITIALIZED, &self->flags)) { retval = (self->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS; break; } - - /* + + /* * Check if link is ready now. Even if CLOCAL is * specified, we cannot return before the IrCOMM link is - * ready + * ready */ - if (!test_bit(ASYNC_B_CLOSING, &self->flags) && - (do_clocal || (self->settings.dce & IRCOMM_CD)) && + if (!test_bit(ASYNC_B_CLOSING, &self->flags) && + (do_clocal || (self->settings.dce & IRCOMM_CD)) && self->state == IRCOMM_TTY_READY) { - break; + break; } - + if (signal_pending(current)) { retval = -ERESTARTSYS; break; } - + IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", __FILE__,__LINE__, tty->driver->name, self->open_count ); - + schedule(); } - + __set_current_state(TASK_RUNNING); remove_wait_queue(&self->open_wait, &wait); - + if (extra_count) { /* ++ is not atomic, so this should be protected - Jean II */ spin_lock_irqsave(&self->spinlock, flags); @@ -344,14 +344,14 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, spin_unlock_irqrestore(&self->spinlock, flags); } self->blocked_open--; - + IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", __FILE__,__LINE__, tty->driver->name, self->open_count); - + if (!retval) self->flags |= ASYNC_NORMAL_ACTIVE; - - return retval; + + return retval; } /* @@ -384,7 +384,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) IRDA_ERROR("%s(), kmalloc failed!\n", __FUNCTION__); return -ENOMEM; } - + self->magic = IRCOMM_TTY_MAGIC; self->flow = FLOW_STOP; @@ -398,13 +398,13 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) /* Init some important stuff */ init_timer(&self->watchdog_timer); init_waitqueue_head(&self->open_wait); - init_waitqueue_head(&self->close_wait); + init_waitqueue_head(&self->close_wait); spin_lock_init(&self->spinlock); - /* + /* * Force TTY into raw mode by default which is usually what * we want for IrCOMM and IrLPT. This way applications will - * not have to twiddle with printcap etc. + * not have to twiddle with printcap etc. */ tty->termios->c_iflag = 0; tty->termios->c_oflag = 0; @@ -420,7 +420,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) self->tty = tty; spin_unlock_irqrestore(&self->spinlock, flags); - IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name, + IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name, self->line, self->open_count); /* 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) ret = ircomm_tty_block_til_ready(self, filp); if (ret) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), returning after block_til_ready with %d\n", __FUNCTION__ , ret); @@ -519,7 +519,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) * serial port won't be shutdown. */ IRDA_DEBUG(0, "%s(), bad serial port count; " - "tty->count is 1, state->count is %d\n", __FUNCTION__ , + "tty->count is 1, state->count is %d\n", __FUNCTION__ , self->open_count); self->open_count = 1; } @@ -546,7 +546,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) spin_unlock_irqrestore(&self->spinlock, flags); /* - * Now we wait for the transmit buffer to clear; and we notify + * Now we wait for the transmit buffer to clear; and we notify * the line discipline to only process XON/XOFF characters. */ tty->closing = 1; @@ -576,7 +576,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) /* * Function ircomm_tty_flush_buffer (tty) * - * + * * */ static void ircomm_tty_flush_buffer(struct tty_struct *tty) @@ -586,9 +586,9 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - /* - * Let do_softint() do this to avoid race condition with - * do_softint() ;-) + /* + * Let do_softint() do this to avoid race condition with + * do_softint() ;-) */ schedule_work(&self->tqueue); } @@ -597,7 +597,7 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty) * Function ircomm_tty_do_softint (work) * * We use this routine to give the write wakeup to the user at at a - * safe time (as fast as possible after write have completed). This + * safe time (as fast as possible after write have completed). This * can be compared to the Tx interrupt. */ static void ircomm_tty_do_softint(struct work_struct *work) @@ -638,7 +638,7 @@ static void ircomm_tty_do_softint(struct work_struct *work) /* Unlink transmit buffer */ spin_lock_irqsave(&self->spinlock, flags); - + skb = self->tx_skb; self->tx_skb = NULL; @@ -650,9 +650,9 @@ static void ircomm_tty_do_softint(struct work_struct *work) /* Drop reference count - see ircomm_ttp_data_request(). */ dev_kfree_skb(skb); } - + /* Check if user (still) wants to be waken up */ - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) { (tty->ldisc.write_wakeup)(tty); @@ -717,12 +717,12 @@ static int ircomm_tty_write(struct tty_struct *tty, /* Fetch current transmit buffer */ skb = self->tx_skb; - /* + /* * Send out all the data we get, possibly as multiple fragmented * frames, but this will only happen if the data is larger than the * max data size. The normal case however is just the opposite, and * this function may be called multiple times, and will then actually - * defragment the data and send it out as one packet as soon as + * defragment the data and send it out as one packet as soon as * possible, but at a safer point in time */ while (count) { @@ -731,16 +731,16 @@ static int ircomm_tty_write(struct tty_struct *tty, /* Adjust data size to the max data size */ if (size > self->max_data_size) size = self->max_data_size; - - /* + + /* * Do we already have a buffer ready for transmit, or do - * we need to allocate a new frame + * we need to allocate a new frame */ - if (skb) { - /* - * Any room for more data at the end of the current + if (skb) { + /* + * Any room for more data at the end of the current * transmit buffer? Cannot use skb_tailroom, since - * dev_alloc_skb gives us a larger skb than we + * dev_alloc_skb gives us a larger skb than we * requested * Note : use tx_data_size, because max_data_size * may have changed and we don't want to overwrite @@ -751,8 +751,8 @@ static int ircomm_tty_write(struct tty_struct *tty, if (size > tailroom) size = tailroom; } else { - /* - * Current transmit frame is full, so break + /* + * Current transmit frame is full, so break * out, so we can send it as soon as possible */ break; @@ -782,15 +782,15 @@ static int ircomm_tty_write(struct tty_struct *tty, spin_unlock_irqrestore(&self->spinlock, flags); - /* + /* * Schedule a new thread which will transmit the frame as soon * as possible, but at a safe point in time. We do this so the * "user" can give us data multiple times, as PPP does (because of * its 256 byte tx buffer). We will then defragment and send out - * all this data as one single packet. + * all this data as one single packet. */ schedule_work(&self->tqueue); - + return len; } @@ -846,7 +846,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned long orig_jiffies, poll_time; unsigned long flags; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -876,7 +876,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) * * This routine notifies the tty driver that input buffers for the line * discipline are close to full, and it should somehow signal that no - * more characters should be sent to the tty. + * more characters should be sent to the tty. */ static void ircomm_tty_throttle(struct tty_struct *tty) { @@ -890,16 +890,16 @@ static void ircomm_tty_throttle(struct tty_struct *tty) /* Software flow control? */ if (I_IXOFF(tty)) ircomm_tty_send_xchar(tty, STOP_CHAR(tty)); - + /* Hardware flow control? */ if (tty->termios->c_cflag & CRTSCTS) { self->settings.dte &= ~IRCOMM_RTS; self->settings.dte |= IRCOMM_DELTA_RTS; - + ircomm_param_request(self, IRCOMM_DTE, TRUE); } - ircomm_flow_request(self->ircomm, FLOW_STOP); + ircomm_flow_request(self->ircomm, FLOW_STOP); } /* @@ -930,7 +930,7 @@ static void ircomm_tty_unthrottle(struct tty_struct *tty) ircomm_param_request(self, IRCOMM_DTE, TRUE); IRDA_DEBUG(1, "%s(), FLOW_START\n", __FUNCTION__ ); } - ircomm_flow_request(self->ircomm, FLOW_START); + ircomm_flow_request(self->ircomm, FLOW_START); } /* @@ -975,7 +975,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) spin_lock_irqsave(&self->spinlock, flags); del_timer(&self->watchdog_timer); - + /* Free parameter buffer */ if (self->ctrl_skb) { dev_kfree_skb(self->ctrl_skb); @@ -1001,7 +1001,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) * * This routine notifies the tty driver that it should hangup the tty * device. - * + * */ static void ircomm_tty_hangup(struct tty_struct *tty) { @@ -1044,7 +1044,7 @@ static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch) * Function ircomm_tty_start (tty) * * This routine notifies the tty driver that it resume sending - * characters to the tty device. + * characters to the tty device. */ void ircomm_tty_start(struct tty_struct *tty) { @@ -1057,9 +1057,9 @@ void ircomm_tty_start(struct tty_struct *tty) * Function ircomm_tty_stop (tty) * * This routine notifies the tty driver that it should stop outputting - * characters to the tty device. + * characters to the tty device. */ -static void ircomm_tty_stop(struct tty_struct *tty) +static void ircomm_tty_stop(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; @@ -1094,14 +1094,14 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) /*wake_up_interruptible(&self->delta_msr_wait);*/ } if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), ircomm%d CD now %s...\n", __FUNCTION__ , self->line, (status & IRCOMM_CD) ? "on" : "off"); if (status & IRCOMM_CD) { wake_up_interruptible(&self->open_wait); } else { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), Doing serial hangup..\n", __FUNCTION__ ); if (tty) tty_hangup(tty); @@ -1113,10 +1113,10 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) if (self->flags & ASYNC_CTS_FLOW) { if (tty->hw_stopped) { if (status & IRCOMM_CTS) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), CTS tx start...\n", __FUNCTION__ ); tty->hw_stopped = 0; - + /* Wake up processes blocked on open */ wake_up_interruptible(&self->open_wait); @@ -1125,7 +1125,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) } } else { if (!(status & IRCOMM_CTS)) { - IRDA_DEBUG(2, + IRDA_DEBUG(2, "%s(), CTS tx stop...\n", __FUNCTION__ ); tty->hw_stopped = 1; } @@ -1145,7 +1145,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap, struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); @@ -1155,10 +1155,10 @@ static int ircomm_tty_data_indication(void *instance, void *sap, return 0; } - /* + /* * If we receive data when hardware is stopped then something is wrong. * We try to poll the peers line settings to check if we are up todate. - * Devices like WinCE can do this, and since they don't send any + * Devices like WinCE can do this, and since they don't send any * params, we can just as well declare the hardware for running. */ if (self->tty->hw_stopped && (self->flow == FLOW_START)) { @@ -1170,9 +1170,9 @@ static int ircomm_tty_data_indication(void *instance, void *sap, ircomm_tty_link_established(self); } - /* + /* * Just give it over to the line discipline. There is no need to - * involve the flip buffers, since we are not running in an interrupt + * involve the flip buffers, since we are not running in an interrupt * handler */ 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, int clen; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); clen = skb->data[0]; - irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen), + irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen), &ircomm_param_info); /* No need to kfree_skb - see ircomm_control_indication() */ @@ -1217,7 +1217,7 @@ static int ircomm_tty_control_indication(void *instance, void *sap, * transmission of data. We just mark the hardware as stopped, and wait * for IrTTP to notify us that things are OK again. */ -static void ircomm_tty_flow_indication(void *instance, void *sap, +static void ircomm_tty_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -1247,7 +1247,7 @@ static void ircomm_tty_flow_indication(void *instance, void *sap, static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) { - int ret=0; + int ret=0; ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]); @@ -1260,37 +1260,37 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) ret += sprintf(buf+ret, "3_WIRE_RAW"); else ret += sprintf(buf+ret, "No common service type!\n"); - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Port name: %s\n", self->settings.port_name); - ret += sprintf(buf+ret, "DTE status: "); - if (self->settings.dte & IRCOMM_RTS) - ret += sprintf(buf+ret, "RTS|"); - if (self->settings.dte & IRCOMM_DTR) - ret += sprintf(buf+ret, "DTR|"); + ret += sprintf(buf+ret, "DTE status: "); + if (self->settings.dte & IRCOMM_RTS) + ret += sprintf(buf+ret, "RTS|"); + if (self->settings.dte & IRCOMM_DTR) + ret += sprintf(buf+ret, "DTR|"); if (self->settings.dte) ret--; /* remove the last | */ - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "DCE status: "); - if (self->settings.dce & IRCOMM_CTS) - ret += sprintf(buf+ret, "CTS|"); - if (self->settings.dce & IRCOMM_DSR) - ret += sprintf(buf+ret, "DSR|"); - if (self->settings.dce & IRCOMM_CD) - ret += sprintf(buf+ret, "CD|"); - if (self->settings.dce & IRCOMM_RI) - ret += sprintf(buf+ret, "RI|"); + if (self->settings.dce & IRCOMM_CTS) + ret += sprintf(buf+ret, "CTS|"); + if (self->settings.dce & IRCOMM_DSR) + ret += sprintf(buf+ret, "DSR|"); + if (self->settings.dce & IRCOMM_CD) + ret += sprintf(buf+ret, "CD|"); + if (self->settings.dce & IRCOMM_RI) + ret += sprintf(buf+ret, "RI|"); if (self->settings.dce) ret--; /* remove the last | */ - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Configuration: "); if (!self->settings.null_modem) ret += sprintf(buf+ret, "DTE <-> DCE\n"); else - ret += sprintf(buf+ret, + ret += sprintf(buf+ret, "DTE <-> DTE (null modem emulation)\n"); 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) ret += sprintf(buf+ret, "ENQ_ACK_OUT|"); if (self->settings.flow_control) ret--; /* remove the last | */ - ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Flags: "); if (self->flags & ASYNC_CTS_FLOW) @@ -1333,25 +1333,25 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) ret--; /* remove the last | */ ret += sprintf(buf+ret, "\n"); - ret += sprintf(buf+ret, "Role: %s\n", self->client ? + ret += sprintf(buf+ret, "Role: %s\n", self->client ? "client" : "server"); ret += sprintf(buf+ret, "Open count: %d\n", self->open_count); ret += sprintf(buf+ret, "Max data size: %d\n", self->max_data_size); ret += sprintf(buf+ret, "Max header size: %d\n", self->max_header_size); - + if (self->tty) - ret += sprintf(buf+ret, "Hardware: %s\n", + ret += sprintf(buf+ret, "Hardware: %s\n", self->tty->hw_stopped ? "Stopped" : "Running"); - ret += sprintf(buf+ret, "\n"); - return ret; + ret += sprintf(buf+ret, "\n"); + return ret; } /* * Function ircomm_tty_read_proc (buf, start, offset, len, eof, unused) * - * + * * */ #ifdef CONFIG_PROC_FS @@ -1359,8 +1359,8 @@ static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused) { struct ircomm_tty_cb *self; - int count = 0, l; - off_t begin = 0; + int count = 0, l; + off_t begin = 0; unsigned long flags; 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, if (self->magic != IRCOMM_TTY_MAGIC) break; - l = ircomm_tty_line_info(self, buf + count); - count += l; - if (count+begin > offset+len) - goto done; - if (count+begin < offset) { - begin += count; - count = 0; - } - + l = ircomm_tty_line_info(self, buf + count); + count += l; + if (count+begin > offset+len) + goto done; + if (count+begin < offset) { + begin += count; + count = 0; + } + self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty); - } - *eof = 1; + } + *eof = 1; done: spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags); - if (offset >= count+begin) - return 0; - *start = buf + (offset-begin); - return ((len < begin+count-offset) ? len : begin+count-offset); + if (offset >= count+begin) + return 0; + *start = buf + (offset-begin); + return ((len < begin+count-offset) ? len : begin+count-offset); } #endif /* CONFIG_PROC_FS */ diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c index 99f5eddbb4b7..8d7ba93e4e09 100644 --- a/net/irda/ircomm/ircomm_tty_attach.c +++ b/net/irda/ircomm/ircomm_tty_attach.c @@ -1,32 +1,32 @@ /********************************************************************* - * + * * Filename: ircomm_tty_attach.c - * Version: + * Version: * Description: Code for attaching the serial driver to IrCOMM * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Jun 5 17:42:00 1999 * Modified at: Tue Jan 4 14:20:49 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/sched.h> @@ -50,35 +50,35 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self); static void ircomm_tty_discovery_indication(discinfo_t *discovery, DISCOVERY_MODE mode, void *priv); -static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, +static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, struct ias_value *value, void *priv); static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, int timeout); static void ircomm_tty_watchdog_timer_expired(void *data); -static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_search(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_search(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); -static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info); char *ircomm_tty_state[] = { @@ -111,7 +111,7 @@ static char *ircomm_tty_event[] = { #endif /* CONFIG_IRDA_DEBUG */ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, - struct sk_buff *skb, struct ircomm_tty_info *info) = + struct sk_buff *skb, struct ircomm_tty_info *info) = { ircomm_tty_state_idle, ircomm_tty_state_search, @@ -125,7 +125,7 @@ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, * Function ircomm_tty_attach_cable (driver) * * Try to attach cable (IrCOMM link). This function will only return - * when the link has been connected, or if an error condition occurs. + * when the link has been connected, or if an error condition occurs. * If success, the return value is the resulting service type. */ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) @@ -135,7 +135,7 @@ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - /* Check if somebody has already connected to us */ + /* Check if somebody has already connected to us */ if (ircomm_is_connected(self->ircomm)) { IRDA_DEBUG(0, "%s(), already connected!\n", __FUNCTION__ ); return 0; @@ -177,7 +177,7 @@ void ircomm_tty_detach_cable(struct ircomm_tty_cb *self) self->skey = NULL; } - if (self->iriap) { + if (self->iriap) { iriap_close(self->iriap); self->iriap = NULL; } @@ -212,7 +212,7 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - + /* Compute hint bits based on service */ hints = irlmp_service_to_hint(S_COMM); if (self->service_type & IRCOMM_3_WIRE_RAW) @@ -234,19 +234,19 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self) if (self->service_type & IRCOMM_3_WIRE_RAW) { /* Register IrLPT with LM-IAS */ self->obj = irias_new_object("IrLPT", IAS_IRLPT_ID); - irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel", + irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel", self->slsap_sel, IAS_KERNEL_ATTR); } else { /* Register IrCOMM with LM-IAS */ self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID); - irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel", + irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel", self->slsap_sel, IAS_KERNEL_ATTR); - + /* Code the parameters into the buffer */ - irda_param_pack(oct_seq, "bbbbbb", + irda_param_pack(oct_seq, "bbbbbb", IRCOMM_SERVICE_TYPE, 1, self->service_type, IRCOMM_PORT_TYPE, 1, IRCOMM_SERIAL); - + /* Register parameters with LM-IAS */ irias_add_octseq_attrib(self->obj, "Parameters", oct_seq, 6, IAS_KERNEL_ATTR); @@ -302,23 +302,23 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self) IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - if (self->service_type & IRCOMM_3_WIRE_RAW) + if (self->service_type & IRCOMM_3_WIRE_RAW) return 0; - /* - * Set default values, but only if the application for some reason + /* + * Set default values, but only if the application for some reason * haven't set them already */ - IRDA_DEBUG(2, "%s(), data-rate = %d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), data-rate = %d\n", __FUNCTION__ , self->settings.data_rate); if (!self->settings.data_rate) self->settings.data_rate = 9600; - IRDA_DEBUG(2, "%s(), data-format = %d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), data-format = %d\n", __FUNCTION__ , self->settings.data_format); if (!self->settings.data_format) self->settings.data_format = IRCOMM_WSIZE_8; /* 8N1 */ - IRDA_DEBUG(2, "%s(), flow-control = %d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), flow-control = %d\n", __FUNCTION__ , self->settings.flow_control); /*self->settings.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/ @@ -330,7 +330,7 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self) ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE); ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE); - + /* For a 3 wire service, we just flush the last parameter and return */ if (self->settings.service_type == IRCOMM_3_WIRE) { ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); @@ -342,10 +342,10 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self) #if 0 ircomm_param_request(self, IRCOMM_XON_XOFF, FALSE); ircomm_param_request(self, IRCOMM_ENQ_ACK, FALSE); -#endif +#endif /* Notify peer that we are ready to receive data */ ircomm_param_request(self, IRCOMM_DTE, TRUE); - + return 0; } @@ -388,8 +388,8 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery, self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty); while (self != NULL) { IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - - ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION, + + ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION, NULL, &info); self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty); @@ -402,7 +402,7 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery, * Link disconnected * */ -void ircomm_tty_disconnect_indication(void *instance, void *sap, +void ircomm_tty_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { @@ -422,7 +422,7 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap, /* Stop data transfers */ self->tty->hw_stopped = 1; - ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, + ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, NULL); } @@ -432,8 +432,8 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap, * Got result from the IAS query we make * */ -static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, - struct ias_value *value, +static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, + struct ias_value *value, void *priv) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv; @@ -454,18 +454,18 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, } switch (value->type) { - case IAS_OCT_SEQ: + case IAS_OCT_SEQ: IRDA_DEBUG(2, "%s(), got octet sequence\n", __FUNCTION__ ); irda_param_extract_all(self, value->t.oct_seq, value->len, &ircomm_param_info); - ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL, + ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL, NULL); break; case IAS_INTEGER: - /* Got LSAP selector */ - IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __FUNCTION__ , + /* Got LSAP selector */ + IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __FUNCTION__ , value->t.integer); if (value->t.integer == -1) { @@ -491,10 +491,10 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, * Connection confirmed * */ -void ircomm_tty_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_data_size, - __u8 max_header_size, +void ircomm_tty_connect_confirm(void *instance, void *sap, + struct qos_info *qos, + __u32 max_data_size, + __u8 max_header_size, struct sk_buff *skb) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -515,16 +515,16 @@ void ircomm_tty_connect_confirm(void *instance, void *sap, } /* - * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size, + * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size, * skb) * * we are discovered and being requested to connect by remote device ! * */ -void ircomm_tty_connect_indication(void *instance, void *sap, - struct qos_info *qos, +void ircomm_tty_connect_indication(void *instance, void *sap, + struct qos_info *qos, __u32 max_data_size, - __u8 max_header_size, + __u8 max_header_size, struct sk_buff *skb) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; @@ -542,8 +542,8 @@ void ircomm_tty_connect_indication(void *instance, void *sap, clen = skb->data[0]; if (clen) - irda_param_extract_all(self, skb->data+1, - IRDA_MIN(skb->len, clen), + irda_param_extract_all(self, skb->data+1, + IRDA_MIN(skb->len, clen), &ircomm_param_info); ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL); @@ -566,14 +566,14 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) if (!self->tty) return; - + del_timer(&self->watchdog_timer); - /* + /* * IrCOMM link is now up, and if we are not using hardware * flow-control, then declare the hardware as running. Otherwise we * will have to wait for the peer device (DCE) to raise the CTS - * line. + * line. */ if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) { IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __FUNCTION__ ); @@ -582,7 +582,7 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) IRDA_DEBUG(1, "%s(), starting hardware!\n", __FUNCTION__ ); self->tty->hw_stopped = 0; - + /* Wake up processes blocked on open */ wake_up_interruptible(&self->open_wait); } @@ -593,8 +593,8 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) /* * Function ircomm_tty_start_watchdog_timer (self, timeout) * - * Start the watchdog timer. This timer is used to make sure that any - * connection attempt is successful, and if not, we will retry after + * Start the watchdog timer. This timer is used to make sure that any + * connection attempt is successful, and if not, we will retry after * the timeout */ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, @@ -616,7 +616,7 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, static void ircomm_tty_watchdog_timer_expired(void *data) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -633,14 +633,14 @@ static void ircomm_tty_watchdog_timer_expired(void *data) * */ int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, - struct sk_buff *skb, struct ircomm_tty_info *info) + struct sk_buff *skb, struct ircomm_tty_info *info) { IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ , ircomm_tty_state[self->state], ircomm_tty_event[event]); - + return (*state[self->state])(self, event, skb, info); } @@ -656,7 +656,7 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_ IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __FUNCTION__ , ircomm_tty_state[self->state], self->service_type); */ self->state = state; @@ -668,9 +668,9 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_ * Just hanging around * */ -static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -679,10 +679,10 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_ATTACH_CABLE: - /* Try to discover any remote devices */ + /* Try to discover any remote devices */ ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); - + irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); break; case IRCOMM_TTY_DISCOVERY_INDICATION: @@ -701,7 +701,7 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, iriap_getvaluebyclass_request(self->iriap, self->saddr, self->daddr, "IrDA:IrCOMM", "Parameters"); - + ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); break; @@ -732,9 +732,9 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, * Trying to discover an IrCOMM device * */ -static int ircomm_tty_state_search(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_search(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -752,19 +752,19 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, __FUNCTION__); return -EBUSY; } - + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, ircomm_tty_getvalue_confirm); - + if (self->service_type == IRCOMM_3_WIRE_RAW) { iriap_getvaluebyclass_request(self->iriap, self->saddr, - self->daddr, "IrLPT", + self->daddr, "IrLPT", "IrDA:IrLMP:LsapSel"); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL); } else { iriap_getvaluebyclass_request(self->iriap, self->saddr, - self->daddr, - "IrDA:IrCOMM", + self->daddr, + "IrDA:IrCOMM", "Parameters"); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); @@ -783,7 +783,7 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, #if 1 /* Give up */ #else - /* Try to discover any remote devices */ + /* Try to discover any remote devices */ ircomm_tty_start_watchdog_timer(self, 3*HZ); irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); #endif @@ -805,9 +805,9 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, * Querying the remote LM-IAS for IrCOMM parameters * */ -static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -822,12 +822,12 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, __FUNCTION__); return -EBUSY; } - + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, ircomm_tty_getvalue_confirm); - iriap_getvaluebyclass_request(self->iriap, self->saddr, - self->daddr, "IrDA:IrCOMM", + iriap_getvaluebyclass_request(self->iriap, self->saddr, + self->daddr, "IrDA:IrCOMM", "IrDA:TinyTP:LsapSel"); ircomm_tty_start_watchdog_timer(self, 3*HZ); @@ -836,7 +836,7 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, case IRCOMM_TTY_WD_TIMER_EXPIRED: /* Go back to search mode */ ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); - ircomm_tty_start_watchdog_timer(self, 3*HZ); + ircomm_tty_start_watchdog_timer(self, 3*HZ); break; case IRCOMM_TTY_CONNECT_INDICATION: del_timer(&self->watchdog_timer); @@ -863,9 +863,9 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, * Query remote LM-IAS for the LSAP selector which we can connect to * */ -static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -877,7 +877,7 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, case IRCOMM_TTY_GOT_LSAPSEL: /* Connect to remote device */ ret = ircomm_connect_request(self->ircomm, self->dlsap_sel, - self->saddr, self->daddr, + self->saddr, self->daddr, NULL, self->service_type); ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_SETUP); @@ -912,9 +912,9 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, * Trying to connect * */ -static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -926,10 +926,10 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, case IRCOMM_TTY_CONNECT_CONFIRM: del_timer(&self->watchdog_timer); ircomm_tty_ias_unregister(self); - - /* + + /* * Send initial parameters. This will also send out queued - * parameters waiting for the connection to come up + * parameters waiting for the connection to come up */ ircomm_tty_send_initial_parameters(self); ircomm_tty_link_established(self); @@ -938,7 +938,7 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, case IRCOMM_TTY_CONNECT_INDICATION: del_timer(&self->watchdog_timer); ircomm_tty_ias_unregister(self); - + /* Accept connection */ ircomm_connect_response(self->ircomm, NULL); ircomm_tty_next_state(self, IRCOMM_TTY_READY); @@ -966,9 +966,9 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, * IrCOMM is now connected * */ -static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, - IRCOMM_TTY_EVENT event, - struct sk_buff *skb, +static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, + IRCOMM_TTY_EVENT event, + struct sk_buff *skb, struct ircomm_tty_info *info) { int ret = 0; @@ -976,7 +976,7 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, switch (event) { case IRCOMM_TTY_DATA_REQUEST: ret = ircomm_data_request(self->ircomm, skb); - break; + break; case IRCOMM_TTY_DETACH_CABLE: ircomm_disconnect_request(self->ircomm, NULL); ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index 75e39ea599d8..a5174e6e7ad3 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c @@ -1,31 +1,31 @@ /********************************************************************* - * + * * Filename: ircomm_tty_ioctl.c - * Version: - * Description: + * Version: + * Description: * 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> - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <linux/init.h> @@ -75,7 +75,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) } if (cflag & CSTOPB) cval |= IRCOMM_2_STOP_BIT; - + if (cflag & PARENB) cval |= IRCOMM_PARITY_ENABLE; if (!(cflag & PARODD)) @@ -88,7 +88,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) self->settings.data_rate = baud; ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); - + /* CTS flow control flag and modem status interrupts */ if (cflag & CRTSCTS) { self->flags |= ASYNC_CTS_FLOW; @@ -104,7 +104,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) self->flags &= ~ASYNC_CHECK_CD; else self->flags |= ASYNC_CHECK_CD; -#if 0 +#if 0 /* * Set up parity check flag */ @@ -113,7 +113,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) driver->read_status_mask |= LSR_FE | LSR_PE; if (I_BRKINT(driver->tty) || I_PARMRK(driver->tty)) driver->read_status_mask |= LSR_BI; - + /* * Characters to ignore */ @@ -124,17 +124,17 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) if (I_IGNBRK(self->tty)) { self->ignore_status_mask |= LSR_BI; /* - * If we're ignore parity and break indicators, ignore + * If we're ignore parity and break indicators, ignore * overruns too. (For real raw support). */ - if (I_IGNPAR(self->tty)) + if (I_IGNPAR(self->tty)) self->ignore_status_mask |= LSR_OE; } #endif self->settings.data_format = cval; ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE); - ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); + ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); } /* @@ -145,7 +145,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) * should be prepared to accept the case where old == NULL, and try to * do something rational. */ -void ircomm_tty_set_termios(struct tty_struct *tty, +void ircomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; @@ -153,8 +153,8 @@ void ircomm_tty_set_termios(struct tty_struct *tty, IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - if ((cflag == old_termios->c_cflag) && - (RELEVANT_IFLAG(tty->termios->c_iflag) == + if ((cflag == old_termios->c_cflag) && + (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { return; @@ -168,21 +168,21 @@ void ircomm_tty_set_termios(struct tty_struct *tty, self->settings.dte &= ~(IRCOMM_DTR|IRCOMM_RTS); ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + /* Handle transition away from B0 status */ if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { self->settings.dte |= IRCOMM_DTR; - if (!(tty->termios->c_cflag & CRTSCTS) || + if (!(tty->termios->c_cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) { self->settings.dte |= IRCOMM_RTS; } ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && - !(tty->termios->c_cflag & CRTSCTS)) + !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; ircomm_tty_start(tty); @@ -192,7 +192,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty, /* * Function ircomm_tty_tiocmget (tty, file) * - * + * * */ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) @@ -217,12 +217,12 @@ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) /* * Function ircomm_tty_tiocmset (tty, file, set, clear) * - * + * * */ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) -{ +{ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -249,21 +249,21 @@ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, self->settings.dte |= IRCOMM_DELTA_DTR; ircomm_param_request(self, IRCOMM_DTE, TRUE); - + return 0; } /* * Function get_serial_info (driver, retinfo) * - * + * * */ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, struct serial_struct __user *retinfo) { struct serial_struct info; - + if (!retinfo) return -EFAULT; @@ -277,11 +277,11 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, info.closing_wait = self->closing_wait; /* For compatibility */ - info.type = PORT_16550A; - info.port = 0; - info.irq = 0; + info.type = PORT_16550A; + info.port = 0; + info.irq = 0; info.xmit_fifo_size = 0; - info.hub6 = 0; + info.hub6 = 0; info.custom_divisor = 0; if (copy_to_user(retinfo, &info, sizeof(*retinfo))) @@ -293,7 +293,7 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, /* * Function set_serial_info (driver, new_info) * - * + * * */ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, @@ -311,7 +311,7 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, state = self old_state = *self; - + if (!capable(CAP_SYS_ADMIN)) { if ((new_serial.baud_base != state->settings.data_rate) || (new_serial.close_delay != state->close_delay) || @@ -368,10 +368,10 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, /* * Function ircomm_tty_ioctl (tty, file, cmd, arg) * - * + * * */ -int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, +int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; @@ -416,7 +416,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, put_user(cnow.brk, &p_cuser->brk) || put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) return -EFAULT; -#endif +#endif return 0; default: ret = -ENOIOCTLCMD; /* ioctls which we must ignore */ diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 7e7a31798d8d..e717801b38f9 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -341,11 +341,11 @@ static void irda_task_timer_expired(void *data) */ static void irda_device_setup(struct net_device *dev) { - dev->hard_header_len = 0; - dev->addr_len = LAP_ALEN; + dev->hard_header_len = 0; + dev->addr_len = LAP_ALEN; - dev->type = ARPHRD_IRDA; - dev->tx_queue_len = 8; /* Window size + 1 s-frame */ + dev->type = ARPHRD_IRDA; + dev->tx_queue_len = 8; /* Window size + 1 s-frame */ memset(dev->broadcast, 0xff, LAP_ALEN); @@ -354,7 +354,7 @@ static void irda_device_setup(struct net_device *dev) } /* - * Funciton alloc_irdadev + * Funciton alloc_irdadev * Allocates and sets up an IRDA device in a manner similar to * alloc_etherdev. */ @@ -386,9 +386,9 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type) /* Try to load the module needed */ if (!reg && capable(CAP_SYS_MODULE)) { spin_unlock(&dongles->hb_spinlock); - + request_module("irda-dongle-%d", type); - + spin_lock(&dongles->hb_spinlock); reg = hashbin_find(dongles, type, NULL); } @@ -438,15 +438,15 @@ int irda_device_register_dongle(struct dongle_reg *new) spin_lock(&dongles->hb_spinlock); /* Check if this dongle has been registered before */ if (hashbin_find(dongles, new->type, NULL)) { - IRDA_MESSAGE("%s: Dongle type %x already registered\n", + IRDA_MESSAGE("%s: Dongle type %x already registered\n", __FUNCTION__, new->type); - } else { + } else { /* Insert IrDA dongle into hashbin */ hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL); } spin_unlock(&dongles->hb_spinlock); - return 0; + return 0; } EXPORT_SYMBOL(irda_device_register_dongle); @@ -462,7 +462,7 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle) spin_lock(&dongles->hb_spinlock); node = hashbin_remove(dongles, dongle->type, NULL); - if (!node) + if (!node) IRDA_ERROR("%s: dongle not found!\n", __FUNCTION__); spin_unlock(&dongles->hb_spinlock); } diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 8f1c6d65b247..98b0fa965790 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -79,10 +79,10 @@ static int iriap_data_indication(void *instance, void *sap, static void iriap_watchdog_timer_expired(void *data); -static inline void iriap_start_watchdog_timer(struct iriap_cb *self, - int timeout) +static inline void iriap_start_watchdog_timer(struct iriap_cb *self, + int timeout) { - irda_start_timer(&self->watchdog_timer, timeout, self, + irda_start_timer(&self->watchdog_timer, timeout, self, iriap_watchdog_timer_expired); } @@ -674,7 +674,7 @@ static void iriap_getvaluebyclass_indication(struct iriap_cb *self, if (attrib == NULL) { IRDA_DEBUG(2, "LM-IAS: Attribute %s not found\n", attr); iriap_getvaluebyclass_response(self, obj->id, - IAS_ATTRIB_UNKNOWN, + IAS_ATTRIB_UNKNOWN, &irias_missing); return; } @@ -971,7 +971,7 @@ static const char *ias_value_types[] = { "IAS_STRING" }; -static inline struct ias_object *irias_seq_idx(loff_t pos) +static inline struct ias_object *irias_seq_idx(loff_t pos) { struct ias_object *obj; @@ -980,7 +980,7 @@ static inline struct ias_object *irias_seq_idx(loff_t pos) if (pos-- == 0) break; } - + return obj; } @@ -995,7 +995,7 @@ static void *irias_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - return (v == SEQ_START_TOKEN) + return (v == SEQ_START_TOKEN) ? (void *) hashbin_get_first(irias_objects) : (void *) hashbin_get_next(irias_objects); } @@ -1027,7 +1027,7 @@ static int irias_seq_show(struct seq_file *seq, void *v) for (attrib = (struct ias_attrib *) hashbin_get_first(obj->attribs); attrib != NULL; attrib = (struct ias_attrib *) hashbin_get_next(obj->attribs)) { - + IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, goto outloop; ); @@ -1046,14 +1046,14 @@ static int irias_seq_show(struct seq_file *seq, void *v) attrib->value->t.string); break; case IAS_OCT_SEQ: - seq_printf(seq, "octet sequence (%d bytes)\n", + seq_printf(seq, "octet sequence (%d bytes)\n", attrib->value->len); break; case IAS_MISSING: seq_puts(seq, "missing\n"); break; default: - seq_printf(seq, "type %d?\n", + seq_printf(seq, "type %d?\n", attrib->value->type); } seq_putc(seq, '\n'); diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c index 2a571b43ebec..4adaae242b9e 100644 --- a/net/irda/irias_object.c +++ b/net/irda/irias_object.c @@ -57,8 +57,8 @@ static char *strndup(char *str, size_t max) len = max; /* Allocate new string */ - new_str = kmalloc(len + 1, GFP_ATOMIC); - if (new_str == NULL) { + new_str = kmalloc(len + 1, GFP_ATOMIC); + if (new_str == NULL) { IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); return NULL; } @@ -78,7 +78,7 @@ static char *strndup(char *str, size_t max) */ struct ias_object *irias_new_object( char *name, int id) { - struct ias_object *obj; + struct ias_object *obj; IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c index 95cf1234ea17..a4c1c9545827 100644 --- a/net/irda/irlan/irlan_client.c +++ b/net/irda/irlan/irlan_client.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_client.c * Version: 0.9 * Description: IrDA LAN Access Protocol (IrLAN) Client @@ -11,17 +11,17 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -54,35 +54,35 @@ #undef CONFIG_IRLAN_GRATUITOUS_ARP -static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, - LM_REASON reason, +static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, + LM_REASON reason, struct sk_buff *); -static int irlan_client_ctrl_data_indication(void *instance, void *sap, +static int irlan_client_ctrl_data_indication(void *instance, void *sap, struct sk_buff *skb); -static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, - struct qos_info *qos, +static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *); -static void irlan_check_response_param(struct irlan_cb *self, char *param, +static void irlan_check_response_param(struct irlan_cb *self, char *param, char *value, int val_len); static void irlan_client_open_ctrl_tsap(struct irlan_cb *self); static void irlan_client_kick_timer_expired(void *data) { struct irlan_cb *self = (struct irlan_cb *) data; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - /* + + /* * If we are in peer mode, the client may not have got the discovery - * indication it needs to make progress. If the client is still in + * indication it needs to make progress. If the client is still in * IDLE state, we must kick it to, but only if the provider is not IDLE - */ - if ((self->provider.access_type == ACCESS_PEER) && + */ + if ((self->provider.access_type == ACCESS_PEER) && (self->client.state == IRLAN_IDLE) && (self->provider.state != IRLAN_IDLE)) { irlan_client_wakeup(self, self->saddr, self->daddr); @@ -92,8 +92,8 @@ static void irlan_client_kick_timer_expired(void *data) static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - - irda_start_timer(&self->client.kick_timer, timeout, (void *) self, + + irda_start_timer(&self->client.kick_timer, timeout, (void *) self, irlan_client_kick_timer_expired); } @@ -110,11 +110,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - /* + /* * Check if we are already awake, or if we are a provider in direct * mode (in that case we must leave the client idle */ - if ((self->client.state != IRLAN_IDLE) || + if ((self->client.state != IRLAN_IDLE) || (self->provider.access_type == ACCESS_DIRECT)) { IRDA_DEBUG(0, "%s(), already awake!\n", __FUNCTION__ ); @@ -135,7 +135,7 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) irlan_open_data_tsap(self); irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); - + /* Start kick timer */ irlan_client_start_kick_timer(self, 2*HZ); } @@ -148,11 +148,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) */ void irlan_client_discovery_indication(discinfo_t *discovery, DISCOVERY_MODE mode, - void *priv) + void *priv) { struct irlan_cb *self; __u32 saddr, daddr; - + IRDA_DEBUG(1, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(discovery != NULL, return;); @@ -177,35 +177,35 @@ void irlan_client_discovery_indication(discinfo_t *discovery, IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , daddr); - + irlan_client_wakeup(self, saddr, daddr); } IRDA_ASSERT_LABEL(out:) rcu_read_unlock(); } - + /* * Function irlan_client_data_indication (handle, skb) * * This function gets the data that is received on the control channel * */ -static int irlan_client_ctrl_data_indication(void *instance, void *sap, +static int irlan_client_ctrl_data_indication(void *instance, void *sap, struct sk_buff *skb) { struct irlan_cb *self; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); - - irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); - /* Ready for a new command */ + irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); + + /* Ready for a new command */ IRDA_DEBUG(2, "%s(), clearing tx_busy\n", __FUNCTION__ ); self->client.tx_busy = FALSE; @@ -215,27 +215,27 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap, return 0; } -static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *userdata) +static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; struct sk_buff *skb; IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->client.tsap_ctrl, return;); - /* Remove frames queued on the control channel */ + /* Remove frames queued on the control channel */ while ((skb = skb_dequeue(&self->client.txq)) != NULL) { dev_kfree_skb(skb); } @@ -272,7 +272,7 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) notify.disconnect_indication = irlan_client_ctrl_disconnect_indication; notify.instance = self; strlcpy(notify.name, "IrLAN ctrl (c)", sizeof(notify.name)); - + tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); if (!tsap) { IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ ); @@ -287,11 +287,11 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) * Connection to peer IrLAN laye confirmed * */ -static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, - struct qos_info *qos, +static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, - struct sk_buff *skb) + struct sk_buff *skb) { struct irlan_cb *self; @@ -316,7 +316,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, * Print return code of request to peer IrLAN layer. * */ -static void print_ret_code(__u8 code) +static void print_ret_code(__u8 code) { switch(code) { case 0: @@ -358,7 +358,7 @@ static void print_ret_code(__u8 code) /* * Function irlan_client_parse_response (self, skb) * - * Extract all parameters from received buffer, then feed them to + * Extract all parameters from received buffer, then feed them to * check_params for parsing */ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) @@ -369,30 +369,30 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) int ret; __u16 val_len; int i; - char *name; - char *value; + char *name; + char *value; + + IRDA_ASSERT(skb != NULL, return;); - IRDA_ASSERT(skb != NULL, return;); - IRDA_DEBUG(4, "%s() skb->len=%d\n", __FUNCTION__ , (int) skb->len); - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + if (!skb) { IRDA_ERROR("%s(), Got NULL skb!\n", __FUNCTION__); return; } frame = skb->data; - - /* - * Check return code and print it if not success + + /* + * Check return code and print it if not success */ if (frame[0]) { print_ret_code(frame[0]); return; } - + name = kmalloc(255, GFP_ATOMIC); if (!name) return; @@ -406,11 +406,11 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) count = frame[1]; IRDA_DEBUG(4, "%s(), got %d parameters\n", __FUNCTION__ , count); - + ptr = frame+2; /* For all parameters */ - for (i=0; i<count;i++) { + for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); @@ -418,7 +418,7 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) } ptr += ret; irlan_check_response_param(self, name, value, val_len); - } + } /* Cleanup */ kfree(name); kfree(value); @@ -430,8 +430,8 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) * Check which parameter is received and update local variables * */ -static void irlan_check_response_param(struct irlan_cb *self, char *param, - char *value, int val_len) +static void irlan_check_response_param(struct irlan_cb *self, char *param, + char *value, int val_len) { __u16 tmp_cpu; /* Temporary value in host order */ __u8 *bytes; @@ -465,7 +465,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, self->client.filter_type |= IRLAN_BROADCAST; else if (strcmp(value, "IPX_SOCKET") == 0) self->client.filter_type |= IRLAN_IPX_SOCKET; - + } if (strcmp(param, "ACCESS_TYPE") == 0) { if (strcmp(value, "DIRECT") == 0) @@ -480,7 +480,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, } /* IRLAN version */ if (strcmp(param, "IRLAN_VER") == 0) { - IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], + IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], (__u8) value[1]); self->version[0] = value[0]; @@ -497,17 +497,17 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.recv_arb_val = tmp_cpu; - IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , self->client.recv_arb_val); } if (strcmp(param, "MAX_FRAME") == 0) { memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.max_frame = tmp_cpu; - IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , + IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , self->client.max_frame); } - + /* RECONNECT_KEY, in case the link goes down! */ if (strcmp(param, "RECONNECT_KEY") == 0) { IRDA_DEBUG(4, "Got reconnect key: "); @@ -521,9 +521,9 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, if (strcmp(param, "FILTER_ENTRY") == 0) { bytes = value; IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", - bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], + bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]); - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++) self->dev->dev_addr[i] = bytes[i]; } } @@ -534,11 +534,11 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, * Got results from remote LM-IAS * */ -void irlan_client_get_value_confirm(int result, __u16 obj_id, - struct ias_value *value, void *priv) +void irlan_client_get_value_confirm(int result, __u16 obj_id, + struct ias_value *value, void *priv) { struct irlan_cb *self; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(priv != NULL, return;); @@ -553,7 +553,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id, /* Check if request succeeded */ if (result != IAS_SUCCESS) { IRDA_DEBUG(2, "%s(), got NULL value!\n", __FUNCTION__ ); - irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, + irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, NULL); return; } diff --git a/net/irda/irlan/irlan_client_event.c b/net/irda/irlan/irlan_client_event.c index ce943b69e996..843ab6fbb394 100644 --- a/net/irda/irlan/irlan_client_event.c +++ b/net/irda/irlan/irlan_client_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_client_event.c * Version: 0.9 * Description: IrLAN client state machine @@ -8,17 +8,17 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sun Dec 26 21:52:24 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -36,31 +36,31 @@ #include <net/irda/irlan_client.h> #include <net/irda/irlan_event.h> -static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = -{ +{ irlan_client_state_idle, irlan_client_state_query, irlan_client_state_conn, @@ -74,8 +74,8 @@ static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = irlan_client_state_sync }; -void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -89,14 +89,14 @@ void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, * IDLE, We are waiting for an indication that there is a provider * available. */ -static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); - + switch (event) { case IRLAN_DISCOVERY_INDICATION: if (self->client.iriap) { @@ -104,7 +104,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, __FUNCTION__); return -EBUSY; } - + self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irlan_client_get_value_confirm); /* Get some values from peer IAS */ @@ -120,7 +120,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, IRDA_DEBUG(4, "%s(), Unknown event %d\n", __FUNCTION__ , event); break; } - if (skb) + if (skb) dev_kfree_skb(skb); return 0; @@ -133,23 +133,23 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, * to provider, just waiting for the confirm. * */ -static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); - + switch(event) { case IRLAN_IAS_PROVIDER_AVAIL: IRDA_ASSERT(self->dtsap_sel_ctrl != 0, return -1;); self->client.open_retries = 0; - - irttp_connect_request(self->client.tsap_ctrl, - self->dtsap_sel_ctrl, - self->saddr, self->daddr, NULL, + + irttp_connect_request(self->client.tsap_ctrl, + self->dtsap_sel_ctrl, + self->saddr, self->daddr, NULL, IRLAN_MTU, NULL); irlan_next_client_state(self, IRLAN_CONN); break; @@ -158,7 +158,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); /* Give the client a kick! */ - if ((self->provider.access_type == ACCESS_PEER) && + if ((self->provider.access_type == ACCESS_PEER) && (self->provider.state != IRLAN_IDLE)) irlan_client_wakeup(self, self->saddr, self->daddr); break; @@ -175,7 +175,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -186,13 +186,13 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, * commands yet. * */ -static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch (event) { case IRLAN_CONNECT_COMPLETE: /* Send getinfo cmd */ @@ -212,7 +212,7 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -221,24 +221,24 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, * * INFO, We have issued a GetInfo command and is awaiting a reply. */ -static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); - + switch (event) { case IRLAN_DATA_INDICATION: IRDA_ASSERT(skb != NULL, return -1;); - + irlan_client_parse_response(self, skb); - + irlan_next_client_state(self, IRLAN_MEDIA); - + irlan_get_media_char(self); break; - + case IRLAN_LMP_DISCONNECT: case IRLAN_LAP_DISCONNECT: irlan_next_client_state(self, IRLAN_IDLE); @@ -252,7 +252,7 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -263,11 +263,11 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, * reply. * */ -static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { @@ -289,7 +289,7 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -300,47 +300,47 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, * reply * */ -static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { struct qos_info qos; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { case IRLAN_DATA_INDICATION: irlan_client_parse_response(self, skb); - + /* - * Check if we have got the remote TSAP for data + * Check if we have got the remote TSAP for data * communications */ - IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); + IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); /* Check which access type we are dealing with */ switch (self->client.access_type) { case ACCESS_PEER: if (self->provider.state == IRLAN_OPEN) { - + irlan_next_client_state(self, IRLAN_ARB); - irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, + irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, NULL); } else { - + irlan_next_client_state(self, IRLAN_WAIT); } break; case ACCESS_DIRECT: case ACCESS_HOSTED: qos.link_disc_time.bits = 0x01; /* 3 secs */ - - irttp_connect_request(self->tsap_data, - self->dtsap_sel_data, - self->saddr, self->daddr, &qos, + + irttp_connect_request(self->tsap_data, + self->dtsap_sel_data, + self->saddr, self->daddr, &qos, IRLAN_MTU, NULL); - + irlan_next_client_state(self, IRLAN_DATA); break; default: @@ -359,7 +359,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, IRDA_DEBUG(2, "%s(), Unknown event %d\n", __FUNCTION__ , event); break; } - + if (skb) dev_kfree_skb(skb); @@ -373,13 +373,13 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, * provider OPEN state. * */ -static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_PROVIDER_SIGNAL: irlan_next_client_state(self, IRLAN_ARB); @@ -398,36 +398,36 @@ static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } -static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { struct qos_info qos; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_CHECK_CON_ARB: if (self->client.recv_arb_val == self->provider.send_arb_val) { irlan_next_client_state(self, IRLAN_CLOSE); irlan_close_data_channel(self); - } else if (self->client.recv_arb_val < - self->provider.send_arb_val) + } else if (self->client.recv_arb_val < + self->provider.send_arb_val) { qos.link_disc_time.bits = 0x01; /* 3 secs */ irlan_next_client_state(self, IRLAN_DATA); - irttp_connect_request(self->tsap_data, - self->dtsap_sel_data, - self->saddr, self->daddr, &qos, + irttp_connect_request(self->tsap_data, + self->dtsap_sel_data, + self->saddr, self->daddr, &qos, IRLAN_MTU, NULL); } else if (self->client.recv_arb_val > - self->provider.send_arb_val) + self->provider.send_arb_val) { IRDA_DEBUG(2, "%s(), lost the battle :-(\n", __FUNCTION__ ); } @@ -448,7 +448,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -459,8 +459,8 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, * the local and remote machines. * */ -static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -470,7 +470,7 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_DATA_INDICATION: irlan_client_parse_response(self, skb); - break; + break; case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ case IRLAN_LAP_DISCONNECT: irlan_next_client_state(self, IRLAN_IDLE); @@ -481,18 +481,18 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } /* * Function irlan_client_state_close (self, event, skb, info) * - * + * * */ -static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -505,17 +505,17 @@ static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, /* * Function irlan_client_state_sync (self, event, skb, info) * - * + * * */ -static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + if (skb) dev_kfree_skb(skb); - + return 0; } diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 310776dd6109..9c3dc57ff746 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_common.c * Version: 0.9 * Description: IrDA LAN Access Protocol Implementation @@ -8,17 +8,17 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sun Dec 26 21:53:10 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -49,12 +49,12 @@ #include <net/irda/irlan_common.h> #include <net/irda/irlan_client.h> -#include <net/irda/irlan_provider.h> +#include <net/irda/irlan_provider.h> #include <net/irda/irlan_eth.h> #include <net/irda/irlan_filter.h> -/* +/* * Send gratuitous ARP when connected to a new AP or not. May be a clever * thing to do, but for some reason the machine crashes if you use DHCP. So * lets not use it by default. @@ -106,8 +106,8 @@ extern struct proc_dir_entry *proc_irda; static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr); static void __irlan_close(struct irlan_cb *self); -static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, - __u8 value_byte, __u16 value_short, +static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, + __u8 value_byte, __u16 value_short, __u8 *value_array, __u16 value_len); static void irlan_open_unicast_addr(struct irlan_cb *self); static void irlan_get_unicast_addr(struct irlan_cb *self); @@ -177,7 +177,7 @@ err_ckey: return -ENOMEM; } -static void __exit irlan_cleanup(void) +static void __exit irlan_cleanup(void) { struct irlan_cb *self, *next; @@ -201,7 +201,7 @@ static void __exit irlan_cleanup(void) /* * Function irlan_open (void) * - * Open new instance of a client/provider, we should only register the + * Open new instance of a client/provider, we should only register the * network device if this instance is ment for a particular client/provider */ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) @@ -229,9 +229,9 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) /* Provider access can only be PEER, DIRECT, or HOSTED */ self->provider.access_type = access; if (access == ACCESS_DIRECT) { - /* + /* * Since we are emulating an IrLAN sever we will have to - * give ourself an ethernet address! + * give ourself an ethernet address! */ dev->dev_addr[0] = 0x40; dev->dev_addr[1] = 0x00; @@ -245,15 +245,15 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) self->disconnect_reason = LM_USER_REQUEST; init_timer(&self->watchdog_timer); init_timer(&self->client.kick_timer); - init_waitqueue_head(&self->open_wait); - + init_waitqueue_head(&self->open_wait); + skb_queue_head_init(&self->client.txq); - + irlan_next_client_state(self, IRLAN_IDLE); irlan_next_provider_state(self, IRLAN_IDLE); if (register_netdev(dev)) { - IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", + IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", __FUNCTION__ ); self = NULL; free_netdev(dev); @@ -268,14 +268,14 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) /* * Function __irlan_close (self) * - * This function closes and deallocates the IrLAN client instances. Be + * This function closes and deallocates the IrLAN client instances. Be * aware that other functions which calls client_close() must * remove self from irlans list first. */ static void __irlan_close(struct irlan_cb *self) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + ASSERT_RTNL(); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -285,8 +285,8 @@ static void __irlan_close(struct irlan_cb *self) /* Close all open connections and remove TSAPs */ irlan_close_tsaps(self); - - if (self->client.iriap) + + if (self->client.iriap) iriap_close(self->client.iriap); /* Remove frames queued on the control channel */ @@ -316,17 +316,17 @@ struct irlan_cb *irlan_get_any(void) static void irlan_connect_indication(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, + __u8 max_header_size, struct sk_buff *skb) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap == self->tsap_data,return;); @@ -349,9 +349,9 @@ static void irlan_connect_indication(void *instance, void *sap, irlan_do_client_event(self, IRLAN_DATA_CONNECT_INDICATION, NULL); if (self->provider.access_type == ACCESS_PEER) { - /* + /* * Data channel is open, so we are now allowed to - * configure the remote filter + * configure the remote filter */ irlan_get_unicast_addr(self); irlan_open_unicast_addr(self); @@ -361,10 +361,10 @@ static void irlan_connect_indication(void *instance, void *sap, } static void irlan_connect_confirm(void *instance, void *sap, - struct qos_info *qos, + struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, - struct sk_buff *skb) + __u8 max_header_size, + struct sk_buff *skb) { struct irlan_cb *self; @@ -381,16 +381,16 @@ static void irlan_connect_confirm(void *instance, void *sap, IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); del_timer(&self->watchdog_timer); - /* + /* * Data channel is open, so we are now allowed to configure the remote - * filter + * filter */ irlan_get_unicast_addr(self); irlan_open_unicast_addr(self); - + /* Open broadcast and multicast filter by default */ - irlan_set_broadcast_filter(self, TRUE); - irlan_set_multicast_filter(self, TRUE); + irlan_set_broadcast_filter(self, TRUE); + irlan_set_multicast_filter(self, TRUE); /* Ready to transfer Ethernet frames */ netif_start_queue(self->dev); @@ -408,29 +408,29 @@ static void irlan_connect_confirm(void *instance, void *sap, * the specified connection (handle) */ static void irlan_disconnect_indication(void *instance, - void *sap, LM_REASON reason, - struct sk_buff *userdata) + void *sap, LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->tsap_data, return;); IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); /* Save reason so we know if we should try to reconnect or not */ self->disconnect_reason = reason; - + switch (reason) { case LM_USER_REQUEST: /* User request */ IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ ); @@ -451,7 +451,7 @@ static void irlan_disconnect_indication(void *instance, IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__); break; } - + /* If you want to pass the skb to *both* state machines, you will * need to skb_clone() it, so that you don't free it twice. * As the state machines don't need it, git rid of it here... @@ -461,7 +461,7 @@ static void irlan_disconnect_indication(void *instance, irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); - + wake_up_interruptible(&self->open_wait); } @@ -480,12 +480,12 @@ void irlan_open_data_tsap(struct irlan_cb *self) return; irda_notify_init(¬ify); - + notify.data_indication = irlan_eth_receive; notify.udata_indication = irlan_eth_receive; notify.connect_indication = irlan_connect_indication; notify.connect_confirm = irlan_connect_confirm; - notify.flow_indication = irlan_eth_flow_indication; + notify.flow_indication = irlan_eth_flow_indication; notify.disconnect_indication = irlan_disconnect_indication; notify.instance = self; strlcpy(notify.name, "IrLAN data", sizeof(notify.name)); @@ -497,7 +497,7 @@ void irlan_open_data_tsap(struct irlan_cb *self) } self->tsap_data = tsap; - /* + /* * This is the data TSAP selector which we will pass to the client * when the client ask for it. */ @@ -518,13 +518,13 @@ void irlan_close_tsaps(struct irlan_cb *self) self->tsap_data = NULL; } if (self->client.tsap_ctrl) { - irttp_disconnect_request(self->client.tsap_ctrl, NULL, + irttp_disconnect_request(self->client.tsap_ctrl, NULL, P_NORMAL); irttp_close_tsap(self->client.tsap_ctrl); self->client.tsap_ctrl = NULL; } if (self->provider.tsap_ctrl) { - irttp_disconnect_request(self->provider.tsap_ctrl, NULL, + irttp_disconnect_request(self->provider.tsap_ctrl, NULL, P_NORMAL); irttp_close_tsap(self->provider.tsap_ctrl); self->provider.tsap_ctrl = NULL; @@ -545,8 +545,8 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - /* + + /* * Check if object has already been registered by a previous provider. * If that is the case, we just change the value of the attribute */ @@ -560,9 +560,9 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) irias_object_change_attribute("IrLAN", "IrDA:TinyTP:LsapSel", new_value); } - - /* Register PnP object only if not registered before */ - if (!irias_find_object("PnP")) { + + /* Register PnP object only if not registered before */ + if (!irias_find_object("PnP")) { obj = irias_new_object("PnP", IAS_PNP_ID); #if 0 irias_add_string_attrib(obj, "Name", sysctl_devname, @@ -606,10 +606,10 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) self->client.tx_busy = FALSE; return 0; } - + /* Check that it's really possible to send commands */ - if ((self->client.tsap_ctrl == NULL) || - (self->client.state == IRLAN_IDLE)) + if ((self->client.tsap_ctrl == NULL) || + (self->client.state == IRLAN_IDLE)) { self->client.tx_busy = FALSE; dev_kfree_skb(skb); @@ -649,7 +649,7 @@ void irlan_get_provider_info(struct irlan_cb *self) __u8 *frame; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -661,12 +661,12 @@ void irlan_get_provider_info(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_GET_PROVIDER_INFO; + + frame[0] = CMD_GET_PROVIDER_INFO; frame[1] = 0x00; /* Zero parameters */ - + irlan_ctrl_data_request(self, skb); } @@ -676,16 +676,16 @@ void irlan_get_provider_info(struct irlan_cb *self) * Send an Open Data Command to provider * */ -void irlan_open_data_channel(struct irlan_cb *self) +void irlan_open_data_channel(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") + IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"), @@ -695,11 +695,11 @@ void irlan_open_data_channel(struct irlan_cb *self) skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_OPEN_DATA_CHANNEL; + frame[0] = CMD_OPEN_DATA_CHANNEL; frame[1] = 0x02; /* Two parameters */ irlan_insert_string_param(skb, "MEDIA", "802.3"); @@ -711,11 +711,11 @@ void irlan_open_data_channel(struct irlan_cb *self) irlan_ctrl_data_request(self, skb); } -void irlan_close_data_channel(struct irlan_cb *self) +void irlan_close_data_channel(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -733,11 +733,11 @@ void irlan_close_data_channel(struct irlan_cb *self) skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_CLOSE_DATA_CHAN; + frame[0] = CMD_CLOSE_DATA_CHAN; frame[1] = 0x01; /* One parameter */ irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); @@ -748,7 +748,7 @@ void irlan_close_data_channel(struct irlan_cb *self) /* * Function irlan_open_unicast_addr (self) * - * Make IrLAN provider accept ethernet frames addressed to the unicast + * Make IrLAN provider accept ethernet frames addressed to the unicast * address. * */ @@ -756,12 +756,12 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + @@ -773,15 +773,15 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); - irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); - + irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); + irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); + irlan_ctrl_data_request(self, skb); } @@ -794,17 +794,17 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) * one but then _we_ have to initiate all communication with other * hosts, since ARP request for this host will not be answered. */ -void irlan_set_broadcast_filter(struct irlan_cb *self, int status) +void irlan_set_broadcast_filter(struct irlan_cb *self, int status) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + + + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") + /* We may waste one byte here...*/ @@ -816,17 +816,17 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); if (status) - irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); + irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); else - irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); + irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_ctrl_data_request(self, skb); } @@ -835,14 +835,14 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) * Function irlan_set_multicast_filter (self, status) * * Make IrLAN provider accept ethernet frames addressed to the multicast - * address. + * address. * */ -void irlan_set_multicast_filter(struct irlan_cb *self, int status) +void irlan_set_multicast_filter(struct irlan_cb *self, int status) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -856,21 +856,21 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status) GFP_ATOMIC); if (!skb) return; - + /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); if (status) - irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); + irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); else - irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); + irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_ctrl_data_request(self, skb); } @@ -887,12 +887,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + @@ -905,34 +905,34 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); - irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); - + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); + irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); + irlan_ctrl_data_request(self, skb); } /* * Function irlan_get_media_char (self) * - * + * * */ -void irlan_get_media_char(struct irlan_cb *self) +void irlan_get_media_char(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"), GFP_ATOMIC); @@ -943,13 +943,13 @@ void irlan_get_media_char(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_GET_MEDIA_CHAR; + frame[0] = CMD_GET_MEDIA_CHAR; frame[1] = 0x01; /* One parameter */ - + irlan_insert_string_param(skb, "MEDIA", "802.3"); irlan_ctrl_data_request(self, skb); } @@ -980,7 +980,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) { int string_len = strlen(string); - return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, + return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, string_len); } @@ -993,7 +993,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, __u16 array_len) { - return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, + return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, array_len); } @@ -1006,19 +1006,19 @@ int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, * | Name Length[1] | Param Name[1..255] | Val Length[2] | Value[0..1016]| * ----------------------------------------------------------------------- */ -static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, - __u8 value_byte, __u16 value_short, +static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, + __u8 value_byte, __u16 value_short, __u8 *value_array, __u16 value_len) { __u8 *frame; __u8 param_len; __le16 tmp_le; /* Temporary value in little endian format */ int n=0; - + if (skb == NULL) { IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ ); return 0; - } + } param_len = strlen(param); switch (type) { @@ -1037,7 +1037,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, return 0; break; } - + /* Insert at end of sk-buffer */ frame = skb->tail; @@ -1045,15 +1045,15 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, if (skb_tailroom(skb) < (param_len+value_len+3)) { IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ ); return 0; - } + } skb_put(skb, param_len+value_len+3); - + /* Insert parameter length */ frame[n++] = param_len; - + /* Insert parameter */ memcpy(frame+n, param, param_len); n += param_len; - + /* Insert value length (2 byte little endian format, LSB first) */ tmp_le = cpu_to_le16(value_len); memcpy(frame+n, &tmp_le, 2); n += 2; /* To avoid alignment problems */ @@ -1082,36 +1082,36 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, * Function irlan_extract_param (buf, name, value, len) * * Extracts a single parameter name/value pair from buffer and updates - * the buffer pointer to point to the next name/value pair. + * the buffer pointer to point to the next name/value pair. */ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) { __u8 name_len; __u16 val_len; int n=0; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + /* get length of parameter name (1 byte) */ name_len = buf[n++]; - + if (name_len > 254) { IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ ); return -RSP_INVALID_COMMAND_FORMAT; } - + /* get parameter name */ memcpy(name, buf+n, name_len); name[name_len] = '\0'; n+=name_len; - - /* - * Get length of parameter value (2 bytes in little endian - * format) + + /* + * Get length of parameter value (2 bytes in little endian + * format) */ memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */ le16_to_cpus(&val_len); n+=2; - + if (val_len > 1016) { IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ ); return -RSP_INVALID_COMMAND_FORMAT; @@ -1122,9 +1122,9 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) memcpy(value, buf+n, val_len); value[val_len] = '\0'; n+=val_len; - - IRDA_DEBUG(4, "Parameter: %s ", name); - IRDA_DEBUG(4, "Value: %s\n", value); + + IRDA_DEBUG(4, "Parameter: %s ", name); + IRDA_DEBUG(4, "Value: %s\n", value); return n; } @@ -1133,7 +1133,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) /* * Start of reading /proc entries. - * Return entry at pos, + * Return entry at pos, * or start_token to indicate print header line * or NULL if end of file */ @@ -1147,7 +1147,7 @@ static void *irlan_seq_start(struct seq_file *seq, loff_t *pos) return SEQ_START_TOKEN; list_for_each_entry(self, &irlans, dev_list) { - if (*pos == i) + if (*pos == i) return self; ++i; } @@ -1160,12 +1160,12 @@ static void *irlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) struct list_head *nxt; ++*pos; - if (v == SEQ_START_TOKEN) + if (v == SEQ_START_TOKEN) nxt = irlans.next; else nxt = ((struct irlan_cb *)v)->dev_list.next; - return (nxt == &irlans) ? NULL + return (nxt == &irlans) ? NULL : list_entry(nxt, struct irlan_cb, dev_list); } @@ -1185,7 +1185,7 @@ static int irlan_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "IrLAN instances:\n"); else { struct irlan_cb *self = v; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); @@ -1201,17 +1201,17 @@ static int irlan_seq_show(struct seq_file *seq, void *v) self->daddr); seq_printf(seq,"version: %d.%d,\n", self->version[1], self->version[0]); - seq_printf(seq,"access type: %s\n", + seq_printf(seq,"access type: %s\n", irlan_access[self->client.access_type]); - seq_printf(seq,"media: %s\n", + seq_printf(seq,"media: %s\n", irlan_media[self->media]); - + seq_printf(seq,"local filter:\n"); seq_printf(seq,"remote filter: "); irlan_print_filter(seq, self->client.filter_type); - seq_printf(seq,"tx busy: %s\n", + seq_printf(seq,"tx busy: %s\n", netif_queue_stopped(self->dev) ? "TRUE" : "FALSE"); - + seq_putc(seq,'\n'); } return 0; @@ -1231,7 +1231,7 @@ static int irlan_seq_open(struct inode *inode, struct file *file) #endif MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); -MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); +MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); MODULE_LICENSE("GPL"); module_param(eth, bool, 0); diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index b0ccc455b747..672ab3f69033 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c @@ -1,8 +1,8 @@ /********************************************************************* - * + * * Filename: irlan_eth.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Oct 15 08:37:58 1998 @@ -11,18 +11,18 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * + * * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/netdevice.h> @@ -55,7 +55,7 @@ static void irlan_eth_setup(struct net_device *dev) { dev->open = irlan_eth_open; dev->stop = irlan_eth_close; - dev->hard_start_xmit = irlan_eth_xmit; + dev->hard_start_xmit = irlan_eth_xmit; dev->get_stats = irlan_eth_get_stats; dev->set_multicast_list = irlan_eth_set_multicast_list; dev->destructor = free_netdev; @@ -63,8 +63,8 @@ static void irlan_eth_setup(struct net_device *dev) SET_MODULE_OWNER(dev); ether_setup(dev); - - /* + + /* * Lets do all queueing in IrTTP instead of this device driver. * Queueing here as well can introduce some strange latency * problems, which we will avoid by setting the queue size to 0. @@ -104,17 +104,17 @@ struct net_device *alloc_irlandev(const char *name) static int irlan_eth_open(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); /* Ready to play! */ - netif_stop_queue(dev); /* Wait until data link is ready */ + netif_stop_queue(dev); /* Wait until data link is ready */ /* We are now open, so time to do some work */ self->disconnect_reason = 0; irlan_client_wakeup(self, self->saddr, self->daddr); - /* Make sure we have a hardware address before we return, + /* Make sure we have a hardware address before we return, so DHCP clients gets happy */ return wait_event_interruptible(self->open_wait, !self->tsap_data->connected); @@ -124,30 +124,30 @@ static int irlan_eth_open(struct net_device *dev) * Function irlan_eth_close (dev) * * Stop the ether network device, his function will usually be called by - * ifconfig down. We should now disconnect the link, We start the + * ifconfig down. We should now disconnect the link, We start the * close timer, so that the instance will be removed if we are unable * to discover the remote device after the disconnect. */ static int irlan_eth_close(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + /* Stop device */ netif_stop_queue(dev); - + irlan_close_data_channel(self); irlan_close_tsaps(self); irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); - irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); - + irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); + /* Remove frames queued on the control channel */ skb_queue_purge(&self->client.txq); self->client.tx_busy = 0; - + return 0; } @@ -164,7 +164,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) /* skb headroom large enough to contain all IrDA-headers? */ if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { - struct sk_buff *new_skb = + struct sk_buff *new_skb = skb_realloc_headroom(skb, self->max_header_size); /* We have to free the original skb anyway */ @@ -176,7 +176,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) /* Use the new skb instead */ skb = new_skb; - } + } dev->trans_start = jiffies; @@ -187,7 +187,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) ret = irttp_data_request(self->tsap_data, skb); if (ret < 0) { - /* + /* * IrTTPs tx queue is full, so we just have to * drop the frame! You might think that we should * just return -1 and don't deallocate the frame, @@ -195,15 +195,15 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) * we have replaced the original skb with a new * one with larger headroom, and that would really * confuse do_dev_queue_xmit() in dev.c! I have - * tried :-) DB + * tried :-) DB */ /* irttp_data_request already free the packet */ self->stats.tx_dropped++; } else { self->stats.tx_packets++; - self->stats.tx_bytes += skb->len; + self->stats.tx_bytes += skb->len; } - + return 0; } @@ -218,37 +218,37 @@ int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) struct irlan_cb *self = instance; if (skb == NULL) { - ++self->stats.rx_dropped; + ++self->stats.rx_dropped; return 0; } if (skb->len < ETH_HLEN) { IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", __FUNCTION__, skb->len); - ++self->stats.rx_dropped; + ++self->stats.rx_dropped; dev_kfree_skb(skb); return 0; } - - /* - * Adopt this frame! Important to set all these fields since they + + /* + * Adopt this frame! Important to set all these fields since they * might have been previously set by the low level IrDA network - * device driver + * device driver */ skb->dev = self->dev; skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */ - + self->stats.rx_packets++; - self->stats.rx_bytes += skb->len; + self->stats.rx_bytes += skb->len; netif_rx(skb); /* Eat it! */ - + return 0; } /* * Function irlan_eth_flow (status) * - * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by + * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by * controlling the queue stop/start. * * The IrDA link layer has the advantage to have flow control, and @@ -268,11 +268,11 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + dev = self->dev; IRDA_ASSERT(dev != NULL, return;); - + IRDA_DEBUG(0, "%s() : flow %s ; running %d\n", __FUNCTION__, flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START", netif_running(dev)); @@ -301,10 +301,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) { struct in_device *in_dev; - /* + /* * When we get a new MAC address do a gratuitous ARP. This * is useful if we have changed access points on the same - * subnet. + * subnet. */ #ifdef CONFIG_INET IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); @@ -313,10 +313,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) if (in_dev == NULL) goto out; if (in_dev->ifa_list) - - arp_send(ARPOP_REQUEST, ETH_P_ARP, + + arp_send(ARPOP_REQUEST, ETH_P_ARP, in_dev->ifa_list->ifa_address, - dev, + dev, in_dev->ifa_list->ifa_address, NULL, dev->dev_addr, NULL); out: @@ -331,9 +331,9 @@ out: * */ #define HW_MAX_ADDRS 4 /* Must query to get it! */ -static void irlan_eth_set_multicast_list(struct net_device *dev) +static void irlan_eth_set_multicast_list(struct net_device *dev) { - struct irlan_cb *self = netdev_priv(dev); + struct irlan_cb *self = netdev_priv(dev); IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -346,7 +346,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) if (dev->flags & IFF_PROMISC) { /* Enable promiscuous mode */ IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n"); - } + } else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { /* Disable promiscuous mode, use normal mode. */ IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __FUNCTION__ ); @@ -378,7 +378,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) * Get the current statistics for this device * */ -static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) +static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c index 2778d8c6aa31..623e0fd16c19 100644 --- a/net/irda/irlan/irlan_event.c +++ b/net/irda/irlan/irlan_event.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: irlan_event.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Oct 20 09:10:16 1998 * Modified at: Sat Oct 30 12:59:01 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <net/irda/irlan_event.h> @@ -38,7 +38,7 @@ char *irlan_state[] = { "IRLAN_SYNC", }; -void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) +void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) { IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); @@ -48,7 +48,7 @@ void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) self->client.state = state; } -void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) +void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) { IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c index ca7d358dab52..e6346b88f934 100644 --- a/net/irda/irlan/irlan_filter.c +++ b/net/irda/irlan/irlan_filter.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: irlan_filter.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Fri Jan 29 11:16:38 1999 * Modified at: Sat Oct 30 12:58:45 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/skbuff.h> @@ -40,7 +40,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - if ((self->provider.filter_type == IRLAN_DIRECTED) && + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_operation == DYNAMIC)) { IRDA_DEBUG(0, "Giving peer a dynamic Ethernet address\n"); @@ -48,12 +48,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) self->provider.mac_address[1] = 0x00; self->provider.mac_address[2] = 0x00; self->provider.mac_address[3] = 0x00; - + /* Use arbitration value to generate MAC address */ if (self->provider.access_type == ACCESS_PEER) { - self->provider.mac_address[4] = + self->provider.mac_address[4] = self->provider.send_arb_val & 0xff; - self->provider.mac_address[5] = + self->provider.mac_address[5] = (self->provider.send_arb_val >> 8) & 0xff; } else { /* Just generate something for now */ @@ -65,12 +65,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x03; irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_insert_short_param(skb, "MAX_ENTRY", 0x0001); - irlan_insert_array_param(skb, "FILTER_ENTRY", + irlan_insert_array_param(skb, "FILTER_ENTRY", self->provider.mac_address, 6); return; } - - if ((self->provider.filter_type == IRLAN_DIRECTED) && + + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Directed filter on\n"); @@ -78,7 +78,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_DIRECTED) && + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Directed filter off\n"); @@ -87,7 +87,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) return; } - if ((self->provider.filter_type == IRLAN_BROADCAST) && + if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Broadcast filter on\n"); @@ -95,7 +95,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_BROADCAST) && + if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Broadcast filter off\n"); @@ -103,7 +103,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Multicast filter on\n"); @@ -111,7 +111,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Multicast filter off\n"); @@ -119,7 +119,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_operation == GET)) { IRDA_DEBUG(0, "Multicast filter get\n"); diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c index 58efde919667..aac66434e473 100644 --- a/net/irda/irlan/irlan_provider.c +++ b/net/irda/irlan/irlan_provider.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_provider.c * Version: 0.9 * Description: IrDA LAN Access Protocol Implementation @@ -11,17 +11,17 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -52,8 +52,8 @@ #include <net/irda/irlan_filter.h> #include <net/irda/irlan_client.h> -static void irlan_provider_connect_indication(void *instance, void *sap, - struct qos_info *qos, +static void irlan_provider_connect_indication(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb); @@ -64,14 +64,14 @@ static void irlan_provider_connect_indication(void *instance, void *sap, * This function gets the data that is received on the control channel * */ -static int irlan_provider_data_indication(void *instance, void *sap, - struct sk_buff *skb) +static int irlan_provider_data_indication(void *instance, void *sap, + struct sk_buff *skb) { struct irlan_cb *self; __u8 code; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; IRDA_ASSERT(self != NULL, return -1;); @@ -83,16 +83,16 @@ static int irlan_provider_data_indication(void *instance, void *sap, switch(code) { case CMD_GET_PROVIDER_INFO: IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); - irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); + irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); break; case CMD_GET_MEDIA_CHAR: IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); - irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); + irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); break; case CMD_OPEN_DATA_CHANNEL: IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); - irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); + irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); break; case CMD_FILTER_OPERATION: IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); @@ -119,9 +119,9 @@ static int irlan_provider_data_indication(void *instance, void *sap, * Got connection from peer IrLAN client * */ -static void irlan_provider_connect_indication(void *instance, void *sap, +static void irlan_provider_connect_indication(void *instance, void *sap, struct qos_info *qos, - __u32 max_sdu_size, + __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { @@ -130,13 +130,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, __u32 saddr, daddr; IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;); IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;); @@ -147,13 +147,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL); - /* + /* * If we are in peer mode, the client may not have got the discovery - * indication it needs to make progress. If the client is still in - * IDLE state, we must kick it. + * indication it needs to make progress. If the client is still in + * IDLE state, we must kick it. */ - if ((self->provider.access_type == ACCESS_PEER) && - (self->client.state == IRLAN_IDLE)) + if ((self->provider.access_type == ACCESS_PEER) && + (self->client.state == IRLAN_IDLE)) { irlan_client_wakeup(self, self->saddr, self->daddr); } @@ -175,38 +175,38 @@ void irlan_provider_connect_response(struct irlan_cb *self, irttp_connect_response(tsap, IRLAN_MTU, NULL); } -static void irlan_provider_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *userdata) +static void irlan_provider_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;); - + irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); } /* * Function irlan_parse_open_data_cmd (self, skb) * - * + * * */ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) { int ret; - + ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb); /* Open data channel */ @@ -218,12 +218,12 @@ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) /* * Function parse_command (skb) * - * Extract all parameters from received buffer, then feed them to + * Extract all parameters from received buffer, then feed them to * check_params for parsing * */ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, - struct sk_buff *skb) + struct sk_buff *skb) { __u8 *frame; __u8 *ptr; @@ -231,16 +231,16 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, __u16 val_len; int i; char *name; - char *value; + char *value; int ret = RSP_SUCCESS; - + IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); - + IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len); IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); - + if (!skb) return -RSP_PROTOCOL_ERROR; @@ -259,11 +259,11 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, count = frame[1]; IRDA_DEBUG(4, "Got %d parameters\n", count); - + ptr = frame+2; - + /* For all parameters */ - for (i=0; i<count;i++) { + for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); @@ -286,7 +286,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, * Send reply to query to peer IrLAN layer * */ -void irlan_provider_send_reply(struct irlan_cb *self, int command, +void irlan_provider_send_reply(struct irlan_cb *self, int command, int ret_code) { struct sk_buff *skb; @@ -310,7 +310,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->provider.max_header_size); skb_put(skb, 2); - + switch (command) { case CMD_GET_PROVIDER_INFO: skb->data[0] = 0x00; /* Success */ @@ -356,7 +356,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, skb->data[0] = 0x00; /* Success */ if (self->provider.send_arb_val) { skb->data[1] = 0x03; /* 3 parameters */ - irlan_insert_short_param(skb, "CON_ARB", + irlan_insert_short_param(skb, "CON_ARB", self->provider.send_arb_val); } else skb->data[1] = 0x02; /* 2 parameters */ @@ -378,13 +378,13 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, * Function irlan_provider_register(void) * * Register provider support so we can accept incoming connections. - * + * */ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) { struct tsap_cb *tsap; notify_t notify; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); @@ -393,7 +393,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) /* Check if already open */ if (self->provider.tsap_ctrl) return -1; - + /* * First register well known control TSAP */ diff --git a/net/irda/irlan/irlan_provider_event.c b/net/irda/irlan/irlan_provider_event.c index 5a086f9827ed..ef401bd6ea00 100644 --- a/net/irda/irlan/irlan_provider_event.c +++ b/net/irda/irlan/irlan_provider_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_provider_event.c * Version: 0.9 * Description: IrLAN provider state machine) @@ -8,16 +8,16 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sat Oct 30 12:52:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -30,18 +30,18 @@ #include <net/irda/irlan_provider.h> #include <net/irda/irlan_event.h> -static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) = -{ +static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) = +{ irlan_provider_state_idle, NULL, /* Query */ NULL, /* Info */ @@ -55,8 +55,8 @@ static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, NULL, /* Sync */ }; -void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_ASSERT(*state[ self->provider.state] != NULL, return;); @@ -73,9 +73,9 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_CONNECT_INDICATION: irlan_provider_connect_response( self, self->provider.tsap_ctrl); @@ -96,13 +96,13 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, * * INFO, We have issued a GetInfo command and is awaiting a reply. */ -static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { int ret; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { @@ -110,7 +110,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, /* Be sure to use 802.3 in case of peer mode */ if (self->provider.access_type == ACCESS_PEER) { self->media = MEDIA_802_3; - + /* Check if client has started yet */ if (self->client.state == IRLAN_IDLE) { /* This should get the client going */ @@ -118,15 +118,15 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, } } - irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, + irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, RSP_SUCCESS); /* Keep state */ break; - case IRLAN_GET_MEDIA_CMD: - irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, + case IRLAN_GET_MEDIA_CMD: + irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, RSP_SUCCESS); /* Keep state */ - break; + break; case IRLAN_OPEN_DATA_CMD: ret = irlan_parse_open_data_cmd(self, skb); if (self->provider.access_type == ACCESS_PEER) { @@ -152,7 +152,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -163,7 +163,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, * reply * */ -static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -173,11 +173,11 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_FILTER_CONFIG_CMD: irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); - irlan_provider_send_reply(self, CMD_FILTER_OPERATION, + irlan_provider_send_reply(self, CMD_FILTER_OPERATION, RSP_SUCCESS); /* Keep state */ break; - case IRLAN_DATA_CONNECT_INDICATION: + case IRLAN_DATA_CONNECT_INDICATION: irlan_next_provider_state(self, IRLAN_DATA); irlan_provider_connect_response(self, self->tsap_data); break; @@ -202,8 +202,8 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, * the local and remote machines. * */ -static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -213,7 +213,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_FILTER_CONFIG_CMD: irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); - irlan_provider_send_reply(self, CMD_FILTER_OPERATION, + irlan_provider_send_reply(self, CMD_FILTER_OPERATION, RSP_SUCCESS); break; case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ @@ -226,7 +226,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } diff --git a/net/irda/irlap.c b/net/irda/irlap.c index e7852a07495e..fd73e4af715a 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -87,7 +87,7 @@ int __init irlap_init(void) /* Allocate master array */ irlap = hashbin_new(HB_LOCK); if (irlap == NULL) { - IRDA_ERROR("%s: can't allocate irlap hashbin!\n", + IRDA_ERROR("%s: can't allocate irlap hashbin!\n", __FUNCTION__); return -ENOMEM; } @@ -701,8 +701,8 @@ void irlap_update_nr_received(struct irlap_cb *self, int nr) int count = 0; /* - * Remove all the ack-ed frames from the window queue. - */ + * Remove all the ack-ed frames from the window queue. + */ /* * Optimize for the common case. It is most likely that the receiver @@ -1109,13 +1109,13 @@ static void *irlap_seq_start(struct seq_file *seq, loff_t *pos) spin_lock_irq(&irlap->hb_spinlock); iter->id = 0; - for (self = (struct irlap_cb *) hashbin_get_first(irlap); + for (self = (struct irlap_cb *) hashbin_get_first(irlap); self; self = (struct irlap_cb *) hashbin_get_next(irlap)) { if (iter->id == *pos) break; ++iter->id; } - + return self; } @@ -1137,7 +1137,7 @@ static int irlap_seq_show(struct seq_file *seq, void *v) { const struct irlap_iter_state *iter = seq->private; const struct irlap_cb *self = v; - + IRDA_ASSERT(self->magic == LAP_MAGIC, return -EINVAL;); seq_printf(seq, "irlap%d ", iter->id); @@ -1222,7 +1222,7 @@ static int irlap_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); - + if (!s) goto out; diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c index 99faff68c399..7b6433fe1dc2 100644 --- a/net/irda/irlap_event.c +++ b/net/irda/irlap_event.c @@ -827,7 +827,7 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event, irlap_disconnect_indication(self, LAP_DISC_INDICATION); break; default: - IRDA_DEBUG(1, "%s(), Unknown event %d, %s\n", __FUNCTION__, + IRDA_DEBUG(1, "%s(), Unknown event %d, %s\n", __FUNCTION__, event, irlap_event[event]); ret = -1; @@ -864,7 +864,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event, * between 15 msecs and 45 msecs. */ irlap_start_backoff_timer(self, msecs_to_jiffies(20 + - (jiffies % 30))); + (jiffies % 30))); } else { /* Always switch state before calling upper layers */ irlap_next_state(self, LAP_NDM); @@ -1377,7 +1377,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event, /* Resend rejected frames */ irlap_resend_rejected_frames(self, CMD_FRAME); - /* Give peer some time to retransmit! + /* Give peer some time to retransmit! * But account for our own Tx. */ irlap_start_final_timer(self, 2 * self->final_timeout); diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index dba349c832d0..0b04603e9c47 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c @@ -414,7 +414,7 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self, IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); return; } - + xid = (struct xid_frame *) skb->data; info->daddr = le32_to_cpu(xid->saddr); @@ -485,7 +485,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); return; } - + xid = (struct xid_frame *) skb->data; info->daddr = le32_to_cpu(xid->saddr); @@ -524,7 +524,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, */ if (info->s == 0xff) { /* Check if things are sane at this point... */ - if((discovery_info == NULL) || + if((discovery_info == NULL) || !pskb_may_pull(skb, 3)) { IRDA_ERROR("%s: discovery frame to short!\n", __FUNCTION__); diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 7e5d12ab3b90..b134c3cf2bdb 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -116,7 +116,7 @@ int __init irlmp_init(void) * Remove IrLMP layer * */ -void __exit irlmp_cleanup(void) +void __exit irlmp_cleanup(void) { /* Check for main structure */ IRDA_ASSERT(irlmp != NULL, return;); @@ -892,7 +892,7 @@ void irlmp_discovery_request(int nslots) /* * Start a single discovery operation if discovery is not already - * running + * running */ if (!sysctl_discovery) { /* Check if user wants to override the default */ @@ -1528,12 +1528,12 @@ int irlmp_unregister_service(void *handle) /* Refresh current hint bits */ spin_lock_irqsave(&irlmp->services->hb_spinlock, flags); - service = (irlmp_service_t *) hashbin_get_first(irlmp->services); - while (service) { + service = (irlmp_service_t *) hashbin_get_first(irlmp->services); + while (service) { irlmp->hints.word |= service->hints.word; - service = (irlmp_service_t *)hashbin_get_next(irlmp->services); - } + service = (irlmp_service_t *)hashbin_get_next(irlmp->services); + } spin_unlock_irqrestore(&irlmp->services->hb_spinlock, flags); return 0; } @@ -1861,7 +1861,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off) spin_lock_irq(&iter->hashbin->hb_spinlock); for (element = hashbin_get_first(iter->hashbin); - element != NULL; + element != NULL; element = hashbin_get_next(iter->hashbin)) { if (!off || *off-- == 0) { /* NB: hashbin left locked */ @@ -1918,7 +1918,7 @@ static void *irlmp_seq_next(struct seq_file *seq, void *v, loff_t *pos) if (v == NULL) { /* no more in this hash bin */ spin_unlock_irq(&iter->hashbin->hb_spinlock); - if (iter->hashbin == irlmp->unconnected_lsaps) + if (iter->hashbin == irlmp->unconnected_lsaps) v = LINK_START_TOKEN; iter->hashbin = NULL; diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c index 4c90dd1b4503..65ffa981510a 100644 --- a/net/irda/irlmp_event.c +++ b/net/irda/irlmp_event.c @@ -615,7 +615,7 @@ static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event, default: /* LM_LAP_DISCONNECT_INDICATION : Should never happen, we * are *not* yet bound to the IrLAP link. Jean II */ - IRDA_DEBUG(0, "%s(), Unknown event %s on LSAP %#02x\n", + IRDA_DEBUG(0, "%s(), Unknown event %s on LSAP %#02x\n", __FUNCTION__, irlmp_event[event], self->slsap_sel); break; } diff --git a/net/irda/irlmp_frame.c b/net/irda/irlmp_frame.c index 39761a1d18f5..559302d3fe66 100644 --- a/net/irda/irlmp_frame.c +++ b/net/irda/irlmp_frame.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlmp_frame.c * Version: 0.9 * Description: IrLMP frame implementation @@ -8,18 +8,18 @@ * Created at: Tue Aug 19 02:09:59 1997 * Modified at: Mon Dec 13 13:41:12 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no> * All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -34,7 +34,7 @@ #include <net/irda/irlmp_frame.h> #include <net/irda/discovery.h> -static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap, +static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap, __u8 slsap, int status, hashbin_t *); inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, @@ -56,18 +56,18 @@ inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, * Send Link Control Frame to IrLAP */ void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, - __u8 opcode, struct sk_buff *skb) + __u8 opcode, struct sk_buff *skb) { __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;); IRDA_ASSERT(skb != NULL, return;); - + frame = skb->data; - + frame[0] = dlsap | CONTROL_BIT; frame[1] = slsap; @@ -87,14 +87,14 @@ void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, * Used by IrLAP to pass received data frames to IrLMP layer * */ -void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, +void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, int unreliable) { struct lsap_cb *lsap; __u8 slsap_sel; /* Source (this) LSAP address */ __u8 dlsap_sel; /* Destination LSAP address */ __u8 *fp; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__); IRDA_ASSERT(self != NULL, return;); @@ -104,11 +104,11 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, fp = skb->data; /* - * The next statements may be confusing, but we do this so that + * The next statements may be confusing, but we do this so that * destination LSAP of received frame is source LSAP in our view */ - slsap_sel = fp[0] & LSAP_MASK; - dlsap_sel = fp[1]; + slsap_sel = fp[0] & LSAP_MASK; + dlsap_sel = fp[1]; /* * Check if this is an incoming connection, since we must deal with @@ -118,11 +118,11 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, IRDA_DEBUG(3, "%s(), incoming connection, " "source LSAP=%d, dest LSAP=%d\n", __FUNCTION__, slsap_sel, dlsap_sel); - + /* Try to find LSAP among the unconnected LSAPs */ lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, CONNECT_CMD, irlmp->unconnected_lsaps); - + /* Maybe LSAP was already connected, so try one more time */ if (!lsap) { IRDA_DEBUG(1, "%s(), incoming connection for LSAP already connected\n", __FUNCTION__); @@ -130,9 +130,9 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, self->lsaps); } } else - lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0, + lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0, self->lsaps); - + if (lsap == NULL) { IRDA_DEBUG(2, "IrLMP, Sorry, no LSAP for received frame!\n"); IRDA_DEBUG(2, "%s(), slsap_sel = %02x, dlsap_sel = %02x\n", @@ -146,8 +146,8 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, return; } - /* - * Check if we received a control frame? + /* + * Check if we received a control frame? */ if (fp[0] & CONTROL_BIT) { switch (fp[2]) { @@ -161,7 +161,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, case DISCONNECT: IRDA_DEBUG(4, "%s(), Disconnect indication!\n", __FUNCTION__); - irlmp_do_lsap_event(lsap, LM_DISCONNECT_INDICATION, + irlmp_do_lsap_event(lsap, LM_DISCONNECT_INDICATION, skb); break; case ACCESSMODE_CMD: @@ -181,7 +181,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, irlmp_udata_indication(lsap, skb); else irlmp_do_lsap_event(lsap, LM_UDATA_INDICATION, skb); - } else { + } else { /* Optimize and bypass the state machine if possible */ if (lsap->lsap_state == LSAP_DATA_TRANSFER_READY) irlmp_data_indication(lsap, skb); @@ -193,7 +193,7 @@ void irlmp_link_data_indication(struct lap_cb *self, struct sk_buff *skb, /* * Function irlmp_link_unitdata_indication (self, skb) * - * + * * */ #ifdef CONFIG_IRDA_ULTRA @@ -205,7 +205,7 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) __u8 pid; /* Protocol identifier */ __u8 *fp; unsigned long flags; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__); IRDA_ASSERT(self != NULL, return;); @@ -215,13 +215,13 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) fp = skb->data; /* - * The next statements may be confusing, but we do this so that + * The next statements may be confusing, but we do this so that * destination LSAP of received frame is source LSAP in our view */ - slsap_sel = fp[0] & LSAP_MASK; + slsap_sel = fp[0] & LSAP_MASK; dlsap_sel = fp[1]; pid = fp[2]; - + if (pid & 0x80) { IRDA_DEBUG(0, "%s(), extension in PID not supp!\n", __FUNCTION__); @@ -233,7 +233,7 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) IRDA_DEBUG(0, "%s(), dropping frame!\n", __FUNCTION__); return; } - + /* Search the connectionless LSAP */ spin_lock_irqsave(&irlmp->unconnected_lsaps->hb_spinlock, flags); lsap = (struct lsap_cb *) hashbin_get_first(irlmp->unconnected_lsaps); @@ -241,10 +241,10 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) /* * Check if source LSAP and dest LSAP selectors and PID match. */ - if ((lsap->slsap_sel == slsap_sel) && - (lsap->dlsap_sel == dlsap_sel) && - (lsap->pid == pid)) - { + if ((lsap->slsap_sel == slsap_sel) && + (lsap->dlsap_sel == dlsap_sel) && + (lsap->pid == pid)) + { break; } lsap = (struct lsap_cb *) hashbin_get_next(irlmp->unconnected_lsaps); @@ -262,12 +262,12 @@ void irlmp_link_unitdata_indication(struct lap_cb *self, struct sk_buff *skb) /* * Function irlmp_link_disconnect_indication (reason, userdata) * - * IrLAP has disconnected + * IrLAP has disconnected * */ -void irlmp_link_disconnect_indication(struct lap_cb *lap, - struct irlap_cb *irlap, - LAP_REASON reason, +void irlmp_link_disconnect_indication(struct lap_cb *lap, + struct irlap_cb *irlap, + LAP_REASON reason, struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__); @@ -278,8 +278,8 @@ void irlmp_link_disconnect_indication(struct lap_cb *lap, lap->reason = reason; lap->daddr = DEV_ADDR_ANY; - /* FIXME: must do something with the skb if any */ - + /* FIXME: must do something with the skb if any */ + /* * Inform station state machine */ @@ -292,9 +292,9 @@ void irlmp_link_disconnect_indication(struct lap_cb *lap, * Incoming LAP connection! * */ -void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr, +void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr, __u32 daddr, struct qos_info *qos, - struct sk_buff *skb) + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__); @@ -314,7 +314,7 @@ void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr, * LAP connection confirmed! * */ -void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, +void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__); @@ -359,7 +359,7 @@ void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, * * Jean II */ -void irlmp_link_discovery_indication(struct lap_cb *self, +void irlmp_link_discovery_indication(struct lap_cb *self, discovery_t *discovery) { IRDA_ASSERT(self != NULL, return;); @@ -367,7 +367,7 @@ void irlmp_link_discovery_indication(struct lap_cb *self, /* Add to main log, cleanup */ irlmp_add_discovery(irlmp->cachelog, discovery); - + /* Just handle it the same way as a discovery confirm, * bypass the LM_LAP state machine (see below) */ irlmp_discovery_confirm(irlmp->cachelog, DISCOVERY_PASSIVE); @@ -387,7 +387,7 @@ void irlmp_link_discovery_confirm(struct lap_cb *self, hashbin_t *log) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;); - + /* Add to main log, cleanup */ irlmp_add_discovery_log(irlmp->cachelog, log); @@ -420,7 +420,7 @@ static inline void irlmp_update_cache(struct lap_cb *lap, * Find handle associated with destination and source LSAP * * Any IrDA connection (LSAP/TSAP) is uniquely identified by - * 3 parameters, the local lsap, the remote lsap and the remote address. + * 3 parameters, the local lsap, the remote lsap and the remote address. * We may initiate multiple connections to the same remote service * (they will have different local lsap), a remote device may initiate * multiple connections to the same local service (they will have @@ -433,20 +433,20 @@ static inline void irlmp_update_cache(struct lap_cb *lap, */ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, __u8 slsap_sel, int status, - hashbin_t *queue) + hashbin_t *queue) { struct lsap_cb *lsap; unsigned long flags; - - /* + + /* * Optimize for the common case. We assume that the last frame * received is in the same connection as the last one, so check in * cache first to avoid the linear search */ #ifdef CONFIG_IRDA_CACHE_LAST_LSAP - if ((self->cache.valid) && - (self->cache.slsap_sel == slsap_sel) && - (self->cache.dlsap_sel == dlsap_sel)) + if ((self->cache.valid) && + (self->cache.slsap_sel == slsap_sel) && + (self->cache.dlsap_sel == dlsap_sel)) { return (self->cache.lsap); } @@ -456,14 +456,14 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, lsap = (struct lsap_cb *) hashbin_get_first(queue); while (lsap != NULL) { - /* - * If this is an incoming connection, then the destination - * LSAP selector may have been specified as LM_ANY so that + /* + * If this is an incoming connection, then the destination + * LSAP selector may have been specified as LM_ANY so that * any client can connect. In that case we only need to check * if the source LSAP (in our view!) match! */ - if ((status == CONNECT_CMD) && - (lsap->slsap_sel == slsap_sel) && + if ((status == CONNECT_CMD) && + (lsap->slsap_sel == slsap_sel) && (lsap->dlsap_sel == LSAP_ANY)) { /* This is where the dest lsap sel is set on incoming * lsaps */ @@ -473,8 +473,8 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, /* * Check if source LSAP and dest LSAP selectors match. */ - if ((lsap->slsap_sel == slsap_sel) && - (lsap->dlsap_sel == dlsap_sel)) + if ((lsap->slsap_sel == slsap_sel) && + (lsap->dlsap_sel == dlsap_sel)) break; lsap = (struct lsap_cb *) hashbin_get_next(queue); diff --git a/net/irda/irmod.c b/net/irda/irmod.c index 2869b16e417d..826e6c4ca5d5 100644 --- a/net/irda/irmod.c +++ b/net/irda/irmod.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irmod.c * Version: 0.9 * Description: IrDA stack main entry points @@ -8,19 +8,19 @@ * Created at: Mon Dec 15 13:55:39 1997 * Modified at: Wed Jan 5 15:12:41 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1997, 1999-2000 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2004 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ /* @@ -52,7 +52,7 @@ extern void irda_sysctl_unregister(void); extern int irsock_init(void); extern void irsock_cleanup(void); /* irlap_frame.c */ -extern int irlap_driver_rcv(struct sk_buff *, struct net_device *, +extern int irlap_driver_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); /* @@ -104,16 +104,16 @@ static int __init irda_init(void) IRDA_DEBUG(0, "%s()\n", __FUNCTION__); /* Lower layer of the stack */ - irlmp_init(); + irlmp_init(); irlap_init(); - + /* Higher layers of the stack */ iriap_init(); - irttp_init(); + irttp_init(); irsock_init(); - + /* Add IrDA packet type (Start receiving packets) */ - dev_add_pack(&irda_packet_type); + dev_add_pack(&irda_packet_type); /* External APIs */ #ifdef CONFIG_PROC_FS @@ -124,7 +124,7 @@ static int __init irda_init(void) #endif /* Driver/dongle support */ - irda_device_init(); + irda_device_init(); return 0; } @@ -140,14 +140,14 @@ static void __exit irda_cleanup(void) /* Remove External APIs */ #ifdef CONFIG_SYSCTL irda_sysctl_unregister(); -#endif +#endif #ifdef CONFIG_PROC_FS irda_proc_unregister(); #endif /* Remove IrDA packet type (stop receiving packets) */ - dev_remove_pack(&irda_packet_type); - + dev_remove_pack(&irda_packet_type); + /* Remove higher layers */ irsock_cleanup(); irttp_cleanup(); @@ -177,8 +177,8 @@ static void __exit irda_cleanup(void) */ subsys_initcall(irda_init); module_exit(irda_cleanup); - + MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> & Jean Tourrilhes <jt@hpl.hp.com>"); -MODULE_DESCRIPTION("The Linux IrDA Protocol Stack"); +MODULE_DESCRIPTION("The Linux IrDA Protocol Stack"); MODULE_LICENSE("GPL"); MODULE_ALIAS_NETPROTO(PF_IRDA); diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h index 80887528e77e..873ae189e37a 100644 --- a/net/irda/irnet/irnet.h +++ b/net/irda/irnet/irnet.h @@ -44,7 +44,7 @@ * the generic Linux PPP driver. Because IrNET depend on recent * changes of the PPP driver interface, IrNET will work only with very * recent kernel (2.3.99-pre6 and up). - * + * * The present implementation offer the following features : * o simple user interface using pppd * o efficient implementation (interface directly to PPP and IrTTP) @@ -327,7 +327,7 @@ #define DEBUG_ASSERT 0 /* Verify all assertions */ -/* +/* * These are the macros we are using to actually print the debug * statements. Don't look at it, it's ugly... * diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c index f65c7a83bc5c..c378e668af0c 100644 --- a/net/irda/irnet/irnet_irda.c +++ b/net/irda/irnet/irnet_irda.c @@ -118,7 +118,7 @@ irnet_open_tsap(irnet_socket * self) /* Open an IrTTP instance */ self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, - ¬ify); + ¬ify); DABORT(self->tsap == NULL, -ENOMEM, IRDA_SR_ERROR, "Unable to allocate TSAP !\n"); @@ -188,7 +188,7 @@ irnet_ias_to_tsap(irnet_socket * self, if(value->t.integer != -1) /* Get the remote TSAP selector */ dtsap_sel = value->t.integer; - else + else self->errno = -EADDRNOTAVAIL; break; default: @@ -280,8 +280,8 @@ irnet_connect_tsap(irnet_socket * self) } /* Connect to remote device */ - err = irttp_connect_request(self->tsap, self->dtsap_sel, - self->rsaddr, self->daddr, NULL, + err = irttp_connect_request(self->tsap, self->dtsap_sel, + self->rsaddr, self->daddr, NULL, self->max_sdu_size_rx, NULL); if(err != 0) { @@ -438,7 +438,7 @@ irnet_dname_to_daddr(irnet_socket * self) if(discoveries == NULL) DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n"); - /* + /* * Now, check all discovered devices (if any), and connect * client only about the services that the client is * interested in... @@ -627,7 +627,7 @@ irda_irnet_destroy(irnet_socket * self) /* Unregister with LM-IAS */ if(self->iriap) - { + { iriap_close(self->iriap); self->iriap = NULL; } @@ -945,7 +945,7 @@ irnet_setup_server(void) /* Register with LM-IAS (so that people can connect to us) */ irnet_server.ias_obj = irias_new_object(IRNET_SERVICE_NAME, jiffies); - irias_add_integer_attrib(irnet_server.ias_obj, IRNET_IAS_VALUE, + irias_add_integer_attrib(irnet_server.ias_obj, IRNET_IAS_VALUE, irnet_server.s.stsap_sel, IAS_KERNEL_ATTR); irias_insert_object(irnet_server.ias_obj); @@ -1076,7 +1076,7 @@ irnet_data_indication(void * instance, */ static void irnet_disconnect_indication(void * instance, - void * sap, + void * sap, LM_REASON reason, struct sk_buff *skb) { @@ -1166,10 +1166,10 @@ irnet_disconnect_indication(void * instance, */ static void irnet_connect_confirm(void * instance, - void * sap, + void * sap, struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, + __u8 max_header_size, struct sk_buff *skb) { irnet_socket * self = (irnet_socket *) instance; @@ -1235,7 +1235,7 @@ irnet_connect_confirm(void * instance, static void irnet_flow_indication(void * instance, void * sap, - LOCAL_FLOW flow) + LOCAL_FLOW flow) { irnet_socket * self = (irnet_socket *) instance; LOCAL_FLOW oldflow = self->tx_flow; @@ -1308,13 +1308,13 @@ irnet_status_indication(void * instance, * Some other node is attempting to connect to the IrNET service, and has * sent a connection request on our server socket. * We just redirect the connection to the relevant IrNET socket. - * + * * Note : we also make sure that between 2 irnet nodes, there can * exist only one irnet connection. */ static void irnet_connect_indication(void * instance, - void * sap, + void * sap, struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, @@ -1463,7 +1463,7 @@ irnet_connect_indication(void * instance, */ static void irnet_getvalue_confirm(int result, - __u16 obj_id, + __u16 obj_id, struct ias_value *value, void * priv) { @@ -1526,7 +1526,7 @@ irnet_getvalue_confirm(int result, */ static void irnet_discovervalue_confirm(int result, - __u16 obj_id, + __u16 obj_id, struct ias_value *value, void * priv) { @@ -1645,7 +1645,7 @@ irnet_discovery_indication(discinfo_t * discovery, void * priv) { irnet_socket * self = &irnet_server.s; - + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, "Invalid instance (0x%p) !!!\n", priv); @@ -1676,7 +1676,7 @@ irnet_expiry_indication(discinfo_t * expiry, void * priv) { irnet_socket * self = &irnet_server.s; - + DENTER(IRDA_OCB_TRACE, "(self=0x%p)\n", self); DASSERT(priv == &irnet_server, , IRDA_OCB_ERROR, "Invalid instance (0x%p) !!!\n", priv); @@ -1718,7 +1718,7 @@ irnet_proc_read(char * buf, int i = 0; len = 0; - + /* Get the IrNET server information... */ len += sprintf(buf+len, "IrNET server - "); len += sprintf(buf+len, "IrDA state: %s, ", @@ -1811,7 +1811,7 @@ irda_irnet_init(void) memset(&irnet_server, 0, sizeof(struct irnet_root)); /* Setup start of irnet instance list */ - irnet_server.list = hashbin_new(HB_NOLOCK); + irnet_server.list = hashbin_new(HB_NOLOCK); DABORT(irnet_server.list == NULL, -ENOMEM, MODULE_ERROR, "Can't allocate hashbin!\n"); /* Init spinlock for instance list */ diff --git a/net/irda/irnet/irnet_irda.h b/net/irda/irnet/irnet_irda.h index f2fecd32d8f6..0ba92d0d5204 100644 --- a/net/irda/irnet/irnet_irda.h +++ b/net/irda/irnet/irnet_irda.h @@ -146,7 +146,7 @@ static void void *); static void irnet_discovervalue_confirm(int, - __u16, + __u16, struct ias_value *, void *); #ifdef DISCOVERY_EVENTS diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c index a1e502ff9070..2f9f8dce5a69 100644 --- a/net/irda/irnet/irnet_ppp.c +++ b/net/irda/irnet/irnet_ppp.c @@ -93,7 +93,7 @@ irnet_ctrl_write(irnet_socket * ap, /* Check if we recognised one of the known command * We can't use "switch" with strings, so hack with "continue" */ - + /* First command : name -> Requested IrDA nickname */ if(!strncmp(start, "name", 4)) { @@ -744,7 +744,7 @@ dev_irnet_ioctl(struct inode * inode, break; /* Set DTR/RTS */ - case TIOCMBIS: + case TIOCMBIS: case TIOCMBIC: /* Set exclusive/non-exclusive mode */ case TIOCEXCL: @@ -941,7 +941,7 @@ ppp_irnet_send(struct ppp_channel * chan, ret = irttp_data_request(self->tsap, skb); if(ret < 0) { - /* + /* * > IrTTPs tx queue is full, so we just have to * > drop the frame! You might think that we should * > just return -1 and don't deallocate the frame, @@ -949,7 +949,7 @@ ppp_irnet_send(struct ppp_channel * chan, * > we have replaced the original skb with a new * > one with larger headroom, and that would really * > confuse do_dev_queue_xmit() in dev.c! I have - * > tried :-) DB + * > tried :-) DB * Correction : we verify the flow control above (self->tx_flow), * so we come here only if IrTTP doesn't like the packet (empty, * too large, IrTTP not connected). In those rare cases, it's ok @@ -1136,6 +1136,6 @@ irnet_cleanup(void) module_init(irnet_init); module_exit(irnet_cleanup); MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>"); -MODULE_DESCRIPTION("IrNET : Synchronous PPP over IrDA"); +MODULE_DESCRIPTION("IrNET : Synchronous PPP over IrDA"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CHARDEV(10, 187); diff --git a/net/irda/irproc.c b/net/irda/irproc.c index 88b9c43f6370..d6f9aba5b9dc 100644 --- a/net/irda/irproc.c +++ b/net/irda/irproc.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irproc.c * Version: 1.0 * Description: Various entries in the /proc file system @@ -10,17 +10,17 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999, Dag Brattli <dagb@cs.uit.no> - * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, * All Rights Reserved. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * - * I, Thomas Davis, provide no warranty for any of this software. - * This material is provided "AS-IS" and at no charge. - * + * + * I, Thomas Davis, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. + * ********************************************************************/ #include <linux/miscdevice.h> @@ -46,7 +46,7 @@ struct irda_entry { struct proc_dir_entry *proc_irda; EXPORT_SYMBOL(proc_irda); - + static struct irda_entry irda_dirs[] = { {"discovery", &discovery_seq_fops}, {"irttp", &irttp_seq_fops}, @@ -61,7 +61,7 @@ static struct irda_entry irda_dirs[] = { * Register irda entry in /proc file system * */ -void __init irda_proc_register(void) +void __init irda_proc_register(void) { int i; struct proc_dir_entry *d; @@ -73,7 +73,7 @@ void __init irda_proc_register(void) for (i=0; i<ARRAY_SIZE(irda_dirs); i++) { d = create_proc_entry(irda_dirs[i].name, 0, proc_irda); - if (d) + if (d) d->proc_fops = irda_dirs[i].fops; } } @@ -84,17 +84,17 @@ void __init irda_proc_register(void) * Unregister irda entry in /proc file system * */ -void __exit irda_proc_unregister(void) +void __exit irda_proc_unregister(void) { int i; - if (proc_irda) { - for (i=0; i<ARRAY_SIZE(irda_dirs); i++) - remove_proc_entry(irda_dirs[i].name, proc_irda); + if (proc_irda) { + for (i=0; i<ARRAY_SIZE(irda_dirs); i++) + remove_proc_entry(irda_dirs[i].name, proc_irda); - remove_proc_entry("irda", proc_net); - proc_irda = NULL; - } + remove_proc_entry("irda", proc_net); + proc_irda = NULL; + } } diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c index 1d26cd33ea13..92662330dbcf 100644 --- a/net/irda/irqueue.c +++ b/net/irda/irqueue.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irqueue.c * Version: 0.3 * Description: General queue implementation @@ -10,28 +10,28 @@ * Modified by: Dag Brattli <dagb@cs.uit.no> * Modified at: Thu Jan 4 14:29:10 CET 2001 * Modified by: Marc Zyngier <mzyngier@freesurf.fr> - * + * * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no> - * Copyright (C) 1998, Dag Brattli, + * Copyright (C) 1998, Dag Brattli, * All Rights Reserved. * * This code is taken from the Vortex Operating System written by Aage * Kvalnes. Aage has agreed that this code can use the GPL licence, * although he does not use that licence in his own code. - * + * * This copyright does however _not_ include the ELF hash() function * which I currently don't know which licence or copyright it * has. Please inform me if you know. - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ /* @@ -213,7 +213,7 @@ static __u32 hash( const char* name) { __u32 h = 0; __u32 g; - + while(*name) { h = (h<<4) + *name++; if ((g = (h & 0xf0000000))) @@ -231,7 +231,7 @@ static __u32 hash( const char* name) */ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element) { - + IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); /* @@ -242,7 +242,7 @@ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element) * Queue is empty. Insert one element into the queue. */ element->q_next = element->q_prev = *queue = element; - + } else { /* * Queue is not empty. Insert element into front of queue. @@ -267,20 +267,20 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue) irda_queue_t *ret; IRDA_DEBUG( 4, "dequeue_first()\n"); - + /* * Set return value */ ret = *queue; - + if ( *queue == NULL ) { /* * Queue was empty. */ } else if ( (*queue)->q_next == *queue ) { - /* + /* * Queue only contained a single element. It will now be - * empty. + * empty. */ *queue = NULL; } else { @@ -291,7 +291,7 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue) (*queue)->q_next->q_prev = (*queue)->q_prev; *queue = (*queue)->q_next; } - + /* * Return the removed entry (or NULL of queue was empty). */ @@ -306,25 +306,25 @@ static irda_queue_t *dequeue_first(irda_queue_t **queue) static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element) { irda_queue_t *ret; - + IRDA_DEBUG( 4, "dequeue_general()\n"); - + /* * Set return value */ ret = *queue; - + if ( *queue == NULL ) { /* * Queue was empty. */ } else if ( (*queue)->q_next == *queue ) { - /* + /* * Queue only contained a single element. It will now be - * empty. + * empty. */ *queue = NULL; - + } else { /* * Remove specific element. @@ -334,7 +334,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element if ( (*queue) == element) (*queue) = element->q_next; } - + /* * Return the removed entry (or NULL of queue was empty). */ @@ -352,7 +352,7 @@ static irda_queue_t *dequeue_general(irda_queue_t **queue, irda_queue_t* element hashbin_t *hashbin_new(int type) { hashbin_t* hashbin; - + /* * Allocate new hashbin */ @@ -380,8 +380,8 @@ EXPORT_SYMBOL(hashbin_new); /* * Function hashbin_delete (hashbin, free_func) * - * Destroy hashbin, the free_func can be a user supplied special routine - * for deallocating this structure if it's complex. If not the user can + * Destroy hashbin, the free_func can be a user supplied special routine + * for deallocating this structure if it's complex. If not the user can * just supply kfree, which should take care of the job. */ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) @@ -392,7 +392,7 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) IRDA_ASSERT(hashbin != NULL, return -1;); IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;); - + /* Synchronize */ if ( hashbin->hb_type & HB_LOCK ) { spin_lock_irqsave(&hashbin->hb_spinlock, flags); @@ -407,11 +407,11 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) while (queue ) { if (free_func) (*free_func)(queue); - queue = dequeue_first( + queue = dequeue_first( (irda_queue_t**) &hashbin->hb_queue[i]); } } - + /* Cleanup local data */ hashbin->hb_current = NULL; hashbin->magic = ~HB_MAGIC; @@ -438,7 +438,7 @@ EXPORT_SYMBOL(hashbin_delete); * Insert an entry into the hashbin * */ -void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, +void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, const char* name) { unsigned long flags = 0; @@ -460,14 +460,14 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, if ( hashbin->hb_type & HB_LOCK ) { spin_lock_irqsave(&hashbin->hb_spinlock, flags); } /* Default is no-lock */ - + /* * Store name and key */ entry->q_hash = hashv; if ( name ) strlcpy( entry->q_name, name, sizeof(entry->q_name)); - + /* * Insert new entry first */ @@ -482,7 +482,7 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, } EXPORT_SYMBOL(hashbin_insert); -/* +/* * Function hashbin_remove_first (hashbin) * * Remove first entry of the hashbin @@ -537,7 +537,7 @@ void *hashbin_remove_first( hashbin_t *hashbin) } -/* +/* * Function hashbin_remove (hashbin, hashv, name) * * Remove entry with the given name @@ -561,7 +561,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name) IRDA_ASSERT( hashbin != NULL, return NULL;); IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); - + /* * Locate hashbin */ @@ -601,7 +601,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name) entry = entry->q_next; } while ( entry != hashbin->hb_queue[ bin ] ); } - + /* * If entry was found, dequeue it */ @@ -622,18 +622,18 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name) if ( hashbin->hb_type & HB_LOCK ) { spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); } /* Default is no-lock */ - - + + /* Return */ - if ( found ) + if ( found ) return entry; else return NULL; - + } EXPORT_SYMBOL(hashbin_remove); -/* +/* * Function hashbin_remove_this (hashbin, entry) * * Remove entry with the given name @@ -655,7 +655,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry) IRDA_ASSERT( hashbin != NULL, return NULL;); IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); IRDA_ASSERT( entry != NULL, return NULL;); - + /* Synchronize */ if ( hashbin->hb_type & HB_LOCK ) { spin_lock_irqsave(&hashbin->hb_spinlock, flags); @@ -722,7 +722,7 @@ void* hashbin_find( hashbin_t* hashbin, long hashv, const char* name ) if ( name ) hashv = hash( name ); bin = GET_HASHBIN( hashv ); - + /* * Search for entry */ @@ -829,7 +829,7 @@ void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name, * called before any calls to hashbin_get_next()! * */ -irda_queue_t *hashbin_get_first( hashbin_t* hashbin) +irda_queue_t *hashbin_get_first( hashbin_t* hashbin) { irda_queue_t *entry; int i; @@ -860,7 +860,7 @@ EXPORT_SYMBOL(hashbin_get_first); * Get next item in hashbin. A series of hashbin_get_next() calls must * be started by a call to hashbin_get_first(). The function returns * NULL when all items have been traversed - * + * * The context of the search is stored within the hashbin, so you must * protect yourself from concurrent enumerations. - Jean II */ @@ -876,13 +876,13 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin) if ( hashbin->hb_current == NULL) { IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;); return NULL; - } + } entry = hashbin->hb_current->q_next; bin = GET_HASHBIN( entry->q_hash); - /* + /* * Make sure that we are not back at the beginning of the queue - * again + * again */ if ( entry != hashbin->hb_queue[ bin ]) { hashbin->hb_current = entry; @@ -895,7 +895,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin) */ if ( bin >= HASHBIN_SIZE) return NULL; - + /* * Move to next queue in hashbin */ @@ -904,7 +904,7 @@ irda_queue_t *hashbin_get_next( hashbin_t *hashbin) entry = hashbin->hb_queue[ i]; if ( entry) { hashbin->hb_current = entry; - + return entry; } } diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c index 86805c3d8324..bb53ba0be585 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irsysctl.c * Version: 1.0 * Description: Sysctl interface for IrDA @@ -8,19 +8,19 @@ * Created at: Sun May 24 22:12:06 1998 * Modified at: Fri Jun 4 02:50:15 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/mm.h> @@ -111,7 +111,7 @@ static ctl_table irda_table[] = { .strategy = &sysctl_string }, #ifdef CONFIG_IRDA_DEBUG - { + { .ctl_name = DEBUG, .procname = "debug", .data = &irda_debug, @@ -121,7 +121,7 @@ static ctl_table irda_table[] = { }, #endif #ifdef CONFIG_IRDA_FAST_RR - { + { .ctl_name = FAST_POLL, .procname = "fast_poll_increase", .data = &sysctl_fast_poll_increase, @@ -287,7 +287,7 @@ int __init irda_sysctl_register(void) * Unregister our sysctl interface * */ -void __exit irda_sysctl_unregister(void) +void __exit irda_sysctl_unregister(void) { unregister_sysctl_table(irda_table_header); } diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 03504f3e4990..68836358fdf2 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irttp.c * Version: 1.2 * Description: Tiny Transport Protocol (TTP) implementation @@ -8,18 +8,18 @@ * Created at: Sun Aug 31 20:14:31 1997 * Modified at: Wed Jan 5 11:31:27 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -42,17 +42,17 @@ static struct irttp_cb *irttp; static void __irttp_close_tsap(struct tsap_cb *self); -static int irttp_data_indication(void *instance, void *sap, +static int irttp_data_indication(void *instance, void *sap, struct sk_buff *skb); -static int irttp_udata_indication(void *instance, void *sap, +static int irttp_udata_indication(void *instance, void *sap, struct sk_buff *skb); -static void irttp_disconnect_indication(void *instance, void *sap, +static void irttp_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *); -static void irttp_connect_indication(void *instance, void *sap, +static void irttp_connect_indication(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, __u8 header_size, struct sk_buff *skb); -static void irttp_connect_confirm(void *instance, void *sap, - struct qos_info *qos, __u32 max_sdu_size, +static void irttp_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 header_size, struct sk_buff *skb); static void irttp_run_tx_queue(struct tsap_cb *self); static void irttp_run_rx_queue(struct tsap_cb *self); @@ -61,7 +61,7 @@ static void irttp_flush_queues(struct tsap_cb *self); static void irttp_fragment_skb(struct tsap_cb *self, struct sk_buff *skb); static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self); static void irttp_todo_expired(unsigned long data); -static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, +static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, int get); static void irttp_flow_indication(void *instance, void *sap, LOCAL_FLOW flow); @@ -109,7 +109,7 @@ int __init irttp_init(void) * Called by module destruction/cleanup code * */ -void __exit irttp_cleanup(void) +void __exit irttp_cleanup(void) { /* Check for main structure */ IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;); @@ -865,7 +865,7 @@ static int irttp_udata_indication(void *instance, void *sap, err = self->notify.udata_indication(self->notify.instance, self,skb); /* Same comment as in irttp_do_data_indication() */ - if (!err) + if (!err) return 0; } /* Either no handler, or handler returns an error */ @@ -940,7 +940,7 @@ static int irttp_data_indication(void *instance, void *sap, /* * If the peer device has given us some credits and we didn't have - * anyone from before, then we need to shedule the tx queue. + * anyone from before, then we need to shedule the tx queue. * We need to do that because our Tx have stopped (so we may not * get any LAP flow indication) and the user may be stopped as * well. - Jean II @@ -1798,14 +1798,14 @@ static void *irttp_seq_start(struct seq_file *seq, loff_t *pos) spin_lock_irq(&irttp->tsaps->hb_spinlock); iter->id = 0; - for (self = (struct tsap_cb *) hashbin_get_first(irttp->tsaps); + for (self = (struct tsap_cb *) hashbin_get_first(irttp->tsaps); self != NULL; self = (struct tsap_cb *) hashbin_get_next(irttp->tsaps)) { if (iter->id == *pos) break; ++iter->id; } - + return self; } diff --git a/net/irda/parameters.c b/net/irda/parameters.c index 1324942f976c..75a72d203b01 100644 --- a/net/irda/parameters.c +++ b/net/irda/parameters.c @@ -563,7 +563,7 @@ static int irda_param_extract(void *self, __u8 *buf, int len, * safe. Returns the number of bytes that was parsed * */ -int irda_param_extract_all(void *self, __u8 *buf, int len, +int irda_param_extract_all(void *self, __u8 *buf, int len, pi_param_info_t *info) { int ret = -1; diff --git a/net/irda/qos.c b/net/irda/qos.c index 95a69c013ee8..349012c926b7 100644 --- a/net/irda/qos.c +++ b/net/irda/qos.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: qos.c * Version: 1.0 * Description: IrLAP QoS parameter negotiation @@ -8,26 +8,26 @@ * Created at: Tue Sep 9 00:00:26 1997 * Modified at: Sun Jan 30 14:29:16 2000 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. - * + * * 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. - * - * 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, + * + * 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, * MA 02111-1307 USA - * + * ********************************************************************/ #include <asm/byteorder.h> @@ -84,16 +84,16 @@ unsigned sysctl_max_tx_data_size = 2042; unsigned sysctl_max_tx_window = 7; static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get); -static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, +static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, int get); -static int irlap_param_max_turn_time(void *instance, irda_param_t *param, +static int irlap_param_max_turn_time(void *instance, irda_param_t *param, int get); static int irlap_param_data_size(void *instance, irda_param_t *param, int get); -static int irlap_param_window_size(void *instance, irda_param_t *param, +static int irlap_param_window_size(void *instance, irda_param_t *param, int get); -static int irlap_param_additional_bofs(void *instance, irda_param_t *parm, +static int irlap_param_additional_bofs(void *instance, irda_param_t *parm, int get); -static int irlap_param_min_turn_time(void *instance, irda_param_t *param, +static int irlap_param_min_turn_time(void *instance, irda_param_t *param, int get); #ifndef CONFIG_IRDA_DYNAMIC_WINDOW @@ -101,7 +101,7 @@ static __u32 irlap_requested_line_capacity(struct qos_info *qos); #endif static __u32 min_turn_times[] = { 10000, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */ -static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, +static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, 1152000, 4000000, 16000000 }; /* bps */ static __u32 data_sizes[] = { 64, 128, 256, 512, 1024, 2048 }; /* bytes */ static __u32 add_bofs[] = { 48, 24, 12, 5, 3, 2, 1, 0 }; /* bytes */ @@ -165,7 +165,7 @@ static pi_param_info_t irlap_param_info = { pi_major_call_table, 2, 0x7f, 7 }; static inline int value_index(__u32 value, __u32 *array, int size) { int i; - + for (i=0; i < size; i++) if (array[i] == value) break; @@ -178,7 +178,7 @@ static inline int value_index(__u32 value, __u32 *array, int size) * Returns value to index in array, easy! * */ -static inline __u32 index_value(int index, __u32 *array) +static inline __u32 index_value(int index, __u32 *array) { return array[index]; } @@ -189,7 +189,7 @@ static inline __u32 index_value(int index, __u32 *array) * Returns index to most significant bit (MSB) in word * */ -static int msb_index (__u16 word) +static int msb_index (__u16 word) { __u16 msb = 0x8000; int index = 15; /* Current MSB */ @@ -298,12 +298,12 @@ void irda_qos_compute_intersection(struct qos_info *qos, struct qos_info *new) * * The purpose of this function is for layers and drivers to be able to * set the maximum QoS possible and then "and in" their own limitations - * + * */ void irda_init_max_qos_capabilies(struct qos_info *qos) { int i; - /* + /* * These are the maximum supported values as specified on pages * 39-43 in IrLAP */ @@ -361,25 +361,25 @@ static void irlap_adjust_qos_settings(struct qos_info *qos) qos->min_turn_time.value = sysctl_min_tx_turn_time; } - /* + /* * Not allowed to use a max turn time less than 500 ms if the baudrate * is less than 115200 */ - if ((qos->baud_rate.value < 115200) && + if ((qos->baud_rate.value < 115200) && (qos->max_turn_time.value < 500)) { - IRDA_DEBUG(0, + IRDA_DEBUG(0, "%s(), adjusting max turn time from %d to 500 ms\n", __FUNCTION__, qos->max_turn_time.value); qos->max_turn_time.value = 500; } - + /* - * The data size must be adjusted according to the baud rate and max + * The data size must be adjusted according to the baud rate and max * turn time */ index = value_index(qos->data_size.value, data_sizes, 6); - line_capacity = irlap_max_line_capacity(qos->baud_rate.value, + line_capacity = irlap_max_line_capacity(qos->baud_rate.value, qos->max_turn_time.value); #ifdef CONFIG_IRDA_DYNAMIC_WINDOW @@ -427,32 +427,32 @@ static void irlap_adjust_qos_settings(struct qos_info *qos) * We just set the QoS capabilities for the peer station * */ -int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb) +int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb) { int ret; - - ret = irda_param_extract_all(self, skb->data, skb->len, + + ret = irda_param_extract_all(self, skb->data, skb->len, &irlap_param_info); - + /* Convert the negotiated bits to values */ irda_qos_bits_to_value(&self->qos_tx); irda_qos_bits_to_value(&self->qos_rx); irlap_adjust_qos_settings(&self->qos_tx); - IRDA_DEBUG(2, "Setting BAUD_RATE to %d bps.\n", + IRDA_DEBUG(2, "Setting BAUD_RATE to %d bps.\n", self->qos_tx.baud_rate.value); IRDA_DEBUG(2, "Setting DATA_SIZE to %d bytes\n", self->qos_tx.data_size.value); - IRDA_DEBUG(2, "Setting WINDOW_SIZE to %d\n", + IRDA_DEBUG(2, "Setting WINDOW_SIZE to %d\n", self->qos_tx.window_size.value); - IRDA_DEBUG(2, "Setting XBOFS to %d\n", + IRDA_DEBUG(2, "Setting XBOFS to %d\n", self->qos_tx.additional_bofs.value); IRDA_DEBUG(2, "Setting MAX_TURN_TIME to %d ms.\n", self->qos_tx.max_turn_time.value); IRDA_DEBUG(2, "Setting MIN_TURN_TIME to %d usecs.\n", self->qos_tx.min_turn_time.value); - IRDA_DEBUG(2, "Setting LINK_DISC to %d secs.\n", + IRDA_DEBUG(2, "Setting LINK_DISC to %d secs.\n", self->qos_tx.link_disc_time.value); return ret; } @@ -463,55 +463,55 @@ int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb) * Insert QoS negotiaion pararameters into frame * */ -int irlap_insert_qos_negotiation_params(struct irlap_cb *self, +int irlap_insert_qos_negotiation_params(struct irlap_cb *self, struct sk_buff *skb) { int ret; /* Insert data rate */ - ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, + ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert max turnaround time */ - ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, + ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert data size */ - ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, + ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert window size */ - ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, + ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert additional BOFs */ - ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, + ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert minimum turnaround time */ - ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, + ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; skb_put(skb, ret); /* Insert link disconnect/threshold time */ - ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, + ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, skb_tailroom(skb), &irlap_param_info); if (ret < 0) return ret; @@ -537,12 +537,12 @@ static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get) if (get) { param->pv.i = self->qos_rx.baud_rate.bits; - IRDA_DEBUG(2, "%s(), baud rate = 0x%02x\n", - __FUNCTION__, param->pv.i); + IRDA_DEBUG(2, "%s(), baud rate = 0x%02x\n", + __FUNCTION__, param->pv.i); } else { - /* + /* * Stations must agree on baud rate, so calculate - * intersection + * intersection */ IRDA_DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", (__u16) param->pv.i); final = (__u16) param->pv.i & self->qos_rx.baud_rate.bits; @@ -558,24 +558,24 @@ static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get) /* * Function irlap_param_link_disconnect (instance, param, get) * - * Negotiate link disconnect/threshold time. + * Negotiate link disconnect/threshold time. * */ -static int irlap_param_link_disconnect(void *instance, irda_param_t *param, +static int irlap_param_link_disconnect(void *instance, irda_param_t *param, int get) { __u16 final; - + struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.link_disc_time.bits; else { - /* - * Stations must agree on link disconnect/threshold + /* + * Stations must agree on link disconnect/threshold * time. */ IRDA_DEBUG(2, "LINK_DISC: %02x\n", (__u8) param->pv.i); @@ -595,14 +595,14 @@ static int irlap_param_link_disconnect(void *instance, irda_param_t *param, * will be negotiated independently for each station * */ -static int irlap_param_max_turn_time(void *instance, irda_param_t *param, +static int irlap_param_max_turn_time(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.max_turn_time.bits; else @@ -621,10 +621,10 @@ static int irlap_param_max_turn_time(void *instance, irda_param_t *param, static int irlap_param_data_size(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.data_size.bits; else @@ -640,14 +640,14 @@ static int irlap_param_data_size(void *instance, irda_param_t *param, int get) * will be negotiated independently for each station * */ -static int irlap_param_window_size(void *instance, irda_param_t *param, +static int irlap_param_window_size(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.window_size.bits; else @@ -665,10 +665,10 @@ static int irlap_param_window_size(void *instance, irda_param_t *param, static int irlap_param_additional_bofs(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.additional_bofs.bits; else @@ -683,14 +683,14 @@ static int irlap_param_additional_bofs(void *instance, irda_param_t *param, int * Negotiate the minimum turn around time. This is a type 1 parameter and * will be negotiated independently for each station */ -static int irlap_param_min_turn_time(void *instance, irda_param_t *param, +static int irlap_param_min_turn_time(void *instance, irda_param_t *param, int get) { struct irlap_cb *self = (struct irlap_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;); - + if (get) param->pv.i = self->qos_rx.min_turn_time.bits; else @@ -721,9 +721,9 @@ __u32 irlap_max_line_capacity(__u32 speed, __u32 max_turn_time) line_capacity = max_line_capacities[i][j]; - IRDA_DEBUG(2, "%s(), line capacity=%d bytes\n", + IRDA_DEBUG(2, "%s(), line capacity=%d bytes\n", __FUNCTION__, line_capacity); - + return line_capacity; } @@ -749,7 +749,7 @@ void irda_qos_bits_to_value(struct qos_info *qos) int index; IRDA_ASSERT(qos != NULL, return;); - + index = msb_index(qos->baud_rate.bits); qos->baud_rate.value = baud_rates[index]; @@ -761,13 +761,13 @@ void irda_qos_bits_to_value(struct qos_info *qos) index = msb_index(qos->min_turn_time.bits); qos->min_turn_time.value = min_turn_times[index]; - + index = msb_index(qos->max_turn_time.bits); qos->max_turn_time.value = max_turn_times[index]; index = msb_index(qos->link_disc_time.bits); qos->link_disc_time.value = link_disc_times[index]; - + index = msb_index(qos->additional_bofs.bits); qos->additional_bofs.value = add_bofs[index]; } diff --git a/net/irda/timer.c b/net/irda/timer.c index 3871a2b911f9..d3a6ee8cc4a2 100644 --- a/net/irda/timer.c +++ b/net/irda/timer.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: timer.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Aug 16 00:59:29 1997 * Modified at: Wed Dec 8 12:50:34 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.com> - * - * 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 + * + * 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 * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -40,11 +40,11 @@ static void irlap_query_timer_expired(void* data); static void irlap_final_timer_expired(void* data); static void irlap_wd_timer_expired(void* data); static void irlap_backoff_timer_expired(void* data); -static void irlap_media_busy_expired(void* data); +static void irlap_media_busy_expired(void* data); void irlap_start_slot_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->slot_timer, timeout, (void *) self, + irda_start_timer(&self->slot_timer, timeout, (void *) self, irlap_slot_timer_expired); } @@ -67,31 +67,31 @@ void irlap_start_query_timer(struct irlap_cb *self, int S, int s) /* Set or re-set the timer. We reset the timer for each received * discovery query, which allow us to automatically adjust to * the speed of the peer discovery (faster or slower). Jean II */ - irda_start_timer( &self->query_timer, timeout, (void *) self, + irda_start_timer( &self->query_timer, timeout, (void *) self, irlap_query_timer_expired); } void irlap_start_final_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->final_timer, timeout, (void *) self, + irda_start_timer(&self->final_timer, timeout, (void *) self, irlap_final_timer_expired); } void irlap_start_wd_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->wd_timer, timeout, (void *) self, + irda_start_timer(&self->wd_timer, timeout, (void *) self, irlap_wd_timer_expired); } void irlap_start_backoff_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->backoff_timer, timeout, (void *) self, + irda_start_timer(&self->backoff_timer, timeout, (void *) self, irlap_backoff_timer_expired); } void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout) { - irda_start_timer(&self->media_busy_timer, timeout, + irda_start_timer(&self->media_busy_timer, timeout, (void *) self, irlap_media_busy_expired); } @@ -109,25 +109,25 @@ void irlap_stop_mbusy_timer(struct irlap_cb *self) irlap_do_event(self, MEDIA_BUSY_TIMER_EXPIRED, NULL, NULL); } -void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout) +void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout) { irda_start_timer(&self->watchdog_timer, timeout, (void *) self, irlmp_watchdog_timer_expired); } -void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout) +void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout) { irda_start_timer(&self->discovery_timer, timeout, (void *) self, irlmp_discovery_timer_expired); } -void irlmp_start_idle_timer(struct lap_cb *self, int timeout) +void irlmp_start_idle_timer(struct lap_cb *self, int timeout) { irda_start_timer(&self->idle_timer, timeout, (void *) self, irlmp_idle_timer_expired); } -void irlmp_stop_idle_timer(struct lap_cb *self) +void irlmp_stop_idle_timer(struct lap_cb *self) { /* If timer is activated, kill it! */ del_timer(&self->idle_timer); @@ -147,7 +147,7 @@ static void irlap_slot_timer_expired(void *data) IRDA_ASSERT(self->magic == LAP_MAGIC, return;); irlap_do_event(self, SLOT_TIMER_EXPIRED, NULL, NULL); -} +} /* * Function irlap_query_timer_expired (data) @@ -163,12 +163,12 @@ static void irlap_query_timer_expired(void *data) IRDA_ASSERT(self->magic == LAP_MAGIC, return;); irlap_do_event(self, QUERY_TIMER_EXPIRED, NULL, NULL); -} +} /* * Function irda_final_timer_expired (data) * - * + * * */ static void irlap_final_timer_expired(void *data) @@ -184,32 +184,32 @@ static void irlap_final_timer_expired(void *data) /* * Function irda_wd_timer_expired (data) * - * + * * */ static void irlap_wd_timer_expired(void *data) { struct irlap_cb *self = (struct irlap_cb *) data; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); - + irlap_do_event(self, WD_TIMER_EXPIRED, NULL, NULL); } /* * Function irda_backoff_timer_expired (data) * - * + * * */ static void irlap_backoff_timer_expired(void *data) { struct irlap_cb *self = (struct irlap_cb *) data; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); - + irlap_do_event(self, BACKOFF_TIMER_EXPIRED, NULL, NULL); } @@ -217,7 +217,7 @@ static void irlap_backoff_timer_expired(void *data) /* * Function irtty_media_busy_expired (data) * - * + * */ void irlap_media_busy_expired(void* data) { diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c index 87130c1c8693..5abfb71aae8d 100644 --- a/net/irda/wrapper.c +++ b/net/irda/wrapper.c @@ -295,7 +295,7 @@ async_unwrap_bof(struct net_device *dev, case OUTSIDE_FRAME: case BEGIN_FRAME: default: - /* We may receive multiple BOF at the start of frame */ + /* We may receive multiple BOF at the start of frame */ break; } |