]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/irda/ircomm/ircomm_tty_attach.c
Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mv-sheeva.git] / net / irda / ircomm / ircomm_tty_attach.c
index 99f5eddbb4b78281c39b6e0e359b1a3d88f78cca..eafc010907c2d65c803b2285b8045a598fc00893 100644 (file)
@@ -1,35 +1,34 @@
 /*********************************************************************
- *                
+ *
  * Filename:      ircomm_tty_attach.c
- * Version:       
+ * Version:
  * Description:   Code for attaching the serial driver to IrCOMM
  * Status:        Experimental.
  * Author:        Dag Brattli <dagb@cs.uit.no>
  * Created at:    Sat Jun  5 17:42:00 1999
  * Modified at:   Tue Jan  4 14:20:49 2000
  * Modified by:   Dag Brattli <dagb@cs.uit.no>
- * 
+ *
  *     Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
  *     Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
- *     
- *     This program is free software; you can redistribute it and/or 
- *     modify it under the terms of the GNU General Public License as 
- *     published by the Free Software Foundation; either version 2 of 
+ *
+ *     This program is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of
  *     the License, or (at your option) any later version.
- * 
+ *
  *     This program is distributed in the hope that it will be useful,
  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  *     GNU General Public License for more details.
- * 
- *     You should have received a copy of the GNU General Public License 
- *     along with this program; if not, write to the Free Software 
- *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
+ *
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program; if not, write to the Free Software
+ *     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *     MA 02111-1307 USA
- *     
+ *
  ********************************************************************/
 
-#include <linux/sched.h>
 #include <linux/init.h>
 
 #include <net/irda/irda.h>
@@ -50,38 +49,38 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self);
 static void ircomm_tty_discovery_indication(discinfo_t *discovery,
                                            DISCOVERY_MODE mode,
                                            void *priv);
-static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, 
+static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
                                        struct ias_value *value, void *priv);
 static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
                                            int timeout);
 static void ircomm_tty_watchdog_timer_expired(void *data);
 
-static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, 
-                                IRCOMM_TTY_EVENT event, 
-                                struct sk_buff *skb, 
+static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
+                                IRCOMM_TTY_EVENT event,
+                                struct sk_buff *skb,
                                 struct ircomm_tty_info *info);
-static int ircomm_tty_state_search(struct ircomm_tty_cb *self, 
-                                  IRCOMM_TTY_EVENT event, 
-                                  struct sk_buff *skb, 
+static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
+                                  IRCOMM_TTY_EVENT event,
+                                  struct sk_buff *skb,
                                   struct ircomm_tty_info *info);
-static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, 
-                                            IRCOMM_TTY_EVENT event, 
-                                            struct sk_buff *skb, 
+static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
+                                            IRCOMM_TTY_EVENT event,
+                                            struct sk_buff *skb,
                                             struct ircomm_tty_info *info);
-static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, 
-                                          IRCOMM_TTY_EVENT event, 
-                                          struct sk_buff *skb, 
+static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
+                                          IRCOMM_TTY_EVENT event,
+                                          struct sk_buff *skb,
                                           struct ircomm_tty_info *info);
-static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, 
-                                 IRCOMM_TTY_EVENT event, 
-                                 struct sk_buff *skb, 
+static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
+                                 IRCOMM_TTY_EVENT event,
+                                 struct sk_buff *skb,
                                  struct ircomm_tty_info *info);
-static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, 
-                                 IRCOMM_TTY_EVENT event, 
-                                 struct sk_buff *skb, 
+static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
+                                 IRCOMM_TTY_EVENT event,
+                                 struct sk_buff *skb,
                                  struct ircomm_tty_info *info);
 
