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