Lines Matching refs:swnode
27 struct swnode { struct
37 struct swnode *parent; argument
46 #define kobj_to_swnode(_kobj_) container_of(_kobj_, struct swnode, kobj) argument
62 struct swnode, fwnode) : NULL; \
65 static inline struct swnode *dev_to_swnode(struct device *dev) in dev_to_swnode()
78 static struct swnode *
81 struct swnode *swnode = NULL; in software_node_to_swnode() local
90 swnode = kobj_to_swnode(k); in software_node_to_swnode()
91 if (swnode->node == node) in software_node_to_swnode()
93 swnode = NULL; in software_node_to_swnode()
98 return swnode; in software_node_to_swnode()
103 const struct swnode *swnode = to_swnode(fwnode); in to_software_node() local
105 return swnode ? swnode->node : NULL; in to_software_node()
111 struct swnode *swnode = software_node_to_swnode(node); in software_node_fwnode() local
113 return swnode ? &swnode->fwnode : NULL; in software_node_fwnode()
379 struct swnode *swnode = to_swnode(fwnode); in software_node_get() local
381 kobject_get(&swnode->kobj); in software_node_get()
383 return &swnode->fwnode; in software_node_get()
388 struct swnode *swnode = to_swnode(fwnode); in software_node_put() local
390 kobject_put(&swnode->kobj); in software_node_put()
396 struct swnode *swnode = to_swnode(fwnode); in software_node_property_present() local
398 return !!property_entry_get(swnode->node->properties, propname); in software_node_property_present()
406 struct swnode *swnode = to_swnode(fwnode); in software_node_read_int_array() local
408 return property_entry_read_int_array(swnode->node->properties, propname, in software_node_read_int_array()
416 struct swnode *swnode = to_swnode(fwnode); in software_node_read_string_array() local
418 return property_entry_read_string_array(swnode->node->properties, in software_node_read_string_array()
425 const struct swnode *swnode = to_swnode(fwnode); in software_node_get_name() local
427 return kobject_name(&swnode->kobj); in software_node_get_name()
454 struct swnode *swnode = to_swnode(fwnode); in software_node_get_parent() local
456 if (!swnode || !swnode->parent) in software_node_get_parent()
459 return fwnode_handle_get(&swnode->parent->fwnode); in software_node_get_parent()
466 struct swnode *p = to_swnode(fwnode); in software_node_get_next_child()
467 struct swnode *c = to_swnode(child); in software_node_get_next_child()
478 c = list_first_entry(&p->children, struct swnode, entry); in software_node_get_next_child()
488 struct swnode *swnode = to_swnode(fwnode); in software_node_get_named_child_node() local
489 struct swnode *child; in software_node_get_named_child_node()
491 if (!swnode || list_empty(&swnode->children)) in software_node_get_named_child_node()
494 list_for_each_entry(child, &swnode->children, entry) { in software_node_get_named_child_node()
509 struct swnode *swnode = to_swnode(fwnode); in software_node_get_reference_args() local
518 prop = property_entry_get(swnode->node->properties, propname); in software_node_get_reference_args()
591 struct swnode *swnode = to_swnode(fwnode); in software_node_graph_get_next_endpoint() local
595 if (!swnode) in software_node_graph_get_next_endpoint()
604 parent = software_node_get(&swnode->fwnode); in software_node_graph_get_next_endpoint()
625 struct swnode *swnode = to_swnode(fwnode); in software_node_graph_get_remote_endpoint() local
629 if (!swnode) in software_node_graph_get_remote_endpoint()
632 prop = property_entry_get(swnode->node->properties, "remote-endpoint"); in software_node_graph_get_remote_endpoint()
644 struct swnode *swnode = to_swnode(fwnode); in software_node_graph_get_port_parent() local
646 swnode = swnode->parent; in software_node_graph_get_port_parent()
647 if (swnode && !strcmp(swnode->node->name, "ports")) in software_node_graph_get_port_parent()
648 swnode = swnode->parent; in software_node_graph_get_port_parent()
650 return swnode ? software_node_get(&swnode->fwnode) : NULL; in software_node_graph_get_port_parent()
657 struct swnode *swnode = to_swnode(fwnode); in software_node_graph_parse_endpoint() local
658 const char *parent_name = swnode->parent->node->name; in software_node_graph_parse_endpoint()
670 endpoint->id = swnode->id; in software_node_graph_parse_endpoint()
709 struct swnode *swnode = NULL; in software_node_find_by_name() local
718 swnode = kobj_to_swnode(k); in software_node_find_by_name()
719 if (parent == swnode->node->parent && swnode->node->name && in software_node_find_by_name()
720 !strcmp(name, swnode->node->name)) { in software_node_find_by_name()
721 kobject_get(&swnode->kobj); in software_node_find_by_name()
724 swnode = NULL; in software_node_find_by_name()
729 return swnode ? swnode->node : NULL; in software_node_find_by_name()
761 struct swnode *swnode = kobj_to_swnode(kobj); in software_node_release() local
763 if (swnode->parent) { in software_node_release()
764 ida_free(&swnode->parent->child_ids, swnode->id); in software_node_release()
765 list_del(&swnode->entry); in software_node_release()
767 ida_free(&swnode_root_ids, swnode->id); in software_node_release()
770 if (swnode->allocated) in software_node_release()
771 software_node_free(swnode->node); in software_node_release()
773 ida_destroy(&swnode->child_ids); in software_node_release()
774 kfree(swnode); in software_node_release()
783 swnode_register(const struct software_node *node, struct swnode *parent, in swnode_register()
786 struct swnode *swnode; in swnode_register() local
789 swnode = kzalloc(sizeof(*swnode), GFP_KERNEL); in swnode_register()
790 if (!swnode) in swnode_register()
796 kfree(swnode); in swnode_register()
800 swnode->id = ret; in swnode_register()
801 swnode->node = node; in swnode_register()
802 swnode->parent = parent; in swnode_register()
803 swnode->kobj.kset = swnode_kset; in swnode_register()
804 fwnode_init(&swnode->fwnode, &software_node_ops); in swnode_register()
806 ida_init(&swnode->child_ids); in swnode_register()
807 INIT_LIST_HEAD(&swnode->entry); in swnode_register()
808 INIT_LIST_HEAD(&swnode->children); in swnode_register()
811 ret = kobject_init_and_add(&swnode->kobj, &software_node_type, in swnode_register()
815 ret = kobject_init_and_add(&swnode->kobj, &software_node_type, in swnode_register()
817 "node%d", swnode->id); in swnode_register()
819 kobject_put(&swnode->kobj); in swnode_register()
827 swnode->allocated = allocated; in swnode_register()
830 list_add_tail(&swnode->entry, &parent->children); in swnode_register()
832 kobject_uevent(&swnode->kobj, KOBJ_ADD); in swnode_register()
833 return &swnode->fwnode; in swnode_register()
901 struct swnode *parent = software_node_to_swnode(node->parent); in software_node_register()
919 struct swnode *swnode; in software_node_unregister() local
921 swnode = software_node_to_swnode(node); in software_node_unregister()
922 if (swnode) in software_node_unregister()
923 fwnode_remove_software_node(&swnode->fwnode); in software_node_unregister()
933 struct swnode *p; in fwnode_create_software_node()
958 struct swnode *swnode = to_swnode(fwnode); in fwnode_remove_software_node() local
960 if (!swnode) in fwnode_remove_software_node()
963 kobject_put(&swnode->kobj); in fwnode_remove_software_node()
978 struct swnode *swnode; in device_add_software_node() local
985 swnode = software_node_to_swnode(node); in device_add_software_node()
986 if (swnode) { in device_add_software_node()
987 kobject_get(&swnode->kobj); in device_add_software_node()
993 swnode = software_node_to_swnode(node); in device_add_software_node()
996 set_secondary_fwnode(dev, &swnode->fwnode); in device_add_software_node()
1019 struct swnode *swnode; in device_remove_software_node() local
1021 swnode = dev_to_swnode(dev); in device_remove_software_node()
1022 if (!swnode) in device_remove_software_node()
1029 kobject_put(&swnode->kobj); in device_remove_software_node()
1075 struct swnode *swnode; in software_node_notify() local
1078 swnode = dev_to_swnode(dev); in software_node_notify()
1079 if (!swnode) in software_node_notify()
1082 ret = sysfs_create_link(&dev->kobj, &swnode->kobj, "software_node"); in software_node_notify()
1086 ret = sysfs_create_link(&swnode->kobj, &dev->kobj, dev_name(dev)); in software_node_notify()
1092 kobject_get(&swnode->kobj); in software_node_notify()
1097 struct swnode *swnode; in software_node_notify_remove() local
1099 swnode = dev_to_swnode(dev); in software_node_notify_remove()
1100 if (!swnode) in software_node_notify_remove()
1103 sysfs_remove_link(&swnode->kobj, dev_name(dev)); in software_node_notify_remove()
1105 kobject_put(&swnode->kobj); in software_node_notify_remove()
1107 if (swnode->managed) { in software_node_notify_remove()
1109 kobject_put(&swnode->kobj); in software_node_notify_remove()