Lines Matching refs:bridge
29 int fpga_bridge_enable(struct fpga_bridge *bridge) in fpga_bridge_enable() argument
31 dev_dbg(&bridge->dev, "enable\n"); in fpga_bridge_enable()
33 if (bridge->br_ops && bridge->br_ops->enable_set) in fpga_bridge_enable()
34 return bridge->br_ops->enable_set(bridge, 1); in fpga_bridge_enable()
47 int fpga_bridge_disable(struct fpga_bridge *bridge) in fpga_bridge_disable() argument
49 dev_dbg(&bridge->dev, "disable\n"); in fpga_bridge_disable()
51 if (bridge->br_ops && bridge->br_ops->enable_set) in fpga_bridge_disable()
52 return bridge->br_ops->enable_set(bridge, 0); in fpga_bridge_disable()
61 struct fpga_bridge *bridge; in __fpga_bridge_get() local
64 bridge = to_fpga_bridge(dev); in __fpga_bridge_get()
66 bridge->info = info; in __fpga_bridge_get()
68 if (!mutex_trylock(&bridge->mutex)) { in __fpga_bridge_get()
76 dev_dbg(&bridge->dev, "get\n"); in __fpga_bridge_get()
78 return bridge; in __fpga_bridge_get()
81 mutex_unlock(&bridge->mutex); in __fpga_bridge_get()
144 void fpga_bridge_put(struct fpga_bridge *bridge) in fpga_bridge_put() argument
146 dev_dbg(&bridge->dev, "put\n"); in fpga_bridge_put()
148 bridge->info = NULL; in fpga_bridge_put()
149 module_put(bridge->dev.parent->driver->owner); in fpga_bridge_put()
150 mutex_unlock(&bridge->mutex); in fpga_bridge_put()
151 put_device(&bridge->dev); in fpga_bridge_put()
165 struct fpga_bridge *bridge; in fpga_bridges_enable() local
168 list_for_each_entry(bridge, bridge_list, node) { in fpga_bridges_enable()
169 ret = fpga_bridge_enable(bridge); in fpga_bridges_enable()
189 struct fpga_bridge *bridge; in fpga_bridges_disable() local
192 list_for_each_entry(bridge, bridge_list, node) { in fpga_bridges_disable()
193 ret = fpga_bridge_disable(bridge); in fpga_bridges_disable()
212 struct fpga_bridge *bridge, *next; in fpga_bridges_put() local
215 list_for_each_entry_safe(bridge, next, bridge_list, node) { in fpga_bridges_put()
216 fpga_bridge_put(bridge); in fpga_bridges_put()
219 list_del(&bridge->node); in fpga_bridges_put()
240 struct fpga_bridge *bridge; in of_fpga_bridge_get_to_list() local
243 bridge = of_fpga_bridge_get(np, info); in of_fpga_bridge_get_to_list()
244 if (IS_ERR(bridge)) in of_fpga_bridge_get_to_list()
245 return PTR_ERR(bridge); in of_fpga_bridge_get_to_list()
248 list_add(&bridge->node, bridge_list); in of_fpga_bridge_get_to_list()
270 struct fpga_bridge *bridge; in fpga_bridge_get_to_list() local
273 bridge = fpga_bridge_get(dev, info); in fpga_bridge_get_to_list()
274 if (IS_ERR(bridge)) in fpga_bridge_get_to_list()
275 return PTR_ERR(bridge); in fpga_bridge_get_to_list()
278 list_add(&bridge->node, bridge_list); in fpga_bridge_get_to_list()
288 struct fpga_bridge *bridge = to_fpga_bridge(dev); in name_show() local
290 return sprintf(buf, "%s\n", bridge->name); in name_show()
296 struct fpga_bridge *bridge = to_fpga_bridge(dev); in state_show() local
299 if (bridge->br_ops && bridge->br_ops->enable_show) { in state_show()
300 state = bridge->br_ops->enable_show(bridge); in state_show()
332 struct fpga_bridge *bridge; in fpga_bridge_register() local
345 bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); in fpga_bridge_register()
346 if (!bridge) in fpga_bridge_register()
355 mutex_init(&bridge->mutex); in fpga_bridge_register()
356 INIT_LIST_HEAD(&bridge->node); in fpga_bridge_register()
358 bridge->name = name; in fpga_bridge_register()
359 bridge->br_ops = br_ops; in fpga_bridge_register()
360 bridge->priv = priv; in fpga_bridge_register()
362 bridge->dev.groups = br_ops->groups; in fpga_bridge_register()
363 bridge->dev.class = &fpga_bridge_class; in fpga_bridge_register()
364 bridge->dev.parent = parent; in fpga_bridge_register()
365 bridge->dev.of_node = parent->of_node; in fpga_bridge_register()
366 bridge->dev.id = id; in fpga_bridge_register()
368 ret = dev_set_name(&bridge->dev, "br%d", id); in fpga_bridge_register()
372 ret = device_register(&bridge->dev); in fpga_bridge_register()
374 put_device(&bridge->dev); in fpga_bridge_register()
378 of_platform_populate(bridge->dev.of_node, NULL, NULL, &bridge->dev); in fpga_bridge_register()
380 return bridge; in fpga_bridge_register()
385 kfree(bridge); in fpga_bridge_register()
398 void fpga_bridge_unregister(struct fpga_bridge *bridge) in fpga_bridge_unregister() argument
404 if (bridge->br_ops && bridge->br_ops->fpga_bridge_remove) in fpga_bridge_unregister()
405 bridge->br_ops->fpga_bridge_remove(bridge); in fpga_bridge_unregister()
407 device_unregister(&bridge->dev); in fpga_bridge_unregister()
413 struct fpga_bridge *bridge = to_fpga_bridge(dev); in fpga_bridge_dev_release() local
415 ida_free(&fpga_bridge_ida, bridge->dev.id); in fpga_bridge_dev_release()
416 kfree(bridge); in fpga_bridge_dev_release()