From patchwork Thu Jun 6 12:55:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 1111116 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45KQdZ2Mffz9s4Y for ; Thu, 6 Jun 2019 22:56:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728027AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:55634 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726040AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 08C4EAC9A; Thu, 6 Jun 2019 12:56:08 +0000 (UTC) From: Oliver Neukum To: davem@davemloft.net, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 1/6] usb: hso: correct debug message Date: Thu, 6 Jun 2019 14:55:43 +0200 Message-Id: <20190606125548.18315-1-oneukum@suse.com> X-Mailer: git-send-email 2.16.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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; } From patchwork Thu Jun 6 12:55:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 1111113 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45KQdV1fg2z9s4Y for ; Thu, 6 Jun 2019 22:56:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728183AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:55632 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727130AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 08C64ADEC; Thu, 6 Jun 2019 12:56:08 +0000 (UTC) From: Oliver Neukum To: davem@davemloft.net, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 2/6] usb: hso: no complaint about kmalloc failure Date: Thu, 6 Jun 2019 14:55:44 +0200 Message-Id: <20190606125548.18315-2-oneukum@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190606125548.18315-1-oneukum@suse.com> References: <20190606125548.18315-1-oneukum@suse.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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; From patchwork Thu Jun 6 12:55:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 1111111 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45KQdQ72BSz9s4Y for ; Thu, 6 Jun 2019 22:56:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728217AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:55630 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727783AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 09A97AE4D; Thu, 6 Jun 2019 12:56:08 +0000 (UTC) From: Oliver Neukum To: davem@davemloft.net, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 3/6] usb: hso: switch definitions to the BIT macro Date: Thu, 6 Jun 2019 14:55:45 +0200 Message-Id: <20190606125548.18315-3-oneukum@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190606125548.18315-1-oneukum@suse.com> References: <20190606125548.18315-1-oneukum@suse.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is just a minor improvement in readability. Signed-off-by: Oliver Neukum --- 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; From patchwork Thu Jun 6 12:55:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 1111115 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45KQdX6Zwgz9s4Y for ; Thu, 6 Jun 2019 22:56:16 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728103AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:55628 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727836AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0CC3BAE87; Thu, 6 Jun 2019 12:56:08 +0000 (UTC) From: Oliver Neukum To: davem@davemloft.net, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 4/6] usb: hso: declare endianness Date: Thu, 6 Jun 2019 14:55:46 +0200 Message-Id: <20190606125548.18315-4-oneukum@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190606125548.18315-1-oneukum@suse.com> References: <20190606125548.18315-1-oneukum@suse.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The driver declares data structures with defined endianness as u16. Be more precise. Signed-off-by: Oliver Neukum --- 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; }; From patchwork Thu Jun 6 12:55:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 1111114 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45KQdV71wRz9sDX for ; Thu, 6 Jun 2019 22:56:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728143AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:55636 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727839AbfFFM4J (ORCPT ); Thu, 6 Jun 2019 08:56:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1DBD9AF3F; Thu, 6 Jun 2019 12:56:08 +0000 (UTC) From: Oliver Neukum To: davem@davemloft.net, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 5/6] usb: hso: obey DMA rules in tiocmget Date: Thu, 6 Jun 2019 14:55:47 +0200 Message-Id: <20190606125548.18315-5-oneukum@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190606125548.18315-1-oneukum@suse.com> References: <20190606125548.18315-1-oneukum@suse.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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) { From patchwork Thu Jun 6 12:55:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 1111112 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45KQdR6gVMz9sDX for ; Thu, 6 Jun 2019 22:56:11 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728296AbfFFM4K (ORCPT ); Thu, 6 Jun 2019 08:56:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:55654 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728175AbfFFM4K (ORCPT ); Thu, 6 Jun 2019 08:56:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2790DAF42; Thu, 6 Jun 2019 12:56:08 +0000 (UTC) From: Oliver Neukum To: davem@davemloft.net, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 6/6] usb: hso: remove bogus check for EINPROGRESS Date: Thu, 6 Jun 2019 14:55:48 +0200 Message-Id: <20190606125548.18315-6-oneukum@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190606125548.18315-1-oneukum@suse.com> References: <20190606125548.18315-1-oneukum@suse.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This check makes no sense. It is an inherent race. Signed-off-by: Oliver Neukum --- 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 */