Lines Matching refs:master

35 struct master {  struct
47 struct master *master; argument
64 struct master *m = s->private; in component_devices_show()
109 static void component_master_debugfs_add(struct master *m) in component_master_debugfs_add()
116 static void component_master_debugfs_del(struct master *m) in component_master_debugfs_del()
124 static void component_master_debugfs_add(struct master *m) in component_master_debugfs_add()
127 static void component_master_debugfs_del(struct master *m) in component_master_debugfs_del()
132 static struct master *__master_find(struct device *dev, in __master_find()
135 struct master *m; in __master_find()
144 static struct component *find_component(struct master *master, in find_component() argument
150 if (c->master && c->master != master) in find_component()
160 static int find_components(struct master *master) in find_components() argument
162 struct component_match *match = master->match; in find_components()
174 dev_dbg(master->dev, "Looking for component %zu\n", i); in find_components()
179 c = find_component(master, mc->compare, mc->data); in find_components()
185 dev_dbg(master->dev, "found component %s, duplicate %u\n", dev_name(c->dev), !!c->master); in find_components()
188 match->compare[i].duplicate = !!c->master; in find_components()
190 c->master = master; in find_components()
196 static void remove_component(struct master *master, struct component *c) in remove_component() argument
201 for (i = 0; i < master->match->num; i++) in remove_component()
202 if (master->match->compare[i].component == c) in remove_component()
203 master->match->compare[i].component = NULL; in remove_component()
213 static int try_to_bring_up_master(struct master *master, in try_to_bring_up_master() argument
218 dev_dbg(master->dev, "trying to bring up master\n"); in try_to_bring_up_master()
220 if (find_components(master)) { in try_to_bring_up_master()
221 dev_dbg(master->dev, "master has incomplete components\n"); in try_to_bring_up_master()
225 if (component && component->master != master) { in try_to_bring_up_master()
226 dev_dbg(master->dev, "master is not for this component (%s)\n", in try_to_bring_up_master()
231 if (!devres_open_group(master->dev, NULL, GFP_KERNEL)) in try_to_bring_up_master()
235 ret = master->ops->bind(master->dev); in try_to_bring_up_master()
237 devres_release_group(master->dev, NULL); in try_to_bring_up_master()
238 dev_info(master->dev, "master bind failed: %d\n", ret); in try_to_bring_up_master()
242 master->bound = true; in try_to_bring_up_master()
248 struct master *m; in try_to_bring_up_masters()
262 static void take_down_master(struct master *master) in take_down_master() argument
264 if (master->bound) { in take_down_master()
265 master->ops->unbind(master->dev); in take_down_master()
266 devres_release_group(master->dev, NULL); in take_down_master()
267 master->bound = false; in take_down_master()
271 static void component_match_release(struct device *master, in component_match_release() argument
280 mc->release(master, mc->data); in component_match_release()
319 void component_match_add_release(struct device *master, in component_match_add_release() argument
337 devres_add(master, match); in component_match_add_release()
346 ret = component_match_realloc(master, match, new_size); in component_match_add_release()
361 static void free_master(struct master *master) in free_master() argument
363 struct component_match *match = master->match; in free_master()
366 component_master_debugfs_del(master); in free_master()
367 list_del(&master->node); in free_master()
373 c->master = NULL; in free_master()
377 kfree(master); in free_master()
384 struct master *master; in component_master_add_with_match() local
392 master = kzalloc(sizeof(*master), GFP_KERNEL); in component_master_add_with_match()
393 if (!master) in component_master_add_with_match()
396 master->dev = dev; in component_master_add_with_match()
397 master->ops = ops; in component_master_add_with_match()
398 master->match = match; in component_master_add_with_match()
400 component_master_debugfs_add(master); in component_master_add_with_match()
403 list_add(&master->node, &masters); in component_master_add_with_match()
405 ret = try_to_bring_up_master(master, NULL); in component_master_add_with_match()
408 free_master(master); in component_master_add_with_match()
419 struct master *master; in component_master_del() local
422 master = __master_find(dev, ops); in component_master_del()
423 if (master) { in component_master_del()
424 take_down_master(master); in component_master_del()
425 free_master(master); in component_master_del()
432 struct master *master, void *data) in component_unbind() argument
436 component->ops->unbind(component->dev, master->dev, data); in component_unbind()
445 struct master *master; in component_unbind_all() local
451 master = __master_find(master_dev, NULL); in component_unbind_all()
452 if (!master) in component_unbind_all()
456 for (i = master->match->num; i--; ) in component_unbind_all()
457 if (!master->match->compare[i].duplicate) { in component_unbind_all()
458 c = master->match->compare[i].component; in component_unbind_all()
459 component_unbind(c, master, data); in component_unbind_all()
464 static int component_bind(struct component *component, struct master *master, in component_bind() argument
474 if (!devres_open_group(master->dev, NULL, GFP_KERNEL)) in component_bind()
483 devres_release_group(master->dev, NULL); in component_bind()
487 dev_dbg(master->dev, "binding %s (ops %ps)\n", in component_bind()
490 ret = component->ops->bind(component->dev, master->dev, data); in component_bind()
501 devres_remove_group(master->dev, NULL); in component_bind()
503 dev_info(master->dev, "bound %s (ops %ps)\n", in component_bind()
507 devres_release_group(master->dev, NULL); in component_bind()
509 dev_err(master->dev, "failed to bind %s (ops %ps): %d\n", in component_bind()
518 struct master *master; in component_bind_all() local
525 master = __master_find(master_dev, NULL); in component_bind_all()
526 if (!master) in component_bind_all()
530 for (i = 0; i < master->match->num; i++) in component_bind_all()
531 if (!master->match->compare[i].duplicate) { in component_bind_all()
532 c = master->match->compare[i].component; in component_bind_all()
533 ret = component_bind(c, master, data); in component_bind_all()
540 if (!master->match->compare[i].duplicate) { in component_bind_all()
541 c = master->match->compare[i].component; in component_bind_all()
542 component_unbind(c, master, data); in component_bind_all()
569 if (component->master) in component_add()
570 remove_component(component->master, component); in component_add()
593 if (component && component->master) { in component_del()
594 take_down_master(component->master); in component_del()
595 remove_component(component->master, component); in component_del()