Re: High CPU load produced by USB (DW2)

2018-02-07 Thread gregkh
On Wed, Feb 07, 2018 at 10:48:57AM +0100, Mirza Krak wrote:
> Hi.
> 
> I initially started a thread on a different mailing list [1], and you
> can take look there for some additional background.
> 
> I am using a 4.14.15 stable kernel on a RK3288 SoC (FireFly RK3288
> board) which uses the DW2 USB core. I have noticed that when
> connecting a USB device there is unreasonable high CPU load produced
> by the USB interrupts.

That's a normal problem with that kind of hardware.  I've seen devices
with that type of USB core take a 30% cpu usage just when you plug a USB
keyboard into the device.

There's not much the kernel can do about horrible hardware, sorry, go
complain to the device manufacturer :(

> Here is one example with a MIDI keyboard connected on USB (not really
> doing anything on it)
> 
>79 2 root SW   0   0%  19% [irq/45-dwc2_hso]
>78 2 root SW   0   0%  11% [irq/45-ff54]

It doesn't matter if anything is happening on the device, USB goes and
polls the device all the time, that's just the way that the protocol
works.  With hardware like this, that polling is done by the kernel
driver/CPU and does not have offload capability to the USB controller to
handle this type of housekeeping.  Because of that, you see tons of CPU
interrupts and a high load.

Again, not much we can do about that, sorry :(

good luck!

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "USB: usbip: convert to use DRIVER_ATTR_RW" added to driver-core-next

2017-06-13 Thread gregkh

This is a note to let you know that I've just added the patch titled

USB: usbip: convert to use DRIVER_ATTR_RW

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From cc3d53def83a99636e16ceb70a79eedc61fddc23 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Date: Fri, 9 Jun 2017 11:03:14 +0200
Subject: USB: usbip: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and the usbip driver
attribute can be trivially changed to use DRIVER_ATTR_RW().

Cc: Valentina Manea <valentina.mane...@gmail.com>
Cc: <linux-usb@vger.kernel.org>
Acked-by: Shuah Khan <shua...@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/usb/usbip/stub_main.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index 44ab43fc4fcc..e74fbb7f4a32 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -134,7 +134,7 @@ int del_match_busid(char *busid)
return ret;
 }
 
-static ssize_t show_match_busid(struct device_driver *drv, char *buf)
+static ssize_t match_busid_show(struct device_driver *drv, char *buf)
 {
int i;
char *out = buf;
@@ -149,7 +149,7 @@ static ssize_t show_match_busid(struct device_driver *drv, 
char *buf)
return out - buf;
 }
 
-static ssize_t store_match_busid(struct device_driver *dev, const char *buf,
+static ssize_t match_busid_store(struct device_driver *dev, const char *buf,
 size_t count)
 {
int len;
@@ -181,8 +181,7 @@ static ssize_t store_match_busid(struct device_driver *dev, 
const char *buf,
 
return -EINVAL;
 }
-static DRIVER_ATTR(match_busid, S_IRUSR | S_IWUSR, show_match_busid,
-  store_match_busid);
+static DRIVER_ATTR_RW(match_busid);
 
 static ssize_t rebind_store(struct device_driver *dev, const char *buf,
 size_t count)
-- 
2.13.1


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "USB: usbip: convert to use DRIVER_ATTR_RW" added to driver-core-testing

2017-06-12 Thread gregkh

This is a note to let you know that I've just added the patch titled

USB: usbip: convert to use DRIVER_ATTR_RW

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the driver-core-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From cc3d53def83a99636e16ceb70a79eedc61fddc23 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Date: Fri, 9 Jun 2017 11:03:14 +0200
Subject: USB: usbip: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and the usbip driver
attribute can be trivially changed to use DRIVER_ATTR_RW().

Cc: Valentina Manea <valentina.mane...@gmail.com>
Cc: <linux-usb@vger.kernel.org>
Acked-by: Shuah Khan <shua...@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/usb/usbip/stub_main.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index 44ab43fc4fcc..e74fbb7f4a32 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -134,7 +134,7 @@ int del_match_busid(char *busid)
return ret;
 }
 
-static ssize_t show_match_busid(struct device_driver *drv, char *buf)
+static ssize_t match_busid_show(struct device_driver *drv, char *buf)
 {
int i;
char *out = buf;
@@ -149,7 +149,7 @@ static ssize_t show_match_busid(struct device_driver *drv, 
char *buf)
return out - buf;
 }
 
-static ssize_t store_match_busid(struct device_driver *dev, const char *buf,
+static ssize_t match_busid_store(struct device_driver *dev, const char *buf,
 size_t count)
 {
int len;
@@ -181,8 +181,7 @@ static ssize_t store_match_busid(struct device_driver *dev, 
const char *buf,
 
return -EINVAL;
 }
-static DRIVER_ATTR(match_busid, S_IRUSR | S_IWUSR, show_match_busid,
-  store_match_busid);
+static DRIVER_ATTR_RW(match_busid);
 
 static ssize_t rebind_store(struct device_driver *dev, const char *buf,
 size_t count)
-- 
2.13.1


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: ip: remove unnecessary & operation" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: ip: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 14f91dd524c42cdf137bda01c44e5e2f69a4c25e Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: ip: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Valentina Manea <valentina.mane...@gmail.com>
Cc: Shuah Khan <sh...@kernel.org>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/usbip/vudc_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
index 7091848df6c8..2fdcdeb13a86 100644
--- a/drivers/usb/usbip/vudc_dev.c
+++ b/drivers/usb/usbip/vudc_dev.c
@@ -259,7 +259,7 @@ static int vep_enable(struct usb_ep *_ep,
 
spin_lock_irqsave(>lock, flags);
 
-   maxp = usb_endpoint_maxp(desc) & 0x7ff;
+   maxp = usb_endpoint_maxp(desc);
_ep->maxpacket = maxp;
ep->desc = desc;
ep->type = usb_endpoint_type(desc);
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: bdc: remove unnecessary & operation" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: bdc: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From cc2e895c604c480b7bc9603bc51963158bdb3b8c Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: gadget: udc: bdc: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Ashwini Pahuja <ashwini.li...@gmail.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/bdc/bdc_ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c 
b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index ccaa74ab6c0e..ff1ef24d1777 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -446,7 +446,7 @@ static int setup_bd_list_xfr(struct bdc *bdc, struct 
bdc_req *req, int num_bds)
bd_xfr->start_bdi = bd_list->eqp_bdi;
bd = bdi_to_bd(ep, bd_list->eqp_bdi);
req_len = req->usb_req.length;
-   maxp = usb_endpoint_maxp(ep->desc) & 0x7ff;
+   maxp = usb_endpoint_maxp(ep->desc);
tfs = roundup(req->usb_req.length, maxp);
tfs = tfs/maxp;
dev_vdbg(bdc->dev, "%s ep:%s num_bds:%d tfs:%d r_len:%d bd:%p\n",
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: core: devices: remove unnecessary & operation" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: core: devices: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From c091b6b34b55423c023c91924babccf32528a430 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: core: devices: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>
Acked-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/core/devices.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index 00d1b26a81d3..f2987ddb1cde 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -227,7 +227,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char 
*start, char *end,
 
start += sprintf(start, format_endpt, desc->bEndpointAddress, dir,
 desc->bmAttributes, type,
-(usb_endpoint_maxp(desc) & 0x07ff) *
+usb_endpoint_maxp(desc) *
 bandwidth,
 interval, unit);
return start;
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: host: ehci: remove unnecessary max_packet() macro" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: host: ehci: remove unnecessary max_packet() macro

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 8437ab99a68363a1c56270932f705e56ff2b6b37 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Fri, 30 Sep 2016 11:24:59 +0300
Subject: usb: host: ehci: remove unnecessary max_packet() macro

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove this macro
from the driver.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/host/ehci-q.c | 22 +-
 drivers/usb/host/ehci-sched.c |  1 -
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index a45a5dc7ed9f..8f3f055c05fa 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -550,9 +550,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
 
 /*-*/
 
-// ... and packet size, for any kind of endpoint descriptor
-#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
-
 /*
  * reverse of qh_urb_transaction:  free a list of TDs.
  * used for cleanup after errors, before HC sees an URB's TDs.
@@ -649,7 +646,7 @@ qh_urb_transaction (
token |= (1 /* "in" */ << 8);
/* else it's already initted to "out" pid (0 << 8) */
 
-   maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input));
+   maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
 
/*
 * buffer gets wrapped in one or more qtds;
@@ -788,14 +785,14 @@ qh_make (
is_input = usb_pipein (urb->pipe);
type = usb_pipetype (urb->pipe);
ep = usb_pipe_endpoint (urb->dev, urb->pipe);
-   maxp = usb_maxpacket (urb->dev, urb->pipe, !is_input);
+   maxp = usb_endpoint_maxp (>desc);
mult = usb_endpoint_maxp_mult (>desc);
 
/* 1024 byte maxpacket is a hardware ceiling.  High bandwidth
 * acts like up to 3KB, but is built from smaller packets.
 */
-   if (max_packet(maxp) > 1024) {
-   ehci_dbg(ehci, "bogus qh maxpacket %d\n", max_packet(maxp));
+   if (maxp > 1024) {
+   ehci_dbg(ehci, "bogus qh maxpacket %d\n", maxp);
goto done;
}
 
@@ -811,8 +808,7 @@ qh_make (
unsignedtmp;
 
qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
-   is_input, 0,
-   mult * max_packet(maxp)));
+   is_input, 0, mult * maxp));
qh->ps.phase = NO_FRAME;
 
if (urb->dev->speed == USB_SPEED_HIGH) {
@@ -856,7 +852,7 @@ qh_make (
think_time = tt ? tt->think_time : 0;
qh->ps.tt_usecs = NS_TO_US(think_time +
usb_calc_bus_time (urb->dev->speed,
-   is_input, 0, max_packet (maxp)));
+   is_input, 0, maxp));
if (urb->interval > ehci->periodic_size)
urb->interval = ehci->periodic_size;
qh->ps.period = urb->interval;
@@ -927,10 +923,10 @@ qh_make (
 * to help them do so.  So now people expect to use
 * such nonconformant devices with Linux too; sigh.
 */
-   info1 |= max_packet(maxp) << 16;
+   info1 |= maxp << 16;
info2 |= (EHCI_TUNE_MULT_HS << 30);
} else {/* PIPE_INTERRUPT */
-   info1 |= max_packet (maxp) << 16;
+   info1 |= maxp << 16;
info2 |= mult << 30;
}
break;
@@ -1223,7 +1219,7 @@ static int submit_single_step_set_feature(
 
token |= (1 /* "in" */ << 8);  /*This is IN stage*/
 
-   maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, 0));
+   maxpacket = usb_maxpacket(urb->dev, urb->pipe, 0);
 
