Compile imx390 driver to module error

Hi everyone.

I was trying to change imx390 driver as module.

So first of all, I modified tegra_defconfig

CONFIG_I2C_IOEXPANDER_DESER_MAX9296=m
CONFIG_VIDEO_IMX390=m

And during the compile, error occured

I’m trying to compile L4T 32.2.3. And also I’m using Leopard Imageing’s cameras.

Can anyone help me out?

You need to export those functions in max929*.c and have extern declare in the imx390.c

ERROR: “max9296_power_on” [drivers/media/i2c/imx390.ko] undefined!
ERROR: “max9296_start_streaming” [drivers/media/i2c/imx390.ko] undefined!
ERROR: “max9296_stop_streaming” [drivers/media/i2c/imx390.ko] undefined!
ERROR: “max9296_power_off” [drivers/media/i2c/imx390.ko] undefined!

Thank you for your reply.

I added extern in max9296.c and max9296.h

And I also added extern declaration in imx390.c.

extern void max9296_power_off(struct device *dev); extern int max9296_power_on(struct device *dev); extern int max9296_start_streaming(struct device *dev, struct device *s_dev); extern int max9296_stop_streaming(struct device *dev, struct device *s_dev);

But the error is still there

You should add EXPORT_SYMBOL_GPL(max9296_xxxxx) to the max9296.c

Thanks for your quick reply.

However, I added EXPORT_SYMBOL_GPL(“function name”) behind this 4 functions. It still has the same error

There’s no problem to build it. By below modification without add extern in the imx390.c

diff --git a/drivers/media/i2c/max9296.c b/drivers/media/i2c/max9296.c
index 88fc03b..9b9cc53 100644
--- a/drivers/media/i2c/max9296.c
+++ b/drivers/media/i2c/max9296.c
@@ -246,6 +246,8 @@ ret:
        return err;
 }

+EXPORT_SYMBOL_GPL(max9296_power_on);
+
 void max9296_power_off(struct device *dev)
 {
        struct max9296 *priv = dev_get_drvdata(dev);
@@ -265,6 +267,7 @@ void max9296_power_off(struct device *dev)

        mutex_unlock(&priv->lock);
 }
+EXPORT_SYMBOL_GPL(max9296_power_off);

 int max9296_setup_link(struct device *dev, struct device *s_dev)
 {
@@ -638,6 +641,7 @@ int max9296_start_streaming(struct device *dev, struct device *s_dev)

        return 0;
 }
+EXPORT_SYMBOL_GPL(max9296_start_streaming);

 int max9296_stop_streaming(struct device *dev, struct device *s_dev)
 {
@@ -666,6 +670,7 @@ int max9296_stop_streaming(struct device *dev, struct device *s_dev)

        return 0;
 }
+EXPORT_SYMBOL_GPL(max9296_stop_streaming);

 int max9296_setup_streaming(struct device *dev, struct device *s_dev)
 {

This works, thanks for your help.