Lines Matching refs:sch
68 struct subchannel *sch = to_subchannel(dev); in call_fn_known_sch() local
72 idset_sch_del(cb->set, sch->schid); in call_fn_known_sch()
74 rc = cb->fn_known_sch(sch, cb->data); in call_fn_known_sch()
91 struct subchannel *sch; in call_fn_all_sch() local
94 sch = get_subchannel_by_schid(schid); in call_fn_all_sch()
95 if (sch) { in call_fn_all_sch()
97 rc = cb->fn_known_sch(sch, cb->data); in call_fn_all_sch()
98 put_device(&sch->dev); in call_fn_all_sch()
143 struct subchannel *sch; in css_alloc_subchannel() local
146 sch = kmalloc (sizeof (*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
147 if (sch == NULL) in css_alloc_subchannel()
149 ret = cio_validate_subchannel (sch, schid); in css_alloc_subchannel()
151 kfree(sch); in css_alloc_subchannel()
154 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
155 return sch; in css_alloc_subchannel()
161 struct subchannel *sch; in css_subchannel_release() local
163 sch = to_subchannel(dev); in css_subchannel_release()
164 if (!cio_is_console(sch->schid)) { in css_subchannel_release()
166 sch->config.intparm = 0; in css_subchannel_release()
167 cio_commit_config(sch); in css_subchannel_release()
168 kfree(sch->lock); in css_subchannel_release()
169 kfree(sch); in css_subchannel_release()
173 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
177 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
178 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
179 sch->schid.sch_no); in css_sch_device_register()
180 ret = device_register(&sch->dev); in css_sch_device_register()
181 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
189 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
191 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
192 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
193 device_unregister(&sch->dev); in css_sch_device_unregister()
194 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
227 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
231 if (cio_is_console(sch->schid)) { in css_update_ssd_info()
234 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
236 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
238 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
239 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
246 struct subchannel *sch = to_subchannel(dev); in type_show() local
248 return sprintf(buf, "%01x\n", sch->st); in type_show()
256 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
258 return sprintf(buf, "css:t%01X\n", sch->st); in modalias_show()
278 static int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
283 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
284 sch->dev.bus = &css_bus_type; in css_register_subchannel()
285 sch->dev.release = &css_subchannel_release; in css_register_subchannel()
286 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
296 dev_set_uevent_suppress(&sch->dev, 1); in css_register_subchannel()
297 css_update_ssd_info(sch); in css_register_subchannel()
299 ret = css_sch_device_register(sch); in css_register_subchannel()
302 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
305 if (!sch->driver) { in css_register_subchannel()
311 dev_set_uevent_suppress(&sch->dev, 0); in css_register_subchannel()
312 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in css_register_subchannel()
320 struct subchannel *sch; in css_probe_device() local
323 sch = cio_get_console_subchannel(); in css_probe_device()
325 sch = css_alloc_subchannel(schid); in css_probe_device()
326 if (IS_ERR(sch)) in css_probe_device()
327 return PTR_ERR(sch); in css_probe_device()
329 ret = css_register_subchannel(sch); in css_probe_device()
332 put_device(&sch->dev); in css_probe_device()
340 struct subchannel *sch; in check_subchannel() local
343 sch = to_subchannel(dev); in check_subchannel()
344 return schid_equal(&sch->schid, schid); in check_subchannel()
390 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
394 if (sch->driver) { in css_evaluate_known_subchannel()
395 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
396 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
398 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
404 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
411 struct subchannel *sch; in css_evaluate_subchannel() local
414 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
415 if (sch) { in css_evaluate_subchannel()
416 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
417 put_device(&sch->dev); in css_evaluate_subchannel()
433 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
436 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
437 if (sch->todo >= todo) in css_sched_sch_todo()
440 if (!get_device(&sch->dev)) in css_sched_sch_todo()
442 sch->todo = todo; in css_sched_sch_todo()
443 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
445 put_device(&sch->dev); in css_sched_sch_todo()
451 struct subchannel *sch; in css_sch_todo() local
455 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
457 spin_lock_irq(sch->lock); in css_sch_todo()
458 todo = sch->todo; in css_sch_todo()
459 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
460 sch->schid.sch_no, todo); in css_sch_todo()
461 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
462 spin_unlock_irq(sch->lock); in css_sch_todo()
468 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
470 spin_lock_irq(sch->lock); in css_sch_todo()
471 css_sched_sch_todo(sch, todo); in css_sch_todo()
472 spin_unlock_irq(sch->lock); in css_sch_todo()
476 css_sch_device_unregister(sch); in css_sch_todo()
480 put_device(&sch->dev); in css_sch_todo()
501 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
507 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
508 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
511 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
513 css_schedule_eval(sch->schid); in slow_eval_known_fn()
589 struct subchannel *sch = to_subchannel(dev); in __unset_registered() local
591 idset_sch_del(set, sch->schid); in __unset_registered()
636 struct subchannel *sch; in css_process_crw() local
657 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
658 if (sch) { in css_process_crw()
659 css_update_ssd_info(sch); in css_process_crw()
660 put_device(&sch->dev); in css_process_crw()
1100 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1102 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1107 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1112 if (sch->st == id->type) in css_bus_match()
1121 struct subchannel *sch; in css_probe() local
1124 sch = to_subchannel(dev); in css_probe()
1125 sch->driver = to_cssdriver(dev->driver); in css_probe()
1126 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1128 sch->driver = NULL; in css_probe()
1134 struct subchannel *sch; in css_remove() local
1137 sch = to_subchannel(dev); in css_remove()
1138 ret = sch->driver->remove ? sch->driver->remove(sch) : 0; in css_remove()
1139 sch->driver = NULL; in css_remove()
1145 struct subchannel *sch; in css_shutdown() local
1147 sch = to_subchannel(dev); in css_shutdown()
1148 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1149 sch->driver->shutdown(sch); in css_shutdown()
1154 struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1157 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1160 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()
1166 struct subchannel *sch = to_subchannel(dev); in css_pm_prepare() local
1169 if (mutex_is_locked(&sch->reg_mutex)) in css_pm_prepare()
1171 if (!sch->dev.driver) in css_pm_prepare()
1173 drv = to_cssdriver(sch->dev.driver); in css_pm_prepare()
1175 return drv->prepare ? drv->prepare(sch) : 0; in css_pm_prepare()
1180 struct subchannel *sch = to_subchannel(dev); in css_pm_complete() local
1183 if (!sch->dev.driver) in css_pm_complete()
1185 drv = to_cssdriver(sch->dev.driver); in css_pm_complete()
1187 drv->complete(sch); in css_pm_complete()
1192 struct subchannel *sch = to_subchannel(dev); in css_pm_freeze() local
1195 if (!sch->dev.driver) in css_pm_freeze()
1197 drv = to_cssdriver(sch->dev.driver); in css_pm_freeze()
1198 return drv->freeze ? drv->freeze(sch) : 0; in css_pm_freeze()
1203 struct subchannel *sch = to_subchannel(dev); in css_pm_thaw() local
1206 if (!sch->dev.driver) in css_pm_thaw()
1208 drv = to_cssdriver(sch->dev.driver); in css_pm_thaw()
1209 return drv->thaw ? drv->thaw(sch) : 0; in css_pm_thaw()
1214 struct subchannel *sch = to_subchannel(dev); in css_pm_restore() local
1217 css_update_ssd_info(sch); in css_pm_restore()
1218 if (!sch->dev.driver) in css_pm_restore()
1220 drv = to_cssdriver(sch->dev.driver); in css_pm_restore()
1221 return drv->restore ? drv->restore(sch) : 0; in css_pm_restore()