{"id":808669,"url":"http://patchwork.ozlabs.org/api/patches/808669/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170901120035.21024-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":"<20170901120035.21024-1-semen.protsenko@linaro.org>","list_archive_url":null,"date":"2017-09-01T12:00:35","name":"[U-Boot,v2,1/1] usb: gadget: g_dnl: Sync internal SN variable with env","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d122cbd1ee861918b18194a38d3d293b65167cec","submitter":{"id":68333,"url":"http://patchwork.ozlabs.org/api/people/68333/?format=json","name":"Sam Protsenko","email":"semen.protsenko@linaro.org"},"delegate":{"id":68827,"url":"http://patchwork.ozlabs.org/api/users/68827/?format=json","username":"lukma","first_name":"Lukasz","last_name":"Majewski","email":"lukma@denx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170901120035.21024-1-semen.protsenko@linaro.org/mbox/","series":[{"id":1014,"url":"http://patchwork.ozlabs.org/api/series/1014/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=1014","date":"2017-09-01T12:00:35","name":"[U-Boot,v2,1/1] usb: gadget: g_dnl: Sync internal SN variable with env","version":2,"mbox":"http://patchwork.ozlabs.org/series/1014/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808669/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808669/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=\"bCaEYXH4\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkHrr5Gf5z9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 22:01:16 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 1D0DEC21F0F; Fri,  1 Sep 2017 12:01:08 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 06BD1C21EBB;\n\tFri,  1 Sep 2017 12:01:06 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 57D71C21ECF; Fri,  1 Sep 2017 12:01:04 +0000 (UTC)","from mail-lf0-f44.google.com (mail-lf0-f44.google.com\n\t[209.85.215.44])\n\tby lists.denx.de (Postfix) with ESMTPS id 2D0E0C21EBB\n\tfor <u-boot@lists.denx.de>; Fri,  1 Sep 2017 12:00:38 +0000 (UTC)","by mail-lf0-f44.google.com with SMTP id y128so8382822lfd.4\n\tfor <u-boot@lists.denx.de>; Fri, 01 Sep 2017 05:00:38 -0700 (PDT)","from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id\n\tn76sm121530lja.79.2017.09.01.05.00.36\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 01 Sep 2017 05:00:36 -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=ACaYDubvK1bA9OKRJwtth3yw+ietN3n8n7tdgUbzylo=;\n\tb=bCaEYXH475ln7X0NNm3ArKnHkbK5CEO4v6Us9xj198ZxPpAbHBHQyir+HDmktfHYTS\n\tBzp4bXHRIRTE6nHzwjVRnnSWQlnPk+zNk9x2tKXCWZvgZQB3r0MoZeLEUA9/EAqtrWbv\n\t3ClxfPLraXMJV1R1FRgzDhfFwGeUNx+MzvCgc=","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=ACaYDubvK1bA9OKRJwtth3yw+ietN3n8n7tdgUbzylo=;\n\tb=GzPlthdBC7LGfayFe7PX0SmfWBQ8JMMb4zNzcHx/dxoI+lt+jTSdPjGNer1Y1JQehi\n\tGL9D9Frh2wttwqQVkJisBJ54JcoNWJyNAlxJ0RyMfqLaAf2FYs2ChzqzYSHT8U2kEz6D\n\ttJJNUzreYCmASaWePGRBxTlT79YjbY+NFPa061ef4wad8rIUg03DaQvVa4+BRQHWNBIT\n\tbNbJu7ND1jeWB5aMVFTjWz4dyQxYXvNnGlXxe7+WmtqWk5+DjYL011umBWks6jwNMvDR\n\tCwRBjAVDHM5LAee849FhkzYjYBCp91VLc06LFCu6caPJfrBqAcXUgemuLG0s8kM91qy6\n\t175A==","X-Gm-Message-State":"AHPjjUhRXDuDFbkghipsaO137oZFXvt/JU2P/shO0x7Y0zJNknRmmIq7\n\t6Cr875kRPMyjG74KZp5gJQ==","X-Google-Smtp-Source":"ADKCNb64W0JmeYfXbtyu+pyJDQsW9+dfWbCnwR70GiqscK+1XkBzElQn0CMUKe59INNhWhRnaPNtZA==","X-Received":"by 10.46.0.163 with SMTP id e35mr698089lji.114.1504267237250;\n\tFri, 01 Sep 2017 05:00:37 -0700 (PDT)","From":"Sam Protsenko <semen.protsenko@linaro.org>","To":"u-boot@lists.denx.de","Date":"Fri,  1 Sep 2017 15:00:35 +0300","Message-Id":"<20170901120035.21024-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 v2 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 | 24 ++++++++++++++++++++++++\n include/env_callback.h     |  1 +\n 2 files changed, 25 insertions(+)","diff":"diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c\nindex 0491a0eea9..1a9f075485 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,28 @@ 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, including when flags == H_PROGRAMMATIC.\n+ */\n+static int on_serialno(const char *name, const char *value, enum env_op op,\n+\t\tint flags)\n+{\n+\tswitch (op) {\n+\tcase env_op_create:\n+\t\t/* Fall through */\n+\tcase env_op_overwrite:\n+\t\tg_dnl_set_serialnumber((char *)value);\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\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","v2","1/1"]}