Lines Matching refs:svc

577 	struct tb_service *svc = container_of(dev, struct tb_service, dev);  in key_show()  local
583 return sprintf(buf, "%*pEp\n", (int)strlen(svc->key), svc->key); in key_show()
587 static int get_modalias(struct tb_service *svc, char *buf, size_t size) in get_modalias() argument
589 return snprintf(buf, size, "tbsvc:k%sp%08Xv%08Xr%08X", svc->key, in get_modalias()
590 svc->prtcid, svc->prtcvers, svc->prtcrevs); in get_modalias()
596 struct tb_service *svc = container_of(dev, struct tb_service, dev); in modalias_show() local
599 get_modalias(svc, buf, PAGE_SIZE - 2); in modalias_show()
607 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcid_show() local
609 return sprintf(buf, "%u\n", svc->prtcid); in prtcid_show()
616 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcvers_show() local
618 return sprintf(buf, "%u\n", svc->prtcvers); in prtcvers_show()
625 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcrevs_show() local
627 return sprintf(buf, "%u\n", svc->prtcrevs); in prtcrevs_show()
634 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcstns_show() local
636 return sprintf(buf, "0x%08x\n", svc->prtcstns); in prtcstns_show()
661 struct tb_service *svc = container_of(dev, struct tb_service, dev); in tb_service_uevent() local
664 get_modalias(svc, modalias, sizeof(modalias)); in tb_service_uevent()
670 struct tb_service *svc = container_of(dev, struct tb_service, dev); in tb_service_release() local
671 struct tb_xdomain *xd = tb_service_parent(svc); in tb_service_release()
673 ida_simple_remove(&xd->service_ids, svc->id); in tb_service_release()
674 kfree(svc->key); in tb_service_release()
675 kfree(svc); in tb_service_release()
689 struct tb_service *svc; in remove_missing_service() local
691 svc = tb_to_service(dev); in remove_missing_service()
692 if (!svc) in remove_missing_service()
695 if (!tb_property_find(xd->properties, svc->key, in remove_missing_service()
705 struct tb_service *svc; in find_service() local
707 svc = tb_to_service(dev); in find_service()
708 if (!svc) in find_service()
711 return !strcmp(svc->key, p->key); in find_service()
714 static int populate_service(struct tb_service *svc, in populate_service() argument
723 svc->prtcid = p->value.immediate; in populate_service()
726 svc->prtcvers = p->value.immediate; in populate_service()
729 svc->prtcrevs = p->value.immediate; in populate_service()
732 svc->prtcstns = p->value.immediate; in populate_service()
734 svc->key = kstrdup(property->key, GFP_KERNEL); in populate_service()
735 if (!svc->key) in populate_service()
743 struct tb_service *svc; in enumerate_services() local
766 svc = kzalloc(sizeof(*svc), GFP_KERNEL); in enumerate_services()
767 if (!svc) in enumerate_services()
770 if (populate_service(svc, p)) { in enumerate_services()
771 kfree(svc); in enumerate_services()
777 kfree(svc->key); in enumerate_services()
778 kfree(svc); in enumerate_services()
781 svc->id = id; in enumerate_services()
782 svc->dev.bus = &tb_bus_type; in enumerate_services()
783 svc->dev.type = &tb_service_type; in enumerate_services()
784 svc->dev.parent = &xd->dev; in enumerate_services()
785 dev_set_name(&svc->dev, "%s.%d", dev_name(&xd->dev), svc->id); in enumerate_services()
787 if (device_register(&svc->dev)) { in enumerate_services()
788 put_device(&svc->dev); in enumerate_services()