platform/mikrotik: adjust hc_wlan read-callback for 6.18
Include <linux/version.h> 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 <namiltd@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/21078 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
eff7240445
commit
6b37b04f90
@ -36,6 +36,7 @@
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/lzo.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user