qtd_fill(ehci, qtd, buf, len, token, maxp

patch "usb: gadget: udc: atmel: remove unnecessary & operation" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: atmel: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 44fbbf1f837f99cae0970bd72fefd72d90d73016 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: gadget: udc: atmel: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Acked-by: Nicolas Ferre <nicolas.fe...@atmel.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index c57012b1ddf4..125680db9379 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -529,7 +529,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct 
usb_endpoint_descriptor *desc)
 
DBG(DBG_GADGET, "%s: ep_enable: desc=%p\n", ep->ep.name, desc);
 
-   maxpacket = usb_endpoint_maxp(desc) & 0x7ff;
+   maxpacket = usb_endpoint_maxp(desc);
 
if (((desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) != ep->index)
|| ep->index == 0
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: dummy: remove unnecessary & operation" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: dummy: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From c2b4d863e1dcb7f5b71926a45ee20de2f2c26cb2 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: gadget: udc: dummy: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/dummy_hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c 
b/drivers/usb/gadget/udc/dummy_hcd.c
index 14004cf88d4d..02b14e91ae6c 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -503,7 +503,7 @@ static int dummy_enable(struct usb_ep *_ep,
 * maximum packet size.
 * For SS devices the wMaxPacketSize is limited by 1024.
 */
-   max = usb_endpoint_maxp(desc) & 0x7ff;
+   max = usb_endpoint_maxp(desc);
 
/* drivers must not request bad settings, since lower levels
 * (hardware or its drivers) may not check.  some endpoints
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: host: xhci: make use of new usb_endpoint_maxp_mult()" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: host: xhci: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From dcf5228c1c78c217eedade8455e20af32d359e00 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:39:22 +0300
Subject: usb: host: xhci: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Mathias Nyman <mathias.ny...@intel.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/host/xhci-mem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 6afe32381209..679672da58ed 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1370,7 +1370,7 @@ static u32 xhci_get_endpoint_max_burst(struct usb_device 
*udev,
if (udev->speed == USB_SPEED_HIGH &&
(usb_endpoint_xfer_isoc(>desc) ||
 usb_endpoint_xfer_int(>desc)))
-   return (usb_endpoint_maxp(>desc) & 0x1800) >> 11;
+   return usb_endpoint_maxp_mult(>desc) - 1;
 
return 0;
 }
@@ -1416,9 +1416,9 @@ static u32 xhci_get_max_esit_payload(struct usb_device 
*udev,
return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
 
max_packet = GET_MAX_PACKET(usb_endpoint_maxp(>desc));
-   max_burst = (usb_endpoint_maxp(>desc) & 0x1800) >> 11;
+   max_burst = usb_endpoint_maxp_mult(>desc);
/* A 0 in max burst means 1 transfer per ESIT */
-   return max_packet * (max_burst + 1);
+   return max_packet * max_burst;
 }
 
 /* Set up an endpoint with one ring segment.  Do not allocate stream rings.
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: chipidea: udc: remove unnecessary & operation" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: chipidea: udc: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 63b9e901e461079f8efe5d7b60ffaa3ce88a0262 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: chipidea: udc: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/chipidea/udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 7a535be3024e..a7b383dc3d07 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1253,7 +1253,7 @@ static int ep_enable(struct usb_ep *ep,
hwep->num  = usb_endpoint_num(desc);
hwep->type = usb_endpoint_type(desc);
 
-   hwep->ep.maxpacket = usb_endpoint_maxp(desc) & 0x07ff;
+   hwep->ep.maxpacket = usb_endpoint_maxp(desc);
hwep->ep.mult = usb_endpoint_maxp_mult(desc);
 
if (hwep->type == USB_ENDPOINT_XFER_CONTROL)
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: atmel: make use of new usb_endpoint_maxp_mult()" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: atmel: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From f0419d9fdf402b4ac07db974df9f3cd3f5de2cdd Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:28:44 +0300
Subject: usb: gadget: udc: atmel: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Acked-by: Nicolas Ferre <nicolas.fe...@atmel.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 45bc997d0711..c57012b1ddf4 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -573,7 +573,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct 
usb_endpoint_descriptor *desc)
 * Bits 11:12 specify number of _additional_
 * transactions per microframe.
 */
-   nr_trans = ((usb_endpoint_maxp(desc) >> 11) & 3) + 1;
+   nr_trans = usb_endpoint_maxp_mult(desc);
if (nr_trans > 3)
return -EINVAL;
 
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: core: devices: make use of new usb_endpoint_maxp_mult()" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: core: devices: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 91f97521bb3f42f7a0447c130c789cb7c1810714 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:27:55 +0300
Subject: usb: core: devices: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>
Acked-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/core/devices.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index ef04b50e6bbb..00d1b26a81d3 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -182,14 +182,8 @@ static char *usb_dump_endpoint_descriptor(int speed, char 
*start, char *end,
 
dir = usb_endpoint_dir_in(desc) ? 'I' : 'O';
 
-   if (speed == USB_SPEED_HIGH) {
-   switch (usb_endpoint_maxp(desc) & (0x03 << 11)) {
-   case 1 << 11:
-   bandwidth = 2; break;
-   case 2 << 11:
-   bandwidth = 3; break;
-   }
-   }
+   if (speed == USB_SPEED_HIGH)
+   bandwidth = usb_endpoint_maxp_mult(desc);
 
/* this isn't checking for illegal values */
switch (usb_endpoint_type(desc)) {
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: bdc: make use of new usb_endpoint_maxp_mult()" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: bdc: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 1f5bba7381c58670dbb1b50885b45c2660e12eb5 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:29:39 +0300
Subject: usb: gadget: udc: bdc: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Ashwini Pahuja <ashwini.li...@gmail.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/bdc/bdc_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.c 
b/drivers/usb/gadget/udc/bdc/bdc_cmd.c
index 4d5e9188beae..6e920f1dce02 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_cmd.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.c
@@ -182,7 +182,7 @@ int bdc_config_ep(struct bdc *bdc, struct bdc_ep *ep)
usb_endpoint_xfer_int(desc)) {
param2 |= si;
 
-   mbs = (usb_endpoint_maxp(desc) & 0x1800) >> 11;
+   mbs = usb_endpoint_maxp_mult(desc);
param2 |= mbs << MB_SHIFT;
}
break;
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: host: ehci: make use of new usb_endpoint_maxp_mult()" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: host: ehci: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From e3b89080f2c50936a9f6eccedb1e07e293777f0a Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:38:18 +0300
Subject: usb: host: ehci: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/host/ehci-q.c | 10 ++
 drivers/usb/host/ehci-sched.c |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index eca3710d8fc4..a45a5dc7ed9f 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -550,8 +550,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
 
 /*-*/
 
-// high bandwidth multiplier, as encoded in highspeed endpoint descriptors
-#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
 // ... and packet size, for any kind of endpoint descriptor
 #define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
 
@@ -770,9 +768,11 @@ qh_make (
gfp_t   flags
 ) {
struct ehci_qh  *qh = ehci_qh_alloc (ehci, flags);
+   struct usb_host_endpoint *ep;
u32 info1 = 0, info2 = 0;
int is_input, type;
int maxp = 0;
+   int mult;
struct usb_tt   *tt = urb->dev->tt;
struct ehci_qh_hw   *hw;
 
@@ -787,7 +787,9 @@ qh_make (
 
is_input = usb_pipein (urb->pipe);
type = usb_pipetype (urb->pipe);
+   ep = usb_pipe_endpoint (urb->dev, urb->pipe);
maxp = usb_maxpacket (urb->dev, urb->pipe, !is_input);
+   mult = usb_endpoint_maxp_mult (>desc);
 
/* 1024 byte maxpacket is a hardware ceiling.  High bandwidth
 * acts like up to 3KB, but is built from smaller packets.
@@ -810,7 +812,7 @@ qh_make (
 
qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
is_input, 0,
-   hb_mult(maxp) * max_packet(maxp)));
+   mult * max_packet(maxp)));
qh->ps.phase = NO_FRAME;
 
if (urb->dev->speed == USB_SPEED_HIGH) {
@@ -929,7 +931,7 @@ qh_make (
info2 |= (EHCI_TUNE_MULT_HS << 30);
} else {/* PIPE_INTERRUPT */
info1 |= max_packet (maxp) << 16;
-   info2 |= hb_mult (maxp) << 30;
+   info2 |= mult << 30;
}
break;
default:
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 1dfe54f14737..6a9fa2c3a24e 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1064,7 +1064,7 @@ iso_stream_init(
 
/* knows about ITD vs SITD */
if (dev->speed == USB_SPEED_HIGH) {
-   unsigned multi = hb_mult(maxp);
+   unsigned multi = usb_endpoint_maxp_mult(>ep->desc);
 
stream->highspeed = 1;
 
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: dummy: make use of new usb_endpoint_maxp_mult()" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: dummy: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From ee8ac85596ec0b45c7dd49e2a2a0af50f98542cd Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:30:59 +0300
Subject: usb: gadget: udc: dummy: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/dummy_hcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c 
b/drivers/usb/gadget/udc/dummy_hcd.c
index 77d07904f932..14004cf88d4d 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -1483,8 +1483,7 @@ static int periodic_bytes(struct dummy *dum, struct 
dummy_ep *ep)
int tmp;
 
/* high bandwidth mode */
-   tmp = usb_endpoint_maxp(ep->desc);
-   tmp = (tmp >> 11) & 0x03;
+   tmp = usb_endpoint_maxp_mult(ep->desc);
tmp *= 8 /* applies to entire frame */;
limit += limit * tmp;
}
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: chipidea: udc: make use of new usb_endpoint_maxp_mult()" added to usb-next

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: chipidea: udc: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From a98e25e71d115702d79ef0f4f8009ce5d4cf37eb Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:26:18 +0300
Subject: usb: chipidea: udc: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Acked-by: Peter Chen <peter.c...@nxp.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/chipidea/udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 661f43fe0f9e..7a535be3024e 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -821,7 +821,7 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request 
*req,
}
 
if (usb_endpoint_xfer_isoc(hwep->ep.desc) &&
-   hwreq->req.length > (1 + hwep->ep.mult) * hwep->ep.maxpacket) {
+   hwreq->req.length > hwep->ep.mult * hwep->ep.maxpacket) {
dev_err(hwep->ci->dev, "request length too big for 
isochronous\n");
return -EMSGSIZE;
}
@@ -1254,7 +1254,7 @@ static int ep_enable(struct usb_ep *ep,
hwep->type = usb_endpoint_type(desc);
 
hwep->ep.maxpacket = usb_endpoint_maxp(desc) & 0x07ff;
-   hwep->ep.mult = QH_ISO_MULT(usb_endpoint_maxp(desc));
+   hwep->ep.mult = usb_endpoint_maxp_mult(desc);
 
if (hwep->type == USB_ENDPOINT_XFER_CONTROL)
cap |= QH_IOS;
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: host: ehci: remove unnecessary max_packet() macro" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: host: ehci: remove unnecessary max_packet() macro

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 8437ab99a68363a1c56270932f705e56ff2b6b37 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Fri, 30 Sep 2016 11:24:59 +0300
Subject: usb: host: ehci: remove unnecessary max_packet() macro

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove this macro
from the driver.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/host/ehci-q.c | 22 +-
 drivers/usb/host/ehci-sched.c |  1 -
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index a45a5dc7ed9f..8f3f055c05fa 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -550,9 +550,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
 
 /*-*/
 
-// ... and packet size, for any kind of endpoint descriptor
-#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
-
 /*
  * reverse of qh_urb_transaction:  free a list of TDs.
  * used for cleanup after errors, before HC sees an URB's TDs.
@@ -649,7 +646,7 @@ qh_urb_transaction (
token |= (1 /* "in" */ << 8);
/* else it's already initted to "out" pid (0 << 8) */
 
-   maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input));
+   maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
 
/*
 * buffer gets wrapped in one or more qtds;
@@ -788,14 +785,14 @@ qh_make (
is_input = usb_pipein (urb->pipe);
type = usb_pipetype (urb->pipe);
ep = usb_pipe_endpoint (urb->dev, urb->pipe);
-   maxp = usb_maxpacket (urb->dev, urb->pipe, !is_input);
+   maxp = usb_endpoint_maxp (>desc);
mult = usb_endpoint_maxp_mult (>desc);
 
/* 1024 byte maxpacket is a hardware ceiling.  High bandwidth
 * acts like up to 3KB, but is built from smaller packets.
 */
-   if (max_packet(maxp) > 1024) {
-   ehci_dbg(ehci, "bogus qh maxpacket %d\n", max_packet(maxp));
+   if (maxp > 1024) {
+   ehci_dbg(ehci, "bogus qh maxpacket %d\n", maxp);
goto done;
}
 
@@ -811,8 +808,7 @@ qh_make (
unsignedtmp;
 
qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
-   is_input, 0,
-   mult * max_packet(maxp)));
+   is_input, 0, mult * maxp));
qh->ps.phase = NO_FRAME;
 
if (urb->dev->speed == USB_SPEED_HIGH) {
@@ -856,7 +852,7 @@ qh_make (
think_time = tt ? tt->think_time : 0;
qh->ps.tt_usecs = NS_TO_US(think_time +
usb_calc_bus_time (urb->dev->speed,
-   is_input, 0, max_packet (maxp)));
+   is_input, 0, maxp));
if (urb->interval > ehci->periodic_size)
urb->interval = ehci->periodic_size;
qh->ps.period = urb->interval;
@@ -927,10 +923,10 @@ qh_make (
 * to help them do so.  So now people expect to use
 * such nonconformant devices with Linux too; sigh.
 */
-   info1 |= max_packet(maxp) << 16;
+   info1 |= maxp << 16;
info2 |= (EHCI_TUNE_MULT_HS << 30);
} else {/* PIPE_INTERRUPT */
-   info1 |= max_packet (maxp) << 16;
+   info1 |= maxp << 16;
info2 |= mult << 30;
}
break;
@@ -1223,7 +1219,7 @@ static int submit_single_step_set_feature(
 
token |= (1 /* "in" */ << 8);  /*This is IN stage*/
 
-   maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, 0));
+   maxpacket = usb_maxpacket(urb->dev, urb->pipe, 0);
 
qtd_fill(ehci, qtd, bu

patch "usb: gadget: udc: dummy: remove unnecessary & operation" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: dummy: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From c2b4d863e1dcb7f5b71926a45ee20de2f2c26cb2 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: gadget: udc: dummy: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/dummy_hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c 
b/drivers/usb/gadget/udc/dummy_hcd.c
index 14004cf88d4d..02b14e91ae6c 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -503,7 +503,7 @@ static int dummy_enable(struct usb_ep *_ep,
 * maximum packet size.
 * For SS devices the wMaxPacketSize is limited by 1024.
 */
-   max = usb_endpoint_maxp(desc) & 0x7ff;
+   max = usb_endpoint_maxp(desc);
 
/* drivers must not request bad settings, since lower levels
 * (hardware or its drivers) may not check.  some endpoints
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: ip: remove unnecessary & operation" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: ip: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 14f91dd524c42cdf137bda01c44e5e2f69a4c25e Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: ip: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Valentina Manea <valentina.mane...@gmail.com>
Cc: Shuah Khan <sh...@kernel.org>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/usbip/vudc_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
index 7091848df6c8..2fdcdeb13a86 100644
--- a/drivers/usb/usbip/vudc_dev.c
+++ b/drivers/usb/usbip/vudc_dev.c
@@ -259,7 +259,7 @@ static int vep_enable(struct usb_ep *_ep,
 
spin_lock_irqsave(>lock, flags);
 
-   maxp = usb_endpoint_maxp(desc) & 0x7ff;
+   maxp = usb_endpoint_maxp(desc);
_ep->maxpacket = maxp;
ep->desc = desc;
ep->type = usb_endpoint_type(desc);
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: core: devices: remove unnecessary & operation" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: core: devices: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From c091b6b34b55423c023c91924babccf32528a430 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: core: devices: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>
Acked-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/core/devices.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index 00d1b26a81d3..f2987ddb1cde 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -227,7 +227,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char 
*start, char *end,
 
start += sprintf(start, format_endpt, desc->bEndpointAddress, dir,
 desc->bmAttributes, type,
-(usb_endpoint_maxp(desc) & 0x07ff) *
+usb_endpoint_maxp(desc) *
 bandwidth,
 interval, unit);
return start;
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: bdc: remove unnecessary & operation" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: bdc: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From cc2e895c604c480b7bc9603bc51963158bdb3b8c Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: gadget: udc: bdc: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Ashwini Pahuja <ashwini.li...@gmail.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/bdc/bdc_ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c 
b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index ccaa74ab6c0e..ff1ef24d1777 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -446,7 +446,7 @@ static int setup_bd_list_xfr(struct bdc *bdc, struct 
bdc_req *req, int num_bds)
bd_xfr->start_bdi = bd_list->eqp_bdi;
bd = bdi_to_bd(ep, bd_list->eqp_bdi);
req_len = req->usb_req.length;
-   maxp = usb_endpoint_maxp(ep->desc) & 0x7ff;
+   maxp = usb_endpoint_maxp(ep->desc);
tfs = roundup(req->usb_req.length, maxp);
tfs = tfs/maxp;
dev_vdbg(bdc->dev, "%s ep:%s num_bds:%d tfs:%d r_len:%d bd:%p\n",
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: atmel: remove unnecessary & operation" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: atmel: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 44fbbf1f837f99cae0970bd72fefd72d90d73016 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: gadget: udc: atmel: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Acked-by: Nicolas Ferre <nicolas.fe...@atmel.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index c57012b1ddf4..125680db9379 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -529,7 +529,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct 
usb_endpoint_descriptor *desc)
 
DBG(DBG_GADGET, "%s: ep_enable: desc=%p\n", ep->ep.name, desc);
 
-   maxpacket = usb_endpoint_maxp(desc) & 0x7ff;
+   maxpacket = usb_endpoint_maxp(desc);
 
if (((desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) != ep->index)
|| ep->index == 0
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: chipidea: udc: remove unnecessary & operation" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: chipidea: udc: remove unnecessary & operation

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 63b9e901e461079f8efe5d7b60ffaa3ce88a0262 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 14:17:38 +0300
Subject: usb: chipidea: udc: remove unnecessary & operation

Now that usb_endpoint_maxp() only returns the lowest
11 bits from wMaxPacketSize, we can remove the &
operation from this driver.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/chipidea/udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 7a535be3024e..a7b383dc3d07 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1253,7 +1253,7 @@ static int ep_enable(struct usb_ep *ep,
hwep->num  = usb_endpoint_num(desc);
hwep->type = usb_endpoint_type(desc);
 
-   hwep->ep.maxpacket = usb_endpoint_maxp(desc) & 0x07ff;
+   hwep->ep.maxpacket = usb_endpoint_maxp(desc);
hwep->ep.mult = usb_endpoint_maxp_mult(desc);
 
if (hwep->type == USB_ENDPOINT_XFER_CONTROL)
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: host: xhci: make use of new usb_endpoint_maxp_mult()" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: host: xhci: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From dcf5228c1c78c217eedade8455e20af32d359e00 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:39:22 +0300
Subject: usb: host: xhci: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Mathias Nyman <mathias.ny...@intel.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/host/xhci-mem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 6afe32381209..679672da58ed 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1370,7 +1370,7 @@ static u32 xhci_get_endpoint_max_burst(struct usb_device 
*udev,
if (udev->speed == USB_SPEED_HIGH &&
(usb_endpoint_xfer_isoc(>desc) ||
 usb_endpoint_xfer_int(>desc)))
-   return (usb_endpoint_maxp(>desc) & 0x1800) >> 11;
+   return usb_endpoint_maxp_mult(>desc) - 1;
 
return 0;
 }
@@ -1416,9 +1416,9 @@ static u32 xhci_get_max_esit_payload(struct usb_device 
*udev,
return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
 
max_packet = GET_MAX_PACKET(usb_endpoint_maxp(>desc));
-   max_burst = (usb_endpoint_maxp(>desc) & 0x1800) >> 11;
+   max_burst = usb_endpoint_maxp_mult(>desc);
/* A 0 in max burst means 1 transfer per ESIT */
-   return max_packet * (max_burst + 1);
+   return max_packet * max_burst;
 }
 
 /* Set up an endpoint with one ring segment.  Do not allocate stream rings.
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: host: ehci: make use of new usb_endpoint_maxp_mult()" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: host: ehci: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From e3b89080f2c50936a9f6eccedb1e07e293777f0a Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:38:18 +0300
Subject: usb: host: ehci: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/host/ehci-q.c | 10 ++
 drivers/usb/host/ehci-sched.c |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index eca3710d8fc4..a45a5dc7ed9f 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -550,8 +550,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
 
 /*-*/
 
-// high bandwidth multiplier, as encoded in highspeed endpoint descriptors
-#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
 // ... and packet size, for any kind of endpoint descriptor
 #define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
 
@@ -770,9 +768,11 @@ qh_make (
gfp_t   flags
 ) {
struct ehci_qh  *qh = ehci_qh_alloc (ehci, flags);
+   struct usb_host_endpoint *ep;
u32 info1 = 0, info2 = 0;
int is_input, type;
int maxp = 0;
+   int mult;
struct usb_tt   *tt = urb->dev->tt;
struct ehci_qh_hw   *hw;
 
@@ -787,7 +787,9 @@ qh_make (
 
is_input = usb_pipein (urb->pipe);
type = usb_pipetype (urb->pipe);
+   ep = usb_pipe_endpoint (urb->dev, urb->pipe);
maxp = usb_maxpacket (urb->dev, urb->pipe, !is_input);
+   mult = usb_endpoint_maxp_mult (>desc);
 
/* 1024 byte maxpacket is a hardware ceiling.  High bandwidth
 * acts like up to 3KB, but is built from smaller packets.
@@ -810,7 +812,7 @@ qh_make (
 
qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
is_input, 0,
-   hb_mult(maxp) * max_packet(maxp)));
+   mult * max_packet(maxp)));
qh->ps.phase = NO_FRAME;
 
if (urb->dev->speed == USB_SPEED_HIGH) {
@@ -929,7 +931,7 @@ qh_make (
info2 |= (EHCI_TUNE_MULT_HS << 30);
} else {/* PIPE_INTERRUPT */
info1 |= max_packet (maxp) << 16;
-   info2 |= hb_mult (maxp) << 30;
+   info2 |= mult << 30;
}
break;
default:
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 1dfe54f14737..6a9fa2c3a24e 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1064,7 +1064,7 @@ iso_stream_init(
 
/* knows about ITD vs SITD */
if (dev->speed == USB_SPEED_HIGH) {
-   unsigned multi = hb_mult(maxp);
+   unsigned multi = usb_endpoint_maxp_mult(>ep->desc);
 
stream->highspeed = 1;
 
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: dummy: make use of new usb_endpoint_maxp_mult()" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: dummy: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From ee8ac85596ec0b45c7dd49e2a2a0af50f98542cd Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:30:59 +0300
Subject: usb: gadget: udc: dummy: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Alan Stern <st...@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/dummy_hcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c 
b/drivers/usb/gadget/udc/dummy_hcd.c
index 77d07904f932..14004cf88d4d 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -1483,8 +1483,7 @@ static int periodic_bytes(struct dummy *dum, struct 
dummy_ep *ep)
int tmp;
 
/* high bandwidth mode */
-   tmp = usb_endpoint_maxp(ep->desc);
-   tmp = (tmp >> 11) & 0x03;
+   tmp = usb_endpoint_maxp_mult(ep->desc);
tmp *= 8 /* applies to entire frame */;
limit += limit * tmp;
}
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: atmel: make use of new usb_endpoint_maxp_mult()" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: atmel: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From f0419d9fdf402b4ac07db974df9f3cd3f5de2cdd Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:28:44 +0300
Subject: usb: gadget: udc: atmel: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Acked-by: Nicolas Ferre <nicolas.fe...@atmel.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 45bc997d0711..c57012b1ddf4 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -573,7 +573,7 @@ usba_ep_enable(struct usb_ep *_ep, const struct 
usb_endpoint_descriptor *desc)
 * Bits 11:12 specify number of _additional_
 * transactions per microframe.
 */
-   nr_trans = ((usb_endpoint_maxp(desc) >> 11) & 3) + 1;
+   nr_trans = usb_endpoint_maxp_mult(desc);
if (nr_trans > 3)
return -EINVAL;
 
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: core: devices: make use of new usb_endpoint_maxp_mult()" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: core: devices: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 91f97521bb3f42f7a0447c130c789cb7c1810714 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:27:55 +0300
Subject: usb: core: devices: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>
Acked-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/core/devices.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index ef04b50e6bbb..00d1b26a81d3 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -182,14 +182,8 @@ static char *usb_dump_endpoint_descriptor(int speed, char 
*start, char *end,
 
dir = usb_endpoint_dir_in(desc) ? 'I' : 'O';
 
-   if (speed == USB_SPEED_HIGH) {
-   switch (usb_endpoint_maxp(desc) & (0x03 << 11)) {
-   case 1 << 11:
-   bandwidth = 2; break;
-   case 2 << 11:
-   bandwidth = 3; break;
-   }
-   }
+   if (speed == USB_SPEED_HIGH)
+   bandwidth = usb_endpoint_maxp_mult(desc);
 
/* this isn't checking for illegal values */
switch (usb_endpoint_type(desc)) {
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: gadget: udc: bdc: make use of new usb_endpoint_maxp_mult()" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: gadget: udc: bdc: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 1f5bba7381c58670dbb1b50885b45c2660e12eb5 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:29:39 +0300
Subject: usb: gadget: udc: bdc: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Ashwini Pahuja <ashwini.li...@gmail.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/gadget/udc/bdc/bdc_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.c 
b/drivers/usb/gadget/udc/bdc/bdc_cmd.c
index 4d5e9188beae..6e920f1dce02 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_cmd.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.c
@@ -182,7 +182,7 @@ int bdc_config_ep(struct bdc *bdc, struct bdc_ep *ep)
usb_endpoint_xfer_int(desc)) {
param2 |= si;
 
-   mbs = (usb_endpoint_maxp(desc) & 0x1800) >> 11;
+   mbs = usb_endpoint_maxp_mult(desc);
param2 |= mbs << MB_SHIFT;
}
break;
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "usb: chipidea: udc: make use of new usb_endpoint_maxp_mult()" added to usb-testing

2016-11-18 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: chipidea: udc: make use of new usb_endpoint_maxp_mult()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the usb-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From a98e25e71d115702d79ef0f4f8009ce5d4cf37eb Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.ba...@linux.intel.com>
Date: Wed, 28 Sep 2016 13:26:18 +0300
Subject: usb: chipidea: udc: make use of new usb_endpoint_maxp_mult()

We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Acked-by: Peter Chen <peter.c...@nxp.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/chipidea/udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 661f43fe0f9e..7a535be3024e 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -821,7 +821,7 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request 
*req,
}
 
if (usb_endpoint_xfer_isoc(hwep->ep.desc) &&
-   hwreq->req.length > (1 + hwep->ep.mult) * hwep->ep.maxpacket) {
+   hwreq->req.length > hwep->ep.mult * hwep->ep.maxpacket) {
dev_err(hwep->ci->dev, "request length too big for 
isochronous\n");
return -EMSGSIZE;
}
@@ -1254,7 +1254,7 @@ static int ep_enable(struct usb_ep *ep,
hwep->type = usb_endpoint_type(desc);
 
hwep->ep.maxpacket = usb_endpoint_maxp(desc) & 0x07ff;
-   hwep->ep.mult = QH_ISO_MULT(usb_endpoint_maxp(desc));
+   hwep->ep.mult = usb_endpoint_maxp_mult(desc);
 
if (hwep->type == USB_ENDPOINT_XFER_CONTROL)
cap |= QH_IOS;
-- 
2.10.2


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "tty: vgacon+sisusb, move scrolldelta to a common helper" added to tty-next

2016-10-28 Thread gregkh

This is a note to let you know that I've just added the patch titled

tty: vgacon+sisusb, move scrolldelta to a common helper

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 35cc56f9a30480c8a0cca809cf341614a2144758 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jsl...@suse.cz>
Date: Mon, 3 Oct 2016 11:18:35 +0200
Subject: tty: vgacon+sisusb, move scrolldelta to a common helper

The code is mirrorred in scrolldelta implementations of both vgacon
and sisusb. Let's move the code to a separate helper where we will
perform a common cleanup and further changes.

While we are moving the code, make it linear and save one indentation
level. This is done by returning from the "!lines" then-branch
immediatelly. This allows flushing the else-branch 1 level to the
left, obviously.

Few more new lines and comments were added too.

And do not forget to export the helper function given sisusb can be
built as module.

Signed-off-by: Jiri Slaby <jsl...@suse.cz>
Cc: Thomas Winischhofer <tho...@winischhofer.net>
Cc: Tomi Valkeinen <tomi.valkei...@ti.com>
Cc: <linux-fb...@vger.kernel.org>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/tty/vt/vt.c | 38 +
 drivers/usb/misc/sisusbvga/sisusb_con.c | 37 ++--
 drivers/video/console/vgacon.c  | 27 ++-
 include/linux/vt_kern.h |  2 ++
 4 files changed, 44 insertions(+), 60 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index a0b7576747cd..2eab714aab67 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4279,6 +4279,44 @@ void vcs_scr_updated(struct vc_data *vc)
notify_update(vc);
 }
 
+void vc_scrolldelta_helper(struct vc_data *c, int lines,
+   unsigned int rolled_over, void *base, unsigned int size)
+{
+   unsigned long ubase = (unsigned long)base;
+   int margin = c->vc_size_row * 4;
+   int ul, we, p, st;
+
+   /* Turn scrollback off */
+   if (!lines) {
+   c->vc_visible_origin = c->vc_origin;
+   return;
+   }
+
+   /* Do we have already enough to allow jumping from 0 to the end? */
+   if (rolled_over > (c->vc_scr_end - ubase) + margin) {
+   ul = c->vc_scr_end - ubase;
+   we = rolled_over + c->vc_size_row;
+   } else {
+   ul = 0;
+   we = size;
+   }
+
+   p = (c->vc_visible_origin - ubase - ul + we) % we +
+   lines * c->vc_size_row;
+   st = (c->vc_origin - ubase - ul + we) % we;
+
+   /* Only a little piece would be left? Show all incl. the piece! */
+   if (st < 2 * margin)
+   margin = 0;
+   if (p < margin)
+   p = 0;
+   if (p > st - margin)
+   p = st;
+
+   c->vc_visible_origin = ubase + (p + ul) % we;
+}
+EXPORT_SYMBOL_GPL(vc_scrolldelta_helper);
+
 /*
  * Visible symbols for modules
  */
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 6331965daa0b..4b5777ec1501 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -686,8 +686,6 @@ static void
 sisusbcon_scrolldelta(struct vc_data *c, int lines)
 {
struct sisusb_usb_data *sisusb;
-   int margin = c->vc_size_row * 4;
-   int ul, we, p, st;
 
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
@@ -700,39 +698,8 @@ sisusbcon_scrolldelta(struct vc_data *c, int lines)
return;
}
 
-   if (!lines) /* Turn scrollback off */
-   c->vc_visible_origin = c->vc_origin;
-   else {
-
-   if (sisusb->con_rolled_over >
-   (c->vc_scr_end - sisusb->scrbuf) + margin) {
-
-   ul = c->vc_scr_end - sisusb->scrbuf;
-   we = sisusb->con_rolled_over + c->vc_size_row;
-
-   } else {
-
-   ul = 0;
-   we = sisusb->scrbuf_size;
-
-   }
-
-   p = (c->vc_visible_origin - sisusb->scrbuf - ul + we) % we +
-   lines * c->vc_size_row;
-
-   st = (c->vc_origin - sisusb->scrbuf - ul + we) % we;
-
-   if (st < 2 * margin)
-   margin = 0;
-
-   if (p < margin)
- 

patch "tty: vt, cleanup and document con_scroll" added to tty-next

2016-10-28 Thread gregkh

This is a note to let you know that I've just added the patch titled

tty: vt, cleanup and document con_scroll

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From d705ff38189fcfbbfa6aa97363d30c23348ad166 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jsl...@suse.cz>
Date: Mon, 3 Oct 2016 11:18:33 +0200
Subject: tty: vt, cleanup and document con_scroll

Scrolling helpers scrup and scrdown both accept 'top' and 'bottom' as
unsigned int. Number of lines 'nr' is accepted as int, but all callers
pass down unsigned too. So change the type of 'nr' to unsigned too.
Now, promote unsigned int from the helpers up to the con_scroll
hook which actually accepted all those as signed int.

Next, the 'dir' parameter can have only two values and we define
constants for that: SM_UP and SM_DOWN. Switch them to enum and do
proper type checking on 'dir' too.

Finally, document the behaviour of the hook.

Signed-off-by: Jiri Slaby <jsl...@suse.cz>
Cc: Thomas Winischhofer <tho...@winischhofer.net>
Cc: Tomi Valkeinen <tomi.valkei...@ti.com>
Cc: "James E.J. Bottomley" <j...@parisc-linux.org>
Cc: Helge Deller <del...@gmx.de>
Cc: <linux-fb...@vger.kernel.org>
Cc: <linux-usb@vger.kernel.org>
Cc: <linux-par...@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/tty/vt/vt.c |  6 --
 drivers/usb/misc/sisusbvga/sisusb_con.c | 18 ++
 drivers/video/console/fbcon.c   | 18 --
 drivers/video/console/mdacon.c  |  7 ---
 drivers/video/console/newport_con.c |  8 
 drivers/video/console/sticon.c  |  7 ---
 drivers/video/console/vgacon.c  | 12 +---
 include/linux/console.h | 16 +++-
 8 files changed, 50 insertions(+), 42 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 06fb39c1d6dd..c4bf96fee32e 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -315,7 +315,8 @@ void schedule_console_callback(void)
schedule_work(_work);
 }
 
-static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+static void scrup(struct vc_data *vc, unsigned int t, unsigned int b,
+   unsigned int nr)
 {
unsigned short *d, *s;
 
@@ -332,7 +333,8 @@ static void scrup(struct vc_data *vc, unsigned int t, 
unsigned int b, int nr)
vc->vc_size_row * nr);
 }
 
-static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b,
+   unsigned int nr)
 {
unsigned short *s;
unsigned int step;
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 460cebf322e3..6331965daa0b 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -808,9 +808,10 @@ sisusbcon_cursor(struct vc_data *c, int mode)
mutex_unlock(>lock);
 }
 
-static int
+static bool
 sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb,
-   int t, int b, int dir, int lines)
+   unsigned int t, unsigned int b, enum con_scroll dir,
+   unsigned int lines)
 {
int cols = sisusb->sisusb_num_columns;
int length = ((b - t) * cols) * 2;
@@ -852,8 +853,9 @@ sisusbcon_scroll_area(struct vc_data *c, struct 
sisusb_usb_data *sisusb,
 }
 
 /* Interface routine */
-static int
-sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
+static bool
+sisusbcon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
+   enum con_scroll dir, unsigned int lines)
 {
struct sisusb_usb_data *sisusb;
u16 eattr = c->vc_video_erase_char;
@@ -870,17 +872,17 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int 
dir, int lines)
 */
 
