netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] usb: hso: correct debug message
@ 2019-06-06 12:55 Oliver Neukum
  2019-06-06 12:55 ` [PATCH 2/6] usb: hso: no complaint about kmalloc failure Oliver Neukum
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Oliver Neukum @ 2019-06-06 12:55 UTC (permalink / raw)
  To: davem, netdev; +Cc: Oliver Neukum

If you do not find the OUT endpoint, you should say so,
rather than copy the error message for the IN endpoint.
Presumably a copy and paste error.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/hso.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index d6916f787fce..6a0ecddff310 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2663,7 +2663,7 @@ static struct hso_device *hso_create_bulk_serial_device(
 	if (!
 	    (serial->out_endp =
 	     hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT))) {
-		dev_err(&interface->dev, "Failed to find BULK IN ep\n");
+		dev_err(&interface->dev, "Failed to find BULK OUT ep\n");
 		goto exit2;
 	}
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] usb: hso: no complaint about kmalloc failure
  2019-06-06 12:55 [PATCH 1/6] usb: hso: correct debug message Oliver Neukum
@ 2019-06-06 12:55 ` Oliver Neukum
  2019-06-06 12:55 ` [PATCH 3/6] usb: hso: switch definitions to the BIT macro Oliver Neukum
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2019-06-06 12:55 UTC (permalink / raw)
  To: davem, netdev; +Cc: Oliver Neukum

If this fails, kmalloc() will print a report including
a stack trace. There is no need for a separate complaint.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/hso.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 6a0ecddff310..fe1d7bdc8afe 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2474,10 +2474,9 @@ static void hso_create_rfkill(struct hso_device *hso_dev,
 				       &interface_to_usbdev(interface)->dev,
 				       RFKILL_TYPE_WWAN,
 				       &hso_rfkill_ops, hso_dev);
-	if (!hso_net->rfkill) {
-		dev_err(dev, "%s - Out of memory\n", __func__);
+	if (!hso_net->rfkill)
 		return;
-	}
+
 	if (rfkill_register(hso_net->rfkill) < 0) {
 		rfkill_destroy(hso_net->rfkill);
 		hso_net->rfkill = NULL;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] usb: hso: switch definitions to the BIT macro
  2019-06-06 12:55 [PATCH 1/6] usb: hso: correct debug message Oliver Neukum
  2019-06-06 12:55 ` [PATCH 2/6] usb: hso: no complaint about kmalloc failure Oliver Neukum
@ 2019-06-06 12:55 ` Oliver Neukum
  2019-06-06 12:55 ` [PATCH 4/6] usb: hso: declare endianness Oliver Neukum
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2019-06-06 12:55 UTC (permalink / raw)
  To: davem, netdev; +Cc: Oliver Neukum