-char *ircomm_tty_state[] = {
+const char *const ircomm_tty_state[] = {
        "IRCOMM_TTY_IDLE",
        "IRCOMM_TTY_SEARCH",
        "IRCOMM_TTY_QUERY_PARAMETERS",
@@ -92,7 +91,7 @@ char *ircomm_tty_state[] = {
 };
 
 #ifdef CONFIG_IRDA_DEBUG
-static char *ircomm_tty_event[] = {
+static const char *const ircomm_tty_event[] = {
        "IRCOMM_TTY_ATTACH_CABLE",
        "IRCOMM_TTY_DETACH_CABLE",
        "IRCOMM_TTY_DATA_REQUEST",
@@ -111,7 +110,7 @@ static char *ircomm_tty_event[] = {
 #endif /* CONFIG_IRDA_DEBUG */
 
 static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
-                     struct sk_buff *skb, struct ircomm_tty_info *info) = 
+                     struct sk_buff *skb, struct ircomm_tty_info *info) =
 {
        ircomm_tty_state_idle,
        ircomm_tty_state_search,
@@ -125,19 +124,19 @@ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
  * Function ircomm_tty_attach_cable (driver)
  *
  *    Try to attach cable (IrCOMM link). This function will only return
- *    when the link has been connected, or if an error condition occurs. 
+ *    when the link has been connected, or if an error condition occurs.
  *    If success, the return value is the resulting service type.
  */
 int ircomm_tty_attach_cable(struct ircomm_tty_cb *self)
 {
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return -1;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
-               /* Check if somebody has already connected to us */
+       /* Check if somebody has already connected to us */
        if (ircomm_is_connected(self->ircomm)) {
-               IRDA_DEBUG(0, "%s(), already connected!\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), already connected!\n", __func__ );
                return 0;
        }
 
@@ -159,7 +158,7 @@ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self)
  */
 void ircomm_tty_detach_cable(struct ircomm_tty_cb *self)
 {
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
@@ -177,7 +176,7 @@ void ircomm_tty_detach_cable(struct ircomm_tty_cb *self)
                self->skey = NULL;
        }
 
-       if (self->iriap) { 
+       if (self->iriap) {
                iriap_close(self->iriap);
                self->iriap = NULL;
        }
@@ -208,11 +207,11 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self)
        __u8 oct_seq[6];
        __u16 hints;
 
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
-       
+
        /* Compute hint bits based on service */
        hints = irlmp_service_to_hint(S_COMM);
        if (self->service_type & IRCOMM_3_WIRE_RAW)
@@ -234,19 +233,19 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self)
        if (self->service_type & IRCOMM_3_WIRE_RAW) {
                /* Register IrLPT with LM-IAS */
                self->obj = irias_new_object("IrLPT", IAS_IRLPT_ID);
-               irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel", 
+               irias_add_integer_attrib(self->obj, "IrDA:IrLMP:LsapSel",
                                         self->slsap_sel, IAS_KERNEL_ATTR);
        } else {
                /* Register IrCOMM with LM-IAS */
                self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID);
-               irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel", 
+               irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel",
                                         self->slsap_sel, IAS_KERNEL_ATTR);
-               
+
                /* Code the parameters into the buffer */
-               irda_param_pack(oct_seq, "bbbbbb", 
+               irda_param_pack(oct_seq, "bbbbbb",
                                IRCOMM_SERVICE_TYPE, 1, self->service_type,
                                IRCOMM_PORT_TYPE,    1, IRCOMM_SERIAL);
-               
+
                /* Register parameters with LM-IAS */
                irias_add_octseq_attrib(self->obj, "Parameters", oct_seq, 6,
                                        IAS_KERNEL_ATTR);
@@ -302,23 +301,23 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
        IRDA_ASSERT(self != NULL, return -1;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
-       if (self->service_type & IRCOMM_3_WIRE_RAW) 
+       if (self->service_type & IRCOMM_3_WIRE_RAW)
                return 0;
 
-       /* 
-        * Set default values, but only if the application for some reason 
+       /*
+        * Set default values, but only if the application for some reason
         * haven't set them already
         */
-       IRDA_DEBUG(2, "%s(), data-rate = %d\n", __FUNCTION__ , 
+       IRDA_DEBUG(2, "%s(), data-rate = %d\n", __func__ ,
                   self->settings.data_rate);
        if (!self->settings.data_rate)
                self->settings.data_rate = 9600;
-       IRDA_DEBUG(2, "%s(), data-format = %d\n", __FUNCTION__ , 
+       IRDA_DEBUG(2, "%s(), data-format = %d\n", __func__ ,
                   self->settings.data_format);
        if (!self->settings.data_format)
                self->settings.data_format = IRCOMM_WSIZE_8;  /* 8N1 */
 
-       IRDA_DEBUG(2, "%s(), flow-control = %d\n", __FUNCTION__ , 
+       IRDA_DEBUG(2, "%s(), flow-control = %d\n", __func__ ,
                   self->settings.flow_control);
        /*self->settings.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/
 
@@ -330,7 +329,7 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
                ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE);
        ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
        ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE);
-       
+
        /* For a 3 wire service, we just flush the last parameter and return */
        if (self->settings.service_type == IRCOMM_3_WIRE) {
                ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE);
@@ -342,10 +341,10 @@ int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
 #if 0
        ircomm_param_request(self, IRCOMM_XON_XOFF, FALSE);
        ircomm_param_request(self, IRCOMM_ENQ_ACK, FALSE);
-#endif 
+#endif
        /* Notify peer that we are ready to receive data */
        ircomm_param_request(self, IRCOMM_DTE, TRUE);
-       
+
        return 0;
 }
 
@@ -363,7 +362,7 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
        struct ircomm_tty_cb *self;
        struct ircomm_tty_info info;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        /* Important note :
         * We need to drop all passive discoveries.
@@ -382,18 +381,9 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
        info.daddr = discovery->daddr;
        info.saddr = discovery->saddr;
 
-       /* FIXME. We have a locking problem on the hashbin here.
-        * We probably need to use hashbin_find_next(), but we first
-        * need to ensure that "line" is unique. - Jean II */
-       self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty);
-       while (self != NULL) {
-               IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
-               
-               ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION, 
-                                   NULL, &info);
-
-               self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
-       }
+       self = (struct ircomm_tty_cb *) priv;
+       ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
+                           NULL, &info);
 }
 
 /*
@@ -402,13 +392,13 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
  *    Link disconnected
  *
  */
-void ircomm_tty_disconnect_indication(void *instance, void *sap, 
+void ircomm_tty_disconnect_indication(void *instance, void *sap,
                                      LM_REASON reason,
                                      struct sk_buff *skb)
 {
        struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
@@ -422,7 +412,7 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap,
        /* Stop data transfers */
        self->tty->hw_stopped = 1;
 
-       ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, 
+       ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL,
                            NULL);
 }
 
@@ -432,13 +422,13 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap,
  *    Got result from the IAS query we make
  *
  */
-static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, 
-                                       struct ias_value *value, 
+static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
+                                       struct ias_value *value,
                                        void *priv)
 {
        struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
@@ -449,37 +439,37 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
 
        /* Check if request succeeded */
        if (result != IAS_SUCCESS) {
-               IRDA_DEBUG(4, "%s(), got NULL value!\n", __FUNCTION__ );
+               IRDA_DEBUG(4, "%s(), got NULL value!\n", __func__ );
                return;
        }
 
        switch (value->type) {
-       case IAS_OCT_SEQ:
-               IRDA_DEBUG(2, "%s(), got octet sequence\n", __FUNCTION__ );
+       case IAS_OCT_SEQ:
+               IRDA_DEBUG(2, "%s(), got octet sequence\n", __func__ );
 
                irda_param_extract_all(self, value->t.oct_seq, value->len,
                                       &ircomm_param_info);
 
-               ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL, 
+               ircomm_tty_do_event(self, IRCOMM_TTY_GOT_PARAMETERS, NULL,
                                    NULL);
                break;
        case IAS_INTEGER:
-               /* Got LSAP selector */ 
-               IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __FUNCTION__ , 
+               /* Got LSAP selector */
+               IRDA_DEBUG(2, "%s(), got lsapsel = %d\n", __func__ ,
                           value->t.integer);
 
                if (value->t.integer == -1) {
-                       IRDA_DEBUG(0, "%s(), invalid value!\n", __FUNCTION__ );
+                       IRDA_DEBUG(0, "%s(), invalid value!\n", __func__ );
                } else
                        self->dlsap_sel = value->t.integer;
 
                ircomm_tty_do_event(self, IRCOMM_TTY_GOT_LSAPSEL, NULL, NULL);
                break;
        case IAS_MISSING:
-               IRDA_DEBUG(0, "%s(), got IAS_MISSING\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), got IAS_MISSING\n", __func__ );
                break;
        default:
-               IRDA_DEBUG(0, "%s(), got unknown type!\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), got unknown type!\n", __func__ );
                break;
        }
        irias_delete_value(value);
@@ -491,15 +481,15 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
  *    Connection confirmed
  *
  */
-void ircomm_tty_connect_confirm(void *instance, void *sap, 
-                               struct qos_info *qos, 
-                               __u32 max_data_size, 
-                               __u8 max_header_size, 
+void ircomm_tty_connect_confirm(void *instance, void *sap,
+                               struct qos_info *qos,
+                               __u32 max_data_size,
+                               __u8 max_header_size,
                                struct sk_buff *skb)
 {
        struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
@@ -515,22 +505,22 @@ void ircomm_tty_connect_confirm(void *instance, void *sap,
 }
 
 /*
- * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size, 
+ * Function ircomm_tty_connect_indication (instance, sap, qos, max_sdu_size,
  *                                         skb)
  *
  *    we are discovered and being requested to connect by remote device !
  *
  */
-void ircomm_tty_connect_indication(void *instance, void *sap, 
-                                  struct qos_info *qos, 
+void ircomm_tty_connect_indication(void *instance, void *sap,
+                                  struct qos_info *qos,
                                   __u32 max_data_size,
-                                  __u8 max_header_size, 
+                                  __u8 max_header_size,
                                   struct sk_buff *skb)
 {
        struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
        int clen;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
@@ -542,8 +532,8 @@ void ircomm_tty_connect_indication(void *instance, void *sap,
 
        clen = skb->data[0];
        if (clen)
-               irda_param_extract_all(self, skb->data+1, 
-                                      IRDA_MIN(skb->len, clen), 
+               irda_param_extract_all(self, skb->data+1,
+                                      IRDA_MIN(skb->len, clen),
                                       &ircomm_param_info);
 
        ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL);
@@ -559,30 +549,30 @@ void ircomm_tty_connect_indication(void *instance, void *sap,
  */
 void ircomm_tty_link_established(struct ircomm_tty_cb *self)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
 
        if (!self->tty)
                return;
-       
+
        del_timer(&self->watchdog_timer);
 
-       /* 
+       /*
         * IrCOMM link is now up, and if we are not using hardware
         * flow-control, then declare the hardware as running. Otherwise we
         * will have to wait for the peer device (DCE) to raise the CTS
-        * line.  
+        * line.
         */
        if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) {
-               IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __func__ );
                return;
        } else {
-               IRDA_DEBUG(1, "%s(), starting hardware!\n", __FUNCTION__ );
+               IRDA_DEBUG(1, "%s(), starting hardware!\n", __func__ );
 
                self->tty->hw_stopped = 0;
-       
+
                /* Wake up processes blocked on open */
                wake_up_interruptible(&self->open_wait);
        }
@@ -593,8 +583,8 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self)
 /*
  * Function ircomm_tty_start_watchdog_timer (self, timeout)
  *
- *    Start the watchdog timer. This timer is used to make sure that any 
- *    connection attempt is successful, and if not, we will retry after 
+ *    Start the watchdog timer. This timer is used to make sure that any
+ *    connection attempt is successful, and if not, we will retry after
  *    the timeout
  */
 static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
@@ -616,8 +606,8 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
 static void ircomm_tty_watchdog_timer_expired(void *data)
 {
        struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data;
-       
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
@@ -633,14 +623,14 @@ static void ircomm_tty_watchdog_timer_expired(void *data)
  *
  */
 int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
-                       struct sk_buff *skb, struct ircomm_tty_info *info) 
+                       struct sk_buff *skb, struct ircomm_tty_info *info)
 {
        IRDA_ASSERT(self != NULL, return -1;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
-       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ ,
+       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __func__ ,
                   ircomm_tty_state[self->state], ircomm_tty_event[event]);
-       
+
        return (*state[self->state])(self, event, skb, info);
 }
 
@@ -656,7 +646,7 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
 
-       IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __FUNCTION__ , 
+       IRDA_DEBUG(2, "%s: next state=%s, service type=%d\n", __func__ ,
                   ircomm_tty_state[self->state], self->service_type);
        */
        self->state = state;
@@ -668,21 +658,21 @@ static inline void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_
  *    Just hanging around
  *
  */
-static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, 
-                                IRCOMM_TTY_EVENT event, 
-                                struct sk_buff *skb, 
+static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
+                                IRCOMM_TTY_EVENT event,
+                                struct sk_buff *skb,
                                 struct ircomm_tty_info *info)
 {
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ ,
+       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __func__ ,
                   ircomm_tty_state[self->state], ircomm_tty_event[event]);
        switch (event) {
        case IRCOMM_TTY_ATTACH_CABLE:
-               /* Try to discover any remote devices */                
+               /* Try to discover any remote devices */
                ircomm_tty_start_watchdog_timer(self, 3*HZ);
                ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
-               
+
                irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS);
                break;
        case IRCOMM_TTY_DISCOVERY_INDICATION:
@@ -691,7 +681,7 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
 
                if (self->iriap) {
                        IRDA_WARNING("%s(), busy with a previous query\n",
-                                    __FUNCTION__);
+                                    __func__);
                        return -EBUSY;
                }
 
@@ -701,7 +691,7 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
                iriap_getvaluebyclass_request(self->iriap,
                                              self->saddr, self->daddr,
                                              "IrDA:IrCOMM", "Parameters");
-               
+
                ircomm_tty_start_watchdog_timer(self, 3*HZ);
                ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
                break;
@@ -719,7 +709,7 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
                ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
                break;
        default:
-               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __FUNCTION__ ,
+               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __func__ ,
                           ircomm_tty_event[event]);
                ret = -EINVAL;
        }
@@ -732,14 +722,14 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
  *    Trying to discover an IrCOMM device
  *
  */
-static int ircomm_tty_state_search(struct ircomm_tty_cb *self, 
-                                  IRCOMM_TTY_EVENT event, 
-                                  struct sk_buff *skb, 
+static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
+                                  IRCOMM_TTY_EVENT event,
+                                  struct sk_buff *skb,
                                   struct ircomm_tty_info *info)
 {
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ ,
+       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __func__ ,
                   ircomm_tty_state[self->state], ircomm_tty_event[event]);
 
        switch (event) {
@@ -749,22 +739,22 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
 
                if (self->iriap) {
                        IRDA_WARNING("%s(), busy with a previous query\n",
-                                    __FUNCTION__);
+                                    __func__);
                        return -EBUSY;
                }
-               
+
                self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
                                         ircomm_tty_getvalue_confirm);
-               
+
                if (self->service_type == IRCOMM_3_WIRE_RAW) {
                        iriap_getvaluebyclass_request(self->iriap, self->saddr,
-                                                     self->daddr, "IrLPT", 
+                                                     self->daddr, "IrLPT",
                                                      "IrDA:IrLMP:LsapSel");
                        ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL);
                } else {
                        iriap_getvaluebyclass_request(self->iriap, self->saddr,
-                                                     self->daddr, 
-                                                     "IrDA:IrCOMM", 
+                                                     self->daddr,
+                                                     "IrDA:IrCOMM",
                                                      "Parameters");
 
                        ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS);
