All of lore.kernel.org
 help / color / mirror / Atom feed
From: A Sun <as1033x@comcast.net>
To: Sean Young <sean@mess.org>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: [PATCH 1/1] [media] mceusb: coding style & comments update for -EPIPE error patches
Date: Sat, 29 Apr 2017 12:05:22 -0400	[thread overview]
Message-ID: <5904B9C2.4000404@comcast.net> (raw)
In-Reply-To: <20170427205424.GA18688@gofer.mess.org>


Cosmetic updates to recent code revisions for better compliance with
https://www.kernel.org/doc/html/latest/process/coding-style.html

This patch depends on an earlier (marked accepted) patch:
  [PATCH v2] [media] mceusb: TX -EPIPE (urb status = -32) lockup fix

Signed-off-by: A Sun <as1033x@comcast.net>
---
 drivers/media/rc/mceusb.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index af46860..66d0be5 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -457,8 +457,11 @@ struct mceusb_dev {
 	u8 txports_cabled;	/* bitmask of transmitters with cable */
 	u8 rxports_active;	/* bitmask of active receive sensors */
 
-	/* async error handler mceusb_deferred_kevent() support
-	 * via workqueue kworker (previously keventd) threads */
+	/*
+	 * support for async error handler mceusb_deferred_kevent()
+	 * where usb_clear_halt(), usb_reset_configuration(),
+	 * usb_reset_device(), etc. must be done in process context
+	 */
 	struct work_struct kevent;
 	unsigned long kevent_flags;
 #		define EVENT_TX_HALT	0
@@ -705,11 +708,10 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
 static void mceusb_defer_kevent(struct mceusb_dev *ir, int kevent)
 {
 	set_bit(kevent, &ir->kevent_flags);
-	if (!schedule_work(&ir->kevent)) {
+	if (!schedule_work(&ir->kevent))
 		dev_err(ir->dev, "kevent %d may have been dropped", kevent);
-	} else {
+	else
 		dev_dbg(ir->dev, "kevent %d scheduled", kevent);
-	}
 }
 
 static void mce_async_callback(struct urb *urb)
@@ -775,14 +777,13 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data,
 	}
 
 	/* outbound data */
-	if (usb_endpoint_xfer_int(ir->usb_ep_out)) {
+	if (usb_endpoint_xfer_int(ir->usb_ep_out))
 		usb_fill_int_urb(async_urb, ir->usbdev, ir->pipe_out,
 				 async_buf, size, mce_async_callback, ir,
 				 ir->usb_ep_out->bInterval);
-	} else {
+	else
 		usb_fill_bulk_urb(async_urb, ir->usbdev, ir->pipe_out,
 				 async_buf, size, mce_async_callback, ir);
-	}
 	memcpy(async_buf, data, size);
 
 	dev_dbg(dev, "send request called (size=%#x)", size);
@@ -1225,13 +1226,12 @@ static void mceusb_deferred_kevent(struct work_struct *work)
 		}
 		clear_bit(EVENT_RX_HALT, &ir->kevent_flags);
 		status = usb_submit_urb(ir->urb_in, GFP_KERNEL);
-		if (status < 0) {
+		if (status < 0)
 			dev_err(ir->dev, "rx unhalt submit urb error %d",
 				status);
-			goto done_rx_halt;
-		}
 	}
 done_rx_halt:
+
 	if (test_bit(EVENT_TX_HALT, &ir->kevent_flags)) {
 		status = usb_clear_halt(ir->usbdev, ir->pipe_out);
 		if (status < 0) {
@@ -1242,6 +1242,7 @@ static void mceusb_deferred_kevent(struct work_struct *work)
 		clear_bit(EVENT_TX_HALT, &ir->kevent_flags);
 	}
 done_tx_halt:
+
 	return;
 }
 
@@ -1397,13 +1398,12 @@ static int mceusb_dev_probe(struct usb_interface *intf,
 
 	/* Saving usb interface data for use by the transmitter routine */
 	ir->usb_ep_out = ep_out;
-	if (usb_endpoint_xfer_int(ir->usb_ep_out)) {
+	if (usb_endpoint_xfer_int(ir->usb_ep_out))
 		ir->pipe_out = usb_sndintpipe(ir->usbdev,
 					ir->usb_ep_out->bEndpointAddress);
-	} else {
+	else
 		ir->pipe_out = usb_sndbulkpipe(ir->usbdev,
 					ir->usb_ep_out->bEndpointAddress);
-	}
 
 	if (dev->descriptor.iManufacturer
 	    && usb_string(dev, dev->descriptor.iManufacturer,
@@ -1415,8 +1415,10 @@ static int mceusb_dev_probe(struct usb_interface *intf,
 		snprintf(name + strlen(name), sizeof(name) - strlen(name),
 			 " %s", buf);
 
-	/* initialize async USB error handler before registering
-	 * or activating any mceusb RX and TX functions */
+	/*
+	 * async USB error handler must initialize before registering
+	 * or activating any mceusb RX or TX functions
+	 */
 	INIT_WORK(&ir->kevent, mceusb_deferred_kevent);
 
 	ir->rc = mceusb_init_rc_dev(ir);
@@ -1424,13 +1426,12 @@ static int mceusb_dev_probe(struct usb_interface *intf,
 		goto rc_dev_fail;
 
 	/* wire up inbound data handler */
-	if (usb_endpoint_xfer_int(ep_in)) {
+	if (usb_endpoint_xfer_int(ep_in))
 		usb_fill_int_urb(ir->urb_in, dev, pipe, ir->buf_in, maxp,
 				mceusb_dev_recv, ir, ep_in->bInterval);
-	} else {
+	else
 		usb_fill_bulk_urb(ir->urb_in, dev, pipe, ir->buf_in, maxp,
 				mceusb_dev_recv, ir);
-	}
 	ir->urb_in->transfer_dma = ir->dma_in;
 	ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
-- 
2.1.4

      parent reply	other threads:[~2017-04-29 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  0:09 [PATCH] [media] mceusb: TX -EPIPE (urb status = -32) lockup fix A Sun
2017-04-13  8:06 ` [PATCH v2] " A Sun
2017-04-27 20:54   ` Sean Young
2017-04-29 16:04     ` [PATCH 0/1] [media] mceusb: coding style & comments update, for -EPIPE error patches A Sun
2017-04-29 16:05     ` A Sun [this message]

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=5904B9C2.4000404@comcast.net \
    --to=as1033x@comcast.net \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=sean@mess.org \
    /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.