Bluetooth: Remove useless flush_work() causing lockdep warnings
[safe/jmp/linux-2.6] / net / 802 / tr.c
index 151855d..e874447 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/init.h>
+#include <linux/sysctl.h>
 #include <net/arp.h>
 #include <net/net_namespace.h>
 
@@ -75,7 +76,7 @@ static DEFINE_SPINLOCK(rif_lock);
 
 static struct timer_list rif_timer;
 
-int sysctl_tr_rif_timeout = 60*10*HZ;
+static int sysctl_tr_rif_timeout = 60*10*HZ;
 
 static inline unsigned long rif_hash(const unsigned char *addr)
 {
@@ -284,10 +285,7 @@ void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,
                if(entry)
                {
 #if TR_SR_DEBUG
-{
-DECLARE_MAC_BUF(mac);
-printk("source routing for %s\n",print_mac(mac, trh->daddr));
-}
+printk("source routing for %pM\n", trh->daddr);
 #endif
                        if(!entry->local_ring && (ntohs(entry->rcf) & TR_RCF_LEN_MASK) >> 8)
                        {
@@ -369,9 +367,8 @@ static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
        if(entry==NULL)
        {
 #if TR_SR_DEBUG
-               DECLARE_MAC_BUF(mac);
-               printk("adding rif_entry: addr:%s rcf:%04X\n",
-                      print_mac(mac, trh->saddr), ntohs(trh->rcf));
+               printk("adding rif_entry: addr:%pM rcf:%04X\n",
+                      trh->saddr, ntohs(trh->rcf));
 #endif
                /*
                 *      Allocate our new entry. A failure to allocate loses
@@ -416,11 +413,8 @@ static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
                         !(trh->rcf & htons(TR_RCF_BROADCAST_MASK)))
                    {
 #if TR_SR_DEBUG
-{
-DECLARE_MAC_BUF(mac);
-printk("updating rif_entry: addr:%s rcf:%04X\n",
-               print_mac(mac, trh->saddr), ntohs(trh->rcf));
-}
+printk("updating rif_entry: addr:%pM rcf:%04X\n",
+               trh->saddr, ntohs(trh->rcf));
 #endif
                            entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK);
                            memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short));
@@ -492,6 +486,7 @@ static struct rif_cache *rif_get_idx(loff_t pos)
 }
 
 static void *rif_seq_start(struct seq_file *seq, loff_t *pos)
+       __acquires(&rif_lock)
 {
        spin_lock_irq(&rif_lock);
 
@@ -523,6 +518,7 @@ static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 }
 
 static void rif_seq_stop(struct seq_file *seq, void *v)
+       __releases(&rif_lock)
 {
        spin_unlock_irq(&rif_lock);
 }
@@ -531,7 +527,6 @@ static int rif_seq_show(struct seq_file *seq, void *v)
 {
        int j, rcf_len, segment, brdgnmb;
        struct rif_cache *entry = v;
-       DECLARE_MAC_BUF(mac);
 
        if (v == SEQ_START_TOKEN)
                seq_puts(seq,
@@ -541,9 +536,9 @@ static int rif_seq_show(struct seq_file *seq, void *v)
                long ttl = (long) (entry->last_used + sysctl_tr_rif_timeout)
                                - (long) jiffies;
 
-               seq_printf(seq, "%s %s %7li ",
+               seq_printf(seq, "%s %pM %7li ",
                           dev?dev->name:"?",
-                          print_mac(mac, entry->addr),
+                          entry->addr,
                           ttl/HZ);
 
                        if (entry->local_ring)
@@ -566,6 +561,9 @@ static int rif_seq_show(struct seq_file *seq, void *v)
                                }
                                seq_putc(seq, '\n');
                        }
+
+               if (dev)
+                       dev_put(dev);
                }
        return 0;
 }
@@ -634,6 +632,26 @@ struct net_device *alloc_trdev(int sizeof_priv)
        return alloc_netdev(sizeof_priv, "tr%d", tr_setup);
 }
 
+#ifdef CONFIG_SYSCTL
+static struct ctl_table tr_table[] = {
+       {
+               .ctl_name       = NET_TR_RIF_TIMEOUT,
+               .procname       = "rif_timeout",
+               .data           = &sysctl_tr_rif_timeout,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec
+       },
+       { 0 },
+};
+
+static __initdata struct ctl_path tr_path[] = {
+       { .procname = "net", .ctl_name = CTL_NET, },
+       { .procname = "token-ring", .ctl_name = NET_TR, },
+       { }
+};
+#endif
+
 /*
  *     Called during bootup.  We don't actually have to initialise
  *     too much for this.
@@ -644,7 +662,9 @@ static int __init rif_init(void)
        rif_timer.expires  = jiffies + sysctl_tr_rif_timeout;
        setup_timer(&rif_timer, rif_check_expire, 0);
        add_timer(&rif_timer);
-
+#ifdef CONFIG_SYSCTL
+       register_sysctl_paths(tr_path, tr_table);
+#endif
        proc_net_fops_create(&init_net, "tr_rif", S_IRUGO, &rif_seq_fops);
        return 0;
 }
@@ -653,3 +673,5 @@ module_init(rif_init);
 
 EXPORT_SYMBOL(tr_type_trans);
 EXPORT_SYMBOL(alloc_trdev);
+
+MODULE_LICENSE("GPL");