backports: fix final link errors
v2 cover backports: fix final link errors
From: "Luis R. Rodriguez" <[email protected]>
OK this took a while but finally figured it out. This addresses the link errors introduced by adding the media and voltage regulator subsystems. We can now move on with life and hopefully cook a release right in time for v3.10. Now we just have to step slowly forward on linux-next tags up to where we are today (which hopefully will remain this way for another week).
Luis R. Rodriguez (4):
compat: fix dma_common_get_sgtable() backport placements
compat: backport soc_camera_power_[on|off] for 3.3
backports: disable some regulator drivers on 3.4 and 3.5
ckmake: make --check-exports default
backport/Makefile.kernel | 1 + backport/backport-include/asm/dma-mapping.h | 8 ++- backport/backport-include/linux/dma-attrs.h | 6 ++ .../backport-include/uapi/linux/v4l2-mediabus.h | 39 +++++++++++ backport/compat/Kconfig | 11 +++ backport/compat/Makefile | 1 + backport/compat/compat-3.4.c | 73 ++++++++++++++++++++ backport/compat/compat-3.6.c | 19 ----- backport/compat/dma-shared-helpers.c | 38 ++++++++++ dependencies | 27 ++++++++ devel/ckmake | 4 +- 11 files changed, 202 insertions(+), 25 deletions(-) create mode 100644 backport/backport-include/linux/dma-attrs.h create mode 100644 backport/backport-include/uapi/linux/v4l2-mediabus.h create mode 100644 backport/compat/dma-shared-helpers.c
Signature · 1 line
1.7.10.4
PATCH v2 1/4 compat: fix dma_common_get_sgtable() backport placements
From: "Luis R. Rodriguez" <[email protected]>
We added dma_common_get_sgtable() assuming it should only be available to older kernels as of 3.6 but it was only up to 3.8 where it was detangled from depending on CONFIG_HAVE_GENERIC_DMA_COHERENT. Its a mess to express this on compat files so just word it via kconfig and throw this onto its own files given that there may be other helpers we may need to backport later with the same circumstances.
One last hack was required for 3.3-3.6 and that is due to header changes between kernels.
$ time ckmake --check-exports --allyesconfig
1 2.6.24 [ OK ] 2 2.6.25 [ OK ] 3 2.6.26 [ OK ] 4 2.6.27 [ OK ] 5 2.6.28 [ OK ] 6 2.6.29 [ OK ] 7 2.6.30 [ OK ] 8 2.6.31 [ OK ] 9 2.6.32 [ OK ] 10 2.6.33 [ OK ] 11 2.6.34 [ OK ] 12 2.6.35 [ OK ] 13 2.6.36 [ OK ] 14 2.6.37 [ OK ] 15 2.6.38 [ OK ] 16 2.6.39 [ OK ] 17 3.0.65 [ OK ] 18 3.1.10 [ OK ] 19 3.2.38 [ OK ] 20 3.3.8 [ LINK ] 21 3.4.32 [ LINK ] 22 3.5.7 [ LINK ] 23 3.6.11 [ OK ] 24 3.7.9 [ OK ] 25 3.8.0 [ OK ] 26 3.9-rc1 [ OK ]
real 30m3.120s user 795m40.684s sys 123m29.995s
--- backport/backport-include/asm/dma-mapping.h | 8 +++--- backport/backport-include/linux/dma-attrs.h | 6 +++++ backport/compat/Kconfig | 11 ++++++++ backport/compat/Makefile | 1 + backport/compat/compat-3.6.c | 19 -------------- backport/compat/dma-shared-helpers.c | 38 +++++++++++++++++++++++++++ 6 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 backport/backport-include/linux/dma-attrs.h create mode 100644 backport/compat/dma-shared-helpers.c
backport/backport-include/asm/dma-mapping.h +5 -3
@@ -3,12 +3,14 @@#include_next <asm/dma-mapping.h>#include <linux/version.h> -#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 ) - +#if defined(CPTCFG_BACKPORT_BUILD_DMA_SHARED_HELPERS )#define dma_common_get_sgtable LINUX_BACKPORT(dma_common_get_sgtable)int dma_common_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t dma_addr,size_t size); +#endif /* defined(CPTCFG_BACKPORT_BUILD_DMA_SHARED_HELPERS) */ + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )#define dma_get_sgtable_attrs LINUX_BACKPORT(dma_get_sgtable_attrs)struct dma_attrs ;
@@ -20,6 +22,6 @@ dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr, }#define dma_get_sgtable (d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL) -#endif +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ #endif /* __BACKPORT_ASM_DMA_MAPPING_H */
backport/backport-include/linux/dma-attrs.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __BACKPORT_DMA_ATTR_H +#define __BACKPORT_DMA_ATTR_H +#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,26 ) +#include_next <linux/dma-attrs.h> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */ +#endif /* __BACKPORT_DMA_ATTR_H */
backport/compat/Kconfig +11 -0
@@ -158,6 +158,17 @@ config BACKPORT_BUILD_HDMI config BACKPORT_HDMI bool +config BACKPORT_BUILD_DMA_SHARED_HELPERS + bool + depends on HAS_DMA + # Build on other kernels kernels < 3.9 if HAVE_GENERIC_DMA_COHERENT is + # not set. Kernels >= 3.8 have this if HAS_DMA is set. + depends on (!HAVE_GENERIC_DMA_COHERENT || BACKPORT_KERNEL_3_9) + # Always build if on 3.3 - 3.5 + default y if (BACKPORT_KERNEL_3_4 || BACKPORT_KERNEL_3_5 || BACKPORT_KERNEL_3_6) + # build for testing + default y if BACKPORT_USERSEL_BUILD_ALL + config BACKPORT_BUILD_LEDS bool depends on !NEW_LEDS || !LEDS_CLASS || !LEDS_TRIGGERS
backport/compat/Makefile +1 -0
@@ -37,3 +37,4 @@ compat-$(CPTCFG_BACKPORT_KERNEL_3_9) += compat-3.9.o compat-$(CPTCFG_BACKPORT_BUILD_KFIFO) += kfifo.o compat-$(CPTCFG_BACKPORT_BUILD_GENERIC_ATOMIC64) += compat_atomic.o +compat-$(CPTCFG_BACKPORT_BUILD_DMA_SHARED_HELPERS) += dma-shared-helpers.o
backport/compat/compat-3.6.c +0 -19
@@ -16,25 +16,6 @@#include <linux/i2c.h> #if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 )) -#include <linux/dma-attrs.h> -/* -* Create scatter-list for the already allocated DMA buffer. -*/ -int dma_common_get_sgtable (struct device *dev,struct sg_table *sgt, -void *cpu_addr,dma_addr_t handle,size_t size) -{ -struct page *page =virt_to_page (cpu_addr); -int ret; - - ret =sg_alloc_table (sgt,1 ,GFP_KERNEL ); -if (unlikely (ret)) -return ret; - -sg_set_page (sgt->sgl, page,PAGE_ALIGN (size),0 ); -return 0 ; -} -EXPORT_SYMBOL_GPL (dma_common_get_sgtable); -/** * __i2c_transfer - unlocked flavor of i2c_transfer * @adap: Handle to I2C bus
backport/compat/dma-shared-helpers.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2013 Luis R. Rodriguez <[email protected]> +* +* Backport compatibility file for Linux for some DMA helpers +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/module.h> +#include <linux/scatterlist.h> +#include <linux/dma-attrs.h> +#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,3 ,0 ) +#if LINUX_VERSION_CODE <=KERNEL_VERSION (3 ,6 ,0 ) +#include <linux/dma-direction.h> +#include <linux/dma-mapping.h> +#include <asm/dma-mapping.h> +#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0) */ +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) */ + +/* +* Create scatter-list for the already allocated DMA buffer. +*/ +int dma_common_get_sgtable (struct device *dev,struct sg_table *sgt, +void *cpu_addr,dma_addr_t handle,size_t size) +{ +struct page *page =virt_to_page (cpu_addr); +int ret; + + ret =sg_alloc_table (sgt,1 ,GFP_KERNEL ); +if (unlikely (ret)) +return ret; + +sg_set_page (sgt->sgl, page,PAGE_ALIGN (size),0 ); +return 0 ; +} +EXPORT_SYMBOL_GPL (dma_common_get_sgtable);
Signature · 1 line
1.7.10.4
PATCH v2 2/4 compat: backport soc_camera_power_[on|off] for 3.3
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
We are only backporting CONFIG_SOC_CAMERA for kernels >= 3.4 but there is an exported symbol from there that some media drivers that we do support on 3.3 need. Handle this special case.
SOC_CAMERA is only enabled on 3.4 as it depends on some newer regulator functionality, however there are some SOC cameras that can rely on the 3.3 regulatory built-in core and the 3.3 SOC_CAMERA module however two routines are not exported in that version of SOC_CAMERA that newer SOC cameras do require. Backport that functionality.
Technically this should go into <media/soc_camera.h> given that is where its where its exported on linux-next but in practice only placing it on <linux/v4l2-mediabus.h> actually fixes linking errors for 3.3 for all SOC camera drivers we make available for 3.3:
LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/imx074.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/mt9m001.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/mt9m111.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/mt9t031.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/mt9t112.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/mt9v022.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/ov2640.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/ov5642.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/ov6650.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/ov772x.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/ov9640.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/ov9740.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/rj54n1cb0c.ko LD [M] /home/mcgrof/build/drivers/media/i2c/soc_camera/tw9910.ko
This fixes all pending linking errors on 3.3.
$ time ckmake --check-exports --allyesconfig
1 2.6.24 [ OK ] 2 2.6.25 [ OK ] 3 2.6.26 [ OK ] 4 2.6.27 [ OK ] 5 2.6.28 [ OK ] 6 2.6.29 [ OK ] 7 2.6.30 [ OK ] 8 2.6.31 [ OK ] 9 2.6.32 [ OK ] 10 2.6.33 [ OK ] 11 2.6.34 [ OK ] 12 2.6.35 [ OK ] 13 2.6.36 [ OK ] 14 2.6.37 [ OK ] 15 2.6.38 [ OK ] 16 2.6.39 [ OK ] 17 3.0.65 [ OK ] 18 3.1.10 [ OK ] 19 3.2.38 [ OK ] 20 3.3.8 [ OK ] 21 3.4.32 [ LINK ] 22 3.5.7 [ LINK ] 23 3.6.11 [ OK ] 24 3.7.9 [ OK ] 25 3.8.0 [ OK ] 26 3.9-rc1 [ OK ]
real 30m14.581s user 796m34.495s sys 126m46.807s
--- backport/Makefile.kernel | 1 + .../backport-include/uapi/linux/v4l2-mediabus.h | 39 +++++++++++ backport/compat/compat-3.4.c | 73 ++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 backport/backport-include/uapi/linux/v4l2-mediabus.h
backport/Makefile.kernel +1 -0
@@ -5,6 +5,7 @@ backport-cc-disable-warning = $(call try-run,\ NOSTDINC_FLAGS := \ -I$(M)/backport-include/ \ + -I$(M)/backport-include/uapi \ -I$(M)/include/ \ -I$(M)/include/uapi \ -I$(M)/include/drm \
backport/backport-include/uapi/linux/v4l2-mediabus.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef __BACKPORT_LINUX_V4L2_MEDIABUS_H +#define __BACKPORT_LINUX_V4L2_MEDIABUS_H +#include <linux/version.h> + +/* +* SOC_CAMERA is only enabled on 3.4 as it depends on some +* newer regulator functionality, however there are some SOC +* cameras that can rely on the 3.3 regulatory built-in core +* and the 3.3 SOC_CAMERA module however two routines are +* not exported in that version of SOC_CAMERA that newer +* SOC cameras do require. Backport that functionality. +* +* Technically this should go into <media/soc_camera.h> +* given that is where its where its exported on linux-next +* but in practice only placing it here actually fixes linking +* errors for 3.3 for all SOC camera drivers we make available +* for 3.3. +*/ +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,3 ,0 )) +#if (LINUX_VERSION_CODE <KERNEL_VERSION (3 ,4 ,0 )) +#if defined(CPTCFG_VIDEO_DEV_MODULE ) + +struct soc_camera_subdev_desc ; + +#define soc_camera_power_on LINUX_BACKPORT(soc_camera_power_on) +int soc_camera_power_on (struct device *dev, +struct soc_camera_subdev_desc *ssdd); + +#define soc_camera_power_off LINUX_BACKPORT(soc_camera_power_off) +int soc_camera_power_off (struct device *dev, +struct soc_camera_subdev_desc *ssdd); + +#endif /* defined(CPTCFG_VIDEO_DEV_MODULE) */ +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) */ +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) */ + +#include_next <linux/v4l2-mediabus.h> + +#endif /* __BACKPORT_LINUX_V4L2_MEDIABUS_H */
backport/compat/compat-3.4.c +73 -0
82 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v2 3/4 backports: disable some regulator drivers on 3.4 and 3.5
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
We enabled regulator subsystem support as of 3.4 but given that the regulator subsystem has advanced quite a bit on 3.5 and 3.6 and that we cannot backport the regulator as its part of the core kernel we have no option but to only enable drivers on their kernels if they don't depend on the new regulator features.
$ time ckmake --check-exports --allyesconfig
1 2.6.24 [ OK ] 2 2.6.25 [ OK ] 3 2.6.26 [ OK ] 4 2.6.27 [ OK ] 5 2.6.28 [ OK ] 6 2.6.29 [ OK ] 7 2.6.30 [ OK ] 8 2.6.31 [ OK ] 9 2.6.32 [ OK ] 10 2.6.33 [ OK ] 11 2.6.34 [ OK ] 12 2.6.35 [ OK ] 13 2.6.36 [ OK ] 14 2.6.37 [ OK ] 15 2.6.38 [ OK ] 16 2.6.39 [ OK ] 17 3.0.65 [ OK ] 18 3.1.10 [ OK ] 19 3.2.38 [ OK ] 20 3.3.8 [ OK ] 21 3.4.32 [ OK ] 22 3.5.7 [ OK ] 23 3.6.11 [ OK ] 24 3.7.9 [ OK ] 25 3.8.0 [ OK ] 26 3.9-rc1 [ OK ]
real 30m12.875s user 797m38.663s sys 126m56.572s
--- dependencies | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
dependencies +27 -0
@@ -69,6 +69,33 @@ REGULATOR_WM8350 DISABLE REGULATOR_PALMAS DISABLE REGULATOR_DA9055 DISABLE REGULATOR_S5M8767 DISABLE +# These have further core regulator kernel dependencies +# we can't easily backport. +REGULATOR_AAT2870 3.6 +REGULATOR_DA903X 3.5 +REGULATOR_DA9052 3.5 +REGULATOR_FAN53555 3.5 +REGULATOR_ISL6271A 3.5 +REGULATOR_LP3971 3.6 +REGULATOR_LP3972 3.6 +REGULATOR_LP8755 3.5 +REGULATOR_MAX1586 3.6 +REGULATOR_MAX8649 3.5 +REGULATOR_MAX8660 3.5 +REGULATOR_MAX8925 3.5 +REGULATOR_MAX8998 3.5 +REGULATOR_MC13783 3.6 +REGULATOR_MC13892 3.6 +REGULATOR_MC13XXX_CORE 3.6 +REGULATOR_PCAP 3.6 +REGULATOR_PCF50633 3.5 +REGULATOR_TPS51632 3.6 +REGULATOR_TPS6105X 3.6 +REGULATOR_TPS65023 3.6 +REGULATOR_TPS6507X 3.6 +REGULATOR_TPS6524X 3.6 +REGULATOR_WM8400 3.5 +REGULATOR_WM8994 3.5 # Media MEDIA_SUPPORT 3.2
Signature · 1 line
1.7.10.4
PATCH v2 4/4 ckmake: make --check-exports default
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Remove --check-exports as an option and now just enable it by default.
--- devel/ckmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
devel/ckmake +1 -3
@@ -180,7 +180,7 @@ def process_kernel(num, kset, cmdline_args): log_file.close() status = p.returncode - if status == 0 and cmdline_args.check_exports: + if status == 0 warn = re.compile('^WARNING:.*undefined.*') log_file = open(log_file_name, 'r') for l in log_file:
@@ -413,8 +413,6 @@ if __name__ == "__main__": help='Build allyesconfig rather than only backport code.') parser.add_argument('--defconfig', metavar='<name>', type=str, help='Build this defconfig rather than only backport code.') - parser.add_argument('--check-exports', const=True, default=False, action="store_const", - help='Check for linker warnings indicating exported symbols are missing.') args = parser.parse_args() if not os.path.exists(modules):
Signature · 1 line
1.7.10.4
Quoted 8 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
OK this took a while but finally figured it out. This addresses the link errors introduced by adding the media and voltage regulator subsystems. We can now move on with life and hopefully cook a release right in time for v3.10. Now we just have to step slowly forward on linux-next tags up to where we are today (which hopefully will remain this way for another week).
Thanks Luis! Applied all 4 (actually 4/4 I applied the one you sent later)
johannes