• Home
  • Raw
  • Download

Lines Matching full:master

7  * subsystem, and only handles one master device, but this doesn't have to be
35 struct master { struct
47 struct master *master; argument
64 struct master *m = s->private; in component_devices_show()
69 seq_printf(s, "%-40s %20s\n", "master name", "status"); 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()
168 * any components which are found to this master. 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()
187 /* Attach this component to the master */ in find_components()
188 match->compare[i].duplicate = !!c->master; in find_components()
190 c->master = master; in find_components()
195 /* Detach component from associated master */
196 static void remove_component(struct master *master, struct component *c) in remove_component() argument
200 /* Detach the component from this master. */ in remove_component()
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()
207 * Try to bring up a master. If component is NULL, we're interested in
208 * this master, otherwise it's a component which must be present to try
209 * and bring up the master.
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()
239 dev_info(master->dev, "master bind failed: %d\n", ret); in try_to_bring_up_master()
243 master->bound = true; in try_to_bring_up_master()
249 struct master *m; in try_to_bring_up_masters()
263 static void take_down_master(struct master *master) in take_down_master() argument
265 if (master->bound) { in take_down_master()
266 master->ops->unbind(master->dev); in take_down_master()
267 devres_release_group(master->dev, NULL); in take_down_master()
268 master->bound = false; in take_down_master()
272 static void component_match_release(struct device *master, in component_match_release() argument
281 mc->release(master, mc->data); in component_match_release()
320 void component_match_add_release(struct device *master, in component_match_add_release() argument
338 devres_add(master, match); in component_match_add_release()
347 ret = component_match_realloc(master, match, new_size); in component_match_add_release()
362 static void free_master(struct master *master) in free_master() argument
364 struct component_match *match = master->match; in free_master()
367 component_master_debugfs_del(master); in free_master()
368 list_del(&master->node); in free_master()
374 c->master = NULL; in free_master()
378 kfree(master); in free_master()
385 struct master *master; in component_master_add_with_match() local
393 master = kzalloc(sizeof(*master), GFP_KERNEL); in component_master_add_with_match()
394 if (!master) in component_master_add_with_match()
397 master->dev = dev; in component_master_add_with_match()
398 master->ops = ops; in component_master_add_with_match()
399 master->match = match; in component_master_add_with_match()
401 component_master_debugfs_add(master); in component_master_add_with_match()
404 list_add(&master->node, &masters); in component_master_add_with_match()
406 ret = try_to_bring_up_master(master, NULL); in component_master_add_with_match()
409 free_master(master); in component_master_add_with_match()
420 struct master *master; in component_master_del() local
423 master = __master_find(dev, ops); in component_master_del()
424 if (master) { in component_master_del()
425 take_down_master(master); in component_master_del()
426 free_master(master); in component_master_del()
433 struct master *master, void *data) in component_unbind() argument
437 component->ops->unbind(component->dev, master->dev, data); in component_unbind()
446 struct master *master; in component_unbind_all() local
452 master = __master_find(master_dev, NULL); in component_unbind_all()
453 if (!master) in component_unbind_all()
457 for (i = master->match->num; i--; ) in component_unbind_all()
458 if (!master->match->compare[i].duplicate) { in component_unbind_all()
459 c = master->match->compare[i].component; in component_unbind_all()
460 component_unbind(c, master, data); in component_unbind_all()
465 static int component_bind(struct component *component, struct master *master, in component_bind() argument
475 if (!devres_open_group(master->dev, NULL, GFP_KERNEL)) in component_bind()
484 devres_release_group(master->dev, NULL); in component_bind()
488 dev_dbg(master->dev, "binding %s (ops %ps)\n", in component_bind()
491 ret = component->ops->bind(component->dev, master->dev, data); in component_bind()
502 devres_remove_group(master->dev, NULL); in component_bind()
504 dev_info(master->dev, "bound %s (ops %ps)\n", in component_bind()
508 devres_release_group(master->dev, NULL); in component_bind()
511 dev_err(master->dev, "failed to bind %s (ops %ps): %d\n", in component_bind()
520 struct master *master; in component_bind_all() local
527 master = __master_find(master_dev, NULL); in component_bind_all()
528 if (!master) in component_bind_all()
532 for (i = 0; i < master->match->num; i++) in component_bind_all()
533 if (!master->match->compare[i].duplicate) { in component_bind_all()
534 c = master->match->compare[i].component; in component_bind_all()
535 ret = component_bind(c, master, data); in component_bind_all()
542 if (!master->match->compare[i - 1].duplicate) { in component_bind_all()
543 c = master->match->compare[i - 1].component; in component_bind_all()
544 component_unbind(c, master, data); in component_bind_all()
571 if (component->master) in component_add()
572 remove_component(component->master, component); in component_add()
595 if (component && component->master) { in component_del()
596 take_down_master(component->master); in component_del()
597 remove_component(component->master, component); in component_del()