if (!lines)
-   return 1;
+   return true;
 
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
-   return 0;
+   return false;
 
/* sisusb->lock is down */
 
if (sisusb_is_inactive(c, sisusb)) {
mutex_unlock(>lock);
-   return 0;
+   return false;
}
 
/* Special case */
@@ -971,7 +973,7 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, 
int lines)
 
mutex_unlock(>lock);
 
-   return 1;
+   return true;
 }
 
 /* Interface routine */
diff --git

patch "tty: vgacon+sisusb, move scrolldelta to a common helper" added to tty-testing

2016-10-27 Thread gregkh

This is a note to let you know that I've just added the patch titled

tty: vgacon+sisusb, move scrolldelta to a common helper

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the tty-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 35cc56f9a30480c8a0cca809cf341614a2144758 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jsl...@suse.cz>
Date: Mon, 3 Oct 2016 11:18:35 +0200
Subject: tty: vgacon+sisusb, move scrolldelta to a common helper

The code is mirrorred in scrolldelta implementations of both vgacon
and sisusb. Let's move the code to a separate helper where we will
perform a common cleanup and further changes.

While we are moving the code, make it linear and save one indentation
level. This is done by returning from the "!lines" then-branch
immediatelly. This allows flushing the else-branch 1 level to the
left, obviously.

