Lines Matching refs:device_state
1316 counter->device_state->groups_list = groups_list; in counter_device_groups_list_prepare()
1317 counter->device_state->num_groups = num_groups; in counter_device_groups_list_prepare()
1327 struct counter_device_state *const device_state) in counter_device_groups_prepare() argument
1335 device_state->groups = kcalloc(device_state->num_groups + 1, in counter_device_groups_prepare()
1336 sizeof(*device_state->groups), in counter_device_groups_prepare()
1338 if (!device_state->groups) in counter_device_groups_prepare()
1342 for (i = 0; i < device_state->num_groups; i++) { in counter_device_groups_prepare()
1343 group = device_state->groups_list + i; in counter_device_groups_prepare()
1359 device_state->groups[i] = &group->attr_group; in counter_device_groups_prepare()
1362 device_state->dev.groups = device_state->groups; in counter_device_groups_prepare()
1368 group = device_state->groups_list + i; in counter_device_groups_prepare()
1372 kfree(device_state->groups); in counter_device_groups_prepare()
1382 struct counter_device_state *const device_state = counter->device_state; in counter_device_release() local
1384 kfree(device_state->groups); in counter_device_release()
1385 counter_device_groups_list_free(device_state->groups_list, in counter_device_release()
1386 device_state->num_groups); in counter_device_release()
1387 ida_simple_remove(&counter_ida, device_state->id); in counter_device_release()
1388 kfree(device_state); in counter_device_release()
1410 struct counter_device_state *device_state; in counter_register() local
1414 device_state = kzalloc(sizeof(*device_state), GFP_KERNEL); in counter_register()
1415 if (!device_state) in counter_register()
1417 counter->device_state = device_state; in counter_register()
1420 device_state->id = ida_simple_get(&counter_ida, 0, 0, GFP_KERNEL); in counter_register()
1421 if (device_state->id < 0) { in counter_register()
1422 err = device_state->id; in counter_register()
1427 device_state->dev.type = &counter_device_type; in counter_register()
1428 device_state->dev.bus = &counter_bus_type; in counter_register()
1430 device_state->dev.parent = counter->parent; in counter_register()
1431 device_state->dev.of_node = counter->parent->of_node; in counter_register()
1433 dev_set_name(&device_state->dev, "counter%d", device_state->id); in counter_register()
1434 device_initialize(&device_state->dev); in counter_register()
1435 dev_set_drvdata(&device_state->dev, counter); in counter_register()
1443 err = counter_device_groups_prepare(device_state); in counter_register()
1448 err = device_add(&device_state->dev); in counter_register()
1455 kfree(device_state->groups); in counter_register()
1457 counter_device_groups_list_free(device_state->groups_list, in counter_register()
1458 device_state->num_groups); in counter_register()
1460 ida_simple_remove(&counter_ida, device_state->id); in counter_register()
1462 kfree(device_state); in counter_register()
1476 device_del(&counter->device_state->dev); in counter_unregister()