From 6b37b04f908b631da8f84fad64d4829ddefe1142 Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Fri, 9 Jan 2026 17:07:56 +0100 Subject: [PATCH] platform/mikrotik: adjust hc_wlan read-callback for 6.18 Include and use preprocessor checks to select the appropriate prototype and definition for hc_wlan_data_bin_read. The third parameter of bin_attribute read callbacks was changed to 'const struct bin_attribute *' in Linux 6.18; this change prevents compilation errors on newer kernels while preserving compatibility with older ones Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/21078 Signed-off-by: Robert Marko --- .../files/drivers/platform/mikrotik/rb_hardconfig.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c index 3c5fa6f5b9..2173c16c64 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "rb_hardconfig.h" #include "routerboot.h" @@ -341,9 +342,15 @@ static ssize_t hc_tag_show_hwoptions(const u8 *pld, u16 pld_len, char *buf) return out - buf; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,18,0) static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count); +#else +static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj, + const struct bin_attribute *attr, char *buf, + loff_t off, size_t count); +#endif static struct hc_wlan_attr { const u16 erd_tag_id; @@ -651,9 +658,15 @@ static ssize_t hc_attr_show(struct kobject *kobj, struct kobj_attribute *attr, * at boot time to load wlan caldata), this makes it possible to save memory for * the system. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,18,0) static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) +#else +static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj, + const struct bin_attribute *attr, char *buf, + loff_t off, size_t count) +#endif { struct hc_wlan_attr *hc_wattr; size_t outlen;