Few more new lines and comments were added too.

And do not forget to export the helper function given sisusb can be
built as module.

Signed-off-by: Jiri Slaby <jsl...@suse.cz>
Cc: Thomas Winischhofer <tho...@winischhofer.net>
Cc: Tomi Valkeinen <tomi.valkei...@ti.com>
Cc: <linux-fb...@vger.kernel.org>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/tty/vt/vt.c | 38 +
 drivers/usb/misc/sisusbvga/sisusb_con.c | 37 ++--
 drivers/video/console/vgacon.c  | 27 ++-
 include/linux/vt_kern.h |  2 ++
 4 files changed, 44 insertions(+), 60 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index a0b7576747cd..2eab714aab67 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4279,6 +4279,44 @@ void vcs_scr_updated(struct vc_data *vc)
notify_update(vc);
 }
 
+void vc_scrolldelta_helper(struct vc_data *c, int lines,
+   unsigned int rolled_over, void *base, unsigned int size)
+{
+   unsigned long ubase = (unsigned long)base;
+   int margin = c->vc_size_row * 4;
+   int ul, we, p, st;
+
+   /* Turn scrollback off */
+   if (!lines) {
+   c->vc_visible_origin = c->vc_origin;
+   return;
+   }
+
+   /* Do we have already enough to allow jumping from 0 to the end? */
+   if (rolled_over > (c->vc_scr_end - ubase) + margin) {
+   ul = c->vc_scr_end - ubase;
+   we = rolled_over + c->vc_size_row;
+   } else {
+   ul = 0;
+   we = size;
+   }
+
+   p = (c->vc_visible_origin - ubase - ul + we) % we +
+   lines * c->vc_size_row;
+   st = (c->vc_origin - ubase - ul + we) % we;
+
+   /* Only a little piece would be left? Show all incl. the piece! */
+   if (st < 2 * margin)
+   margin = 0;
+   if (p < margin)
+   p = 0;
+   if (p > st - margin)
+   p = st;
+
+   c->vc_visible_origin = ubase + (p + ul) % we;
+}
+EXPORT_SYMBOL_GPL(vc_scrolldelta_helper);
+
 /*
  * Visible symbols for modules
  */
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 6331965daa0b..4b5777ec1501 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -686,8 +686,6 @@ static void
 sisusbcon_scrolldelta(struct vc_data *c, int lines)
 {
struct sisusb_usb_data *sisusb;
-   int margin = c->vc_size_row * 4;
-   int ul, we, p, st;
 
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
@@ -700,39 +698,8 @@ sisusbcon_scrolldelta(struct vc_data *c, int lines)
return;
}
 
