aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-26 04:37:14 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:55 -0500
commit14cc3e2b633bb64063698980974df4535368e98f (patch)
treed542c9db7376de199d640b8e34d5630460b217b5 /drivers/s390/char
parent353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (diff)
[PATCH] sem2mutex: misc static one-file mutexes
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Dave Jones <davej@codemonkey.org.uk> Cc: Paul Mackerras <paulus@samba.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Jens Axboe <axboe@suse.de> Cc: Neil Brown <neilb@cse.unsw.edu.au> Acked-by: Alasdair G Kergon <agk@redhat.com> Cc: Greg KH <greg@kroah.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r--drivers/s390/char/raw3270.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index bd06607a5dcc..eecb2afad5c2 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -28,6 +28,7 @@
28#include <linux/major.h> 28#include <linux/major.h>
29#include <linux/kdev_t.h> 29#include <linux/kdev_t.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/mutex.h>
31 32
32struct class *class3270; 33struct class *class3270;
33 34
@@ -59,7 +60,7 @@ struct raw3270 {
59#define RAW3270_FLAGS_CONSOLE 8 /* Device is the console. */ 60#define RAW3270_FLAGS_CONSOLE 8 /* Device is the console. */
60 61
61/* Semaphore to protect global data of raw3270 (devices, views, etc). */ 62/* Semaphore to protect global data of raw3270 (devices, views, etc). */
62static DECLARE_MUTEX(raw3270_sem); 63static DEFINE_MUTEX(raw3270_mutex);
63 64
64/* List of 3270 devices. */ 65/* List of 3270 devices. */
65static struct list_head raw3270_devices = LIST_HEAD_INIT(raw3270_devices); 66static struct list_head raw3270_devices = LIST_HEAD_INIT(raw3270_devices);
@@ -815,7 +816,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
815 * number for it. Note: there is no device with minor 0, 816 * number for it. Note: there is no device with minor 0,
816 * see special case for fs3270.c:fs3270_open(). 817 * see special case for fs3270.c:fs3270_open().
817 */ 818 */
818 down(&raw3270_sem); 819 mutex_lock(&raw3270_mutex);
819 /* Keep the list sorted. */ 820 /* Keep the list sorted. */
820 minor = RAW3270_FIRSTMINOR; 821 minor = RAW3270_FIRSTMINOR;
821 rp->minor = -1; 822 rp->minor = -1;
@@ -832,7 +833,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
832 rp->minor = minor; 833 rp->minor = minor;
833 list_add_tail(&rp->list, &raw3270_devices); 834 list_add_tail(&rp->list, &raw3270_devices);
834 } 835 }
835 up(&raw3270_sem); 836 mutex_unlock(&raw3270_mutex);
836 /* No free minor number? Then give up. */ 837 /* No free minor number? Then give up. */
837 if (rp->minor == -1) 838 if (rp->minor == -1)
838 return -EUSERS; 839 return -EUSERS;
@@ -1003,7 +1004,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor)
1003 1004
1004 if (minor <= 0) 1005 if (minor <= 0)
1005 return -ENODEV; 1006 return -ENODEV;
1006 down(&raw3270_sem); 1007 mutex_lock(&raw3270_mutex);
1007 rc = -ENODEV; 1008 rc = -ENODEV;
1008 list_for_each_entry(rp, &raw3270_devices, list) { 1009 list_for_each_entry(rp, &raw3270_devices, list) {
1009 if (rp->minor != minor) 1010 if (rp->minor != minor)
@@ -1024,7 +1025,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor)
1024 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); 1025 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
1025 break; 1026 break;
1026 } 1027 }
1027 up(&raw3270_sem); 1028 mutex_unlock(&raw3270_mutex);
1028 return rc; 1029 return rc;
1029} 1030}
1030 1031
@@ -1038,7 +1039,7 @@ raw3270_find_view(struct raw3270_fn *fn, int minor)
1038 struct raw3270_view *view, *tmp; 1039 struct raw3270_view *view, *tmp;
1039 unsigned long flags; 1040 unsigned long flags;
1040 1041
1041 down(&raw3270_sem); 1042 mutex_lock(&raw3270_mutex);
1042 view = ERR_PTR(-ENODEV); 1043 view = ERR_PTR(-ENODEV);
1043 list_for_each_entry(rp, &raw3270_devices, list) { 1044 list_for_each_entry(rp, &raw3270_devices, list) {
1044 if (rp->minor != minor) 1045 if (rp->minor != minor)
@@ -1057,7 +1058,7 @@ raw3270_find_view(struct raw3270_fn *fn, int minor)
1057 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); 1058 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
1058 break; 1059 break;
1059 } 1060 }
1060 up(&raw3270_sem); 1061 mutex_unlock(&raw3270_mutex);
1061 return view; 1062 return view;
1062} 1063}
1063 1064
@@ -1104,7 +1105,7 @@ raw3270_delete_device(struct raw3270 *rp)
1104 struct ccw_device *cdev; 1105 struct ccw_device *cdev;
1105 1106
1106 /* Remove from device chain. */ 1107 /* Remove from device chain. */
1107 down(&raw3270_sem); 1108 mutex_lock(&raw3270_mutex);
1108 if (rp->clttydev) 1109 if (rp->clttydev)
1109 class_device_destroy(class3270, 1110 class_device_destroy(class3270,
1110 MKDEV(IBM_TTY3270_MAJOR, rp->minor)); 1111 MKDEV(IBM_TTY3270_MAJOR, rp->minor));
@@ -1112,7 +1113,7 @@ raw3270_delete_device(struct raw3270 *rp)
1112 class_device_destroy(class3270, 1113 class_device_destroy(class3270,
1113 MKDEV(IBM_FS3270_MAJOR, rp->minor)); 1114 MKDEV(IBM_FS3270_MAJOR, rp->minor));
1114 list_del_init(&rp->list); 1115 list_del_init(&rp->list);
1115 up(&raw3270_sem); 1116 mutex_unlock(&raw3270_mutex);
1116 1117
1117 /* Disconnect from ccw_device. */ 1118 /* Disconnect from ccw_device. */
1118 cdev = rp->cdev; 1119 cdev = rp->cdev;
@@ -1208,13 +1209,13 @@ int raw3270_register_notifier(void (*notifier)(int, int))
1208 if (!np) 1209 if (!np)
1209 return -ENOMEM; 1210 return -ENOMEM;
1210 np->notifier = notifier; 1211 np->notifier = notifier;
1211 down(&raw3270_sem); 1212 mutex_lock(&raw3270_mutex);
1212 list_add_tail(&np->list, &raw3270_notifier); 1213 list_add_tail(&np->list, &raw3270_notifier);
1213 list_for_each_entry(rp, &raw3270_devices, list) { 1214 list_for_each_entry(rp, &raw3270_devices, list) {
1214 get_device(&rp->cdev->dev); 1215 get_device(&rp->cdev->dev);
1215 notifier(rp->minor, 1); 1216 notifier(rp->minor, 1);
1216 } 1217 }
1217 up(&raw3270_sem); 1218 mutex_unlock(&raw3270_mutex);
1218 return 0; 1219 return 0;
1219} 1220}
1220 1221
@@ -1222,14 +1223,14 @@ void raw3270_unregister_notifier(void (*notifier)(int, int))
1222{ 1223{
1223 struct raw3270_notifier *np; 1224 struct raw3270_notifier *np;
1224 1225
1225 down(&raw3270_sem); 1226 mutex_lock(&raw3270_mutex);
1226 list_for_each_entry(np, &raw3270_notifier, list) 1227 list_for_each_entry(np, &raw3270_notifier, list)
1227 if (np->notifier == notifier) { 1228 if (np->notifier == notifier) {
1228 list_del(&np->list); 1229 list_del(&np->list);
1229 kfree(np); 1230 kfree(np);
1230 break; 1231 break;
1231 } 1232 }
1232 up(&raw3270_sem); 1233 mutex_unlock(&raw3270_mutex);
1233} 1234}
1234 1235
1235/* 1236/*
@@ -1256,10 +1257,10 @@ raw3270_set_online (struct ccw_device *cdev)
1256 goto failure; 1257 goto failure;
1257 raw3270_create_attributes(rp); 1258 raw3270_create_attributes(rp);
1258 set_bit(RAW3270_FLAGS_READY, &rp->flags); 1259 set_bit(RAW3270_FLAGS_READY, &rp->flags);
1259 down(&raw3270_sem); 1260 mutex_lock(&raw3270_mutex);
1260 list_for_each_entry(np, &raw3270_notifier, list) 1261 list_for_each_entry(np, &raw3270_notifier, list)
1261 np->notifier(rp->minor, 1); 1262 np->notifier(rp->minor, 1);
1262 up(&raw3270_sem); 1263 mutex_unlock(&raw3270_mutex);
1263 return 0; 1264 return 0;
1264 1265
1265failure: 1266failure:
@@ -1307,10 +1308,10 @@ raw3270_remove (struct ccw_device *cdev)
1307 } 1308 }
1308 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); 1309 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
1309 1310
1310 down(&raw3270_sem); 1311 mutex_lock(&raw3270_mutex);
1311 list_for_each_entry(np, &raw3270_notifier, list) 1312 list_for_each_entry(np, &raw3270_notifier, list)
1312 np->notifier(rp->minor, 0); 1313 np->notifier(rp->minor, 0);
1313 up(&raw3270_sem); 1314 mutex_unlock(&raw3270_mutex);
1314 1315
1315 /* Reset 3270 device. */ 1316 /* Reset 3270 device. */
1316 raw3270_reset_device(rp); 1317 raw3270_reset_device(rp);
@@ -1370,13 +1371,13 @@ raw3270_init(void)
1370 rc = ccw_driver_register(&raw3270_ccw_driver); 1371 rc = ccw_driver_register(&raw3270_ccw_driver);
1371 if (rc == 0) { 1372 if (rc == 0) {
1372 /* Create attributes for early (= console) device. */ 1373 /* Create attributes for early (= console) device. */
1373 down(&raw3270_sem); 1374 mutex_lock(&raw3270_mutex);
1374 class3270 = class_create(THIS_MODULE, "3270"); 1375 class3270 = class_create(THIS_MODULE, "3270");
1375 list_for_each_entry(rp, &raw3270_devices, list) { 1376 list_for_each_entry(rp, &raw3270_devices, list) {
1376 get_device(&rp->cdev->dev); 1377 get_device(&rp->cdev->dev);
1377 raw3270_create_attributes(rp); 1378 raw3270_create_attributes(rp);
1378 } 1379 }
1379 up(&raw3270_sem); 1380 mutex_unlock(&raw3270_mutex);
1380 } 1381 }
1381 return rc; 1382 return rc;
1382} 1383}