/* Note that phys_device is optional. It is here to allow for differentiation between which  */
static int add_memory_block(int nid, struct mem_section *section, unsigned long state, int phys_device, enum mem_add_context context)
/* Note that phys_device is optional. It is here to allow for differentiation between which  */
static int add_memory_block(int nid, struct mem_section *section, unsigned long state, int phys_device, enum mem_add_context context)
{
	struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL);
	int ret = 0;
	if (!mem)
		return -ENOMEM;
	mem->phys_index = __section_nr(section);
	mem->state = state;
	mutex_init(&mem->state_mutex);
	mem->phys_device = phys_device;
	ret = register_memory(mem, section);
	if (!ret)
		ret = mem_create_simple_file(mem, phys_index);
	if (!ret)
		ret = mem_create_simple_file(mem, state);
	if (!ret)
		ret = mem_create_simple_file(mem, phys_device);
	if (!ret)
		ret = mem_create_simple_file(mem, removable);
	if (!ret) {
		if (context == HOTPLUG)
			ret = register_mem_sect_under_node(mem, nid);
	}
	return ret;
}