Commit 55180399 authored by David S. Miller's avatar David S. Miller

[IRDA]: Fix IRQ save/restore handling in seq file handlers.

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.
parent 28a058fe
......@@ -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 = {
......
......@@ -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 */
......
......@@ -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 = {
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment