Lines Matching refs:sch
70 struct subchannel *sch = to_subchannel(dev); in call_fn_known_sch() local
75 idset_sch_del(cb->set, sch->schid); in call_fn_known_sch()
77 rc = cb->fn_known_sch(sch, cb->data); in call_fn_known_sch()
94 struct subchannel *sch; in call_fn_all_sch() local
97 sch = get_subchannel_by_schid(schid); in call_fn_all_sch()
98 if (sch) { in call_fn_all_sch()
100 rc = cb->fn_known_sch(sch, cb->data); in call_fn_all_sch()
101 put_device(&sch->dev); in call_fn_all_sch()
150 static int css_sch_create_locks(struct subchannel *sch) in css_sch_create_locks() argument
152 sch->lock = kmalloc(sizeof(*sch->lock), GFP_KERNEL); in css_sch_create_locks()
153 if (!sch->lock) in css_sch_create_locks()
156 spin_lock_init(sch->lock); in css_sch_create_locks()
157 mutex_init(&sch->reg_mutex); in css_sch_create_locks()
164 struct subchannel *sch = to_subchannel(dev); in css_subchannel_release() local
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()
174 struct subchannel *sch; in css_alloc_subchannel() local
177 sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
178 if (!sch) in css_alloc_subchannel()
181 ret = cio_validate_subchannel(sch, schid); in css_alloc_subchannel()
185 ret = css_sch_create_locks(sch); in css_alloc_subchannel()
189 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
190 sch->dev.release = &css_subchannel_release; in css_alloc_subchannel()
191 device_initialize(&sch->dev); in css_alloc_subchannel()
192 return sch; in css_alloc_subchannel()
195 kfree(sch); in css_alloc_subchannel()
199 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
203 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
204 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
205 sch->schid.sch_no); in css_sch_device_register()
206 ret = device_add(&sch->dev); in css_sch_device_register()
207 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
215 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
217 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
218 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
219 device_unregister(&sch->dev); in css_sch_device_unregister()
220 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
253 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
257 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
259 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
261 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
267 struct subchannel *sch = to_subchannel(dev); in type_show() local
269 return sprintf(buf, "%01x\n", sch->st); in type_show()
277 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
279 return sprintf(buf, "css:t%01X\n", sch->st); in modalias_show()
303 struct subchannel *sch = to_subchannel(dev); in chpids_show() local
304 struct chsc_ssd_info *ssd = &sch->ssd_info; in chpids_show()
325 struct subchannel *sch = to_subchannel(dev); in pimpampom_show() local
326 struct pmcw *pmcw = &sch->schib.pmcw; in pimpampom_show()
344 int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
349 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
350 sch->dev.bus = &css_bus_type; in css_register_subchannel()
351 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
353 if (sch->st == SUBCHANNEL_TYPE_IO) in css_register_subchannel()
354 sch->dev.type = &io_subchannel_type; in css_register_subchannel()
365 dev_set_uevent_suppress(&sch->dev, 1); in css_register_subchannel()
366 css_update_ssd_info(sch); in css_register_subchannel()
368 ret = css_sch_device_register(sch); in css_register_subchannel()
371 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
374 if (!sch->driver) { in css_register_subchannel()
380 dev_set_uevent_suppress(&sch->dev, 0); in css_register_subchannel()
381 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in css_register_subchannel()
388 struct subchannel *sch; in css_probe_device() local
391 sch = css_alloc_subchannel(schid); in css_probe_device()
392 if (IS_ERR(sch)) in css_probe_device()
393 return PTR_ERR(sch); in css_probe_device()
395 ret = css_register_subchannel(sch); in css_probe_device()
397 put_device(&sch->dev); in css_probe_device()
405 struct subchannel *sch; in check_subchannel() local
408 sch = to_subchannel(dev); in check_subchannel()
409 return schid_equal(&sch->schid, schid); in check_subchannel()
459 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
463 if (sch->driver) { in css_evaluate_known_subchannel()
464 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
465 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
467 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
473 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
480 struct subchannel *sch; in css_evaluate_subchannel() local
483 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
484 if (sch) { in css_evaluate_subchannel()
485 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
486 put_device(&sch->dev); in css_evaluate_subchannel()
502 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
505 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
506 if (sch->todo >= todo) in css_sched_sch_todo()
509 if (!get_device(&sch->dev)) in css_sched_sch_todo()
511 sch->todo = todo; in css_sched_sch_todo()
512 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
514 put_device(&sch->dev); in css_sched_sch_todo()
521 struct subchannel *sch; in css_sch_todo() local
525 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
527 spin_lock_irq(sch->lock); in css_sch_todo()
528 todo = sch->todo; in css_sch_todo()
529 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
530 sch->schid.sch_no, todo); in css_sch_todo()
531 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
532 spin_unlock_irq(sch->lock); in css_sch_todo()
538 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
540 spin_lock_irq(sch->lock); in css_sch_todo()
541 css_sched_sch_todo(sch, todo); in css_sch_todo()
542 spin_unlock_irq(sch->lock); in css_sch_todo()
546 css_sch_device_unregister(sch); in css_sch_todo()
550 put_device(&sch->dev); in css_sch_todo()
571 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
577 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
578 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
581 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
583 css_schedule_eval(sch->schid); in slow_eval_known_fn()
665 struct subchannel *sch = to_subchannel(dev); in __unset_registered() local
667 idset_sch_del(set, sch->schid); in __unset_registered()
713 struct subchannel *sch; in css_process_crw() local
734 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
735 if (sch) { in css_process_crw()
736 css_update_ssd_info(sch); in css_process_crw()
737 put_device(&sch->dev); in css_process_crw()
1179 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1181 if (!sch->dev.parent) in sch_is_pseudo_sch()
1183 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1188 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1193 if (sch->st == id->type) in css_bus_match()
1202 struct subchannel *sch; in css_probe() local
1205 sch = to_subchannel(dev); in css_probe()
1206 sch->driver = to_cssdriver(dev->driver); in css_probe()
1207 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1209 sch->driver = NULL; in css_probe()
1215 struct subchannel *sch; in css_remove() local
1218 sch = to_subchannel(dev); in css_remove()
1219 ret = sch->driver->remove ? sch->driver->remove(sch) : 0; in css_remove()
1220 sch->driver = NULL; in css_remove()
1226 struct subchannel *sch; in css_shutdown() local
1228 sch = to_subchannel(dev); in css_shutdown()
1229 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1230 sch->driver->shutdown(sch); in css_shutdown()
1235 struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1238 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1241 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()
1247 struct subchannel *sch = to_subchannel(dev); in css_pm_prepare() local
1250 if (mutex_is_locked(&sch->reg_mutex)) in css_pm_prepare()
1252 if (!sch->dev.driver) in css_pm_prepare()
1254 drv = to_cssdriver(sch->dev.driver); in css_pm_prepare()
1256 return drv->prepare ? drv->prepare(sch) : 0; in css_pm_prepare()
1261 struct subchannel *sch = to_subchannel(dev); in css_pm_complete() local
1264 if (!sch->dev.driver) in css_pm_complete()
1266 drv = to_cssdriver(sch->dev.driver); in css_pm_complete()
1268 drv->complete(sch); in css_pm_complete()
1273 struct subchannel *sch = to_subchannel(dev); in css_pm_freeze() local
1276 if (!sch->dev.driver) in css_pm_freeze()
1278 drv = to_cssdriver(sch->dev.driver); in css_pm_freeze()
1279 return drv->freeze ? drv->freeze(sch) : 0; in css_pm_freeze()
1284 struct subchannel *sch = to_subchannel(dev); in css_pm_thaw() local
1287 if (!sch->dev.driver) in css_pm_thaw()
1289 drv = to_cssdriver(sch->dev.driver); in css_pm_thaw()
1290 return drv->thaw ? drv->thaw(sch) : 0; in css_pm_thaw()
1295 struct subchannel *sch = to_subchannel(dev); in css_pm_restore() local
1298 css_update_ssd_info(sch); in css_pm_restore()
1299 if (!sch->dev.driver) in css_pm_restore()
1301 drv = to_cssdriver(sch->dev.driver); in css_pm_restore()
1302 return drv->restore ? drv->restore(sch) : 0; in css_pm_restore()