driver-core: Move kobj_to_dev from genhd.h to device.h
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 3 Jul 2012 16:49:35 +0000 (18:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jul 2012 01:05:45 +0000 (18:05 -0700)
commita4232963757e62b3b97bbba07cb92c6d448f6f4b
treebf91e17c13821f4463fbae1dc04be0b5e4f9fe7d
parent8153584e3fdf78753bf653d5f583b6ecb86e5e70
driver-core: Move kobj_to_dev from genhd.h to device.h

This function is not really specific to the genhd layer and there are various
re-implementations or open-coded variants of it all throughout the kernel. To
avoid further duplications move the function to a more generic place.

While moving also convert it from a macro to a inline function.

Potential users of this function can be detected and converted using the
following coccinelle patch:

// <smpl>
@@
expression k;
@@
-container_of(k, struct device, kobj)
+kobj_to_dev(kobj)
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/device.h
include/linux/genhd.h