{"id":808671,"url":"http://patchwork.ozlabs.org/api/patches/808671/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170901124203.19462-1-semen.protsenko@linaro.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","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":"<20170901124203.19462-1-semen.protsenko@linaro.org>","list_archive_url":null,"date":"2017-09-01T12:42:03","name":"[U-Boot,v3,1/1] usb: gadget: g_dnl: Sync internal SN variable with env","commit_ref":"de4e4edaffeeb56aeb9354662872cbbcaf46d4cd","pull_url":null,"state":"accepted","archived":false,"hash":"f6872be13ba9cb7cd3c9b657946ef42beacd67a2","submitter":{"id":68333,"url":"http://patchwork.ozlabs.org/api/people/68333/?format=json","name":"Sam Protsenko","email":"semen.protsenko@linaro.org"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170901124203.19462-1-semen.protsenko@linaro.org/mbox/","series":[{"id":1016,"url":"http://patchwork.ozlabs.org/api/series/1016/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=1016","date":"2017-09-01T12:42:03","name":"[U-Boot,v3,1/1] usb: gadget: g_dnl: Sync internal SN variable with env","version":3,"mbox":"http://patchwork.ozlabs.org/series/1016/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808671/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808671/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\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"kcp7yu90\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkJmC3HyZz9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 22:42:18 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid D1EABC21F02; Fri,  1 Sep 2017 12:42:12 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 06B48C21D19;\n\tFri,  1 Sep 2017 12:42:10 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid E5CE4C21D19; Fri,  1 Sep 2017 12:42:07 +0000 (UTC)","from mail-lf0-f53.google.com (mail-lf0-f53.google.com\n\t[209.85.215.53])\n\tby lists.denx.de (Postfix) with ESMTPS id 5377EC21C72\n\tfor <u-boot@lists.denx.de>; Fri,  1 Sep 2017 12:42:07 +0000 (UTC)","by mail-lf0-f53.google.com with SMTP id d202so340218lfd.5\n\tfor <u-boot@lists.denx.de>; Fri, 01 Sep 2017 05:42:07 -0700 (PDT)","from localhost ([195.238.92.132])\n\tby smtp.gmail.com with ESMTPSA id h89sm9548lji.56.2017.09.01.05.42.04\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 01 Sep 2017 05:42:04 -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=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\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=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id;\n\tbh=yCnCSXJFOquCkEsKzzsNnJ4NxP+twaxCpL4PsenLanE=;\n\tb=kcp7yu902qmmweYx4sk5Nbfe0biFgFMPC+BkLQdV4cehAFNLwS3WZ1CG5U4M8SSe3o\n\tGA8T7RiJO5rMzTD7QloSUaeh8InKaidKRMB+NKp00/GpthqRo0ydIZT4FJ0Ej/EmOzcS\n\tIntFUmVJcGHJL5gAIG1H2wsgdy5YPwGGPUoAs=","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;\n\tbh=yCnCSXJFOquCkEsKzzsNnJ4NxP+twaxCpL4PsenLanE=;\n\tb=ZUmwQ1K0rb/6WXw5nOZkm6T/DHpeKHAKJFnHEjqnJNakXpurNJt9tKI5Gv/aXO1t7R\n\tMWZjKZcMC3H+IEMR0aMXqvCvzK/86MryzfQt93/pUnHmjlVi4c33fQQi31681J6scI0l\n\tt7hjWkrZxrGY6z4UpJJ2kZmGxvJGQAeOlSti517QSDlA6y4Synrm2H8B/iLBhwasNNM4\n\tu+w+60m6/4iFtp7Ht7XptlipC1xuQswcrSVlgRiIgJ7GrYAYjE16eXDUQ4ZBZcuEm5tp\n\t0pIuhr1z3pKw1O4R8lLUMif/qoT3KtMhYZPlQB1gEAu/PiQ8N9RbFsEhSWwdpzQEjSJm\n\tIJhw==","X-Gm-Message-State":"AHPjjUibU8sGuTxvp3BXEG+vkp9d/CnWn+w81GfE43AfDbuk1gJdb01u\n\tgnoNzUqd2arZjuvPdxQJuw==","X-Google-Smtp-Source":"ADKCNb6/JZkiX4v2z6dDROkStYT7KE5c0eK44ZaSvaku8Nd0B8Yw4fZvpIyuUjn2B4COziSCemeLUw==","X-Received":"by 10.25.154.72 with SMTP id c69mr750398lfe.173.1504269726496;\n\tFri, 01 Sep 2017 05:42:06 -0700 (PDT)","From":"Sam Protsenko <semen.protsenko@linaro.org>","To":"u-boot@lists.denx.de","Date":"Fri,  1 Sep 2017 15:42:03 +0300","Message-Id":"<20170901124203.19462-1-semen.protsenko@linaro.org>","X-Mailer":"git-send-email 2.14.1","Cc":"Marek Vasut <marex@denx.de>, Tom Rini <trini@konsulko.com>,\n\tPraneeth Bajjuri <praneeth@ti.com>","Subject":"[U-Boot] [PATCH v3 1/1] usb: gadget: g_dnl: Sync internal SN\n\tvariable with env","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":"Since commit 842778a09104 (\"usb: gadget: g_dnl: only set iSerialNumber\nif we have a serial#\") \"fastboot devices\" stopped to show correct device\nserial number for TI boards, showing this line instead:\n\n    ????????????\tfastboot\n\nThis is because serial# env variable could be set after g_dnl gadget was\ninitialized (e.g. by using env_set() in the board file).\n\nTo fix this, let's update internal serial number variable (g_dnl_serial)\nwhen \"serial#\" env var is changed.\n\nSigned-off-by: Sam Protsenko <semen.protsenko@linaro.org>\nCc: Felipe Balbi <felipe.balbi@linux.intel.com>\n---\n drivers/usb/gadget/g_dnl.c | 15 +++++++++++++++\n include/env_callback.h     |  1 +\n 2 files changed, 16 insertions(+)","diff":"diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c\nindex 0491a0eea9..039331a5af 100644\n--- a/drivers/usb/gadget/g_dnl.c\n+++ b/drivers/usb/gadget/g_dnl.c\n@@ -19,6 +19,8 @@\n #include <dfu.h>\n #include <thor.h>\n \n+#include <env_callback.h>\n+\n #include \"gadget_chips.h\"\n #include \"composite.c\"\n \n@@ -202,6 +204,19 @@ static int g_dnl_get_bcd_device_number(struct usb_composite_dev *cdev)\n \treturn g_dnl_get_board_bcd_device_number(gcnum);\n }\n \n+/**\n+ * Update internal serial number variable when the \"serial#\" env var changes.\n+ *\n+ * Handle all cases, even when flags == H_PROGRAMMATIC or op == env_op_delete.\n+ */\n+static int on_serialno(const char *name, const char *value, enum env_op op,\n+\t\tint flags)\n+{\n+\tg_dnl_set_serialnumber((char *)value);\n+\treturn 0;\n+}\n+U_BOOT_ENV_CALLBACK(serialno, on_serialno);\n+\n static int g_dnl_bind(struct usb_composite_dev *cdev)\n {\n \tstruct usb_gadget *gadget = cdev->gadget;\ndiff --git a/include/env_callback.h b/include/env_callback.h\nindex 90b95b5e66..5c4a30c2de 100644\n--- a/include/env_callback.h\n+++ b/include/env_callback.h\n@@ -72,6 +72,7 @@\n \tSILENT_CALLBACK \\\n \tSPLASHIMAGE_CALLBACK \\\n \t\"stdin:console,stdout:console,stderr:console,\" \\\n+\t\"serial#:serialno,\" \\\n \tCONFIG_ENV_CALLBACK_LIST_STATIC\n \n struct env_clbk_tbl {\n","prefixes":["U-Boot","v3","1/1"]}