-   if (!lines) /* Turn scrollback off */
-   c->vc_visible_origin = c->vc_origin;
-   else {
-
-   if (sisusb->con_rolled_over >
-   (c->vc_scr_end - sisusb->scrbuf) + margin) {
-
-   ul = c->vc_scr_end - sisusb->scrbuf;
-   we = sisusb->con_rolled_over + c->vc_size_row;
-
-   } else {
-
-   ul = 0;
-   we = sisusb->scrbuf_size;
-
-   }
-
-   p = (c->vc_visible_origin - sisusb->scrbuf - ul + we) % we +
-   lines * c->vc_size_row;
-
-   st = (c->vc_origin - sisusb->scrbuf - ul + we) % we;
-
-   if (st < 2 * margin)
-   margin = 0;
-

patch "tty: vt, cleanup and document con_scroll" added to tty-testing

2016-10-27 Thread gregkh

This is a note to let you know that I've just added the patch titled

tty: vt, cleanup and document con_scroll

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the tty-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From d705ff38189fcfbbfa6aa97363d30c23348ad166 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jsl...@suse.cz>
Date: Mon, 3 Oct 2016 11:18:33 +0200
Subject: tty: vt, cleanup and document con_scroll

Scrolling helpers scrup and scrdown both accept 'top' and 'bottom' as
unsigned int. Number of lines 'nr' is accepted as int, but all callers
pass down unsigned too. So change the type of 'nr' to unsigned too.
Now, promote unsigned int from the helpers up to the con_scroll
hook which actually accepted all those as signed int.

Next, the 'dir' parameter can have only two values and we define
constants for that: SM_UP and SM_DOWN. Switch them to enum and do
proper type checking on 'dir' too.

Finally, document the behaviour of the hook.

Signed-off-by: Jiri Slaby <jsl...@suse.cz>
Cc: Thomas Winischhofer <tho...@winischhofer.net>
Cc: Tomi Valkeinen <tomi.valkei...@ti.com>
Cc: "James E.J. Bottomley" <j...@parisc-linux.org>
Cc: Helge Deller <del...@gmx.de>
Cc: <linux-fb...@vger.kernel.org>
Cc: <linux-usb@vger.kernel.org>
Cc: <linux-par...@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/tty/vt/vt.c |  6 --
 drivers/usb/misc/sisusbvga/sisusb_con.c | 18 ++
 drivers/video/console/fbcon.c   | 18 --
 drivers/video/console/mdacon.c  |  7 ---
 drivers/video/console/newport_con.c |  8 
 drivers/video/console/sticon.c  |  7 ---
 drivers/video/console/vgacon.c  | 12 +---
 include/linux/console.h | 16 +++-
 8 files changed, 50 insertions(+), 42 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 06fb39c1d6dd..c4bf96fee32e 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -315,7 +315,8 @@ void schedule_console_callback(void)
schedule_work(_work);
 }
 
-static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+static void scrup(struct vc_data *vc, unsigned int t, unsigned int b,
+   unsigned int nr)
 {
unsigned short *d, *s;
 
@@ -332,7 +333,8 @@ static void scrup(struct vc_data *vc, unsigned int t, 
unsigned int b, int nr)
vc->vc_size_row * nr);
 }
 
-static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b,
+   unsigned int nr)
 {
unsigned short *s;
unsigned int step;
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 460cebf322e3..6331965daa0b 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -808,9 +808,10 @@ sisusbcon_cursor(struct vc_data *c, int mode)
mutex_unlock(>lock);
 }
 
-static int
+static bool
 sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb,
-   int t, int b, int dir, int lines)
+   unsigned int t, unsigned int b, enum con_scroll dir,
+   unsigned int lines)
 {
int cols = sisusb->sisusb_num_columns;
int length = ((b - t) * cols) * 2;
@@ -852,8 +853,9 @@ sisusbcon_scroll_area(struct vc_data *c, struct 
sisusb_usb_data *sisusb,
 }
 
 /* Interface routine */
-static int
-sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
+static bool
+sisusbcon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
+   enum con_scroll dir, unsigned int lines)
 {
struct sisusb_usb_data *sisusb;
u16 eattr = c->vc_video_erase_char;
@@ -870,17 +872,17 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int 
dir, int lines)
 */
 