@@ -783,7 +773,7 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
 #if 1
                /* Give up */
 #else
-               /* Try to discover any remote devices */                
+               /* Try to discover any remote devices */
                ircomm_tty_start_watchdog_timer(self, 3*HZ);
                irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS);
 #endif
@@ -792,7 +782,7 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
                ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
                break;
        default:
-               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __FUNCTION__ ,
+               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __func__ ,
                           ircomm_tty_event[event]);
                ret = -EINVAL;
        }
@@ -805,29 +795,29 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self,
  *    Querying the remote LM-IAS for IrCOMM parameters
  *
  */
-static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, 
-                                            IRCOMM_TTY_EVENT event, 
-                                            struct sk_buff *skb, 
+static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
+                                            IRCOMM_TTY_EVENT event,
+                                            struct sk_buff *skb,
                                             struct ircomm_tty_info *info)
 {
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ ,
+       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __func__ ,
                   ircomm_tty_state[self->state], ircomm_tty_event[event]);
 
        switch (event) {
        case IRCOMM_TTY_GOT_PARAMETERS:
                if (self->iriap) {
                        IRDA_WARNING("%s(), busy with a previous query\n",
-                                    __FUNCTION__);
+                                    __func__);
                        return -EBUSY;
                }
-               
+
                self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,
                                         ircomm_tty_getvalue_confirm);
 
