Lines Matching refs:svc
710 struct tb_service *svc = container_of(dev, struct tb_service, dev); in key_show() local
716 return sprintf(buf, "%*pE\n", (int)strlen(svc->key), svc->key); in key_show()
720 static int get_modalias(struct tb_service *svc, char *buf, size_t size) in get_modalias() argument
722 return snprintf(buf, size, "tbsvc:k%sp%08Xv%08Xr%08X", svc->key, in get_modalias()
723 svc->prtcid, svc->prtcvers, svc->prtcrevs); in get_modalias()
729 struct tb_service *svc = container_of(dev, struct tb_service, dev); in modalias_show() local
732 get_modalias(svc, buf, PAGE_SIZE - 2); in modalias_show()
740 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcid_show() local
742 return sprintf(buf, "%u\n", svc->prtcid); in prtcid_show()
749 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcvers_show() local
751 return sprintf(buf, "%u\n", svc->prtcvers); in prtcvers_show()
758 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcrevs_show() local
760 return sprintf(buf, "%u\n", svc->prtcrevs); in prtcrevs_show()
767 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcstns_show() local
769 return sprintf(buf, "0x%08x\n", svc->prtcstns); in prtcstns_show()
794 struct tb_service *svc = container_of(dev, struct tb_service, dev); in tb_service_uevent() local
797 get_modalias(svc, modalias, sizeof(modalias)); in tb_service_uevent()
803 struct tb_service *svc = container_of(dev, struct tb_service, dev); in tb_service_release() local
804 struct tb_xdomain *xd = tb_service_parent(svc); in tb_service_release()
806 tb_service_debugfs_remove(svc); in tb_service_release()
807 ida_simple_remove(&xd->service_ids, svc->id); in tb_service_release()
808 kfree(svc->key); in tb_service_release()
809 kfree(svc); in tb_service_release()
823 struct tb_service *svc; in remove_missing_service() local
825 svc = tb_to_service(dev); in remove_missing_service()
826 if (!svc) in remove_missing_service()
829 if (!tb_property_find(xd->remote_properties, svc->key, in remove_missing_service()
839 struct tb_service *svc; in find_service() local
841 svc = tb_to_service(dev); in find_service()
842 if (!svc) in find_service()
845 return !strcmp(svc->key, p->key); in find_service()
848 static int populate_service(struct tb_service *svc, in populate_service() argument
857 svc->prtcid = p->value.immediate; in populate_service()
860 svc->prtcvers = p->value.immediate; in populate_service()
863 svc->prtcrevs = p->value.immediate; in populate_service()
866 svc->prtcstns = p->value.immediate; in populate_service()
868 svc->key = kstrdup(property->key, GFP_KERNEL); in populate_service()
869 if (!svc->key) in populate_service()
877 struct tb_service *svc; in enumerate_services() local
900 svc = kzalloc(sizeof(*svc), GFP_KERNEL); in enumerate_services()
901 if (!svc) in enumerate_services()
904 if (populate_service(svc, p)) { in enumerate_services()
905 kfree(svc); in enumerate_services()
911 kfree(svc->key); in enumerate_services()
912 kfree(svc); in enumerate_services()
915 svc->id = id; in enumerate_services()
916 svc->dev.bus = &tb_bus_type; in enumerate_services()
917 svc->dev.type = &tb_service_type; in enumerate_services()
918 svc->dev.parent = &xd->dev; in enumerate_services()
919 dev_set_name(&svc->dev, "%s.%d", dev_name(&xd->dev), svc->id); in enumerate_services()
921 tb_service_debugfs_init(svc); in enumerate_services()
923 if (device_register(&svc->dev)) { in enumerate_services()
924 put_device(&svc->dev); in enumerate_services()