accel/ivpu: Stop using hardcoded DRIVER_DATE
authorJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Mon, 30 Sep 2024 19:53:03 +0000 (21:53 +0200)
committerJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Fri, 11 Oct 2024 10:44:38 +0000 (12:44 +0200)
Hardcoded driver date is useless, so use kernel version as a driver date
to make identifying .ko file easier. Also allow to pass DRIVER_DATE
on build time to allow versioning the driver in case it is built out
of the tree.

Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240930195322.461209-13-jacek.lawrynowicz@linux.intel.com
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
drivers/accel/ivpu/ivpu_drv.c
drivers/accel/ivpu/ivpu_drv.h
include/uapi/drm/ivpu_accel.h

index 38b4158..9fd371a 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
+#include <generated/utsrelease.h>
 
 #include <drm/drm_accel.h>
 #include <drm/drm_file.h>
@@ -32,8 +33,7 @@
 #include "vpu_boot_api.h"
 
 #ifndef DRIVER_VERSION_STR
-#define DRIVER_VERSION_STR __stringify(DRM_IVPU_DRIVER_MAJOR) "." \
-                          __stringify(DRM_IVPU_DRIVER_MINOR) "."
+#define DRIVER_VERSION_STR "1.0.0 " UTS_RELEASE
 #endif
 
 static struct lock_class_key submitted_jobs_xa_lock_class_key;
@@ -447,9 +447,16 @@ static const struct drm_driver driver = {
 
        .name = DRIVER_NAME,
        .desc = DRIVER_DESC,
+
+#ifdef DRIVER_DATE
        .date = DRIVER_DATE,
-       .major = DRM_IVPU_DRIVER_MAJOR,
-       .minor = DRM_IVPU_DRIVER_MINOR,
+       .major = DRIVER_MAJOR,
+       .minor = DRIVER_MINOR,
+       .patchlevel = DRIVER_PATCHLEVEL,
+#else
+       .date = UTS_RELEASE,
+       .major = 1,
+#endif
 };
 
 static void ivpu_context_abort_invalid(struct ivpu_device *vdev)
index 2b30cc2..4714782 100644 (file)
@@ -21,7 +21,6 @@
 
 #define DRIVER_NAME "intel_vpu"
 #define DRIVER_DESC "Driver for Intel NPU (Neural Processing Unit)"
-#define DRIVER_DATE "20230117"
 
 #define PCI_DEVICE_ID_MTL   0x7d1d
 #define PCI_DEVICE_ID_ARL   0xad1d
index 084fb52..234664d 100644 (file)
@@ -12,9 +12,6 @@
 extern "C" {
 #endif
 
-#define DRM_IVPU_DRIVER_MAJOR 1
-#define DRM_IVPU_DRIVER_MINOR 0
-
 #define DRM_IVPU_GET_PARAM               0x00
 #define DRM_IVPU_SET_PARAM               0x01
 #define DRM_IVPU_BO_CREATE               0x02