Fix build on kernel 6.8+

This commit is contained in:
Sakari 2024-03-14 10:59:15 +08:00 committed by Geoffrey McRae
parent 1374629d08
commit f72619e468
1 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/version.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
//#include <drm/drm_util.h> //#include <drm/drm_util.h>
@ -39,6 +40,10 @@
#include "atom-names.h" #include "atom-names.h"
#include "atom-bits.h" #include "atom-bits.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
#define strscpy strlcpy
#endif
#define ATOM_COND_ABOVE 0 #define ATOM_COND_ABOVE 0
#define ATOM_COND_ABOVEOREQUAL 1 #define ATOM_COND_ABOVEOREQUAL 1
#define ATOM_COND_ALWAYS 2 #define ATOM_COND_ALWAYS 2
@ -1424,7 +1429,7 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
if (*str != '\0') if (*str != '\0')
{ {
pr_info("ATOM BIOS: %s\n", str); pr_info("ATOM BIOS: %s\n", str);
strlcpy(ctx->vbios_version, str, sizeof(ctx->vbios_version)); strscpy(ctx->vbios_version, str, sizeof(ctx->vbios_version));
} }
return ctx; return ctx;