* Re: [PATCH] dt-bindings: Drop redundant maxItems/items
From: Laurent Pinchart @ 2020-12-23 17:57 UTC (permalink / raw)
To: Rob Herring
Cc: Sam Ravnborg, devicetree, Linux-ALSA, Greg Kroah-Hartman,
Linux USB List, linux-kernel@vger.kernel.org, dri-devel,
Jassi Brar, Vinod Koul, Mark Brown,
open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
In-Reply-To: <CAL_JsqJLw_RtLehYDLu_HKCoxDHsx-AdGTWfN0JMJhgNqLeFng@mail.gmail.com>
On Wed, Dec 23, 2020 at 10:54:26AM -0700, Rob Herring wrote:
> On Mon, Dec 21, 2020 at 11:39 PM Sam Ravnborg <sam@ravnborg.org> wrote:
> >
> > Hi Rob,
> >
> > On Mon, Dec 21, 2020 at 09:06:45PM -0700, Rob Herring wrote:
> > > 'maxItems' equal to the 'items' list length is redundant. 'maxItems' is
> > > preferred for a single entry while greater than 1 should have an 'items'
> > > list.
> > >
> > > A meta-schema check for this is pending once these existing cases are
> > > fixed.
> > >
> > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > Cc: Vinod Koul <vkoul@kernel.org>
> > > Cc: Mark Brown <broonie@kernel.org>
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Cc: Jassi Brar <jaswinder.singh@linaro.org>
> > > Cc: dri-devel@lists.freedesktop.org
> > > Cc: dmaengine@vger.kernel.org
> > > Cc: alsa-devel@alsa-project.org
> > > Cc: linux-usb@vger.kernel.org
> > > Signed-off-by: Rob Herring <robh@kernel.org>
> >
> > With one comment below,
> > Acked-by: Sam Ravnborg <sam@ravnborg.org>
> >
> > > ---
> > > diff --git a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
> > > index 737c1f47b7de..54c361d4a7af 100644
> > > --- a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
> > > +++ b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
> > > @@ -74,11 +74,8 @@ properties:
> > >
> > > phys:
> > > maxItems: 1
> > > - items:
> > > - - description: phandle + phy specifier pair.
> >
> > The description may help some people, so keeping the
> > description and deleting maxItems would maybe be better.
>
> Do we really want to describe 'phys' hundreds of times? No. The
> question I ask on the descriptions is could it be generated instead.
I agree. If the description had mentioned why particular PHY was
referenced, I would have kept that, but "the phy is a phy" is probably
not something we want to duplicate everywhere.
--
Regards,
Laurent Pinchart
^ permalink raw reply
* Re: [PATCH] dt-bindings: Drop redundant maxItems/items
From: Rob Herring @ 2020-12-23 17:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: devicetree, Linux-ALSA, Greg Kroah-Hartman, Linux USB List,
linux-kernel@vger.kernel.org, dri-devel, Jassi Brar, Vinod Koul,
Mark Brown, Laurent Pinchart,
open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
In-Reply-To: <20201222063908.GB3463004@ravnborg.org>
On Mon, Dec 21, 2020 at 11:39 PM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Rob,
>
> On Mon, Dec 21, 2020 at 09:06:45PM -0700, Rob Herring wrote:
> > 'maxItems' equal to the 'items' list length is redundant. 'maxItems' is
> > preferred for a single entry while greater than 1 should have an 'items'
> > list.
> >
> > A meta-schema check for this is pending once these existing cases are
> > fixed.
> >
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Vinod Koul <vkoul@kernel.org>
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Jassi Brar <jaswinder.singh@linaro.org>
> > Cc: dri-devel@lists.freedesktop.org
> > Cc: dmaengine@vger.kernel.org
> > Cc: alsa-devel@alsa-project.org
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Rob Herring <robh@kernel.org>
>
> With one comment below,
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>
> > ---
> > diff --git a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
> > index 737c1f47b7de..54c361d4a7af 100644
> > --- a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
> > +++ b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
> > @@ -74,11 +74,8 @@ properties:
> >
> > phys:
> > maxItems: 1
> > - items:
> > - - description: phandle + phy specifier pair.
>
> The description may help some people, so keeping the
> description and deleting maxItems would maybe be better.
Do we really want to describe 'phys' hundreds of times? No. The
question I ask on the descriptions is could it be generated instead.
Rob
^ permalink raw reply
* [PATCH] usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720
From: Pali Rohár @ 2020-12-23 16:24 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, Gregory CLEMENT, Miquel Raynal
Cc: Tomasz Maciej Nowak, linux-usb, linux-kernel, Peter Chen
Older ATF does not provide SMC call for USB 3.0 phy power on functionality
and therefore initialization of xhci-hcd is failing when older version of
ATF is used. In this case phy_power_on() function returns -EOPNOTSUPP.
[ 3.108467] mvebu-a3700-comphy d0018300.phy: unsupported SMC call, try updating your firmware
[ 3.117250] phy phy-d0018300.phy.0: phy poweron failed --> -95
[ 3.123465] xhci-hcd: probe of d0058000.usb failed with error -95
This patch calls phy_power_on() in xhci_mvebu_a3700_init_quirk() function
and in case it returns -EOPNOTSUPP then XHCI_SKIP_PHY_INIT quirk is set to
instruct xhci-plat to skip PHY initialization.
This patch fixes above failure by ignoring 'not supported' error in
aardvark driver. In this case it is expected that phy is already power on.
It fixes initialization of xhci-hcd on Espressobin boards where is older
Marvell's Arm Trusted Firmware without SMC call for USB 3.0 phy power.
This is regression introduced in commit bd3d25b07342 ("arm64: dts: marvell:
armada-37xx: link USB hosts with their PHYs") where USB 3.0 phy was defined
and therefore xhci-hcd on Espressobin with older ATF started failing.
Fixes: bd3d25b07342 ("arm64: dts: marvell: armada-37xx: link USB hosts with their PHYs")
Signed-off-by: Pali Rohár <pali@kernel.org>
Cc: <stable@vger.kernel.org> # 5.1+: ea17a0f153af: phy: marvell: comphy: Convert internal SMCC firmware return codes to errno
Cc: <stable@vger.kernel.org> # 5.1+: f768e718911e: usb: host: xhci-plat: add priv quirk for skip PHY initialization
---
When applying this patch, please include additional line
Cc: <stable@vger.kernel.org> # 5.1+: <COMMIT_ID>: usb: host: xhci-plat: fix support for XHCI_SKIP_PHY_INIT quirk
with correct COMMIT_ID of mentioned patch which is available in the thread:
https://lore.kernel.org/lkml/20201221150903.26630-1-pali@kernel.org/T/#u
As mentioned patch is required for change in this patch to work. Above
mentioned patch is prerequisite for this patch and therefore needs to be
reviewed and applied prior this patch.
Note that same issue as in this USB 3.0 PHY patch was already resolved and
applied also for SATA PHY and PCIe PHY on A3720 SOC in following commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=45aefe3d2251e4e229d7662052739f96ad1d08d9
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0c6ae0f8948a2be6bf4e8b4bbab9ca1343289b6
And these commits were also backported to stable kernel versions (where
were affected commits which broke drivers initialization).
---
drivers/usb/host/xhci-mvebu.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
index 60651a50770f..ec4f6d6e44cf 100644
--- a/drivers/usb/host/xhci-mvebu.c
+++ b/drivers/usb/host/xhci-mvebu.c
@@ -8,6 +8,7 @@
#include <linux/mbus.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/phy/phy.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
@@ -77,9 +78,43 @@ int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
{
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct device *dev = hcd->self.controller;
+ struct phy *phy;
+ int ret;
/* Without reset on resume, the HC won't work at all */
xhci->quirks |= XHCI_RESET_ON_RESUME;
+ /* Old bindings miss the PHY handle */
+ phy = of_phy_get(dev->of_node, "usb3-phy");
+ if (IS_ERR(phy) && PTR_ERR(phy) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ else if (IS_ERR(phy))
+ goto phy_out;
+
+ ret = phy_init(phy);
+ if (ret)
+ goto phy_put;
+
+ ret = phy_set_mode(phy, PHY_MODE_USB_HOST_SS);
+ if (ret)
+ goto phy_exit;
+
+ ret = phy_power_on(phy);
+ if (ret == -EOPNOTSUPP) {
+ /* Skip initializatin of XHCI PHY when it is unsupported by firmware */
+ dev_warn(dev, "PHY unsupported by firmware\n");
+ xhci->quirks |= XHCI_SKIP_PHY_INIT;
+ }
+ if (ret)
+ goto phy_exit;
+
+ phy_power_off(phy);
+phy_exit:
+ phy_exit(phy);
+phy_put:
+ of_phy_put(phy);
+phy_out:
+
return 0;
}
--
2.20.1
^ permalink raw reply related
* [RESEND] usb: gadget: Question on chipidea UDC driver
From: Yuval Shaia @ 2020-12-23 16:19 UTC (permalink / raw)
To: Peter.Chen@nxp.com; +Cc: linux-usb@vger.kernel.org, Yuval Shaia
Hello,
I'm using a board equipped with ChipIdea UDC and trying to expose storage device (for example) out of it.
I load the following modules/drivers:
udc-core
libcomposite
ci_hdrc
ci_hdrc_usb
usb_f_mass_storage.
Next, I used the basic setup via configfs:
idVendor = 0x1d6b
idProduct = 0x0001
Created an empty config, function and linked the function to configuration:
mkdir configs/c.1
mkdir functions/mass_storage.1
(also created lun0 with dd)
ln -s functions/mass_storage.1 configs/c.1
Then started the device:
echo ci_hdrc.0 > UDC
On device side I can see that the setup from Linux perspective is looking good:
[ 8.360082] Mass Storage Function, version: 2009/09/11
[ 8.360094] LUN: removable file: (no medium)
However on the host side I see some errors:
[ 10.087328] usb 1-1: device descriptor read/64, error -32
[ 10.455328] usb 1-1: device descriptor read/64, error -32
[ 10.695328] usb 1-1: device descriptor read/64, error -32
[ 11.875327] usb 1-1: device not accepting address 4, error -32
[ 12.423327] usb 1-1: device not accepting address 5, error -32
[ 12.429178] usb usb1-port1: unable to enumerate USB device
I added some debug printks to both coreidea/udc.c and coreidea/core.c and can see that the interatom between the platform driver and the device controller is ok (i.e interrupts etc).
git tag 4.14.76.
Any idea?
Thanks a lot in advance for any help.
Yuval
^ permalink raw reply
* [PATCH v2] usb: host: xhci-plat: fix support for XHCI_SKIP_PHY_INIT quirk
From: Pali Rohár @ 2020-12-23 16:18 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, Peter Chen
Cc: Jun Li, linux-usb, linux-kernel
In-Reply-To: <20201221150903.26630-1-pali@kernel.org>
Currently init_quirk callbacks for xhci platform drivers are called
xhci_plat_setup() function which is called after chip reset completes.
It happens in the middle of the usb_add_hcd() function.
But XHCI_SKIP_PHY_INIT quirk is checked in the xhci_plat_probe() function
prior calling usb_add_hcd() function. Therefore this XHCI_SKIP_PHY_INIT
currently does nothing as prior xhci_plat_setup() it is not set.
Quirk XHCI_SKIP_PHY_INIT is only setting hcd->skip_phy_initialization value
which really needs to be set prior calling usb_add_hcd() as this function
at its beginning skips PHY init if this member is set.
This patch fixes implementation of the XHCI_SKIP_PHY_INIT quirk by calling
init_quirk callbacks (via xhci_priv_init_quirk()) prior checking if
XHCI_SKIP_PHY_INIT is set. Also checking if either xhci->quirks or
priv->quirks contains this XHCI_SKIP_PHY_INIT quirk.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
Changes in v2:
* Check also xhci->quirks as xhci_priv_init_quirk() callbacks are setting xhci->quirks
* Tested with "usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720" patch
* Removed Fixes: line
---
drivers/usb/host/xhci-plat.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 4d34f6005381..0eab7cb5a767 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -89,13 +89,6 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
/* called during probe() after chip reset completes */
static int xhci_plat_setup(struct usb_hcd *hcd)
{
- int ret;
-
-
- ret = xhci_priv_init_quirk(hcd);
- if (ret)
- return ret;
-
return xhci_gen_setup(hcd, xhci_plat_quirks);
}
@@ -330,7 +323,14 @@ static int xhci_plat_probe(struct platform_device *pdev)
hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
xhci->shared_hcd->tpl_support = hcd->tpl_support;
- if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
+
+ if (priv) {
+ ret = xhci_priv_init_quirk(hcd);
+ if (ret)
+ goto disable_usb_phy;
+ }
+
+ if ((xhci->quirks & XHCI_SKIP_PHY_INIT) || (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)))
hcd->skip_phy_initialization = 1;
if (priv && (priv->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK))
--
2.20.1
^ permalink raw reply related
* memory leak in zr364xx_probe
From: syzbot @ 2020-12-23 15:25 UTC (permalink / raw)
To: linux-kernel, linux-media, linux-usb, mchehab, royale,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 3644e2d2 mm/filemap: fix infinite loop in generic_file_buf..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16f80eff500000
kernel config: https://syzkaller.appspot.com/x/.config?x=37c889fb8b2761af
dashboard link: https://syzkaller.appspot.com/bug?extid=b4d54814b339b5c6bbd4
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1089df07500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1671c77f500000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+b4d54814b339b5c6bbd4@syzkaller.appspotmail.com
BUG: memory leak
unreferenced object 0xffffc90000e71000 (size 200704):
comm "kworker/0:2", pid 3653, jiffies 4294942426 (age 13.820s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000110a155e>] __vmalloc_node_range+0x3a5/0x410 mm/vmalloc.c:2585
[<000000008a1ee970>] __vmalloc_node mm/vmalloc.c:2617 [inline]
[<000000008a1ee970>] vmalloc+0x49/0x50 mm/vmalloc.c:2650
[<00000000a6a3abfa>] zr364xx_board_init drivers/media/usb/zr364xx/zr364xx.c:1348 [inline]
[<00000000a6a3abfa>] zr364xx_probe+0x60b/0x833 drivers/media/usb/zr364xx/zr364xx.c:1509
[<0000000014a572f5>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
[<00000000f30ee977>] really_probe+0x159/0x480 drivers/base/dd.c:561
[<00000000ddb29374>] driver_probe_device+0x84/0x100 drivers/base/dd.c:745
[<0000000073c89cb9>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:851
[<000000009f56a99c>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
[<00000000848d591a>] __device_attach+0x122/0x250 drivers/base/dd.c:919
[<00000000168be5bb>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
[<00000000464f40a6>] device_add+0x5be/0xc30 drivers/base/core.c:3091
[<000000008c75a2b5>] usb_set_configuration+0x9d9/0xb90 drivers/usb/core/message.c:2164
[<00000000071d14a5>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
[<00000000f325b973>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
[<00000000f30ee977>] really_probe+0x159/0x480 drivers/base/dd.c:561
[<00000000ddb29374>] driver_probe_device+0x84/0x100 drivers/base/dd.c:745
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply
* Re: [RESEND] usb: dwc3: meson-g12a: disable clk on error handling path in probe
From: Zheng Zengkai @ 2020-12-23 14:41 UTC (permalink / raw)
To: Greg KH
Cc: balbi, khilman, narmstrong, jbrunet, martin.blumenstingl,
linux-usb, linux-arm-kernel, linux-amlogic, linux-kernel
In-Reply-To: <X+L7usyEWYXzxQWD@kroah.com>
Hi Greg,
> On Wed, Dec 23, 2020 at 10:13:03AM +0800, Zheng Zengkai wrote:
>> Hi everyone,
>>
>> Friendly ping:
>>
>> Just want to know why this patch was ignored,
> Right now it is the merge window and we can't do anything with any
> patches until 5.11-rc1 is out. After that happens, I'll work on
> catching up on older patches like this.
>
> thanks,
>
> greg k-h
> .
Thank you very much for your reply and information!
Best Regards,
Zheng Zengkai
^ permalink raw reply
* Re: [PATCH -next] usb: host: use DEFINE_MUTEX (and mutex_init() had been too late)
From: Greg KH @ 2020-12-23 14:18 UTC (permalink / raw)
To: Zheng Yongjun; +Cc: linux-usb, linux-kernel
In-Reply-To: <20201223141109.32290-1-zhengyongjun3@huawei.com>
On Wed, Dec 23, 2020 at 10:11:09PM +0800, Zheng Yongjun wrote:
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
> drivers/usb/host/u132-hcd.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Again, dropped, due to lack of changelog text :(
^ permalink raw reply
* Re: [PATCH -next] usb: misc: use DEFINE_MUTEX (and mutex_init() had been too late)
From: Greg KH @ 2020-12-23 14:17 UTC (permalink / raw)
To: Zheng Yongjun; +Cc: linux-usb, linux-kernel
In-Reply-To: <20201223141044.32235-1-zhengyongjun3@huawei.com>
On Wed, Dec 23, 2020 at 10:10:44PM +0800, Zheng Yongjun wrote:
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
> drivers/usb/misc/ftdi-elan.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
I can not take patches without any changelog text, sorry.
And try including the driver name in the subject line please.
thanks,
greg k-h
^ permalink raw reply
* [PATCH -next] usb: usbip: Use DEFINE_SPINLOCK() for spinlock
From: Zheng Yongjun @ 2020-12-23 14:14 UTC (permalink / raw)
To: valentina.manea.m, shuah, linux-usb, linux-kernel; +Cc: Zheng Yongjun
spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/usb/usbip/stub_main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index c1c0bbc9f8b1..77a5b3f8736a 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -23,7 +23,7 @@ struct kmem_cache *stub_priv_cache;
*/
#define MAX_BUSID 16
static struct bus_id_priv busid_table[MAX_BUSID];
-static spinlock_t busid_table_lock;
+static DEFINE_SPINLOCK(busid_table_lock);
static void init_busid_table(void)
{
@@ -35,8 +35,6 @@ static void init_busid_table(void)
*/
memset(busid_table, 0, sizeof(busid_table));
- spin_lock_init(&busid_table_lock);
-
for (i = 0; i < MAX_BUSID; i++)
spin_lock_init(&busid_table[i].busid_lock);
}
--
2.22.0
^ permalink raw reply related
* [PATCH -next] usb: host: use DEFINE_MUTEX (and mutex_init() had been too late)
From: Zheng Yongjun @ 2020-12-23 14:11 UTC (permalink / raw)
To: linux-usb, linux-kernel; +Cc: Zheng Yongjun
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/usb/host/u132-hcd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 995bc52d2d22..fb692719a03a 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -78,7 +78,7 @@ static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait);
* u132_module_lock exists to protect access to global variables
*
*/
-static struct mutex u132_module_lock;
+static DEFINE_MUTEX(u132_module_lock);
static int u132_exiting;
static int u132_instances;
/*
@@ -3190,7 +3190,6 @@ static int __init u132_hcd_init(void)
int retval;
u132_instances = 0;
u132_exiting = 0;
- mutex_init(&u132_module_lock);
if (usb_disabled())
return -ENODEV;
printk(KERN_INFO "driver %s\n", hcd_name);
--
2.22.0
^ permalink raw reply related
* [PATCH -next] usb: misc: use DEFINE_MUTEX (and mutex_init() had been too late)
From: Zheng Yongjun @ 2020-12-23 14:10 UTC (permalink / raw)
To: linux-usb, linux-kernel; +Cc: Zheng Yongjun
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/usb/misc/ftdi-elan.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 8a3d9c0c8d8b..bfb538f2cac1 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -61,7 +61,7 @@ extern struct platform_driver u132_platform_driver;
* ftdi_module_lock exists to protect access to global variables
*
*/
-static struct mutex ftdi_module_lock;
+static DEFINE_MUTEX(ftdi_module_lock);
static int ftdi_instances = 0;
static struct list_head ftdi_static_list;
/*
@@ -2761,7 +2761,6 @@ static int __init ftdi_elan_init(void)
{
int result;
pr_info("driver %s\n", ftdi_elan_driver.name);
- mutex_init(&ftdi_module_lock);
INIT_LIST_HEAD(&ftdi_static_list);
result = usb_register(&ftdi_elan_driver);
if (result) {
--
2.22.0
^ permalink raw reply related
* Re: [RESEND] usb: dwc3: meson-g12a: disable clk on error handling path in probe
From: Greg KH @ 2020-12-23 8:11 UTC (permalink / raw)
To: Zheng Zengkai
Cc: balbi, khilman, narmstrong, jbrunet, martin.blumenstingl,
linux-usb, linux-arm-kernel, linux-amlogic, linux-kernel
In-Reply-To: <c069b566-224d-f938-089c-6a69d1ec9d55@huawei.com>
On Wed, Dec 23, 2020 at 10:13:03AM +0800, Zheng Zengkai wrote:
> Hi everyone,
>
> Friendly ping:
>
> Just want to know why this patch was ignored,
Right now it is the merge window and we can't do anything with any
patches until 5.11-rc1 is out. After that happens, I'll work on
catching up on older patches like this.
thanks,
greg k-h
^ permalink raw reply
* UBSAN: shift-out-of-bounds in vhci_hub_control
From: syzbot @ 2020-12-23 4:55 UTC (permalink / raw)
To: gregkh, linux-kernel, linux-usb, shuah, syzkaller-bugs,
valentina.manea.m
Hello,
syzbot found the following issue on:
HEAD commit: a409ed15 Merge tag 'gpio-v5.11-1' of git://git.kernel.org/..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1053b623500000
kernel config: https://syzkaller.appspot.com/x/.config?x=f7c39e7211134bc0
dashboard link: https://syzkaller.appspot.com/bug?extid=297d20e437b79283bf6d
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15f4f137500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1115f30f500000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+297d20e437b79283bf6d@syzkaller.appspotmail.com
================================================================================
UBSAN: shift-out-of-bounds in drivers/usb/usbip/vhci_hcd.c:399:41
shift exponent 768 is too large for 32-bit type 'int'
CPU: 1 PID: 8482 Comm: syz-executor092 Not tainted 5.10.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x107/0x163 lib/dump_stack.c:120
ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
__ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:395
vhci_hub_control.cold+0x205/0x246 drivers/usb/usbip/vhci_hcd.c:399
rh_call_control drivers/usb/core/hcd.c:683 [inline]
rh_urb_enqueue drivers/usb/core/hcd.c:841 [inline]
usb_hcd_submit_urb+0xcaa/0x22d0 drivers/usb/core/hcd.c:1544
usb_submit_urb+0x6e4/0x1560 drivers/usb/core/urb.c:585
usb_start_wait_urb+0x101/0x4c0 drivers/usb/core/message.c:58
usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
usb_control_msg+0x31c/0x4a0 drivers/usb/core/message.c:153
do_proc_control+0x4cb/0x9c0 drivers/usb/core/devio.c:1165
proc_control drivers/usb/core/devio.c:1191 [inline]
usbdev_do_ioctl drivers/usb/core/devio.c:2535 [inline]
usbdev_ioctl+0x12c1/0x3b20 drivers/usb/core/devio.c:2708
vfs_ioctl fs/ioctl.c:48 [inline]
__do_sys_ioctl fs/ioctl.c:753 [inline]
__se_sys_ioctl fs/ioctl.c:739 [inline]
__x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x443f39
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 fb d7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd18a092c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002e0 RCX: 0000000000443f39
RDX: 0000000020000000 RSI: 00000000c0185500 RDI: 0000000000000003
RBP: 00000000006ce018 R08: 0000000000000000 R09: 00000000004002e0
R10: 000000000000000f R11: 0000000000000246 R12: 0000000000401bc0
R13: 0000000000401c50 R14: 0000000000000000 R15: 0000000000000000
================================================================================
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply
* [PATCH AUTOSEL 5.10 042/217] usb: typec: ucsi: Work around PPM losing change information
From: Sasha Levin @ 2020-12-23 2:13 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Benjamin Berg, Hans de Goede, Heikki Krogerus, Greg Kroah-Hartman,
Sasha Levin, linux-usb
In-Reply-To: <20201223021626.2790791-1-sashal@kernel.org>
From: Benjamin Berg <bberg@redhat.com>
[ Upstream commit 217504a055325fe76ec1142aa15f14d3db77f94f ]
Some/many PPMs are simply clearing the change bitfield when a
notification on a port is acknowledge. Unfortunately, doing so means
that any changes between the GET_CONNECTOR_STATUS and ACK_CC_CI commands
is simply lost.
Work around this by re-fetching the connector status afterwards. We can
then infer any changes that we see have happened but that may not be
respresented in the change bitfield.
We end up with the following actions:
1. UCSI_GET_CONNECTOR_STATUS, store result, update unprocessed_changes
2. UCSI_GET_CAM_SUPPORTED, discard result
3. ACK connector change
4. UCSI_GET_CONNECTOR_STATUS, store result
5. Infere lost changes by comparing UCSI_GET_CONNECTOR_STATUS results
6. If PPM reported a new change, then restart in order to ACK
7. Process everything as usual.
The worker is also changed to re-schedule itself if a new change
notification happened while it was running.
Doing this fixes quite commonly occurring issues where e.g. the UCSI
power supply would remain online even thought the ThunderBolt cable was
unplugged.
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benjamin Berg <bberg@redhat.com>
Link: https://lore.kernel.org/r/20201009144047.505957-3-benjamin@sipsolutions.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/ucsi/ucsi.c | 125 ++++++++++++++++++++++++++++------
drivers/usb/typec/ucsi/ucsi.h | 2 +
2 files changed, 107 insertions(+), 20 deletions(-)
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 51a570d40a42e..f02958927cbd8 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -53,7 +53,7 @@ static int ucsi_acknowledge_connector_change(struct ucsi *ucsi)
ctrl = UCSI_ACK_CC_CI;
ctrl |= UCSI_ACK_CONNECTOR_CHANGE;
- return ucsi->ops->async_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl));
+ return ucsi->ops->sync_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl));
}
static int ucsi_exec_command(struct ucsi *ucsi, u64 command);
@@ -625,21 +625,113 @@ static void ucsi_handle_connector_change(struct work_struct *work)
struct ucsi_connector *con = container_of(work, struct ucsi_connector,
work);
struct ucsi *ucsi = con->ucsi;
+ struct ucsi_connector_status pre_ack_status;
+ struct ucsi_connector_status post_ack_status;
enum typec_role role;
+ u16 inferred_changes;
+ u16 changed_flags;
u64 command;
int ret;
mutex_lock(&con->lock);
+ /*
+ * Some/many PPMs have an issue where all fields in the change bitfield
+ * are cleared when an ACK is send. This will causes any change
+ * between GET_CONNECTOR_STATUS and ACK to be lost.
+ *
+ * We work around this by re-fetching the connector status afterwards.
+ * We then infer any changes that we see have happened but that may not
+ * be represented in the change bitfield.
+ *
+ * Also, even though we don't need to know the currently supported alt
+ * modes, we run the GET_CAM_SUPPORTED command to ensure the PPM does
+ * not get stuck in case it assumes we do.
+ * Always do this, rather than relying on UCSI_CONSTAT_CAM_CHANGE to be
+ * set in the change bitfield.
+ *
+ * We end up with the following actions:
+ * 1. UCSI_GET_CONNECTOR_STATUS, store result, update unprocessed_changes
+ * 2. UCSI_GET_CAM_SUPPORTED, discard result
+ * 3. ACK connector change
+ * 4. UCSI_GET_CONNECTOR_STATUS, store result
+ * 5. Infere lost changes by comparing UCSI_GET_CONNECTOR_STATUS results
+ * 6. If PPM reported a new change, then restart in order to ACK
+ * 7. Process everything as usual.
+ *
+ * We may end up seeing a change twice, but we can only miss extremely
+ * short transitional changes.
+ */
+
+ /* 1. First UCSI_GET_CONNECTOR_STATUS */
+ command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num);
+ ret = ucsi_send_command(ucsi, command, &pre_ack_status,
+ sizeof(pre_ack_status));
+ if (ret < 0) {
+ dev_err(ucsi->dev, "%s: GET_CONNECTOR_STATUS failed (%d)\n",
+ __func__, ret);
+ goto out_unlock;
+ }
+ con->unprocessed_changes |= pre_ack_status.change;
+
+ /* 2. Run UCSI_GET_CAM_SUPPORTED and discard the result. */
+ command = UCSI_GET_CAM_SUPPORTED;
+ command |= UCSI_CONNECTOR_NUMBER(con->num);
+ ucsi_send_command(con->ucsi, command, NULL, 0);
+
+ /* 3. ACK connector change */
+ clear_bit(EVENT_PENDING, &ucsi->flags);
+ ret = ucsi_acknowledge_connector_change(ucsi);
+ if (ret) {
+ dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);
+ goto out_unlock;
+ }
+
+ /* 4. Second UCSI_GET_CONNECTOR_STATUS */
command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num);
- ret = ucsi_send_command(ucsi, command, &con->status,
- sizeof(con->status));
+ ret = ucsi_send_command(ucsi, command, &post_ack_status,
+ sizeof(post_ack_status));
if (ret < 0) {
dev_err(ucsi->dev, "%s: GET_CONNECTOR_STATUS failed (%d)\n",
__func__, ret);
goto out_unlock;
}
+ /* 5. Inferre any missing changes */
+ changed_flags = pre_ack_status.flags ^ post_ack_status.flags;
+ inferred_changes = 0;
+ if (UCSI_CONSTAT_PWR_OPMODE(changed_flags) != 0)
+ inferred_changes |= UCSI_CONSTAT_POWER_OPMODE_CHANGE;
+
+ if (changed_flags & UCSI_CONSTAT_CONNECTED)
+ inferred_changes |= UCSI_CONSTAT_CONNECT_CHANGE;
+
+ if (changed_flags & UCSI_CONSTAT_PWR_DIR)
+ inferred_changes |= UCSI_CONSTAT_POWER_DIR_CHANGE;
+
+ if (UCSI_CONSTAT_PARTNER_FLAGS(changed_flags) != 0)
+ inferred_changes |= UCSI_CONSTAT_PARTNER_CHANGE;
+
+ if (UCSI_CONSTAT_PARTNER_TYPE(changed_flags) != 0)
+ inferred_changes |= UCSI_CONSTAT_PARTNER_CHANGE;
+
+ /* Mask out anything that was correctly notified in the later call. */
+ inferred_changes &= ~post_ack_status.change;
+ if (inferred_changes)
+ dev_dbg(ucsi->dev, "%s: Inferred changes that would have been lost: 0x%04x\n",
+ __func__, inferred_changes);
+
+ con->unprocessed_changes |= inferred_changes;
+
+ /* 6. If PPM reported a new change, then restart in order to ACK */
+ if (post_ack_status.change)
+ goto out_unlock;
+
+ /* 7. Continue as if nothing happened */
+ con->status = post_ack_status;
+ con->status.change = con->unprocessed_changes;
+ con->unprocessed_changes = 0;
+
role = !!(con->status.flags & UCSI_CONSTAT_PWR_DIR);
if (con->status.change & UCSI_CONSTAT_POWER_OPMODE_CHANGE ||
@@ -680,28 +772,19 @@ static void ucsi_handle_connector_change(struct work_struct *work)
ucsi_port_psy_changed(con);
}
- if (con->status.change & UCSI_CONSTAT_CAM_CHANGE) {
- /*
- * We don't need to know the currently supported alt modes here.
- * Running GET_CAM_SUPPORTED command just to make sure the PPM
- * does not get stuck in case it assumes we do so.
- */
- command = UCSI_GET_CAM_SUPPORTED;
- command |= UCSI_CONNECTOR_NUMBER(con->num);
- ucsi_send_command(con->ucsi, command, NULL, 0);
- }
-
if (con->status.change & UCSI_CONSTAT_PARTNER_CHANGE)
ucsi_partner_change(con);
- ret = ucsi_acknowledge_connector_change(ucsi);
- if (ret)
- dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);
-
trace_ucsi_connector_change(con->num, &con->status);
out_unlock:
- clear_bit(EVENT_PENDING, &ucsi->flags);
+ if (test_and_clear_bit(EVENT_PENDING, &ucsi->flags)) {
+ schedule_work(&con->work);
+ mutex_unlock(&con->lock);
+ return;
+ }
+
+ clear_bit(EVENT_PROCESSING, &ucsi->flags);
mutex_unlock(&con->lock);
}
@@ -719,7 +802,9 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num)
return;
}
- if (!test_and_set_bit(EVENT_PENDING, &ucsi->flags))
+ set_bit(EVENT_PENDING, &ucsi->flags);
+
+ if (!test_and_set_bit(EVENT_PROCESSING, &ucsi->flags))
schedule_work(&con->work);
}
EXPORT_SYMBOL_GPL(ucsi_connector_change);
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index b7a92f2460507..dd9ba60ab4a30 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -296,6 +296,7 @@ struct ucsi {
#define EVENT_PENDING 0
#define COMMAND_PENDING 1
#define ACK_PENDING 2
+#define EVENT_PROCESSING 3
};
#define UCSI_MAX_SVID 5
@@ -322,6 +323,7 @@ struct ucsi_connector {
struct typec_capability typec_cap;
+ u16 unprocessed_changes;
struct ucsi_connector_status status;
struct ucsi_connector_capability cap;
struct power_supply *psy;
--
2.27.0
^ permalink raw reply related
* [PATCH AUTOSEL 5.4 037/130] media: zr364xx: propagate errors from zr364xx_start_readpipe()
From: Sasha Levin @ 2020-12-23 2:16 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Evgeny Novikov, Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin,
linux-usb, linux-media
In-Reply-To: <20201223021813.2791612-1-sashal@kernel.org>
From: Evgeny Novikov <novikov@ispras.ru>
[ Upstream commit af0321a5be3e5647441eb6b79355beaa592df97a ]
zr364xx_start_readpipe() can fail but callers do not care about that.
This can result in various negative consequences. The patch adds missed
error handling.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/usb/zr364xx/zr364xx.c | 31 ++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index 637962825d7a8..32f463f05eacd 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -1330,6 +1330,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
{
struct zr364xx_pipeinfo *pipe = cam->pipe;
unsigned long i;
+ int err;
DBG("board init: %p\n", cam);
memset(pipe, 0, sizeof(*pipe));
@@ -1362,9 +1363,8 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
if (i == 0) {
printk(KERN_INFO KBUILD_MODNAME ": out of memory. Aborting\n");
- kfree(cam->pipe->transfer_buffer);
- cam->pipe->transfer_buffer = NULL;
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_free;
} else
cam->buffer.dwFrames = i;
@@ -1379,9 +1379,17 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
/*** end create system buffers ***/
/* start read pipe */
- zr364xx_start_readpipe(cam);
+ err = zr364xx_start_readpipe(cam);
+ if (err)
+ goto err_free;
+
DBG(": board initialized\n");
return 0;
+
+err_free:
+ kfree(cam->pipe->transfer_buffer);
+ cam->pipe->transfer_buffer = NULL;
+ return err;
}
static int zr364xx_probe(struct usb_interface *intf,
@@ -1578,10 +1586,19 @@ static int zr364xx_resume(struct usb_interface *intf)
if (!cam->was_streaming)
return 0;
- zr364xx_start_readpipe(cam);
+ res = zr364xx_start_readpipe(cam);
+ if (res)
+ return res;
+
res = zr364xx_prepare(cam);
- if (!res)
- zr364xx_start_acquire(cam);
+ if (res)
+ goto err_prepare;
+
+ zr364xx_start_acquire(cam);
+ return 0;
+
+err_prepare:
+ zr364xx_stop_readpipe(cam);
return res;
}
#endif
--
2.27.0
^ permalink raw reply related
* Re: cdc_ncm kernel log spam with trendnet 2.5G USB adapter
From: Roland Dreier @ 2020-12-23 3:01 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: Oliver Neukum, netdev, linux-usb
In-Reply-To: <20201222184926.35382198@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On Tue, Dec 22, 2020 at 6:49 PM Jakub Kicinski <kuba@kernel.org> wrote:
> I'm not sure what the story here is but if this change is expected to
> get into the networking tree we'll need a fresh posting. This sort of
> scissored reply does not get into patchwork.
OK, will resend. Too bad about patchwork, "git am" drops everything
before scissors lines by default.
> It sounds like you're getting tens of those messages a second, we can
> remove the message but the device is still generating spurious events,
> wasting CPU cycles. Was blocking those events deemed unfeasible?
I certainly don't know enough about the USB CDC class to know why the
spurious messages are showing up or whether they could be suppressed
without a fix in the adapter firmware. But even ~30 spurious messages
per second doesn't seem so bad for a multi-gig adapter that might be
handling 100,000 or more packets per second.
- R.
^ permalink raw reply
* [PATCH AUTOSEL 5.4 114/130] USB: typec: tcpm: Fix PR_SWAP error handling
From: Sasha Levin @ 2020-12-23 2:17 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Kyle Tso, Guenter Roeck, Heikki Krogerus, Badhri Jagan Sridharan,
Will McVicker, Greg Kroah-Hartman, Sasha Levin, linux-usb
In-Reply-To: <20201223021813.2791612-1-sashal@kernel.org>
From: Kyle Tso <kyletso@google.com>
[ Upstream commit 301a633c1b5b2caa4c4b97a83270d4a1d60c53bf ]
PD rev3.0 8.3.3.16.3.6 PE_PRS_SRC_SNK_Wait_Source_on State
The Policy Enging Shall transition to the ErrorRecovery state when the
PSSourceOnTimer times out ...
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20201210160521.3417426-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/tcpm/tcpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 5bb84cb4876a9..0c0f251ab8a51 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3451,7 +3451,7 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
}
- tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
+ tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
tcpm_set_state(port, SNK_STARTUP, 0);
--
2.27.0
^ permalink raw reply related
* [PATCH AUTOSEL 5.4 115/130] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
From: Sasha Levin @ 2020-12-23 2:17 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Kyle Tso, Guenter Roeck, Heikki Krogerus, Badhri Jagan Sridharan,
Will McVicker, Greg Kroah-Hartman, Sasha Levin, linux-usb
In-Reply-To: <20201223021813.2791612-1-sashal@kernel.org>
From: Kyle Tso <kyletso@google.com>
[ Upstream commit fe79d5de77204dd946cfad76a9bec23354b1a500 ]
TCPM state machine needs 20-25ms to enter the ErrorRecovery state after
tPSSourceOn timer timeouts. Change the timer from max 480ms to 450ms to
ensure that the timer complies with the Spec. In order to keep the
flexibility for other usecases using tPSSourceOn, add another timer only
for PR_SWAP.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20201210160521.3417426-5-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/tcpm/tcpm.c | 2 +-
include/linux/usb/pd.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0c0f251ab8a51..77a49e16e285e 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3451,7 +3451,7 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
}
- tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
+ tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON_PRS);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
tcpm_set_state(port, SNK_STARTUP, 0);
diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
index 6655ce32feff1..203fca353fdce 100644
--- a/include/linux/usb/pd.h
+++ b/include/linux/usb/pd.h
@@ -432,6 +432,7 @@ static inline unsigned int rdo_max_power(u32 rdo)
#define PD_T_DRP_SRC 30
#define PD_T_PS_SOURCE_OFF 920
#define PD_T_PS_SOURCE_ON 480
+#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */
#define PD_T_PS_HARD_RESET 30
#define PD_T_SRC_RECOVER 760
#define PD_T_SRC_RECOVER_MAX 1000
--
2.27.0
^ permalink raw reply related
* Re: cdc_ncm kernel log spam with trendnet 2.5G USB adapter
From: Jakub Kicinski @ 2020-12-23 2:49 UTC (permalink / raw)
To: Roland Dreier; +Cc: Oliver Neukum, netdev, linux-usb
In-Reply-To: <20201219222140.4161646-1-roland@kernel.org>
On Sat, 19 Dec 2020 14:21:40 -0800 Roland Dreier wrote:
> (Apologies, trying one more time with a better mailer)
>
> Sorry it took so long, but I finally got a chance to test the patches. They
> seem to work well, but they only get rid of the downlink / uplink speed spam -
> I still get the following filling my kernel log with a patched kernel:
>
> [ 29.830383] cdc_ncm 2-2:2.0 enp0s2u2c2: network connection: connected
> [ 29.894359] cdc_ncm 2-2:2.0 enp0s2u2c2: network connection: connected
> [ 29.958601] cdc_ncm 2-2:2.0 enp0s2u2c2: network connection: connected
> [ 30.022473] cdc_ncm 2-2:2.0 enp0s2u2c2: network connection: connected
> [ 30.086548] cdc_ncm 2-2:2.0 enp0s2u2c2: network connection: connected
>
> with the below patch on top of your 3, then my kernel log is clean.
>
> Please apply your patches plus my patch, and feel free to add
>
> Tested-by: Roland Dreier <roland@kernel.org>
>
> to the other three.
Hi Ronald, thanks for the patch.
I'm not sure what the story here is but if this change is expected to
get into the networking tree we'll need a fresh posting. This sort of
scissored reply does not get into patchwork.
> Subject: [PATCH] CDC-NCM: remove "connected" log message
>
> The cdc_ncm driver passes network connection notifications up to
> usbnet_link_change(), which is the right place for any logging.
> Remove the netdev_info() duplicating this from the driver itself.
>
> This stops devices such as my "TRENDnet USB 10/100/1G/2.5G LAN"
> (ID 20f4:e02b) adapter from spamming the kernel log with
>
> cdc_ncm 2-2:2.0 enp0s2u2c2: network connection: connected
>
> messages every 60 msec or so.
>
> Signed-off-by: Roland Dreier <roland@kernel.org>
> ---
> drivers/net/usb/cdc_ncm.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
> index a45fcc44facf..50d3a4e6d445 100644
> --- a/drivers/net/usb/cdc_ncm.c
> +++ b/drivers/net/usb/cdc_ncm.c
> @@ -1850,9 +1850,6 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
> * USB_CDC_NOTIFY_NETWORK_CONNECTION notification shall be
> * sent by device after USB_CDC_NOTIFY_SPEED_CHANGE.
> */
> - netif_info(dev, link, dev->net,
> - "network connection: %sconnected\n",
> - !!event->wValue ? "" : "dis");
> usbnet_link_change(dev, !!event->wValue, 0);
> break;
>
It sounds like you're getting tens of those messages a second, we can
remove the message but the device is still generating spurious events,
wasting CPU cycles. Was blocking those events deemed unfeasible?
^ permalink raw reply
* [PATCH AUTOSEL 4.19 75/87] USB: typec: tcpm: Fix PR_SWAP error handling
From: Sasha Levin @ 2020-12-23 2:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Kyle Tso, Guenter Roeck, Heikki Krogerus, Badhri Jagan Sridharan,
Will McVicker, Greg Kroah-Hartman, Sasha Levin, linux-usb
In-Reply-To: <20201223022103.2792705-1-sashal@kernel.org>
From: Kyle Tso <kyletso@google.com>
[ Upstream commit 301a633c1b5b2caa4c4b97a83270d4a1d60c53bf ]
PD rev3.0 8.3.3.16.3.6 PE_PRS_SRC_SNK_Wait_Source_on State
The Policy Enging Shall transition to the ErrorRecovery state when the
PSSourceOnTimer times out ...
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20201210160521.3417426-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/tcpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index af41d4dce3adb..9c901e3b17472 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -3455,7 +3455,7 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
}
- tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
+ tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
tcpm_set_state(port, SNK_STARTUP, 0);
--
2.27.0
^ permalink raw reply related
* [PATCH AUTOSEL 4.9 16/48] media: zr364xx: propagate errors from zr364xx_start_readpipe()
From: Sasha Levin @ 2020-12-23 2:23 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Evgeny Novikov, Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin,
linux-usb, linux-media
In-Reply-To: <20201223022417.2794032-1-sashal@kernel.org>
From: Evgeny Novikov <novikov@ispras.ru>
[ Upstream commit af0321a5be3e5647441eb6b79355beaa592df97a ]
zr364xx_start_readpipe() can fail but callers do not care about that.
This can result in various negative consequences. The patch adds missed
error handling.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/usb/zr364xx/zr364xx.c | 31 ++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index c5513f55e64e0..8c8c4c9858507 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -1357,6 +1357,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
{
struct zr364xx_pipeinfo *pipe = cam->pipe;
unsigned long i;
+ int err;
DBG("board init: %p\n", cam);
memset(pipe, 0, sizeof(*pipe));
@@ -1390,9 +1391,8 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
if (i == 0) {
printk(KERN_INFO KBUILD_MODNAME ": out of memory. Aborting\n");
- kfree(cam->pipe->transfer_buffer);
- cam->pipe->transfer_buffer = NULL;
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_free;
} else
cam->buffer.dwFrames = i;
@@ -1407,9 +1407,17 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
/*** end create system buffers ***/
/* start read pipe */
- zr364xx_start_readpipe(cam);
+ err = zr364xx_start_readpipe(cam);
+ if (err)
+ goto err_free;
+
DBG(": board initialized\n");
return 0;
+
+err_free:
+ kfree(cam->pipe->transfer_buffer);
+ cam->pipe->transfer_buffer = NULL;
+ return err;
}
static int zr364xx_probe(struct usb_interface *intf,
@@ -1608,10 +1616,19 @@ static int zr364xx_resume(struct usb_interface *intf)
if (!cam->was_streaming)
return 0;
- zr364xx_start_readpipe(cam);
+ res = zr364xx_start_readpipe(cam);
+ if (res)
+ return res;
+
res = zr364xx_prepare(cam);
- if (!res)
- zr364xx_start_acquire(cam);
+ if (res)
+ goto err_prepare;
+
+ zr364xx_start_acquire(cam);
+ return 0;
+
+err_prepare:
+ zr364xx_stop_readpipe(cam);
return res;
}
#endif
--
2.27.0
^ permalink raw reply related
* [PATCH AUTOSEL 4.4 15/38] media: zr364xx: propagate errors from zr364xx_start_readpipe()
From: Sasha Levin @ 2020-12-23 2:24 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Evgeny Novikov, Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin,
linux-usb, linux-media
In-Reply-To: <20201223022516.2794471-1-sashal@kernel.org>
From: Evgeny Novikov <novikov@ispras.ru>
[ Upstream commit af0321a5be3e5647441eb6b79355beaa592df97a ]
zr364xx_start_readpipe() can fail but callers do not care about that.
This can result in various negative consequences. The patch adds missed
error handling.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/usb/zr364xx/zr364xx.c | 31 ++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index 2d56cccaa4747..505e08ddde2bb 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -1359,6 +1359,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
{
struct zr364xx_pipeinfo *pipe = cam->pipe;
unsigned long i;
+ int err;
DBG("board init: %p\n", cam);
memset(pipe, 0, sizeof(*pipe));
@@ -1392,9 +1393,8 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
if (i == 0) {
printk(KERN_INFO KBUILD_MODNAME ": out of memory. Aborting\n");
- kfree(cam->pipe->transfer_buffer);
- cam->pipe->transfer_buffer = NULL;
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_free;
} else
cam->buffer.dwFrames = i;
@@ -1409,9 +1409,17 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
/*** end create system buffers ***/
/* start read pipe */
- zr364xx_start_readpipe(cam);
+ err = zr364xx_start_readpipe(cam);
+ if (err)
+ goto err_free;
+
DBG(": board initialized\n");
return 0;
+
+err_free:
+ kfree(cam->pipe->transfer_buffer);
+ cam->pipe->transfer_buffer = NULL;
+ return err;
}
static int zr364xx_probe(struct usb_interface *intf,
@@ -1610,10 +1618,19 @@ static int zr364xx_resume(struct usb_interface *intf)
if (!cam->was_streaming)
return 0;
- zr364xx_start_readpipe(cam);
+ res = zr364xx_start_readpipe(cam);
+ if (res)
+ return res;
+
res = zr364xx_prepare(cam);
- if (!res)
- zr364xx_start_acquire(cam);
+ if (res)
+ goto err_prepare;
+
+ zr364xx_start_acquire(cam);
+ return 0;
+
+err_prepare:
+ zr364xx_stop_readpipe(cam);
return res;
}
#endif
--
2.27.0
^ permalink raw reply related
* [PATCH AUTOSEL 4.14 21/66] media: zr364xx: propagate errors from zr364xx_start_readpipe()
From: Sasha Levin @ 2020-12-23 2:22 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Evgeny Novikov, Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin,
linux-usb, linux-media
In-Reply-To: <20201223022253.2793452-1-sashal@kernel.org>
From: Evgeny Novikov <novikov@ispras.ru>
[ Upstream commit af0321a5be3e5647441eb6b79355beaa592df97a ]
zr364xx_start_readpipe() can fail but callers do not care about that.
This can result in various negative consequences. The patch adds missed
error handling.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/usb/zr364xx/zr364xx.c | 31 ++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index d30f129a9db75..fe87e2159dae1 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -1352,6 +1352,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
{
struct zr364xx_pipeinfo *pipe = cam->pipe;
unsigned long i;
+ int err;
DBG("board init: %p\n", cam);
memset(pipe, 0, sizeof(*pipe));
@@ -1384,9 +1385,8 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
if (i == 0) {
printk(KERN_INFO KBUILD_MODNAME ": out of memory. Aborting\n");
- kfree(cam->pipe->transfer_buffer);
- cam->pipe->transfer_buffer = NULL;
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_free;
} else
cam->buffer.dwFrames = i;
@@ -1401,9 +1401,17 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)
/*** end create system buffers ***/
/* start read pipe */
- zr364xx_start_readpipe(cam);
+ err = zr364xx_start_readpipe(cam);
+ if (err)
+ goto err_free;
+
DBG(": board initialized\n");
return 0;
+
+err_free:
+ kfree(cam->pipe->transfer_buffer);
+ cam->pipe->transfer_buffer = NULL;
+ return err;
}
static int zr364xx_probe(struct usb_interface *intf,
@@ -1602,10 +1610,19 @@ static int zr364xx_resume(struct usb_interface *intf)
if (!cam->was_streaming)
return 0;
- zr364xx_start_readpipe(cam);
+ res = zr364xx_start_readpipe(cam);
+ if (res)
+ return res;
+
res = zr364xx_prepare(cam);
- if (!res)
- zr364xx_start_acquire(cam);
+ if (res)
+ goto err_prepare;
+
+ zr364xx_start_acquire(cam);
+ return 0;
+
+err_prepare:
+ zr364xx_stop_readpipe(cam);
return res;
}
#endif
--
2.27.0
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 76/87] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
From: Sasha Levin @ 2020-12-23 2:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Kyle Tso, Guenter Roeck, Heikki Krogerus, Badhri Jagan Sridharan,
Will McVicker, Greg Kroah-Hartman, Sasha Levin, linux-usb
In-Reply-To: <20201223022103.2792705-1-sashal@kernel.org>
From: Kyle Tso <kyletso@google.com>
[ Upstream commit fe79d5de77204dd946cfad76a9bec23354b1a500 ]
TCPM state machine needs 20-25ms to enter the ErrorRecovery state after
tPSSourceOn timer timeouts. Change the timer from max 480ms to 450ms to
ensure that the timer complies with the Spec. In order to keep the
flexibility for other usecases using tPSSourceOn, add another timer only
for PR_SWAP.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20201210160521.3417426-5-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/tcpm.c | 2 +-
include/linux/usb/pd.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 9c901e3b17472..95e4725eaf3f7 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -3455,7 +3455,7 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
}
- tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
+ tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON_PRS);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
tcpm_set_state(port, SNK_STARTUP, 0);
diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
index bdf4c88d2aa0a..1a29a7351fbed 100644
--- a/include/linux/usb/pd.h
+++ b/include/linux/usb/pd.h
@@ -441,6 +441,7 @@ static inline unsigned int rdo_max_power(u32 rdo)
#define PD_T_DRP_SRC 30
#define PD_T_PS_SOURCE_OFF 920
#define PD_T_PS_SOURCE_ON 480
+#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */
#define PD_T_PS_HARD_RESET 30
#define PD_T_SRC_RECOVER 760
#define PD_T_SRC_RECOVER_MAX 1000
--
2.27.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox