Selaa lähdekoodia

msm: camera: sensor: Unregister i3c driver properly

Only unregister the i3c driver if there is i3c node
in dtsi.

CRs-Fixed: 3234792
Change-Id: I01e99406a08648aab90147d1287d3d8b6ab04e89
Signed-off-by: Depeng Shao <[email protected]>
Depeng Shao 3 vuotta sitten
vanhempi
sitoutus
f339796365

+ 10 - 1
drivers/cam_sensor_module/cam_actuator/cam_actuator_dev.c

@@ -629,7 +629,7 @@ int cam_actuator_driver_init(void)
 
 	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
 	if (!dev) {
-		CAM_WARN(CAM_ACTUATOR, "Couldnt Find the i3c-id-table dev node");
+		CAM_DBG(CAM_ACTUATOR, "Couldnt Find the i3c-id-table dev node");
 		return 0;
 	}
 
@@ -661,8 +661,17 @@ i2c_register_err:
 
 void cam_actuator_driver_exit(void)
 {
+	struct device_node *dev;
+
 	platform_driver_unregister(&cam_actuator_platform_driver);
 	i2c_del_driver(&cam_actuator_i2c_driver);
+
+	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
+	if (!dev) {
+		CAM_DBG(CAM_ACTUATOR, "Couldnt Find the i3c-id-table dev node");
+		return;
+	}
+
 	i3c_driver_unregister(&cam_actuator_i3c_driver);
 }
 

+ 10 - 1
drivers/cam_sensor_module/cam_eeprom/cam_eeprom_dev.c

@@ -776,7 +776,7 @@ int cam_eeprom_driver_init(void)
 
 	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
 	if (!dev) {
-		CAM_WARN(CAM_EEPROM, "Couldnt Find the i3c-id-table dev node");
+		CAM_DBG(CAM_EEPROM, "Couldnt Find the i3c-id-table dev node");
 		return 0;
 	}
 
@@ -809,9 +809,18 @@ spi_register_err:
 
 void cam_eeprom_driver_exit(void)
 {
+	struct device_node *dev;
+
 	platform_driver_unregister(&cam_eeprom_platform_driver);
 	spi_unregister_driver(&cam_eeprom_spi_driver);
 	i2c_del_driver(&cam_eeprom_i2c_driver);
+
+	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
+	if (!dev) {
+		CAM_DBG(CAM_EEPROM, "Couldnt Find the i3c-id-table dev node");
+		return;
+	}
+
 	i3c_driver_unregister(&cam_eeprom_i3c_driver);
 }
 

+ 10 - 1
drivers/cam_sensor_module/cam_ois/cam_ois_dev.c

@@ -589,7 +589,7 @@ int cam_ois_driver_init(void)
 
 	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
 	if (!dev) {
-		CAM_WARN(CAM_OIS, "Couldnt Find the i3c-id-table dev node");
+		CAM_DBG(CAM_OIS, "Couldnt Find the i3c-id-table dev node");
 		return 0;
 	}
 
@@ -621,8 +621,17 @@ i2c_register_err:
 
 void cam_ois_driver_exit(void)
 {
+	struct device_node *dev;
+
 	platform_driver_unregister(&cam_ois_platform_driver);
 	i2c_del_driver(&cam_ois_i2c_driver);
+
+	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
+	if (!dev) {
+		CAM_DBG(CAM_EEPROM, "Couldnt Find the i3c-id-table dev node");
+		return;
+	}
+
 	i3c_driver_unregister(&cam_ois_i3c_driver);
 }
 

+ 10 - 1
drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.c

@@ -613,7 +613,7 @@ int cam_sensor_driver_init(void)
 
 	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
 	if (!dev) {
-		CAM_WARN(CAM_SENSOR, "Couldnt Find the i3c-id-table dev node");
+		CAM_DBG(CAM_SENSOR, "Couldnt Find the i3c-id-table dev node");
 		return 0;
 	}
 
@@ -645,8 +645,17 @@ i2c_register_err:
 
 void cam_sensor_driver_exit(void)
 {
+	struct device_node *dev;
+
 	platform_driver_unregister(&cam_sensor_platform_driver);
 	i2c_del_driver(&cam_sensor_i2c_driver);
+
+	dev = of_find_node_by_path(I3C_SENSOR_DEV_ID_DT_PATH);
+	if (!dev) {
+		CAM_DBG(CAM_ACTUATOR, "Couldnt Find the i3c-id-table dev node");
+		return;
+	}
+
 	i3c_driver_unregister(&cam_sensor_i3c_driver);
 }