All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juergen Stuber <starblue@users.sourceforge.net>,
	legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org,
	Johan Hovold <johan@kernel.org>
Subject: [PATCH 06/14] USB: legousbtower: drop redundant interrupt-in running flag
Date: Tue,  5 Nov 2019 09:41:44 +0100	[thread overview]
Message-ID: <20191105084152.16322-7-johan@kernel.org> (raw)
In-Reply-To: <20191105084152.16322-1-johan@kernel.org>

Drop the redundant interrupt-in-running flag, which tried to keep track
of when the interrupt-in URB was in flight. This isn't needed since we
can stop the URB unconditionally in tower_abort_transfers() and the URB
can not be submitted while usb_kill_urb() is running anyway.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/misc/legousbtower.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 937bce23adf0..33533faa019e 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -206,7 +206,6 @@ struct lego_usb_tower {
 	struct usb_endpoint_descriptor* interrupt_in_endpoint;
 	struct urb*		interrupt_in_urb;
 	int			interrupt_in_interval;
-	int			interrupt_in_running;
 	int			interrupt_in_done;
 
 	char*			interrupt_out_buffer;
@@ -379,7 +378,6 @@ static int tower_open (struct inode *inode, struct file *file)
 			  dev,
 			  dev->interrupt_in_interval);
 
-	dev->interrupt_in_running = 1;
 	dev->interrupt_in_done = 0;
 	mb();
 
@@ -387,7 +385,6 @@ static int tower_open (struct inode *inode, struct file *file)
 	if (retval) {
 		dev_err(&dev->udev->dev,
 			"Couldn't submit interrupt_in_urb %d\n", retval);
-		dev->interrupt_in_running = 0;
 		goto unlock_exit;
 	}
 
@@ -450,11 +447,7 @@ static int tower_release (struct inode *inode, struct file *file)
 static void tower_abort_transfers (struct lego_usb_tower *dev)
 {
 	/* shutdown transfer */
-	if (dev->interrupt_in_running) {
-		dev->interrupt_in_running = 0;
-		mb();
-		usb_kill_urb(dev->interrupt_in_urb);
-	}
+	usb_kill_urb(dev->interrupt_in_urb);
 	if (dev->interrupt_out_busy)
 		usb_kill_urb(dev->interrupt_out_urb);
 }
@@ -731,15 +724,11 @@ static void tower_interrupt_in_callback (struct urb *urb)
 	}
 
 resubmit:
-	/* resubmit if we're still running */
-	if (dev->interrupt_in_running) {
-		retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC);
-		if (retval)
-			dev_err(&dev->udev->dev,
-				"%s: usb_submit_urb failed (%d)\n",
-				__func__, retval);
+	retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC);
+	if (retval) {
+		dev_err(&dev->udev->dev, "%s: usb_submit_urb failed (%d)\n",
+			__func__, retval);
 	}
-
 exit:
 	dev->interrupt_in_done = 1;
 	wake_up_interruptible (&dev->read_wait);
-- 
2.23.0


  parent reply	other threads:[~2019-11-05  8:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  8:41 [PATCH 00/14] USB: legousbtower: misc cleanups Johan Hovold
2019-11-05  8:41 ` [PATCH 01/14] USB: legousbtower: drop redundant MODULE_LICENSE ifdef Johan Hovold
2019-11-05  8:41 ` [PATCH 02/14] USB: legousbtower: drop redundant NULL check Johan Hovold
2019-11-05  8:41 ` [PATCH 03/14] USB: legousbtower: zero driver data at allocation Johan Hovold
2019-11-05  8:41 ` [PATCH 04/14] USB: legousbtower: drop redundant open_count check Johan Hovold
2019-11-05  8:41 ` [PATCH 05/14] USB: legousbtower: drop noisy disconnect messages Johan Hovold
2019-11-05  8:41 ` Johan Hovold [this message]
2019-11-05  8:41 ` [PATCH 07/14] USB: legousbtower: stop interrupt-out URB unconditionally Johan Hovold
2019-11-05  8:41 ` [PATCH 08/14] USB: legousbtower: remove tower_abort_transfers() Johan Hovold
2019-11-05  8:41 ` [PATCH 09/14] USB: legousbtower: clean up pointer declarations in driver data Johan Hovold
2019-11-05  8:41 ` [PATCH 10/14] USB: legousbtower: drop unnecessary packed attributes Johan Hovold
2019-11-05  8:41 ` [PATCH 11/14] USB: legousbtower: drop redundant endianness comments Johan Hovold
2019-11-05  8:41 ` [PATCH 12/14] USB: legousbtower: clean up runaway white space Johan Hovold
2019-11-05  8:41 ` [PATCH 13/14] USB: legousbtower: drop superfluous brackets Johan Hovold
2019-11-05  8:41 ` [PATCH 14/14] USB: legousbtower: drop superfluous newlines Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191105084152.16322-7-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=legousb-devel@lists.sourceforge.net \
    --cc=linux-usb@vger.kernel.org \
    --cc=starblue@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.