diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-08-07 11:40:09 +0200 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2013-08-12 19:51:44 -0700 |
commit | f3194b4f935ab2691511c04084fa69ef19a12e4d (patch) | |
tree | bc17db84ce8adf765c7bfc8d7fda0487db9b8c79 | |
parent | 521609b14db694e898695f29eb1b36b386efba9a (diff) |
backports: fix device_release_driver
Upstream commit 38dbdde48f135c6b8fd1524eacf79041c7b5899a
The new macro, introduced by
commit 9f5876fa9cfb8cd6f450c200043ca7e31915f976
Author: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Date: Thu Jul 18 16:40:55 2013 -0700
backports: backport drvdata = NULL core driver fixes
evaluates its argument multiple times, causing crashes as
there are potential side-effects of the called code and/or
the arguments.
Fix this by converting it to static inlines.
Also remove the driver_probe_device() macro that has the
same issue, but tries to wrap a function that isn't even
available outside the driver core code in any kernel.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r-- | backport/backport-include/linux/device.h | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h index ba55d0ec..909a534c 100644 --- a/backport/backport-include/linux/device.h +++ b/backport/backport-include/linux/device.h @@ -177,22 +177,15 @@ extern int dev_set_name(struct device *dev, const char *name, ...) #endif #if LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0) -#define driver_probe_device(__drv, __dev) \ -({ \ - int ret; \ - ret = (driver_probe_device)(__drv, __dev); \ - if (ret) \ - dev_set_drvdata(__dev, NULL); \ - return ret; \ -}) - -#define device_release_driver(__dev) \ -({ \ - (device_release_driver)(__dev); \ - device_lock(__dev); \ - dev_set_drvdata(__dev, NULL); \ - device_unlock(__dev); \ -}) +static inline void +backport_device_release_driver(struct device *dev) +{ + device_release_driver(dev); + device_lock(dev); + dev_set_drvdata(dev, NULL); + device_unlock(dev); +} +#define device_release_driver LINUX_BACKPORT(device_release_driver) #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0) */ #endif /* __BACKPORT_DEVICE_H */ |