Skip to content

Commit 40364ef

Browse files
Vixandclaude
andcommitted
hi3516cv500: fix init wrappers and MMZ for Linux 6.6-7.0
- platform_driver.remove void return (sys_config, mipi_rx, sys, base init) - ctl_table.child and register_sysctl_table removal (base_init) - list_for_each type safety in mmz_userdev - pud_offset API change in media_mem Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ea597bd commit 40364ef

6 files changed

Lines changed: 30 additions & 8 deletions

File tree

kernel/init/hi3516cv500/base_init.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <linux/module.h>
22

33
#include "mod_ext.h"
4+
#include "../../compat/kernel_compat.h"
45

56
extern int HI_LOG(hi_s32 level, hi_mod_id mod_id, const char *fmt, ...);
67
EXPORT_SYMBOL(HI_LOG);
@@ -58,6 +59,7 @@ static struct ctl_table comm_eproc_table[] = {
5859
{}
5960
};
6061

62+
#ifndef COMPAT_NO_SYSCTL_TABLE
6163
static struct ctl_table comm_dir_table[] = {
6264
{
6365
.procname = "debug",
@@ -75,12 +77,17 @@ static struct ctl_table comm_parent_tbl[] = {
7577
},
7678
{}
7779
};
80+
#endif
7881

7982
static struct ctl_table_header *comm_eproc_tbl_head;
8083

8184
int __init comm_init_proc_ctrl(void)
8285
{
86+
#ifdef COMPAT_NO_SYSCTL_TABLE
87+
comm_eproc_tbl_head = compat_register_sysctl("dev/debug", comm_eproc_table);
88+
#else
8389
comm_eproc_tbl_head = register_sysctl_table(comm_parent_tbl);
90+
#endif
8491
if (!comm_eproc_tbl_head)
8592
return -ENOMEM;
8693
return 0;

kernel/init/hi3516cv500/mipi_rx_init.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/printk.h>
1111
#include <linux/version.h>
1212
#include <linux/of_platform.h>
13+
#include "../../compat/kernel_compat.h"
1314

1415
extern unsigned int g_mipi_rx_irq_num;
1516
extern void *g_mipi_rx_regs_va;
@@ -36,12 +37,12 @@ static int hi35xx_mipi_rx_probe(struct platform_device *pdev)
3637
return mipi_rx_mod_init();
3738
}
3839

39-
static int hi35xx_mipi_rx_remove(struct platform_device *pdev)
40+
static compat_platform_remove_ret hi35xx_mipi_rx_remove(struct platform_device *pdev)
4041
{
4142
mipi_rx_mod_exit();
4243
g_mipi_rx_regs_va = NULL;
4344

44-
return 0;
45+
compat_platform_remove_return;
4546
}
4647

4748
static const struct of_device_id g_hi35xx_mipi_rx_match[] = {

kernel/init/hi3516cv500/sys_init.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <linux/printk.h>
44
#include <linux/version.h>
55
#include <linux/of_platform.h>
6+
#include "../../compat/kernel_compat.h"
67

78
#include "hi_type.h"
89
#include "hi_osal.h"
@@ -62,7 +63,7 @@ static int hi35xx_sys_probe(struct platform_device *pdev)
6263
return 0;
6364
}
6465

65-
static int hi35xx_sys_remove(struct platform_device *pdev)
66+
static compat_platform_remove_ret hi35xx_sys_remove(struct platform_device *pdev)
6667
{
6768
sys_do_mod_exit();
6869

@@ -71,7 +72,7 @@ static int hi35xx_sys_remove(struct platform_device *pdev)
7172
g_reg_ddr0_base_va = NULL;
7273
g_reg_misc_base_va = NULL;
7374

74-
return 0;
75+
compat_platform_remove_return;
7576
}
7677

7778
static const struct of_device_id hi35xx_sys_match[] = {

kernel/osal/hi3516cv500/mmz/media_mem.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,19 @@ unsigned long usr_virt_to_phys(unsigned long virt)
628628
return 0;
629629
}
630630

631+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
632+
{
633+
p4d_t *p4d;
634+
p4d = p4d_offset(pgd, virt);
635+
if (p4d_none(*p4d)) {
636+
printk("printk: not mapped in p4d!\n");
637+
return 0;
638+
}
639+
pud = pud_offset(p4d, virt);
640+
}
641+
#else
631642
pud = pud_offset(pgd, virt);
643+
#endif
632644
if (pud_none(*pud)) {
633645
printk("printk: not mapped in pud!\n");
634646
return 0;

kernel/osal/hi3516cv500/mmz/mmz_userdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ static int mmz_userdev_release(struct inode *inode, struct file *file)
860860
struct mmb_info *p = NULL;
861861
struct mmb_info *n = NULL;
862862

863-
list_for_each_entry_safe(p, n, &pmu->list, list) {
863+
osal_list_for_each_entry_safe(p, n, &pmu->list, list) {
864864
error("MMB LEAK(pid=%d): 0x%lX, %lu bytes, '%s'\n",
865865
pmu->pid, hil_mmb_phys(p->mmb),
866866
hil_mmb_length(p->mmb),

kernel/sys_config/hi3516cv500/sys_config.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/types.h>
1515
#include <asm/io.h>
1616
#include "hi_osal.h"
17+
#include "../../compat/kernel_compat.h"
1718

1819
#define VO_BT1120_EN 0
1920
#define VO_BT656_EN 0
@@ -936,7 +937,7 @@ void sensor_bus_pin_mux(int index, bus_type bus_type, const char *name)
936937
}
937938
}
938939

939-
static void sensor_clk_config(char *s)
940+
static void sensor_clk_config(char *s)
940941
{
941942
int ret;
942943
int index;
@@ -1126,10 +1127,10 @@ static int sys_config_probe(struct platform_device* pdev)
11261127
return hi_sysconfig_init(g_cmos_yuv_flag, g_online_flag, g_chip_list, g_sensor_list);
11271128
}
11281129

1129-
static int sys_config_remove(struct platform_device* pdev)
1130+
static compat_platform_remove_ret sys_config_remove(struct platform_device* pdev)
11301131
{
11311132
hi_sysconfig_exit();
1132-
return 0;
1133+
compat_platform_remove_return;
11331134
}
11341135

11351136
static const struct of_device_id g_sys_config_match[] = {

0 commit comments

Comments
 (0)