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()
205 struct subchannel *sch; in css_alloc_subchannel() local
212 sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
213 if (!sch) in css_alloc_subchannel()
216 sch->schid = schid; in css_alloc_subchannel()
217 sch->schib = *schib; in css_alloc_subchannel()
218 sch->st = schib->pmcw.st; in css_alloc_subchannel()
220 ret = css_sch_create_locks(sch); in css_alloc_subchannel()
224 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
225 sch->dev.release = &css_subchannel_release; in css_alloc_subchannel()
226 device_initialize(&sch->dev); in css_alloc_subchannel()
227 return sch; in css_alloc_subchannel()
230 kfree(sch); in css_alloc_subchannel()
234 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
238 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
239 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
240 sch->schid.sch_no); in css_sch_device_register()
241 ret = device_add(&sch->dev); in css_sch_device_register()
242 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
250 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
252 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
253 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
254 device_unregister(&sch->dev); in css_sch_device_unregister()
255 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
287 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
291 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
293 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
295 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
301 struct subchannel *sch = to_subchannel(dev); in type_show() local
303 return sprintf(buf, "%01x\n", sch->st); in type_show()
311 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
313 return sprintf(buf, "css:t%01X\n", sch->st); in modalias_show()
337 struct subchannel *sch = to_subchannel(dev); in chpids_show() local
338 struct chsc_ssd_info *ssd = &sch->ssd_info; in chpids_show()
359 struct subchannel *sch = to_subchannel(dev); in pimpampom_show() local
360 struct pmcw *pmcw = &sch->schib.pmcw; in pimpampom_show()
378 int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
383 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
384 sch->dev.bus = &css_bus_type; in css_register_subchannel()
385 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
387 if (sch->st == SUBCHANNEL_TYPE_IO) in css_register_subchannel()
388 sch->dev.type = &io_subchannel_type; in css_register_subchannel()
399 dev_set_uevent_suppress(&sch->dev, 1); in css_register_subchannel()
400 css_update_ssd_info(sch); in css_register_subchannel()
402 ret = css_sch_device_register(sch); in css_register_subchannel()
405 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
408 if (!sch->driver) { in css_register_subchannel()
414 dev_set_uevent_suppress(&sch->dev, 0); in css_register_subchannel()
415 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in css_register_subchannel()
422 struct subchannel *sch; in css_probe_device() local
425 sch = css_alloc_subchannel(schid, schib); in css_probe_device()
426 if (IS_ERR(sch)) in css_probe_device()
427 return PTR_ERR(sch); in css_probe_device()
429 ret = css_register_subchannel(sch); in css_probe_device()
431 put_device(&sch->dev); in css_probe_device()
439 struct subchannel *sch; in check_subchannel() local
442 sch = to_subchannel(dev); in check_subchannel()
443 return schid_equal(&sch->schid, schid); in check_subchannel()
493 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
497 if (sch->driver) { in css_evaluate_known_subchannel()
498 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
499 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
501 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
507 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
514 struct subchannel *sch; in css_evaluate_subchannel() local
517 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
518 if (sch) { in css_evaluate_subchannel()
519 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
520 put_device(&sch->dev); in css_evaluate_subchannel()
536 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
539 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
540 if (sch->todo >= todo) in css_sched_sch_todo()
543 if (!get_device(&sch->dev)) in css_sched_sch_todo()
545 sch->todo = todo; in css_sched_sch_todo()
546 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
548 put_device(&sch->dev); in css_sched_sch_todo()
555 struct subchannel *sch; in css_sch_todo() local
559 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
561 spin_lock_irq(sch->lock); in css_sch_todo()
562 todo = sch->todo; in css_sch_todo()
563 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
564 sch->schid.sch_no, todo); in css_sch_todo()
565 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
566 spin_unlock_irq(sch->lock); in css_sch_todo()
572 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
574 spin_lock_irq(sch->lock); in css_sch_todo()
575 css_sched_sch_todo(sch, todo); in css_sch_todo()
576 spin_unlock_irq(sch->lock); in css_sch_todo()
580 css_sch_device_unregister(sch); in css_sch_todo()
584 put_device(&sch->dev); in css_sch_todo()
605 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
611 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
612 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
615 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
617 css_schedule_eval(sch->schid); in slow_eval_known_fn()
699 struct subchannel *sch = to_subchannel(dev); in __unset_registered() local
701 idset_sch_del(set, sch->schid); in __unset_registered()
747 struct subchannel *sch; in css_process_crw() local
768 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
769 if (sch) { in css_process_crw()
770 css_update_ssd_info(sch); in css_process_crw()
771 put_device(&sch->dev); in css_process_crw()
1214 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1216 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1221 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1226 if (sch->st == id->type) in css_bus_match()
1235 struct subchannel *sch; in css_probe() local
1238 sch = to_subchannel(dev); in css_probe()
1239 sch->driver = to_cssdriver(dev->driver); in css_probe()
1240 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1242 sch->driver = NULL; in css_probe()
1248 struct subchannel *sch; in css_remove() local
1251 sch = to_subchannel(dev); in css_remove()
1252 ret = sch->driver->remove ? sch->driver->remove(sch) : 0; in css_remove()
1253 sch->driver = NULL; in css_remove()
1259 struct subchannel *sch; in css_shutdown() local
1261 sch = to_subchannel(dev); in css_shutdown()
1262 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1263 sch->driver->shutdown(sch); in css_shutdown()
1268 struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1271 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1274 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()
1280 struct subchannel *sch = to_subchannel(dev); in css_pm_prepare() local
1283 if (mutex_is_locked(&sch->reg_mutex)) in css_pm_prepare()
1285 if (!sch->dev.driver) in css_pm_prepare()
1287 drv = to_cssdriver(sch->dev.driver); in css_pm_prepare()
1289 return drv->prepare ? drv->prepare(sch) : 0; in css_pm_prepare()
1294 struct subchannel *sch = to_subchannel(dev); in css_pm_complete() local
1297 if (!sch->dev.driver) in css_pm_complete()
1299 drv = to_cssdriver(sch->dev.driver); in css_pm_complete()
1301 drv->complete(sch); in css_pm_complete()
1306 struct subchannel *sch = to_subchannel(dev); in css_pm_freeze() local
1309 if (!sch->dev.driver) in css_pm_freeze()
1311 drv = to_cssdriver(sch->dev.driver); in css_pm_freeze()
1312 return drv->freeze ? drv->freeze(sch) : 0; in css_pm_freeze()
1317 struct subchannel *sch = to_subchannel(dev); in css_pm_thaw() local
1320 if (!sch->dev.driver) in css_pm_thaw()
1322 drv = to_cssdriver(sch->dev.driver); in css_pm_thaw()
1323 return drv->thaw ? drv->thaw(sch) : 0; in css_pm_thaw()
1328 struct subchannel *sch = to_subchannel(dev); in css_pm_restore() local
1331 css_update_ssd_info(sch); in css_pm_restore()
1332 if (!sch->dev.driver) in css_pm_restore()
1334 drv = to_cssdriver(sch->dev.driver); in css_pm_restore()
1335 return drv->restore ? drv->restore(sch) : 0; in css_pm_restore()