netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: netdev@vger.kernel.org
Cc: linux-usb@vger.kernel.org,
	"Alexey Orishko" <alexey.orishko@gmail.com>,
	"Bjørn Mork" <bjorn@mork.no>
Subject: [PATCH net-next 07/24] net: cdc_ncm: remove tx_speed and rx_speed fields
Date: Fri,  1 Nov 2013 11:16:44 +0100	[thread overview]
Message-ID: <1383301021-16613-8-git-send-email-bjorn@mork.no> (raw)
In-Reply-To: <1383301021-16613-1-git-send-email-bjorn@mork.no>

These fields are only used to prevent printing the same speeds
multiple times if we receive multiple identical speed notifications.

The value of these printk's is questionable, and even more so when
we filter out some of the notifications sent us by the firmware. If
we are going to print any of these, then we should print them all.

Removing little used fields is a bonus.

Cc: Alexey Orishko <alexey.orishko@gmail.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/net/usb/cdc_ncm.c   |   37 ++++++++++++++-----------------------
 include/linux/usb/cdc_ncm.h |    2 --
 2 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 9cdd762..fc36a99 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -510,7 +510,6 @@ advance:
 	    ctx->tx_max % usb_maxpacket(dev->udev, dev->out, 1) == 0)
 		ctx->tx_max++;
 
-	ctx->tx_speed = ctx->rx_speed = 0;
 	return 0;
 
 error2:
@@ -1048,7 +1047,6 @@ static void
 cdc_ncm_speed_change(struct usbnet *dev,
 		     struct usb_cdc_speed_change *data)
 {
-	struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
 	uint32_t rx_speed = le32_to_cpu(data->DLBitRRate);
 	uint32_t tx_speed = le32_to_cpu(data->ULBitRate);
 
@@ -1056,25 +1054,20 @@ cdc_ncm_speed_change(struct usbnet *dev,
 	 * Currently the USB-NET API does not support reporting the actual
 	 * device speed. Do print it instead.
 	 */
-	if ((tx_speed != ctx->tx_speed) || (rx_speed != ctx->rx_speed)) {
-		ctx->tx_speed = tx_speed;
-		ctx->rx_speed = rx_speed;
-
-		if ((tx_speed > 1000000) && (rx_speed > 1000000)) {
-			printk(KERN_INFO KBUILD_MODNAME
-			       ": %s: %u mbit/s downlink "
-			       "%u mbit/s uplink\n",
-			       dev->net->name,
-			       (unsigned int)(rx_speed / 1000000U),
-			       (unsigned int)(tx_speed / 1000000U));
-		} else {
-			printk(KERN_INFO KBUILD_MODNAME
-			       ": %s: %u kbit/s downlink "
-			       "%u kbit/s uplink\n",
-			       dev->net->name,
-			       (unsigned int)(rx_speed / 1000U),
-			       (unsigned int)(tx_speed / 1000U));
-		}
+	if ((tx_speed > 1000000) && (rx_speed > 1000000)) {
+		printk(KERN_INFO KBUILD_MODNAME
+		       ": %s: %u mbit/s downlink "
+		       "%u mbit/s uplink\n",
+		       dev->net->name,
+		       (unsigned int)(rx_speed / 1000000U),
+		       (unsigned int)(tx_speed / 1000000U));
+	} else {
+		printk(KERN_INFO KBUILD_MODNAME
+		       ": %s: %u kbit/s downlink "
+		       "%u kbit/s uplink\n",
+		       dev->net->name,
+		       (unsigned int)(rx_speed / 1000U),
+		       (unsigned int)(tx_speed / 1000U));
 	}
 }
 
@@ -1111,8 +1104,6 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
 		       dev->net->name, ctx->connected ? "" : "dis");
 
 		usbnet_link_change(dev, ctx->connected, 0);
-		if (!ctx->connected)
-			ctx->tx_speed = ctx->rx_speed = 0;
 		break;
 
 	case USB_CDC_NOTIFY_SPEED_CHANGE:
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 059dcc9..f14af3d 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -110,8 +110,6 @@ struct cdc_ncm_ctx {
 
 	u32 tx_timer_pending;
 	u32 tx_curr_frame_num;
-	u32 rx_speed;
-	u32 tx_speed;
 	u32 rx_max;
 	u32 tx_max;
 	u32 max_datagram_size;
-- 
1.7.10.4

  parent reply	other threads:[~2013-11-01 10:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 10:16 [PATCH net-next 00/24] cdc_ncm: many small and mostly trivial fixes Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 01/24] net: cdc_ncm: simplify and optimize frame padding Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 02/24] net: cdc_ncm: add include protection to cdc_ncm.h Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 03/24] net: cdc_ncm: remove redundant "intf" field Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 04/24] net: cdc_ncm: remove redundant endpoint pointers Bjørn Mork
2013-11-01 10:16 ` Bjørn Mork [this message]
2013-11-01 10:16 ` [PATCH net-next 08/24] net: cdc_ncm: remove ncm_parm field Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 09/24] net: cdc_ncm: fix SET_MAX_DATAGRAM_SIZE Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 10/24] net: cdc_ncm: remove descriptor pointers Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 11/24] net: cdc_ncm: only the control intf can be probed Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 12/24] net: cdc_ncm: no point in filling up the NTBs if we send ZLPs Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 13/24] net: cdc_ncm: remove probe and disconnect wrappers Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 15/24] net: cdc_ncm: set correct dev->hard_mtu Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 17/24] net: cdc_ncm: use netif_* and dev_* instead of pr_* Bjørn Mork
2013-11-01 10:36   ` Joe Perches
2013-11-04  8:59     ` Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 21/24] net: cdc_ncm: refactoring cdc_ncm_setup Bjørn Mork
2013-11-01 10:16 ` [PATCH net-next 22/24] net: cdc_ncm: return proper error if setup fails Bjørn Mork
     [not found] ` <1383301021-16613-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2013-11-01 10:16   ` [PATCH net-next 05/24] net: cdc_ncm: remove redundant netdev field Bjørn Mork
2013-11-01 10:16   ` [PATCH net-next 06/24] net: cdc_ncm: remove unused udev field Bjørn Mork
2013-11-01 10:16   ` [PATCH net-next 14/24] net: cdc_ncm: remove ethtool ops Bjørn Mork
2013-11-01 10:16   ` [PATCH net-next 16/24] net: cdc_ncm: log the length we warn about Bjørn Mork
2013-11-01 10:16   ` [PATCH net-next 18/24] net: cdc_ncm: log signatures in hex Bjørn Mork
2013-11-01 10:16   ` [PATCH net-next 19/24] net: cdc_ncm: endian convert constants instead of variables Bjørn Mork
2013-11-01 10:16   ` [PATCH net-next 20/24] net: cdc_ncm: drop "extern" from header declarations Bjørn Mork
2013-11-01 10:17   ` [PATCH net-next 23/24] net: cdc_ncm: improve bind error debug messages Bjørn Mork
2013-11-01 10:17 ` [PATCH net-next 24/24] net: cdc_ncm: no not set tx_max higher than the device supports Bjørn Mork
2013-11-02  6:02 ` [PATCH net-next 00/24] cdc_ncm: many small and mostly trivial fixes David Miller

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=1383301021-16613-8-git-send-email-bjorn@mork.no \
    --to=bjorn@mork.no \
    --cc=alexey.orishko@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.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 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).