Lines Matching refs:memory
658 static int __add_memory_block(struct memory_block *memory) in __add_memory_block() argument
662 memory->dev.bus = &memory_subsys; in __add_memory_block()
663 memory->dev.id = memory->start_section_nr / sections_per_block; in __add_memory_block()
664 memory->dev.release = memory_block_release; in __add_memory_block()
665 memory->dev.groups = memory_memblk_attr_groups; in __add_memory_block()
666 memory->dev.offline = memory->state == MEM_OFFLINE; in __add_memory_block()
668 ret = device_register(&memory->dev); in __add_memory_block()
670 put_device(&memory->dev); in __add_memory_block()
673 ret = xa_err(xa_store(&memory_blocks, memory->dev.id, memory, in __add_memory_block()
676 device_unregister(&memory->dev); in __add_memory_block()
825 static void remove_memory_block(struct memory_block *memory) in remove_memory_block() argument
827 if (WARN_ON_ONCE(memory->dev.bus != &memory_subsys)) in remove_memory_block()
830 WARN_ON(xa_erase(&memory_blocks, memory->dev.id) == NULL); in remove_memory_block()
832 if (memory->group) { in remove_memory_block()
833 list_del(&memory->group_next); in remove_memory_block()
834 memory->group = NULL; in remove_memory_block()
838 put_device(&memory->dev); in remove_memory_block()
839 device_unregister(&memory->dev); in remove_memory_block()