diff options
Diffstat (limited to 'drivers/message/i2o/i2o_config.c')
-rw-r--r-- | drivers/message/i2o/i2o_config.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 068ba0785bb4..7d3cc575c361 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -31,7 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/miscdevice.h> | 33 | #include <linux/miscdevice.h> |
34 | #include <linux/smp_lock.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/compat.h> | 35 | #include <linux/compat.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | 37 | ||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #define SG_TABLESIZE 30 | 42 | #define SG_TABLESIZE 30 |
43 | 43 | ||
44 | static DEFINE_MUTEX(i2o_cfg_mutex); | ||
44 | static long i2o_cfg_ioctl(struct file *, unsigned int, unsigned long); | 45 | static long i2o_cfg_ioctl(struct file *, unsigned int, unsigned long); |
45 | 46 | ||
46 | static spinlock_t i2o_config_lock; | 47 | static spinlock_t i2o_config_lock; |
@@ -741,7 +742,7 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd, | |||
741 | unsigned long arg) | 742 | unsigned long arg) |
742 | { | 743 | { |
743 | int ret; | 744 | int ret; |
744 | lock_kernel(); | 745 | mutex_lock(&i2o_cfg_mutex); |
745 | switch (cmd) { | 746 | switch (cmd) { |
746 | case I2OGETIOPS: | 747 | case I2OGETIOPS: |
747 | ret = i2o_cfg_ioctl(file, cmd, arg); | 748 | ret = i2o_cfg_ioctl(file, cmd, arg); |
@@ -753,7 +754,7 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd, | |||
753 | ret = -ENOIOCTLCMD; | 754 | ret = -ENOIOCTLCMD; |
754 | break; | 755 | break; |
755 | } | 756 | } |
756 | unlock_kernel(); | 757 | mutex_unlock(&i2o_cfg_mutex); |
757 | return ret; | 758 | return ret; |
758 | } | 759 | } |
759 | 760 | ||
@@ -981,7 +982,7 @@ static long i2o_cfg_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) | |||
981 | { | 982 | { |
982 | int ret; | 983 | int ret; |
983 | 984 | ||
984 | lock_kernel(); | 985 | mutex_lock(&i2o_cfg_mutex); |
985 | switch (cmd) { | 986 | switch (cmd) { |
986 | case I2OGETIOPS: | 987 | case I2OGETIOPS: |
987 | ret = i2o_cfg_getiops(arg); | 988 | ret = i2o_cfg_getiops(arg); |
@@ -1037,7 +1038,7 @@ static long i2o_cfg_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) | |||
1037 | osm_debug("unknown ioctl called!\n"); | 1038 | osm_debug("unknown ioctl called!\n"); |
1038 | ret = -EINVAL; | 1039 | ret = -EINVAL; |
1039 | } | 1040 | } |
1040 | unlock_kernel(); | 1041 | mutex_unlock(&i2o_cfg_mutex); |
1041 | return ret; | 1042 | return ret; |
1042 | } | 1043 | } |
1043 | 1044 | ||
@@ -1051,7 +1052,7 @@ static int cfg_open(struct inode *inode, struct file *file) | |||
1051 | if (!tmp) | 1052 | if (!tmp) |
1052 | return -ENOMEM; | 1053 | return -ENOMEM; |
1053 | 1054 | ||
1054 | lock_kernel(); | 1055 | mutex_lock(&i2o_cfg_mutex); |
1055 | file->private_data = (void *)(i2o_cfg_info_id++); | 1056 | file->private_data = (void *)(i2o_cfg_info_id++); |
1056 | tmp->fp = file; | 1057 | tmp->fp = file; |
1057 | tmp->fasync = NULL; | 1058 | tmp->fasync = NULL; |
@@ -1065,7 +1066,7 @@ static int cfg_open(struct inode *inode, struct file *file) | |||
1065 | spin_lock_irqsave(&i2o_config_lock, flags); | 1066 | spin_lock_irqsave(&i2o_config_lock, flags); |
1066 | open_files = tmp; | 1067 | open_files = tmp; |
1067 | spin_unlock_irqrestore(&i2o_config_lock, flags); | 1068 | spin_unlock_irqrestore(&i2o_config_lock, flags); |
1068 | unlock_kernel(); | 1069 | mutex_unlock(&i2o_cfg_mutex); |
1069 | 1070 | ||
1070 | return 0; | 1071 | return 0; |
1071 | } | 1072 | } |
@@ -1076,14 +1077,14 @@ static int cfg_fasync(int fd, struct file *fp, int on) | |||
1076 | struct i2o_cfg_info *p; | 1077 | struct i2o_cfg_info *p; |
1077 | int ret = -EBADF; | 1078 | int ret = -EBADF; |
1078 | 1079 | ||
1079 | lock_kernel(); | 1080 | mutex_lock(&i2o_cfg_mutex); |
1080 | for (p = open_files; p; p = p->next) | 1081 | for (p = open_files; p; p = p->next) |
1081 | if (p->q_id == id) | 1082 | if (p->q_id == id) |
1082 | break; | 1083 | break; |
1083 | 1084 | ||
1084 | if (p) | 1085 | if (p) |
1085 | ret = fasync_helper(fd, fp, on, &p->fasync); | 1086 | ret = fasync_helper(fd, fp, on, &p->fasync); |
1086 | unlock_kernel(); | 1087 | mutex_unlock(&i2o_cfg_mutex); |
1087 | return ret; | 1088 | return ret; |
1088 | } | 1089 | } |
1089 | 1090 | ||
@@ -1093,7 +1094,7 @@ static int cfg_release(struct inode *inode, struct file *file) | |||
1093 | struct i2o_cfg_info *p, **q; | 1094 | struct i2o_cfg_info *p, **q; |
1094 | unsigned long flags; | 1095 | unsigned long flags; |
1095 | 1096 | ||
1096 | lock_kernel(); | 1097 | mutex_lock(&i2o_cfg_mutex); |
1097 | spin_lock_irqsave(&i2o_config_lock, flags); | 1098 | spin_lock_irqsave(&i2o_config_lock, flags); |
1098 | for (q = &open_files; (p = *q) != NULL; q = &p->next) { | 1099 | for (q = &open_files; (p = *q) != NULL; q = &p->next) { |
1099 | if (p->q_id == id) { | 1100 | if (p->q_id == id) { |
@@ -1103,7 +1104,7 @@ static int cfg_release(struct inode *inode, struct file *file) | |||
1103 | } | 1104 | } |
1104 | } | 1105 | } |
1105 | spin_unlock_irqrestore(&i2o_config_lock, flags); | 1106 | spin_unlock_irqrestore(&i2o_config_lock, flags); |
1106 | unlock_kernel(); | 1107 | mutex_unlock(&i2o_cfg_mutex); |
1107 | 1108 | ||
1108 | return 0; | 1109 | return 0; |
1109 | } | 1110 | } |