Lines Matching full:pr

262 static void scmi_powercap_unregister_all_zones(struct scmi_powercap_root *pr)  in scmi_powercap_unregister_all_zones()  argument
267 for (i = pr->num_zones - 1; i >= 0; i--) { in scmi_powercap_unregister_all_zones()
268 if (!list_empty(&pr->registered_zones[i])) { in scmi_powercap_unregister_all_zones()
271 list_for_each_entry(spz, &pr->registered_zones[i], node) in scmi_powercap_unregister_all_zones()
296 static int scmi_powercap_register_zone(struct scmi_powercap_root *pr, in scmi_powercap_register_zone() argument
314 list_move(&spz->node, &pr->registered_zones[spz->height]); in scmi_powercap_register_zone()
335 * @pr: A reference to the root powercap zones descriptors
367 struct scmi_powercap_root *pr) in scmi_zones_register() argument
373 zones_stack = kcalloc(pr->num_zones, sizeof(spz), GFP_KERNEL); in scmi_zones_register()
377 spz = list_first_entry_or_null(&pr->scmi_zones, in scmi_zones_register()
387 ret = scmi_powercap_register_zone(pr, spz, parent); in scmi_zones_register()
397 scmi_powercap_unregister_all_zones(pr); in scmi_zones_register()
405 spz = list_first_entry_or_null(&pr->scmi_zones, in scmi_zones_register()
421 struct scmi_powercap_root *pr; in scmi_powercap_probe() local
435 pr = devm_kzalloc(dev, sizeof(*pr), GFP_KERNEL); in scmi_powercap_probe()
436 if (!pr) in scmi_powercap_probe()
444 pr->num_zones = ret; in scmi_powercap_probe()
446 pr->spzones = devm_kcalloc(dev, pr->num_zones, in scmi_powercap_probe()
447 sizeof(*pr->spzones), GFP_KERNEL); in scmi_powercap_probe()
448 if (!pr->spzones) in scmi_powercap_probe()
452 pr->registered_zones = devm_kcalloc(dev, pr->num_zones, in scmi_powercap_probe()
453 sizeof(*pr->registered_zones), in scmi_powercap_probe()
455 if (!pr->registered_zones) in scmi_powercap_probe()
458 INIT_LIST_HEAD(&pr->scmi_zones); in scmi_powercap_probe()
460 for (i = 0, spz = pr->spzones; i < pr->num_zones; i++, spz++) { in scmi_powercap_probe()
470 spz->spzones = pr->spzones; in scmi_powercap_probe()
472 INIT_LIST_HEAD(&pr->registered_zones[i]); in scmi_powercap_probe()
474 list_add_tail(&spz->node, &pr->scmi_zones); in scmi_powercap_probe()
494 ret = scmi_zones_register(dev, pr); in scmi_powercap_probe()
498 dev_set_drvdata(dev, pr); in scmi_powercap_probe()
506 struct scmi_powercap_root *pr = dev_get_drvdata(dev); in scmi_powercap_remove() local
508 scmi_powercap_unregister_all_zones(pr); in scmi_powercap_remove()