Lines Matching refs:sch
67 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()
147 static int css_sch_create_locks(struct subchannel *sch) in css_sch_create_locks() argument
149 sch->lock = kmalloc(sizeof(*sch->lock), GFP_KERNEL); in css_sch_create_locks()
150 if (!sch->lock) in css_sch_create_locks()
153 spin_lock_init(sch->lock); in css_sch_create_locks()
154 mutex_init(&sch->reg_mutex); in css_sch_create_locks()
161 struct subchannel *sch = to_subchannel(dev); in css_subchannel_release() local
163 sch->config.intparm = 0; in css_subchannel_release()
164 cio_commit_config(sch); in css_subchannel_release()
165 kfree(sch->lock); in css_subchannel_release()
166 kfree(sch); in css_subchannel_release()
171 struct subchannel *sch; in css_alloc_subchannel() local
174 sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
175 if (!sch) in css_alloc_subchannel()
178 ret = cio_validate_subchannel(sch, schid); in css_alloc_subchannel()
182 ret = css_sch_create_locks(sch); in css_alloc_subchannel()
186 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
187 sch->dev.release = &css_subchannel_release; in css_alloc_subchannel()
188 device_initialize(&sch->dev); in css_alloc_subchannel()
189 return sch; in css_alloc_subchannel()
192 kfree(sch); in css_alloc_subchannel()
196 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
200 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
201 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
202 sch->schid.sch_no); in css_sch_device_register()
203 ret = device_add(&sch->dev); in css_sch_device_register()
204 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
212 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
214 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
215 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
216 device_unregister(&sch->dev); in css_sch_device_unregister()
217 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
250 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
254 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
256 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
258 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
264 struct subchannel *sch = to_subchannel(dev); in type_show() local
266 return sprintf(buf, "%01x\n", sch->st); in type_show()
274 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
276 return sprintf(buf, "css:t%01X\n", sch->st); in modalias_show()
296 int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
301 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
302 sch->dev.bus = &css_bus_type; in css_register_subchannel()
303 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
313 dev_set_uevent_suppress(&sch->dev, 1); in css_register_subchannel()
314 css_update_ssd_info(sch); in css_register_subchannel()
316 ret = css_sch_device_register(sch); in css_register_subchannel()
319 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
322 if (!sch->driver) { in css_register_subchannel()
328 dev_set_uevent_suppress(&sch->dev, 0); in css_register_subchannel()
329 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in css_register_subchannel()
336 struct subchannel *sch; in css_probe_device() local
339 sch = css_alloc_subchannel(schid); in css_probe_device()
340 if (IS_ERR(sch)) in css_probe_device()
341 return PTR_ERR(sch); in css_probe_device()
343 ret = css_register_subchannel(sch); in css_probe_device()
345 put_device(&sch->dev); in css_probe_device()
353 struct subchannel *sch; in check_subchannel() local
356 sch = to_subchannel(dev); in check_subchannel()
357 return schid_equal(&sch->schid, schid); in check_subchannel()
407 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
411 if (sch->driver) { in css_evaluate_known_subchannel()
412 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
413 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
415 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
421 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
428 struct subchannel *sch; in css_evaluate_subchannel() local
431 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
432 if (sch) { in css_evaluate_subchannel()
433 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
434 put_device(&sch->dev); in css_evaluate_subchannel()
450 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
453 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
454 if (sch->todo >= todo) in css_sched_sch_todo()
457 if (!get_device(&sch->dev)) in css_sched_sch_todo()
459 sch->todo = todo; in css_sched_sch_todo()
460 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
462 put_device(&sch->dev); in css_sched_sch_todo()
469 struct subchannel *sch; in css_sch_todo() local
473 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
475 spin_lock_irq(sch->lock); in css_sch_todo()
476 todo = sch->todo; in css_sch_todo()
477 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
478 sch->schid.sch_no, todo); in css_sch_todo()
479 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
480 spin_unlock_irq(sch->lock); in css_sch_todo()
486 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
488 spin_lock_irq(sch->lock); in css_sch_todo()
489 css_sched_sch_todo(sch, todo); in css_sch_todo()
490 spin_unlock_irq(sch->lock); in css_sch_todo()
494 css_sch_device_unregister(sch); in css_sch_todo()
498 put_device(&sch->dev); in css_sch_todo()
519 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
525 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
526 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
529 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
531 css_schedule_eval(sch->schid); in slow_eval_known_fn()
613 struct subchannel *sch = to_subchannel(dev); in __unset_registered() local
615 idset_sch_del(set, sch->schid); in __unset_registered()
661 struct subchannel *sch; in css_process_crw() local
682 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
683 if (sch) { in css_process_crw()
684 css_update_ssd_info(sch); in css_process_crw()
685 put_device(&sch->dev); in css_process_crw()
1121 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1123 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1128 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1133 if (sch->st == id->type) in css_bus_match()
1142 struct subchannel *sch; in css_probe() local
1145 sch = to_subchannel(dev); in css_probe()
1146 sch->driver = to_cssdriver(dev->driver); in css_probe()
1147 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1149 sch->driver = NULL; in css_probe()
1155 struct subchannel *sch; in css_remove() local
1158 sch = to_subchannel(dev); in css_remove()
1159 ret = sch->driver->remove ? sch->driver->remove(sch) : 0; in css_remove()
1160 sch->driver = NULL; in css_remove()
1166 struct subchannel *sch; in css_shutdown() local
1168 sch = to_subchannel(dev); in css_shutdown()
1169 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1170 sch->driver->shutdown(sch); in css_shutdown()
1175 struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1178 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1181 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()
1187 struct subchannel *sch = to_subchannel(dev); in css_pm_prepare() local
1190 if (mutex_is_locked(&sch->reg_mutex)) in css_pm_prepare()
1192 if (!sch->dev.driver) in css_pm_prepare()
1194 drv = to_cssdriver(sch->dev.driver); in css_pm_prepare()
1196 return drv->prepare ? drv->prepare(sch) : 0; in css_pm_prepare()
1201 struct subchannel *sch = to_subchannel(dev); in css_pm_complete() local
1204 if (!sch->dev.driver) in css_pm_complete()
1206 drv = to_cssdriver(sch->dev.driver); in css_pm_complete()
1208 drv->complete(sch); in css_pm_complete()
1213 struct subchannel *sch = to_subchannel(dev); in css_pm_freeze() local
1216 if (!sch->dev.driver) in css_pm_freeze()
1218 drv = to_cssdriver(sch->dev.driver); in css_pm_freeze()
1219 return drv->freeze ? drv->freeze(sch) : 0; in css_pm_freeze()
1224 struct subchannel *sch = to_subchannel(dev); in css_pm_thaw() local
1227 if (!sch->dev.driver) in css_pm_thaw()
1229 drv = to_cssdriver(sch->dev.driver); in css_pm_thaw()
1230 return drv->thaw ? drv->thaw(sch) : 0; in css_pm_thaw()
1235 struct subchannel *sch = to_subchannel(dev); in css_pm_restore() local
1238 css_update_ssd_info(sch); in css_pm_restore()
1239 if (!sch->dev.driver) in css_pm_restore()
1241 drv = to_cssdriver(sch->dev.driver); in css_pm_restore()
1242 return drv->restore ? drv->restore(sch) : 0; in css_pm_restore()