Skip to contentSkip to conversation

Patch "[media] au0828: Fix dev_state handling" has been added to the 4.5-stable tree

PATCH [email protected] 1 participant 1 message Apr 17, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

[media] au0828: Fix dev_state handling

to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:

     au0828-fix-dev_state-handling.patch

and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e8e3039f5b941f7825d335f8ca11c12a8104db11 Mon Sep 17 00:00:00 2001

From: Mauro Carvalho Chehab <[email protected]>
Date: Tue, 22 Mar 2016 09:21:57 -0300
Subject: [media] au0828: Fix dev_state handling

From: Mauro Carvalho Chehab <[email protected]>

commit e8e3039f5b941f7825d335f8ca11c12a8104db11 upstream.

The au0828 dev_state is actually a bit mask. It should not be checking with "==" but, instead, with a logic and. There are some places where it was doing it wrong.

Fix that by replacing the dev_state set/clear/test with the bitops.

As reviewed by Shuah:
"Looks good. Tested running bind/unbind au0828 loop for 1000 times. Didn't see any problems and the v4l2_querycap() problem has been fixed with this patch.

After the above test, ran bind/unbind snd_usb_audio 1000 times. Didn't see any problems. Generated media graph and the graph looks good."

---
 drivers/media/usb/au0828/au0828-core.c  |    2 -
 drivers/media/usb/au0828/au0828-input.c |    4 +-
 drivers/media/usb/au0828/au0828-video.c |   63 +++++++++++++++-----------------
 drivers/media/usb/au0828/au0828.h       |    9 ++--
 4 files changed, 39 insertions(+), 39 deletions(-)
drivers/media/usb/au0828/au0828-core.c +1 -1
@@ -192,7 +192,7 @@ static void au0828_usb_disconnect(struct
 	   Set the status so poll routines can check and avoid
 	   access after disconnect.
 	*/
-	dev->dev_state = DEV_DISCONNECTED;
+	set_bit(DEV_DISCONNECTED, &dev->dev_state);
 
 	au0828_rc_unregister(dev);
 	/* Digital TV */
drivers/media/usb/au0828/au0828-input.c +2 -2
@@ -130,7 +130,7 @@ static int au0828_get_key_au8522(struct
 	bool first = true;
 
 	/* do nothing if device is disconnected */
-	if (ir->dev->dev_state == DEV_DISCONNECTED)
+	if (test_bit(DEV_DISCONNECTED, &ir->dev->dev_state))
 		return 0;
 
 	/* Check IR int */
@@ -260,7 +260,7 @@ static void au0828_rc_stop(struct rc_dev
 	cancel_delayed_work_sync(&ir->work);
 
 	/* do nothing if device is disconnected */
-	if (ir->dev->dev_state != DEV_DISCONNECTED) {
+	if (!test_bit(DEV_DISCONNECTED, &ir->dev->dev_state)) {
 		/* Disable IR */
 		au8522_rc_clear(ir, 0xe0, 1 << 4);
 	}
drivers/media/usb/au0828/au0828-video.c +31 -32

231 lines not on this page · raw message

drivers/media/usb/au0828/au0828.h +5 -4
@@ -21,6 +21,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/bitops.h>
 #include <linux/usb.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
@@ -122,9 +123,9 @@ enum au0828_stream_state {
 
 /* device state */
 enum au0828_dev_state {
-	DEV_INITIALIZED = 0x01,
-	DEV_DISCONNECTED = 0x02,
-	DEV_MISCONFIGURED = 0x04
+	DEV_INITIALIZED = 0,
+	DEV_DISCONNECTED = 1,
+	DEV_MISCONFIGURED = 2
 };
 
 struct au0828_dev;
@@ -248,7 +249,7 @@ struct au0828_dev {
 	int input_type;
 	int std_set_in_tuner_core;
 	unsigned int ctrl_input;
-	enum au0828_dev_state dev_state;
+	long unsigned int dev_state; /* defined at enum au0828_dev_state */;
 	enum au0828_stream_state stream_state;
 	wait_queue_head_t open;
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.5/v4l-vsp1-set-the-sru-ctrl0-register-when-starting-the-stream.patch queue-4.5/au0828-fix-au0828_v4l2_close-dev_state-race-condition.patch queue-4.5/coda-fix-error-path-in-case-of-missing-pdata-on-non-dt-platform.patch queue-4.5/au0828-fix-dev_state-handling.patch