diff options
Diffstat (limited to 'drivers/s390/char/raw3270.c')
-rw-r--r-- | drivers/s390/char/raw3270.c | 86 |
1 files changed, 52 insertions, 34 deletions
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index e95b56f810db..7a84014f2037 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -555,7 +555,7 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view, | |||
555 | #ifdef CONFIG_TN3270_CONSOLE | 555 | #ifdef CONFIG_TN3270_CONSOLE |
556 | if (raw3270_registered == 0) { | 556 | if (raw3270_registered == 0) { |
557 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); | 557 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); |
558 | rq->callback = 0; | 558 | rq->callback = NULL; |
559 | rc = __raw3270_start(rp, view, rq); | 559 | rc = __raw3270_start(rp, view, rq); |
560 | if (rc == 0) | 560 | if (rc == 0) |
561 | while (!raw3270_request_final(rq)) { | 561 | while (!raw3270_request_final(rq)) { |
@@ -719,8 +719,8 @@ raw3270_size_device(struct raw3270 *rp) | |||
719 | rc = __raw3270_size_device_vm(rp); | 719 | rc = __raw3270_size_device_vm(rp); |
720 | else | 720 | else |
721 | rc = __raw3270_size_device(rp); | 721 | rc = __raw3270_size_device(rp); |
722 | raw3270_init_view.dev = 0; | 722 | raw3270_init_view.dev = NULL; |
723 | rp->view = 0; | 723 | rp->view = NULL; |
724 | up(&raw3270_init_sem); | 724 | up(&raw3270_init_sem); |
725 | if (rc == 0) { /* Found something. */ | 725 | if (rc == 0) { /* Found something. */ |
726 | /* Try to find a model. */ | 726 | /* Try to find a model. */ |
@@ -761,8 +761,8 @@ raw3270_reset_device(struct raw3270 *rp) | |||
761 | rp->view = &raw3270_init_view; | 761 | rp->view = &raw3270_init_view; |
762 | raw3270_init_view.dev = rp; | 762 | raw3270_init_view.dev = rp; |
763 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); | 763 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); |
764 | raw3270_init_view.dev = 0; | 764 | raw3270_init_view.dev = NULL; |
765 | rp->view = 0; | 765 | rp->view = NULL; |
766 | up(&raw3270_init_sem); | 766 | up(&raw3270_init_sem); |
767 | return rc; | 767 | return rc; |
768 | } | 768 | } |
@@ -934,7 +934,7 @@ raw3270_activate_view(struct raw3270_view *view) | |||
934 | else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) | 934 | else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) |
935 | rc = -ENODEV; | 935 | rc = -ENODEV; |
936 | else { | 936 | else { |
937 | oldview = 0; | 937 | oldview = NULL; |
938 | if (rp->view) { | 938 | if (rp->view) { |
939 | oldview = rp->view; | 939 | oldview = rp->view; |
940 | oldview->fn->deactivate(oldview); | 940 | oldview->fn->deactivate(oldview); |
@@ -951,7 +951,7 @@ raw3270_activate_view(struct raw3270_view *view) | |||
951 | rp->view = nv; | 951 | rp->view = nv; |
952 | if (nv->fn->activate(nv) == 0) | 952 | if (nv->fn->activate(nv) == 0) |
953 | break; | 953 | break; |
954 | rp->view = 0; | 954 | rp->view = NULL; |
955 | } | 955 | } |
956 | } | 956 | } |
957 | } | 957 | } |
@@ -975,7 +975,7 @@ raw3270_deactivate_view(struct raw3270_view *view) | |||
975 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); | 975 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); |
976 | if (rp->view == view) { | 976 | if (rp->view == view) { |
977 | view->fn->deactivate(view); | 977 | view->fn->deactivate(view); |
978 | rp->view = 0; | 978 | rp->view = NULL; |
979 | /* Move deactivated view to end of list. */ | 979 | /* Move deactivated view to end of list. */ |
980 | list_del_init(&view->list); | 980 | list_del_init(&view->list); |
981 | list_add_tail(&view->list, &rp->view_list); | 981 | list_add_tail(&view->list, &rp->view_list); |
@@ -985,7 +985,7 @@ raw3270_deactivate_view(struct raw3270_view *view) | |||
985 | rp->view = view; | 985 | rp->view = view; |
986 | if (view->fn->activate(view) == 0) | 986 | if (view->fn->activate(view) == 0) |
987 | break; | 987 | break; |
988 | rp->view = 0; | 988 | rp->view = NULL; |
989 | } | 989 | } |
990 | } | 990 | } |
991 | } | 991 | } |
@@ -1076,7 +1076,7 @@ raw3270_del_view(struct raw3270_view *view) | |||
1076 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); | 1076 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); |
1077 | if (rp->view == view) { | 1077 | if (rp->view == view) { |
1078 | view->fn->deactivate(view); | 1078 | view->fn->deactivate(view); |
1079 | rp->view = 0; | 1079 | rp->view = NULL; |
1080 | } | 1080 | } |
1081 | list_del_init(&view->list); | 1081 | list_del_init(&view->list); |
1082 | if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags)) { | 1082 | if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags)) { |
@@ -1106,10 +1106,10 @@ raw3270_delete_device(struct raw3270 *rp) | |||
1106 | 1106 | ||
1107 | /* Remove from device chain. */ | 1107 | /* Remove from device chain. */ |
1108 | mutex_lock(&raw3270_mutex); | 1108 | mutex_lock(&raw3270_mutex); |
1109 | if (rp->clttydev) | 1109 | if (rp->clttydev && !IS_ERR(rp->clttydev)) |
1110 | class_device_destroy(class3270, | 1110 | class_device_destroy(class3270, |
1111 | MKDEV(IBM_TTY3270_MAJOR, rp->minor)); | 1111 | MKDEV(IBM_TTY3270_MAJOR, rp->minor)); |
1112 | if (rp->cltubdev) | 1112 | if (rp->cltubdev && !IS_ERR(rp->cltubdev)) |
1113 | class_device_destroy(class3270, | 1113 | class_device_destroy(class3270, |
1114 | MKDEV(IBM_FS3270_MAJOR, rp->minor)); | 1114 | MKDEV(IBM_FS3270_MAJOR, rp->minor)); |
1115 | list_del_init(&rp->list); | 1115 | list_del_init(&rp->list); |
@@ -1117,9 +1117,9 @@ raw3270_delete_device(struct raw3270 *rp) | |||
1117 | 1117 | ||
1118 | /* Disconnect from ccw_device. */ | 1118 | /* Disconnect from ccw_device. */ |
1119 | cdev = rp->cdev; | 1119 | cdev = rp->cdev; |
1120 | rp->cdev = 0; | 1120 | rp->cdev = NULL; |
1121 | cdev->dev.driver_data = 0; | 1121 | cdev->dev.driver_data = NULL; |
1122 | cdev->handler = 0; | 1122 | cdev->handler = NULL; |
1123 | 1123 | ||
1124 | /* Put ccw_device structure. */ | 1124 | /* Put ccw_device structure. */ |
1125 | put_device(&cdev->dev); | 1125 | put_device(&cdev->dev); |
@@ -1144,7 +1144,7 @@ raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
1144 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1144 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1145 | ((struct raw3270 *) dev->driver_data)->model); | 1145 | ((struct raw3270 *) dev->driver_data)->model); |
1146 | } | 1146 | } |
1147 | static DEVICE_ATTR(model, 0444, raw3270_model_show, 0); | 1147 | static DEVICE_ATTR(model, 0444, raw3270_model_show, NULL); |
1148 | 1148 | ||
1149 | static ssize_t | 1149 | static ssize_t |
1150 | raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) | 1150 | raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -1152,7 +1152,7 @@ raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
1152 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1152 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1153 | ((struct raw3270 *) dev->driver_data)->rows); | 1153 | ((struct raw3270 *) dev->driver_data)->rows); |
1154 | } | 1154 | } |
1155 | static DEVICE_ATTR(rows, 0444, raw3270_rows_show, 0); | 1155 | static DEVICE_ATTR(rows, 0444, raw3270_rows_show, NULL); |
1156 | 1156 | ||
1157 | static ssize_t | 1157 | static ssize_t |
1158 | raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf) | 1158 | raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -1160,7 +1160,7 @@ raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *bu | |||
1160 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1160 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1161 | ((struct raw3270 *) dev->driver_data)->cols); | 1161 | ((struct raw3270 *) dev->driver_data)->cols); |
1162 | } | 1162 | } |
1163 | static DEVICE_ATTR(columns, 0444, raw3270_columns_show, 0); | 1163 | static DEVICE_ATTR(columns, 0444, raw3270_columns_show, NULL); |
1164 | 1164 | ||
1165 | static struct attribute * raw3270_attrs[] = { | 1165 | static struct attribute * raw3270_attrs[] = { |
1166 | &dev_attr_model.attr, | 1166 | &dev_attr_model.attr, |
@@ -1173,21 +1173,37 @@ static struct attribute_group raw3270_attr_group = { | |||
1173 | .attrs = raw3270_attrs, | 1173 | .attrs = raw3270_attrs, |
1174 | }; | 1174 | }; |
1175 | 1175 | ||
1176 | static void | 1176 | static int raw3270_create_attributes(struct raw3270 *rp) |
1177 | raw3270_create_attributes(struct raw3270 *rp) | ||
1178 | { | 1177 | { |
1179 | //FIXME: check return code | 1178 | int rc; |
1180 | sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); | 1179 | |
1181 | rp->clttydev = | 1180 | rc = sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); |
1182 | class_device_create(class3270, NULL, | 1181 | if (rc) |
1183 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), | 1182 | goto out; |
1184 | &rp->cdev->dev, "tty%s", | 1183 | |
1185 | rp->cdev->dev.bus_id); | 1184 | rp->clttydev = class_device_create(class3270, NULL, |
1186 | rp->cltubdev = | 1185 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), |
1187 | class_device_create(class3270, NULL, | 1186 | &rp->cdev->dev, "tty%s", |
1188 | MKDEV(IBM_FS3270_MAJOR, rp->minor), | 1187 | rp->cdev->dev.bus_id); |
1189 | &rp->cdev->dev, "tub%s", | 1188 | if (IS_ERR(rp->clttydev)) { |
1190 | rp->cdev->dev.bus_id); | 1189 | rc = PTR_ERR(rp->clttydev); |
1190 | goto out_ttydev; | ||
1191 | } | ||
1192 | |||
1193 | rp->cltubdev = class_device_create(class3270, NULL, | ||
1194 | MKDEV(IBM_FS3270_MAJOR, rp->minor), | ||
1195 | &rp->cdev->dev, "tub%s", | ||
1196 | rp->cdev->dev.bus_id); | ||
1197 | if (!IS_ERR(rp->cltubdev)) | ||
1198 | goto out; | ||
1199 | |||
1200 | rc = PTR_ERR(rp->cltubdev); | ||
1201 | class_device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor)); | ||
1202 | |||
1203 | out_ttydev: | ||
1204 | sysfs_remove_group(&rp->cdev->dev.kobj, &raw3270_attr_group); | ||
1205 | out: | ||
1206 | return rc; | ||
1191 | } | 1207 | } |
1192 | 1208 | ||
1193 | /* | 1209 | /* |
@@ -1255,7 +1271,9 @@ raw3270_set_online (struct ccw_device *cdev) | |||
1255 | rc = raw3270_reset_device(rp); | 1271 | rc = raw3270_reset_device(rp); |
1256 | if (rc) | 1272 | if (rc) |
1257 | goto failure; | 1273 | goto failure; |
1258 | raw3270_create_attributes(rp); | 1274 | rc = raw3270_create_attributes(rp); |
1275 | if (rc) | ||
1276 | goto failure; | ||
1259 | set_bit(RAW3270_FLAGS_READY, &rp->flags); | 1277 | set_bit(RAW3270_FLAGS_READY, &rp->flags); |
1260 | mutex_lock(&raw3270_mutex); | 1278 | mutex_lock(&raw3270_mutex); |
1261 | list_for_each_entry(np, &raw3270_notifier, list) | 1279 | list_for_each_entry(np, &raw3270_notifier, list) |
@@ -1296,7 +1314,7 @@ raw3270_remove (struct ccw_device *cdev) | |||
1296 | spin_lock_irqsave(get_ccwdev_lock(cdev), flags); | 1314 | spin_lock_irqsave(get_ccwdev_lock(cdev), flags); |
1297 | if (rp->view) { | 1315 | if (rp->view) { |
1298 | rp->view->fn->deactivate(rp->view); | 1316 | rp->view->fn->deactivate(rp->view); |
1299 | rp->view = 0; | 1317 | rp->view = NULL; |
1300 | } | 1318 | } |
1301 | while (!list_empty(&rp->view_list)) { | 1319 | while (!list_empty(&rp->view_list)) { |
1302 | v = list_entry(rp->view_list.next, struct raw3270_view, list); | 1320 | v = list_entry(rp->view_list.next, struct raw3270_view, list); |