提交 6819bc2e 编写于 作者: Y YOSHIFUJI Hideaki 提交者: David S. Miller

[NET] IRDA: Fix whitespace errors.

Signed-off-by: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 981c0ff6
......@@ -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;
}
/*
......
/*********************************************************************
*
*
* 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;
......
/*********************************************************************
*
*
* 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");
......
/*********************************************************************
*
*
* 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);
}
/*********************************************************************
*
*
* 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)
{
......
/*********************************************************************
*
*
* 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)
......
/*********************************************************************
*
*
* 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 @@ static void ircomm_ttp_connect_confirm(void *instance, void *sap,
* 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 @@ static void ircomm_ttp_connect_indication(void *instance, void *sap,
/*
* 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);
}
......
此差异已折叠。
此差异已折叠。
/*********************************************************************
*
*
* 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 */
......
......@@ -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);
}
......
......@@ -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');
......
......@@ -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__);
......
/*********************************************************************
*
*
* 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, &notify);
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;
}
......
/*********************************************************************
*
*
* 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;
}
......
此差异已折叠。
/*********************************************************************
*
*
* 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 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev)
*
*/
#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);
......
/*********************************************************************
*
*
* 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]);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -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);
......
此差异已折叠。
此差异已折叠。
......@@ -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;
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -146,7 +146,7 @@ static void
void *);
static void
irnet_discovervalue_confirm(int,
__u16,
__u16,
struct ias_value *,
void *);
#ifdef DISCOVERY_EVENTS
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册