diff --git a/include/linux/device.h b/include/linux/device.h
index 161d96241b1b4da3b9a0909749709a33bcca33c5..5c4495c8fe3facdf11a03d6cea379236e146f108 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -689,6 +689,11 @@ struct device {
 	void	(*release)(struct device *dev);
 };
 
+static inline struct device *kobj_to_dev(struct kobject *kobj)
+{
+	return container_of(kobj, struct device, kobj);
+}
+
 /* Get the wakeup routines, which depend on struct device */
 #include <linux/pm_wakeup.h>
 
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 017a7fb5a1fcb7ea3a2e9e5e3d2116be6bf26922..ae0aaa9d42faacf9d250ae509a93947fc1d06424 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -16,7 +16,6 @@
 
 #ifdef CONFIG_BLOCK
 
-#define kobj_to_dev(k)		container_of((k), struct device, kobj)
 #define dev_to_disk(device)	container_of((device), struct gendisk, part0.__dev)
 #define dev_to_part(device)	container_of((device), struct hd_struct, __dev)
 #define disk_to_dev(disk)	(&(disk)->part0.__dev)