Skip to content

Commit 75fac96

Browse files
committed
sensor_i2c/hi3516cv300: declare MODULE_LICENSE("GPL")
User-reported failure on real hi3516cv300 hardware (IMX323 over I2C, OpenIPC 2.6.04.28-lite): open_sensor_i2c: Unknown symbol i2c_new_device (err 0) open_sensor_i2c: Unknown symbol i2c_unregister_device (err 0) The kernel's `i2c_new_device` / `i2c_unregister_device` are `EXPORT_SYMBOL_GPL`. With no `MODULE_LICENSE` in this module, the kernel treats it as proprietary and refuses to resolve those symbols. The cv300 sensor_i2c module was added in #38 (commit 20882c6) without module init/exit boilerplate or license declaration — it was a half-port of the vendor's combined `hi3516cv300_sensor.ko`, where the top-level wrapper would have lived. Sensor_spi (split out by the same port) doesn't hit this because all the helpers it calls (ioremap_nocache, iounmap, …) are non-GPL exports, and the recent #59 added `EXPORT_SYMBOL` for ssp_drv_*. The i2c branch of i2c_drv.c hits two GPL-only symbols that have always required this license tag. Verified live on hi3516cv300 hardware (172.17.32.126) reproducing the user's `Unknown symbol i2c_new_device` failure. Building this fix and testing on the same camera confirms `open_sensor_i2c.ko` loads cleanly once the license tag is in place (combined with the firmware-side fix in OpenIPC/firmware#2030 that ships and pre-loads sensor_spi for cv300). A proper module_init / module_exit / module_param wrapper for cv300 sensor_i2c is a separate, larger piece of work — not addressed here. The .ko's load-time symbol resolution is what blocks the camera; once that succeeds, the symbols inside (i2c_drv_init etc.) are reachable through the existing in-kernel callback mechanism, same as before. Refs #62, #66.
1 parent e2aa062 commit 75fac96

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

kernel/sensor_i2c/hi3516cv300/sensor.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <linux/module.h>
2+
13
#include "hi_osal.h"
24

35
#include "sensor.h"
@@ -133,3 +135,9 @@ HI_VOID sensor_dev_exit(HI_S32 s32SensorIndex)
133135
osal_printk("sensor dev exit OK.\n");
134136
g_stSensorDev[s32SensorIndex] = NULL;
135137
}
138+
139+
/* The kernel's i2c_new_device / i2c_unregister_device are EXPORT_SYMBOL_GPL,
140+
* so this module must declare a GPL-compatible license or insmod fails with
141+
* "Unknown symbol" on those calls in i2c_drv_init / i2c_drv_exit.
142+
*/
143+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)