This is just a minor improvement in readability.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/hso.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index fe1d7bdc8afe..ab18dbe169f3 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -177,13 +177,13 @@ enum rx_ctrl_state{
 #define W_VALUE         (0x0)
 #define W_LENGTH        (0x2)
 
-#define B_OVERRUN       (0x1<<6)
-#define B_PARITY        (0x1<<5)
-#define B_FRAMING       (0x1<<4)
-#define B_RING_SIGNAL   (0x1<<3)
-#define B_BREAK         (0x1<<2)
-#define B_TX_CARRIER    (0x1<<1)
-#define B_RX_CARRIER    (0x1<<0)
+#define B_OVERRUN       BIT(6)
+#define B_PARITY        BIT(5)
+#define B_FRAMING       BIT(4)
+#define B_RING_SIGNAL   BIT(3)
+#define B_BREAK         BIT(2)
+#define B_TX_CARRIER    BIT(1)
+#define B_RX_CARRIER    BIT(0)
 
 struct hso_serial_state_notification {
 	u8 bmRequestType;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] usb: hso: declare endianness
  2019-06-06 12:55 [PATCH 1/6] usb: hso: correct debug message Oliver Neukum
  2019-06-06 12:55 ` [PATCH 2/6] usb: hso: no complaint about kmalloc failure Oliver Neukum
  2019-06-06 12:55 ` [PATCH 3/6] usb: hso: switch definitions to the BIT macro Oliver Neukum
@ 2019-06-06 12:55 ` Oliver Neukum
  2019-06-06 12:55 ` [PATCH 5/6] usb: hso: obey DMA rules in tiocmget Oliver Neukum
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2019-06-06 12:55 UTC (permalink / raw)
  To: davem, netdev; +Cc: Oliver Neukum

The driver declares data structures with defined endianness as
u16. Be more precise.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/hso.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index ab18dbe169f3..7379df01cd98 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -188,10 +188,10 @@ enum rx_ctrl_state{
 struct hso_serial_state_notification {
 	u8 bmRequestType;
 	u8 bNotification;
-	u16 wValue;
-	u16 wIndex;
-	u16 wLength;
-	u16 UART_state_bitmap;
+	__le16 wValue;
+	__le16 wIndex;
+	__le16 wLength;
+	__le16 UART_state_bitmap;
 } __packed;
 
 struct hso_tiocmget {
@@ -201,7 +201,7 @@ struct hso_tiocmget {
 	struct usb_endpoint_descriptor *endp;
 	struct urb *urb;
 	struct hso_serial_state_notification serial_state_notification;
-	u16    prev_UART_state_bitmap;
+	__le16    prev_UART_state_bitmap;
 	struct uart_icount icount;
 };
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] usb: hso: obey DMA rules in tiocmget
  2019-06-06 12:55 [PATCH 1/6] usb: hso: correct debug message Oliver Neukum
                   ` (2 preceding siblings ...)
  2019-06-06 12:55 ` [PATCH 4/6] usb: hso: declare endianness Oliver Neukum
@ 2019-06-06 12:55 ` Oliver Neukum
  2019-06-06 12:55 ` [PATCH 6/6] usb: hso: remove bogus check for EINPROGRESS Oliver Neukum
  2019-06-06 18:18 ` [PATCH 1/6] usb: hso: correct debug message David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2019-06-06 12:55 UTC (permalink / raw)
  To: davem, netdev; +Cc: Oliver Neukum

The serial state information must not be embedded into another
data structure, as this interferes with cache handling for DMA.
Allocating it separately.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/hso.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 7379df01cd98..489024f0ae62 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -200,7 +200,7 @@ struct hso_tiocmget {
 	int    intr_completed;
 	struct usb_endpoint_descriptor *endp;
 	struct urb *urb;
-	struct hso_serial_state_notification serial_state_notification;
+	struct hso_serial_state_notification *serial_state_notification;
 	__le16    prev_UART_state_bitmap;
 	struct uart_icount icount;
 };
@@ -1446,7 +1446,7 @@ static int tiocmget_submit_urb(struct hso_serial *serial,
 			 usb_rcvintpipe(usb,
 					tiocmget->endp->
 					bEndpointAddress & 0x7F),
-			 &tiocmget->serial_state_notification,
+			 tiocmget->serial_state_notification,
 			 sizeof(struct hso_serial_state_notification),
 			 tiocmget_intr_callback, serial,
 			 tiocmget->endp->bInterval);
@@ -1493,7 +1493,7 @@ static void tiocmget_intr_callback(struct urb *urb)
 	/* wIndex should be the USB interface number of the port to which the
 	 * notification applies, which should always be the Modem port.
 	 */
-	serial_state_notification = &tiocmget->serial_state_notification;
+	serial_state_notification = tiocmget->serial_state_notification;
 	if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE ||
 	    serial_state_notification->bNotification != B_NOTIFICATION ||
 	    le16_to_cpu(serial_state_notification->wValue) != W_VALUE ||
@@ -2578,6 +2578,8 @@ static void hso_free_tiomget(struct hso_serial *serial)
 		usb_free_urb(tiocmget->urb);
 		tiocmget->urb = NULL;
 		serial->tiocmget = NULL;
+		kfree(tiocmget->serial_state_notification);
+		tiocmget->serial_state_notification = NULL;
 		kfree(tiocmget);
 	}
 }
@@ -2628,10 +2630,13 @@ static struct hso_device *hso_create_bulk_serial_device(
 		num_urbs = 2;
 		serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget),
 					   GFP_KERNEL);
+		serial->tiocmget->serial_state_notification
+		      	= kzalloc(sizeof(struct hso_serial_state_notification),
+					   GFP_KERNEL);
 		/* it isn't going to break our heart if serial->tiocmget
 		 *  allocation fails don't bother checking this.
 		 */
-		if (serial->tiocmget) {
+		if (serial->tiocmget && serial->tiocmget->serial_state_notification) {
 			tiocmget = serial->tiocmget;
 			tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
 			if (tiocmget->urb) {
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] usb: hso: remove bogus check for EINPROGRESS
  2019-06-06 12:55 [PATCH 1/6] usb: hso: correct debug message Oliver Neukum
                   ` (3 preceding siblings ...)
  2019-06-06 12:55 ` [PATCH 5/6] usb: hso: obey DMA rules in tiocmget Oliver Neukum
@ 2019-06-06 12:55 ` Oliver Neukum
  2019-06-06 18:18 ` [PATCH 1/6] usb: hso: correct debug message David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2019-06-06 12:55 UTC (permalink / raw)
  To: davem, netdev; +Cc: Oliver Neukum

This check makes no sense. It is an inherent race.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/hso.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 489024f0ae62..f7976a6fa570 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -845,8 +845,7 @@ static void hso_net_tx_timeout(struct net_device *net)
 	dev_warn(&net->dev, "Tx timed out.\n");
 
 	/* Tear the waiting frame off the list */
-	if (odev->mux_bulk_tx_urb &&
-	    (odev->mux_bulk_tx_urb->status == -EINPROGRESS))
+	if (odev->mux_bulk_tx_urb)
 		usb_unlink_urb(odev->mux_bulk_tx_urb);
 
 	/* Update statistics */
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/6] usb: hso: correct debug message
  2019-06-06 12:55 [PATCH 1/6] usb: hso: correct debug message Oliver Neukum
                   ` (4 preceding siblings ...)
  2019-06-06 12:55 ` [PATCH 6/6] usb: hso: remove bogus check for EINPROGRESS Oliver Neukum
@ 2019-06-06 18:18 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2019-06-06 18:18 UTC (permalink / raw)
  To: oneukum; +Cc: netdev


Oliver, can you please start providing proper header postings with
your patch series that explains at a high level what the patch series
is doing, how it is doing it, and why it is doing it that way?

Also, you need to tag your Subject lines properly with what tree
you are targetting with these changes.  Either net or net-next.

Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-06 18:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 12:55 [PATCH 1/6] usb: hso: correct debug message Oliver Neukum
2019-06-06 12:55 ` [PATCH 2/6] usb: hso: no complaint about kmalloc failure Oliver Neukum
2019-06-06 12:55 ` [PATCH 3/6] usb: hso: switch definitions to the BIT macro Oliver Neukum
2019-06-06 12:55 ` [PATCH 4/6] usb: hso: declare endianness Oliver Neukum
2019-06-06 12:55 ` [PATCH 5/6] usb: hso: obey DMA rules in tiocmget Oliver Neukum
2019-06-06 12:55 ` [PATCH 6/6] usb: hso: remove bogus check for EINPROGRESS Oliver Neukum
2019-06-06 18:18 ` [PATCH 1/6] usb: hso: correct debug message David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).