]> git.hungrycats.org Git - linux/commitdiff
[IRDA]: Fix IRQ save/restore handling in seq file handlers.
authorDavid S. Miller <davem@nuts.ninka.net>
Wed, 5 Nov 2003 04:52:55 +0000 (20:52 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Wed, 5 Nov 2003 04:52:55 +0000 (20:52 -0800)
IRDA was restoring IRQ flags in a different function from which they
were saved which explodes on certain platforms.  It did not need to
use _irq{save,restore}() anyways since the seqfile layer always invokes
these routines from user context with interrupts enabled, so using
plain spin_{lock,unlock}_irq() works just fine.

net/irda/discovery.c
net/irda/ircomm/ircomm_core.c
net/irda/iriap.c
net/irda/irlap.c
net/irda/irlmp.c
net/irda/irttp.c

index d200fec0030369fa9a22c49d3c0e40b35f3556d0..b549d02b67f0e1c1c149261c334e353e4dcad386 100644 (file)
@@ -351,10 +351,6 @@ __u32 irlmp_find_device(hashbin_t *cachelog, char *name, __u32 *saddr)
 }
 
 #ifdef CONFIG_PROC_FS
-struct discovery_iter_state {
-       unsigned long flags;
-};
-
 static inline discovery_t *discovery_seq_idx(loff_t pos)
 
 {
@@ -372,9 +368,7 @@ static inline discovery_t *discovery_seq_idx(loff_t pos)
 
 static void *discovery_seq_start(struct seq_file *seq, loff_t *pos)
 {
-       struct discovery_iter_state *iter = seq->private;
-
-       spin_lock_irqsave(&irlmp->cachelog->hb_spinlock, iter->flags);
+       spin_lock_irq(&irlmp->cachelog->hb_spinlock);
         return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN;
 }
 
@@ -388,8 +382,7 @@ static void *discovery_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 
 static void discovery_seq_stop(struct seq_file *seq, void *v)
 {
-       struct discovery_iter_state *iter = seq->private;
-       spin_unlock_irqrestore(&irlmp->cachelog->hb_spinlock, iter->flags);
+       spin_unlock_irq(&irlmp->cachelog->hb_spinlock);
 }
 
 static int discovery_seq_show(struct seq_file *seq, void *v)
@@ -446,28 +439,9 @@ static struct seq_operations discovery_seq_ops = {
 
 static int discovery_seq_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       int rc = -ENOMEM;
-       struct discovery_iter_state *s;
-       
        ASSERT(irlmp != NULL, return -EINVAL;);
 
-       s = kmalloc(sizeof(*s), GFP_KERNEL);
-       if (!s)
-               goto out;
-
-       rc = seq_open(file, &discovery_seq_ops);
-       if (rc)
-               goto out_kfree;
-
-       seq          = file->private_data;
-       seq->private = s;
-       memset(s, 0, sizeof(*s));
-out:
-       return rc;
-out_kfree:
-       kfree(s);
-       goto out;
+       return seq_open(file, &discovery_seq_ops);
 }
 
 struct file_operations discovery_seq_fops = {
index 431aef2c679969cdc7429bae202518c60a24d105..361e8de978066e337c3e607b452223bb5288fda2 100644 (file)
@@ -508,17 +508,12 @@ void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow)
 EXPORT_SYMBOL(ircomm_flow_request);
 
 #ifdef CONFIG_PROC_FS
-struct ircomm_iter_state {
-       unsigned long flags;
-};
-
 static void *ircomm_seq_start(struct seq_file *seq, loff_t *pos)
 {
-       struct ircomm_iter_state *iter = seq->private;
        struct ircomm_cb *self;
        loff_t off = 0;
 
-       spin_lock_irqsave(&ircomm->hb_spinlock, iter->flags);
+       spin_lock_irq(&ircomm->hb_spinlock);
 
        for (self = (struct ircomm_cb *) hashbin_get_first(ircomm);
             self != NULL;
@@ -539,8 +534,7 @@ static void *ircomm_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 
 static void ircomm_seq_stop(struct seq_file *seq, void *v)
 {
-       struct ircomm_iter_state *iter = seq->private;
-       spin_unlock_irqrestore(&ircomm->hb_spinlock, iter->flags);
+       spin_unlock_irq(&ircomm->hb_spinlock);
 }
 
 static int ircomm_seq_show(struct seq_file *seq, void *v)
@@ -581,25 +575,7 @@ static struct seq_operations ircomm_seq_ops = {
 
 static int ircomm_seq_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       int rc = -ENOMEM;
-       struct ircomm_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
-       
-       if (!s)
-               goto out;
-
-       rc = seq_open(file, &ircomm_seq_ops);
-       if (rc)
-               goto out_kfree;
-
-       seq          = file->private_data;
-       seq->private = s;
-       memset(s, 0, sizeof(*s));
-out:
-       return rc;
-out_kfree:
-       kfree(s);
-       goto out;
+       return seq_open(file, &ircomm_seq_ops);
 }
 #endif /* CONFIG_PROC_FS */
 
index a2d2f87b5bbf59731c8869506834d568ef61bc56..16b2253511982fabe83d768f738ff5be6547911e 100644 (file)
@@ -978,10 +978,6 @@ static const char *ias_value_types[] = {
        "IAS_STRING"
 };
 
-struct irias_iter_state {
-       unsigned long flags;
-};
-
 static inline struct ias_object *irias_seq_idx(loff_t pos) 
 {
        struct ias_object *obj;
@@ -997,9 +993,7 @@ static inline struct ias_object *irias_seq_idx(loff_t pos)
 
 static void *irias_seq_start(struct seq_file *seq, loff_t *pos)
 {
-       struct irias_iter_state *iter = seq->private;
-
-       spin_lock_irqsave(&irias_objects->hb_spinlock, iter->flags);
+       spin_lock_irq(&irias_objects->hb_spinlock);
 
        return *pos ? irias_seq_idx(*pos - 1) : SEQ_START_TOKEN;
 }
@@ -1015,9 +1009,7 @@ static void *irias_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 
 static void irias_seq_stop(struct seq_file *seq, void *v)
 {
-       struct irias_iter_state *iter = seq->private;
-
-       spin_unlock_irqrestore(&irias_objects->hb_spinlock, iter->flags);
+       spin_unlock_irq(&irias_objects->hb_spinlock);
 }
 
 static int irias_seq_show(struct seq_file *seq, void *v)
@@ -1088,26 +1080,9 @@ static struct seq_operations irias_seq_ops = {
 
 static int irias_seq_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *seq;
-       int rc = -ENOMEM;
-       struct irias_iter_state *s;
-
        ASSERT( irias_objects != NULL, return -EINVAL;);
-       s = kmalloc(sizeof(*s), GFP_KERNEL);
-       if (!s)
-               goto out;
 
-       rc = seq_open(file, &irias_seq_ops);
-       if (rc)
-               goto out_kfree;
-       seq          = file->private_data;
-       seq->private = s;
-       memset(s, 0, sizeof(*s));
-out:
-       return rc;
-out_kfree:
-       kfree(s);
-       goto out;
+       return seq_open(file, &irias_seq_ops);
 }
 
 struct file_operations irias_seq_fops = {
index 743b758613dad93d369be01565a5fca1067ade70..9d846c13ade9dc8052624f9e31d4272c2963e6d4 100644 (file)
@@ -1094,7 +1094,6 @@ void irlap_apply_connection_parameters(struct irlap_cb *self, int now)
 #ifdef CONFIG_PROC_FS
 struct irlap_iter_state {
        int id;
-       unsigned long flags;
 };
 
 static void *irlap_seq_start(struct seq_file *seq, loff_t *pos)
@@ -1103,7 +1102,7 @@ static void *irlap_seq_start(struct seq_file *seq, loff_t *pos)
        struct irlap_cb *self;
 
        /* Protect our access to the tsap list */
-       spin_lock_irqsave(&irlap->hb_spinlock, iter->flags);
+       spin_lock_irq(&irlap->hb_spinlock);
        iter->id = 0;
 
        for (self = (struct irlap_cb *) hashbin_get_first(irlap); 
@@ -1127,8 +1126,7 @@ static void *irlap_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 
 static void irlap_seq_stop(struct seq_file *seq, void *v)
 {
-       struct irlap_iter_state *iter = seq->private;
-       spin_unlock_irqrestore(&irlap->hb_spinlock, iter->flags);
+       spin_unlock_irq(&irlap->hb_spinlock);
 }
 
 static int irlap_seq_show(struct seq_file *seq, void *v)
index 79a22f223db7f7b25f340e0ae3a38cd9ae4d8c1f..f702c9c304619c43b3a70c064573c485d0079407 100644 (file)
@@ -1780,7 +1780,6 @@ __u32 irlmp_get_daddr(struct lsap_cb *self)
 #ifdef CONFIG_PROC_FS
 
 struct irlmp_iter_state {
-       unsigned long flags;
        hashbin_t *hashbin;
 };
 
@@ -1791,7 +1790,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off)
 {
        void *element;
 
-       spin_lock_irqsave(&iter->hashbin->hb_spinlock, iter->flags);
+       spin_lock_irq(&iter->hashbin->hb_spinlock);
        for (element = hashbin_get_first(iter->hashbin);
             element != NULL; 
             element = hashbin_get_next(iter->hashbin)) {
@@ -1800,7 +1799,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off)
                        return element;
                }
        }
-       spin_unlock_irqrestore(&iter->hashbin->hb_spinlock, iter->flags);
+       spin_unlock_irq(&iter->hashbin->hb_spinlock);
        iter->hashbin = NULL;
        return NULL;
 }
@@ -1848,8 +1847,7 @@ static void *irlmp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
        v = hashbin_get_next(iter->hashbin);
 
        if (v == NULL) {                        /* no more in this hash bin */
-               spin_unlock_irqrestore(&iter->hashbin->hb_spinlock, 
-                                      iter->flags);
+               spin_unlock_irq(&iter->hashbin->hb_spinlock);
 
                if (iter->hashbin == irlmp->unconnected_lsaps) 
                        v =  LINK_START_TOKEN;
@@ -1862,10 +1860,9 @@ static void *irlmp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 static void irlmp_seq_stop(struct seq_file *seq, void *v)
 {
        struct irlmp_iter_state *iter = seq->private;
-       
+
        if (iter->hashbin)
-               spin_unlock_irqrestore(&iter->hashbin->hb_spinlock, iter->flags);
-               
+               spin_unlock_irq(&iter->hashbin->hb_spinlock);
 }
 
 static int irlmp_seq_show(struct seq_file *seq, void *v)
index d41b81870da9626e4debe2910fffb74395e2dd06..b1d57dfd2e8a42ffcb5c01f9d301c7a7ec434e9f 100644 (file)
@@ -1774,7 +1774,6 @@ void irttp_run_rx_queue(struct tsap_cb *self)
 #ifdef CONFIG_PROC_FS
 struct irttp_iter_state {
        int id;
-       unsigned long flags;
 };
 
 static void *irttp_seq_start(struct seq_file *seq, loff_t *pos)
@@ -1783,7 +1782,7 @@ static void *irttp_seq_start(struct seq_file *seq, loff_t *pos)
        struct tsap_cb *self;
 
        /* Protect our access to the tsap list */
-       spin_lock_irqsave(&irttp->tsaps->hb_spinlock, iter->flags);
+       spin_lock_irq(&irttp->tsaps->hb_spinlock);
        iter->id = 0;
 
        for (self = (struct tsap_cb *) hashbin_get_first(irttp->tsaps); 
@@ -1808,8 +1807,7 @@ static void *irttp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 
 static void irttp_seq_stop(struct seq_file *seq, void *v)
 {
-       struct irttp_iter_state *iter = seq->private;
-       spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, iter->flags);
+       spin_unlock_irq(&irttp->tsaps->hb_spinlock);
 }
 
 static int irttp_seq_show(struct seq_file *seq, void *v)