aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/istallion.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-06-01 16:52:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 16:47:40 -0400
commitb4eda9cb48eac1b7369ad33e5d015c33b4376431 (patch)
tree0faa2f1af52804731765b3793436c0b00956fe2e /drivers/char/istallion.c
parent8fd4bd22350784d5b2fe9274f6790ba353976415 (diff)
stallion: prune lock_kernel calls
Remove unneeded tty layer lock kernel bits. Relock the needed bits using the port mutex. The istallion still has brd state races but those are not new or introduced by the removal of the lock_kernel logic. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/istallion.c')
-rw-r--r--drivers/char/istallion.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 4e395c956a09..750650cbac11 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -14,6 +14,7 @@
14 * the Free Software Foundation; either version 2 of the License, or 14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version. 15 * (at your option) any later version.
16 * 16 *
17 * FIXME: brdp->state needs proper locking.
17 */ 18 */
18 19
19/*****************************************************************************/ 20/*****************************************************************************/
@@ -4011,6 +4012,7 @@ static int stli_getbrdstats(combrd_t __user *bp)
4011 return -ENODEV; 4012 return -ENODEV;
4012 4013
4013 memset(&stli_brdstats, 0, sizeof(combrd_t)); 4014 memset(&stli_brdstats, 0, sizeof(combrd_t));
4015
4014 stli_brdstats.brd = brdp->brdnr; 4016 stli_brdstats.brd = brdp->brdnr;
4015 stli_brdstats.type = brdp->brdtype; 4017 stli_brdstats.type = brdp->brdtype;
4016 stli_brdstats.hwid = 0; 4018 stli_brdstats.hwid = 0;
@@ -4076,10 +4078,13 @@ static int stli_portcmdstats(struct tty_struct *tty, struct stliport *portp)
4076 if (brdp == NULL) 4078 if (brdp == NULL)
4077 return -ENODEV; 4079 return -ENODEV;
4078 4080
4081 mutex_lock(&portp->port.mutex);
4079 if (brdp->state & BST_STARTED) { 4082 if (brdp->state & BST_STARTED) {
4080 if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, 4083 if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS,
4081 &stli_cdkstats, sizeof(asystats_t), 1)) < 0) 4084 &stli_cdkstats, sizeof(asystats_t), 1)) < 0) {
4085 mutex_unlock(&portp->port.mutex);
4082 return rc; 4086 return rc;
4087 }
4083 } else { 4088 } else {
4084 memset(&stli_cdkstats, 0, sizeof(asystats_t)); 4089 memset(&stli_cdkstats, 0, sizeof(asystats_t));
4085 } 4090 }
@@ -4124,6 +4129,7 @@ static int stli_portcmdstats(struct tty_struct *tty, struct stliport *portp)
4124 stli_comstats.modem = stli_cdkstats.dcdcnt; 4129 stli_comstats.modem = stli_cdkstats.dcdcnt;
4125 stli_comstats.hwid = stli_cdkstats.hwid; 4130 stli_comstats.hwid = stli_cdkstats.hwid;
4126 stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); 4131 stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals);
4132 mutex_unlock(&portp->port.mutex);
4127 4133
4128 return 0; 4134 return 0;
4129} 4135}
@@ -4186,15 +4192,20 @@ static int stli_clrportstats(struct stliport *portp, comstats_t __user *cp)
4186 if (!brdp) 4192 if (!brdp)
4187 return -ENODEV; 4193 return -ENODEV;
4188 4194
4195 mutex_lock(&portp->port.mutex);
4196
4189 if (brdp->state & BST_STARTED) { 4197 if (brdp->state & BST_STARTED) {
4190 if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, NULL, 0, 0)) < 0) 4198 if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, NULL, 0, 0)) < 0) {
4199 mutex_unlock(&portp->port.mutex);
4191 return rc; 4200 return rc;
4201 }
4192 } 4202 }
4193 4203
4194 memset(&stli_comstats, 0, sizeof(comstats_t)); 4204 memset(&stli_comstats, 0, sizeof(comstats_t));
4195 stli_comstats.brd = portp->brdnr; 4205 stli_comstats.brd = portp->brdnr;
4196 stli_comstats.panel = portp->panelnr; 4206 stli_comstats.panel = portp->panelnr;
4197 stli_comstats.port = portp->portnr; 4207 stli_comstats.port = portp->portnr;
4208 mutex_unlock(&portp->port.mutex);
4198 4209
4199 if (copy_to_user(cp, &stli_comstats, sizeof(comstats_t))) 4210 if (copy_to_user(cp, &stli_comstats, sizeof(comstats_t)))
4200 return -EFAULT; 4211 return -EFAULT;
@@ -4266,8 +4277,6 @@ static long stli_memioctl(struct file *fp, unsigned int cmd, unsigned long arg)
4266 done = 0; 4277 done = 0;
4267 rc = 0; 4278 rc = 0;
4268 4279
4269 lock_kernel();
4270
4271 switch (cmd) { 4280 switch (cmd) {
4272 case COM_GETPORTSTATS: 4281 case COM_GETPORTSTATS:
4273 rc = stli_getportstats(NULL, NULL, argp); 4282 rc = stli_getportstats(NULL, NULL, argp);
@@ -4290,8 +4299,6 @@ static long stli_memioctl(struct file *fp, unsigned int cmd, unsigned long arg)
4290 done++; 4299 done++;
4291 break; 4300 break;
4292 } 4301 }
4293 unlock_kernel();
4294
4295 if (done) 4302 if (done)
4296 return rc; 4303 return rc;
4297 4304
@@ -4308,8 +4315,6 @@ static long stli_memioctl(struct file *fp, unsigned int cmd, unsigned long arg)
4308 if (brdp->state == 0) 4315 if (brdp->state == 0)
4309 return -ENODEV; 4316 return -ENODEV;
4310 4317
4311 lock_kernel();
4312
4313 switch (cmd) { 4318 switch (cmd) {
4314 case STL_BINTR: 4319 case STL_BINTR:
4315 EBRDINTR(brdp); 4320 EBRDINTR(brdp);
@@ -4332,7 +4337,6 @@ static long stli_memioctl(struct file *fp, unsigned int cmd, unsigned long arg)
4332 rc = -ENOIOCTLCMD; 4337 rc = -ENOIOCTLCMD;
4333 break; 4338 break;
4334 } 4339 }
4335 unlock_kernel();
4336 return rc; 4340 return rc;
4337} 4341}
4338 4342