if (!lines)
-   return 1;
+   return true;
 
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
-   return 0;
+   return false;
 
/* sisusb->lock is down */
 
if (sisusb_is_inactive(c, sisusb)) {
mutex_unlock(>lock);
-   return 0;
+   return false;
}
 
/* Special case */
@@ -971,7 +973,7 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, 
int lines)
 
mutex_unlock(>lock);
 
-   return 1;
+   return true;
 }
 
 /

patch usb: phy: Allow compile test of GPIO consumers if !GPIOLIB added to usb-next

2015-06-01 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: phy: Allow compile test of GPIO consumers if !GPIOLIB

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


From db978e284781af641a02f9ca9d99a746e1e1f60f Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven ge...@linux-m68k.org
Date: Tue, 5 May 2015 18:32:38 +0200
Subject: usb: phy: Allow compile test of GPIO consumers if !GPIOLIB

The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
Cc: linux-usb@vger.kernel.org
Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/phy/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 173a5b5d8bc1..869c0cfcad98 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -91,7 +91,7 @@ config TWL6030_USB
 
 config USB_GPIO_VBUS
tristate GPIO based peripheral-only VBUS sensing 'transceiver'
-   depends on GPIOLIB
+   depends on GPIOLIB || COMPILE_TEST
select USB_PHY
help
  Provides simple GPIO VBUS sensing for controllers with an
-- 
2.4.2


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] MAINTAINERS: Add an entry for USB/IP driver

2014-08-25 Thread gregkh
On Wed, Aug 20, 2014 at 12:44:45PM +0530, sanjeev sharma wrote:
 Hello Valentina,
 
 I have started looking into USB IP Project and this look's very interesting 
 and
 Do we have anything left in this Project apart from reviewing user-land
 protocol ?

What do you mean by this?  Does the code not work properly for you?

confused,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch uwb: convert bus code to use dev_groups added to driver-core tree

2013-10-16 Thread gregkh

This is a note to let you know that I've just added the patch titled

uwb: convert bus code to use dev_groups

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


From 1b604039a342a4ba465d37657bec55db476506b0 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman gre...@linuxfoundation.org
Date: Sun, 6 Oct 2013 23:55:44 -0700
Subject: uwb: convert bus code to use dev_groups

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the uwb bus code to use the
correct field.

Cc: Bruno Morelli br...@evidence.eu.com
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/uwb/umc-bus.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/uwb/umc-bus.c b/drivers/uwb/umc-bus.c
index 5c5b3fc9..e3ed6ff6 100644
--- a/drivers/uwb/umc-bus.c
+++ b/drivers/uwb/umc-bus.c
@@ -201,6 +201,7 @@ static ssize_t capability_id_show(struct device *dev, 
struct device_attribute *a
 
return sprintf(buf, 0x%02x\n, umc-cap_id);
 }
