drm/tegra: Avoid kernel version checks

Instead of using kernel version checks in the Tegra DRM driver for the
tegra_fb_ops structure, just check if the appropriate definition is
defined and if so use it. This fixes building the Tegra DRM driver
against some 3rd party kernels that include backports from upstream.

Note that this also aligns the driver closer to the upstream code by
using the same definitions that the upstream driver uses.

Bug 4346767

Change-Id: I8cb40899d0bf7cdc233e5f4cee7b6afb6f12d015
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027832
(cherry picked from commit 086fc6d3da)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030330
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-12-04 20:47:27 +00:00
committed by mobile promotions
parent 6fe3abc899
commit b5d808a6ff
2 changed files with 12 additions and 21 deletions

View File

@@ -50,9 +50,6 @@ subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME
# Deprecate PCIED Error reporting pci_enable_pcie_error_reporting
subdir-ccflags-y += -DNV_DROP_PCIE_ERROR_REPORTING
# FB Deferred IO helpers name alignment
subdir-ccflags-y += -DNV_FB_DEFERRED_IO_OPS_RENAME
# Crypto driver has major change in it ops, skip it
export CONFIG_SKIP_CRYPTO=y
endif

View File

@@ -11,10 +11,7 @@
#include <linux/console.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
#include <linux/fb.h>
#endif
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
@@ -214,24 +211,21 @@ static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
return __tegra_gem_mmap(&bo->gem, vma);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
#if defined(NV_FB_DEFERRED_IO_OPS_RENAME)
FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(tegra_fb,
drm_fb_helper_damage_range,
drm_fb_helper_damage_area)
#else
FB_GEN_DEFAULT_DEFERRED_IO_OPS(tegra_fb,
drm_fb_helper_damage_range,
drm_fb_helper_damage_area)
#endif
#endif
static const struct fb_ops tegra_fb_ops = {
.owner = THIS_MODULE,
#if defined(__FB_DEFAULT_DMAMEM_OPS_RDWR) /* Linux v6.6 */
__FB_DEFAULT_DMAMEM_OPS_RDWR,
#elif defined(__FB_DEFAULT_SYS_OPS_RDWR) /* Linux v6.5 */
__FB_DEFAULT_SYS_OPS_RDWR,
#else
.fb_read = drm_fb_helper_sys_read,
.fb_write = drm_fb_helper_sys_write,
#endif
DRM_FB_HELPER_DEFAULT_OPS,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
__FB_DEFAULT_DEFERRED_OPS_RDWR(tegra_fb),
__FB_DEFAULT_DEFERRED_OPS_DRAW(tegra_fb),
#if defined(__FB_DEFAULT_DMAMEM_OPS_DRAW) /* Linux v6.6 */
__FB_DEFAULT_DMAMEM_OPS_DRAW,
#elif defined(__FB_DEFAULT_SYS_OPS_DRAW) /* Linux v6.5 */
__FB_DEFAULT_SYS_OPS_DRAW,
#else
.fb_fillrect = drm_fb_helper_sys_fillrect,
.fb_copyarea = drm_fb_helper_sys_copyarea,