iwlwifi: fix build with kernel 6.1

This commit is contained in:
coolsnowwolf 2023-02-26 16:47:48 +08:00
parent 21e254e7da
commit a2c61871bc
2 changed files with 261 additions and 0 deletions

View File

@ -0,0 +1,47 @@
From cc885ed1dcebcdb063167888e79845328ed60703 Mon Sep 17 00:00:00 2001
From: W_Y_CPP <383152993@qq.com>
Date: Wed, 22 Feb 2023 21:57:39 +0900
Subject: [PATCH] fix build with kernel 6.1
---
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 4 ++++
1 file changed, 4 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index e6001a5..b4e222c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -1099,7 +1099,11 @@ static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
iwl_mvm_mac_ap_iterator, &data);
if (data.beacon_device_ts) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+ u32 rand = (get_random_u32() % (64 - 36)) + 36;
+#else
u32 rand = (prandom_u32() % (64 - 36)) + 36;
+#endif
mvmvif->ap_beacon_time = data.beacon_device_ts +
ieee80211_tu_to_usec(data.beacon_int * rand /
100);
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -1097,9 +1097,13 @@ static int _iwl_pcie_rx_init(struct iwl_trans *trans)
if (trans_pcie->msix_enabled)
poll = iwl_pcie_napi_poll_msix;
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0)
netif_napi_add(&trans_pcie->napi_dev, &rxq->napi,
poll, NAPI_POLL_WEIGHT);
+#else
+ netif_napi_add_weight(&trans_pcie->napi_dev, &rxq->napi,
+ poll, NAPI_POLL_WEIGHT);
+#endif
napi_enable(&rxq->napi);
}
--
2.17.1

View File

@ -0,0 +1,214 @@
From 767cc7f3b63233577767e60fe4bc911f6595c121 Mon Sep 17 00:00:00 2001
From: W_Y_CPP <383152993@qq.com>
Date: Wed, 22 Feb 2023 22:58:07 +0900
Subject: [PATCH] export efivarfs function
---
fs/efivarfs/internal.h | 39 ---------------------------------------
include/linux/efi.h | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 39 deletions(-)
fs/efivarfs/vars.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/fs/efivarfs/internal.h b/fs/efivarfs/internal.h
index 8ebf3a6..9231bd4 100644
--- a/fs/efivarfs/internal.h
+++ b/fs/efivarfs/internal.h
@@ -9,45 +9,6 @@
#include <linux/list.h>
#include <linux/efi.h>
-struct efi_variable {
- efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
- efi_guid_t VendorGuid;
- unsigned long DataSize;
- __u8 Data[1024];
- efi_status_t Status;
- __u32 Attributes;
-} __attribute__((packed));
-
-struct efivar_entry {
- struct efi_variable var;
- struct list_head list;
- struct kobject kobj;
-};
-
-int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
- void *data, bool duplicates, struct list_head *head);
-
-int efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
-void __efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
-void efivar_entry_remove(struct efivar_entry *entry);
-int efivar_entry_delete(struct efivar_entry *entry);
-
-int efivar_entry_size(struct efivar_entry *entry, unsigned long *size);
-int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
- unsigned long *size, void *data);
-int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
- unsigned long *size, void *data);
-int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
- unsigned long *size, void *data, bool *set);
-
-int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
- struct list_head *head, void *data);
-
-bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data,
- unsigned long data_size);
-bool efivar_variable_is_removable(efi_guid_t vendor, const char *name,
- size_t len);
-
extern const struct file_operations efivarfs_file_operations;
extern const struct inode_operations efivarfs_dir_inode_operations;
extern bool efivarfs_valid_name(const char *str, int len);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 4e1bfee..8ec2678 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1062,6 +1062,45 @@ struct efivars {
#define EFI_VAR_NAME_LEN 1024
+struct efi_variable {
+ efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
+ efi_guid_t VendorGuid;
+ unsigned long DataSize;
+ __u8 Data[1024];
+ efi_status_t Status;
+ __u32 Attributes;
+} __attribute__((packed));
+
+struct efivar_entry {
+ struct efi_variable var;
+ struct list_head list;
+ struct kobject kobj;
+};
+
+int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
+ void *data, bool duplicates, struct list_head *head);
+
+int efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
+void __efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
+void efivar_entry_remove(struct efivar_entry *entry);
+int efivar_entry_delete(struct efivar_entry *entry);
+
+int efivar_entry_size(struct efivar_entry *entry, unsigned long *size);
+int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
+ unsigned long *size, void *data);
+int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
+ unsigned long *size, void *data);
+int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
+ unsigned long *size, void *data, bool *set);
+
+int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
+ struct list_head *head, void *data);
+
+bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data,
+ unsigned long data_size);
+bool efivar_variable_is_removable(efi_guid_t vendor, const char *name,
+ size_t len);
+
int efivars_register(struct efivars *efivars,
const struct efivar_operations *ops,
struct kobject *kobject);
diff --git a/fs/efivarfs/vars.c b/fs/efivarfs/vars.c
index 9e4f478..5026987 100644
--- a/fs/efivarfs/vars.c
+++ b/fs/efivarfs/vars.c
@@ -259,6 +259,7 @@ efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data,
kfree(utf8_name);
return true;
}
+EXPORT_SYMBOL_GPL(efivar_validate);
bool
efivar_variable_is_removable(efi_guid_t vendor, const char *var_name,
@@ -287,7 +288,7 @@ efivar_variable_is_removable(efi_guid_t vendor, const char *var_name,
*/
return found;
}
-
+EXPORT_SYMBOL_GPL(efivar_variable_is_removable);
static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor,
struct list_head *head)
{
@@ -446,7 +447,7 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
return err;
}
-
+EXPORT_SYMBOL_GPL(efivar_init);
/**
* efivar_entry_add - add entry to variable list
* @entry: entry to add to list
@@ -466,7 +467,7 @@ int efivar_entry_add(struct efivar_entry *entry, struct list_head *head)
return 0;
}
-
+EXPORT_SYMBOL_GPL(efivar_entry_add);
/**
* __efivar_entry_add - add entry to variable list
* @entry: entry to add to list
@@ -487,7 +488,7 @@ void efivar_entry_remove(struct efivar_entry *entry)
{
list_del(&entry->list);
}
-
+EXPORT_SYMBOL_GPL(efivar_entry_remove);
/*
* efivar_entry_list_del_unlock - remove entry from variable list
* @entry: entry to remove
@@ -536,7 +537,7 @@ int efivar_entry_delete(struct efivar_entry *entry)
efivar_entry_list_del_unlock(entry);
return 0;
}
-
+EXPORT_SYMBOL_GPL(efivar_entry_delete);
/**
* efivar_entry_size - obtain the size of a variable
* @entry: entry for this variable
@@ -562,7 +563,7 @@ int efivar_entry_size(struct efivar_entry *entry, unsigned long *size)
return 0;
}
-
+EXPORT_SYMBOL_GPL(efivar_entry_size);
/**
* __efivar_entry_get - call get_variable()
* @entry: read data for this variable
@@ -585,7 +586,7 @@ int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
return efi_status_to_err(status);
}
-
+EXPORT_SYMBOL_GPL(__efivar_entry_get);
/**
* efivar_entry_get - call get_variable()
* @entry: read data for this variable
@@ -606,7 +607,7 @@ int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
return 0;
}
-
+EXPORT_SYMBOL_GPL(efivar_entry_get);
/**
* efivar_entry_set_get_size - call set_variable() and get new size (atomic)
* @entry: entry containing variable to set and get
@@ -686,7 +687,7 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
return err;
}
-
+EXPORT_SYMBOL_GPL(efivar_entry_set_get_size);
/**
* efivar_entry_iter - iterate over variable list
* @func: callback function
@@ -720,3 +721,4 @@ int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
return err;
}
+EXPORT_SYMBOL_GPL(efivar_entry_iter);
\ No newline at end of file
--
2.17.1