+static DEVICE_ATTR_RO(capability_id);
 
 static ssize_t version_show(struct device *dev, struct device_attribute *attr, 
char *buf)
 {
@@ -208,12 +209,14 @@ static ssize_t version_show(struct device *dev, struct 
device_attribute *attr, c
 
return sprintf(buf, 0x%04x\n, umc-version);
 }
+static DEVICE_ATTR_RO(version);
 
-static struct device_attribute umc_dev_attrs[] = {
-   __ATTR_RO(capability_id),
-   __ATTR_RO(version),
-   __ATTR_NULL,
+static struct attribute *umc_dev_attrs[] = {
+   dev_attr_capability_id.attr,
+   dev_attr_version.attr,
+   NULL,
 };
+ATTRIBUTE_GROUPS(umc_dev);
 
 struct bus_type umc_bus_type = {
.name   = umc,
@@ -222,7 +225,7 @@ struct bus_type umc_bus_type = {
.remove = umc_device_remove,
.suspend= umc_device_suspend,
.resume = umc_device_resume,
-   .dev_attrs  = umc_dev_attrs,
+   .dev_groups = umc_dev_groups,
 };
 EXPORT_SYMBOL_GPL(umc_bus_type);
 
-- 
1.8.4.3.gca3854a


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch usb: chipidea: ci13xxx_imx: let device core handle pinctrl added to usb tree

2013-06-17 Thread gregkh

This is a note to let you know that I've just added the patch titled

usb: chipidea: ci13xxx_imx: let device core handle pinctrl

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


From a95fd1897378e9533f049f6a3c74ee80cedab947 Mon Sep 17 00:00:00 2001
From: Fabio Estevam fabio.este...@freescale.com
Date: Thu, 13 Jun 2013 17:59:45 +0300
Subject: usb: chipidea: ci13xxx_imx: let device core handle pinctrl

Since commit ab78029 (drivers/pinctrl: grab default handles from device core),
we can rely on device core for handling pinctrl.

So remove devm_pinctrl_get_select_default() from the driver.

Cc: linux-usb@vger.kernel.org
Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Tested-by: Shawn Guo shawn@linaro.org
Signed-off-by: Alexander Shishkin alexander.shish...@linux.intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/usb/chipidea/ci13xxx_imx.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 585099a..45bb9b5 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -20,7 +20,6 @@
 #include linux/usb/chipidea.h
 #include linux/clk.h
 #include linux/regulator/consumer.h
-#include linux/pinctrl/consumer.h
 
 #include ci.h
 #include ci13xxx_imx.h
@@ -103,7 +102,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
struct device_node *phy_np;
struct resource *res;
struct regulator *reg_vbus;
-   struct pinctrl *pinctrl;
int ret;
 
if (of_find_property(pdev-dev.of_node, fsl,usbmisc, NULL)
@@ -122,11 +120,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
return -ENOENT;
}
 
-   pinctrl = devm_pinctrl_get_select_default(pdev-dev);
-   if (IS_ERR(pinctrl))
-   dev_warn(pdev-dev, pinctrl get/select failed, err=%ld\n,
-   PTR_ERR(pinctrl));
-
data-clk = devm_clk_get(pdev-dev, NULL);
if (IS_ERR(data-clk)) {
dev_err(pdev-dev,
-- 
1.8.3.rc0.20.gb99dd2e


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch usb-usb-storage-don-t-access-beyond-the-end-of-the-sg-buffer.patch added to gregkh-2.6 tree

2008-02-20 Thread gregkh

This is a note to let you know that I've just added the patch titled

 Subject: USB: usb-storage: don't access beyond the end of the sg buffer

to my gregkh-2.6 tree.  Its filename is

 usb-usb-storage-don-t-access-beyond-the-end-of-the-sg-buffer.patch

This tree can be found at 
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


From [EMAIL PROTECTED]  Wed Feb 20 12:59:54 2008
From: Alan Stern [EMAIL PROTECTED]
Date: Wed, 20 Feb 2008 14:15:58 -0500 (EST)
Subject: USB: usb-storage: don't access beyond the end of the sg buffer
To: Greg KH [EMAIL PROTECTED], Matthew Dharm [EMAIL PROTECTED]
Cc: Boaz Harrosh [EMAIL PROTECTED],  USB Storage list [EMAIL PROTECTED],  
USB list linux-usb@vger.kernel.org
Message-ID: [EMAIL PROTECTED]


This patch (as1035) fixes a bug in usb_stor_access_xfer_buf() (the bug
was originally found by Boaz Harrosh): The routine must not attempt to
write beyond the end of a scatter-gather list or beyond the number of
bytes requested.  It also fixes up the formatting of a few comments
and similar whitespace issues.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]

---
 drivers/usb/storage/protocol.c |   27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -150,13 +150,14 @@ void usb_stor_transparent_scsi_command(s
 
 /* Copy a buffer of length buflen to/from the srb's transfer buffer.
  * Update the **sgptr and *offset variables so that the next copy will
- * pick up from where this one left off. */
-
+ * pick up from where this one left off.
+ */
 unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr,
unsigned int *offset, enum xfer_buf_dir dir)
 {
unsigned int cnt;
+   struct scatterlist *sg = *sgptr;
 
/* We have to go through the list one entry
 * at a time.  Each s-g entry contains some number of pages, and
@@ -164,22 +165,23 @@ unsigned int usb_stor_access_xfer_buf(un
 * in kernel-addressable memory then kmap() will return its address.
 * If the page is not directly accessible -- such as a user buffer
 * located in high memory -- then kmap() will map it to a temporary
-* position in the kernel's virtual address space. */
-   struct scatterlist *sg = *sgptr;
+* position in the kernel's virtual address space.
+*/
 
if (!sg)
sg = scsi_sglist(srb);
+   buflen = min(buflen, scsi_bufflen(srb));
 
/* This loop handles a single s-g list entry, which may
-   * include multiple pages.  Find the initial page structure
-   * and the starting offset within the page, and update
-   * the *offset and **sgptr values for the next loop. */
+* include multiple pages.  Find the initial page structure
+* and the starting offset within the page, and update
+* the *offset and **sgptr values for the next loop.
+*/
cnt = 0;
-   while (cnt  buflen) {
+   while (cnt  buflen  sg) {
struct page *page = sg_page(sg) +
((sg-offset + *offset)  PAGE_SHIFT);
-   unsigned int poff =
-   (sg-offset + *offset)  (PAGE_SIZE-1);
+   unsigned int poff = (sg-offset + *offset)  (PAGE_SIZE-1);
unsigned int sglen = sg-length - *offset;
 
if (sglen  buflen - cnt) {
@@ -222,14 +224,15 @@ unsigned int usb_stor_access_xfer_buf(un
 }
 
 /* Store the contents of buffer into srb's transfer buffer and set the
- * SCSI residue. */
+ * SCSI residue.
+ */
 void usb_stor_set_xfer_buf(unsigned char *buffer,
unsigned int buflen, struct scsi_cmnd *srb)
 {
unsigned int offset = 0;
struct scatterlist *sg = NULL;
 
-   usb_stor_access_xfer_buf(buffer, buflen, srb, sg, offset,
+   buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, sg, offset,
TO_XFER_BUF);
if (buflen  scsi_bufflen(srb))
scsi_set_resid(srb, scsi_bufflen(srb) - buflen);


Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are

driver/cpufreq-fix-kobject-reference-count-handling.patch
driver/pm-remove-unbalanced-mutex_unlock-from-dpm_resume.patch
usb/usb-convert-usb.h-struct-usb_device-to-kernel-doc.patch
usb/usb-make-usb_storage_onetouch-available-with-pm.patch
usb/usb-usb-ohci-sm501-driver-use-the-conventional-convention-for-suspend-and-resume.patch
usb/usb-quirks-and-unusual_devs-entry-for-actions-flash-drive.patch
usb/usb-usb-storage-don-t-clear-halt-when-get-max-lun-stalls.patch
usb/usb-usb-storage-don-t-access-beyond-the-end-of-the-sg-buffer.patch
usb/usb-usb-storage-unusual_devs-entry-for-oracom-mp3-player.patch
-
To unsubscribe from this list: send the line

patch usb-usb-storage-don-t-clear-halt-when-get-max-lun-stalls.patch added to gregkh-2.6 tree

2008-02-19 Thread gregkh

This is a note to let you know that I've just added the patch titled

 Subject: USB: usb-storage: don't clear-halt when Get-Max-LUN stalls

to my gregkh-2.6 tree.  Its filename is

 usb-usb-storage-don-t-clear-halt-when-get-max-lun-stalls.patch

This tree can be found at 
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


From [EMAIL PROTECTED] Wed Feb 13 07:46:39 2008
From: Alan Stern [EMAIL PROTECTED]
Date: Wed, 13 Feb 2008 10:45:28 -0500 (EST)
Subject: USB: usb-storage: don't clear-halt when Get-Max-LUN stalls
To: Matthew Dharm [EMAIL PROTECTED]
Cc: Robert Spitzenpfeil [EMAIL PROTECTED], Andre Welter [EMAIL PROTECTED], 
USB list linux-usb@vger.kernel.org, USB Storage list [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]


This patch (as1032) removes the Clear-Halt calls in
usb_stor_Bulk_max_lun().  Evidently some devices (such as the Oracom
MP3 player) really don't like to receive these requests when their
bulk endpoints aren't halted.

The only reason for adding them originally was to get an ancient
ZIP-100 drive to work.  But since this device has only a single LUN,
we don't need to send it a Get-Max-LUN request at all.  Adding an
unusual_devs entry for the ZIP-100 with the SINGLE_LUN flag set will
cause this step to be skipped.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]

---
 drivers/usb/storage/transport.c|   11 ---
 drivers/usb/storage/unusual_devs.h |   12 
 2 files changed, 12 insertions(+), 11 deletions(-)

--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -891,17 +891,6 @@ int usb_stor_Bulk_max_lun(struct us_data
if (result  0)
return us-iobuf[0];
 
-   /* 
-* Some devices (i.e. Iomega Zip100) need this -- apparently
-* the bulk pipes get STALLed when the GetMaxLUN request is
-* processed.   This is, in theory, harmless to all other devices
-* (regardless of if they stall or not).
-*/
-   if (result == -EPIPE) {
-   usb_stor_clear_halt(us, us-recv_bulk_pipe);
-   usb_stor_clear_halt(us, us-send_bulk_pipe);
-   }
-
/*
 * Some devices don't like GetMaxLUN.  They may STALL the control
 * pipe, they may return a zero-length result, they may do nothing at
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -759,6 +759,18 @@ UNUSUAL_DEV(  0x0595, 0x4343, 0x, 0x
Digital Camera EX-20 DSC,
US_SC_8070, US_PR_DEVICE, NULL, 0 ),
 
+/* Reported by Andre Welter [EMAIL PROTECTED]
+ * This antique device predates the release of the Bulk-only Transport
+ * spec, and if it gets a Get-Max-LUN then it requires the host to do a
+ * Clear-Halt on the bulk endpoints.  The SINGLE_LUN flag will prevent
+ * us from sending the request.
+ */
+UNUSUAL_DEV(  0x059b, 0x0001, 0x0100, 0x0100,
+   Iomega,
+   ZIP 100,
+   US_SC_DEVICE, US_PR_DEVICE, NULL,
+   US_FL_SINGLE_LUN ),
+
 /* Reported by [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x059f, 0x0643, 0x, 0x,
LaCie,


Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are

driver/cpufreq-fix-kobject-reference-count-handling.patch
usb/usb-convert-usb.h-struct-usb_device-to-kernel-doc.patch
usb/usb-make-usb_storage_onetouch-available-with-pm.patch
usb/usb-usb-ohci-sm501-driver-use-the-conventional-convention-for-suspend-and-resume.patch
usb/usb-usb-storage-don-t-clear-halt-when-get-max-lun-stalls.patch
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch usb-gadget-ethernet-error-path-potential-oops-fix.patch added to gregkh-2.6 tree

2007-12-20 Thread gregkh

This is a note to let you know that I've just added the patch titled

 Subject: USB: gadget: ethernet error path potential oops fix

to my gregkh-2.6 tree.  Its filename is

 usb-gadget-ethernet-error-path-potential-oops-fix.patch

This tree can be found at 
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


From [EMAIL PROTECTED] Wed Dec 19 12:08:01 2007
From: David Brownell [EMAIL PROTECTED]
Date: Wed, 19 Dec 2007 11:27:51 -0800
Subject: USB: gadget: ethernet error path potential oops fix
To: USB list linux-usb@vger.kernel.org, Greg KH [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
Content-Disposition: inline


Fix potential (never-observed) oops on rare error path,
bugzilla #9594.  Fix uses the same test as used earlier.

Also make the adjacent else block look like an else block
instead of hiding like a bug.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]

---
 drivers/usb/gadget/ether.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1067,19 +1067,19 @@ done:
 
/* on error, disable any endpoints  */
if (result  0) {
-   if (!subset_active(dev))
+   if (!subset_active(dev)  dev-status_ep)
(void) usb_ep_disable (dev-status_ep);
dev-status = NULL;
(void) usb_ep_disable (dev-in_ep);
(void) usb_ep_disable (dev-out_ep);
dev-in = NULL;
dev-out = NULL;
-   } else
+   }
 
/* activate non-CDC configs right away
 * this isn't strictly according to the RNDIS spec
 */
-   if (!cdc_active (dev)) {
+   else if (!cdc_active (dev)) {
netif_carrier_on (dev-net);
if (netif_running (dev-net)) {
spin_unlock (dev-lock);


Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are

usb/usb-convert-ehci-debug-files-to-use-debugfs-instead-of-sysfs.patch
usb/usb-convert-ohci-debug-files-to-use-debugfs-instead-of-sysfs.patch
usb/usb-ehci-add-separate-iaa-watchdog-timer.patch
usb/usb-gadget-pxa2xx_udc-supports-inverted-vbus.patch
usb/usb-remove-ohci-useless-masking-unmasking-of-wdh-interrupt.patch
usb/usb-device-dma-support-on-omap2.patch
usb/usb-s3c2410_udc-minor-irq-handler-cleanups.patch
usb/usb-m66592-udc-add-support-for-sh7722-usbf.patch
usb/usb-add-missing-space-to-printk-messages.patch
usb/usb-add-printer-gadget-driver.patch
usb/usb-usb-peripheral-controller-driver-oops-avoidance.patch
usb/usb-gadget-at91_udc-minor-fix.patch
usb/usb-don-t-change-hc-power-state-for-a-freeze.patch
usb/usb-dummy_hcd-don-t-register-drivers-on-the-platform-bus.patch
usb/usb-force-handover-port-to-companion-when-hub_port_connect_change-fails.patch
usb/usb-gadget-code-switches-to-pr_err-and-friends.patch
usb/usb-update-pxa27x-ohci-driver-to-use-clk-support.patch
usb/usb-add-marvell-orion-usb-host-support.patch
usb/usb-ehci-potential-oops-fix-on-arc-tdi-cores.patch
usb/usb-gadget-ethernet-error-path-potential-oops-fix.patch
-
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html