-               iriap_getvaluebyclass_request(self->iriap, self->saddr, 
-                                             self->daddr, "IrDA:IrCOMM", 
+               iriap_getvaluebyclass_request(self->iriap, self->saddr,
+                                             self->daddr, "IrDA:IrCOMM",
                                              "IrDA:TinyTP:LsapSel");
 
                ircomm_tty_start_watchdog_timer(self, 3*HZ);
@@ -836,7 +826,7 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
        case IRCOMM_TTY_WD_TIMER_EXPIRED:
                /* Go back to search mode */
                ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH);
-               ircomm_tty_start_watchdog_timer(self, 3*HZ); 
+               ircomm_tty_start_watchdog_timer(self, 3*HZ);
                break;
        case IRCOMM_TTY_CONNECT_INDICATION:
                del_timer(&self->watchdog_timer);
@@ -850,7 +840,7 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
                ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
                break;
        default:
-               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __FUNCTION__ ,
+               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __func__ ,
                           ircomm_tty_event[event]);
                ret = -EINVAL;
        }
@@ -863,21 +853,21 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self,
  *    Query remote LM-IAS for the LSAP selector which we can connect to
  *
  */
-static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, 
-                                          IRCOMM_TTY_EVENT event, 
-                                          struct sk_buff *skb, 
+static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
+                                          IRCOMM_TTY_EVENT event,
+                                          struct sk_buff *skb,
                                           struct ircomm_tty_info *info)
 {
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ ,
+       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __func__ ,
                   ircomm_tty_state[self->state], ircomm_tty_event[event]);
 
        switch (event) {
        case IRCOMM_TTY_GOT_LSAPSEL:
                /* Connect to remote device */
                ret = ircomm_connect_request(self->ircomm, self->dlsap_sel,
-                                            self->saddr, self->daddr, 
+                                            self->saddr, self->daddr,
                                             NULL, self->service_type);
                ircomm_tty_start_watchdog_timer(self, 3*HZ);
                ircomm_tty_next_state(self, IRCOMM_TTY_SETUP);
@@ -899,7 +889,7 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
                ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
                break;
        default:
-               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __FUNCTION__ ,
+               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __func__ ,
                           ircomm_tty_event[event]);
                ret = -EINVAL;
        }
