X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Firda%2Fircomm%2Fircomm_lmp.c;h=67c99d20857fab4e2e078e9c1d5d4a9ee6bbc952;hb=cf816ecb533ab96b883dfdc0db174598b5b5c4d2;hp=c8e0d89ee11fd3e9443767fd875d05372453bcc5;hpb=c730f5b621afa33e9f4939da9078669162ebff4e;p=linux-2.6-omap-h63xx.git diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c index c8e0d89ee11..67c99d20857 100644 --- a/net/irda/ircomm/ircomm_lmp.c +++ b/net/irda/ircomm/ircomm_lmp.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: ircomm_lmp.c * Version: 1.0 * Description: Interface between IrCOMM and IrLMP @@ -9,28 +9,27 @@ * Modified at: Sun Dec 12 13:44:17 1999 * Modified by: Dag Brattli * Sources: Previous IrLPT work by Thomas Davis - * + * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * Copyright (c) 2000-2003 Jean Tourrilhes - * - * 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 #include #include @@ -45,30 +44,30 @@ /* * 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; - IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(0, "%s()\n", __func__ ); /* Don't forget to refcount it - should be NULL anyway */ if(userdata) 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, @@ -77,8 +76,8 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, struct sk_buff *tx_skb; int ret; - IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - + IRDA_DEBUG(0, "%s()\n", __func__ ); + /* Any userdata supplied? */ if (userdata == NULL) { tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); @@ -88,8 +87,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 +104,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__ ); + IRDA_DEBUG(0, "%s()\n", __func__ ); - 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 +135,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) @@ -149,30 +148,30 @@ 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; + IRDA_DEBUG(2, "%s()\n", __func__ ); + + line = cb->line; self = (struct ircomm_cb *) hashbin_lock_find(ircomm, line, NULL); - if (!self) { - IRDA_DEBUG(2, "%s(), didn't find myself\n", __FUNCTION__ ); - return; + if (!self) { + IRDA_DEBUG(2, "%s(), didn't find myself\n", __func__ ); + 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", __func__ ); + 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 +179,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,26 +188,26 @@ 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; - IRDA_DEBUG(4, "%s(), sending frame\n", __FUNCTION__ ); + cb->line = self->line; + + IRDA_DEBUG(4, "%s(), sending frame\n", __func__ ); /* Don't forget to refcount it - see ircomm_tty_do_softint() */ skb_get(skb); skb->destructor = ircomm_lmp_flow_control; - 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); - } + if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { + IRDA_DEBUG(2, "%s(), asking TTY to slow down!\n", __func__ ); + 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__); + IRDA_ERROR("%s(), failed\n", __func__); /* irlmp_data_request already free the packet */ } @@ -226,12 +225,12 @@ 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_DEBUG(4, "%s()\n", __func__ ); + 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,22 +240,22 @@ 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) { struct ircomm_cb *self = (struct ircomm_cb *) instance; struct ircomm_info info; - IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(0, "%s()\n", __func__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -289,7 +288,7 @@ static void ircomm_lmp_connect_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *)instance; struct ircomm_info info; - IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(0, "%s()\n", __func__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -312,14 +311,14 @@ 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) { struct ircomm_cb *self = (struct ircomm_cb *) instance; struct ircomm_info info; - IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(0, "%s()\n", __func__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -342,7 +341,7 @@ int ircomm_open_lsap(struct ircomm_cb *self) { notify_t notify; - IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(0, "%s()\n", __func__ ); /* Register callbacks */ irda_notify_init(¬ify); @@ -355,7 +354,7 @@ int ircomm_open_lsap(struct ircomm_cb *self) self->lsap = irlmp_open_lsap(LSAP_ANY, ¬ify, 0); if (!self->lsap) { - IRDA_DEBUG(0,"%sfailed to allocate tsap\n", __FUNCTION__ ); + IRDA_DEBUG(0,"%sfailed to allocate tsap\n", __func__ ); return -1; } self->slsap_sel = self->lsap->slsap_sel;