Lines Matching refs:svc

633 	struct tb_service *svc = container_of(dev, struct tb_service, dev);  in key_show()  local
639 return sprintf(buf, "%*pE\n", (int)strlen(svc->key), svc->key); in key_show()
643 static int get_modalias(struct tb_service *svc, char *buf, size_t size) in get_modalias() argument
645 return snprintf(buf, size, "tbsvc:k%sp%08Xv%08Xr%08X", svc->key, in get_modalias()
646 svc->prtcid, svc->prtcvers, svc->prtcrevs); in get_modalias()
652 struct tb_service *svc = container_of(dev, struct tb_service, dev); in modalias_show() local
655 get_modalias(svc, buf, PAGE_SIZE - 2); in modalias_show()
663 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcid_show() local
665 return sprintf(buf, "%u\n", svc->prtcid); in prtcid_show()
672 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcvers_show() local
674 return sprintf(buf, "%u\n", svc->prtcvers); in prtcvers_show()
681 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcrevs_show() local
683 return sprintf(buf, "%u\n", svc->prtcrevs); in prtcrevs_show()
690 struct tb_service *svc = container_of(dev, struct tb_service, dev); in prtcstns_show() local
692 return sprintf(buf, "0x%08x\n", svc->prtcstns); in prtcstns_show()
717 struct tb_service *svc = container_of(dev, struct tb_service, dev); in tb_service_uevent() local
720 get_modalias(svc, modalias, sizeof(modalias)); in tb_service_uevent()
726 struct tb_service *svc = container_of(dev, struct tb_service, dev); in tb_service_release() local
727 struct tb_xdomain *xd = tb_service_parent(svc); in tb_service_release()
729 ida_simple_remove(&xd->service_ids, svc->id); in tb_service_release()
730 kfree(svc->key); in tb_service_release()
731 kfree(svc); in tb_service_release()
745 struct tb_service *svc; in remove_missing_service() local
747 svc = tb_to_service(dev); in remove_missing_service()
748 if (!svc) in remove_missing_service()
751 if (!tb_property_find(xd->properties, svc->key, in remove_missing_service()
761 struct tb_service *svc; in find_service() local
763 svc = tb_to_service(dev); in find_service()
764 if (!svc) in find_service()
767 return !strcmp(svc->key, p->key); in find_service()
770 static int populate_service(struct tb_service *svc, in populate_service() argument
779 svc->prtcid = p->value.immediate; in populate_service()
782 svc->prtcvers = p->value.immediate; in populate_service()
785 svc->prtcrevs = p->value.immediate; in populate_service()
788 svc->prtcstns = p->value.immediate; in populate_service()
790 svc->key = kstrdup(property->key, GFP_KERNEL); in populate_service()
791 if (!svc->key) in populate_service()
799 struct tb_service *svc; in enumerate_services() local
822 svc = kzalloc(sizeof(*svc), GFP_KERNEL); in enumerate_services()
823 if (!svc) in enumerate_services()
826 if (populate_service(svc, p)) { in enumerate_services()
827 kfree(svc); in enumerate_services()
833 kfree(svc); in enumerate_services()
836 svc->id = id; in enumerate_services()
837 svc->dev.bus = &tb_bus_type; in enumerate_services()
838 svc->dev.type = &tb_service_type; in enumerate_services()
839 svc->dev.parent = &xd->dev; in enumerate_services()
840 dev_set_name(&svc->dev, "%s.%d", dev_name(&xd->dev), svc->id); in enumerate_services()
842 if (device_register(&svc->dev)) { in enumerate_services()
843 put_device(&svc->dev); in enumerate_services()