Commit 025fd9de authored by Steffen A. Mork's avatar Steffen A. Mork Committed by Linus Torvalds

[PATCH] fix dss1_divert fixes

As noted by Bartlomiej, this makes the spinlock be a proper lock rather
than just a local lock to each user.
Signed-off-by: default avatarSteffen A. Mork <linux-dev@morknet.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 555983d6
...@@ -62,7 +62,6 @@ static int __init divert_init(void) ...@@ -62,7 +62,6 @@ static int __init divert_init(void)
static void __exit divert_exit(void) static void __exit divert_exit(void)
{ {
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
int i; int i;
spin_lock_irqsave(&divert_lock, flags); spin_lock_irqsave(&divert_lock, flags);
......
...@@ -182,7 +182,6 @@ isdn_divert_ioctl(struct inode *inode, struct file *file, ...@@ -182,7 +182,6 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
divert_ioctl dioctl; divert_ioctl dioctl;
int i; int i;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
divert_rule *rulep; divert_rule *rulep;
char *cp; char *cp;
......
...@@ -48,13 +48,14 @@ static struct deflect_struc *table_head = NULL; ...@@ -48,13 +48,14 @@ static struct deflect_struc *table_head = NULL;
static struct deflect_struc *table_tail = NULL; static struct deflect_struc *table_tail = NULL;
static unsigned char extern_wait_max = 4; /* maximum wait in s for external process */ static unsigned char extern_wait_max = 4; /* maximum wait in s for external process */
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
/***************************/ /***************************/
/* timer callback function */ /* timer callback function */
/***************************/ /***************************/
static void deflect_timer_expire(ulong arg) static void deflect_timer_expire(ulong arg)
{ {
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
struct call_struc *cs = (struct call_struc *) arg; struct call_struc *cs = (struct call_struc *) arg;
spin_lock_irqsave(&divert_lock, flags); spin_lock_irqsave(&divert_lock, flags);
...@@ -109,7 +110,6 @@ int cf_command(int drvid, int mode, ...@@ -109,7 +110,6 @@ int cf_command(int drvid, int mode,
u_char proc, char *msn, u_char proc, char *msn,
u_char service, char *fwd_nr, ulong *procid) u_char service, char *fwd_nr, ulong *procid)
{ unsigned long flags; { unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
int retval,msnlen; int retval,msnlen;
int fwd_len; int fwd_len;
char *p,*ielenp,tmp[60]; char *p,*ielenp,tmp[60];
...@@ -204,7 +204,6 @@ int deflect_extern_action(u_char cmd, ulong callid, char *to_nr) ...@@ -204,7 +204,6 @@ int deflect_extern_action(u_char cmd, ulong callid, char *to_nr)
{ struct call_struc *cs; { struct call_struc *cs;
isdn_ctrl ic; isdn_ctrl ic;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
int i; int i;
if ((cmd & 0x7F) > 2) return(-EINVAL); /* invalid command */ if ((cmd & 0x7F) > 2) return(-EINVAL); /* invalid command */
...@@ -275,7 +274,6 @@ int deflect_extern_action(u_char cmd, ulong callid, char *to_nr) ...@@ -275,7 +274,6 @@ int deflect_extern_action(u_char cmd, ulong callid, char *to_nr)
int insertrule(int idx, divert_rule *newrule) int insertrule(int idx, divert_rule *newrule)
{ struct deflect_struc *ds,*ds1=NULL; { struct deflect_struc *ds,*ds1=NULL;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
if (!(ds = (struct deflect_struc *) kmalloc(sizeof(struct deflect_struc), if (!(ds = (struct deflect_struc *) kmalloc(sizeof(struct deflect_struc),
GFP_KERNEL))) GFP_KERNEL)))
...@@ -321,7 +319,6 @@ int insertrule(int idx, divert_rule *newrule) ...@@ -321,7 +319,6 @@ int insertrule(int idx, divert_rule *newrule)
int deleterule(int idx) int deleterule(int idx)
{ struct deflect_struc *ds,*ds1; { struct deflect_struc *ds,*ds1;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
if (idx < 0) if (idx < 0)
{ spin_lock_irqsave(&divert_lock, flags); { spin_lock_irqsave(&divert_lock, flags);
...@@ -389,7 +386,6 @@ divert_rule *getruleptr(int idx) ...@@ -389,7 +386,6 @@ divert_rule *getruleptr(int idx)
int isdn_divert_icall(isdn_ctrl *ic) int isdn_divert_icall(isdn_ctrl *ic)
{ int retval = 0; { int retval = 0;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
struct call_struc *cs = NULL; struct call_struc *cs = NULL;
struct deflect_struc *dv; struct deflect_struc *dv;
char *p,*p1; char *p,*p1;
...@@ -540,7 +536,6 @@ int isdn_divert_icall(isdn_ctrl *ic) ...@@ -540,7 +536,6 @@ int isdn_divert_icall(isdn_ctrl *ic)
void deleteprocs(void) void deleteprocs(void)
{ struct call_struc *cs, *cs1; { struct call_struc *cs, *cs1;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
spin_lock_irqsave(&divert_lock, flags); spin_lock_irqsave(&divert_lock, flags);
cs = divert_head; cs = divert_head;
...@@ -698,7 +693,6 @@ int prot_stat_callback(isdn_ctrl *ic) ...@@ -698,7 +693,6 @@ int prot_stat_callback(isdn_ctrl *ic)
{ struct call_struc *cs, *cs1; { struct call_struc *cs, *cs1;
int i; int i;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
cs = divert_head; /* start of list */ cs = divert_head; /* start of list */
cs1 = NULL; cs1 = NULL;
...@@ -790,7 +784,6 @@ int prot_stat_callback(isdn_ctrl *ic) ...@@ -790,7 +784,6 @@ int prot_stat_callback(isdn_ctrl *ic)
int isdn_divert_stat_callback(isdn_ctrl *ic) int isdn_divert_stat_callback(isdn_ctrl *ic)
{ struct call_struc *cs, *cs1; { struct call_struc *cs, *cs1;
unsigned long flags; unsigned long flags;
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED;
int retval; int retval;
retval = -1; retval = -1;
......
...@@ -114,6 +114,8 @@ struct divert_info ...@@ -114,6 +114,8 @@ struct divert_info
/**************/ /**************/
/* Prototypes */ /* Prototypes */
/**************/ /**************/
extern spinlock_t divert_lock;
extern ulong if_used; /* number of interface users */ extern ulong if_used; /* number of interface users */
extern int divert_dev_deinit(void); extern int divert_dev_deinit(void);
extern int divert_dev_init(void); extern int divert_dev_init(void);
......
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