Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df2b717c authored by Seth Jennings's avatar Seth Jennings Committed by Greg Kroah-Hartman
Browse files

drivers: base: use device get/put functions



Use the [get|put]_device functions for ref'ing the memory block device
rather than the kobject functions which should be hidden away by the
device layer.

Signed-off-by: default avatarSeth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 879f1bec
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -616,14 +616,14 @@ static int add_memory_section(int nid, struct mem_section *section,
			if (scn_nr >= (*mem_p)->start_section_nr &&
			if (scn_nr >= (*mem_p)->start_section_nr &&
			    scn_nr <= (*mem_p)->end_section_nr) {
			    scn_nr <= (*mem_p)->end_section_nr) {
				mem = *mem_p;
				mem = *mem_p;
				kobject_get(&mem->dev.kobj);
				get_device(&mem->dev);
			}
			}
	} else
	} else
		mem = find_memory_block(section);
		mem = find_memory_block(section);


	if (mem) {
	if (mem) {
		mem->section_count++;
		mem->section_count++;
		kobject_put(&mem->dev.kobj);
		put_device(&mem->dev);
	} else {
	} else {
		ret = init_memory_block(&mem, section, state);
		ret = init_memory_block(&mem, section, state);
		/* store memory_block pointer for next loop */
		/* store memory_block pointer for next loop */
@@ -663,7 +663,7 @@ unregister_memory(struct memory_block *memory)
	BUG_ON(memory->dev.bus != &memory_subsys);
	BUG_ON(memory->dev.bus != &memory_subsys);


	/* drop the ref. we got in remove_memory_block() */
	/* drop the ref. we got in remove_memory_block() */
	kobject_put(&memory->dev.kobj);
	put_device(&memory->dev);
	device_unregister(&memory->dev);
	device_unregister(&memory->dev);
}
}


@@ -680,7 +680,7 @@ static int remove_memory_block(unsigned long node_id,
	if (mem->section_count == 0)
	if (mem->section_count == 0)
		unregister_memory(mem);
		unregister_memory(mem);
	else
	else
		kobject_put(&mem->dev.kobj);
		put_device(&mem->dev);


	mutex_unlock(&mem_sysfs_mutex);
	mutex_unlock(&mem_sysfs_mutex);
	return 0;
	return 0;