Lines Matching refs:device_state
1245 counter->device_state->groups_list = groups_list; in counter_device_groups_list_prepare()
1246 counter->device_state->num_groups = num_groups; in counter_device_groups_list_prepare()
1256 struct counter_device_state *const device_state) in counter_device_groups_prepare() argument
1264 device_state->groups = kcalloc(device_state->num_groups + 1, in counter_device_groups_prepare()
1265 sizeof(*device_state->groups), in counter_device_groups_prepare()
1267 if (!device_state->groups) in counter_device_groups_prepare()
1271 for (i = 0; i < device_state->num_groups; i++) { in counter_device_groups_prepare()
1272 group = device_state->groups_list + i; in counter_device_groups_prepare()
1288 device_state->groups[i] = &group->attr_group; in counter_device_groups_prepare()
1291 device_state->dev.groups = device_state->groups; in counter_device_groups_prepare()
1297 group = device_state->groups_list + i; in counter_device_groups_prepare()
1301 kfree(device_state->groups); in counter_device_groups_prepare()
1311 struct counter_device_state *const device_state = counter->device_state; in counter_device_release() local
1313 kfree(device_state->groups); in counter_device_release()
1314 counter_device_groups_list_free(device_state->groups_list, in counter_device_release()
1315 device_state->num_groups); in counter_device_release()
1316 ida_simple_remove(&counter_ida, device_state->id); in counter_device_release()
1317 kfree(device_state); in counter_device_release()
1339 struct counter_device_state *device_state; in counter_register() local
1343 device_state = kzalloc(sizeof(*device_state), GFP_KERNEL); in counter_register()
1344 if (!device_state) in counter_register()
1346 counter->device_state = device_state; in counter_register()
1349 device_state->id = ida_simple_get(&counter_ida, 0, 0, GFP_KERNEL); in counter_register()
1350 if (device_state->id < 0) { in counter_register()
1351 err = device_state->id; in counter_register()
1356 device_state->dev.type = &counter_device_type; in counter_register()
1357 device_state->dev.bus = &counter_bus_type; in counter_register()
1359 device_state->dev.parent = counter->parent; in counter_register()
1360 device_state->dev.of_node = counter->parent->of_node; in counter_register()
1362 dev_set_name(&device_state->dev, "counter%d", device_state->id); in counter_register()
1363 device_initialize(&device_state->dev); in counter_register()
1364 dev_set_drvdata(&device_state->dev, counter); in counter_register()
1372 err = counter_device_groups_prepare(device_state); in counter_register()
1377 err = device_add(&device_state->dev); in counter_register()
1384 kfree(device_state->groups); in counter_register()
1386 counter_device_groups_list_free(device_state->groups_list, in counter_register()
1387 device_state->num_groups); in counter_register()
1389 ida_simple_remove(&counter_ida, device_state->id); in counter_register()
1391 kfree(device_state); in counter_register()
1405 device_del(&counter->device_state->dev); in counter_unregister()