• Home
  • Raw
  • Download

Lines Matching refs:master

61 struct master {  struct
72 struct master *master; argument
90 struct master *m = s->private; in component_devices_show()
125 static void component_master_debugfs_add(struct master *m) in component_master_debugfs_add()
131 static void component_master_debugfs_del(struct master *m) in component_master_debugfs_del()
138 static void component_master_debugfs_add(struct master *m) in component_master_debugfs_add()
141 static void component_master_debugfs_del(struct master *m) in component_master_debugfs_del()
146 static struct master *__master_find(struct device *parent, in __master_find()
149 struct master *m; in __master_find()
158 static struct component *find_component(struct master *master, in find_component() argument
164 if (c->master && c->master != master) in find_component()
178 static int find_components(struct master *master) in find_components() argument
180 struct component_match *match = master->match; in find_components()
192 dev_dbg(master->parent, "Looking for component %zu\n", i); in find_components()
197 c = find_component(master, mc); in find_components()
203 dev_dbg(master->parent, "found component %s, duplicate %u\n", dev_name(c->dev), !!c->master); in find_components()
206 match->compare[i].duplicate = !!c->master; in find_components()
208 c->master = master; in find_components()
214 static void remove_component(struct master *master, struct component *c) in remove_component() argument
219 for (i = 0; i < master->match->num; i++) in remove_component()
220 if (master->match->compare[i].component == c) in remove_component()
221 master->match->compare[i].component = NULL; in remove_component()
231 static int try_to_bring_up_master(struct master *master, in try_to_bring_up_master() argument
236 dev_dbg(master->parent, "trying to bring up master\n"); in try_to_bring_up_master()
238 if (find_components(master)) { in try_to_bring_up_master()
239 dev_dbg(master->parent, "master has incomplete components\n"); in try_to_bring_up_master()
243 if (component && component->master != master) { in try_to_bring_up_master()
244 dev_dbg(master->parent, "master is not for this component (%s)\n", in try_to_bring_up_master()
249 if (!devres_open_group(master->parent, master, GFP_KERNEL)) in try_to_bring_up_master()
253 ret = master->ops->bind(master->parent); in try_to_bring_up_master()
255 devres_release_group(master->parent, NULL); in try_to_bring_up_master()
257 dev_info(master->parent, "master bind failed: %d\n", ret); in try_to_bring_up_master()
261 devres_close_group(master->parent, NULL); in try_to_bring_up_master()
262 master->bound = true; in try_to_bring_up_master()
268 struct master *m; in try_to_bring_up_masters()
282 static void take_down_master(struct master *master) in take_down_master() argument
284 if (master->bound) { in take_down_master()
285 master->ops->unbind(master->parent); in take_down_master()
286 devres_release_group(master->parent, master); in take_down_master()
287 master->bound = false; in take_down_master()
328 static void __component_match_add(struct device *master, in __component_match_add() argument
348 devres_add(master, match); in __component_match_add()
392 void component_match_add_release(struct device *master, in component_match_add_release() argument
397 __component_match_add(master, matchptr, release, compare, NULL, in component_match_add_release()
419 void component_match_add_typed(struct device *master, in component_match_add_typed() argument
423 __component_match_add(master, matchptr, NULL, NULL, compare_typed, in component_match_add_typed()
428 static void free_master(struct master *master) in free_master() argument
430 struct component_match *match = master->match; in free_master()
433 component_master_debugfs_del(master); in free_master()
434 list_del(&master->node); in free_master()
440 c->master = NULL; in free_master()
444 kfree(master); in free_master()
463 struct master *master; in component_master_add_with_match() local
471 master = kzalloc(sizeof(*master), GFP_KERNEL); in component_master_add_with_match()
472 if (!master) in component_master_add_with_match()
475 master->parent = parent; in component_master_add_with_match()
476 master->ops = ops; in component_master_add_with_match()
477 master->match = match; in component_master_add_with_match()
479 component_master_debugfs_add(master); in component_master_add_with_match()
482 list_add(&master->node, &masters); in component_master_add_with_match()
484 ret = try_to_bring_up_master(master, NULL); in component_master_add_with_match()
487 free_master(master); in component_master_add_with_match()
507 struct master *master; in component_master_del() local
510 master = __master_find(parent, ops); in component_master_del()
511 if (master) { in component_master_del()
512 take_down_master(master); in component_master_del()
513 free_master(master); in component_master_del()
520 struct master *master, void *data) in component_unbind() argument
525 component->ops->unbind(component->dev, master->parent, data); in component_unbind()
543 struct master *master; in component_unbind_all() local
549 master = __master_find(parent, NULL); in component_unbind_all()
550 if (!master) in component_unbind_all()
554 for (i = master->match->num; i--; ) in component_unbind_all()
555 if (!master->match->compare[i].duplicate) { in component_unbind_all()
556 c = master->match->compare[i].component; in component_unbind_all()
557 component_unbind(c, master, data); in component_unbind_all()
562 static int component_bind(struct component *component, struct master *master, in component_bind() argument
572 if (!devres_open_group(master->parent, NULL, GFP_KERNEL)) in component_bind()
581 devres_release_group(master->parent, NULL); in component_bind()
585 dev_dbg(master->parent, "binding %s (ops %ps)\n", in component_bind()
588 ret = component->ops->bind(component->dev, master->parent, data); in component_bind()
599 devres_remove_group(master->parent, NULL); in component_bind()
601 dev_info(master->parent, "bound %s (ops %ps)\n", in component_bind()
605 devres_release_group(master->parent, NULL); in component_bind()
608 dev_err(master->parent, "failed to bind %s (ops %ps): %d\n", in component_bind()
626 struct master *master; in component_bind_all() local
633 master = __master_find(parent, NULL); in component_bind_all()
634 if (!master) in component_bind_all()
638 for (i = 0; i < master->match->num; i++) in component_bind_all()
639 if (!master->match->compare[i].duplicate) { in component_bind_all()
640 c = master->match->compare[i].component; in component_bind_all()
641 ret = component_bind(c, master, data); in component_bind_all()
648 if (!master->match->compare[i - 1].duplicate) { in component_bind_all()
649 c = master->match->compare[i - 1].component; in component_bind_all()
650 component_unbind(c, master, data); in component_bind_all()
679 if (component->master) in __component_add()
680 remove_component(component->master, component); in __component_add()
761 if (component && component->master) { in component_del()
762 take_down_master(component->master); in component_del()
763 remove_component(component->master, component); in component_del()