backports: add kobj_to_dev()
authorJohannes Berg <johannes.berg@intel.com>
Tue, 21 Oct 2014 11:15:07 +0000 (13:15 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 25 Oct 2014 11:36:33 +0000 (13:36 +0200)
This will be needed by the devcoredump backport.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
backport/backport-include/linux/device.h

index 830105df33fdb44a01fd0bb0df7865cf99b6d90e..41f06c39d48743f3ea7874e7afabf2ca79995a0e 100644 (file)
@@ -110,6 +110,12 @@ backport_device_release_driver(struct device *dev)
        device_unlock(dev);
 }
 #define device_release_driver LINUX_BACKPORT(device_release_driver)
+
+#define kobj_to_dev LINUX_BACKPORT(kobj_to_dev)
+static inline struct device *kobj_to_dev(struct kobject *kobj)
+{
+       return container_of(kobj, struct device, kobj);
+}
 #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0) */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)