Lines Matching refs:th
252 intel_th_device_alloc(struct intel_th *th, unsigned int type, const char *name, in intel_th_device_alloc() argument
259 parent = th->dev; in intel_th_device_alloc()
261 parent = &th->hub->dev; in intel_th_device_alloc()
279 dev_set_name(&thdev->dev, "%d-%s%d", th->id, name, id); in intel_th_device_alloc()
281 dev_set_name(&thdev->dev, "%d-%s", th->id, name); in intel_th_device_alloc()
422 static int intel_th_populate(struct intel_th *th, struct resource *devres, in intel_th_populate() argument
435 thdev = intel_th_device_alloc(th, subdev->type, subdev->name, in intel_th_populate()
463 dev_dbg(th->dev, "%s:%d @ %pR\n", in intel_th_populate()
477 thdev->dev.devt = MKDEV(th->major, i); in intel_th_populate()
490 th->hub = thdev; in intel_th_populate()
496 th->thdev[i] = thdev; in intel_th_populate()
503 intel_th_device_remove(th->thdev[i]); in intel_th_populate()
561 struct intel_th *th; in intel_th_alloc() local
564 th = kzalloc(sizeof(*th), GFP_KERNEL); in intel_th_alloc()
565 if (!th) in intel_th_alloc()
568 th->id = ida_simple_get(&intel_th_ida, 0, 0, GFP_KERNEL); in intel_th_alloc()
569 if (th->id < 0) { in intel_th_alloc()
570 err = th->id; in intel_th_alloc()
574 th->major = __register_chrdev(0, 0, TH_POSSIBLE_OUTPUTS, in intel_th_alloc()
576 if (th->major < 0) { in intel_th_alloc()
577 err = th->major; in intel_th_alloc()
580 th->dev = dev; in intel_th_alloc()
582 err = intel_th_populate(th, devres, ndevres, irq); in intel_th_alloc()
586 return th; in intel_th_alloc()
589 __unregister_chrdev(th->major, 0, TH_POSSIBLE_OUTPUTS, in intel_th_alloc()
593 ida_simple_remove(&intel_th_ida, th->id); in intel_th_alloc()
596 kfree(th); in intel_th_alloc()
602 void intel_th_free(struct intel_th *th) in intel_th_free() argument
607 if (th->thdev[i] != th->hub) in intel_th_free()
608 intel_th_device_remove(th->thdev[i]); in intel_th_free()
610 intel_th_device_remove(th->hub); in intel_th_free()
612 __unregister_chrdev(th->major, 0, TH_POSSIBLE_OUTPUTS, in intel_th_free()
615 ida_simple_remove(&intel_th_ida, th->id); in intel_th_free()
617 kfree(th); in intel_th_free()