Lines Matching refs:mem

82 	struct memory_block *mem = to_memory_block(dev);  in memory_block_release()  local
84 kfree(mem); in memory_block_release()
115 struct memory_block *mem = to_memory_block(dev); in show_mem_start_phys_index() local
118 phys_index = mem->start_section_nr / sections_per_block; in show_mem_start_phys_index()
130 struct memory_block *mem = to_memory_block(dev); in show_mem_removable() local
132 if (mem->state != MEM_ONLINE) in show_mem_removable()
136 if (!present_section_nr(mem->start_section_nr + i)) in show_mem_removable()
138 pfn = section_nr_to_pfn(mem->start_section_nr + i); in show_mem_removable()
152 struct memory_block *mem = to_memory_block(dev); in show_mem_state() local
159 switch (mem->state) { in show_mem_state()
171 mem->state); in show_mem_state()
261 static int memory_block_change_state(struct memory_block *mem, in memory_block_change_state() argument
266 if (mem->state != from_state_req) in memory_block_change_state()
270 mem->state = MEM_GOING_OFFLINE; in memory_block_change_state()
272 ret = memory_block_action(mem->start_section_nr, to_state, in memory_block_change_state()
273 mem->online_type); in memory_block_change_state()
275 mem->state = ret ? from_state_req : to_state; in memory_block_change_state()
283 struct memory_block *mem = to_memory_block(dev); in memory_subsys_online() local
286 if (mem->state == MEM_ONLINE) in memory_subsys_online()
294 if (mem->online_type < 0) in memory_subsys_online()
295 mem->online_type = MMOP_ONLINE_KEEP; in memory_subsys_online()
298 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); in memory_subsys_online()
301 mem->online_type = -1; in memory_subsys_online()
308 struct memory_block *mem = to_memory_block(dev); in memory_subsys_offline() local
310 if (mem->state == MEM_OFFLINE) in memory_subsys_offline()
314 if (mem->section_count != sections_per_block) in memory_subsys_offline()
317 return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE); in memory_subsys_offline()
324 struct memory_block *mem = to_memory_block(dev); in store_mem_state() local
357 mem->online_type = online_type; in store_mem_state()
358 ret = device_online(&mem->dev); in store_mem_state()
361 ret = device_offline(&mem->dev); in store_mem_state()
391 struct memory_block *mem = to_memory_block(dev); in show_phys_device() local
392 return sprintf(buf, "%d\n", mem->phys_device); in show_phys_device()
412 struct memory_block *mem = to_memory_block(dev); in show_valid_zones() local
413 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in show_valid_zones()
423 if (mem->state == MEM_ONLINE) { in show_valid_zones()
436 nid = mem->nid; in show_valid_zones()
668 struct memory_block *mem; in init_memory_block() local
673 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in init_memory_block()
674 if (!mem) in init_memory_block()
678 mem->start_section_nr = in init_memory_block()
680 mem->end_section_nr = mem->start_section_nr + sections_per_block - 1; in init_memory_block()
681 mem->state = state; in init_memory_block()
682 start_pfn = section_nr_to_pfn(mem->start_section_nr); in init_memory_block()
683 mem->phys_device = arch_get_memory_phys_device(start_pfn); in init_memory_block()
685 ret = register_memory(mem); in init_memory_block()
687 *memory = mem; in init_memory_block()
693 struct memory_block *mem; in add_memory_block() local
708 ret = init_memory_block(&mem, __nr_to_section(section_nr), MEM_ONLINE); in add_memory_block()
711 mem->section_count = section_count; in add_memory_block()
722 struct memory_block *mem; in hotplug_memory_register() local
726 mem = find_memory_block(section); in hotplug_memory_register()
727 if (mem) { in hotplug_memory_register()
728 mem->section_count++; in hotplug_memory_register()
729 put_device(&mem->dev); in hotplug_memory_register()
731 ret = init_memory_block(&mem, section, MEM_OFFLINE); in hotplug_memory_register()
734 mem->section_count++; in hotplug_memory_register()
756 struct memory_block *mem; in remove_memory_section() local
764 mem = find_memory_block(section); in remove_memory_section()
765 if (!mem) in remove_memory_section()
768 unregister_mem_sect_under_nodes(mem, __section_nr(section)); in remove_memory_section()
770 mem->section_count--; in remove_memory_section()
771 if (mem->section_count == 0) in remove_memory_section()
772 unregister_memory(mem); in remove_memory_section()
774 put_device(&mem->dev); in remove_memory_section()
791 bool is_memblock_offlined(struct memory_block *mem) in is_memblock_offlined() argument
793 return mem->state == MEM_OFFLINE; in is_memblock_offlined()