summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Yip2023-05-16 08:11:59 -0700
committerJason Yip2023-05-16 08:13:08 -0700
commit4fb1b7f7063f28b90ba5e0a94255cf3b4035b6f1 (patch)
tree9f25ea2f75c75f802f55983b4f1137712923b059
parentdf1a4740ddc9d592bbdefe736fd074e438c05fcc (diff)
downloadaur-4fb1b7f7063f28b90ba5e0a94255cf3b4035b6f1.tar.gz
[UPDATE]: Redo linux 6.x compatibility patch
https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/merge_requests/12 https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/merge_requests/12
-rw-r--r--.SRCINFO6
-rw-r--r--.gitignore8
-rw-r--r--PKGBUILD9
-rw-r--r--dkms.conf7
-rw-r--r--linux-6.3-rc2.patch94
-rw-r--r--linux-6.x-compatibility.patch135
6 files changed, 147 insertions, 112 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 49c5a451fdfb..f5fd2ca1f4b8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = ddcci-driver-linux-dkms
pkgdesc = A pair of Linux kernel drivers for DDC/CI monitors (DKMS)
pkgver = 0.4.3
- pkgrel = 5
+ pkgrel = 6
url = https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/
arch = i686
arch = x86_64
@@ -10,8 +10,8 @@ pkgbase = ddcci-driver-linux-dkms
depends = dkms
conflicts = ddcci-driver-linux
source = https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/archive/v0.4.3/ddcci-driver-linux-v0.4.3.tar.gz
- source = linux-6.3-rc2.patch
+ source = linux-6.x-compatibility.patch
b2sums = 71f855b8d7e4b9a1b5d38a73d4a6df7453e72600596121f68c6782f180211bd935ab30cf0cf94cc0528e8d5f732449d35b24cd9584d17083318d819b81a0b259
- b2sums = d4b602afe040b70ab4e288807ffd06b7ee8b4d1befba749c6badc03f391dcacff41f36df7d5049030754bcb9ac1b29d99abec70fcc218fb744eb2067d55e9d79
+ b2sums = 67e88af9c052ff8275b01229b1af388c53cb99fe4bc0a9b725797f5a98187eb8b91581dde753a76896869be568acd180f17491c6ac753d08d56572316da24b2b
pkgname = ddcci-driver-linux-dkms
diff --git a/.gitignore b/.gitignore
index 1b2e1ee03df9..166f9e1d2bb7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
-*.tar.gz
-*.zst
-ddcci-driver-linux-v*.*.*/
+*
+!/.gitignore
+!/PKGBUILD
+!/.SRCINFO
+!/*.patch
diff --git a/PKGBUILD b/PKGBUILD
index f5d2ec3e0d2d..e4ea37081064 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@
pkgname=ddcci-driver-linux-dkms
pkgver=0.4.3
-pkgrel=5
+pkgrel=6
pkgdesc="A pair of Linux kernel drivers for DDC/CI monitors (DKMS)"
arch=('i686' 'x86_64' 'aarch64')
url="https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/"
@@ -13,15 +13,14 @@ depends=('dkms')
conflicts=("ddcci-driver-linux")
source=(
"https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/archive/v${pkgver}/ddcci-driver-linux-v${pkgver}.tar.gz"
- "linux-6.3-rc2.patch"
+ "linux-6.x-compatibility.patch"
)
b2sums=('71f855b8d7e4b9a1b5d38a73d4a6df7453e72600596121f68c6782f180211bd935ab30cf0cf94cc0528e8d5f732449d35b24cd9584d17083318d819b81a0b259'
- 'd4b602afe040b70ab4e288807ffd06b7ee8b4d1befba749c6badc03f391dcacff41f36df7d5049030754bcb9ac1b29d99abec70fcc218fb744eb2067d55e9d79')
+ '67e88af9c052ff8275b01229b1af388c53cb99fe4bc0a9b725797f5a98187eb8b91581dde753a76896869be568acd180f17491c6ac753d08d56572316da24b2b')
-# by UmarJ
prepare() {
cd "${srcdir}/ddcci-driver-linux-v${pkgver}"
- patch --strip=1 --forward --input="../linux-6.3-rc2.patch"
+ patch --strip=1 --forward --input="../linux-6.x-compatibility.patch"
}
package() {
diff --git a/dkms.conf b/dkms.conf
deleted file mode 100644
index 4f441bf27088..000000000000
--- a/dkms.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-PACKAGE_NAME="@_PKGBASE@"
-PACKAGE_VERSION="@PKGVER@"
-MAKE[0]="make --uname_r=$kernelver"
-CLEAN="make clean"
-BUILT_MODULE_NAME[0]="@_PKGBASE@"
-DEST_MODULE_LOCATION[0]="/kernel/drivers/misc"
-AUTOINSTALL="yes"
diff --git a/linux-6.3-rc2.patch b/linux-6.3-rc2.patch
deleted file mode 100644
index 349ed1c4e964..000000000000
--- a/linux-6.3-rc2.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-diff --unified --recursive --text a/ddcci/ddcci.c b/ddcci/ddcci.c
---- a/ddcci/ddcci.c
-+++ b/ddcci/ddcci.c
-@@ -43,6 +43,9 @@
-
- struct bus_type ddcci_bus_type;
- EXPORT_SYMBOL_GPL(ddcci_bus_type);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
-+static bool ddcci_bus_registered;
-+#endif
-
- /* Assert neccessary string array sizes */
- #ifndef sizeof_field
-@@ -931,7 +934,11 @@
-
- /* DDC/CI bus */
-
--static int ddcci_device_uevent(struct device *dev, struct kobj_uevent_env *env)
-+static int ddcci_device_uevent(
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
-+ const
-+#endif
-+ struct device *dev, struct kobj_uevent_env *env)
- {
- struct ddcci_device *device = to_ddcci_device(dev);
- char model[ARRAY_SIZE(device->model)];
-@@ -1011,7 +1018,11 @@
- kfree(device);
- }
-
--static char *ddcci_devnode(struct device *dev,
-+static char *ddcci_devnode(
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
-+ const
-+#endif
-+ struct device *dev,
- umode_t *mode, kuid_t *uid, kgid_t *gid)
- {
- struct ddcci_device *device;
-@@ -1021,7 +1032,11 @@
- device->i2c_client->adapter->nr);
- }
-
--static char *ddcci_dependent_devnode(struct device *dev,
-+static char *ddcci_dependent_devnode(
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
-+ const
-+#endif
-+ struct device *dev,
- umode_t *mode, kuid_t *uid, kgid_t *gid)
- {
- struct ddcci_device *device;
-@@ -1100,7 +1115,13 @@
- int ret;
-
- /* Can't register until after driver model init */
-- if (unlikely(WARN_ON(!ddcci_bus_type.p)))
-+ if (unlikely(WARN_ON(!
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
-+ ddcci_bus_type.p
-+#else
-+ ddcci_bus_registered
-+#endif
-+ )))
- return -EAGAIN;
-
- pr_debug("registering driver [%s]\n", driver->driver.name);
-@@ -1672,8 +1693,15 @@
- }
-
- /* I2C probe function */
--static int ddcci_probe(struct i2c_client *client, const struct i2c_device_id *id)
-+static int ddcci_probe(struct i2c_client *client
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
-+ , const struct i2c_device_id *id)
-+{
-+#else
-+ )
- {
-+ const struct i2c_device_id *id = i2c_client_get_device_id(client);
-+#endif
- int i, ret = -ENODEV, tmp;
- unsigned char main_addr, addr;
- struct ddcci_bus_drv_data *drv_data;
-@@ -1849,6 +1877,9 @@
- pr_err("failed to register bus 'ddcci'\n");
- goto err_busreg;
- }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
-+ ddcci_bus_registered = true;
-+#endif
-
- /* Register I2C driver */
- ret = i2c_add_driver(&ddcci_driver);
diff --git a/linux-6.x-compatibility.patch b/linux-6.x-compatibility.patch
new file mode 100644
index 000000000000..18ea9eab598e
--- /dev/null
+++ b/linux-6.x-compatibility.patch
@@ -0,0 +1,135 @@
+diff --unified --recursive --text a/ddcci/ddcci.c b/ddcci/ddcci.c
+--- a/ddcci/ddcci.c
++++ b/ddcci/ddcci.c
+@@ -35,11 +35,16 @@
+ static unsigned int delay = 60;
+ static unsigned short autoprobe_addrs[127] = {0xF0, 0xF2, 0xF4, 0xF6, 0xF8};
+ static int autoprobe_addr_count = 5;
++static bool is_registered;
+
+ static dev_t ddcci_cdev_first;
+ static dev_t ddcci_cdev_next;
+ static dev_t ddcci_cdev_end;
+-static DEFINE_SEMAPHORE(core_lock);
++static DEFINE_SEMAPHORE(core_lock
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
++ , 1
++#endif
++ );
+
+ struct bus_type ddcci_bus_type;
+ EXPORT_SYMBOL_GPL(ddcci_bus_type);
+@@ -931,7 +936,7 @@
+
+ /* DDC/CI bus */
+
+-static int ddcci_device_uevent(struct device *dev, struct kobj_uevent_env *env)
++static int ddcci_device_uevent(CSTRUCT device *dev, struct kobj_uevent_env *env)
+ {
+ struct ddcci_device *device = to_ddcci_device(dev);
+ char model[ARRAY_SIZE(device->model)];
+@@ -1011,7 +1016,7 @@
+ kfree(device);
+ }
+
+-static char *ddcci_devnode(struct device *dev,
++static char *ddcci_devnode(CSTRUCT device *dev,
+ umode_t *mode, kuid_t *uid, kgid_t *gid)
+ {
+ struct ddcci_device *device;
+@@ -1021,7 +1026,7 @@
+ device->i2c_client->adapter->nr);
+ }
+
+-static char *ddcci_dependent_devnode(struct device *dev,
++static char *ddcci_dependent_devnode(CSTRUCT device *dev,
+ umode_t *mode, kuid_t *uid, kgid_t *gid)
+ {
+ struct ddcci_device *device;
+@@ -1065,7 +1070,7 @@
+ * ddcci_verify_device - return parameter as ddcci_device, or NULL
+ * @dev: device, probably from some driver model iterator
+ */
+-struct ddcci_device *ddcci_verify_device(struct device *dev)
++struct ddcci_device *ddcci_verify_device(CSTRUCT device *dev)
+ {
+ if (unlikely(!dev))
+ return NULL;
+@@ -1100,7 +1105,7 @@
+ int ret;
+
+ /* Can't register until after driver model init */
+- if (unlikely(WARN_ON(!ddcci_bus_type.p)))
++ if (unlikely(WARN_ON(!is_registered)))
+ return -EAGAIN;
+
+ pr_debug("registering driver [%s]\n", driver->driver.name);
+@@ -1672,8 +1676,15 @@
+ }
+
+ /* I2C probe function */
+-static int ddcci_probe(struct i2c_client *client, const struct i2c_device_id *id)
++static int ddcci_probe(struct i2c_client *client
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
++ , const struct i2c_device_id *id)
+ {
++#else
++ )
++{
++ const struct i2c_device_id *id = i2c_client_get_device_id(client);
++#endif
+ int i, ret = -ENODEV, tmp;
+ unsigned char main_addr, addr;
+ struct ddcci_bus_drv_data *drv_data;
+@@ -1857,6 +1868,7 @@
+ goto err_drvreg;
+ }
+
++ is_registered = true;
+ pr_debug("ddcci driver initialized\n");
+
+ return 0;
+@@ -1886,6 +1898,7 @@
+
+ i2c_del_driver(&ddcci_driver);
+ bus_unregister(&ddcci_bus_type);
++ is_registered = false;
+ unregister_chrdev_region(ddcci_cdev_first, 128);
+ }
+
+diff --unified --recursive --text a/dkms.conf b/dkms.conf
+--- a/dkms.conf 2023-03-13
++++ b/dkms.conf 2023-05-16
+@@ -7,5 +7,5 @@
+ BUILT_MODULE_LOCATION[1]="ddcci-backlight/"
+ DEST_MODULE_LOCATION[0]="/extra"
+ DEST_MODULE_LOCATION[1]="/extra"
+-MAKE[0]="make KVER=$kernelver -C ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
++MAKE[0]="make KVER=$kernelver"
+ AUTOINSTALL="yes"
+diff --unified --recursive --text a/include/linux/ddcci.h b/include/linux/ddcci.h
+--- a/include/linux/ddcci.h
++++ b/include/linux/ddcci.h
+@@ -17,6 +17,13 @@
+ #include <linux/mod_devicetable.h>
+ #include <linux/device.h>
+ #include <linux/cdev.h>
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
++#define CSTRUCT const struct
++#else
++#define CSTRUCT struct
++#endif
++
+
+ #define DDCCI_MODULE_PREFIX "ddcci:"
+
+@@ -132,7 +139,7 @@
+ ddcci_register_driver(THIS_MODULE, driver)
+ void ddcci_del_driver(struct ddcci_driver *driver);
+
+-struct ddcci_device *ddcci_verify_device(struct device *dev);
++struct ddcci_device *ddcci_verify_device(CSTRUCT device *dev);
+
+ #define module_ddcci_driver(__ddcci_driver) \
+ module_driver(__ddcci_driver, ddcci_add_driver, \