Skip to contentSkip to conversation

em28xx-video: do not unregister the v4l2 dummy clock before v4l2_device_unregister() has been called

PATCH New Frank Schäfer 1 participant 3 messages Jan 17, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 em28xx-video: do not unregister the v4l2 dummy clock before v4l2_device_unregister() has been called

Otherwiese the core refuses to unregister the clock and the following warning appears in the system log:

"WARNING: ... at drivers/media/v4l2-core/v4l2-clk.c:231 v4l2_clk_unregister+0x8a/0x90 [videodev]()
v4l2_clk_unregister(): Refusing to unregister ref-counted 11-0030:mclk clock!"

---
 drivers/media/usb/em28xx/em28xx-video.c |    6 +++---

1 Datei geändert, 3 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-)

drivers/media/usb/em28xx/em28xx-video.c +3 -3
index c3c9289..09e18da 100644
@@ -1918,14 +1918,14 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
 		video_unregister_device(dev->vdev);
 	}
 
+	v4l2_ctrl_handler_free(&dev->ctrl_handler);
+	v4l2_device_unregister(&dev->v4l2_dev);
+
 	if (dev->clk) {
 		v4l2_clk_unregister_fixed(dev->clk);
 		dev->clk = NULL;
 	}
 
-	v4l2_ctrl_handler_free(&dev->ctrl_handler);
-	v4l2_device_unregister(&dev->v4l2_dev);
-
 	if (dev->users)
 		em28xx_warn("Device is open ! Memory deallocation is deferred on last close.\n");
 	mutex_unlock(&dev->lock);
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/3 em28xx-camera: fix return value checks on sensor probing

Since commit e63b009d6e the returned error code in case of not connected/responding i2c clients is ENXIO isntead of ENODEV, which causes several error messages on sensor probing.
Fix the i2c return value checks on sensor probing to silence these warnings.

---
 drivers/media/usb/em28xx/em28xx-camera.c |    4 ++--

1 Datei geändert, 2 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

drivers/media/usb/em28xx/em28xx-camera.c +2 -2
index c29f5c4..505e050 100644
@@ -120,7 +120,7 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
 		reg = 0x00;
 		ret = i2c_master_send(&client, &reg, 1);
 		if (ret < 0) {
-			if (ret != -ENODEV)
+			if (ret != -ENXIO)
 				em28xx_errdev("couldn't read from i2c device 0x%02x: error %i\n",
 					      client.addr << 1, ret);
 			continue;
@@ -218,7 +218,7 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
 		reg = 0x1c;
 		ret = i2c_smbus_read_byte_data(&client, reg);
 		if (ret < 0) {
-			if (ret != -ENODEV)
+			if (ret != -ENXIO)
 				em28xx_errdev("couldn't read from i2c device 0x%02x: error %i\n",
 					      client.addr << 1, ret);
 			continue;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 3/3 em28xx-v4l: do not call em28xx_init_camera() if the device has no sensor

In reply to Frank Schäfer

This avoids the unnecessary temporary registration of a dummy V4L2 clock.

---
 drivers/media/usb/em28xx/em28xx-video.c |    3 ++-

1 Datei geändert, 2 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

drivers/media/usb/em28xx/em28xx-video.c +2 -1
index 09e18da..2775c90 100644
@@ -2273,7 +2273,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
 	}
 
 	em28xx_tuner_setup(dev);
-	em28xx_init_camera(dev);
+	if (dev->em28xx_sensor != EM28XX_NOSENSOR)
+		em28xx_init_camera(dev);
 
 	/* Configure audio */
 	ret = em28xx_audio_setup(dev);
Signature · 1 line
1.7.10.4