Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814922/?format=api
{ "id": 814922, "url": "http://patchwork.ozlabs.org/api/patches/814922/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1505742050-5697-2-git-send-email-bmeng.cn@gmail.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1505742050-5697-2-git-send-email-bmeng.cn@gmail.com>", "list_archive_url": null, "date": "2017-09-18T13:40:37", "name": "[U-Boot,01/14] dm: usb: Fix broken usb_stop()", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "e22b1c015d3947a950dce4cb988e970130d560c4", "submitter": { "id": 64981, "url": "http://patchwork.ozlabs.org/api/people/64981/?format=api", "name": "Bin Meng", "email": "bmeng.cn@gmail.com" }, "delegate": { "id": 1699, "url": "http://patchwork.ozlabs.org/api/users/1699/?format=api", "username": "marex", "first_name": "Marek", "last_name": "Vasut", "email": "marek.vasut@gmail.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1505742050-5697-2-git-send-email-bmeng.cn@gmail.com/mbox/", "series": [ { "id": 3647, "url": "http://patchwork.ozlabs.org/api/series/3647/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=3647", "date": "2017-09-18T13:40:36", "name": "usb: xhci: Add interrupt transfer support and full speed device support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3647/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814922/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814922/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"lVJbGR/8\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xwn9z2J2Xz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 23:37:27 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 0B601C21F47; Mon, 18 Sep 2017 13:36:49 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id B236EC21EF7;\n\tMon, 18 Sep 2017 13:36:32 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 49B92C21DA4; Mon, 18 Sep 2017 13:36:30 +0000 (UTC)", "from mail-io0-f195.google.com (mail-io0-f195.google.com\n\t[209.85.223.195])\n\tby lists.denx.de (Postfix) with ESMTPS id BCACCC21DA2\n\tfor <u-boot@lists.denx.de>; Mon, 18 Sep 2017 13:36:29 +0000 (UTC)", "by mail-io0-f195.google.com with SMTP id g32so1096053ioj.1\n\tfor <u-boot@lists.denx.de>; Mon, 18 Sep 2017 06:36:29 -0700 (PDT)", "from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com.\n\t[147.11.156.139]) by smtp.gmail.com with ESMTPSA id\n\t193sm2528740ion.83.2017.09.18.06.36.27\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 18 Sep 2017 06:36:27 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=qpcsJv7i49ZTt8TBw+/yOkTHWLfdPYzKce5IM7t6nEQ=;\n\tb=lVJbGR/8eGZEUh8RX50NGbd2WXSvSsePIcNMDq/4ypdChkuBkE54p7UsbZOtPCDOwx\n\tqN6mmv08B31A5X8d3hfE4AoHbebO3MzFPmJXa0ofLKzfLA/lSewjjLvTLqboB23dCI/t\n\thUkTbxorxy5FJ0nwt9TepHyTA7DsHc6yj+9AaPJzBFf/vi9NOTHoRv2CCc5MeGzvJITx\n\tCrnFQMtAYybZEmfCjGNGbro+4ESMwkB7LXDGJbqW2AtZGTpCfOL9UN2V3odkj93gshgJ\n\tox3MbTpz+thRNSSIzn4EGIQBFgOiMNoQ6w2b23RlYt+m7+2G8T43ifuPKvkPEtDPLiT4\n\t3SkQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=qpcsJv7i49ZTt8TBw+/yOkTHWLfdPYzKce5IM7t6nEQ=;\n\tb=Jfg5REhUq8m4AHfD9GArxqPT0SpRTmNpidg0nfZwBQZZiOAk1CgQSo2S+Fe60DWoRq\n\tR8TKD/+yDWsAri5OBp0Lnyz7VFsIYcWdVCBPW+rG4HWLmCbv/tkew6sb2z++Gfm9k7tU\n\tIHctISZj4gRrl08hdAif0FfiG/azd7InyC69Bqp1fr/ik0ZfvkVsBYueelTDpfAkqLgO\n\tUq3WFuNVfEJfjmNdNBw99GO+5yAc0E4LdnS6sj4+AQ0Byu5n/hUk1m1hJGhN7B5AynD5\n\tiArZB+cInSu4gXKR+cARnkdIYexUYSg3MxKpm+6VrY1oST5nb3aP5IZirATFHvD8nvcv\n\turAg==", "X-Gm-Message-State": "AHPjjUieB2ho/G1NlBfw411wCO5Sah370qXW5l3fgvg5n/8dSvUcZRdO\n\th+GZpOpRYOFKhg==", "X-Google-Smtp-Source": "AOwi7QC90EgtbsY2HDDyjCIDaObcUbuMwr7zLvxh1nGl6hvHhc3fV5UX0Pipt/pnrhYi1XsnMLe4dg==", "X-Received": "by 10.107.185.7 with SMTP id j7mr21024311iof.221.1505741788667; \n\tMon, 18 Sep 2017 06:36:28 -0700 (PDT)", "From": "Bin Meng <bmeng.cn@gmail.com>", "To": "Marek Vasut <marex@denx.de>, U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Mon, 18 Sep 2017 06:40:37 -0700", "Message-Id": "<1505742050-5697-2-git-send-email-bmeng.cn@gmail.com>", "X-Mailer": "git-send-email 1.7.9.5", "In-Reply-To": "<1505742050-5697-1-git-send-email-bmeng.cn@gmail.com>", "References": "<1505742050-5697-1-git-send-email-bmeng.cn@gmail.com>", "Cc": "Stefan Roese <sr@denx.de>", "Subject": "[U-Boot] [PATCH 01/14] dm: usb: Fix broken usb_stop()", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "At present we only do device_remove() during usb stop. The DM API\ndevice_remove() only marks the device state as inactivated, but\nstill keeps its USB topology (eg: parent, children, etc) in the DM\ndevice structure. There is no issue if we only start USB subsystem\nonce and never stop it. But a big issue occurs when we do 'usb stop'\nand 'usb start' multiple times.\n\nStrange things may be observed with current implementation, like:\n- the enumeration may report only 1 mass storage device is detected,\n but the total number of USB devices is correct.\n- USB keyboard does not work anymore after a bunch of 'usb reset'\n even if 'usb tree' shows it is correctly identified.\n- read/write flash drive via 'fatload usb' may complain \"Bad device\"\n\nIn fact, every time when USB host controller starts the enumeration\nprocess, it takes random time for each USB port to show up online,\nhence each USB device may appear in a different order from previous\nenumeration, and gets assigned to a totally different USB address.\nAs a result, we end up using a stale USB topology in the DM device\nstructure which still reflects the previous enumeration result, and\nit may create an exact same DM device name like generic_bus_0_dev_7\nthat is already in the DM device structure. And since the DM device\nstructure is there, there is no device_bind() call to bind driver to\nthe device during current enumeration process, eventually creating\nan inconsistent software representation of the hardware topology, a\nnon-working USB subsystem.\n\nThe fix is to clear the unused USB topology in the usb_stop(), by\ncalling device_unbind() on each controller's root hub device, and\nthe unbinding will unbind all of its children automatically.\n\nSigned-off-by: Bin Meng <bmeng.cn@gmail.com>\n---\n\n drivers/usb/host/usb-uclass.c | 13 +++++++++++++\n 1 file changed, 13 insertions(+)", "diff": "diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c\nindex bc44fc3..e90614f 100644\n--- a/drivers/usb/host/usb-uclass.c\n+++ b/drivers/usb/host/usb-uclass.c\n@@ -164,6 +164,7 @@ int usb_get_max_xfer_size(struct usb_device *udev, size_t *size)\n int usb_stop(void)\n {\n \tstruct udevice *bus;\n+\tstruct udevice *rh;\n \tstruct uclass *uc;\n \tstruct usb_uclass_priv *uc_priv;\n \tint err = 0, ret;\n@@ -179,6 +180,18 @@ int usb_stop(void)\n \t\tret = device_remove(bus, DM_REMOVE_NORMAL);\n \t\tif (ret && !err)\n \t\t\terr = ret;\n+\n+\t\t/* Locate root hub device */\n+\t\tdevice_find_first_child(bus, &rh);\n+\t\tif (rh) {\n+\t\t\t/*\n+\t\t\t * All USB devices are children of root hub.\n+\t\t\t * Unbinding root hub will unbind all of its children.\n+\t\t\t */\n+\t\t\tret = device_unbind(rh);\n+\t\t\tif (ret && !err)\n+\t\t\t\terr = ret;\n+\t\t}\n \t}\n #ifdef CONFIG_BLK\n \tret = blk_unbind_all(IF_TYPE_USB);\n", "prefixes": [ "U-Boot", "01/14" ] }