diff mbox

Compile error with Linux-3.4

Message ID CAJt7Dwx07xy6e2b=bNOzM-otW6tCz+F24XyTQGPMrFVQoXN+2Q@mail.gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Michael McElroy Dec. 4, 2017, 2:11 p.m. UTC
I have been following the thread on the genl-const.cocci parse error.
I  had the same problem and found the information very helpful. I had
been killing the gentree build because I thought it was hung applying
SmPL patch 0079-netdev-destructor.cocci. On my system, a 4 processor
Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz machine, that patch takes
about an hour and 20 minutes with the system at 100% for about an
hour. After reading your discussion, I stopped killing it and it ran
successfully.  I am backporting to 3.4 and ran into a couple of other
problems. There were 2  problems building the output against a 3.4
kernel. I wasn't sure that my kernel was the problem, so I built
against the 3.4 branch of linux-stable.

The first problem was caused by commit 8cdd85766293018fea01512959320a05269e97b4.

Author: Johannes Berg <johannes.berg@intel.com>
Date:   Fri Oct 13 10:48:42 2017 +0200

    backports: add netdev_upper_dev_link() extack argument

    But make it optional (using magic.h) to let this still work
    on kernels that didn't change the argument.

    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

In file included from /home/mike/linux-backport/compat/compat-3.8.c:18:
/home/mike/linux-backport/backport-include/linux/netdevice.h:341:
error: implicit declaration of function 'netdev_upper_dev_link'

/home/mike/linux-backport/backport-include/linux/netdevice.h: In
function '_bp_netdev_upper_dev_

+#if LINUX_VERSION_IS_LESS(4,14,0)
+static inline int _bp_netdev_upper_dev_link(struct net_device *dev,
+                                           struct net_device *upper_dev)
+{
+       return netdev_upper_dev_link(dev, upper_dev);
+}
+#define netdev_upper_dev_link3(dev, upper, extack) \
+       netdev_upper_dev_link(dev, upper)
+#define netdev_upper_dev_link2(dev, upper) \
+       netdev_upper_dev_link(dev, upper)
+#define netdev_upper_dev_link(...) \
+       macro_dispatcher(netdev_upper_dev_link, __VA_ARGS__)(__VA_ARGS__)
+#endif
+

I tried building against various kernels and didn't find
netdev_upper_dev_link' defined until 3, so anything less that that
probably has this error.  I didn't know exactly what to use here so I
just did an  #if 0 around that section and resolved the problem for
me.

The second problem is in commit 2ebca7b7d087be04e25b1fc50cf08137d423af3d.

Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Tue Apr 19 22:13:11 2016 +0300

    backport: add pm_runtime_active() implementation for < 3.9 kernels

    The pm_runtime_active() helper function was introduced in kernel 3.9.
    In order to use it in earlier kernels, we need to add its
    implementation to the backports.

    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    [add LINUX_BACKPORT() protection]
    Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>



/home/mike/linux-backport/backport-include/linux/pm_runtime.h: In
function 'backport_pm_runtime_active':
/home/mike/linux-backport/backport-include/linux/pm_runtime.h:10:
error: 'struct dev_pm_info' has no member named 'runtime_status'
/home/mike/linux-backport/backport-include/linux/pm_runtime.h:11:
error: 'struct dev_pm_info' has no member named 'disable_depth'
make[6]: *** [/home/mike/linux-backport/compat/backport-4.8.o] Error 1

In linux/pm.h, those members addition to the struct are controlled by
CONFIG_PM_RUNTIME, not CONFIG_PM. I changed pm_runtime.h to use
CONFIG_PM_RUNTIME and that resolved the problem.

Thanks for this amazing product,
Mike McElroy
--
To unsubscribe from this list: send the line "unsubscribe backports" in
diff mbox

Patch

diff --git a/backport/backport-include/linux/pm_runtime.h
b/backport/backport-include/linu
new file mode 100644
index 0000000..16d2a80
--- /dev/null
+++ b/backport/backport-include/linux/pm_runtime.h
@@ -0,0 +1,19 @@ 
+#ifndef __BACKPORT_PM_RUNTIME_H
+#define __BACKPORT_PM_RUNTIME_H
+#include_next <linux/pm_runtime.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
+#define pm_runtime_active LINUX_BACKPORT(pm_runtime_active)
+#ifdef CONFIG_PM
+static inline bool pm_runtime_active(struct device *dev)
+{
+       return dev->power.runtime_status == RPM_ACTIVE
+               || dev->power.disable_depth;
+}
+#else
+static inline bool pm_runtime_active(struct device *dev) { return true; }
+#endif /* CONFIG_PM */
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */
+
+#endif /* __BACKPORT_PM_RUNTIME_H */