Lines Matching refs:mem
81 struct memory_block *mem = to_memory_block(dev); in memory_block_release() local
83 kfree(mem); in memory_block_release()
114 struct memory_block *mem = to_memory_block(dev); in show_mem_start_phys_index() local
117 phys_index = mem->start_section_nr / sections_per_block; in show_mem_start_phys_index()
129 struct memory_block *mem = to_memory_block(dev); in show_mem_removable() local
132 if (!present_section_nr(mem->start_section_nr + i)) in show_mem_removable()
134 pfn = section_nr_to_pfn(mem->start_section_nr + i); in show_mem_removable()
147 struct memory_block *mem = to_memory_block(dev); in show_mem_state() local
154 switch (mem->state) { in show_mem_state()
166 mem->state); in show_mem_state()
254 static int memory_block_change_state(struct memory_block *mem, in memory_block_change_state() argument
259 if (mem->state != from_state_req) in memory_block_change_state()
263 mem->state = MEM_GOING_OFFLINE; in memory_block_change_state()
265 ret = memory_block_action(mem->start_section_nr, to_state, in memory_block_change_state()
266 mem->online_type); in memory_block_change_state()
268 mem->state = ret ? from_state_req : to_state; in memory_block_change_state()
276 struct memory_block *mem = to_memory_block(dev); in memory_subsys_online() local
279 if (mem->state == MEM_ONLINE) in memory_subsys_online()
287 if (mem->online_type < 0) in memory_subsys_online()
288 mem->online_type = MMOP_ONLINE_KEEP; in memory_subsys_online()
291 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); in memory_subsys_online()
294 mem->online_type = -1; in memory_subsys_online()
301 struct memory_block *mem = to_memory_block(dev); in memory_subsys_offline() local
303 if (mem->state == MEM_OFFLINE) in memory_subsys_offline()
307 if (mem->section_count != sections_per_block) in memory_subsys_offline()
310 return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE); in memory_subsys_offline()
317 struct memory_block *mem = to_memory_block(dev); in store_mem_state() local
350 mem->online_type = online_type; in store_mem_state()
351 ret = device_online(&mem->dev); in store_mem_state()
354 ret = device_offline(&mem->dev); in store_mem_state()
381 struct memory_block *mem = to_memory_block(dev); in show_phys_device() local
382 return sprintf(buf, "%d\n", mem->phys_device); in show_phys_device()
389 struct memory_block *mem = to_memory_block(dev); in show_valid_zones() local
395 start_pfn = section_nr_to_pfn(mem->start_section_nr); in show_valid_zones()
607 struct memory_block *mem; in init_memory_block() local
612 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in init_memory_block()
613 if (!mem) in init_memory_block()
617 mem->start_section_nr = in init_memory_block()
619 mem->end_section_nr = mem->start_section_nr + sections_per_block - 1; in init_memory_block()
620 mem->state = state; in init_memory_block()
621 mem->section_count++; in init_memory_block()
622 start_pfn = section_nr_to_pfn(mem->start_section_nr); in init_memory_block()
623 mem->phys_device = arch_get_memory_phys_device(start_pfn); in init_memory_block()
625 ret = register_memory(mem); in init_memory_block()
627 *memory = mem; in init_memory_block()
633 struct memory_block *mem; in add_memory_block() local
648 ret = init_memory_block(&mem, __nr_to_section(section_nr), MEM_ONLINE); in add_memory_block()
651 mem->section_count = section_count; in add_memory_block()
663 struct memory_block *mem; in register_new_memory() local
667 mem = find_memory_block(section); in register_new_memory()
668 if (mem) { in register_new_memory()
669 mem->section_count++; in register_new_memory()
670 put_device(&mem->dev); in register_new_memory()
672 ret = init_memory_block(&mem, section, MEM_OFFLINE); in register_new_memory()
677 if (mem->section_count == sections_per_block) in register_new_memory()
678 ret = register_mem_sect_under_node(mem, nid); in register_new_memory()
698 struct memory_block *mem; in remove_memory_block() local
701 mem = find_memory_block(section); in remove_memory_block()
702 unregister_mem_sect_under_nodes(mem, __section_nr(section)); in remove_memory_block()
704 mem->section_count--; in remove_memory_block()
705 if (mem->section_count == 0) in remove_memory_block()
706 unregister_memory(mem); in remove_memory_block()
708 put_device(&mem->dev); in remove_memory_block()
724 bool is_memblock_offlined(struct memory_block *mem) in is_memblock_offlined() argument
726 return mem->state == MEM_OFFLINE; in is_memblock_offlined()