Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-drm-fsl-dcu.git] / net / irda / discovery.c
index 89fd2a2cbca66a170c471672cfcbcd8c56745fd6..789478bc3009ad9743861420be835621473c4151 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************************
- *                
+ *
  * Filename:      discovery.c
  * Version:       0.1
  * Description:   Routines for handling discoveries at the IrLMP layer
  * 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;