From eb11882964ec477a02e8fb497e137555717651a7 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 21 Oct 2014 13:15:07 +0200 Subject: [PATCH] backports: add kobj_to_dev() This will be needed by the devcoredump backport. Signed-off-by: Johannes Berg Signed-off-by: Hauke Mehrtens --- backport/backport-include/linux/device.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h index 830105df33fd..41f06c39d487 100644 --- a/backport/backport-include/linux/device.h +++ b/backport/backport-include/linux/device.h @@ -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) -- 2.30.2