Lines Matching refs:sch
68 struct subchannel *sch = to_subchannel(dev); in call_fn_known_sch() local
73 idset_sch_del(cb->set, sch->schid); in call_fn_known_sch()
75 rc = cb->fn_known_sch(sch, cb->data); in call_fn_known_sch()
92 struct subchannel *sch; in call_fn_all_sch() local
95 sch = get_subchannel_by_schid(schid); in call_fn_all_sch()
96 if (sch) { in call_fn_all_sch()
98 rc = cb->fn_known_sch(sch, cb->data); in call_fn_all_sch()
99 put_device(&sch->dev); in call_fn_all_sch()
148 static int css_sch_create_locks(struct subchannel *sch) in css_sch_create_locks() argument
150 sch->lock = kmalloc(sizeof(*sch->lock), GFP_KERNEL); in css_sch_create_locks()
151 if (!sch->lock) in css_sch_create_locks()
154 spin_lock_init(sch->lock); in css_sch_create_locks()
155 mutex_init(&sch->reg_mutex); in css_sch_create_locks()
162 struct subchannel *sch = to_subchannel(dev); in css_subchannel_release() local
164 sch->config.intparm = 0; in css_subchannel_release()
165 cio_commit_config(sch); in css_subchannel_release()
166 kfree(sch->lock); in css_subchannel_release()
167 kfree(sch); in css_subchannel_release()
172 struct subchannel *sch; in css_alloc_subchannel() local
175 sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
176 if (!sch) in css_alloc_subchannel()
179 ret = cio_validate_subchannel(sch, schid); in css_alloc_subchannel()
183 ret = css_sch_create_locks(sch); in css_alloc_subchannel()
187 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
188 sch->dev.release = &css_subchannel_release; in css_alloc_subchannel()
189 device_initialize(&sch->dev); in css_alloc_subchannel()
190 return sch; in css_alloc_subchannel()
193 kfree(sch); in css_alloc_subchannel()
197 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
201 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
202 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
203 sch->schid.sch_no); in css_sch_device_register()
204 ret = device_add(&sch->dev); in css_sch_device_register()
205 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
213 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
215 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
216 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
217 device_unregister(&sch->dev); in css_sch_device_unregister()
218 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
251 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
255 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
257 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
259 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
265 struct subchannel *sch = to_subchannel(dev); in type_show() local
267 return sprintf(buf, "%01x\n", sch->st); in type_show()
275 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
277 return sprintf(buf, "css:t%01X\n", sch->st); in modalias_show()
297 int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
302 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
303 sch->dev.bus = &css_bus_type; in css_register_subchannel()
304 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
314 dev_set_uevent_suppress(&sch->dev, 1); in css_register_subchannel()
315 css_update_ssd_info(sch); in css_register_subchannel()
317 ret = css_sch_device_register(sch); in css_register_subchannel()
320 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
323 if (!sch->driver) { in css_register_subchannel()
329 dev_set_uevent_suppress(&sch->dev, 0); in css_register_subchannel()
330 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in css_register_subchannel()
337 struct subchannel *sch; in css_probe_device() local
340 sch = css_alloc_subchannel(schid); in css_probe_device()
341 if (IS_ERR(sch)) in css_probe_device()
342 return PTR_ERR(sch); in css_probe_device()
344 ret = css_register_subchannel(sch); in css_probe_device()
346 put_device(&sch->dev); in css_probe_device()
354 struct subchannel *sch; in check_subchannel() local
357 sch = to_subchannel(dev); in check_subchannel()
358 return schid_equal(&sch->schid, schid); in check_subchannel()
408 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
412 if (sch->driver) { in css_evaluate_known_subchannel()
413 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
414 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
416 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
422 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
429 struct subchannel *sch; in css_evaluate_subchannel() local
432 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
433 if (sch) { in css_evaluate_subchannel()
434 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
435 put_device(&sch->dev); in css_evaluate_subchannel()
451 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
454 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
455 if (sch->todo >= todo) in css_sched_sch_todo()
458 if (!get_device(&sch->dev)) in css_sched_sch_todo()
460 sch->todo = todo; in css_sched_sch_todo()
461 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
463 put_device(&sch->dev); in css_sched_sch_todo()
470 struct subchannel *sch; in css_sch_todo() local
474 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
476 spin_lock_irq(sch->lock); in css_sch_todo()
477 todo = sch->todo; in css_sch_todo()
478 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
479 sch->schid.sch_no, todo); in css_sch_todo()
480 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
481 spin_unlock_irq(sch->lock); in css_sch_todo()
487 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
489 spin_lock_irq(sch->lock); in css_sch_todo()
490 css_sched_sch_todo(sch, todo); in css_sch_todo()
491 spin_unlock_irq(sch->lock); in css_sch_todo()
495 css_sch_device_unregister(sch); in css_sch_todo()
499 put_device(&sch->dev); in css_sch_todo()
520 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
526 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
527 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
530 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
532 css_schedule_eval(sch->schid); in slow_eval_known_fn()
614 struct subchannel *sch = to_subchannel(dev); in __unset_registered() local
616 idset_sch_del(set, sch->schid); in __unset_registered()
662 struct subchannel *sch; in css_process_crw() local
683 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
684 if (sch) { in css_process_crw()
685 css_update_ssd_info(sch); in css_process_crw()
686 put_device(&sch->dev); in css_process_crw()
1126 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1128 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1133 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1138 if (sch->st == id->type) in css_bus_match()
1147 struct subchannel *sch; in css_probe() local
1150 sch = to_subchannel(dev); in css_probe()
1151 sch->driver = to_cssdriver(dev->driver); in css_probe()
1152 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1154 sch->driver = NULL; in css_probe()
1160 struct subchannel *sch; in css_remove() local
1163 sch = to_subchannel(dev); in css_remove()
1164 ret = sch->driver->remove ? sch->driver->remove(sch) : 0; in css_remove()
1165 sch->driver = NULL; in css_remove()
1171 struct subchannel *sch; in css_shutdown() local
1173 sch = to_subchannel(dev); in css_shutdown()
1174 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1175 sch->driver->shutdown(sch); in css_shutdown()
1180 struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1183 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1186 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()
1192 struct subchannel *sch = to_subchannel(dev); in css_pm_prepare() local
1195 if (mutex_is_locked(&sch->reg_mutex)) in css_pm_prepare()
1197 if (!sch->dev.driver) in css_pm_prepare()
1199 drv = to_cssdriver(sch->dev.driver); in css_pm_prepare()
1201 return drv->prepare ? drv->prepare(sch) : 0; in css_pm_prepare()
1206 struct subchannel *sch = to_subchannel(dev); in css_pm_complete() local
1209 if (!sch->dev.driver) in css_pm_complete()
1211 drv = to_cssdriver(sch->dev.driver); in css_pm_complete()
1213 drv->complete(sch); in css_pm_complete()
1218 struct subchannel *sch = to_subchannel(dev); in css_pm_freeze() local
1221 if (!sch->dev.driver) in css_pm_freeze()
1223 drv = to_cssdriver(sch->dev.driver); in css_pm_freeze()
1224 return drv->freeze ? drv->freeze(sch) : 0; in css_pm_freeze()
1229 struct subchannel *sch = to_subchannel(dev); in css_pm_thaw() local
1232 if (!sch->dev.driver) in css_pm_thaw()
1234 drv = to_cssdriver(sch->dev.driver); in css_pm_thaw()
1235 return drv->thaw ? drv->thaw(sch) : 0; in css_pm_thaw()
1240 struct subchannel *sch = to_subchannel(dev); in css_pm_restore() local
1243 css_update_ssd_info(sch); in css_pm_restore()
1244 if (!sch->dev.driver) in css_pm_restore()
1246 drv = to_cssdriver(sch->dev.driver); in css_pm_restore()
1247 return drv->restore ? drv->restore(sch) : 0; in css_pm_restore()