@@ -912,24 +902,24 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self,
  *    Trying to connect
  *
  */
-static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, 
-                                 IRCOMM_TTY_EVENT event, 
-                                 struct sk_buff *skb, 
+static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
+                                 IRCOMM_TTY_EVENT event,
+                                 struct sk_buff *skb,
                                  struct ircomm_tty_info *info)
 {
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __FUNCTION__ ,
+       IRDA_DEBUG(2, "%s: state=%s, event=%s\n", __func__ ,
                   ircomm_tty_state[self->state], ircomm_tty_event[event]);
 
        switch (event) {
        case IRCOMM_TTY_CONNECT_CONFIRM:
                del_timer(&self->watchdog_timer);
                ircomm_tty_ias_unregister(self);
-               
-               /* 
+
+               /*
                 * Send initial parameters. This will also send out queued
-                * parameters waiting for the connection to come up 
+                * parameters waiting for the connection to come up
                 */
                ircomm_tty_send_initial_parameters(self);
                ircomm_tty_link_established(self);
@@ -938,7 +928,7 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
        case IRCOMM_TTY_CONNECT_INDICATION:
                del_timer(&self->watchdog_timer);
                ircomm_tty_ias_unregister(self);
-               
+
                /* Accept connection */
                ircomm_connect_response(self->ircomm, NULL);
                ircomm_tty_next_state(self, IRCOMM_TTY_READY);
@@ -953,7 +943,7 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
                ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
                break;
        default:
-               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __FUNCTION__ ,
+               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __func__ ,
                           ircomm_tty_event[event]);
                ret = -EINVAL;
        }
@@ -966,9 +956,9 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self,
  *    IrCOMM is now connected
  *
  */
-static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, 
-                                 IRCOMM_TTY_EVENT event, 
-                                 struct sk_buff *skb, 
+static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
+                                 IRCOMM_TTY_EVENT event,
+                                 struct sk_buff *skb,
                                  struct ircomm_tty_info *info)
 {
        int ret = 0;
@@ -976,7 +966,7 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
        switch (event) {
        case IRCOMM_TTY_DATA_REQUEST:
                ret = ircomm_data_request(self->ircomm, skb);
-               break;          
+               break;
        case IRCOMM_TTY_DETACH_CABLE:
                ircomm_disconnect_request(self->ircomm, NULL);
                ircomm_tty_next_state(self, IRCOMM_TTY_IDLE);
@@ -991,13 +981,13 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
                        self->settings.dce = IRCOMM_DELTA_CD;
                        ircomm_tty_check_modem_status(self);
                } else {
-                       IRDA_DEBUG(0, "%s(), hanging up!\n", __FUNCTION__ );
+                       IRDA_DEBUG(0, "%s(), hanging up!\n", __func__ );
                        if (self->tty)
                                tty_hangup(self->tty);
                }
                break;
        default:
-               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __FUNCTION__ ,
+               IRDA_DEBUG(2, "%s(), unknown event: %s\n", __func__ ,
                           ircomm_tty_event[event]);
                ret = -EINVAL;
        }