Followup-For: Bug #1089505
Control: tag -1 patch

A patch should be generatable from 
https://github.com/teddywlq/smifb2/commit/2a6b1cae1a2334b19bd74f695d54a7d6cab28041

While you are updating the package, I have attached two more patches to
- simplify the installation of the -dkms package
- restore compatibility with some older kernels by correcting version
  constraints


Andreas
>From d3ea20dc911d3298e9e92f085463993c75b6de76 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Thu, 27 Feb 2025 04:21:16 +0100
Subject: [PATCH 1/2] Simplify -dkms package installation

Don't hardcode the version, let dh_dkms substitute it in dkms.conf.
Drop MAKE and CLEAN from dkms.conf which are using the defaults.
---
 debian/install          | 1 -
 debian/rules            | 4 +++-
 debian/smifb2-dkms.dkms | 4 +---
 3 files changed, 4 insertions(+), 5 deletions(-)
 delete mode 100644 debian/install

diff --git a/debian/install b/debian/install
deleted file mode 100644
index 130ad36..0000000
--- a/debian/install
+++ /dev/null
@@ -1 +0,0 @@
-smifb2/* /usr/src/smifb2-2.4.0/
diff --git a/debian/rules b/debian/rules
index 5848dd9..798771f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,8 +2,10 @@
 
 export DH_VERBOSE=1
 
+include /usr/share/dpkg/pkg-info.mk
+
 %:
        dh $@
 
 override_dh_install:
-       dh_install -Xsmifb2/readme
+       dh_install -Xsmifb2/readme smifb2/* 
usr/src/smifb2-$(DEB_VERSION_UPSTREAM)/
diff --git a/debian/smifb2-dkms.dkms b/debian/smifb2-dkms.dkms
index 55ce27a..ef91bb0 100644
--- a/debian/smifb2-dkms.dkms
+++ b/debian/smifb2-dkms.dkms
@@ -1,8 +1,6 @@
 PACKAGE_NAME="smifb2"
-PACKAGE_VERSION="2.4.0"
+PACKAGE_VERSION="#MODULE_VERSION#"
 BUILT_MODULE_NAME[0]="smifb"
-MAKE[0]="make -C ${kernel_source_dir} 
M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
-CLEAN="make -C ${kernel_source_dir} 
M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
 DEST_MODULE_LOCATION[0]=/kernel/drivers/gpu/drm/smifb2
 AUTOINSTALL=yes
 BUILD_EXCLUSIVE_CONFIG="CONFIG_DRM CONFIG_I2C CONFIG_DRM_VRAM_HELPER"
-- 
2.39.5

>From e257f4c14a6b0f39a02aa8ec5c47328d26c73634 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Thu, 27 Feb 2025 11:27:48 +0100
Subject: [PATCH 2/2] Fix version constraints to restore support for some
 ancient kernels

---
 debian/patches/fix-Linux-5.x-build.patch | 56 ++++++++++++++++++++++++
 debian/patches/series                    |  1 +
 2 files changed, 57 insertions(+)
 create mode 100644 debian/patches/fix-Linux-5.x-build.patch

diff --git a/debian/patches/fix-Linux-5.x-build.patch 
b/debian/patches/fix-Linux-5.x-build.patch
new file mode 100644
index 0000000..a29e615
--- /dev/null
+++ b/debian/patches/fix-Linux-5.x-build.patch
@@ -0,0 +1,56 @@
+Author: Andreas Beckmann <a...@debian.org>
+Description: Fix version constraints to restore support for some ancient 
kernels
+
+--- a/smifb2/smi_debugfs.c
++++ b/smifb2/smi_debugfs.c
+@@ -8,6 +8,7 @@
+ #include <linux/vmalloc.h>
+ #include <linux/debugfs.h>
+ #include <drm/drm_debugfs.h>
++#include <drm/drm_file.h>
+ #include "smi_debugfs.h"
+ 
+ extern int pwm_ctrl;
+@@ -126,7 +127,7 @@ static const struct file_operations reg_
+       .read  = reg_read,
+       .write = reg_write,
+ };
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+      void smi_debugfs_init(struct drm_minor *minor)
+ #else
+      int smi_debugfs_init(struct drm_minor *minor)
+--- a/smifb2/smi_debugfs.h
++++ b/smifb2/smi_debugfs.h
+@@ -19,7 +19,7 @@ struct smi_regs{
+ 
+ 
+ 
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+         void smi_debugfs_init(struct drm_minor *minor);
+ #else
+         int smi_debugfs_init(struct drm_minor *minor);
+--- a/smifb2/smi_drv.c
++++ b/smifb2/smi_drv.c
+@@ -475,7 +475,7 @@ irqreturn_t smi_drm_interrupt(DRM_IRQ_AR
+ static int smi_dumb_create_align(struct drm_file *file, struct drm_device 
*dev,
+                            struct drm_mode_create_dumb *args)
+ {
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
+       args->width = ALIGN (args->width , 8);  
+       return drm_gem_vram_fill_create_dumb(file, dev, &dev->vram_mm->bdev, 0, 
false, args);
+ #else
+--- a/smifb2/smi_main.c
++++ b/smifb2/smi_main.c
+@@ -564,8 +564,8 @@ void smi_gem_free_object(struct drm_gem_
+       struct drm_gem_vram_object *gbo;
+        gbo = drm_gem_vram_of_gem(obj);
+        if (gbo) {
+-              if (gbo->bo.base.import_attach)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++              if (gbo->bo.base.import_attach)
+                       drm_prime_gem_destroy(&gbo->bo.base, gbo->bo.sg);
+ #else
+                       drm_prime_gem_destroy(&gbo->gem, gbo->bo.sg);
diff --git a/debian/patches/series b/debian/patches/series
index d0a0780..232c8cf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ encoding.patch
 0001-Fix-Linux-6.8-build.patch
 fix-linux-6.10-build.patch
 fix-linux-6.11-build.patch
+fix-Linux-5.x-build.patch
-- 
2.39.5

Reply via email to